100 |
// nd_obj = NDLevel2::GetNDLevel2(); |
// nd_obj = NDLevel2::GetNDLevel2(); |
101 |
// ac_obj = AcLevel2::GetAcLevel2(); |
// ac_obj = AcLevel2::GetAcLevel2(); |
102 |
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
103 |
|
|
104 |
|
h0_obj = 0; |
105 |
|
trk0_obj = 0; |
106 |
|
|
107 |
trk2_obj = 0; |
trk2_obj = 0; |
108 |
trk1_obj = 0; |
trk1_obj = 0; |
109 |
trkh_obj = 0; |
trkh_obj = 0; |
122 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
123 |
runlastentry = 0ULL; |
runlastentry = 0ULL; |
124 |
|
|
125 |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
l0_file = NULL; |
126 |
|
l0_tree = NULL; |
127 |
|
iroot = -1; |
128 |
|
dbc = 0; |
129 |
|
|
130 |
|
irun = -1; |
131 |
|
run_tree = NULL; |
132 |
|
run_tree_clone = NULL; |
133 |
|
sel_tree = NULL; |
134 |
|
sel_tree_clone = NULL; |
135 |
|
|
136 |
|
irunentry = -1; |
137 |
|
pam_tree = NULL; |
138 |
|
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
139 |
|
|
140 |
|
host = "mysql://localhost/pamelaprod"; |
141 |
|
user = "anonymous"; |
142 |
|
psw = ""; |
143 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
144 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
145 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
146 |
|
if ( !pamdbhost ) pamdbhost = ""; |
147 |
|
if ( !pamdbuser ) pamdbuser = ""; |
148 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
149 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
150 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
151 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
152 |
|
|
153 |
|
|
154 |
|
|
155 |
// sorted_tracks = 0;//new TRefArray(); |
// sorted_tracks = 0;//new TRefArray(); |
156 |
|
|
157 |
|
CAL0 = false; |
158 |
CAL1 = true; |
CAL1 = true; |
159 |
CAL2 = true; |
CAL2 = true; |
160 |
TRK2 = true; |
TRK2 = true; |
161 |
TRK1 = false; |
TRK1 = false; |
162 |
TRKh = false; |
TRKh = false; |
163 |
TRG = true; |
TRKh = false; |
164 |
TOF = true; |
TRG = true; |
165 |
S4 = true; |
TOF = true; |
166 |
ND = true; |
TOF0 = false; |
167 |
AC = true; |
S4 = true; |
168 |
ORB = true; |
ND = true; |
169 |
|
AC = true; |
170 |
|
ORB = true; |
171 |
|
|
172 |
RUN = true; |
RUN = true; |
173 |
|
|
174 |
|
SELLI = -1; |
175 |
|
|
176 |
tsorted=0; |
tsorted=0; |
177 |
timage=0; |
timage=0; |
186 |
if(soft_obj)delete soft_obj; //Emiliano |
if(soft_obj)delete soft_obj; //Emiliano |
187 |
|
|
188 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
189 |
|
if(h0_obj) delete h0_obj; |
190 |
|
if(trk0_obj) delete trk0_obj; |
191 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
192 |
if(trk2_obj) delete trk2_obj; |
if(trk2_obj) delete trk2_obj; |
193 |
if(trkh_obj) delete trkh_obj; |
if(trkh_obj) delete trkh_obj; |
208 |
timage->Delete(); |
timage->Delete(); |
209 |
delete timage; |
delete timage; |
210 |
} |
} |
211 |
|
|
212 |
|
if(dbc){ |
213 |
|
dbc->Close(); |
214 |
|
delete dbc; |
215 |
|
} |
216 |
|
|
217 |
|
if(l0_file)l0_file->Close(); |
218 |
|
if(pam_tree)pam_tree->Delete();; |
219 |
|
if(run_tree)run_tree->Delete();; |
220 |
|
if(sel_tree)sel_tree->Delete();; |
221 |
|
for(Int_t i=0; i<NCLONES; i++ )if(pam_tree_clone[i])pam_tree_clone[i]->Delete();; |
222 |
|
if(run_tree_clone)run_tree_clone->Delete();; |
223 |
|
if(sel_tree_clone)sel_tree_clone->Delete();; |
224 |
|
|
225 |
|
|
226 |
}; |
}; |
227 |
|
|
228 |
/** |
/** |
240 |
// if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
// if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
241 |
// if(soft_obj) soft_obj->Clear(); |
// if(soft_obj) soft_obj->Clear(); |
242 |
|
|
243 |
|
if(h0_obj) h0_obj->Clear(); |
244 |
|
if(trk0_obj) trk0_obj->Clear(); |
245 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
246 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
247 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
554 |
use_CAL && |
use_CAL && |
555 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
556 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
557 |
|
cp && ci && |
558 |
true){ |
true){ |
559 |
|
|
560 |
|
|
576 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
577 |
return; |
return; |
578 |
}; |
}; |
579 |
if( use_TOF ){ |
if( use_TOF && op && oi ){ |
580 |
|
|
581 |
Int_t nphit_p =0; |
Int_t nphit_p =0; |
582 |
Int_t nphit_i =0; |
Int_t nphit_i =0; |
832 |
|
|
833 |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
834 |
// else GetWhichTrees(f); |
// else GetWhichTrees(f); |
835 |
|
|
836 |
|
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
837 |
|
|
838 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
839 |
|
|
840 |
TTree *Trout =0; |
TTree *Trout =0; |
842 |
TString fname = f->GetName(); |
TString fname = f->GetName(); |
843 |
if(!CheckLevel2File(fname))return NULL; |
if(!CheckLevel2File(fname))return NULL; |
844 |
|
|
845 |
UInt_t *found=0; |
// UInt_t *found=0; |
846 |
|
|
847 |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
848 |
if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
857 |
if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
858 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
859 |
cout << endl; |
cout << endl; |
860 |
|
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
861 |
|
|
862 |
f->cd(); |
f->cd(); |
863 |
|
|
865 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
866 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
867 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
868 |
else T->SetBranchStatus("TrkLevel2",0,found); |
// else T->SetBranchStatus("TrkLevel2",0,found); |
869 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
870 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
871 |
else T->SetBranchStatus("TrkLevel1",0,found); |
// else T->SetBranchStatus("TrkLevel1",0,found); |
872 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
873 |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
874 |
else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
875 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
876 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
877 |
else Trout->AddFriend(T); |
else Trout->AddFriend(T); |
882 |
TTree *C = (TTree*)f->Get("Calorimeter"); |
TTree *C = (TTree*)f->Get("Calorimeter"); |
883 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
884 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
885 |
else C->SetBranchStatus("CaloLevel2",0,found); |
// else C->SetBranchStatus("CaloLevel2",0,found); |
886 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
887 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
888 |
else C->SetBranchStatus("CaloLevel1",0,found); |
// else C->SetBranchStatus("CaloLevel1",0,found); |
889 |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
890 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
891 |
else Trout->AddFriend(C); |
else Trout->AddFriend(C); |
953 |
}else{ |
}else{ |
954 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
955 |
}; |
}; |
956 |
|
|
957 |
|
TTree *L = (TTree*)f->Get("SelectionList"); |
958 |
|
if(L && SELLI==1) { |
959 |
|
// L->SetBranchAddress("RunEntry",&irun); |
960 |
|
// cout << "SelectionList: set branch address RunEntry"<<endl; |
961 |
|
// L->SetBranchAddress("EventEntry",&irunentry); |
962 |
|
// cout << "SelectionList: set branch address EventEntry"<<endl; |
963 |
|
// if(!Trout)Trout=O; |
964 |
|
// else Trout->AddFriend("SelectionList"); |
965 |
|
cout << " TTree *PamLevel2::GetPamTree(TFile, TString) >>> SelectionList not implemente!!!!"<<endl; |
966 |
|
sel_tree = 0; |
967 |
|
}else{ |
968 |
|
cout << "SelectionList : missing tree"<<endl; |
969 |
|
}; |
970 |
|
|
971 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
972 |
|
|
973 |
|
pam_tree = (TChain*)Trout; |
974 |
|
|
975 |
return Trout; |
return Trout; |
976 |
|
|
1009 |
// return 0; |
// return 0; |
1010 |
// } |
// } |
1011 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
1012 |
|
if ( !flisttxt.EndsWith(".root") ){ |
1013 |
|
|
1014 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1015 |
|
|
1041 |
// cout <<"(2) " << file << endl; |
// cout <<"(2) " << file << endl; |
1042 |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
1043 |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
1044 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
if( file.EndsWith(".root") ){ |
1045 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
1046 |
delete fullpath; |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1047 |
|
delete fullpath; |
1048 |
|
} |
1049 |
// }else{ |
// }else{ |
1050 |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
1051 |
// }; |
// }; |
1052 |
}; |
}; |
1053 |
in.close(); |
in.close(); |
1054 |
|
} else { |
1055 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1056 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1057 |
|
delete fullpath; |
1058 |
|
}; |
1059 |
}else{ |
}else{ |
1060 |
|
|
1061 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1133 |
TChain *N = 0; |
TChain *N = 0; |
1134 |
TChain *A = 0; |
TChain *A = 0; |
1135 |
TChain *B = 0; |
TChain *B = 0; |
1136 |
|
|
1137 |
|
TChain *L = 0; |
1138 |
|
|
1139 |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
1140 |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
1144 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
1145 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
1146 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
1147 |
|
|
1148 |
|
L = new TChain("SelectionList"); |
1149 |
|
|
1150 |
// loop over files and create chains |
// loop over files and create chains |
1151 |
TIter next(fl); |
TIter next(fl); |
1162 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
1163 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
1164 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
1165 |
|
if(SELLI==1) L->Add(name); |
1166 |
}; |
}; |
1167 |
} |
} |
1168 |
|
|
1169 |
cout << "done chain \n"; |
cout << "done chain \n"; |
1170 |
|
|
1171 |
UInt_t *found=0; |
// UInt_t *found=0; |
1172 |
// Tracker |
// Tracker |
1173 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
1174 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1175 |
else T->SetBranchStatus("TrkLevel2",0,found); |
// else T->SetBranchStatus("TrkLevel2",0,found); |
1176 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
1177 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1178 |
else T->SetBranchStatus("TrkLevel1",0,found); |
// else T->SetBranchStatus("TrkLevel1",0,found); |
1179 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
1180 |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1181 |
else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
1182 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
1183 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1184 |
else Trout->AddFriend("Tracker"); |
else Trout->AddFriend("Tracker"); |
1188 |
// Calorimeter |
// Calorimeter |
1189 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
1190 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1191 |
else C->SetBranchStatus("CaloLevel2",0,found); |
// else C->SetBranchStatus("CaloLevel2",0,found); |
1192 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1193 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1194 |
else C->SetBranchStatus("CaloLevel1",0,found); |
// else C->SetBranchStatus("CaloLevel1",0,found); |
1195 |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
1196 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
1197 |
else Trout->AddFriend("Calorimeter"); |
else Trout->AddFriend("Calorimeter"); |
1252 |
}else{ |
}else{ |
1253 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1254 |
}; |
}; |
1255 |
|
|
1256 |
|
// Selection List |
1257 |
|
if(L && SELLI==1) { |
1258 |
|
cout<<">>> Found selection-list <<<"<<endl; |
1259 |
|
L->SetBranchAddress("RunEntry",&irun); |
1260 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1261 |
|
L->SetBranchAddress("EventEntry",&irunentry); |
1262 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1263 |
|
sel_tree = L; |
1264 |
|
// if(!Trout)Trout=O; |
1265 |
|
// else Trout->AddFriend("SelectionList"); |
1266 |
|
}else{ |
1267 |
|
// cout << "SelectionList : missing tree"<<endl; |
1268 |
|
if(L)L->Delete(); |
1269 |
|
}; |
1270 |
|
|
1271 |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
1272 |
|
|
1273 |
|
pam_tree = Trout; |
1274 |
// // Tracker |
|
|
// if(TRK2||TRK1||TRKh){ |
|
|
// if(!Tout)Tout=T; |
|
|
// else Tout->AddFriend("Tracker"); |
|
|
// } |
|
|
// // Calorimeter |
|
|
// if(CAL2||CAL1) { |
|
|
// if(!Tout)Tout=C; |
|
|
// else Tout->AddFriend("Calorimeter"); |
|
|
// }; |
|
|
// // ToF |
|
|
// if(TOF) { |
|
|
// if(!Tout)Tout=O; |
|
|
// else Tout->AddFriend("ToF"); |
|
|
// }; |
|
|
// // Trigger |
|
|
// if(TRG) { |
|
|
// if(!Tout)Tout=R; |
|
|
// else Tout->AddFriend("Trigger"); |
|
|
// }; |
|
|
// // S4 |
|
|
// if(S4) { |
|
|
// if(!Tout)Tout=S; |
|
|
// else Tout->AddFriend("S4"); |
|
|
// }; |
|
|
// // Neutron Detector |
|
|
// if(ND) { |
|
|
// if(!Tout)Tout=N; |
|
|
// else Tout->AddFriend("NeutronD"); |
|
|
// }; |
|
|
// // Anticounters |
|
|
// if(AC) { |
|
|
// if(!Tout)Tout=A; |
|
|
// else Tout->AddFriend("Anticounter"); |
|
|
// }; |
|
|
// // OrbitalInfo |
|
|
// if(ORB) { |
|
|
// if(!Tout)Tout=B; |
|
|
// else Tout->AddFriend("OrbitalInfo"); |
|
|
// }; |
|
|
|
|
|
// cout<<endl<<" Number of entries: "<<Tout->GetEntries()<<endl<<endl; |
|
|
|
|
|
// if( Tout->GetEntries() )PamLevel2::SetBranchAddress( Tout ); |
|
|
|
|
1275 |
return Trout; |
return Trout; |
1276 |
} |
} |
1277 |
|
|
1353 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1354 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1355 |
}; |
}; |
1356 |
|
// SelectionList |
1357 |
|
if(SELLI==1) { |
1358 |
|
t->SetBranchAddress("RunEntry", &irun); |
1359 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1360 |
|
t->SetBranchAddress("EventEntry", &irunentry); |
1361 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1362 |
|
}; |
1363 |
|
|
1364 |
} |
} |
1365 |
/** |
/** |
1433 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1434 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1435 |
}; |
}; |
1436 |
|
// SelectionList |
1437 |
|
if(SELLI==1) { |
1438 |
|
t->SetBranchAddress("RunEntry", &irun); |
1439 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1440 |
|
t->SetBranchAddress("EventEntry", &irunentry); |
1441 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1442 |
|
}; |
1443 |
|
|
1444 |
} |
} |
1445 |
|
|
1467 |
R->Add(name); |
R->Add(name); |
1468 |
}; |
}; |
1469 |
} |
} |
1470 |
|
|
1471 |
|
if(R->GetNtrees()){ |
1472 |
|
|
1473 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1474 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
1475 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1476 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1477 |
|
}else{ |
1478 |
|
delete R; |
1479 |
|
R=0; |
1480 |
|
} |
1481 |
|
|
1482 |
|
run_tree = R; |
1483 |
|
|
1484 |
return R; |
return R; |
1485 |
|
|
1486 |
} |
} |
1495 |
*/ |
*/ |
1496 |
TTree *PamLevel2::GetRunTree(TFile *f){ |
TTree *PamLevel2::GetRunTree(TFile *f){ |
1497 |
|
|
1498 |
|
cout << "TTree *PamLevel2::GetRunTree(TFile *f) -- obsolte "<<endl; |
1499 |
|
|
1500 |
TTree *R = (TTree*)f->Get("Run"); |
TTree *R = (TTree*)f->Get("Run"); |
1501 |
|
|
1502 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
if(R){ |
1503 |
cout << "Run : set branch address RunInfo"<<endl; |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1504 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
cout << "Run : set branch address RunInfo"<<endl; |
1505 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1506 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1507 |
|
} |
1508 |
|
|
1509 |
|
run_tree = (TChain*)R; |
1510 |
|
|
1511 |
return R; |
return R; |
1512 |
|
|
1513 |
} |
} |
1522 |
// |
// |
1523 |
if ( run->GetEntries() <= 0 ) return(false); |
if ( run->GetEntries() <= 0 ) return(false); |
1524 |
// |
// |
1525 |
|
|
1526 |
Int_t oldrun = irun; |
Int_t oldrun = irun; |
1527 |
if ( irun < 0 ){ |
// -------------------------------------- |
1528 |
irun = 0; |
// if it is a full file (not preselected) |
1529 |
run->GetEntry(0); |
// -------------------------------------- |
1530 |
runfirstentry = 0ULL; |
if(SELLI==0){ |
1531 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
if ( irun < 0 ){ |
1532 |
}; |
irun = 0; |
1533 |
while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
run->GetEntry(irun); |
1534 |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
runfirstentry = 0ULL; |
1535 |
irun++; |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
1536 |
run->GetEntry(irun); |
return(true); |
1537 |
runfirstentry = runlastentry+1ULL; |
}; |
1538 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
|
1539 |
|
if( !GetOrbitalInfo() ){ |
1540 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
1541 |
|
return(false); |
1542 |
|
} |
1543 |
|
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
1544 |
|
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
1545 |
|
while ( GetOrbitalInfo()->absTime > GetRunInfo()->RUNTRAILER_TIME && irun < run->GetEntries() ){ |
1546 |
|
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
1547 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
1548 |
|
irun++; |
1549 |
|
run->GetEntry(irun); |
1550 |
|
runfirstentry = runlastentry+1ULL; |
1551 |
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
1552 |
|
}; |
1553 |
|
|
1554 |
|
// |
1555 |
|
if |
1556 |
|
( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1557 |
|
// |
1558 |
|
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
1559 |
|
// |
1560 |
|
return(true); |
1561 |
}; |
}; |
1562 |
// |
// ---------------------------------------------------- |
1563 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
// if it is a preselected file (there is SelectionList) |
1564 |
// |
// NBNB - the event tree MUST be read first |
1565 |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
// ---------------------------------------------------- |
1566 |
// |
if(SELLI==1){ |
1567 |
return(true); |
sel_tree->GetEntry(iev); |
1568 |
|
if(irun != oldrun){ |
1569 |
|
run->GetEntry(irun); |
1570 |
|
return true; |
1571 |
|
} |
1572 |
|
return false; |
1573 |
|
} |
1574 |
|
|
1575 |
|
return false; |
1576 |
// |
// |
1577 |
}; |
}; |
1578 |
/** |
/** |
1595 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
1596 |
|
|
1597 |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
1598 |
|
CAL0 = false; |
1599 |
CAL1 = true; |
CAL1 = true; |
1600 |
CAL2 = true; |
CAL2 = true; |
1601 |
TRK2 = true; |
TRK2 = true; |
1602 |
TRK1 = false; |
TRK1 = false; |
1603 |
TRKh = false; |
TRKh = false; |
1604 |
|
TRK0 = false; |
1605 |
TRG = true; |
TRG = true; |
1606 |
TOF = true; |
TOF = true; |
1607 |
|
TOF0 = false; |
1608 |
S4 = true; |
S4 = true; |
1609 |
ND = true; |
ND = true; |
1610 |
AC = true; |
AC = true; |
1611 |
ORB = true; |
ORB = true; |
1612 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
1613 |
|
CAL0 = false; |
1614 |
CAL1 = false; |
CAL1 = false; |
1615 |
CAL2 = false; |
CAL2 = false; |
1616 |
TRK2 = false; |
TRK2 = false; |
1617 |
TRK1 = false; |
TRK1 = false; |
1618 |
TRKh = false; |
TRKh = false; |
1619 |
|
TRK0 = false; |
1620 |
TRG = false; |
TRG = false; |
1621 |
TOF = false; |
TOF = false; |
1622 |
|
TOF0 = false; |
1623 |
S4 = false; |
S4 = false; |
1624 |
ND = false; |
ND = false; |
1625 |
AC = false; |
AC = false; |
1631 |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
1632 |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
1633 |
}; |
}; |
1634 |
|
|
1635 |
|
if( detlist.Contains("CAL0", TString::kIgnoreCase) ){ |
1636 |
|
if ( detlist.Contains("-CAL0", TString::kIgnoreCase) )CAL0=false; |
1637 |
|
if ( detlist.Contains("+CAL0", TString::kIgnoreCase) )CAL0=true; |
1638 |
|
}; |
1639 |
|
|
1640 |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
1641 |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
1648 |
CAL1=false; |
CAL1=false; |
1649 |
} |
} |
1650 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
1651 |
|
if( detlist.Contains("TRK0", TString::kIgnoreCase) ){ |
1652 |
|
if ( detlist.Contains("-TRK0", TString::kIgnoreCase) )TRK0=false; |
1653 |
|
if ( detlist.Contains("+TRK0", TString::kIgnoreCase) )TRK0=true; |
1654 |
|
}; |
1655 |
|
|
1656 |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
1657 |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
1658 |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
1681 |
|
|
1682 |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
1683 |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
1684 |
|
|
1685 |
|
if( detlist.Contains("-TOF0", TString::kIgnoreCase) )TOF0 = false; |
1686 |
|
else if( detlist.Contains("+TOF0", TString::kIgnoreCase) )TOF0 = true; |
1687 |
|
|
1688 |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
1689 |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
1718 |
* Set tree/branch detector flags from the content of a tree |
* Set tree/branch detector flags from the content of a tree |
1719 |
*/ |
*/ |
1720 |
void PamLevel2::GetWhichTrees(TFile* f){ |
void PamLevel2::GetWhichTrees(TFile* f){ |
1721 |
|
|
1722 |
|
|
1723 |
|
|
1724 |
|
cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<<endl; |
1725 |
// ----------- |
// ----------- |
1726 |
// reset flags |
// reset flags |
1727 |
// ----------- |
// ----------- |
1893 |
|
|
1894 |
Bool_t RUN__ok = false; |
Bool_t RUN__ok = false; |
1895 |
|
|
1896 |
|
Bool_t SELLI__ok = false; |
1897 |
|
|
1898 |
cout << "Checking file: "<<name<<endl; |
cout << "Checking file: "<<name<<endl; |
1899 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
1910 |
|
|
1911 |
while( (key = (TKey*)next()) ){ |
while( (key = (TKey*)next()) ){ |
1912 |
|
|
1913 |
|
// cout << key->GetName() << endl; |
1914 |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
1915 |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
1916 |
// nev_previous = nev; |
// nev_previous = nev; |
1921 |
// return false; |
// return false; |
1922 |
// }; |
// }; |
1923 |
|
|
1924 |
|
|
1925 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
1926 |
|
|
1927 |
//========================================================= |
//========================================================= |
1928 |
|
if( !strcmp(key->GetName(),"SelectionList" ) ){ |
1929 |
|
SELLI__ok = true; |
1930 |
|
if(SELLI==1){ |
1931 |
|
Int_t nevt = ((TTree*)f->Get("SelectionList"))->GetEntries(); |
1932 |
|
if( nev && nevt!=nev){ |
1933 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList tree has "<<nevt<<" events instead of "<<nev<< endl; |
1934 |
|
return false; |
1935 |
|
} |
1936 |
|
nev=nevt; |
1937 |
|
} |
1938 |
|
} |
1939 |
|
|
1940 |
|
//========================================================= |
1941 |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
1942 |
TRG__ok = true; |
TRG__ok = true; |
1943 |
if(TRG){ |
if(TRG){ |
2049 |
}; |
}; |
2050 |
|
|
2051 |
}; |
}; |
2052 |
|
|
2053 |
|
if( SELLI==-1 )SELLI = (Int_t)SELLI__ok; |
2054 |
|
if( SELLI==0 && SELLI__ok ){ |
2055 |
|
cout << "File: "<< f->GetName() <<" discarded ---- found SelectionList (it is not a full-event file)" << endl; |
2056 |
|
return false; |
2057 |
|
} |
2058 |
|
if( SELLI==1 && !SELLI__ok ){ |
2059 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList missing" << endl; |
2060 |
|
return false; |
2061 |
|
} |
2062 |
|
|
2063 |
|
// cout << "SELLI "<<SELLI<<endl; |
2064 |
|
|
2065 |
// cout<< "CheckLevel2File(TString): detector list --> "; |
// cout<< "CheckLevel2File(TString): detector list --> "; |
2066 |
// if(TRK1__ok)cout<<"TRK1 "; |
// if(TRK1__ok)cout<<"TRK1 "; |
2067 |
// if(TRK2__ok)cout<<"TRK2 "; |
// if(TRK2__ok)cout<<"TRK2 "; |
2170 |
cout << "Create clones of PAMELA trees "<<endl; |
cout << "Create clones of PAMELA trees "<<endl; |
2171 |
|
|
2172 |
Int_t i=0; |
Int_t i=0; |
2173 |
tree_clone[i] = fChain->GetTree()->CloneTree(0); |
pam_tree_clone[i] = fChain->GetTree()->CloneTree(0); |
2174 |
TString name = tree_clone[i]->GetName(); |
TString name = pam_tree_clone[i]->GetName(); |
2175 |
name.Append("_clone"); |
name.Append("_clone"); |
2176 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
2177 |
cout << tree_clone[i]->GetName() <<endl; |
cout << pam_tree_clone[i]->GetName() <<endl; |
2178 |
i++; |
i++; |
2179 |
|
|
2180 |
TList *li = fChain->GetListOfFriends(); |
TList *li = fChain->GetListOfFriends(); |
2184 |
while( (T_friend = (TFriendElement*)next()) ){ |
while( (T_friend = (TFriendElement*)next()) ){ |
2185 |
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
2186 |
// cout<<T_friend->GetTree()->GetName()<< endl; |
// cout<<T_friend->GetTree()->GetName()<< endl; |
2187 |
tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
pam_tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
2188 |
tree_clone[i]->SetAutoSave(1000000); |
pam_tree_clone[i]->SetAutoSave(1000000); |
2189 |
name = tree_clone[i]->GetName(); |
name = pam_tree_clone[i]->GetName(); |
2190 |
name.Append("_clone"); |
name.Append("_clone"); |
2191 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
2192 |
cout << tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
2193 |
i++; |
i++; |
2194 |
} |
} |
2195 |
|
|
2209 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2210 |
cout << "Create new PAMELA trees "<<endl; |
cout << "Create new PAMELA trees "<<endl; |
2211 |
|
|
|
Int_t i=0; |
|
2212 |
|
|
2213 |
|
run_tree_clone = new TTree("Run","PAMELA Level2 data from the GL_RUN table "); |
2214 |
|
run_tree_clone->Branch("RunInfo","GL_RUN",GetPointerTo("RunInfo")); |
2215 |
|
cout << "Run : branch RunInfo"<<endl; |
2216 |
|
run_tree_clone->Branch("SoftInfo","SoftInfo",GetPointerTo("SoftInfo")); |
2217 |
|
cout << "Run : branch SoftInfo"<<endl; |
2218 |
|
|
2219 |
|
|
2220 |
|
|
2221 |
|
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
2222 |
|
sel_tree_clone->Branch("RunEntry",&irun,"runentry/I"); |
2223 |
|
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/I"); |
2224 |
|
|
2225 |
|
|
2226 |
|
Int_t i=0; |
2227 |
if(TRK1||TRK2||TRKh){ |
if(TRK1||TRK2||TRKh){ |
2228 |
tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
pam_tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
2229 |
if(TRK1) { |
if(TRK1) { |
2230 |
tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
2231 |
tree_clone[i]->BranchRef(); |
pam_tree_clone[i]->BranchRef(); |
2232 |
cout << "Tracker : branch TrkLevel1"<<endl; |
cout << "Tracker : branch TrkLevel1"<<endl; |
2233 |
|
cout << "CreateCloneTrees " << GetTrkLevel1()<<endl; |
2234 |
}; |
}; |
2235 |
if(TRK2) { |
if(TRK2) { |
2236 |
tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
2237 |
cout << "Tracker : branch TrkLevel2"<<endl; |
cout << "Tracker : branch TrkLevel2"<<endl; |
2238 |
}; |
}; |
2239 |
if(TRKh) { |
if(TRKh) { |
2240 |
tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
2241 |
cout << "Tracker : branch TrkHough"<<endl; |
cout << "Tracker : branch TrkHough"<<endl; |
2242 |
}; |
}; |
2243 |
i++; |
i++; |
2245 |
|
|
2246 |
// Calorimeter |
// Calorimeter |
2247 |
if(CAL1||CAL2){ |
if(CAL1||CAL2){ |
2248 |
tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
pam_tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
2249 |
if(CAL1) { |
if(CAL1) { |
2250 |
tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
pam_tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
2251 |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
2252 |
}; |
}; |
2253 |
if(CAL2) { |
if(CAL2) { |
2254 |
tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
2255 |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
2256 |
}; |
}; |
2257 |
i++; |
i++; |
2259 |
|
|
2260 |
// ToF |
// ToF |
2261 |
if(TOF) { |
if(TOF) { |
2262 |
tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
2263 |
tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
2264 |
cout << "ToF : branch ToFLevel2"<<endl; |
cout << "ToF : branch ToFLevel2"<<endl; |
2265 |
i++; |
i++; |
2266 |
}; |
}; |
2267 |
// Trigger |
// Trigger |
2268 |
if(TRG) { |
if(TRG) { |
2269 |
tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
pam_tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
2270 |
tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
pam_tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
2271 |
cout << "Trigger : branch TrigLevel2"<<endl; |
cout << "Trigger : branch TrigLevel2"<<endl; |
2272 |
i++; |
i++; |
2273 |
}; |
}; |
2274 |
// S4 |
// S4 |
2275 |
if(S4) { |
if(S4) { |
2276 |
tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
pam_tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
2277 |
tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
pam_tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
2278 |
cout << "S4 : branch S4Level2"<<endl; |
cout << "S4 : branch S4Level2"<<endl; |
2279 |
i++; |
i++; |
2280 |
}; |
}; |
2281 |
// Neutron Detector |
// Neutron Detector |
2282 |
if(ND) { |
if(ND) { |
2283 |
tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
pam_tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
2284 |
tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
pam_tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
2285 |
cout << "NeutronD : branch NDLevel2"<<endl; |
cout << "NeutronD : branch NDLevel2"<<endl; |
2286 |
i++; |
i++; |
2287 |
}; |
}; |
2288 |
// Anticounters |
// Anticounters |
2289 |
if(AC) { |
if(AC) { |
2290 |
tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
pam_tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
2291 |
tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
pam_tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
2292 |
cout << "Anticounter : branch AcLevel2"<<endl; |
cout << "Anticounter : branch AcLevel2"<<endl; |
2293 |
i++; |
i++; |
2294 |
}; |
}; |
2295 |
// OrbitalInfo |
// OrbitalInfo |
2296 |
if(ORB) { |
if(ORB) { |
2297 |
tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
2298 |
tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2299 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
2300 |
i++; |
i++; |
2301 |
}; |
}; |
2310 |
*/ |
*/ |
2311 |
//void PamLevel2::FillNewPamTree(TTree *T){ |
//void PamLevel2::FillNewPamTree(TTree *T){ |
2312 |
void PamLevel2::FillCloneTrees(){ |
void PamLevel2::FillCloneTrees(){ |
2313 |
|
|
2314 |
for(Int_t i=0; i<8; i++){ |
// cout << "PamLevel2::FillCloneTrees()" << irunentry << endl; |
2315 |
if(tree_clone[i])tree_clone[i]->Fill(); |
|
2316 |
|
for(Int_t i=0; i<NCLONES; i++){ |
2317 |
|
if(pam_tree_clone[i])pam_tree_clone[i]->Fill(); |
2318 |
} |
} |
2319 |
|
if(sel_tree_clone)sel_tree_clone->Fill(); |
2320 |
|
|
2321 |
} |
} |
2322 |
|
|
2323 |
|
|
2324 |
TTree* PamLevel2::GetCloneTree(TString name){ |
TTree* PamLevel2::GetCloneTree(TString name){ |
2325 |
|
|
2326 |
for(Int_t i=0; i<8; i++){ |
for(Int_t i=0; i<NCLONES; i++){ |
2327 |
if(tree_clone[i]){ |
if(pam_tree_clone[i]){ |
2328 |
TString na = tree_clone[i]->GetName(); |
TString na = pam_tree_clone[i]->GetName(); |
2329 |
if(!name.CompareTo(na))return tree_clone[i]; |
if(!name.CompareTo(na))return pam_tree_clone[i]; |
2330 |
}; |
}; |
2331 |
} |
} |
2332 |
|
if(run_tree_clone){ |
2333 |
|
TString na = run_tree_clone->GetName(); |
2334 |
|
if(!name.CompareTo(na))return run_tree_clone; |
2335 |
|
} |
2336 |
|
if(sel_tree_clone){ |
2337 |
|
TString na = sel_tree_clone->GetName(); |
2338 |
|
if(!name.CompareTo(na))return sel_tree_clone; |
2339 |
|
} |
2340 |
return NULL; |
return NULL; |
2341 |
|
|
2342 |
} |
} |
2343 |
void PamLevel2::WriteCloneTrees(){ |
void PamLevel2::WriteCloneTrees(){ |
2344 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2345 |
cout << "Write clones of PAMELA trees "<<endl; |
cout << "Write clones of PAMELA trees "<<endl; |
2346 |
for(Int_t i=0; i<8; i++){ |
cout << run_tree_clone->GetName()<<endl; |
2347 |
if(tree_clone[i]){ |
run_tree_clone->Write(); |
2348 |
cout << tree_clone[i]->GetName()<<endl; |
cout << sel_tree_clone->GetName()<<endl; |
2349 |
tree_clone[i]->Write(); |
sel_tree_clone->Write(); |
2350 |
|
for(Int_t i=0; i<NCLONES; i++){ |
2351 |
|
if(pam_tree_clone[i]){ |
2352 |
|
cout << pam_tree_clone[i]->GetName()<<endl; |
2353 |
|
pam_tree_clone[i]->Write(); |
2354 |
}; |
}; |
2355 |
} |
} |
2356 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2358 |
} |
} |
2359 |
|
|
2360 |
/** |
/** |
2361 |
* Create a new (empty) Pamela trees |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
2362 |
*/ |
*/ |
2363 |
// TTree* PamLevel2::GetNewPamTree(){ |
Int_t PamLevel2::GetEntry(Int_t iee){ |
2364 |
|
|
2365 |
|
if(!pam_tree){ |
2366 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
2367 |
|
return 0; |
2368 |
|
} |
2369 |
|
|
2370 |
|
|
2371 |
|
// |
2372 |
|
// This is a sort of bug: if you don't have the run tree you don't want to exit here you want to have loaded the event anyway... |
2373 |
|
// |
2374 |
|
// if(!run_tree ){ |
2375 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
2376 |
|
// return 0; |
2377 |
|
// } |
2378 |
|
|
2379 |
|
Int_t ii=0; |
2380 |
|
//------------------------------- |
2381 |
|
ii = iee; |
2382 |
|
if( !pam_tree->GetEntry(ii) ) return 0; |
2383 |
|
|
2384 |
|
// |
2385 |
|
// ... 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. |
2386 |
|
// 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 |
2387 |
|
// a problem if you don't check the return code of getentry. |
2388 |
|
// |
2389 |
|
if(!run_tree ){ |
2390 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
2391 |
|
return 0; |
2392 |
|
} |
2393 |
|
|
2394 |
// if(tree_clone)return tree_clone; |
//------------------------------- |
2395 |
|
ii = iee; |
2396 |
|
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
2397 |
|
if(SELLI==0)irunentry = iee-runfirstentry; |
2398 |
|
if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
2399 |
|
|
2400 |
|
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
2401 |
|
|
2402 |
|
if( TRK0 || CAL0 || TOF0 )GetYodaEntry( ); |
2403 |
|
|
2404 |
|
return 1; |
2405 |
|
|
2406 |
|
} |
2407 |
|
|
2408 |
// TTree *Tout = 0; |
/** |
2409 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
2410 |
|
* Given the run ID (...), if needed it query the DB and load the proper file. |
2411 |
|
* @return Pointer to the tree |
2412 |
|
*/ |
2413 |
|
|
2414 |
|
|
2415 |
|
TTree* PamLevel2::GetYodaTree( ){ |
2416 |
|
|
2417 |
|
// cout << "TTree* PamLevel2::GetYodaTree( )"<<endl; |
2418 |
|
//=================================== |
2419 |
|
// check if iroot has changed |
2420 |
|
//=================================== |
2421 |
|
if( irun<0 ){ |
2422 |
|
cout << "PamLevel2::GetYodaTree() -- ERROR "<<endl; |
2423 |
|
cout << "In order to use this method you have to load the RunInfo tree "<<endl; |
2424 |
|
cout << "with the method TChain* PamLevel2::GetRunTree(TString, TString)"<<endl; |
2425 |
|
// cout << " - read the event with PamLevel2::GetEntry(Int_t)"<<endl; |
2426 |
|
return NULL; |
2427 |
|
} |
2428 |
|
Int_t irootnew = run_obj->ID_ROOT_L0; |
2429 |
|
// cout << "iroot "<<iroot<<endl; |
2430 |
|
// cout << "irootnew "<<irootnew<<endl; |
2431 |
|
|
2432 |
|
//=================================== |
2433 |
|
// load the level0 file |
2434 |
|
// (if not already loaded) |
2435 |
|
//=================================== |
2436 |
|
if( iroot != irootnew || !l0_tree){ |
2437 |
|
iroot = irootnew; |
2438 |
|
//=================================== |
2439 |
|
// open the DB connection |
2440 |
|
// (if not already opened) |
2441 |
|
//=================================== |
2442 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
2443 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
2444 |
|
cout<<"Connecting to DB"<<endl; |
2445 |
|
cout<<"HOST "<<host<<endl; |
2446 |
|
cout<<"USER "<<user<<endl; |
2447 |
|
cout<<"PSW "<<psw<<endl; |
2448 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
2449 |
|
if( !dbc )return NULL; |
2450 |
|
if( !dbc->IsConnected() )return NULL; |
2451 |
|
// cout<<"...done"<<endl; |
2452 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
2453 |
|
}else{ |
2454 |
|
// cout<<"DB already connected"<<endl; |
2455 |
|
} |
2456 |
|
GL_ROOT glroot = GL_ROOT(); |
2457 |
|
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
2458 |
|
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
2459 |
|
return NULL; |
2460 |
|
}; |
2461 |
|
TString filename = glroot.PATH + glroot.NAME; |
2462 |
|
if(l0_file){ |
2463 |
|
l0_file->Close(); |
2464 |
|
l0_file->Delete(); |
2465 |
|
} |
2466 |
|
cout << "Opening LEVEL0 file: "<< filename << endl; |
2467 |
|
FileStat_t t; |
2468 |
|
if( gSystem->GetPathInfo(filename.Data(),t) ){ |
2469 |
|
cout << " PamLevel2::GetYodaTree() -- ERROR opening file "<<endl; |
2470 |
|
return NULL; |
2471 |
|
} |
2472 |
|
l0_file = new TFile(filename); |
2473 |
|
if( !l0_file )return NULL; |
2474 |
|
l0_tree = (TTree*)l0_file->Get("Physics"); |
2475 |
|
if(!h0_obj)h0_obj = new EventHeader(); |
2476 |
|
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
2477 |
|
//--------------------------------------------------- |
2478 |
|
// TRACKER: |
2479 |
|
if(TRK0){ |
2480 |
|
if(!trk0_obj){ |
2481 |
|
trk0_obj = new TrkLevel0(); |
2482 |
|
trk0_obj->Set(); |
2483 |
|
}; |
2484 |
|
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
2485 |
|
} |
2486 |
|
//--------------------------------------------------- |
2487 |
|
// CALORIMETER: |
2488 |
|
if(CAL0){ |
2489 |
|
cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
2490 |
|
} |
2491 |
|
//--------------------------------------------------- |
2492 |
|
// TOF: |
2493 |
|
if(TOF0){ |
2494 |
|
cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<<endl; |
2495 |
|
} |
2496 |
|
|
2497 |
|
}; |
2498 |
|
|
2499 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
2500 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
2501 |
|
} |
2502 |
|
|
2503 |
|
TrkParams::SetCalib(run_obj,dbc); |
2504 |
|
|
2505 |
|
|
2506 |
|
// cout << l0_tree << endl; |
2507 |
|
|
2508 |
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
return l0_tree; |
2509 |
// cout << "Create new PAMELA trees "<<endl; |
|
2510 |
|
} |
2511 |
|
|
2512 |
|
/** |
2513 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
2514 |
|
*/ |
2515 |
|
Int_t PamLevel2::GetYodaEntry(){ |
2516 |
|
|
2517 |
|
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
2518 |
|
if(!GetYodaTree())return 0; |
2519 |
|
|
2520 |
|
// patch |
2521 |
|
if( (Int_t)irunentry < 0){ |
2522 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
2523 |
|
irunentry=0; |
2524 |
|
} |
2525 |
|
// --------------------------------- |
2526 |
|
// if file is NOT a preselected file |
2527 |
|
// --------------------------------- |
2528 |
|
UInt_t quellagiusta = irunentry + run_obj->EV_FROM; |
2529 |
|
|
|
// if(TRK1||TRK2||TRKh){ |
|
|
// TTree *T = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
|
|
// if(TRK1) { |
|
|
// trk1_clone = new TrkLevel1(); |
|
|
// T->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
|
|
// T->BranchRef(); |
|
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
|
|
// }; |
|
|
// if(TRK2) { |
|
|
// trk2_clone = new TrkLevel2(); |
|
|
// T->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
|
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
|
|
// }; |
|
|
// if(TRKh) { |
|
|
// trkh_clone = new TrkHough(); |
|
|
// T->Branch("TrkHough","TrkHough", &trkh_clone); |
|
|
// cout << "Tracker : branch TrkHough"<<endl; |
|
|
// }; |
|
|
// if(!Tout)Tout=T; |
|
|
// else Tout->AddFriend("Tracker_clone"); |
|
|
// } |
|
|
|
|
|
// // Calorimeter |
|
|
// if(CAL1||CAL2){ |
|
|
// TTree *C = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
|
|
// if(CAL1) { |
|
|
// calo1_clone = new CaloLevel1(); |
|
|
// C->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
|
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
|
|
// }; |
|
|
// if(CAL2) { |
|
|
// calo2_clone = new CaloLevel2(); |
|
|
// C->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
|
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
|
|
// }; |
|
|
// if(!Tout)Tout=C; |
|
|
// else Tout->AddFriend("Calorimeter_clone"); |
|
|
// } |
|
|
|
|
|
// // ToF |
|
|
// if(TOF) { |
|
|
// TTree *O = new TTree("ToF_clone","PAMELA ToF level2 data "); |
|
|
// tof_clone = new ToFLevel2(); |
|
|
// O->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
|
|
// cout << "ToF : branch ToFLevel2"<<endl; |
|
|
// if(!Tout)Tout=O; |
|
|
// else Tout->AddFriend("ToF_clone"); |
|
|
// }; |
|
|
// // Trigger |
|
|
// if(TRG) { |
|
|
// TTree *R = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
|
|
// trig_clone = new TrigLevel2(); |
|
|
// R->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
|
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
|
|
// if(!Tout)Tout=R; |
|
|
// else Tout->AddFriend("Trigger_clone"); |
|
|
// }; |
|
|
// // S4 |
|
|
// if(S4) { |
|
|
// TTree *S = new TTree("S4_clone","PAMELA S4 level2 data "); |
|
|
// s4_clone = new S4Level2(); |
|
|
// S->Branch("S4Level2","S4Level2", &s4_clone); |
|
|
// cout << "S4 : branch S4Level2"<<endl; |
|
|
// if(!Tout)Tout=S; |
|
|
// else Tout->AddFriend("S4_clone"); |
|
|
// }; |
|
|
// // Neutron Detector |
|
|
// if(ND) { |
|
|
// TTree *N = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
|
|
// nd_clone = new NDLevel2(); |
|
|
// N->Branch("NDLevel2","NDLevel2", &nd_clone); |
|
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
|
|
// if(!Tout)Tout=N; |
|
|
// else Tout->AddFriend("NeutronD_clone"); |
|
|
// }; |
|
|
// // Anticounters |
|
|
// if(AC) { |
|
|
// TTree *A = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
|
|
// ac_clone = new AcLevel2(); |
|
|
// A->Branch("AcLevel2","AcLevel2", &ac_clone); |
|
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
|
|
// if(!Tout)Tout=A; |
|
|
// else Tout->AddFriend("Anticounter_clone"); |
|
|
// }; |
|
|
// // OrbitalInfo |
|
|
// if(ORB) { |
|
|
// TTree *B = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
|
|
// orb_clone = new OrbitalInfo(); |
|
|
// B->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
|
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
|
|
// if(!Tout)Tout=B; |
|
|
// else Tout->AddFriend("OrbitalInfo_clone"); |
|
|
// }; |
|
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
|
2530 |
|
|
2531 |
// tree_clone = Tout; |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
2532 |
// tree_clone->SetDirectory(0); |
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
2533 |
|
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
2534 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
2535 |
|
|
2536 |
|
if( !GetOrbitalInfo() ){ |
2537 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
2538 |
|
return 0; |
2539 |
|
} |
2540 |
|
|
2541 |
// return Tout; |
// --------------------------------------------------------------------- |
2542 |
// } |
// ATTENTION!!! |
2543 |
// /** |
// If data are not pre-processed with cleaner, the level0 tree may contain |
2544 |
// * Fill a tree (created with GetNewPamTree) |
// spurious nested physics packets. |
2545 |
// * |
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
2546 |
// */ |
// while level2 tree DOES NOT!! |
2547 |
// //void PamLevel2::FillNewPamTree(TTree *T){ |
// This means that "quellagiusta" in these cases is not correct. |
2548 |
// void PamLevel2::FillNewPamTree(){ |
// In order to retrieve the correct level0 event, I implemented a check |
2549 |
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
2550 |
|
// is shift forward until when the packets match. |
2551 |
|
// --------------------------------------------------------------------- |
2552 |
|
Int_t answer = 0; |
2553 |
|
Int_t shift =0; |
2554 |
|
do{ |
2555 |
|
if(shift>0){ |
2556 |
|
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
2557 |
|
} |
2558 |
|
answer = l0_tree->GetEntry(quellagiusta+shift); |
2559 |
|
shift++; |
2560 |
|
if( !GetEventHeader() ){ |
2561 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
2562 |
|
return 0; |
2563 |
|
} |
2564 |
|
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
2565 |
|
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
2566 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
2567 |
|
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
2568 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
2569 |
|
|
2570 |
// if(trk1_clone) *trk1_clone = *trk1_obj; |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
|
// if(trk2_clone){ |
|
|
// trk2_clone->Clear(); |
|
|
// trk2_obj->Copy(*trk2_clone); |
|
|
// // *trk2_clone = *trk2_obj; |
|
|
// } |
|
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
|
|
// if(calo1_clone){ |
|
|
// // *calo1_clone = *calo1_obj; |
|
|
// calo1_clone->Clear(); |
|
|
// calo1_obj->Copy(*calo1_clone); |
|
|
// } |
|
|
// if(calo2_clone){ |
|
|
// // *calo2_clone = *calo2_obj; |
|
|
// calo2_clone->Clear(); |
|
|
// calo2_obj->Copy(*calo2_clone); |
|
|
// } |
|
|
// if(tof_clone) *tof_clone = *tof_obj; |
|
|
// if(trig_clone) *trig_clone = *trig_obj; |
|
|
// if(s4_clone) *s4_clone = *s4_obj; |
|
|
// if(nd_clone) *nd_clone = *nd_obj; |
|
|
// if(ac_clone) *ac_clone = *ac_obj; |
|
|
// if(orb_clone) *orb_clone = *orb_obj; |
|
|
|
|
|
// TTree *T = tree_clone; |
|
|
|
|
|
// T->Fill(); //fill main tree |
|
|
// // cout<<T->IsA()->GetName()<<" "<<T->GetName()<<endl; |
|
|
// TList *li = T->GetListOfFriends(); |
|
|
// TIter next(li); |
|
|
// TFriendElement* T_friend=0; |
|
|
// while( (T_friend = (TFriendElement*)next()) ){ |
|
|
// // cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
|
|
// T_friend->GetTree()->Fill();//fill friends |
|
|
// } |
|
2571 |
|
|
2572 |
// } |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
2573 |
|
// return GetYodaTree()->GetEntry(quellagiusta); |
2574 |
|
|
2575 |
|
return answer; |
2576 |
|
|
2577 |
|
} |