85 |
// |
// |
86 |
//-------------------------------------- |
//-------------------------------------- |
87 |
/** |
/** |
88 |
* Constructor |
* Default Constructor |
89 |
*/ |
*/ |
90 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
91 |
|
Initialize(); |
92 |
|
}; |
93 |
|
|
94 |
|
/** |
95 |
|
* Constructor with given dir, list and detectors |
96 |
|
*/ |
97 |
|
PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ |
98 |
|
Initialize(); |
99 |
|
GetPamTree(GetListOfLevel2Files(ddir,list),detlist); |
100 |
|
GetRunTree(GetListOfLevel2Files(ddir,list)); |
101 |
|
}; |
102 |
|
|
103 |
|
/** |
104 |
|
* Constructor with given dir and list |
105 |
|
*/ |
106 |
|
PamLevel2::PamLevel2(TString ddir,TString list){ |
107 |
|
Initialize(); |
108 |
|
GetPamTree(GetListOfLevel2Files(ddir,list),""); |
109 |
|
GetRunTree(GetListOfLevel2Files(ddir,list)); |
110 |
|
}; |
111 |
|
|
112 |
|
|
113 |
|
void PamLevel2::Initialize(){ |
114 |
|
|
115 |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
116 |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
142 |
|
|
143 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
144 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
145 |
irun = -1; |
irun = -1LL; |
146 |
runfirstentry = 0ULL; |
runfirstentry = 0LL; |
147 |
runlastentry = 0ULL; |
runlastentry = 0LL; |
148 |
|
|
149 |
l0_file = NULL; |
l0_file = NULL; |
150 |
l0_tree = NULL; |
l0_tree = NULL; |
153 |
|
|
154 |
prevshift = 0; |
prevshift = 0; |
155 |
|
|
|
irun = -1; |
|
156 |
run_tree = NULL; |
run_tree = NULL; |
157 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
158 |
sel_tree = NULL; |
sel_tree = NULL; |
159 |
sel_tree_clone = NULL; |
sel_tree_clone = NULL; |
160 |
|
|
161 |
irunentry = -1; |
irunentry = -1LL; |
162 |
pam_tree = NULL; |
pam_tree = NULL; |
163 |
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
164 |
|
|
241 |
} |
} |
242 |
|
|
243 |
if(l0_file)l0_file->Close(); |
if(l0_file)l0_file->Close(); |
244 |
if(pam_tree)pam_tree->Delete();; |
// if(pam_tree)pam_tree->Delete();; |
245 |
|
|
246 |
|
if ( pam_tree ){ |
247 |
|
// |
248 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
249 |
|
// |
250 |
|
TList *temp = pam_tree->GetListOfFriends(); |
251 |
|
TList *contents = new TList; // create chain friend list |
252 |
|
contents->SetOwner(); |
253 |
|
TIter next(temp); |
254 |
|
TChain *questo = 0; |
255 |
|
while ( (questo = (TChain*) next()) ){ |
256 |
|
TString name = questo->GetName(); |
257 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
258 |
|
}; |
259 |
|
// |
260 |
|
// deleting the main chain |
261 |
|
// |
262 |
|
pam_tree->Delete(); |
263 |
|
// |
264 |
|
// deleting the friends... |
265 |
|
// |
266 |
|
TIter next2(contents); |
267 |
|
TChain *questa = 0; |
268 |
|
while ( questa = (TChain*)next2() ){ |
269 |
|
TString name = questa->GetName(); |
270 |
|
questa->Delete(); |
271 |
|
questa=NULL; |
272 |
|
}; |
273 |
|
// |
274 |
|
}; |
275 |
|
pam_tree = NULL; |
276 |
|
|
277 |
if(run_tree)run_tree->Delete();; |
if(run_tree)run_tree->Delete();; |
278 |
if(sel_tree)sel_tree->Delete();; |
if(sel_tree)sel_tree->Delete();; |
279 |
for(Int_t i=0; i<NCLONES; i++ )if(pam_tree_clone[i])pam_tree_clone[i]->Delete();; |
for(Int_t i=0; i<NCLONES; i++ )if(pam_tree_clone[i])pam_tree_clone[i]->Delete();; |
299 |
// if(soft_obj) soft_obj->Clear(); |
// if(soft_obj) soft_obj->Clear(); |
300 |
|
|
301 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
302 |
if(trk0_obj) trk0_obj->Clear(); |
// if(trk0_obj) trk0_obj->Clear(); |
303 |
if(calo0_obj) calo0_obj->Clear(); |
if(calo0_obj) calo0_obj->Clear(); |
304 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
305 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
306 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
307 |
if(calo1_obj)calo1_obj->Clear(); |
if(calo1_obj)calo1_obj->Clear(); |
308 |
if(calo2_obj)calo2_obj->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
322 |
if(timage){ |
if(timage){ |
323 |
timage->Delete(); |
timage->Delete(); |
324 |
} |
} |
325 |
|
}; |
326 |
|
|
327 |
|
void PamLevel2::Reset(){ |
328 |
|
// |
329 |
|
// First of all clear everything |
330 |
|
// |
331 |
|
Clear(); |
332 |
|
// |
333 |
|
// close and reset chains and pointers |
334 |
|
// |
335 |
|
if ( pam_tree ){ |
336 |
|
// |
337 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
338 |
|
// |
339 |
|
TList *temp = pam_tree->GetListOfFriends(); |
340 |
|
TList *contents = new TList; // create chain friend list |
341 |
|
contents->SetOwner(); |
342 |
|
TIter next(temp); |
343 |
|
TChain *questo = 0; |
344 |
|
while ( (questo = (TChain*) next()) ){ |
345 |
|
TString name = questo->GetName(); |
346 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
347 |
|
}; |
348 |
|
// |
349 |
|
// deleting the main chain |
350 |
|
// |
351 |
|
pam_tree->Delete(); |
352 |
|
// |
353 |
|
// deleting the friends... |
354 |
|
// |
355 |
|
TIter next2(contents); |
356 |
|
TChain *questa = 0; |
357 |
|
while ( questa = (TChain*)next2() ){ |
358 |
|
TString name = questa->GetName(); |
359 |
|
questa->Delete(); |
360 |
|
questa=NULL; |
361 |
|
}; |
362 |
|
// |
363 |
|
}; |
364 |
|
pam_tree = NULL; |
365 |
|
// |
366 |
|
if(run_tree)run_tree->Delete();; |
367 |
|
run_tree = NULL; |
368 |
|
if(sel_tree)sel_tree->Delete();; |
369 |
|
sel_tree = NULL; |
370 |
|
// |
371 |
|
// Close file |
372 |
|
// |
373 |
|
if(l0_file)l0_file->Close("R"); |
374 |
|
l0_file = NULL; |
375 |
|
// |
376 |
|
h0_obj = 0; |
377 |
|
trk0_obj = 0; |
378 |
|
calo0_obj = 0; |
379 |
|
// |
380 |
|
trk2_obj = 0; |
381 |
|
trk1_obj = 0; |
382 |
|
trkh_obj = 0; |
383 |
|
calo1_obj = 0; |
384 |
|
calo2_obj = 0; |
385 |
|
tof_obj = 0; |
386 |
|
trig_obj = 0; |
387 |
|
s4_obj = 0; |
388 |
|
nd_obj = 0; |
389 |
|
ac_obj = 0; |
390 |
|
orb_obj = 0; |
391 |
|
// |
392 |
|
// Reset run pointers |
393 |
|
// |
394 |
|
run_obj = 0;//new GL_RUN(); |
395 |
|
soft_obj = 0;// Emiliano |
396 |
|
irun = -1; |
397 |
|
runfirstentry = 0ULL; |
398 |
|
runlastentry = 0ULL; |
399 |
|
// |
400 |
}; |
}; |
401 |
|
|
402 |
|
|
965 |
|
|
966 |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
967 |
// else GetWhichTrees(f); |
// else GetWhichTrees(f); |
968 |
|
if ( pam_tree ){ |
969 |
|
printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); |
970 |
|
return pam_tree; |
971 |
|
}; |
972 |
|
// |
973 |
|
|
974 |
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
975 |
|
|
976 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
1046 |
if(R && TRG) { |
if(R && TRG) { |
1047 |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1048 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
1049 |
if(!Trout)Trout=O; |
if(!Trout)Trout=R; |
1050 |
else Trout->AddFriend(R); |
else Trout->AddFriend(R); |
1051 |
}else{ |
}else{ |
1052 |
cout << "Trigger : missing tree"<<endl; |
cout << "Trigger : missing tree"<<endl; |
1056 |
if(S && S4) { |
if(S && S4) { |
1057 |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1058 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
1059 |
if(!Trout)Trout=O; |
if(!Trout)Trout=S; |
1060 |
else Trout->AddFriend(S); |
else Trout->AddFriend(S); |
1061 |
}else{ |
}else{ |
1062 |
cout << "S4 : missing tree"<<endl; |
cout << "S4 : missing tree"<<endl; |
1066 |
if(N && ND) { |
if(N && ND) { |
1067 |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
1068 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
1069 |
if(!Trout)Trout=O; |
if(!Trout)Trout=N; |
1070 |
else Trout->AddFriend(N); |
else Trout->AddFriend(N); |
1071 |
}else{ |
}else{ |
1072 |
cout << "NeutronD : missing tree"<<endl; |
cout << "NeutronD : missing tree"<<endl; |
1076 |
if(A && AC) { |
if(A && AC) { |
1077 |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
1078 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
1079 |
if(!Trout)Trout=O; |
if(!Trout)Trout=A; |
1080 |
else Trout->AddFriend(A); |
else Trout->AddFriend(A); |
1081 |
}else{ |
}else{ |
1082 |
cout << "Anticounter : missing tree"<<endl; |
cout << "Anticounter : missing tree"<<endl; |
1086 |
if(B && ORB) { |
if(B && ORB) { |
1087 |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1088 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1089 |
if(!Trout)Trout=O; |
if(!Trout)Trout=B; |
1090 |
else Trout->AddFriend(B); |
else Trout->AddFriend(B); |
1091 |
}else{ |
}else{ |
1092 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1128 |
|
|
1129 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
1130 |
|
|
1131 |
if(ddir=="")ddir = wdir; |
// if(ddir=="")ddir = wdir; |
1132 |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1133 |
cout << "Level2 data directory : "<< ddir << endl; |
if ( ddir != ""){ |
1134 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1135 |
|
} else { |
1136 |
|
cout << "Level2 data directory not given as input: trying to evaluate from list or taking working directory " << endl; |
1137 |
|
}; |
1138 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
1139 |
contents->SetOwner(); |
contents->SetOwner(); |
1140 |
|
|
1183 |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
1184 |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
1185 |
if( file.EndsWith(".root") ){ |
if( file.EndsWith(".root") ){ |
1186 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
TString filedir; |
1187 |
|
if (ddir != ""){ |
1188 |
|
filedir = ddir; // take the input dir |
1189 |
|
} else { |
1190 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
1191 |
|
filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir |
1192 |
|
}; |
1193 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); |
1194 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1195 |
delete fullpath; |
delete fullpath; |
1196 |
} |
} |
1200 |
}; |
}; |
1201 |
in.close(); |
in.close(); |
1202 |
} else { |
} else { |
1203 |
|
if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); |
1204 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1205 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1206 |
delete fullpath; |
delete fullpath; |
1210 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1211 |
cout << "Check for existing root files."<<endl; |
cout << "Check for existing root files."<<endl; |
1212 |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
1213 |
|
if ( ddir == "" ){ |
1214 |
|
ddir = wdir; |
1215 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1216 |
|
}; |
1217 |
|
|
1218 |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1219 |
TList *temp = datadir->GetListOfFiles(); |
TList *temp = datadir->GetListOfFiles(); |
1220 |
// temp->Print(); |
// temp->Print(); |
1258 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1259 |
*/ |
*/ |
1260 |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
1261 |
|
// |
1262 |
|
// |
1263 |
|
// |
1264 |
|
if ( pam_tree ){ |
1265 |
|
printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); |
1266 |
|
return pam_tree; |
1267 |
|
}; |
1268 |
|
// |
1269 |
|
|
1270 |
TChain *Trout =0; |
TChain *Trout =0; |
1271 |
|
|
1286 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1287 |
cout << endl; |
cout << endl; |
1288 |
|
|
1289 |
TChain *T = 0; |
TChain *T = 0; |
1290 |
TChain *C = 0; |
TChain *C = 0; |
1291 |
TChain *O = 0; |
TChain *O = 0; |
1292 |
TChain *R = 0; |
TChain *R = 0; |
1293 |
TChain *S = 0; |
TChain *S = 0; |
1294 |
TChain *N = 0; |
TChain *N = 0; |
1295 |
TChain *A = 0; |
TChain *A = 0; |
1296 |
TChain *B = 0; |
TChain *B = 0; |
1297 |
|
|
1298 |
TChain *L = 0; |
TChain *L = 0; |
1299 |
|
|
1300 |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
1301 |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
1305 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
1306 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
1307 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
|
|
|
1308 |
L = new TChain("SelectionList"); |
L = new TChain("SelectionList"); |
1309 |
|
|
1310 |
// loop over files and create chains |
// loop over files and create chains |
1324 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
1325 |
if(SELLI==1) L->Add(name); |
if(SELLI==1) L->Add(name); |
1326 |
}; |
}; |
1327 |
} |
}; |
1328 |
|
|
1329 |
cout << "done chain \n"; |
cout << "done chain \n"; |
1330 |
|
|
1341 |
// else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
1342 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
1343 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1344 |
else Trout->AddFriend("Tracker"); |
else Trout->AddFriend("Tracker"); |
1345 |
}else{ |
}else{ |
1346 |
cout << "Tracker : missing tree"<<endl; |
cout << "Tracker : missing tree"<<endl; |
1347 |
}; |
}; |
1614 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1615 |
*/ |
*/ |
1616 |
TChain *PamLevel2::GetRunTree(TList *fl){ |
TChain *PamLevel2::GetRunTree(TList *fl){ |
1617 |
|
// |
1618 |
TChain *R = new TChain("Run"); |
// |
1619 |
|
// |
1620 |
|
if ( run_tree ){ |
1621 |
|
printf("WARNING: TChain *PamLevel2::GetRunTree(TList *fl) -- run_tree already exists!\n "); |
1622 |
|
return run_tree; |
1623 |
|
}; |
1624 |
|
// |
1625 |
|
TChain *R = new TChain("Run"); |
1626 |
|
|
1627 |
// loop over files and create chains |
// loop over files and create chains |
1628 |
TIter next(fl); |
TIter next(fl); |
1661 |
* @return Pointer to a TTree |
* @return Pointer to a TTree |
1662 |
*/ |
*/ |
1663 |
TTree *PamLevel2::GetRunTree(TFile *f){ |
TTree *PamLevel2::GetRunTree(TFile *f){ |
1664 |
|
if ( run_tree ){ |
1665 |
|
printf("WARNING: TTree *PamLevel2::GetRunTree(TFile *f) -- run_tree already exists!\n "); |
1666 |
|
return run_tree; |
1667 |
|
}; |
1668 |
|
|
1669 |
|
|
1670 |
cout << "TTree *PamLevel2::GetRunTree(TFile *f) -- obsolte "<<endl; |
cout << "TTree *PamLevel2::GetRunTree(TFile *f) -- obsolte "<<endl; |
1671 |
|
|
1672 |
TTree *R = (TTree*)f->Get("Run"); |
TTree *T = (TTree*)f->Get("Run"); |
1673 |
|
|
1674 |
if(R){ |
if(T){ |
1675 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
T->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1676 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
1677 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
T->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1678 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1679 |
} |
} |
1680 |
|
|
1681 |
run_tree = (TChain*)R; |
run_tree = (TChain*)T; |
1682 |
|
|
1683 |
return R; |
return T; |
1684 |
|
|
1685 |
} |
} |
1686 |
/** |
/** |
1688 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
1689 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
1690 |
*/ |
*/ |
1691 |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev){ |
1692 |
// |
// |
1693 |
// check if we have already called once GetEntry, if not call it |
// check if we have already called once GetEntry, if not call it |
1694 |
// |
// |
1695 |
if ( run->GetEntries() <= 0 ) return(false); |
if(!run){ |
1696 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl; |
1697 |
|
return(false); |
1698 |
|
} |
1699 |
|
if ( run->GetEntries() <= 0 ) return(false); |
1700 |
// |
// |
1701 |
|
|
1702 |
Int_t oldrun = irun; |
// Int_t oldrun = irun; |
1703 |
|
Long64_t oldrun = irun; |
1704 |
|
|
1705 |
// -------------------------------------- |
// -------------------------------------- |
1706 |
// if it is a full file (not preselected) |
// if it is a full file (not preselected) |
1707 |
// -------------------------------------- |
// -------------------------------------- |
1708 |
if(SELLI==0){ |
if(SELLI==0){ |
|
if ( irun < 0 ){ |
|
|
irun = 0; |
|
|
run->GetEntry(irun); |
|
|
runfirstentry = 0ULL; |
|
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
|
|
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL; |
|
|
return(true); |
|
|
}; |
|
1709 |
|
|
1710 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() ){ |
1711 |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
1712 |
return(false); |
return(false); |
1713 |
} |
} |
1714 |
|
|
1715 |
|
if ( irun < 0LL ){ |
1716 |
|
irun = 0LL; |
1717 |
|
run->GetEntry(irun); |
1718 |
|
runfirstentry = 0LL; |
1719 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1720 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
1721 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1722 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1723 |
|
// return(true); |
1724 |
|
}; |
1725 |
|
// |
1726 |
|
if ( irun == run->GetEntries()-1LL && |
1727 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
1728 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
1729 |
|
){ |
1730 |
|
irun = -1LL; |
1731 |
|
runfirstentry = 0LL; |
1732 |
|
runlastentry = -1LL; |
1733 |
|
}; |
1734 |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
1735 |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
1736 |
// |
// |
1737 |
bool fromfirst = true; |
bool fromfirst = true; |
1738 |
// |
// |
1739 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){ |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ |
1740 |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
1741 |
irun++; |
irun++; |
1742 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1743 |
runfirstentry = runlastentry; |
runfirstentry = runlastentry; |
1744 |
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runfirstentry += 1ULL; |
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; |
1745 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1746 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1747 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1748 |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
1749 |
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
1750 |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
1751 |
// |
// |
1752 |
prevshift = 0; |
// prevshift = 0; |
1753 |
// |
// |
1754 |
if ( irun == run->GetEntries()-1 && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
1755 |
// printf(" resetting irun \n"); |
printf(" resetting irun (it should NOT happen!!!)\n"); |
1756 |
fromfirst = false; |
fromfirst = false; |
1757 |
irun = 0; |
irun = 0; |
1758 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1759 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
1760 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1761 |
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL; |
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
1762 |
}; |
}; |
1763 |
// |
// |
1764 |
}; |
}; |
1765 |
// |
// |
1766 |
if ( !fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) ) printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
if ( |
1767 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
1768 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
1769 |
|
) { |
1770 |
|
printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
1771 |
|
return false; |
1772 |
|
} |
1773 |
// |
// |
1774 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1775 |
// |
// |
1776 |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
1777 |
// |
// |
1778 |
|
prevshift = 0; |
1779 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1780 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1781 |
return(true); |
return(true); |
1782 |
}; |
}; |
1783 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
1786 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
1787 |
if(SELLI==1){ |
if(SELLI==1){ |
1788 |
sel_tree->GetEntry(iev); |
sel_tree->GetEntry(iev); |
1789 |
|
// cout << irun << " "<< irunentry << endl; |
1790 |
if(irun != oldrun){ |
if(irun != oldrun){ |
1791 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1792 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1793 |
|
prevshift = 0; |
1794 |
return true; |
return true; |
1795 |
} |
} |
1796 |
return false; |
return false; |
1799 |
return false; |
return false; |
1800 |
// |
// |
1801 |
}; |
}; |
1802 |
|
|
1803 |
|
// Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev){ |
1804 |
|
// // |
1805 |
|
// // check if we have already called once GetEntry, if not call it |
1806 |
|
// // |
1807 |
|
// if(!run_tree){ |
1808 |
|
// cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl; |
1809 |
|
// return false; |
1810 |
|
// } |
1811 |
|
// if ( run_tree->GetEntries() <= 0 ) { |
1812 |
|
// cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl; |
1813 |
|
// return(false); |
1814 |
|
// } |
1815 |
|
// // |
1816 |
|
|
1817 |
|
// Int_t oldrun = irun; |
1818 |
|
// // -------------------------------------- |
1819 |
|
// // if it is a full file (not preselected) |
1820 |
|
// // -------------------------------------- |
1821 |
|
// if(SELLI==0){ |
1822 |
|
|
1823 |
|
// if( !GetOrbitalInfo() ){ |
1824 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
1825 |
|
// return(false); |
1826 |
|
// } |
1827 |
|
|
1828 |
|
// if ( irun < 0 ){ |
1829 |
|
// irun = 0; |
1830 |
|
// run_tree->GetEntry(irun); |
1831 |
|
// runfirstentry = iev; |
1832 |
|
// if( iev != 0){ |
1833 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- WARNING -- "<<endl; |
1834 |
|
// } |
1835 |
|
// }; |
1836 |
|
|
1837 |
|
// bool fromfirst = true; |
1838 |
|
|
1839 |
|
// while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){ |
1840 |
|
// irun++; |
1841 |
|
// if( irun == run->GetEntries() ){ |
1842 |
|
// if(!fromfirst){ |
1843 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl; |
1844 |
|
// return false; |
1845 |
|
// } |
1846 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- reached end of run tree. searchin again from beginning (should not happen)" <<endl; |
1847 |
|
// fromfirst = false; |
1848 |
|
// irun =0; |
1849 |
|
// } |
1850 |
|
// run_tree->GetEntry(irun); |
1851 |
|
// runfirstentry = iev; |
1852 |
|
// }; |
1853 |
|
// // |
1854 |
|
// if ( irun == oldrun ) return(false); |
1855 |
|
// // |
1856 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1857 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1858 |
|
// prevshift = 0; |
1859 |
|
// return(true); |
1860 |
|
// }; |
1861 |
|
// // ---------------------------------------------------- |
1862 |
|
// // if it is a preselected file (there is SelectionList) |
1863 |
|
// // NBNB - the event tree MUST be read first |
1864 |
|
// // ---------------------------------------------------- |
1865 |
|
// if(SELLI==1){ |
1866 |
|
// sel_tree->GetEntry(iev); |
1867 |
|
// if(irun != oldrun){ |
1868 |
|
// run->GetEntry(irun); |
1869 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1870 |
|
// prevshift = 0; |
1871 |
|
// return true; |
1872 |
|
// } |
1873 |
|
// return false; |
1874 |
|
// } |
1875 |
|
|
1876 |
|
// return false; |
1877 |
|
// // |
1878 |
|
// }; |
1879 |
/** |
/** |
1880 |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
1881 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
1882 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
1883 |
*/ |
*/ |
1884 |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev){ |
1885 |
return(UpdateRunInfo((TChain*)run,iev)); |
return(UpdateRunInfo((TChain*)run,iev)); |
1886 |
}; |
}; |
1887 |
|
|
2520 |
|
|
2521 |
|
|
2522 |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
2523 |
sel_tree_clone->Branch("RunEntry",&irun,"runentry/I"); |
sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
2524 |
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/I"); |
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); |
2525 |
|
|
2526 |
|
|
2527 |
Int_t i=0; |
Int_t i=0; |
2661 |
/** |
/** |
2662 |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
2663 |
*/ |
*/ |
2664 |
Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
2665 |
|
Int_t PamLevel2::GetEntry(Long64_t iee){ |
2666 |
|
|
2667 |
if(!pam_tree){ |
if(!pam_tree){ |
2668 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
2678 |
// return 0; |
// return 0; |
2679 |
// } |
// } |
2680 |
|
|
2681 |
Int_t ii=0; |
Long64_t ii=0; |
2682 |
//------------------------------- |
//------------------------------- |
2683 |
ii = iee; |
ii = iee; |
2684 |
if( !pam_tree->GetEntry(ii) ) return 0; |
if( !pam_tree->GetEntry(ii) ){ |
2685 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
2686 |
|
return 0; |
2687 |
|
} |
2688 |
// |
// |
2689 |
// ... that's way I put it here. Notice that nothing change in the code (is backward compatible) since in any case you return with 0. |
// ... that's way I put it here. Notice that nothing change in the code (is backward compatible) since in any case you return with 0. |
2690 |
// in theory one would like to return 1 if run is not loaded but now I don't have the will to add that 2 lines of code and it is not |
// in theory one would like to return 1 if run is not loaded but now I don't have the will to add that 2 lines of code and it is not |
2701 |
|
|
2702 |
//------------------------------- |
//------------------------------- |
2703 |
ii = iee; |
ii = iee; |
2704 |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
2705 |
|
Bool_t UPDATED = UpdateRunInfo(ii); |
2706 |
if(SELLI==0)irunentry = iee-runfirstentry; |
if(SELLI==0)irunentry = iee-runfirstentry; |
2707 |
if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
2708 |
|
|
2728 |
// check if iroot has changed |
// check if iroot has changed |
2729 |
//=================================== |
//=================================== |
2730 |
if( irun<0 ){ |
if( irun<0 ){ |
2731 |
cout << "PamLevel2::GetYodaTree() -- ERROR "<<endl; |
cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = "<<irun<<endl; |
2732 |
cout << "In order to use this method you have to load the RunInfo tree "<<endl; |
// cout << "In order to use this method you have to first load the RunInfo tree "<<endl; |
|
cout << "with the method TChain* PamLevel2::GetRunTree(TString, TString)"<<endl; |
|
|
// cout << " - read the event with PamLevel2::GetEntry(Int_t)"<<endl; |
|
2733 |
return NULL; |
return NULL; |
2734 |
} |
} |
2735 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
2813 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
2814 |
} |
} |
2815 |
|
|
2816 |
if ( TRK0 ) TrkParams::SetCalib(run_obj,dbc); |
if ( TRK0 ){ |
2817 |
|
TrkParams::Load(6); |
2818 |
|
if( !TrkParams::IsLoaded(6) ){ |
2819 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
2820 |
|
}; |
2821 |
|
TrkParams::SetCalib(run_obj,dbc); |
2822 |
|
TrkParams::LoadCalib( ); |
2823 |
|
if( !TrkParams::CalibIsLoaded() ){ |
2824 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
2825 |
|
}; |
2826 |
|
} |
2827 |
|
|
2828 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
2829 |
|
|
2840 |
if(!GetYodaTree())return 0; |
if(!GetYodaTree())return 0; |
2841 |
|
|
2842 |
// patch |
// patch |
2843 |
if( (Int_t)irunentry < 0){ |
if( irunentry < 0){ |
2844 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
2845 |
irunentry=0; |
irunentry=0LL; |
2846 |
} |
} |
2847 |
// --------------------------------- |
// --------------------------------- |
2848 |
// if file is NOT a preselected file |
// if file is NOT a preselected file |
2849 |
// --------------------------------- |
// --------------------------------- |
2850 |
UInt_t quellagiusta = irunentry + run_obj->EV_FROM; |
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); |
2851 |
|
|
2852 |
|
|
2853 |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
2859 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
2860 |
return 0; |
return 0; |
2861 |
} |
} |
2862 |
|
if( GetOrbitalInfo()->OBT==0 && GetOrbitalInfo()->pkt_num==0 ){ |
2863 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl; |
2864 |
|
return 0; |
2865 |
|
} |
2866 |
|
|
2867 |
// --------------------------------------------------------------------- |
// --------------------------------------------------------------------- |
2868 |
// ATTENTION!!! |
// ATTENTION!!! |
2880 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
2881 |
do{ |
do{ |
2882 |
if(shift>0){ |
if(shift>0){ |
2883 |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
2884 |
} |
} |
2885 |
answer = l0_tree->GetEntry(quellagiusta+shift+prevshift); |
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
2886 |
shift++; |
shift++; |
2887 |
if( !GetEventHeader() ){ |
if( !GetEventHeader() ){ |
2888 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
2889 |
return 0; |
return 0; |
2890 |
} |
} |
2891 |
|
// cout << "PKTNUM "<<shift<<" == L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
2892 |
|
// cout << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
2893 |
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
2894 |
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
2895 |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
2897 |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
2898 |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
2899 |
// |
// |
2900 |
if ( prevshift != 0 && (quellagiusta+shift) == GetYodaTree()->GetEntries() ){ |
if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){ |
2901 |
prevshift = 0; |
prevshift = 0; |
2902 |
shift = -1; |
shift = -1; |
2903 |
}; |
}; |
2904 |
|
|
2905 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() ); |
2906 |
|
|
2907 |
if ( (quellagiusta+shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl; |
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl; |
2908 |
|
|
2909 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
2910 |
// return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |