| 113 |
orb_obj = 0; |
orb_obj = 0; |
| 114 |
|
|
| 115 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
| 116 |
|
soft_obj = 0;// Emiliano |
| 117 |
|
irun = -1; |
| 118 |
|
runfirstentry = 0ULL; |
| 119 |
|
runlastentry = 0ULL; |
| 120 |
|
|
| 121 |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
| 122 |
|
|
| 146 |
void PamLevel2::Delete(){ |
void PamLevel2::Delete(){ |
| 147 |
|
|
| 148 |
if(run_obj)delete run_obj; |
if(run_obj)delete run_obj; |
| 149 |
|
if(soft_obj)delete soft_obj; //Emiliano |
| 150 |
|
|
| 151 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
| 152 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
| 177 |
void PamLevel2::Clear(){ |
void PamLevel2::Clear(){ |
| 178 |
|
|
| 179 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
| 180 |
if(run_obj)delete run_obj; |
|
| 181 |
|
// |
| 182 |
|
// This method is called once for every entry but RunInfo and SoftInfo do not change until the next run so we cannot clear them here unless we don't |
| 183 |
|
// want to load them for each event even if they are the same... |
| 184 |
|
// |
| 185 |
|
// if(run_obj)delete run_obj; |
| 186 |
|
// if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
| 187 |
|
// if(soft_obj) soft_obj->Clear(); |
| 188 |
|
|
| 189 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
| 190 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
| 220 |
TString objname = c; |
TString objname = c; |
| 221 |
|
|
| 222 |
if(!objname.CompareTo("TrkLevel1")) { |
if(!objname.CompareTo("TrkLevel1")) { |
| 223 |
if(!trk1_obj) trk1_obj = new TrkLevel1(); |
if(!trk1_obj){ |
| 224 |
|
trk1_obj = new TrkLevel1(); |
| 225 |
|
trk1_obj->Set(); |
| 226 |
|
} |
| 227 |
return &trk1_obj; |
return &trk1_obj; |
| 228 |
}; |
}; |
| 229 |
if(!objname.CompareTo("TrkLevel2")) { |
if(!objname.CompareTo("TrkLevel2")) { |
| 230 |
if(!trk2_obj) trk2_obj = new TrkLevel2(); |
if(!trk2_obj){ |
| 231 |
|
trk2_obj = new TrkLevel2(); |
| 232 |
|
trk2_obj->Set(); |
| 233 |
|
} |
| 234 |
return &trk2_obj; |
return &trk2_obj; |
| 235 |
}; |
}; |
| 236 |
if(!objname.CompareTo("TrkHough")) { |
if(!objname.CompareTo("TrkHough")) { |
| 242 |
return &calo1_obj; |
return &calo1_obj; |
| 243 |
}; |
}; |
| 244 |
if(!objname.CompareTo("CaloLevel2")) { |
if(!objname.CompareTo("CaloLevel2")) { |
| 245 |
if(!calo2_obj) calo2_obj = new CaloLevel2(); |
if(!calo2_obj){ |
| 246 |
|
calo2_obj = new CaloLevel2(); |
| 247 |
|
calo2_obj->Set(); |
| 248 |
|
}; |
| 249 |
return &calo2_obj; |
return &calo2_obj; |
| 250 |
}; |
}; |
| 251 |
if(!objname.CompareTo("ToFLevel2")) { |
if(!objname.CompareTo("ToFLevel2")) { |
| 252 |
if(!tof_obj) tof_obj = new ToFLevel2(); |
if(!tof_obj){ |
| 253 |
|
tof_obj = new ToFLevel2(); |
| 254 |
|
tof_obj->Set(); |
| 255 |
|
} |
| 256 |
return &tof_obj; |
return &tof_obj; |
| 257 |
}; |
}; |
| 258 |
if(!objname.CompareTo("TrigLevel2")) { |
if(!objname.CompareTo("TrigLevel2")) { |
| 277 |
}; |
}; |
| 278 |
|
|
| 279 |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
| 280 |
|
|
| 281 |
|
if(!objname.CompareTo("SoftInfo"))return &soft_obj; // Emiliano |
| 282 |
|
|
| 283 |
return NULL; |
return NULL; |
| 284 |
}; |
}; |
| 285 |
//-------------------------------------- |
//-------------------------------------- |
| 920 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
| 921 |
contents->SetOwner(); |
contents->SetOwner(); |
| 922 |
|
|
| 923 |
char *fullpath; |
// char *fullpath; |
| 924 |
|
// const char *fullpath; |
| 925 |
|
|
| 926 |
// if no input file list is given: |
// if no input file list is given: |
| 927 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
| 928 |
|
|
| 929 |
if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
| 930 |
cout <<"File "<<flisttxt<<" not found"<<endl; |
// if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){ |
| 931 |
return 0; |
// cout <<"File "<<flisttxt<<" not found"<<endl; |
| 932 |
} |
// return 0; |
| 933 |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
// } |
| 934 |
flisttxt = fullpath; |
// flisttxt = fullpath; |
| 935 |
|
|
| 936 |
|
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 937 |
|
|
| 938 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
| 939 |
cout << "Cannot change directory : "<<ddir<<endl; |
cout << "Cannot change directory : "<<ddir<<endl; |
| 940 |
return 0; |
return 0; |
| 943 |
cout <<"Input file list : " << flisttxt <<endl; |
cout <<"Input file list : " << flisttxt <<endl; |
| 944 |
ifstream in; |
ifstream in; |
| 945 |
in.open(flisttxt, ios::in); //open input file list |
in.open(flisttxt, ios::in); //open input file list |
| 946 |
|
if(!in.good()){ |
| 947 |
|
cout <<" ERROR opening the file "<<endl; |
| 948 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
| 949 |
|
return 0; |
| 950 |
|
} |
| 951 |
int line=0; |
int line=0; |
| 952 |
while (1) { |
while (1) { |
| 953 |
TString file; |
TString file; |
| 961 |
} |
} |
| 962 |
if(file.Contains("#"))file = file(0,file.First("#")); |
if(file.Contains("#"))file = file(0,file.First("#")); |
| 963 |
// cout <<"(2) " << file << endl; |
// cout <<"(2) " << file << endl; |
| 964 |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
| 965 |
|
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
| 966 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
| 967 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
| 968 |
}else{ |
delete fullpath; |
| 969 |
|
// }else{ |
| 970 |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
| 971 |
}; |
// }; |
| 972 |
}; |
}; |
| 973 |
in.close(); |
in.close(); |
| 974 |
|
|
| 990 |
while ( (questo = (TSystemFile*) next()) ) { |
while ( (questo = (TSystemFile*) next()) ) { |
| 991 |
TString name = questo-> GetName(); |
TString name = questo-> GetName(); |
| 992 |
if( name.EndsWith(".root") ){ |
if( name.EndsWith(".root") ){ |
| 993 |
char *fullpath; |
// const char *fullpath = gSystem->FindFile(ddir,name); |
| 994 |
gSystem->IsFileInIncludePath(name,&fullpath); |
// char *fullpath; |
| 995 |
|
// gSystem->IsFileInIncludePath(name,&fullpath); |
| 996 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(name)); |
| 997 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
| 998 |
|
delete fullpath; |
| 999 |
}; |
}; |
| 1000 |
} |
} |
| 1001 |
delete temp; |
delete temp; |
| 1005 |
gSystem->ChangeDirectory(wdir); // back to the working directory |
gSystem->ChangeDirectory(wdir); // back to the working directory |
| 1006 |
// cout << endl << "Selected files:" << endl; |
// cout << endl << "Selected files:" << endl; |
| 1007 |
// contents->Print(); |
// contents->Print(); |
| 1008 |
cout << contents->GetEntries()<<" files selected\n"; |
cout << contents->GetEntries()<<" files \n"; |
| 1009 |
// cout << endl; |
// cout << endl; |
| 1010 |
// cout << "Working directory: "<< gSystem->WorkingDirectory()<< endl; |
// cout << "Working directory: "<< gSystem->WorkingDirectory()<< endl; |
| 1011 |
return contents; |
return contents; |
| 1396 |
|
|
| 1397 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1398 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
| 1399 |
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
| 1400 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
| 1401 |
|
|
| 1402 |
return R; |
return R; |
| 1403 |
|
|
| 1418 |
|
|
| 1419 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1420 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
| 1421 |
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
| 1422 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
| 1423 |
|
|
| 1424 |
return R; |
return R; |
| 1425 |
|
|
| 1426 |
} |
} |
| 1427 |
|
/** |
| 1428 |
|
* Update the runinfo informations (to be used to have Run infos event by event basis) |
| 1429 |
|
* @param run Pointer to the chain/tree which contains run infos |
| 1430 |
|
* @return true if a new run has been read, false if it is still the same run |
| 1431 |
|
*/ |
| 1432 |
|
Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){ |
| 1433 |
|
// |
| 1434 |
|
// check if we have already called once GetEntry, if not call it |
| 1435 |
|
// |
| 1436 |
|
if ( run->GetEntries() <= 0 ) return(false); |
| 1437 |
|
// |
| 1438 |
|
Int_t oldrun = irun; |
| 1439 |
|
if ( irun < 0 ){ |
| 1440 |
|
irun = 0; |
| 1441 |
|
run->GetEntry(0); |
| 1442 |
|
runfirstentry = 0ULL; |
| 1443 |
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
| 1444 |
|
}; |
| 1445 |
|
while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
| 1446 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
| 1447 |
|
irun++; |
| 1448 |
|
run->GetEntry(irun); |
| 1449 |
|
runfirstentry = runlastentry+1ULL; |
| 1450 |
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
| 1451 |
|
}; |
| 1452 |
|
// |
| 1453 |
|
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
| 1454 |
|
// |
| 1455 |
|
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
| 1456 |
|
// |
| 1457 |
|
return(true); |
| 1458 |
|
// |
| 1459 |
|
}; |
| 1460 |
|
/** |
| 1461 |
|
* Update the runinfo informations (to be used to have Run infos event by event basis) |
| 1462 |
|
* @param run Pointer to the chain/tree which contains run infos |
| 1463 |
|
* @return true if a new run has been read, false if it is still the same run |
| 1464 |
|
*/ |
| 1465 |
|
Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){ |
| 1466 |
|
return(UpdateRunInfo((TChain*)run,iev)); |
| 1467 |
|
}; |
| 1468 |
|
|
| 1469 |
//-------------------------------------- |
//-------------------------------------- |
| 1470 |
// |
// |
| 1471 |
// |
// |