397 |
* If no options are specified, the default is assumed. Default is: |
* If no options are specified, the default is assumed. Default is: |
398 |
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
399 |
*/ |
*/ |
400 |
PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ |
PamLevel2::PamLevel2(TString ddir,TString llist,TString detlist){ |
401 |
Initialize(); |
Initialize(); |
402 |
TList* listf = GetListOfLevel2Files(ddir,list); |
TList* listf = GetListOfLevel2Files(ddir,llist); |
403 |
GetPamTree(listf,detlist); |
if(listf)GetPamTree(listf,detlist); |
404 |
GetRunTree(listf); |
if(listf)GetRunTree(listf); |
405 |
}; |
}; |
406 |
|
|
407 |
PamLevel2::PamLevel2(TString ddir,TList *list,TString detlist){ |
PamLevel2::PamLevel2(TString ddir,TList *llist,TString detlist){ |
408 |
Initialize(); |
Initialize(); |
409 |
GetPamTree(list,detlist); |
GetPamTree(llist,detlist); |
410 |
GetRunTree(list); |
GetRunTree(llist); |
411 |
}; |
}; |
412 |
/** |
/** |
413 |
* Constructor |
* Constructor |
416 |
* Default trees/branches are loaded. Default is: |
* Default trees/branches are loaded. Default is: |
417 |
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
418 |
*/ |
*/ |
419 |
PamLevel2::PamLevel2(TString ddir,TString list){ |
PamLevel2::PamLevel2(TString ddir,TString llist){ |
420 |
Initialize(); |
Initialize(); |
421 |
TList* listf = GetListOfLevel2Files(ddir,list); |
TList* listf = GetListOfLevel2Files(ddir,llist); |
422 |
GetPamTree(listf,""); |
GetPamTree(listf,""); |
423 |
GetRunTree(listf); |
GetRunTree(listf); |
424 |
}; |
}; |
1867 |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
1868 |
|
|
1869 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
1870 |
|
// cout << "Working directory: "<<wdir<<endl; |
1871 |
|
|
1872 |
// if(ddir=="")ddir = wdir; |
// if(ddir=="")ddir = wdir; |
1873 |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1874 |
if ( ddir != ""){ |
if ( ddir != ""){ |
1893 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
1894 |
if ( !flisttxt.EndsWith(".root") ){ |
if ( !flisttxt.EndsWith(".root") ){ |
1895 |
|
|
1896 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
TString dir = gSystem->DirName(flisttxt); |
1897 |
|
// cout << " List directory "<<dir<<endl; |
1898 |
|
if(dir == "." || dir == "") |
1899 |
|
flisttxt = gSystem->ConcatFileName(wdir.Data(),gSystem->BaseName(flisttxt)); |
1900 |
|
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1901 |
|
|
1902 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
1903 |
cout << "Cannot change directory : "<<ddir<<endl; |
cout << "Cannot change directory : "<<ddir<<endl; |
1908 |
ifstream in; |
ifstream in; |
1909 |
in.open(flisttxt, ios::in); //open input file list |
in.open(flisttxt, ios::in); //open input file list |
1910 |
if(!in.good()){ |
if(!in.good()){ |
1911 |
cout <<" ERROR opening the file "<<endl; |
cout <<" TList* PamLevel2::GetListOfLevel2Files(TString, TString) --> ERROR opening the file "<<endl; |
1912 |
gSystem->ChangeDirectory(wdir); // back to the working directory |
gSystem->ChangeDirectory(wdir); // back to the working directory |
1913 |
return 0; |
return 0; |
1914 |
} |
} |
1962 |
|
|
1963 |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1964 |
TList *temp = datadir->GetListOfFiles(); |
TList *temp = datadir->GetListOfFiles(); |
1965 |
|
if(!temp)return 0; |
1966 |
// temp->Print(); |
// temp->Print(); |
1967 |
// cout << "*************************************" << endl; |
// cout << "*************************************" << endl; |
1968 |
|
|
2786 |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
2787 |
if ( gltsync ) delete gltsync; // Emiliano |
if ( gltsync ) delete gltsync; // Emiliano |
2788 |
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano |
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano |
2789 |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); // Emiliano |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc,false); // Emiliano |
2790 |
if ( dbc ) dbc->Close(); // Emiliano |
if ( dbc ) dbc->Close(); // Emiliano |
2791 |
if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano |
if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano |
2792 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
3129 |
} |
} |
3130 |
|
|
3131 |
TList *lk = f->GetListOfKeys(); |
TList *lk = f->GetListOfKeys(); |
3132 |
|
if(!lk)return; |
3133 |
TIter next(lk); |
TIter next(lk); |
3134 |
TKey *key =0; |
TKey *key =0; |
3135 |
|
|
3452 |
if(GP){ |
if(GP){ |
3453 |
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
3454 |
if( nev && nevt!=nev){ |
if( nev && nevt!=nev){ |
3455 |
cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
cout << "File: "<< f->GetName() <<" discarded ---- h20 tree has "<<nevt<<" events instead of "<<nev<< endl; |
3456 |
return false; |
return false; |
3457 |
} |
} |
3458 |
nev=nevt; |
nev=nevt; |
3744 |
}; |
}; |
3745 |
// GPamela |
// GPamela |
3746 |
if(GP) { |
if(GP) { |
3747 |
pam_tree_clone[i] = new TTree("h20","PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("h20","GPAMELA info "); |
3748 |
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
3749 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3750 |
i++; |
i++; |
3840 |
//------------------------------- |
//------------------------------- |
3841 |
ii = iee; |
ii = iee; |
3842 |
if( !pam_tree->GetEntry(ii) ){ |
if( !pam_tree->GetEntry(ii) ){ |
3843 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
3844 |
return 0; |
return 0; |
3845 |
} |
} |
|
|
|
3846 |
// |
// |
3847 |
// ... 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. |
3848 |
// 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 |