1 |
#include <PamLevel2.h> |
#include <PamLevel2.h> |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
///////////////////////////////////////////////////////////////////////////// |
6 |
|
///////////////////////////////////////////////////////////////////////////// |
7 |
|
///////////////////////////////////////////////////////////////////////////// |
8 |
|
///////////////////////////////////////////////////////////////////////////// |
9 |
|
|
10 |
|
void GPamela::Clear(){ |
11 |
|
Irun = 0; |
12 |
|
Ievnt = 0; |
13 |
|
Ipa = 0; |
14 |
|
X0 = 0.; |
15 |
|
Y0 = 0.; |
16 |
|
Z0 = 0.; |
17 |
|
Theta = 0.; |
18 |
|
Phi = 0.; |
19 |
|
P0 = 0.; |
20 |
|
Nthtof = 0; |
21 |
|
Nthcat = 0; |
22 |
|
Nthcas = 0; |
23 |
|
Nthspe = 0; |
24 |
|
Nstrpx = 0; |
25 |
|
Nstrpy = 0; |
26 |
|
Nthcali = 0; |
27 |
|
Nthcal = 0; |
28 |
|
Nthnd = 0; |
29 |
|
Nthcard = 0; |
30 |
|
} |
31 |
|
|
32 |
|
void GPamela::Delete(){ |
33 |
|
|
34 |
|
Clear(); |
35 |
|
|
36 |
|
delete [] Ipltof; |
37 |
|
delete [] Ipaddle; |
38 |
|
delete [] Ipartof; |
39 |
|
delete [] Xintof; |
40 |
|
delete [] Yintof; |
41 |
|
delete [] Zintof; |
42 |
|
delete [] Xouttof; |
43 |
|
delete [] Youttof; |
44 |
|
delete [] Zouttof; |
45 |
|
delete [] Ereltof; |
46 |
|
delete [] Timetof; |
47 |
|
delete [] Pathtof; |
48 |
|
delete [] P0tof; |
49 |
|
delete [] Iparcat; |
50 |
|
delete [] Icat; |
51 |
|
delete [] Xincat; |
52 |
|
delete [] Yincat; |
53 |
|
delete [] Zincat; |
54 |
|
delete [] Xoutcat; |
55 |
|
delete [] Youtcat; |
56 |
|
delete [] Zoutcat; |
57 |
|
delete [] Erelcat; |
58 |
|
delete [] Timecat; |
59 |
|
delete [] Pathcat; |
60 |
|
delete [] P0cat; |
61 |
|
delete [] Iparcas; |
62 |
|
delete [] Icas; |
63 |
|
delete [] Xincas; |
64 |
|
delete [] Yincas; |
65 |
|
delete [] Zincas; |
66 |
|
delete [] Xoutcas; |
67 |
|
delete [] Youtcas; |
68 |
|
delete [] Zoutcas; |
69 |
|
delete [] Erelcas; |
70 |
|
delete [] Timecas; |
71 |
|
delete [] Pathcas; |
72 |
|
delete [] P0cas; |
73 |
|
delete [] Iparspe; |
74 |
|
delete [] Itrpb; |
75 |
|
delete [] Itrsl; |
76 |
|
delete [] Itspa; |
77 |
|
delete [] Xinspe; |
78 |
|
delete [] Yinspe; |
79 |
|
delete [] Zinspe; |
80 |
|
delete [] Xoutspe; |
81 |
|
delete [] Youtspe; |
82 |
|
delete [] Zoutspe; |
83 |
|
delete [] Xavspe; |
84 |
|
delete [] Yavspe; |
85 |
|
delete [] Zavspe; |
86 |
|
delete [] Erelspe; |
87 |
|
delete [] Pathspe; |
88 |
|
delete [] P0spe; |
89 |
|
delete [] Nxmult; |
90 |
|
delete [] Nymult; |
91 |
|
delete [] Npstripx; |
92 |
|
delete [] Ntstripx; |
93 |
|
delete [] Istripx; |
94 |
|
delete [] Qstripx; |
95 |
|
delete [] Xstripx; |
96 |
|
delete [] Npstripy; |
97 |
|
delete [] Ntstripy; |
98 |
|
delete [] Istripy; |
99 |
|
delete [] Qstripy; |
100 |
|
delete [] Ystripy; |
101 |
|
delete [] Icaplane; |
102 |
|
delete [] Icastrip; |
103 |
|
delete [] Icamod; |
104 |
|
delete [] Enestrip; |
105 |
|
delete [] Icapl; |
106 |
|
delete [] Icasi; |
107 |
|
delete [] Icast; |
108 |
|
delete [] Xincal; |
109 |
|
delete [] Yincal; |
110 |
|
delete [] Zincal; |
111 |
|
delete [] Erelcal; |
112 |
|
delete [] Itubend; |
113 |
|
delete [] Iparnd; |
114 |
|
delete [] Xinnd; |
115 |
|
delete [] Yinnd; |
116 |
|
delete [] Zinnd; |
117 |
|
delete [] Xoutnd; |
118 |
|
delete [] Youtnd; |
119 |
|
delete [] Zoutnd; |
120 |
|
delete [] Erelnd; |
121 |
|
delete [] Timend; |
122 |
|
delete [] Pathnd; |
123 |
|
delete [] P0nd; |
124 |
|
delete [] Iparcard; |
125 |
|
delete [] Icard; |
126 |
|
delete [] Xincard; |
127 |
|
delete [] Yincard; |
128 |
|
delete [] Zincard; |
129 |
|
delete [] Xoutcard; |
130 |
|
delete [] Youtcard; |
131 |
|
delete [] Zoutcard; |
132 |
|
delete [] Erelcard; |
133 |
|
delete [] Timecard; |
134 |
|
delete [] Pathcard; |
135 |
|
delete [] P0card; |
136 |
|
|
137 |
|
|
138 |
|
}; |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
void GPamela::SetBranchAddress( TChain* fhBookTree ){ |
143 |
|
|
144 |
|
// cout << "fhBookTree "<<fhBookTree << endl; |
145 |
|
// prepare tree |
146 |
|
fhBookTree->SetBranchAddress("Irun",&Irun); |
147 |
|
fhBookTree->SetBranchAddress("Ievnt",&Ievnt); |
148 |
|
fhBookTree->SetBranchAddress("Ipa",&Ipa); |
149 |
|
fhBookTree->SetBranchAddress("X0",&X0); |
150 |
|
fhBookTree->SetBranchAddress("Y0",&Y0); |
151 |
|
fhBookTree->SetBranchAddress("Z0",&Z0); |
152 |
|
fhBookTree->SetBranchAddress("Theta",&Theta); |
153 |
|
fhBookTree->SetBranchAddress("Phi",&Phi); |
154 |
|
fhBookTree->SetBranchAddress("P0",&P0); |
155 |
|
fhBookTree->SetBranchAddress("Nthtof",&Nthtof); |
156 |
|
fhBookTree->SetBranchAddress("Ipltof",Ipltof); |
157 |
|
fhBookTree->SetBranchAddress("Ipaddle",Ipaddle); |
158 |
|
fhBookTree->SetBranchAddress("Ipartof",Ipartof); |
159 |
|
fhBookTree->SetBranchAddress("Xintof",Xintof); |
160 |
|
fhBookTree->SetBranchAddress("Yintof",Yintof); |
161 |
|
fhBookTree->SetBranchAddress("Zintof",Zintof); |
162 |
|
fhBookTree->SetBranchAddress("Xouttof",Xouttof); |
163 |
|
fhBookTree->SetBranchAddress("Youttof",Youttof); |
164 |
|
fhBookTree->SetBranchAddress("Zouttof",Zouttof); |
165 |
|
fhBookTree->SetBranchAddress("Ereltof",Ereltof); |
166 |
|
fhBookTree->SetBranchAddress("Timetof",Timetof); |
167 |
|
fhBookTree->SetBranchAddress("Pathtof",Pathtof); |
168 |
|
fhBookTree->SetBranchAddress("P0tof",P0tof); |
169 |
|
fhBookTree->SetBranchAddress("Nthcat",&Nthcat); |
170 |
|
fhBookTree->SetBranchAddress("Iparcat",Iparcat); |
171 |
|
fhBookTree->SetBranchAddress("Icat",Icat); |
172 |
|
fhBookTree->SetBranchAddress("Xincat",Xincat); |
173 |
|
fhBookTree->SetBranchAddress("Yincat",Yincat); |
174 |
|
fhBookTree->SetBranchAddress("Zincat",Zincat); |
175 |
|
fhBookTree->SetBranchAddress("Xoutcat",Xoutcat); |
176 |
|
fhBookTree->SetBranchAddress("Youtcat",Youtcat); |
177 |
|
fhBookTree->SetBranchAddress("Zoutcat",Zoutcat); |
178 |
|
fhBookTree->SetBranchAddress("Erelcat",Erelcat); |
179 |
|
fhBookTree->SetBranchAddress("Timecat",Timecat); |
180 |
|
fhBookTree->SetBranchAddress("Pathcat",Pathcat); |
181 |
|
fhBookTree->SetBranchAddress("P0cat",P0cat); |
182 |
|
fhBookTree->SetBranchAddress("Nthcas",&Nthcas); |
183 |
|
fhBookTree->SetBranchAddress("Iparcas",Iparcas); |
184 |
|
fhBookTree->SetBranchAddress("Icas",Icas); |
185 |
|
fhBookTree->SetBranchAddress("Xincas",Xincas); |
186 |
|
fhBookTree->SetBranchAddress("Yincas",Yincas); |
187 |
|
fhBookTree->SetBranchAddress("Zincas",Zincas); |
188 |
|
fhBookTree->SetBranchAddress("Xoutcas",Xoutcas); |
189 |
|
fhBookTree->SetBranchAddress("Youtcas",Youtcas); |
190 |
|
fhBookTree->SetBranchAddress("Zoutcas",Zoutcas); |
191 |
|
fhBookTree->SetBranchAddress("Erelcas",Erelcas); |
192 |
|
fhBookTree->SetBranchAddress("Timecas",Timecas); |
193 |
|
fhBookTree->SetBranchAddress("Pathcas",Pathcas); |
194 |
|
fhBookTree->SetBranchAddress("P0cas",P0cas); |
195 |
|
fhBookTree->SetBranchAddress("Nthspe",&Nthspe); |
196 |
|
fhBookTree->SetBranchAddress("Iparspe",Iparspe); |
197 |
|
fhBookTree->SetBranchAddress("Itrpb",Itrpb); |
198 |
|
fhBookTree->SetBranchAddress("Itrsl",Itrsl); |
199 |
|
fhBookTree->SetBranchAddress("Itspa",Itspa); |
200 |
|
fhBookTree->SetBranchAddress("Xinspe",Xinspe); |
201 |
|
fhBookTree->SetBranchAddress("Yinspe",Yinspe); |
202 |
|
fhBookTree->SetBranchAddress("Zinspe",Zinspe); |
203 |
|
fhBookTree->SetBranchAddress("Xoutspe",Xoutspe); |
204 |
|
fhBookTree->SetBranchAddress("Youtspe",Youtspe); |
205 |
|
fhBookTree->SetBranchAddress("Zoutspe",Zoutspe); |
206 |
|
fhBookTree->SetBranchAddress("Xavspe",Xavspe); |
207 |
|
fhBookTree->SetBranchAddress("Yavspe",Yavspe); |
208 |
|
fhBookTree->SetBranchAddress("Zavspe",Zavspe); |
209 |
|
fhBookTree->SetBranchAddress("Erelspe",Erelspe); |
210 |
|
fhBookTree->SetBranchAddress("Pathspe",Pathspe); |
211 |
|
fhBookTree->SetBranchAddress("P0spe",P0spe); |
212 |
|
fhBookTree->SetBranchAddress("Nxmult",Nxmult); |
213 |
|
fhBookTree->SetBranchAddress("Nymult",Nymult); |
214 |
|
fhBookTree->SetBranchAddress("Nstrpx",&Nstrpx); |
215 |
|
fhBookTree->SetBranchAddress("Npstripx",Npstripx); |
216 |
|
fhBookTree->SetBranchAddress("Ntstripx",Ntstripx); |
217 |
|
fhBookTree->SetBranchAddress("Istripx",Istripx); |
218 |
|
fhBookTree->SetBranchAddress("Qstripx",Qstripx); |
219 |
|
fhBookTree->SetBranchAddress("Xstripx",Xstripx); |
220 |
|
fhBookTree->SetBranchAddress("Nstrpy",&Nstrpy); |
221 |
|
fhBookTree->SetBranchAddress("Npstripy",Npstripy); |
222 |
|
fhBookTree->SetBranchAddress("Ntstripy",Ntstripy); |
223 |
|
fhBookTree->SetBranchAddress("Istripy",Istripy); |
224 |
|
fhBookTree->SetBranchAddress("Qstripy",Qstripy); |
225 |
|
fhBookTree->SetBranchAddress("Ystripy",Ystripy); |
226 |
|
fhBookTree->SetBranchAddress("Nthcali",&Nthcali); |
227 |
|
fhBookTree->SetBranchAddress("Icaplane",Icaplane); |
228 |
|
fhBookTree->SetBranchAddress("Icastrip",Icastrip); |
229 |
|
fhBookTree->SetBranchAddress("Icamod",Icamod); |
230 |
|
fhBookTree->SetBranchAddress("Enestrip",Enestrip); |
231 |
|
fhBookTree->SetBranchAddress("Nthcal",&Nthcal); |
232 |
|
fhBookTree->SetBranchAddress("Icapl",Icapl); |
233 |
|
fhBookTree->SetBranchAddress("Icasi",Icasi); |
234 |
|
fhBookTree->SetBranchAddress("Icast",Icast); |
235 |
|
fhBookTree->SetBranchAddress("Xincal",Xincal); |
236 |
|
fhBookTree->SetBranchAddress("Yincal",Yincal); |
237 |
|
fhBookTree->SetBranchAddress("Zincal",Zincal); |
238 |
|
fhBookTree->SetBranchAddress("Erelcal",Erelcal); |
239 |
|
fhBookTree->SetBranchAddress("Nthnd",&Nthnd); |
240 |
|
fhBookTree->SetBranchAddress("Itubend",Itubend); |
241 |
|
fhBookTree->SetBranchAddress("Iparnd",Iparnd); |
242 |
|
fhBookTree->SetBranchAddress("Xinnd",Xinnd); |
243 |
|
fhBookTree->SetBranchAddress("Yinnd",Yinnd); |
244 |
|
fhBookTree->SetBranchAddress("Zinnd",Zinnd); |
245 |
|
fhBookTree->SetBranchAddress("Xoutnd",Xoutnd); |
246 |
|
fhBookTree->SetBranchAddress("Youtnd",Youtnd); |
247 |
|
fhBookTree->SetBranchAddress("Zoutnd",Zoutnd); |
248 |
|
fhBookTree->SetBranchAddress("Erelnd",Erelnd); |
249 |
|
fhBookTree->SetBranchAddress("Timend",Timend); |
250 |
|
fhBookTree->SetBranchAddress("Pathnd",Pathnd); |
251 |
|
fhBookTree->SetBranchAddress("P0nd",P0nd); |
252 |
|
fhBookTree->SetBranchAddress("Nthcard",&Nthcard); |
253 |
|
fhBookTree->SetBranchAddress("Iparcard",Iparcard); |
254 |
|
fhBookTree->SetBranchAddress("Icard",Icard); |
255 |
|
fhBookTree->SetBranchAddress("Xincard",Xincard); |
256 |
|
fhBookTree->SetBranchAddress("Yincard",Yincard); |
257 |
|
fhBookTree->SetBranchAddress("Zincard",Zincard); |
258 |
|
fhBookTree->SetBranchAddress("Xoutcard",Xoutcard); |
259 |
|
fhBookTree->SetBranchAddress("Youtcard",Youtcard); |
260 |
|
fhBookTree->SetBranchAddress("Zoutcard",Zoutcard); |
261 |
|
fhBookTree->SetBranchAddress("Erelcard",Erelcard); |
262 |
|
fhBookTree->SetBranchAddress("Timecard",Timecard); |
263 |
|
fhBookTree->SetBranchAddress("Pathcard",Pathcard); |
264 |
|
fhBookTree->SetBranchAddress("P0card",P0card); |
265 |
|
|
266 |
|
// fhBookTree->SetBranchStatus("*",0); |
267 |
|
|
268 |
|
} |
269 |
|
|
270 |
|
ClassImp(GPamela); |
271 |
|
|
272 |
|
///////////////////////////////////////////////////////////////////////////// |
273 |
|
///////////////////////////////////////////////////////////////////////////// |
274 |
|
///////////////////////////////////////////////////////////////////////////// |
275 |
|
///////////////////////////////////////////////////////////////////////////// |
276 |
//-------------------------------------- |
//-------------------------------------- |
277 |
// |
// |
278 |
// |
// |
285 |
calo_track = 0; |
calo_track = 0; |
286 |
tof_track = 0; |
tof_track = 0; |
287 |
candeleteobj = 0; |
candeleteobj = 0; |
288 |
|
pscore = 0; |
289 |
|
iscore = 0; |
290 |
}; |
}; |
291 |
//-------------------------------------- |
//-------------------------------------- |
292 |
// |
// |
336 |
calo_track = 0; |
calo_track = 0; |
337 |
tof_track = 0; |
tof_track = 0; |
338 |
} |
} |
339 |
|
pscore = 0; |
340 |
|
iscore = 0; |
341 |
|
|
342 |
} |
} |
343 |
void PamTrack::Delete(){ |
void PamTrack::Delete(){ |
344 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
371 |
}; |
}; |
372 |
|
|
373 |
/** |
/** |
374 |
* Constructor with given dir, list and detectors |
* Constructor |
375 |
|
* @param ddir Name of directory where level2 files are stored. |
376 |
|
* @param list Name of an ascii file containing the list of file names |
377 |
|
* @param detlist Options to chose what to load. |
378 |
|
* Possible options are: |
379 |
|
* +AUTO --> load all trees/branches in the input files |
380 |
|
* +(-)ALL --> inlcude(exclude) all trees/branches |
381 |
|
* +(-)TRK1+(-)TRK2+(-)CAL1+(-)CAL2+(-)TOF+(-)TRG+(-)ND+(-)S4+(-)ORB+(-)AC --> inlcude(exclude) trees and branches |
382 |
|
* +(-)TRK0 --> include(exclude) tracker level0 tree |
383 |
|
* +(-)GP --> include exclude GPAMELA output tree |
384 |
|
* If no options are specified, the default is assumed. Default is: |
385 |
|
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
386 |
*/ |
*/ |
387 |
PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ |
PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ |
388 |
Initialize(); |
Initialize(); |
391 |
}; |
}; |
392 |
|
|
393 |
/** |
/** |
394 |
* Constructor with given dir and list |
* Constructor |
395 |
|
* @param ddir Name of directory where level2 files are stored. |
396 |
|
* @param list Name of an ascii file containing the list of file names |
397 |
|
* Default trees/branches are loaded. Default is: |
398 |
|
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
399 |
*/ |
*/ |
400 |
PamLevel2::PamLevel2(TString ddir,TString list){ |
PamLevel2::PamLevel2(TString ddir,TString list){ |
401 |
Initialize(); |
Initialize(); |
406 |
|
|
407 |
void PamLevel2::Initialize(){ |
void PamLevel2::Initialize(){ |
408 |
|
|
|
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
|
|
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
|
|
// trkh_obj = TrkHough::GetTrkHough(); |
|
|
// calo1_obj = CaloLevel1::GetCaloLevel1(); |
|
|
// calo2_obj = CaloLevel2::GetCaloLevel2(); |
|
|
// tof_obj = ToFLevel2::GetToFLevel2(); |
|
|
// trig_obj = TrigLevel2::GetTrigLevel2(); |
|
|
// s4_obj = S4Level2::GetS4Level2(); |
|
|
// nd_obj = NDLevel2::GetNDLevel2(); |
|
|
// ac_obj = AcLevel2::GetAcLevel2(); |
|
|
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
|
|
|
|
409 |
h0_obj = 0; |
h0_obj = 0; |
410 |
trk0_obj = 0; |
trk0_obj = 0; |
411 |
calo0_obj = 0; |
calo0_obj = 0; |
421 |
nd_obj = 0; |
nd_obj = 0; |
422 |
ac_obj = 0; |
ac_obj = 0; |
423 |
orb_obj = 0; |
orb_obj = 0; |
424 |
|
gp_obj = 0; |
425 |
|
|
426 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
427 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
435 |
dbc = 0; |
dbc = 0; |
436 |
|
|
437 |
prevshift = 0; |
prevshift = 0; |
438 |
|
maxshift = 10; //EMILIANO |
439 |
|
|
440 |
run_tree = NULL; |
run_tree = NULL; |
441 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
446 |
pam_tree = NULL; |
pam_tree = NULL; |
447 |
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; |
448 |
|
|
449 |
|
totdltime[0] = 0LL; |
450 |
|
totdltime[1] = 0LL; |
451 |
|
|
452 |
host = "mysql://localhost/pamelaprod"; |
host = "mysql://localhost/pamelaprod"; |
453 |
user = "anonymous"; |
user = "anonymous"; |
454 |
psw = ""; |
psw = ""; |
471 |
CAL2 = true; |
CAL2 = true; |
472 |
TRK2 = true; |
TRK2 = true; |
473 |
TRK1 = false; |
TRK1 = false; |
474 |
TRKh = false; |
TRK0 = false; |
475 |
TRKh = false; |
TRKh = false; |
476 |
TRG = true; |
TRG = true; |
477 |
TOF = true; |
TOF = true; |
479 |
S4 = true; |
S4 = true; |
480 |
ND = true; |
ND = true; |
481 |
AC = true; |
AC = true; |
482 |
ORB = true; |
ORB = true; |
483 |
|
GP = false; |
484 |
|
|
485 |
RUN = true; |
RUN = true; |
486 |
|
|
487 |
SELLI = -1; |
SELLI = -1; |
488 |
|
|
489 |
|
ISGP = false; |
490 |
|
|
491 |
tsorted=0; |
tsorted=0; |
492 |
timage=0; |
timage=0; |
493 |
|
|
519 |
if(nd_obj) delete nd_obj; |
if(nd_obj) delete nd_obj; |
520 |
if(ac_obj) delete ac_obj; |
if(ac_obj) delete ac_obj; |
521 |
if(orb_obj) delete orb_obj; |
if(orb_obj) delete orb_obj; |
522 |
|
if(gp_obj) delete gp_obj; |
523 |
|
|
524 |
if(tsorted){ |
if(tsorted){ |
525 |
tsorted->Delete(); |
tsorted->Delete(); |
607 |
if(nd_obj) nd_obj->Clear(); |
if(nd_obj) nd_obj->Clear(); |
608 |
if(ac_obj) ac_obj->Clear(); |
if(ac_obj) ac_obj->Clear(); |
609 |
if(orb_obj) orb_obj->Clear(); |
if(orb_obj) orb_obj->Clear(); |
610 |
|
if(gp_obj) gp_obj->Clear(); |
611 |
|
|
612 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
613 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
684 |
nd_obj = 0; |
nd_obj = 0; |
685 |
ac_obj = 0; |
ac_obj = 0; |
686 |
orb_obj = 0; |
orb_obj = 0; |
687 |
|
gp_obj = 0; |
688 |
// |
// |
689 |
// Reset run pointers |
// Reset run pointers |
690 |
// |
// |
694 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
695 |
runlastentry = 0ULL; |
runlastentry = 0ULL; |
696 |
// |
// |
697 |
|
totdltime[0] = 0LL; |
698 |
|
totdltime[1] = 0LL; |
699 |
|
// |
700 |
}; |
}; |
701 |
|
|
702 |
Bool_t PamLevel2::IsGood(){ |
Bool_t PamLevel2::IsGood(){ |
776 |
if(!orb_obj) orb_obj = new OrbitalInfo(); |
if(!orb_obj) orb_obj = new OrbitalInfo(); |
777 |
return &orb_obj; |
return &orb_obj; |
778 |
}; |
}; |
779 |
|
if(!objname.CompareTo("GPamela")){ |
780 |
|
if(!gp_obj) gp_obj = new GPamela(); |
781 |
|
return &gp_obj; |
782 |
|
}; |
783 |
|
|
784 |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
785 |
|
|
935 |
void PamLevel2::SortTracks(){ |
void PamLevel2::SortTracks(){ |
936 |
TString how = howtosort; |
TString how = howtosort; |
937 |
|
|
938 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
939 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
940 |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
941 |
return; |
return; |
965 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
966 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
967 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
968 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
969 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
970 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
971 |
|
|
972 |
|
if ( use_TOF ){ |
973 |
|
use_S1 = true; |
974 |
|
use_S2 = true; |
975 |
|
use_S3 = true; |
976 |
|
}; |
977 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
978 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF ){ |
979 |
|
use_TOF = false; |
980 |
|
use_S1 = false; |
981 |
|
use_S2 = false; |
982 |
|
use_S3 = false; |
983 |
|
} |
984 |
|
|
985 |
if( !TRK2 ){ |
if( !TRK2 ){ |
986 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
987 |
return; |
return; |
1009 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
1010 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
1011 |
// if track has an image, check image selection |
// if track has an image, check image selection |
1012 |
|
|
1013 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
1014 |
|
Int_t ti_score = 0; //image track |
1015 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
1016 |
|
Int_t toti_score = 0; //image track |
1017 |
|
|
1018 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
1019 |
|
|
1020 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
1024 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
1025 |
|
|
1026 |
//assign starting scores |
//assign starting scores |
1027 |
Int_t tp_score = 0; //main track sorted by the tracker |
tp_score = 0; //main track sorted by the tracker |
1028 |
Int_t ti_score = 0; //image track |
ti_score = 0; //image track |
1029 |
|
|
1030 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1031 |
// calorimeter check |
// calorimeter check |
1036 |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
1037 |
return; |
return; |
1038 |
}; |
}; |
1039 |
|
if( use_CAL && !cp && ci ){ |
1040 |
|
ti_score++; |
1041 |
|
toti_score++; |
1042 |
|
}; |
1043 |
|
if( use_CAL && cp && !ci ){ |
1044 |
|
tp_score++; |
1045 |
|
totp_score++; |
1046 |
|
}; |
1047 |
if( |
if( |
1048 |
use_CAL && |
use_CAL && |
1049 |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
1059 |
// else ti_score++; |
// else ti_score++; |
1060 |
|
|
1061 |
|
|
1062 |
if( cp->npresh > ci->npresh) tp_score++; |
if( cp->npresh > ci->npresh){ |
1063 |
if( cp->npresh < ci->npresh) ti_score++; |
tp_score++; |
1064 |
else ;//niente |
totp_score++; |
1065 |
|
}; |
1066 |
|
if( cp->npresh < ci->npresh){ |
1067 |
|
ti_score++; |
1068 |
|
toti_score++; |
1069 |
|
}; |
1070 |
|
|
1071 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
1072 |
|
|
1076 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1077 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1078 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1079 |
if( use_TOF && !tof_obj ){ |
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){ |
1080 |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
1081 |
return; |
return; |
1082 |
}; |
}; |
1083 |
if( use_TOF && op && oi ){ |
// |
1084 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){ |
1085 |
|
ti_score++; |
1086 |
|
toti_score++; |
1087 |
|
}; |
1088 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){ |
1089 |
|
tp_score++; |
1090 |
|
totp_score++; |
1091 |
|
}; |
1092 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){ |
1093 |
// |
// |
1094 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1095 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1101 |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
1102 |
}; |
}; |
1103 |
// |
// |
1104 |
if ( sen >= sortthr ){ |
if ( sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
1105 |
//printf(" IS A NUCLEUS! en = %f \n",sen); |
//printf(" IS A NUCLEUS! en = %f \n",sen); |
1106 |
// |
// |
1107 |
// is a nucleus use a different algorithm |
// is a nucleus use a different algorithm |
1194 |
|
|
1195 |
|
|
1196 |
if( |
if( |
1197 |
use_TOF && |
(use_TOF || use_S1 || use_S2 || use_S3) && |
1198 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
1199 |
true){ |
true){ |
1200 |
|
|
1241 |
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
1242 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
1243 |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
1244 |
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
1245 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
1246 |
|
}; |
1247 |
}; |
}; |
1248 |
|
|
1249 |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
1250 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
1251 |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
1252 |
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
1253 |
|
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
1254 |
|
}; |
1255 |
}; |
}; |
1256 |
|
|
1257 |
if( |
if( |
1258 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
1259 |
true){ |
true){ |
1260 |
|
|
1261 |
if ( nphit_p > nphit_i) tp_score++; |
if ( nphit_p != nphit_i ){ |
1262 |
else if( nphit_p < nphit_i) ti_score++; |
totp_score += nphit_p; |
1263 |
else ;//niente |
toti_score += nphit_i; |
1264 |
|
tp_score+=nphit_p; |
1265 |
|
ti_score+=nphit_i; |
1266 |
|
}; |
1267 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
1268 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
1269 |
|
// else ;//niente |
1270 |
}; |
}; |
1271 |
}; |
}; |
1272 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
1288 |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
1289 |
|
|
1290 |
// CHECK 1 : number of points along X |
// CHECK 1 : number of points along X |
1291 |
if ( tp->GetNX() >= ti->GetNX() )tp_score++ ; |
if ( tp->GetNX() >= ti->GetNX() ){ |
1292 |
if ( tp->GetNX() <= ti->GetNX() )ti_score++ ; |
tp_score++ ; |
1293 |
|
totp_score++ ; |
1294 |
|
}; |
1295 |
|
if ( tp->GetNX() <= ti->GetNX() ){ |
1296 |
|
ti_score++ ; |
1297 |
|
toti_score++ ; |
1298 |
|
}; |
1299 |
// CHECK 2 : number of points along Y |
// CHECK 2 : number of points along Y |
1300 |
if ( tp->GetNY() >= ti->GetNY() )tp_score++ ; |
if ( tp->GetNY() >= ti->GetNY() ){ |
1301 |
if ( tp->GetNY() <= ti->GetNY() )ti_score++ ; |
tp_score++ ; |
1302 |
|
totp_score++ ; |
1303 |
|
}; |
1304 |
|
if ( tp->GetNY() <= ti->GetNY() ){ |
1305 |
|
ti_score++ ; |
1306 |
|
toti_score++ ; |
1307 |
|
}; |
1308 |
// CHECK 3 : chi**2 along X |
// CHECK 3 : chi**2 along X |
1309 |
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
1310 |
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
1332 |
ts = ti;//its image!! |
ts = ti;//its image!! |
1333 |
cs = ci; |
cs = ci; |
1334 |
os = oi; |
os = oi; |
1335 |
|
Int_t totis = toti_score; |
1336 |
|
|
1337 |
ti = tp;//its image!! |
ti = tp;//its image!! |
1338 |
ci = cp; |
ci = cp; |
1342 |
cp = cs; |
cp = cs; |
1343 |
op = os; |
op = os; |
1344 |
|
|
1345 |
|
toti_score = totp_score; |
1346 |
|
totp_score = totis; |
1347 |
|
|
1348 |
|
|
1349 |
}else { |
}else { |
1350 |
|
|
1353 |
}; |
}; |
1354 |
|
|
1355 |
}else{ |
}else{ |
1356 |
|
totp_score = 1; |
1357 |
|
toti_score = 0; |
1358 |
|
|
1359 |
// ts = tp; |
// ts = tp; |
1360 |
// cs = cp; |
// cs = cp; |
1361 |
// os = op; |
// os = op; |
1369 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
1370 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
1371 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
1372 |
|
|
1373 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
1374 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
1375 |
|
|
1376 |
|
((PamTrack*)(ttsorted[i]))->SetPScore(totp_score); |
1377 |
|
((PamTrack*)(ttsorted[i]))->SetIScore(toti_score); |
1378 |
|
((PamTrack*)(ttimage[i]))->SetPScore(totp_score); |
1379 |
|
((PamTrack*)(ttimage[i]))->SetIScore(toti_score); |
1380 |
}; |
}; |
1381 |
|
|
1382 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
1542 |
*/ |
*/ |
1543 |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ |
1544 |
|
|
1545 |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { |
1546 |
// else GetWhichTrees(f); |
cout << "+AUTO"<<endl; |
1547 |
if ( pam_tree ){ |
GetWhichTrees(f); |
1548 |
printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); |
}; |
1549 |
return pam_tree; |
SetWhichTrees(detlist); |
1550 |
}; |
|
1551 |
|
if ( pam_tree ){ |
1552 |
|
printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); |
1553 |
|
return pam_tree; |
1554 |
|
}; |
1555 |
// |
// |
1556 |
|
|
1557 |
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
1558 |
|
|
1559 |
SetWhichTrees(detlist); |
// SetWhichTrees(detlist); |
1560 |
|
|
1561 |
TTree *Trout =0; |
TTree *Trout =0; |
1562 |
|
|
1577 |
if(ND)cout<<"ND "; |
if(ND)cout<<"ND "; |
1578 |
if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
1579 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1580 |
|
if(GP)cout<<"GP "; |
1581 |
cout << endl; |
cout << endl; |
1582 |
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
1583 |
|
|
1676 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1677 |
}; |
}; |
1678 |
|
|
1679 |
|
// GPamela |
1680 |
|
TTree *G = (TTree*)f->Get("h20"); |
1681 |
|
if(G && GP) { |
1682 |
|
if(!gp_obj)gp_obj=new GPamela(); |
1683 |
|
// ------------------------------------ |
1684 |
|
// ATTENZIONE!!! |
1685 |
|
// non so per quale arcano motivo, |
1686 |
|
// per l'albero di gpamela il branch address lo devo settare |
1687 |
|
// DOPO aver fatto friend |
1688 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
1689 |
|
// ------------------------------------ |
1690 |
|
// gp_obj->SetBranchAddress(G); //ho dovuto fare in maniera diversa dagli altri |
1691 |
|
// cout << "h20 : set branch address GPamela "<<endl; |
1692 |
|
if(!Trout)Trout=G; |
1693 |
|
else Trout->AddFriend(G); |
1694 |
|
}else{ |
1695 |
|
// cout << "h20 : missing tree"<<endl; |
1696 |
|
}; |
1697 |
|
|
1698 |
|
|
1699 |
TTree *L = (TTree*)f->Get("SelectionList"); |
TTree *L = (TTree*)f->Get("SelectionList"); |
1700 |
if(L && SELLI==1) { |
if(L && SELLI==1) { |
1701 |
// L->SetBranchAddress("RunEntry",&irun); |
// L->SetBranchAddress("RunEntry",&irun); |
1712 |
|
|
1713 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
1714 |
|
|
1715 |
|
// ------------------------------------ |
1716 |
|
// ATTENZIONE!!! |
1717 |
|
// non so per quale arcano motivo, |
1718 |
|
// per l'albero di gpamela il branch address lo devo settare |
1719 |
|
// DOPO aver fatto friend |
1720 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
1721 |
|
// ------------------------------------ |
1722 |
|
if(G && GP) { |
1723 |
|
gp_obj->SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri |
1724 |
|
cout << "h20 : set branch address GPamela "<<endl; |
1725 |
|
}else{ |
1726 |
|
cout << "h20 : missing tree"<<endl; |
1727 |
|
}; |
1728 |
|
|
1729 |
pam_tree = (TChain*)Trout; |
pam_tree = (TChain*)Trout; |
1730 |
|
|
1731 |
return Trout; |
return Trout; |
1876 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1877 |
*/ |
*/ |
1878 |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
1879 |
// |
// |
1880 |
// |
// |
1881 |
// |
// |
1882 |
if ( pam_tree ){ |
if ( pam_tree ){ |
1883 |
printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); |
printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); |
1884 |
return pam_tree; |
return pam_tree; |
1885 |
}; |
}; |
1886 |
// |
// |
1887 |
|
|
1888 |
TChain *Trout =0; |
TChain *Trout =0; |
1889 |
|
|
|
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
|
|
SetWhichTrees(detlist); |
|
1890 |
|
|
1891 |
cout<< "GetPamTree(TList*,TString): input detector list --> "; |
if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { |
1892 |
if(TRK1)cout<<"TRK1 "; |
if( fl->GetEntries()>0 ){ |
1893 |
if(TRK2)cout<<"TRK2 "; |
cout << "+AUTO"<<endl; |
1894 |
if(TRKh)cout<<"TRKH "; |
TFile *fprimo = new TFile( fl->At(0)->GetName() ); |
1895 |
if(CAL1)cout<<"CAL1 "; |
GetWhichTrees(fprimo); |
1896 |
if(CAL2)cout<<"CAL2 "; |
fprimo->Delete(); |
1897 |
if(TOF)cout<<"TOF "; |
} |
1898 |
if(TRG)cout<<"TRG "; |
}; |
1899 |
if(AC)cout<<"AC "; |
SetWhichTrees(detlist); |
1900 |
if(ND)cout<<"ND "; |
|
|
if(S4)cout<<"S4 "; |
|
|
if(ORB)cout<<"ORB "; |
|
|
cout << endl; |
|
1901 |
|
|
1902 |
|
|
1903 |
|
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
1904 |
|
// |
1905 |
TChain *T = 0; |
TChain *T = 0; |
1906 |
TChain *C = 0; |
TChain *C = 0; |
1907 |
TChain *O = 0; |
TChain *O = 0; |
1910 |
TChain *N = 0; |
TChain *N = 0; |
1911 |
TChain *A = 0; |
TChain *A = 0; |
1912 |
TChain *B = 0; |
TChain *B = 0; |
1913 |
|
TChain *G = 0; |
1914 |
|
|
1915 |
TChain *L = 0; |
TChain *L = 0; |
1916 |
|
|
1922 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
1923 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
1924 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
1925 |
L = new TChain("SelectionList"); |
if(GP) G = new TChain("h20"); |
1926 |
|
L = new TChain("SelectionList"); |
1927 |
|
|
1928 |
// loop over files and create chains |
// loop over files and create chains |
1929 |
TIter next(fl); |
TIter next(fl); |
1940 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
1941 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
1942 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
1943 |
|
if(GP) G->Add(name); |
1944 |
if(SELLI==1) L->Add(name); |
if(SELLI==1) L->Add(name); |
1945 |
}; |
}; |
1946 |
}; |
}; |
1951 |
// UInt_t *found=0; |
// UInt_t *found=0; |
1952 |
// Tracker |
// Tracker |
1953 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
1954 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
// if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1955 |
// else T->SetBranchStatus("TrkLevel2",0,found); |
// if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
1956 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
// if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1957 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
// if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
1958 |
// else T->SetBranchStatus("TrkLevel1",0,found); |
// if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1959 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
// if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
|
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
|
|
// else T->SetBranchStatus("TrkHough",0,found); |
|
|
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
|
1960 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1961 |
else Trout->AddFriend("Tracker"); |
else Trout->AddFriend("Tracker"); |
1962 |
}else{ |
}else{ |
1963 |
cout << "Tracker : missing tree"<<endl; |
// cout << "Tracker : missing tree"<<endl; |
1964 |
}; |
}; |
1965 |
// Calorimeter |
// Calorimeter |
1966 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
1967 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
// if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1968 |
// else C->SetBranchStatus("CaloLevel2",0,found); |
// if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1969 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
// if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1970 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
// if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
|
// else C->SetBranchStatus("CaloLevel1",0,found); |
|
|
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
|
1971 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
1972 |
else Trout->AddFriend("Calorimeter"); |
else Trout->AddFriend("Calorimeter"); |
1973 |
}else{ |
}else{ |
1974 |
cout << "Calorimeter : missing tree"<<endl; |
// cout << "Calorimeter : missing tree"<<endl; |
1975 |
}; |
}; |
1976 |
// ToF |
// ToF |
1977 |
if(O && TOF) { |
if(O && TOF) { |
1978 |
O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
// O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
1979 |
cout << "ToF : set branch address ToFLevel2"<<endl; |
// cout << "ToF : set branch address ToFLevel2"<<endl; |
1980 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
1981 |
else Trout->AddFriend("ToF"); |
else Trout->AddFriend("ToF"); |
1982 |
}else{ |
}else{ |
1983 |
cout << "ToF : missing tree"<<endl; |
// cout << "ToF : missing tree"<<endl; |
1984 |
}; |
}; |
1985 |
// Trigger |
// Trigger |
1986 |
if(R && TRG) { |
if(R && TRG) { |
1987 |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
// R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1988 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
// cout << "Trigger : set branch address TrigLevel2"<<endl; |
1989 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
1990 |
else Trout->AddFriend("Trigger"); |
else Trout->AddFriend("Trigger"); |
1991 |
}else{ |
}else{ |
1992 |
cout << "Trigger : missing tree"<<endl; |
// cout << "Trigger : missing tree"<<endl; |
1993 |
}; |
}; |
1994 |
// S4 |
// S4 |
1995 |
if(S && S4) { |
if(S && S4) { |
1996 |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
// S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1997 |
cout << "S4 : set branch address S4Level2"<<endl; |
// cout << "S4 : set branch address S4Level2"<<endl; |
1998 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
1999 |
else Trout->AddFriend("S4"); |
else Trout->AddFriend("S4"); |
2000 |
}else{ |
}else{ |
2001 |
cout << "S4 : missing tree"<<endl; |
// cout << "S4 : missing tree"<<endl; |
2002 |
}; |
}; |
2003 |
// Neutron Detector |
// Neutron Detector |
2004 |
if(N && ND) { |
if(N && ND) { |
2005 |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
// N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
2006 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
// cout << "NeutronD : set branch address NDLevel2"<<endl; |
2007 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2008 |
else Trout->AddFriend("NeutronD"); |
else Trout->AddFriend("NeutronD"); |
2009 |
}else{ |
}else{ |
2010 |
cout << "NeutronD : missing tree"<<endl; |
// cout << "NeutronD : missing tree"<<endl; |
2011 |
}; |
}; |
2012 |
// Anticounters |
// Anticounters |
2013 |
if(A && AC) { |
if(A && AC) { |
2014 |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
// A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
2015 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
// cout << "Anticounter : set branch address AcLevel2"<<endl; |
2016 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2017 |
else Trout->AddFriend("Anticounter"); |
else Trout->AddFriend("Anticounter"); |
2018 |
}else{ |
}else{ |
2019 |
cout << "Anticounter : missing tree"<<endl; |
// cout << "Anticounter : missing tree"<<endl; |
2020 |
}; |
}; |
2021 |
// Orbital Info |
// Orbital Info |
2022 |
if(B && ORB) { |
if(B && ORB) { |
2023 |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
// B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2024 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
// cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
2025 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2026 |
else Trout->AddFriend("OrbitalInfo"); |
else Trout->AddFriend("OrbitalInfo"); |
2027 |
}else{ |
}else{ |
2028 |
cout << "OrbitalInfo : missing tree"<<endl; |
// cout << "OrbitalInfo : missing tree"<<endl; |
2029 |
}; |
}; |
2030 |
|
// GPamela |
2031 |
|
if(G && GP) { |
2032 |
|
if(!gp_obj)gp_obj = new GPamela(); |
2033 |
|
// ------------------------------------ |
2034 |
|
// ATTENZIONE!!! |
2035 |
|
// non so per quale arcano motivo, |
2036 |
|
// per l'albero di gpamela il branch address lo devo settare |
2037 |
|
// DOPO aver fatto friend |
2038 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
2039 |
|
// ------------------------------------ |
2040 |
|
// gp_obj->SetBranchAddress(G); //ho dovuto fare in maniera diversa dagli altri |
2041 |
|
// cout << "h20 : set branch address GPamela "<<endl; |
2042 |
|
if(!Trout)Trout=G; |
2043 |
|
else Trout->AddFriend("h20"); |
2044 |
|
}else{ |
2045 |
|
// cout << "h20 : missing tree"<<endl; |
2046 |
|
}; |
2047 |
|
|
2048 |
|
// ===================================== |
2049 |
|
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
2050 |
|
// ===================================== |
2051 |
|
SetBranchAddress(Trout); |
2052 |
|
|
2053 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2054 |
|
|
2055 |
// Selection List |
// Selection List |
2070 |
|
|
2071 |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
2072 |
|
|
2073 |
pam_tree = Trout; |
// ------------------------------------ |
2074 |
|
// ATTENZIONE!!! |
2075 |
|
// non so per quale arcano motivo, |
2076 |
|
// per l'albero di gpamela il branch address lo devo settare |
2077 |
|
// DOPO aver fatto friend |
2078 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
2079 |
|
// ------------------------------------ |
2080 |
|
// cout << G << " --- "<<GP <<endl; |
2081 |
|
// if(G && GP) { |
2082 |
|
// gp_obj->SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri |
2083 |
|
// cout << "h20 : set branch address GPamela "<<endl; |
2084 |
|
// }else{ |
2085 |
|
// cout << "h20 : missing tree"<<endl; |
2086 |
|
// }; |
2087 |
|
|
2088 |
|
|
2089 |
|
pam_tree = Trout; |
2090 |
|
|
2091 |
return Trout; |
return Trout; |
2092 |
} |
} |
2093 |
|
|
2113 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
ND = ND & t->GetBranchStatus("NDLevel2"); |
2114 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
AC = AC & t->GetBranchStatus("AcLevel2"); |
2115 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
2116 |
|
GP = GP & t->GetBranchStatus("h20"); |
2117 |
|
|
2118 |
|
|
2119 |
// Tracker |
// Tracker |
2170 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2171 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
2172 |
}; |
}; |
2173 |
|
// GPamela |
2174 |
|
if(GP) { |
2175 |
|
// GetPointerTo("GPamela"); |
2176 |
|
if(!gp_obj)gp_obj = new GPamela(); |
2177 |
|
gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri |
2178 |
|
cout << "h20 : set branch address GPamela "<<endl; |
2179 |
|
}; |
2180 |
// SelectionList |
// SelectionList |
2181 |
if(SELLI==1) { |
if(SELLI==1) { |
2182 |
t->SetBranchAddress("RunEntry", &irun); |
t->SetBranchAddress("RunEntry", &irun); |
2191 |
*/ |
*/ |
2192 |
void PamLevel2::SetBranchAddress(TChain *t){ |
void PamLevel2::SetBranchAddress(TChain *t){ |
2193 |
|
|
2194 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
2195 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
2196 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
2197 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
2198 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
2199 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
2200 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
2201 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
2202 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
2203 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
2204 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
2205 |
|
// GP = GP & t->GetBranchStatus("h20"); |
2206 |
|
|
2207 |
// Tracker |
// Tracker |
2208 |
if(TRK2) { |
if(TRK2) { |
2258 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2259 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
2260 |
}; |
}; |
2261 |
|
// GPamela |
2262 |
|
// cout <<"GP "<<GP<<endl; |
2263 |
|
if(GP) { |
2264 |
|
// GetPointerTo("GPamela"); |
2265 |
|
if(!gp_obj)gp_obj = new GPamela(); |
2266 |
|
gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri |
2267 |
|
cout << "h20 : set branch address GPamela "<<endl; |
2268 |
|
}; |
2269 |
// SelectionList |
// SelectionList |
2270 |
if(SELLI==1) { |
if(SELLI==1) { |
2271 |
t->SetBranchAddress("RunEntry", &irun); |
t->SetBranchAddress("RunEntry", &irun); |
2365 |
// |
// |
2366 |
// check if we have already called once GetEntry, if not call it |
// check if we have already called once GetEntry, if not call it |
2367 |
// |
// |
2368 |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- NON FUNZIONA BENISSIMO.... "<<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- ATTENZIONE --- NON E` MANTENUTA!!!!!!!.... "<<endl; |
2369 |
if(!run){ |
if(!run){ |
2370 |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl; |
2371 |
return(false); |
return(false); |
2384 |
// |
// |
2385 |
// the absolute time is necessary to relate the event with the run |
// the absolute time is necessary to relate the event with the run |
2386 |
// |
// |
2387 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() && !ISGP){ |
2388 |
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; |
2389 |
return(false); |
return(false); |
2390 |
} |
} |
2391 |
|
|
2392 |
|
ULong64_t abstime = 0; |
2393 |
|
if( GetOrbitalInfo() )abstime=GetOrbitalInfo()->absTime; |
2394 |
|
|
2395 |
|
|
2396 |
// |
// |
2397 |
// the first time the routine is called, set run search from the beginning |
// the first time the routine is called, set run search from the beginning |
2398 |
// |
// |
2402 |
runfirstentry = 0LL; |
runfirstentry = 0LL; |
2403 |
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
2404 |
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
2405 |
|
|
2406 |
|
if( ISGP && run->GetEntries()!=1 ){ |
2407 |
|
cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run->GetEntries() << endl; |
2408 |
|
cout << "** WARNING ** run will not be updated"<<endl; |
2409 |
|
} |
2410 |
|
|
2411 |
}; |
}; |
2412 |
// |
// |
2413 |
if ( irun == run->GetEntries()-1LL && |
if(ISGP)abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
2414 |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
// |
2415 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
if ( irun == run->GetEntries()-1LL && |
2416 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && |
2417 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2418 |
){ |
){ |
2419 |
irun = -1LL; |
irun = -1LL; |
2420 |
runfirstentry = 0LL; |
runfirstentry = 0LL; |
2425 |
// |
// |
2426 |
bool fromfirst = true; |
bool fromfirst = true; |
2427 |
// |
// |
2428 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ |
while ( !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ |
2429 |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
2430 |
irun++; |
irun++; |
2431 |
run->GetEntry(irun); |
run->GetEntry(irun); |
2435 |
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2436 |
// cout << "runfirstentry "<<runfirstentry<<endl; |
// cout << "runfirstentry "<<runfirstentry<<endl; |
2437 |
// 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))); |
2438 |
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
// printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME); |
2439 |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
2440 |
// |
// |
2441 |
// prevshift = 0; |
// prevshift = 0; |
2442 |
// |
// |
2443 |
if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){ |
2444 |
printf(" resetting irun (it should NOT happen!!!)\n"); |
printf(" resetting irun (it should NOT happen!!!)\n"); |
2445 |
fromfirst = false; |
fromfirst = false; |
2446 |
irun = 0; |
irun = 0; |
2453 |
}; |
}; |
2454 |
// |
// |
2455 |
if ( |
if ( |
2456 |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && |
2457 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2458 |
) { |
) { |
2459 |
printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime); |
2460 |
return false; |
return false; |
2461 |
} |
} |
2462 |
// |
// |
2508 |
if(SELLI==0){ |
if(SELLI==0){ |
2509 |
|
|
2510 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
2511 |
|
// increment dead and live-time counters |
2512 |
|
// --------------------------------------------------------------- |
2513 |
|
if( GetTrigLevel2() ){ |
2514 |
|
totdltime[0]+=GetTrigLevel2()->dltime[0]; |
2515 |
|
totdltime[1]+=GetTrigLevel2()->dltime[1]; |
2516 |
|
} |
2517 |
|
totdltime[2]++; |
2518 |
|
|
2519 |
|
// cout << setw(10)<<totdltime[0]<<setw(10)<<totdltime[1]<<setw(10)<<totdltime[2]<<endl; |
2520 |
|
|
2521 |
|
// --------------------------------------------------------------- |
2522 |
|
// retrieve OBT and absolute time of the event |
2523 |
|
// --------------------------------------------------------------- |
2524 |
|
ULong64_t abstime = 0; |
2525 |
|
ULong64_t obt = 0; |
2526 |
|
if( GetOrbitalInfo() ){ |
2527 |
|
abstime = GetOrbitalInfo()->absTime; |
2528 |
|
obt = GetOrbitalInfo()->OBT; |
2529 |
|
} |
2530 |
|
// --------------------------------------------------------------- |
2531 |
// the absolute time is necessary to relate the event with the run |
// the absolute time is necessary to relate the event with the run |
2532 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
2533 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() && !ISGP ){ |
2534 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
2535 |
return(false); |
return(false); |
2536 |
} |
} |
2543 |
irunentry = 0; |
irunentry = 0; |
2544 |
prevshift = 0; |
prevshift = 0; |
2545 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2546 |
|
|
2547 |
|
if( ISGP && run_tree->GetEntries()!=1 ){ |
2548 |
|
cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run_tree->GetEntries() << endl; |
2549 |
|
cout << "** WARNING ** run will not be updated"<<endl; |
2550 |
|
} |
2551 |
}; |
}; |
2552 |
|
|
2553 |
|
// ----------------------------------------------------------------------- |
2554 |
|
// if it is simulation, assign abstime by hand (temporaneo!!!) |
2555 |
|
// ----------------------------------------------------------------------- |
2556 |
|
if(ISGP){ |
2557 |
|
abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
2558 |
|
obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO |
2559 |
|
} |
2560 |
// |
// |
2561 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
2562 |
|
|
2570 |
while ( |
while ( |
2571 |
( |
( |
2572 |
( |
( |
2573 |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2574 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
abstime <= GetRunInfo()->RUNTRAILER_TIME) && |
2575 |
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2576 |
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
obt <= GetRunInfo()->RUNTRAILER_OBT) |
2577 |
) |
) |
2578 |
|| GetRunInfo()->NEVENTS==0 |
|| GetRunInfo()->NEVENTS==0 |
2579 |
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento |
2580 |
|
|| !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) |
2581 |
) |
) |
2582 |
&& irun < run_tree->GetEntries() ){ |
&& irun < run_tree->GetEntries() ){ |
2583 |
|
|
2584 |
|
// - - - - - - - - - - - - - |
2585 |
|
// irunentry = position of current entry, relative to the run |
2586 |
|
// prevshift = shift needed to synchronize l0 and l2 data (nested events) |
2587 |
|
// - - - - - - - - - - - - - |
2588 |
|
|
2589 |
|
// ----------------------------------------- |
2590 |
|
// store dead and live-time of previous run |
2591 |
|
// ----------------------------------------- |
2592 |
|
if(fromfirst){ |
2593 |
|
if(oldrun==irun){ |
2594 |
|
/// decrement counters |
2595 |
|
if( GetTrigLevel2()){ |
2596 |
|
totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time |
2597 |
|
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
2598 |
|
} |
2599 |
|
totdltime[2]--; //event counter |
2600 |
|
cout << endl; |
2601 |
|
cout << "n.events : "<<totdltime[2]<<endl; |
2602 |
|
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
2603 |
|
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
2604 |
|
}else{ |
2605 |
|
totdltime[0]=0;//live-time |
2606 |
|
totdltime[1]=0;//dead-time |
2607 |
|
totdltime[2]=0; //event counter |
2608 |
|
cout << " *** JUMP RUN *** irun "<<irun<<endl; |
2609 |
|
} |
2610 |
|
/// add an entry |
2611 |
|
if(run_tree_clone) |
2612 |
|
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
2613 |
|
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
2614 |
|
/// reset counters |
2615 |
|
if( GetTrigLevel2() ){ |
2616 |
|
totdltime[0]=GetTrigLevel2()->dltime[0];//live-time |
2617 |
|
totdltime[1]=0; //dead-time |
2618 |
|
} |
2619 |
|
totdltime[2]=1; //event counter |
2620 |
|
} |
2621 |
|
|
2622 |
|
|
2623 |
irun++; |
irun++; |
2624 |
// ------------------------------------ |
// ------------------------------------ |
2625 |
// if the end of run tree is reached... |
// if the end of run tree is reached... |
2647 |
// ------------------------------------------------------------------- |
// ------------------------------------------------------------------- |
2648 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2649 |
irunentry = 0; |
irunentry = 0; |
2650 |
prevshift = 0; |
prevshift = 0; |
2651 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2652 |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2653 |
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; |
2667 |
|
|
2668 |
// -------------------------------------- |
// -------------------------------------- |
2669 |
// ... otherwise |
// ... otherwise |
2670 |
|
// -------------------------------------- |
2671 |
|
|
2672 |
|
|
2673 |
|
|
2674 |
|
// // ----------------------------------------- |
2675 |
|
// // store dead and live-time of previous run |
2676 |
|
// // ----------------------------------------- |
2677 |
|
// // -------------------------------------------------------------- |
2678 |
|
// // if the run is empty, fill the dead-live time branch with zeros |
2679 |
|
// // -------------------------------------------------------------- |
2680 |
|
// /// if some runs have been jumped, fill with zeros |
2681 |
|
// if(irun-oldrun>1){ |
2682 |
|
// ULong64_t temp[3]; |
2683 |
|
// temp[0]=totdltime[0]; |
2684 |
|
// temp[1]=totdltime[1]; |
2685 |
|
// temp[2]=totdltime[2]; |
2686 |
|
// for(int i=oldrun+1; i<irun; irun++){ |
2687 |
|
// totdltime[0]=0; |
2688 |
|
// totdltime[1]=0; |
2689 |
|
// totdltime[2]=0; |
2690 |
|
// cout << " ** JUMPED RUN **"<<endl; |
2691 |
|
// if(run_tree_clone) |
2692 |
|
// if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
2693 |
|
// run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
2694 |
|
// } |
2695 |
|
// totdltime[0]=temp[0]; |
2696 |
|
// totdltime[1]=temp[1]; |
2697 |
|
// totdltime[2]=temp[2]; |
2698 |
|
// } |
2699 |
|
// /// decrement counters |
2700 |
|
// if( GetTrigLevel2() ){ |
2701 |
|
// totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time |
2702 |
|
// totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
2703 |
|
// } |
2704 |
|
// totdltime[2]--; //event counter |
2705 |
|
// /// add an entry |
2706 |
|
// if(irun>0 ){ |
2707 |
|
// cout << endl; |
2708 |
|
// cout << "n.events : "<<totdltime[2]<<endl; |
2709 |
|
// cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
2710 |
|
// cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
2711 |
|
// if(run_tree_clone) |
2712 |
|
// if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
2713 |
|
// run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
2714 |
|
// } |
2715 |
|
// /// reset counters |
2716 |
|
// if( GetTrigLevel2() ){ |
2717 |
|
// totdltime[0]=GetTrigLevel2()->dltime[0];//live-time |
2718 |
|
// totdltime[1]=0; //dead-time |
2719 |
|
// } |
2720 |
|
// totdltime[2]=1; //event counter |
2721 |
|
|
2722 |
|
|
2723 |
|
// -------------------------------------- |
2724 |
// ---> exit with TRUE |
// ---> exit with TRUE |
2725 |
// -------------------------------------- |
// -------------------------------------- |
2726 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2735 |
true ){ |
true ){ |
2736 |
cout << "* fragment *"<<endl; |
cout << "* fragment *"<<endl; |
2737 |
} |
} |
2738 |
|
|
2739 |
return(true); |
return(true); |
2740 |
}; |
}; |
2741 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2773 |
* @param detlist TString containing the sequence of trees required |
* @param detlist TString containing the sequence of trees required |
2774 |
*/ |
*/ |
2775 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
2776 |
|
|
2777 |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
// if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
2778 |
CAL0 = false; |
if( detlist.Contains("+ALL", TString::kIgnoreCase)){ |
2779 |
|
|
2780 |
|
cout << " ======================================================== "<<endl; |
2781 |
|
cout << " (( WARNING )) "<< endl; |
2782 |
|
cout << " The meaning of the option +ALL has changed!! "<<endl; |
2783 |
|
cout << " Now it includes really all (level0+level1+level2+gpamela)"<<endl; |
2784 |
|
cout << " and the file is discarded if it does not contain all "<<endl; |
2785 |
|
cout << " trees or level0 files are not available!! "<<endl; |
2786 |
|
cout << " ======================================================== "<<endl; |
2787 |
|
|
2788 |
|
CAL0 = true; |
2789 |
CAL1 = true; |
CAL1 = true; |
2790 |
CAL2 = true; |
CAL2 = true; |
2791 |
TRK2 = true; |
TRK2 = true; |
2792 |
TRK1 = false; |
TRK1 = true; |
2793 |
TRKh = false; |
TRKh = true; |
2794 |
TRK0 = false; |
TRK0 = true; |
2795 |
TRG = true; |
TRG = true; |
2796 |
TOF = true; |
TOF = true; |
2797 |
TOF0 = false; |
TOF0 = true; |
2798 |
S4 = true; |
S4 = true; |
2799 |
ND = true; |
ND = true; |
2800 |
AC = true; |
AC = true; |
2801 |
ORB = true; |
ORB = true; |
2802 |
|
GP = true; |
2803 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
2804 |
CAL0 = false; |
CAL0 = false; |
2805 |
CAL1 = false; |
CAL1 = false; |
2815 |
ND = false; |
ND = false; |
2816 |
AC = false; |
AC = false; |
2817 |
ORB = false; |
ORB = false; |
2818 |
|
GP = false; |
2819 |
}; |
}; |
2820 |
|
|
2821 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
2889 |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
2890 |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
2891 |
|
|
2892 |
|
if( detlist.Contains("-GP", TString::kIgnoreCase) )GP = false; |
2893 |
|
else if( detlist.Contains("+GP", TString::kIgnoreCase) )GP = true; |
2894 |
|
|
2895 |
|
cout<< "Set detector list from input --> "; |
2896 |
|
if(TRK0)cout<<"TRK0 "; |
2897 |
|
if(TRK1)cout<<"TRK1 "; |
2898 |
|
if(TRK2)cout<<"TRK2 "; |
2899 |
|
if(TRKh)cout<<"TRKH "; |
2900 |
|
if(CAL0)cout<<"CAL0 "; |
2901 |
|
if(CAL1)cout<<"CAL1 "; |
2902 |
|
if(CAL2)cout<<"CAL2 "; |
2903 |
|
if(TOF)cout<<"TOF "; |
2904 |
|
if(TRG)cout<<"TRG "; |
2905 |
|
if(AC)cout<<"AC "; |
2906 |
|
if(ND)cout<<"ND "; |
2907 |
|
if(S4)cout<<"S4 "; |
2908 |
|
if(ORB)cout<<"ORB "; |
2909 |
|
if(GP)cout<<"GP "; |
2910 |
|
cout << endl; |
2911 |
// cout<< "Set detector list --> "; |
// cout<< "Set detector list --> "; |
2912 |
// if(TRK1)cout<<"TRK1 "; |
// if(TRK1)cout<<"TRK1 "; |
2913 |
// if(TRK2)cout<<"TRK2 "; |
// if(TRK2)cout<<"TRK2 "; |
2914 |
// if(TRKh)cout<<"TRKH "; |
// if(TRKh)cout<<"TRKH "; |
2915 |
// if(CAL1)cout<<"CAL1 "; |
// if(CAL1)cout<<"CAL1 "; |
2916 |
// if(CAL2)cout<<"CAL2 "; |
// if(CAL2)cout<<"CAL2 "; |
2917 |
|
// if(TOF0)cout<<"TOF0 "; |
2918 |
// if(TOF)cout<<"TOF "; |
// if(TOF)cout<<"TOF "; |
2919 |
// if(TRG)cout<<"TRG "; |
// if(TRG)cout<<"TRG "; |
2920 |
// if(AC)cout<<"AC "; |
// if(AC)cout<<"AC "; |
2933 |
|
|
2934 |
|
|
2935 |
|
|
2936 |
cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<<endl; |
// cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<<endl; |
2937 |
// ----------- |
// ----------- |
2938 |
// reset flags |
// reset flags |
2939 |
// ----------- |
// ----------- |
2948 |
ND = false; |
ND = false; |
2949 |
AC = false; |
AC = false; |
2950 |
ORB = false; |
ORB = false; |
2951 |
|
GP = false; |
2952 |
|
|
2953 |
RUN = false; |
RUN = false; |
2954 |
|
|
3039 |
TRK2 = false; |
TRK2 = false; |
3040 |
TRKh = false; |
TRKh = false; |
3041 |
}else nev=nevt; |
}else nev=nevt; |
3042 |
T->Delete(); |
// T->Delete(); |
3043 |
}; |
}; |
3044 |
//========================================================= |
//========================================================= |
3045 |
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
3055 |
CAL1 = false; |
CAL1 = false; |
3056 |
CAL2 = false; |
CAL2 = false; |
3057 |
}else nev=nevt; |
}else nev=nevt; |
3058 |
T->Delete(); |
// T->Delete(); |
3059 |
}; |
}; |
3060 |
|
//========================================================= |
3061 |
|
if( !strcmp(key->GetName(),"h20") ){ |
3062 |
|
GP = true; |
3063 |
|
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
3064 |
|
if( nev && nevt!=nev){ |
3065 |
|
cout << "File: "<< f->GetName() <<" h20 tree has "<<nevt<<" events instead of "<<nev<< endl; |
3066 |
|
GP = false; |
3067 |
|
}else nev=nevt; |
3068 |
|
} |
3069 |
|
|
3070 |
}; |
}; |
3071 |
|
|
3072 |
delete lk; |
// delete lk; |
3073 |
|
|
3074 |
// cout<< "Get detector list from input file --> "; |
cout<< "Get detector list from input file --> "; |
3075 |
// if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
3076 |
// if(TRK2)cout<<"TRK2 "; |
if(TRK2)cout<<"TRK2 "; |
3077 |
// if(TRKh)cout<<"TRKH "; |
if(TRKh)cout<<"TRKH "; |
3078 |
// if(CAL1)cout<<"CAL1 "; |
if(CAL1)cout<<"CAL1 "; |
3079 |
// if(CAL2)cout<<"CAL2 "; |
if(CAL2)cout<<"CAL2 "; |
3080 |
// if(TOF)cout<<"TOF "; |
if(TOF)cout<<"TOF "; |
3081 |
// if(TRG)cout<<"TRG "; |
if(TRG)cout<<"TRG "; |
3082 |
// if(AC)cout<<"AC "; |
if(AC)cout<<"AC "; |
3083 |
// if(ND)cout<<"ND "; |
if(ND)cout<<"ND "; |
3084 |
// if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
3085 |
// if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
3086 |
// cout << endl; |
if(GP)cout<<"GP "; |
3087 |
|
cout << endl; |
3088 |
|
|
3089 |
return ; |
return ; |
3090 |
|
|
3113 |
Bool_t ND__ok = false; |
Bool_t ND__ok = false; |
3114 |
Bool_t AC__ok = false; |
Bool_t AC__ok = false; |
3115 |
Bool_t ORB__ok = false; |
Bool_t ORB__ok = false; |
3116 |
|
Bool_t GP__ok = false; |
3117 |
|
|
3118 |
Bool_t RUN__ok = false; |
Bool_t RUN__ok = false; |
3119 |
|
|
3145 |
// return false; |
// return false; |
3146 |
// }; |
// }; |
3147 |
|
|
3148 |
|
//========================================================= |
3149 |
|
// check if the file |
3150 |
|
|
3151 |
|
|
3152 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
3153 |
|
|
3274 |
}; |
}; |
3275 |
T->Delete(); |
T->Delete(); |
3276 |
}; |
}; |
3277 |
|
//========================================================= |
3278 |
|
if( !strcmp(key->GetName(),"h20") ){ |
3279 |
|
ISGP = true; |
3280 |
|
GP__ok = true; |
3281 |
|
if(GP){ |
3282 |
|
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
3283 |
|
if( nev && nevt!=nev){ |
3284 |
|
cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
3285 |
|
return false; |
3286 |
|
} |
3287 |
|
nev=nevt; |
3288 |
|
} |
3289 |
|
} |
3290 |
|
|
3291 |
}; |
}; |
3292 |
|
|
3376 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
3377 |
return false; |
return false; |
3378 |
}; |
}; |
3379 |
|
if(GP && !GP__ok){ |
3380 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing h20 tree"<< endl; |
3381 |
|
return false; |
3382 |
|
}; |
3383 |
|
|
3384 |
|
|
3385 |
// lk->Delete(); |
// lk->Delete(); |
3398 |
// if(ND)cout<<"ND "; |
// if(ND)cout<<"ND "; |
3399 |
// if(S4)cout<<"S4 "; |
// if(S4)cout<<"S4 "; |
3400 |
// if(ORB)cout<<"ORB "; |
// if(ORB)cout<<"ORB "; |
3401 |
|
// if(GP)cout<<"GP "; |
3402 |
// cout << endl; |
// cout << endl; |
3403 |
|
|
3404 |
return true; |
return true; |
3480 |
} |
} |
3481 |
cout << "----------------------------------------------------"<<endl; |
cout << "----------------------------------------------------"<<endl; |
3482 |
|
|
3483 |
|
// ------------------------------------ |
3484 |
|
// add branch with dead and live times |
3485 |
|
// ------------------------------------ |
3486 |
|
run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l"); |
3487 |
|
cout << "Run : branch DeadLiveTime"<<endl; |
3488 |
|
|
3489 |
|
|
3490 |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
3491 |
sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
3568 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3569 |
i++; |
i++; |
3570 |
}; |
}; |
3571 |
|
// GPamela |
3572 |
|
if(GP) { |
3573 |
|
pam_tree_clone[i] = new TTree("h20","PAMELA oribital info "); |
3574 |
|
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
3575 |
|
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3576 |
|
i++; |
3577 |
|
}; |
3578 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3579 |
|
|
3580 |
} |
} |
3619 |
void PamLevel2::WriteCloneTrees(){ |
void PamLevel2::WriteCloneTrees(){ |
3620 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3621 |
cout << "Write clones of PAMELA trees "<<endl; |
cout << "Write clones of PAMELA trees "<<endl; |
3622 |
cout << run_tree_clone->GetName()<<endl; |
cout << run_tree_clone->GetName()<<endl; |
3623 |
|
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
3624 |
|
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
3625 |
run_tree_clone->Write(); |
run_tree_clone->Write(); |
3626 |
cout << sel_tree_clone->GetName()<<endl; |
cout << sel_tree_clone->GetName()<<endl; |
3627 |
sel_tree_clone->Write(); |
sel_tree_clone->Write(); |
3665 |
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; |
3666 |
return 0; |
return 0; |
3667 |
} |
} |
3668 |
|
|
3669 |
|
// cout << " gp_obj->P0 "<<gp_obj->P0<<endl; |
3670 |
// |
// |
3671 |
// ... 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. |
3672 |
// 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 |
3757 |
// open the DB connection |
// open the DB connection |
3758 |
// (if not already opened) |
// (if not already opened) |
3759 |
//=================================== |
//=================================== |
3760 |
if(!dbc || (dbc && !dbc->IsConnected())){ |
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
|
|
cout<<"Connecting to DB"<<endl; |
|
|
cout<<"HOST "<<host<<endl; |
|
|
cout<<"USER "<<user<<endl; |
|
|
cout<<"PSW "<<psw<<endl; |
|
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
|
|
if( !dbc )return NULL; |
|
|
if( !dbc->IsConnected() )return NULL; |
|
|
// cout<<"...done"<<endl; |
|
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
|
|
}else{ |
|
|
// cout<<"DB already connected"<<endl; |
|
|
} |
|
3761 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
3762 |
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
3763 |
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
3805 |
cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<<endl; |
cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<<endl; |
3806 |
} |
} |
3807 |
|
|
3808 |
|
// dbc->Close(); |
3809 |
|
|
3810 |
|
|
3811 |
}; |
}; |
3812 |
|
|
3813 |
if(!dbc || (dbc && !dbc->IsConnected())){ |
// if(!dbc || (dbc && !dbc->IsConnected())){ |
3814 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
3815 |
} |
// } |
3816 |
|
|
3817 |
if ( TRK0 ){ |
if ( TRK0 ){ |
3818 |
TrkParams::Load(6); |
TrkParams::Load(6); |
3819 |
if( !TrkParams::IsLoaded(6) ){ |
if( !TrkParams::IsLoaded(6) ){ |
3820 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
3821 |
}; |
}; |
3822 |
|
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
3823 |
TrkParams::SetCalib(run_obj,dbc); |
TrkParams::SetCalib(run_obj,dbc); |
3824 |
TrkParams::LoadCalib( ); |
TrkParams::LoadCalib( ); |
3825 |
if( !TrkParams::CalibIsLoaded() ){ |
if( !TrkParams::CalibIsLoaded() ){ |
3827 |
}; |
}; |
3828 |
} |
} |
3829 |
|
|
3830 |
|
|
3831 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
|
|
|
3832 |
return l0_tree; |
return l0_tree; |
3833 |
|
|
3834 |
} |
} |
3856 |
|
|
3857 |
// 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; |
3858 |
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
3859 |
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
// cout << " time "<< abstime << endl; |
3860 |
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
3861 |
|
|
3862 |
if( !GetOrbitalInfo() ){ |
ULong64_t obt = 0; |
3863 |
|
ULong64_t pktn = 0; |
3864 |
|
if( GetOrbitalInfo() ){ |
3865 |
|
obt = GetOrbitalInfo()->OBT; |
3866 |
|
pktn = GetOrbitalInfo()->pkt_num; |
3867 |
|
} |
3868 |
|
|
3869 |
|
if( !GetOrbitalInfo() && !ISGP){ |
3870 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
3871 |
return 0; |
return 0; |
3872 |
} |
} |
3873 |
if( GetOrbitalInfo()->OBT==0 && GetOrbitalInfo()->pkt_num==0 ){ |
if( obt==0 && pktn==0 && !ISGP ){ |
3874 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl; |
3875 |
return 0; |
return 0; |
3876 |
} |
} |
3889 |
Int_t answer = 0; |
Int_t answer = 0; |
3890 |
Int_t shift =0; |
Int_t shift =0; |
3891 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
3892 |
Int_t maxshift = 10; |
// Int_t maxshift = 50; // EMILIANO |
3893 |
do{ |
do{ |
3894 |
if(shift>0){ |
if(shift>0){ |
3895 |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3896 |
cout << " RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM <<endl; |
cout << " RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM <<endl; |
3897 |
cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
3898 |
} |
} |
3902 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
3903 |
return 0; |
return 0; |
3904 |
} |
} |
3905 |
// cout << "PKTNUM "<<shift<<" == L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
|
3906 |
// cout << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
if(ISGP){ |
3907 |
|
obt = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO |
3908 |
|
pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO |
3909 |
|
} |
3910 |
|
|
3911 |
|
// cout << "PKTNUM "<<shift<<" == L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3912 |
|
// cout << " L2 --- "<< obt << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
3913 |
// 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; |
3914 |
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
// cout << " obt "<< obt << endl; |
3915 |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
3916 |
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
// cout << " pktn "<< pktn << endl; |
3917 |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
3918 |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
3919 |
// |
// |
3922 |
shift = -1; |
shift = -1; |
3923 |
}; |
}; |
3924 |
|
|
3925 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
}while( ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || |
3926 |
|
pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ) |
3927 |
|
&& (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
3928 |
|
|
3929 |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
3930 |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
3950 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
3951 |
if( !dbc )return false; |
if( !dbc )return false; |
3952 |
if( !dbc->IsConnected() )return false; |
if( !dbc->IsConnected() )return false; |
3953 |
|
stringstream myquery; // EMILIANO |
3954 |
|
myquery.str(""); // EMILIANO |
3955 |
|
myquery << "SET time_zone='+0:00'"; // EMILIANO |
3956 |
|
dbc->Query(myquery.str().c_str()); // EMILIANO |
3957 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3958 |
return true; |
return true; |
3959 |
|
|
3960 |
} |
} |
3961 |
|
|
3962 |
|
/** |
3963 |
|
* \Brief Add a friend to the pamela chain. |
3964 |
|
* @param cname name of the chain to be added |
3965 |
|
*/ |
3966 |
|
|
3967 |
|
TChain* PamLevel2::AddFriend(TString cname){ |
3968 |
|
|
3969 |
|
if(!GetPamTree()){ |
3970 |
|
cout << " TChain* PamLevel2::AddFriend(TString cname) --- a pamela tree must be created first"<<endl; |
3971 |
|
return NULL; |
3972 |
|
} |
3973 |
|
|
3974 |
|
|
3975 |
|
TChain *c = new TChain( cname.Data() ); |
3976 |
|
|
3977 |
|
TIter next( GetPamTree()->GetListOfFiles() ); |
3978 |
|
Int_t nf = 0; |
3979 |
|
TChainElement* element = 0; |
3980 |
|
while ((element = (TChainElement*) next())) { |
3981 |
|
c->Add(element->GetTitle()); |
3982 |
|
nf++; |
3983 |
|
} |
3984 |
|
|
3985 |
|
GetPamTree()->AddFriend(cname.Data()); |
3986 |
|
|
3987 |
|
cout << "external chain created and added to pamela friends :"<<cname<<endl; |
3988 |
|
cout << "n.files "<<nf<<endl; |
3989 |
|
|
3990 |
|
|
3991 |
|
return c; |
3992 |
|
|
3993 |
|
} |
3994 |
|
|
3995 |
|
|