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; |
364 |
// |
// |
365 |
//-------------------------------------- |
//-------------------------------------- |
366 |
/** |
/** |
367 |
* Constructor |
* Default Constructor |
368 |
*/ |
*/ |
369 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
370 |
|
Initialize(); |
371 |
|
}; |
372 |
|
|
373 |
|
/** |
374 |
|
* 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){ |
388 |
|
Initialize(); |
389 |
|
TList* listf = GetListOfLevel2Files(ddir,list); |
390 |
|
GetPamTree(listf,detlist); |
391 |
|
GetRunTree(listf); |
392 |
|
}; |
393 |
|
|
394 |
|
/** |
395 |
|
* Constructor |
396 |
|
* @param ddir Name of directory where level2 files are stored. |
397 |
|
* @param list Name of an ascii file containing the list of file names |
398 |
|
* Default trees/branches are loaded. Default is: |
399 |
|
* +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB |
400 |
|
*/ |
401 |
|
PamLevel2::PamLevel2(TString ddir,TString list){ |
402 |
|
Initialize(); |
403 |
|
TList* listf = GetListOfLevel2Files(ddir,list); |
404 |
|
GetPamTree(listf,""); |
405 |
|
GetRunTree(listf); |
406 |
|
}; |
407 |
|
|
408 |
|
|
409 |
|
void PamLevel2::Initialize(){ |
410 |
|
|
411 |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
h0_obj = 0; |
412 |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
trk0_obj = 0; |
413 |
// trkh_obj = TrkHough::GetTrkHough(); |
calo0_obj = 0; |
414 |
// 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(); |
|
415 |
trk2_obj = 0; |
trk2_obj = 0; |
416 |
trk1_obj = 0; |
trk1_obj = 0; |
417 |
trkh_obj = 0; |
trkh_obj = 0; |
423 |
nd_obj = 0; |
nd_obj = 0; |
424 |
ac_obj = 0; |
ac_obj = 0; |
425 |
orb_obj = 0; |
orb_obj = 0; |
426 |
|
gp_obj = 0; |
427 |
|
|
428 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
429 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
430 |
irun = -1; |
irun = -1LL; |
431 |
runfirstentry = 0ULL; |
irunt = -1LL; |
432 |
runlastentry = 0ULL; |
runfirstentry = 0LL; |
433 |
|
runlastentry = 0LL; |
434 |
|
|
435 |
|
l0_file = NULL; |
436 |
|
l0_tree = NULL; |
437 |
|
iroot = -1; |
438 |
|
dbc = 0; |
439 |
|
|
440 |
|
prevshift = 0; |
441 |
|
maxshift = 10; //EMILIANO |
442 |
|
|
443 |
|
run_tree = NULL; |
444 |
|
run_tree_clone = NULL; |
445 |
|
sel_tree = NULL; |
446 |
|
sel_tree_clone = NULL; |
447 |
|
|
448 |
|
irunentry = -1LL; |
449 |
|
pam_tree = NULL; |
450 |
|
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
451 |
|
|
452 |
|
totdltime[0] = 0LL; |
453 |
|
totdltime[1] = 0LL; |
454 |
|
totdltime[2] = 0LL; |
455 |
|
|
456 |
|
host = "mysql://localhost/pamelaprod"; |
457 |
|
user = "anonymous"; |
458 |
|
psw = ""; |
459 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
460 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
461 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
462 |
|
if ( !pamdbhost ) pamdbhost = ""; |
463 |
|
if ( !pamdbuser ) pamdbuser = ""; |
464 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
465 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
466 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
467 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
468 |
|
|
469 |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
|
470 |
|
|
471 |
// sorted_tracks = 0;//new TRefArray(); |
// sorted_tracks = 0;//new TRefArray(); |
472 |
|
|
473 |
|
CAL0 = false; |
474 |
CAL1 = true; |
CAL1 = true; |
475 |
CAL2 = true; |
CAL2 = true; |
476 |
TRK2 = true; |
TRK2 = true; |
477 |
TRK1 = false; |
TRK1 = false; |
478 |
|
TRK0 = false; |
479 |
TRKh = false; |
TRKh = false; |
480 |
TRG = true; |
TRG = true; |
481 |
TOF = true; |
TOF = true; |
482 |
S4 = true; |
TOF0 = false; |
483 |
ND = true; |
S4 = true; |
484 |
AC = true; |
ND = true; |
485 |
ORB = true; |
AC = true; |
486 |
|
ORB = true; |
487 |
RUN = true; |
GP = false; |
488 |
|
|
489 |
|
RUN = true; |
490 |
|
|
491 |
|
SELLI = -1; |
492 |
|
|
493 |
|
ISGP = false; |
494 |
|
|
495 |
tsorted=0; |
tsorted=0; |
496 |
timage=0; |
timage=0; |
497 |
|
|
498 |
|
howtosort = "+CAL+TOF"; |
499 |
|
//howtosort = "+TOF"; |
500 |
|
sortthr = 100.; |
501 |
|
|
502 |
}; |
}; |
503 |
/** |
/** |
509 |
if(soft_obj)delete soft_obj; //Emiliano |
if(soft_obj)delete soft_obj; //Emiliano |
510 |
|
|
511 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
512 |
|
if(h0_obj) delete h0_obj; |
513 |
|
if(trk0_obj) delete trk0_obj; |
514 |
|
if(calo0_obj) delete calo0_obj; |
515 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
516 |
if(trk2_obj) delete trk2_obj; |
if(trk2_obj) delete trk2_obj; |
517 |
if(trkh_obj) delete trkh_obj; |
if(trkh_obj) delete trkh_obj; |
523 |
if(nd_obj) delete nd_obj; |
if(nd_obj) delete nd_obj; |
524 |
if(ac_obj) delete ac_obj; |
if(ac_obj) delete ac_obj; |
525 |
if(orb_obj) delete orb_obj; |
if(orb_obj) delete orb_obj; |
526 |
|
if(gp_obj) delete gp_obj; |
527 |
|
|
528 |
if(tsorted){ |
if(tsorted){ |
529 |
tsorted->Delete(); |
tsorted->Delete(); |
533 |
timage->Delete(); |
timage->Delete(); |
534 |
delete timage; |
delete timage; |
535 |
} |
} |
536 |
|
|
537 |
|
if(dbc){ |
538 |
|
dbc->Close(); |
539 |
|
delete dbc; |
540 |
|
} |
541 |
|
|
542 |
|
if(l0_file)l0_file->Close(); |
543 |
|
// if(pam_tree)pam_tree->Delete();; |
544 |
|
|
545 |
|
if ( pam_tree ){ |
546 |
|
// |
547 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
548 |
|
// |
549 |
|
TList *temp = pam_tree->GetListOfFriends(); |
550 |
|
TList *contents = new TList; // create chain friend list |
551 |
|
contents->SetOwner(); |
552 |
|
TIter next(temp); |
553 |
|
TChain *questo = 0; |
554 |
|
while ( (questo = (TChain*) next()) ){ |
555 |
|
TString name = questo->GetName(); |
556 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
557 |
|
}; |
558 |
|
// |
559 |
|
// deleting the main chain |
560 |
|
// |
561 |
|
pam_tree->Delete(); |
562 |
|
// |
563 |
|
// deleting the friends... |
564 |
|
// |
565 |
|
TIter next2(contents); |
566 |
|
TChain *questa = 0; |
567 |
|
while ( questa = (TChain*)next2() ){ |
568 |
|
TString name = questa->GetName(); |
569 |
|
questa->Delete(); |
570 |
|
questa=NULL; |
571 |
|
}; |
572 |
|
// |
573 |
|
}; |
574 |
|
pam_tree = NULL; |
575 |
|
|
576 |
|
if(run_tree)run_tree->Delete();; |
577 |
|
if(sel_tree)sel_tree->Delete();; |
578 |
|
for(Int_t i=0; i<NCLONES; i++ )if(pam_tree_clone[i])pam_tree_clone[i]->Delete();; |
579 |
|
if(run_tree_clone)run_tree_clone->Delete();; |
580 |
|
if(sel_tree_clone)sel_tree_clone->Delete();; |
581 |
|
|
582 |
|
if(irunoffset) delete [] irunoffset; |
583 |
|
|
584 |
}; |
}; |
585 |
|
|
586 |
/** |
/** |
598 |
// 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 |
599 |
// if(soft_obj) soft_obj->Clear(); |
// if(soft_obj) soft_obj->Clear(); |
600 |
|
|
601 |
|
if(h0_obj) h0_obj->Clear(); |
602 |
|
// if(trk0_obj) trk0_obj->Clear(); |
603 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
604 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
605 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
606 |
|
if(calo0_obj) calo0_obj->Clear(); |
607 |
if(calo1_obj)calo1_obj->Clear(); |
if(calo1_obj)calo1_obj->Clear(); |
608 |
if(calo2_obj)calo2_obj->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
609 |
if(tof_obj) tof_obj->Clear(); |
if(tof_obj) tof_obj->Clear(); |
612 |
if(nd_obj) nd_obj->Clear(); |
if(nd_obj) nd_obj->Clear(); |
613 |
if(ac_obj) ac_obj->Clear(); |
if(ac_obj) ac_obj->Clear(); |
614 |
if(orb_obj) orb_obj->Clear(); |
if(orb_obj) orb_obj->Clear(); |
615 |
|
if(gp_obj) gp_obj->Clear(); |
616 |
|
|
617 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
618 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
623 |
if(timage){ |
if(timage){ |
624 |
timage->Delete(); |
timage->Delete(); |
625 |
} |
} |
|
|
|
626 |
}; |
}; |
627 |
|
|
628 |
|
void PamLevel2::Reset(){ |
629 |
|
// |
630 |
|
// First of all clear everything |
631 |
|
// |
632 |
|
Clear(); |
633 |
|
// |
634 |
|
// close and reset chains and pointers |
635 |
|
// |
636 |
|
if ( pam_tree ){ |
637 |
|
// |
638 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
639 |
|
// |
640 |
|
TList *temp = pam_tree->GetListOfFriends(); |
641 |
|
TList *contents = new TList; // create chain friend list |
642 |
|
contents->SetOwner(); |
643 |
|
TIter next(temp); |
644 |
|
TChain *questo = 0; |
645 |
|
while ( (questo = (TChain*) next()) ){ |
646 |
|
TString name = questo->GetName(); |
647 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
648 |
|
}; |
649 |
|
// |
650 |
|
// deleting the main chain |
651 |
|
// |
652 |
|
pam_tree->Delete(); |
653 |
|
// |
654 |
|
// deleting the friends... |
655 |
|
// |
656 |
|
TIter next2(contents); |
657 |
|
TChain *questa = 0; |
658 |
|
while ( questa = (TChain*)next2() ){ |
659 |
|
TString name = questa->GetName(); |
660 |
|
questa->Delete(); |
661 |
|
questa=NULL; |
662 |
|
}; |
663 |
|
// |
664 |
|
}; |
665 |
|
pam_tree = NULL; |
666 |
|
// |
667 |
|
if(run_tree)run_tree->Delete();; |
668 |
|
run_tree = NULL; |
669 |
|
if(sel_tree)sel_tree->Delete();; |
670 |
|
sel_tree = NULL; |
671 |
|
// |
672 |
|
// Close file |
673 |
|
// |
674 |
|
if(l0_file)l0_file->Close("R"); |
675 |
|
l0_file = NULL; |
676 |
|
// |
677 |
|
h0_obj = 0; |
678 |
|
trk0_obj = 0; |
679 |
|
calo0_obj = 0; |
680 |
|
// |
681 |
|
trk2_obj = 0; |
682 |
|
trk1_obj = 0; |
683 |
|
trkh_obj = 0; |
684 |
|
calo1_obj = 0; |
685 |
|
calo2_obj = 0; |
686 |
|
tof_obj = 0; |
687 |
|
trig_obj = 0; |
688 |
|
s4_obj = 0; |
689 |
|
nd_obj = 0; |
690 |
|
ac_obj = 0; |
691 |
|
orb_obj = 0; |
692 |
|
gp_obj = 0; |
693 |
|
// |
694 |
|
// Reset run pointers |
695 |
|
// |
696 |
|
run_obj = 0;//new GL_RUN(); |
697 |
|
soft_obj = 0;// Emiliano |
698 |
|
irun = -1; |
699 |
|
irunt = -1; |
700 |
|
runfirstentry = 0ULL; |
701 |
|
runlastentry = 0ULL; |
702 |
|
// |
703 |
|
totdltime[0] = 0LL; |
704 |
|
totdltime[1] = 0LL; |
705 |
|
totdltime[2] = 0LL; |
706 |
|
// |
707 |
|
}; |
708 |
|
|
709 |
|
Bool_t PamLevel2::IsGood(){ |
710 |
|
Bool_t goodev=true; |
711 |
|
// if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
712 |
|
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
713 |
|
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
714 |
|
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
715 |
|
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
716 |
|
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
717 |
|
if(ac_obj && ac_obj->unpackError != 255) goodev = false; |
718 |
|
// if(orb_obj) |
719 |
|
return goodev; |
720 |
|
}; |
721 |
|
|
722 |
//-------------------------------------- |
//-------------------------------------- |
723 |
// |
// |
783 |
if(!orb_obj) orb_obj = new OrbitalInfo(); |
if(!orb_obj) orb_obj = new OrbitalInfo(); |
784 |
return &orb_obj; |
return &orb_obj; |
785 |
}; |
}; |
786 |
|
if(!objname.CompareTo("GPamela")){ |
787 |
|
if(!gp_obj) gp_obj = new GPamela(); |
788 |
|
return &gp_obj; |
789 |
|
}; |
790 |
|
|
791 |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
792 |
|
|
802 |
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
803 |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
804 |
*/ |
*/ |
805 |
CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ |
CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ |
806 |
|
|
807 |
if( !calo2_obj )return 0; |
if( !calo2_obj )return 0; |
808 |
|
|
809 |
if( calo2_obj->CaloLevel2::ntrk()==0 ){ |
if( calo2_obj->CaloLevel2::ntrk()==0 ){ |
810 |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<<endl; |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<<endl; |
811 |
return NULL; |
return NULL; |
812 |
}; |
}; |
813 |
|
|
814 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
815 |
Int_t it_calo=0; |
Int_t it_calo=0; |
816 |
|
|
817 |
do{ |
do{ |
818 |
c = calo2_obj->CaloLevel2::GetCaloTrkVar(it_calo); |
c = calo2_obj->CaloLevel2::GetCaloTrkVar(it_calo); |
819 |
it_calo++; |
it_calo++; |
820 |
} while( c && seqno != c->trkseqno && it_calo < calo2_obj->CaloLevel2::ntrk()); |
} while( c && seqno != c->trkseqno && it_calo < calo2_obj->CaloLevel2::ntrk()); |
821 |
|
|
822 |
if(!c || seqno != c->trkseqno){ |
if(!c || seqno != c->trkseqno){ |
823 |
c = 0; |
c = 0; |
824 |
if(seqno!=-1)cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match Calorimeter stored tracks"<<endl; |
if(seqno!=-1)cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match Calorimeter stored tracks"<<endl; |
825 |
}; |
}; |
826 |
return c; |
return c; |
827 |
|
|
828 |
}; |
}; |
829 |
//-------------------------------------- |
//-------------------------------------- |
830 |
// |
// |
831 |
// |
// |
832 |
//-------------------------------------- |
//-------------------------------------- |
833 |
/** |
/** |
834 |
* Retrieves the ToF track matching the seqno-th tracker stored track. |
* Retrieves the ToF track matching the seqno-th tracker stored track. |
835 |
* (If seqno = -1 retrieves the tracker-independent tof track) |
* (If seqno = -1 retrieves the tracker-independent tof track) |
836 |
*/ |
*/ |
837 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno){ |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno){ |
838 |
|
|
839 |
if( !tof_obj )return 0; |
if( !tof_obj )return 0; |
840 |
|
|
841 |
if( tof_obj->ToFLevel2::ntrk()==0 ){ |
if( tof_obj->ToFLevel2::ntrk()==0 ){ |
842 |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<<endl; |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<<endl; |
843 |
return NULL; |
return NULL; |
844 |
}; |
}; |
845 |
|
|
846 |
ToFTrkVar *c = 0; |
ToFTrkVar *c = 0; |
847 |
Int_t it_tof=0; |
Int_t it_tof=0; |
848 |
|
|
849 |
do{ |
do{ |
850 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
851 |
it_tof++; |
it_tof++; |
852 |
} while( c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while( c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
853 |
|
|
854 |
if(!c || seqno != c->trkseqno){ |
if(!c || seqno != c->trkseqno){ |
855 |
c = 0; |
c = 0; |
856 |
if(seqno!=-1)cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match ToF stored tracks"<<endl; |
if(seqno!=-1)cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match ToF stored tracks"<<endl; |
857 |
}; |
}; |
858 |
return c; |
return c; |
859 |
|
|
860 |
}; |
}; |
861 |
|
|
862 |
//-------------------------------------- |
//-------------------------------------- |
863 |
// |
// |
864 |
// |
// |
865 |
//-------------------------------------- |
//-------------------------------------- |
866 |
/** |
/** |
867 |
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
868 |
*/ |
*/ |
869 |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
870 |
|
|
871 |
cout <<"PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** "<<endl; |
cout <<"PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** "<<endl; |
872 |
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
873 |
|
|
874 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
875 |
ToFTrkVar *o = 0; |
ToFTrkVar *o = 0; |
876 |
|
|
877 |
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
878 |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
879 |
|
|
880 |
// if(t && c && o)track = new PamTrack(t,c,o); |
// if(t && c && o)track = new PamTrack(t,c,o); |
881 |
PamTrack *track = new PamTrack(t,c,o); |
PamTrack *track = new PamTrack(t,c,o); |
882 |
|
|
883 |
return track; |
return track; |
884 |
|
|
885 |
}; |
}; |
886 |
//-------------------------------------- |
//-------------------------------------- |
887 |
// |
// |
888 |
// |
// |
916 |
} |
} |
917 |
//-------------------------------------- |
//-------------------------------------- |
918 |
// |
// |
919 |
|
|
920 |
|
/** |
921 |
|
* Sort physical (tracker) tracks. Left here as backward compatibility method. |
922 |
|
**/ |
923 |
|
void PamLevel2::SortTracks(TString how){ |
924 |
|
printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); |
925 |
|
howtosort = how; |
926 |
|
SortTracks(); |
927 |
|
}; |
928 |
|
|
929 |
// |
// |
930 |
//-------------------------------------- |
//-------------------------------------- |
931 |
/** |
/** |
932 |
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. |
* Sort physical (tracker) tracks. |
933 |
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
934 |
* Sorting cryteria: |
* Sorting cryteria: |
935 |
* TRK: lower chi**2 |
* TRK: lower chi**2 |
936 |
* CAL: lower Y spatial residual on the first calorimeter plane |
* CAL: lower Y spatial residual on the first calorimeter plane |
937 |
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
938 |
|
* S1: (ask Emiliano) |
939 |
|
* S2: (ask Emiliano) |
940 |
|
* S3: (ask Emiliano) |
941 |
|
* GP: more GP hits |
942 |
* The default sorting cryterium is "TOF+CAL". |
* The default sorting cryterium is "TOF+CAL". |
943 |
* |
* |
944 |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
945 |
*/ |
*/ |
946 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(){ |
947 |
|
TString how = howtosort; |
948 |
|
|
949 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
950 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
951 |
cout << "void PamLevel2::SortTracks(TString how): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
952 |
return; |
return; |
953 |
}; |
}; |
954 |
// cout << "call SortTracs() "<<endl; |
//Save current Object count |
|
//Save current Object count |
|
955 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
956 |
|
|
957 |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
// create TCloneArrays to store tracks and its images |
|
|
|
|
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
|
|
// sorted_tracks->Clear(); |
|
|
// sorted_tracks.Clear(); |
|
|
|
|
958 |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
959 |
tsorted->Delete(); |
tsorted->Delete(); |
960 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
961 |
|
|
962 |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
963 |
timage->Delete(); |
timage->Delete(); |
964 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
965 |
|
|
966 |
|
|
967 |
// loop over the tracks sorted by the tracker |
|
968 |
|
//-------------------------------------------------- |
969 |
|
// retrieve sorting method |
970 |
|
//-------------------------------------------------- |
971 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
972 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
973 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
974 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
975 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
976 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
977 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
978 |
|
|
979 |
|
if ( use_TOF ){ |
980 |
|
use_S1 = true; |
981 |
|
use_S2 = true; |
982 |
|
use_S3 = true; |
983 |
|
}; |
984 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
985 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF ){ |
986 |
|
use_TOF = false; |
987 |
|
use_S1 = false; |
988 |
|
use_S2 = false; |
989 |
|
use_S3 = false; |
990 |
|
} |
991 |
|
if( !GP ){ |
992 |
|
use_GP = false; |
993 |
|
} |
994 |
|
|
995 |
if( !TRK2 ){ |
if( !TRK2 ){ |
996 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
997 |
return; |
return; |
998 |
}; |
}; |
999 |
|
|
1000 |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
1001 |
|
|
1002 |
|
|
1003 |
|
//-------------------------------------------------- |
1004 |
|
// loop over "physical" tracks sorted by the tracker |
1005 |
|
//-------------------------------------------------- |
1006 |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
1007 |
|
|
1008 |
TrkTrack *ts = 0; |
TrkTrack *ts = 0; |
1010 |
ToFTrkVar *os = 0; |
ToFTrkVar *os = 0; |
1011 |
|
|
1012 |
// get tracker tracks |
// get tracker tracks |
1013 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
1014 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
1015 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
1016 |
|
|
1017 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *ti = 0; //tracker (image) |
1018 |
CaloTrkVar *ci = 0; |
CaloTrkVar *ci = 0; |
1019 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
1020 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
1021 |
// if track has an image, check image selection |
// if track has an image, check image selection |
1022 |
|
|
1023 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
1024 |
|
Int_t ti_score = 0; //image track |
1025 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
1026 |
|
Int_t toti_score = 0; //image track |
1027 |
|
|
1028 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
1029 |
|
|
1030 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
1031 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
1032 |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
1033 |
|
|
1034 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
1035 |
|
|
1036 |
//assign starting scores |
//assign starting scores |
1037 |
Int_t tp_score = 0; //main track sorted by the tracker |
tp_score = 0; //main track sorted by the tracker |
1038 |
Int_t ti_score = 0; //image track |
ti_score = 0; //image track |
1039 |
|
|
1040 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
1041 |
|
// ***************************************************************************************** |
1042 |
|
// ----------------------------------------------------------------------------------------- |
1043 |
// calorimeter check |
// calorimeter check |
1044 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
|
// check the Y spatial residual on the first calorimeter plane |
|
|
// (cut on calorimeter variables from Emiliano) |
|
1045 |
if( use_CAL && !calo2_obj ){ |
if( use_CAL && !calo2_obj ){ |
1046 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
1047 |
return; |
return; |
1048 |
}; |
}; |
1049 |
|
if( use_CAL && !cp && ci ){ |
1050 |
|
ti_score++; |
1051 |
|
toti_score++; |
1052 |
|
}; |
1053 |
|
if( use_CAL && cp && !ci ){ |
1054 |
|
tp_score++; |
1055 |
|
totp_score++; |
1056 |
|
}; |
1057 |
if( |
if( |
1058 |
use_CAL && |
use_CAL && |
1059 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
cp && ci && |
|
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
|
1060 |
true){ |
true){ |
1061 |
|
|
1062 |
|
|
1063 |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
if( |
1064 |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
cp->npresh > ci->npresh && |
1065 |
|
true){ |
1066 |
if(resy_p <= resy_i) tp_score++; |
tp_score++; |
1067 |
else ti_score++; |
totp_score++; |
1068 |
|
}; |
1069 |
|
if( |
1070 |
|
cp->npresh < ci->npresh && |
1071 |
|
true){ |
1072 |
|
ti_score++; |
1073 |
|
toti_score++; |
1074 |
|
}; |
1075 |
|
|
1076 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
1077 |
|
|
1078 |
}; |
}; |
1079 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
1080 |
|
// ***************************************************************************************** |
1081 |
|
// ----------------------------------------------------------------------------------------- |
1082 |
// TOF check |
// TOF check |
1083 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
1084 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1085 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1086 |
if( use_TOF && !tof_obj ){ |
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){ |
1087 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
1088 |
return; |
return; |
1089 |
}; |
}; |
1090 |
if( use_TOF ){ |
// |
1091 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){ |
1092 |
Int_t nphit_p =0; |
ti_score++; |
1093 |
Int_t nphit_i =0; |
toti_score++; |
1094 |
|
}; |
1095 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){ |
1096 |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
tp_score++; |
1097 |
cout << "track: npmttdc "<< op->npmttdc << endl; |
totp_score++; |
1098 |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
}; |
1099 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){ |
1100 |
|
// |
1101 |
|
Float_t sen = 0.; |
1102 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1103 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1104 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); |
1105 |
}; |
}; |
|
|
|
1106 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1107 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1108 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
1109 |
}; |
}; |
1110 |
|
// |
1111 |
|
if ( sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
1112 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
1113 |
|
// |
1114 |
|
// is a nucleus use a different algorithm |
1115 |
|
// |
1116 |
|
Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates |
1117 |
|
for(Int_t ip=0; ip<nz; ip++) |
1118 |
|
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
1119 |
|
Trajectory *tr = new Trajectory(nz,zin); |
1120 |
|
// |
1121 |
|
Int_t nphit_p =0; |
1122 |
|
Int_t nphit_i =0; |
1123 |
|
Float_t enhit_p = 0.; |
1124 |
|
Float_t enhit_i = 0.; |
1125 |
|
// |
1126 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1127 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1128 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
1129 |
|
nphit_p++; |
1130 |
|
enhit_p += (op->dedx).At(ih); |
1131 |
|
}; |
1132 |
|
}; |
1133 |
|
// |
1134 |
|
tp->DoTrack2(tr); |
1135 |
|
// |
1136 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
1137 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1138 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1139 |
|
if(pl == 0){ |
1140 |
|
nphit_p++; |
1141 |
|
enhit_p += (op->dedx).At(ih); |
1142 |
|
}; |
1143 |
|
}; |
1144 |
|
}; |
1145 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
1146 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1147 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1148 |
|
if(pl == 3){ |
1149 |
|
nphit_p++; |
1150 |
|
enhit_p += (op->dedx).At(ih); |
1151 |
|
}; |
1152 |
|
}; |
1153 |
|
}; |
1154 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
1155 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1156 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1157 |
|
if(pl == 4){ |
1158 |
|
nphit_p++; |
1159 |
|
enhit_p += (op->dedx).At(ih); |
1160 |
|
}; |
1161 |
|
}; |
1162 |
|
}; |
1163 |
|
|
1164 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1165 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1166 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
1167 |
|
nphit_i++; |
1168 |
|
enhit_i += (op->dedx).At(ih); |
1169 |
|
}; |
1170 |
|
}; |
1171 |
|
// |
1172 |
|
ti->DoTrack2(tr); |
1173 |
|
// |
1174 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
1175 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1176 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1177 |
|
if(pl == 0){ |
1178 |
|
nphit_i++; |
1179 |
|
enhit_i += (op->dedx).At(ih); |
1180 |
|
}; |
1181 |
|
}; |
1182 |
|
}; |
1183 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
1184 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1185 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1186 |
|
if(pl == 3){ |
1187 |
|
nphit_i++; |
1188 |
|
enhit_i += (op->dedx).At(ih); |
1189 |
|
}; |
1190 |
|
}; |
1191 |
|
}; |
1192 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
1193 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1194 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1195 |
|
if(pl == 4){ |
1196 |
|
nphit_i++; |
1197 |
|
enhit_i += (op->dedx).At(ih); |
1198 |
|
}; |
1199 |
|
}; |
1200 |
|
}; |
1201 |
|
|
1202 |
|
|
1203 |
if( |
if( |
1204 |
use_TOF && |
(use_TOF || use_S1 || use_S2 || use_S3) && |
1205 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
1206 |
true){ |
true){ |
1207 |
|
|
1208 |
|
// printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i); |
1209 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
1210 |
|
// if( enhit_p > enhit_i ) tp_score++; |
1211 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
1212 |
|
if ( nphit_p > nphit_i ) tp_score++; |
1213 |
|
if ( nphit_p < nphit_i ) ti_score++; |
1214 |
|
if ( nphit_p == nphit_i ){ |
1215 |
|
if ( enhit_p > enhit_i ) tp_score++; |
1216 |
|
else ti_score++; |
1217 |
|
}; |
1218 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
1219 |
|
}; |
1220 |
|
delete tr; |
1221 |
|
// |
1222 |
|
} else { |
1223 |
|
// ------------- |
1224 |
|
// NOT a NUCLEUS |
1225 |
|
// ------------- |
1226 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
1227 |
|
|
1228 |
|
Int_t nphit_p =0; |
1229 |
|
Int_t nphit_i =0; |
1230 |
|
|
1231 |
|
|
1232 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
1233 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
1234 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
1235 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1236 |
|
|
1237 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1238 |
|
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1239 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1240 |
|
// }; |
1241 |
|
|
1242 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1243 |
|
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1244 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1245 |
|
// }; |
1246 |
|
// --- modified to count tdc signals (more efficient?) |
1247 |
|
// --- and to implement check on tdcflag |
1248 |
|
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
1249 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
1250 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
1251 |
|
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
1252 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
1253 |
|
}; |
1254 |
|
}; |
1255 |
|
|
1256 |
|
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
1257 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
1258 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
1259 |
|
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
1260 |
|
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
1261 |
|
}; |
1262 |
|
}; |
1263 |
|
|
1264 |
|
if( |
1265 |
|
(nphit_p+nphit_i) !=0 && |
1266 |
|
true){ |
1267 |
|
|
1268 |
if( nphit_p >= nphit_i) tp_score++; |
if ( nphit_p != nphit_i ){ |
1269 |
else ti_score++; |
totp_score += nphit_p; |
1270 |
|
toti_score += nphit_i; |
1271 |
|
tp_score+=nphit_p; |
1272 |
|
ti_score+=nphit_i; |
1273 |
|
}; |
1274 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
1275 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
1276 |
|
// else ;//niente |
1277 |
|
}; |
1278 |
}; |
}; |
1279 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
1280 |
}; |
}; |
1281 |
if(tp_score == ti_score) use_TRK = true; |
|
1282 |
// ------------------------ |
|
1283 |
|
// if(tp_score == ti_score) use_TRK = true; |
1284 |
|
|
1285 |
|
|
1286 |
|
// ----------------------------------------------------------------------------------------- |
1287 |
|
// ***************************************************************************************** |
1288 |
|
// ----------------------------------------------------------------------------------------- |
1289 |
// tracker check |
// tracker check |
1290 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
1291 |
// chi**2 difference is not always large enough to distinguish among |
// chi**2 difference is not always large enough to distinguish among |
1292 |
// the real track and its image. |
// the real track and its image. |
1293 |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
1294 |
|
// *** MODIFIED ON AUGUST 2007 *** |
1295 |
if(use_TRK){ |
if(use_TRK){ |
1296 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
1297 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
1298 |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
|
1299 |
|
// CHECK 1 : number of points along X |
1300 |
|
if ( tp->GetNX() >= ti->GetNX() ){ |
1301 |
|
tp_score++ ; |
1302 |
|
totp_score++ ; |
1303 |
|
}; |
1304 |
|
if ( tp->GetNX() <= ti->GetNX() ){ |
1305 |
|
ti_score++ ; |
1306 |
|
toti_score++ ; |
1307 |
|
}; |
1308 |
|
// CHECK 2 : number of points along Y |
1309 |
|
if ( tp->GetNY() >= ti->GetNY() ){ |
1310 |
|
tp_score++ ; |
1311 |
|
totp_score++ ; |
1312 |
|
}; |
1313 |
|
if ( tp->GetNY() <= ti->GetNY() ){ |
1314 |
|
ti_score++ ; |
1315 |
|
toti_score++ ; |
1316 |
|
}; |
1317 |
|
|
1318 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
1319 |
}; |
}; |
1320 |
|
|
1321 |
// ------------------------ |
|
1322 |
|
// ----------------------------------------------------------------------------------------- |
1323 |
|
// ***************************************************************************************** |
1324 |
|
// ----------------------------------------------------------------------------------------- |
1325 |
|
// GPamela check |
1326 |
|
// ----------------------------------------------------------------------------------------- |
1327 |
|
|
1328 |
|
//--------------------------------------------------- |
1329 |
|
// count the number of GP hits |
1330 |
|
//--------------------------------------------------- |
1331 |
|
if(use_GP){ |
1332 |
|
int ngphits_p=0; |
1333 |
|
int ngphits_i=0; |
1334 |
|
float toll = 0.02; //200 micron |
1335 |
|
for(int ih=0; ih<GetGPamela()->Nthspe; ih++){ |
1336 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
1337 |
|
if( |
1338 |
|
tp && |
1339 |
|
tp->YGood(ip) && |
1340 |
|
fabs(tp->ym[ip]- GetGPamela()->Yavspe[ih])<toll && |
1341 |
|
true) ngphits_p++; |
1342 |
|
if( ti && |
1343 |
|
ti->YGood(ip) && |
1344 |
|
fabs(ti->ym[ip]- GetGPamela()->Yavspe[ih])<toll && |
1345 |
|
true) ngphits_i++; |
1346 |
|
} |
1347 |
|
if( |
1348 |
|
ngphits_p > ngphits_i && |
1349 |
|
true){ |
1350 |
|
tp_score++ ; |
1351 |
|
totp_score++ ; |
1352 |
|
} |
1353 |
|
if( |
1354 |
|
ngphits_p < ngphits_i && |
1355 |
|
true){ |
1356 |
|
ti_score++ ; |
1357 |
|
toti_score++ ; |
1358 |
|
} |
1359 |
|
} |
1360 |
|
|
1361 |
|
|
1362 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1363 |
// the winner is.... |
// the winner is.... |
1364 |
// ------------------------ |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1365 |
if (tp_score > ti_score) { |
if (tp_score > ti_score) { |
1366 |
// ts = tp;//the track sorted by the tracker!! |
|
1367 |
// cs = cp; |
|
|
// os = op; |
|
1368 |
}else if (tp_score < ti_score) { |
}else if (tp_score < ti_score) { |
1369 |
|
|
1370 |
|
|
1371 |
ts = ti;//its image!! |
ts = ti;//its image!! |
1372 |
cs = ci; |
cs = ci; |
1373 |
os = oi; |
os = oi; |
1374 |
|
Int_t totis = toti_score; |
1375 |
|
|
1376 |
ti = tp;//its image!! |
ti = tp;//its image!! |
1377 |
ci = cp; |
ci = cp; |
1381 |
cp = cs; |
cp = cs; |
1382 |
op = os; |
op = os; |
1383 |
|
|
1384 |
|
toti_score = totp_score; |
1385 |
|
totp_score = totis; |
1386 |
|
|
1387 |
|
|
1388 |
}else { |
}else { |
1389 |
// ts = tp; |
|
1390 |
// cs = cp; |
// cout << "Warning - track image ambiguity not solved" << endl; |
1391 |
// os = op; |
|
|
// cout << "Warning - track image ambiguity not solved" << endl; |
|
|
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
|
1392 |
}; |
}; |
1393 |
|
|
1394 |
}else{ |
}else{ |
1395 |
// ts = tp; |
totp_score = 1; |
1396 |
// cs = cp; |
toti_score = 0; |
1397 |
// os = op; |
|
1398 |
|
// ts = tp; |
1399 |
|
// cs = cp; |
1400 |
|
// os = op; |
1401 |
}; |
}; |
1402 |
|
|
1403 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
1404 |
// sorted_tracks->Add(ts);//save the track in the sorted array |
// sorted_tracks->Add(ts);//save the track in the sorted array |
1405 |
// sorted_tracks.Add(ts);//save the track in the sorted array |
// sorted_tracks.Add(ts);//save the track in the sorted array |
1406 |
// sorted_tracks.Add(tp);//save the track in the sorted array |
// sorted_tracks.Add(tp);//save the track in the sorted array |
1407 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
1408 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
1409 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
1410 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
1411 |
|
|
1412 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
1413 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
1414 |
|
|
1415 |
|
((PamTrack*)(ttsorted[i]))->SetPScore(totp_score); |
1416 |
|
((PamTrack*)(ttsorted[i]))->SetIScore(toti_score); |
1417 |
|
((PamTrack*)(ttimage[i]))->SetPScore(totp_score); |
1418 |
|
((PamTrack*)(ttimage[i]))->SetIScore(toti_score); |
1419 |
}; |
}; |
1420 |
|
|
1421 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
1422 |
cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
1423 |
tsorted->Delete(); tsorted=0; |
tsorted->Delete(); tsorted=0; |
1424 |
timage->Delete(); timage=0; |
timage->Delete(); timage=0; |
1425 |
} |
} |
1451 |
TClonesArray *PamLevel2::GetTracks(){ |
TClonesArray *PamLevel2::GetTracks(){ |
1452 |
|
|
1453 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1454 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1455 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1456 |
|
|
1457 |
return tsorted; |
return tsorted; |
1458 |
|
|
1459 |
}; |
}; |
1460 |
//-------------------------------------- |
//-------------------------------------- |
1461 |
// |
// |
1462 |
// |
// |
1463 |
//-------------------------------------- |
//-------------------------------------- |
1464 |
/** |
/** |
1465 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
1470 |
|
|
1471 |
// if(!trk2_obj) return 0; |
// if(!trk2_obj) return 0; |
1472 |
|
|
1473 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
1474 |
// SortTracks("+CAL+TOF"); |
// SortTracks("+CAL+TOF"); |
1475 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
1476 |
// // if(!sorted_tracks)return 0; |
// // if(!sorted_tracks)return 0; |
1489 |
|
|
1490 |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
1491 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1492 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1493 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1494 |
if(!tsorted)return 0; |
if(!tsorted)return 0; |
1495 |
if(!tsorted->GetEntries())return 0; |
if(!tsorted->GetEntries())return 0; |
1546 |
|
|
1547 |
|
|
1548 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1549 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1550 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1551 |
if(!timage)return 0; |
if(!timage)return 0; |
1552 |
if(!timage->GetEntries())return 0; |
if(!timage->GetEntries())return 0; |
1581 |
*/ |
*/ |
1582 |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ |
1583 |
|
|
1584 |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { |
1585 |
// else GetWhichTrees(f); |
cout << "+AUTO"<<endl; |
1586 |
|
GetWhichTrees(f); |
1587 |
|
}; |
1588 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
1589 |
|
|
1590 |
|
if ( pam_tree ){ |
1591 |
|
printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); |
1592 |
|
return pam_tree; |
1593 |
|
}; |
1594 |
|
// |
1595 |
|
|
1596 |
|
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
1597 |
|
|
1598 |
|
// SetWhichTrees(detlist); |
1599 |
|
|
1600 |
TTree *Trout =0; |
TTree *Trout =0; |
1601 |
|
|
1602 |
TString fname = f->GetName(); |
TString fname = f->GetName(); |
1603 |
if(!CheckLevel2File(fname))return NULL; |
if(!CheckLevel2File(fname))return NULL; |
1604 |
|
|
1605 |
UInt_t *found=0; |
// UInt_t *found=0; |
1606 |
|
|
1607 |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
1608 |
if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
1616 |
if(ND)cout<<"ND "; |
if(ND)cout<<"ND "; |
1617 |
if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
1618 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1619 |
|
if(GP)cout<<"GP "; |
1620 |
cout << endl; |
cout << endl; |
1621 |
|
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
1622 |
|
|
1623 |
f->cd(); |
f->cd(); |
1624 |
|
|
1626 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
1627 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
1628 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1629 |
else T->SetBranchStatus("TrkLevel2",0,found); |
// else T->SetBranchStatus("TrkLevel2",0,found); |
1630 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
1631 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1632 |
else T->SetBranchStatus("TrkLevel1",0,found); |
// else T->SetBranchStatus("TrkLevel1",0,found); |
1633 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
1634 |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1635 |
else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
1636 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
1637 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1638 |
else Trout->AddFriend(T); |
else Trout->AddFriend(T); |
1643 |
TTree *C = (TTree*)f->Get("Calorimeter"); |
TTree *C = (TTree*)f->Get("Calorimeter"); |
1644 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
1645 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1646 |
else C->SetBranchStatus("CaloLevel2",0,found); |
// else C->SetBranchStatus("CaloLevel2",0,found); |
1647 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1648 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1649 |
else C->SetBranchStatus("CaloLevel1",0,found); |
// else C->SetBranchStatus("CaloLevel1",0,found); |
1650 |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
1651 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
1652 |
else Trout->AddFriend(C); |
else Trout->AddFriend(C); |
1669 |
if(R && TRG) { |
if(R && TRG) { |
1670 |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1671 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
1672 |
if(!Trout)Trout=O; |
if(!Trout)Trout=R; |
1673 |
else Trout->AddFriend(R); |
else Trout->AddFriend(R); |
1674 |
}else{ |
}else{ |
1675 |
cout << "Trigger : missing tree"<<endl; |
cout << "Trigger : missing tree"<<endl; |
1679 |
if(S && S4) { |
if(S && S4) { |
1680 |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1681 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
1682 |
if(!Trout)Trout=O; |
if(!Trout)Trout=S; |
1683 |
else Trout->AddFriend(S); |
else Trout->AddFriend(S); |
1684 |
}else{ |
}else{ |
1685 |
cout << "S4 : missing tree"<<endl; |
cout << "S4 : missing tree"<<endl; |
1689 |
if(N && ND) { |
if(N && ND) { |
1690 |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
1691 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
1692 |
if(!Trout)Trout=O; |
if(!Trout)Trout=N; |
1693 |
else Trout->AddFriend(N); |
else Trout->AddFriend(N); |
1694 |
}else{ |
}else{ |
1695 |
cout << "NeutronD : missing tree"<<endl; |
cout << "NeutronD : missing tree"<<endl; |
1699 |
if(A && AC) { |
if(A && AC) { |
1700 |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
1701 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
1702 |
if(!Trout)Trout=O; |
if(!Trout)Trout=A; |
1703 |
else Trout->AddFriend(A); |
else Trout->AddFriend(A); |
1704 |
}else{ |
}else{ |
1705 |
cout << "Anticounter : missing tree"<<endl; |
cout << "Anticounter : missing tree"<<endl; |
1709 |
if(B && ORB) { |
if(B && ORB) { |
1710 |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1711 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1712 |
if(!Trout)Trout=O; |
if(!Trout)Trout=B; |
1713 |
else Trout->AddFriend(B); |
else Trout->AddFriend(B); |
1714 |
}else{ |
}else{ |
1715 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1716 |
}; |
}; |
1717 |
|
|
1718 |
|
// GPamela |
1719 |
|
TTree *G = (TTree*)f->Get("h20"); |
1720 |
|
if(G && GP) { |
1721 |
|
if(!gp_obj)gp_obj=new GPamela(); |
1722 |
|
// ------------------------------------ |
1723 |
|
// ATTENZIONE!!! |
1724 |
|
// non so per quale arcano motivo, |
1725 |
|
// per l'albero di gpamela il branch address lo devo settare |
1726 |
|
// DOPO aver fatto friend |
1727 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
1728 |
|
// ------------------------------------ |
1729 |
|
// gp_obj->SetBranchAddress(G); //ho dovuto fare in maniera diversa dagli altri |
1730 |
|
// cout << "h20 : set branch address GPamela "<<endl; |
1731 |
|
if(!Trout)Trout=G; |
1732 |
|
else Trout->AddFriend(G); |
1733 |
|
}else{ |
1734 |
|
// cout << "h20 : missing tree"<<endl; |
1735 |
|
}; |
1736 |
|
|
1737 |
|
|
1738 |
|
TTree *L = (TTree*)f->Get("SelectionList"); |
1739 |
|
if(L && SELLI==1) { |
1740 |
|
cout << " TTree *PamLevel2::GetPamTree(TFile, TString) >>> SelectionList not implemented!!!!"<<endl; |
1741 |
|
sel_tree = 0; |
1742 |
|
}else{ |
1743 |
|
cout << "SelectionList : missing tree"<<endl; |
1744 |
|
}; |
1745 |
|
|
1746 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
1747 |
|
|
1748 |
|
// ------------------------------------ |
1749 |
|
// ATTENZIONE!!! |
1750 |
|
// non so per quale arcano motivo, |
1751 |
|
// per l'albero di gpamela il branch address lo devo settare |
1752 |
|
// DOPO aver fatto friend |
1753 |
|
// FGRRRVZZZZUTSALKJMSLKJ!!! |
1754 |
|
// ------------------------------------ |
1755 |
|
if(G && GP) { |
1756 |
|
gp_obj->SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri |
1757 |
|
cout << "h20 : set branch address GPamela "<<endl; |
1758 |
|
}else{ |
1759 |
|
cout << "h20 : missing tree"<<endl; |
1760 |
|
}; |
1761 |
|
|
1762 |
|
pam_tree = (TChain*)Trout; |
1763 |
|
|
1764 |
return Trout; |
return Trout; |
1765 |
|
|
1779 |
|
|
1780 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
1781 |
|
|
1782 |
if(ddir=="")ddir = wdir; |
// if(ddir=="")ddir = wdir; |
1783 |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1784 |
cout << "Level2 data directory : "<< ddir << endl; |
if ( ddir != ""){ |
1785 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1786 |
|
} else { |
1787 |
|
cout << "Level2 data directory not given as input: trying to evaluate from list or taking working directory " << endl; |
1788 |
|
}; |
1789 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
1790 |
contents->SetOwner(); |
contents->SetOwner(); |
1791 |
|
|
1801 |
// return 0; |
// return 0; |
1802 |
// } |
// } |
1803 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
1804 |
|
if ( !flisttxt.EndsWith(".root") ){ |
1805 |
|
|
1806 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1807 |
|
|
1808 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
1809 |
cout << "Cannot change directory : "<<ddir<<endl; |
cout << "Cannot change directory : "<<ddir<<endl; |
1810 |
return 0; |
return 0; |
|
} |
|
|
|
|
|
cout <<"Input file list : " << flisttxt <<endl; |
|
|
ifstream in; |
|
|
in.open(flisttxt, ios::in); //open input file list |
|
|
if(!in.good()){ |
|
|
cout <<" ERROR opening the file "<<endl; |
|
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
|
|
return 0; |
|
|
} |
|
|
int line=0; |
|
|
while (1) { |
|
|
TString file; |
|
|
in >> file; |
|
|
if (!in.good()) break; |
|
|
line++; |
|
|
// cout <<"(1) " << file << endl; |
|
|
if(file.IsNull()){ |
|
|
cout << "-- list interrupted at line "<<line <<endl; |
|
|
break; |
|
1811 |
} |
} |
1812 |
if(file.Contains("#"))file = file(0,file.First("#")); |
|
1813 |
|
cout <<"Input file list : " << flisttxt <<endl; |
1814 |
|
ifstream in; |
1815 |
|
in.open(flisttxt, ios::in); //open input file list |
1816 |
|
if(!in.good()){ |
1817 |
|
cout <<" ERROR opening the file "<<endl; |
1818 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
1819 |
|
return 0; |
1820 |
|
} |
1821 |
|
int line=0; |
1822 |
|
while (1) { |
1823 |
|
TString file; |
1824 |
|
in >> file; |
1825 |
|
if (!in.good()) break; |
1826 |
|
line++; |
1827 |
|
// cout <<"(1) " << file << endl; |
1828 |
|
if(file.IsNull()){ |
1829 |
|
cout << "-- list interrupted at line "<<line <<endl; |
1830 |
|
break; |
1831 |
|
} |
1832 |
|
if(file.Contains("#"))file = file(0,file.First("#")); |
1833 |
// cout <<"(2) " << file << endl; |
// cout <<"(2) " << file << endl; |
1834 |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
1835 |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
1836 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
if( file.EndsWith(".root") ){ |
1837 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
TString filedir; |
1838 |
delete fullpath; |
if (ddir != ""){ |
1839 |
|
filedir = ddir; // take the input dir |
1840 |
|
} else { |
1841 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
1842 |
|
filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir |
1843 |
|
}; |
1844 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); |
1845 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1846 |
|
delete fullpath; |
1847 |
|
} |
1848 |
// }else{ |
// }else{ |
1849 |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
1850 |
// }; |
// }; |
1851 |
}; |
}; |
1852 |
in.close(); |
in.close(); |
1853 |
|
} else { |
1854 |
|
if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); |
1855 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1856 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1857 |
|
delete fullpath; |
1858 |
|
}; |
1859 |
}else{ |
}else{ |
1860 |
|
|
1861 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1862 |
cout << "Check for existing root files."<<endl; |
cout << "Check for existing root files."<<endl; |
1863 |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
1864 |
|
if ( ddir == "" ){ |
1865 |
|
ddir = wdir; |
1866 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1867 |
|
}; |
1868 |
|
|
1869 |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1870 |
TList *temp = datadir->GetListOfFiles(); |
TList *temp = datadir->GetListOfFiles(); |
1871 |
// temp->Print(); |
// temp->Print(); |
1909 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1910 |
*/ |
*/ |
1911 |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
1912 |
|
// |
1913 |
|
// |
1914 |
|
// |
1915 |
|
if ( pam_tree ){ |
1916 |
|
printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); |
1917 |
|
return pam_tree; |
1918 |
|
}; |
1919 |
|
// |
1920 |
|
|
1921 |
TChain *Trout =0; |
TChain *Trout =0; |
1922 |
|
|
1923 |
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
// ------------------------------------------- |
1924 |
SetWhichTrees(detlist); |
// set flags to include/exclude trees/branches |
1925 |
|
// ------------------------------------------- |
1926 |
cout<< "GetPamTree(TList*,TString): input detector list --> "; |
if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { |
1927 |
if(TRK1)cout<<"TRK1 "; |
if( fl->GetEntries()>0 ){ |
1928 |
if(TRK2)cout<<"TRK2 "; |
cout << "+AUTO"<<endl; |
1929 |
if(TRKh)cout<<"TRKH "; |
TFile *fprimo = new TFile( fl->At(0)->GetName() ); |
1930 |
if(CAL1)cout<<"CAL1 "; |
GetWhichTrees(fprimo); |
1931 |
if(CAL2)cout<<"CAL2 "; |
fprimo->Close();// AAAAARGGGGGHHHHH!!!!!!! non commentare questa riga, altrimenti si incasina il TChain |
1932 |
if(TOF)cout<<"TOF "; |
fprimo->Delete(); |
1933 |
if(TRG)cout<<"TRG "; |
} |
1934 |
if(AC)cout<<"AC "; |
}; |
1935 |
if(ND)cout<<"ND "; |
SetWhichTrees(detlist); |
1936 |
if(S4)cout<<"S4 "; |
|
|
if(ORB)cout<<"ORB "; |
|
|
cout << endl; |
|
1937 |
|
|
1938 |
|
// ------------------------------------------- |
1939 |
|
// build chains |
1940 |
|
// ------------------------------------------- |
1941 |
TChain *T = 0; |
TChain *T = 0; |
1942 |
TChain *C = 0; |
TChain *C = 0; |
1943 |
TChain *O = 0; |
TChain *O = 0; |
1946 |
TChain *N = 0; |
TChain *N = 0; |
1947 |
TChain *A = 0; |
TChain *A = 0; |
1948 |
TChain *B = 0; |
TChain *B = 0; |
1949 |
|
TChain *G = 0; |
1950 |
|
|
1951 |
|
TChain *L = 0; |
1952 |
|
|
1953 |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
1954 |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
1958 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
1959 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
1960 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
1961 |
|
if(GP) G = new TChain("h20"); |
1962 |
|
L = new TChain("SelectionList"); |
1963 |
|
|
1964 |
// loop over files and create chains |
// loop over files and create chains |
1965 |
TIter next(fl); |
TIter next(fl); |
1976 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
1977 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
1978 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
1979 |
|
if(GP) G->Add(name); |
1980 |
|
if(SELLI==1) L->Add(name); |
1981 |
}; |
}; |
1982 |
} |
}; |
1983 |
|
|
1984 |
cout << "done chain \n"; |
cout << "done chains\n"; |
1985 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1986 |
|
|
1987 |
|
|
1988 |
|
// ------------------------------------------- |
1989 |
|
// make friends |
1990 |
|
// ------------------------------------------- |
1991 |
|
|
|
UInt_t *found=0; |
|
1992 |
// Tracker |
// Tracker |
1993 |
|
cout << "Friends: "<<endl; |
1994 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
|
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
|
|
else T->SetBranchStatus("TrkLevel2",0,found); |
|
|
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
|
|
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
|
|
else T->SetBranchStatus("TrkLevel1",0,found); |
|
|
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
|
|
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
|
|
else T->SetBranchStatus("TrkHough",0,found); |
|
|
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
|
1995 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1996 |
else Trout->AddFriend("Tracker"); |
else Trout->AddFriend("Tracker"); |
1997 |
}else{ |
// cout << "+Tacker"<<endl; |
|
cout << "Tracker : missing tree"<<endl; |
|
1998 |
}; |
}; |
1999 |
// Calorimeter |
// Calorimeter |
2000 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
|
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
|
|
else C->SetBranchStatus("CaloLevel2",0,found); |
|
|
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
|
|
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
|
|
else C->SetBranchStatus("CaloLevel1",0,found); |
|
|
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
|
2001 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
2002 |
else Trout->AddFriend("Calorimeter"); |
else Trout->AddFriend("Calorimeter"); |
2003 |
}else{ |
// cout << "+Calorimeter"<<endl; |
|
cout << "Calorimeter : missing tree"<<endl; |
|
2004 |
}; |
}; |
2005 |
// ToF |
// ToF |
2006 |
if(O && TOF) { |
if(O && TOF) { |
|
O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
|
|
cout << "ToF : set branch address ToFLevel2"<<endl; |
|
2007 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2008 |
else Trout->AddFriend("ToF"); |
else Trout->AddFriend("ToF"); |
2009 |
}else{ |
// cout << "+ToF"<<endl; |
|
cout << "ToF : missing tree"<<endl; |
|
2010 |
}; |
}; |
2011 |
// Trigger |
// Trigger |
2012 |
if(R && TRG) { |
if(R && TRG) { |
|
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
|
|
cout << "Trigger : set branch address TrigLevel2"<<endl; |
|
2013 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2014 |
else Trout->AddFriend("Trigger"); |
else Trout->AddFriend("Trigger"); |
2015 |
}else{ |
// cout << "+Trigger"<<endl; |
|
cout << "Trigger : missing tree"<<endl; |
|
2016 |
}; |
}; |
2017 |
// S4 |
// S4 |
2018 |
if(S && S4) { |
if(S && S4) { |
|
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
|
|
cout << "S4 : set branch address S4Level2"<<endl; |
|
2019 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2020 |
else Trout->AddFriend("S4"); |
else Trout->AddFriend("S4"); |
2021 |
}else{ |
// cout << "+S4"<<endl; |
|
cout << "S4 : missing tree"<<endl; |
|
2022 |
}; |
}; |
2023 |
// Neutron Detector |
// Neutron Detector |
2024 |
if(N && ND) { |
if(N && ND) { |
|
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
|
|
cout << "NeutronD : set branch address NDLevel2"<<endl; |
|
2025 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2026 |
else Trout->AddFriend("NeutronD"); |
else Trout->AddFriend("NeutronD"); |
2027 |
}else{ |
// cout << "+NeutronD"<<endl; |
|
cout << "NeutronD : missing tree"<<endl; |
|
2028 |
}; |
}; |
2029 |
// Anticounters |
// Anticounters |
2030 |
if(A && AC) { |
if(A && AC) { |
|
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
|
|
cout << "Anticounter : set branch address AcLevel2"<<endl; |
|
2031 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2032 |
else Trout->AddFriend("Anticounter"); |
else Trout->AddFriend("Anticounter"); |
2033 |
}else{ |
// cout << "+Anticounter"<<endl; |
|
cout << "Anticounter : missing tree"<<endl; |
|
2034 |
}; |
}; |
2035 |
// Orbital Info |
// Orbital Info |
2036 |
if(B && ORB) { |
if(B && ORB) { |
|
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
|
|
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
|
2037 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
2038 |
else Trout->AddFriend("OrbitalInfo"); |
else Trout->AddFriend("OrbitalInfo"); |
2039 |
}else{ |
// cout << "+OrbitalInfo"<<endl; |
2040 |
cout << "OrbitalInfo : missing tree"<<endl; |
}; |
2041 |
|
// GPamela |
2042 |
|
if(G && GP) { |
2043 |
|
if(!Trout)Trout=G; |
2044 |
|
else Trout->AddFriend("h20"); |
2045 |
|
// cout << "+h20"<<endl; |
2046 |
}; |
}; |
|
|
|
|
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
|
2047 |
|
|
2048 |
|
// ===================================== |
2049 |
// // Tracker |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
2050 |
// if(TRK2||TRK1||TRKh){ |
// ===================================== |
2051 |
// if(!Tout)Tout=T; |
SetBranchAddress(Trout); |
2052 |
// else Tout->AddFriend("Tracker"); |
|
2053 |
// } |
|
2054 |
// // Calorimeter |
// ------------------------------------ |
2055 |
// if(CAL2||CAL1) { |
// finally handle selection trees... |
2056 |
// if(!Tout)Tout=C; |
// (it is not friend of pamela tree) |
2057 |
// else Tout->AddFriend("Calorimeter"); |
// ------------------------------------ |
2058 |
// }; |
|
2059 |
// // ToF |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2060 |
// if(TOF) { |
|
2061 |
// if(!Tout)Tout=O; |
// Selection List |
2062 |
// else Tout->AddFriend("ToF"); |
if(L && SELLI==1) { |
2063 |
// }; |
cout<<">>> Found selection-list <<<"<<endl; |
2064 |
// // Trigger |
// L->SetBranchAddress("RunEntry",&irun); |
2065 |
// if(TRG) { |
L->SetBranchAddress("RunEntry",&irunt);//NEWNEW |
2066 |
// if(!Tout)Tout=R; |
cout << "SelectionList: set branch address RunEntry"<<endl; |
2067 |
// else Tout->AddFriend("Trigger"); |
L->SetBranchAddress("EventEntry",&irunentry); |
2068 |
// }; |
cout << "SelectionList: set branch address EventEntry"<<endl; |
2069 |
// // S4 |
sel_tree = L; |
2070 |
// if(S4) { |
// if(!Trout)Trout=O; |
2071 |
// if(!Tout)Tout=S; |
// else Trout->AddFriend("SelectionList"); |
2072 |
// else Tout->AddFriend("S4"); |
cout << "+SelectionList"<<endl; |
2073 |
// }; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2074 |
// // Neutron Detector |
}else{ |
2075 |
// if(ND) { |
// cout << "SelectionList : missing tree"<<endl; |
2076 |
// if(!Tout)Tout=N; |
if(L)L->Delete(); |
2077 |
// else Tout->AddFriend("NeutronD"); |
}; |
2078 |
// }; |
|
2079 |
// // Anticounters |
// -------------------------------------------- |
2080 |
// if(AC) { |
// return the pamela chain with all the friends |
2081 |
// if(!Tout)Tout=A; |
// -------------------------------------------- |
2082 |
// else Tout->AddFriend("Anticounter"); |
|
2083 |
// }; |
pam_tree = Trout; |
|
// // 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 ); |
|
2084 |
|
|
2085 |
return Trout; |
return Trout; |
2086 |
} |
} |
2107 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
ND = ND & t->GetBranchStatus("NDLevel2"); |
2108 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
AC = AC & t->GetBranchStatus("AcLevel2"); |
2109 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
2110 |
|
GP = GP & t->GetBranchStatus("h20"); |
2111 |
|
|
2112 |
|
|
2113 |
// Tracker |
// Tracker |
2164 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2165 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
2166 |
}; |
}; |
2167 |
|
// GPamela |
2168 |
|
if(GP) { |
2169 |
|
// GetPointerTo("GPamela"); |
2170 |
|
if(!gp_obj)gp_obj = new GPamela(); |
2171 |
|
gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri |
2172 |
|
cout << "h20 : set branch address GPamela "<<endl; |
2173 |
|
}; |
2174 |
|
|
2175 |
} |
} |
2176 |
/** |
/** |
2178 |
*/ |
*/ |
2179 |
void PamLevel2::SetBranchAddress(TChain *t){ |
void PamLevel2::SetBranchAddress(TChain *t){ |
2180 |
|
|
2181 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
2182 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
2183 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
2184 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
2185 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
2186 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
2187 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
2188 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
2189 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
2190 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
2191 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
2192 |
|
// GP = GP & t->GetBranchStatus("h20"); |
2193 |
|
|
2194 |
// Tracker |
// Tracker |
2195 |
if(TRK2) { |
if(TRK2) { |
2196 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
2197 |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
2198 |
}; |
}; |
2200 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
2201 |
cout << "Tracker : set branch address TrkLevel1"<<endl; |
cout << "Tracker : set branch address TrkLevel1"<<endl; |
2202 |
}; |
}; |
2203 |
if(TRKh) { |
if(TRKh) { |
2204 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
2205 |
cout << "Tracker : set branch address TrkHough"<<endl; |
cout << "Tracker : set branch address TrkHough"<<endl; |
2206 |
}; |
}; |
2207 |
|
|
2208 |
// Calorimeter |
// Calorimeter |
2209 |
if(CAL2) { |
if(CAL2) { |
2245 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2246 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
2247 |
}; |
}; |
2248 |
|
// GPamela |
2249 |
|
// cout <<"GP "<<GP<<endl; |
2250 |
|
if(GP) { |
2251 |
|
// GetPointerTo("GPamela"); |
2252 |
|
if(!gp_obj)gp_obj = new GPamela(); |
2253 |
|
gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri |
2254 |
|
cout << "h20 : set branch address GPamela "<<endl; |
2255 |
|
}; |
2256 |
|
// SelectionList |
2257 |
|
// if(SELLI==1){ |
2258 |
|
// t->SetBranchAddress("RunEntry",&irunt);//NEWNEW |
2259 |
|
// cout << "SelectionList: set branch address RunEntry"<<endl; |
2260 |
|
// t->SetBranchAddress("EventEntry",&irunentry); |
2261 |
|
// cout << "SelectionList: set branch address EventEntry"<<endl; |
2262 |
|
|
2263 |
|
// } |
2264 |
|
|
2265 |
} |
} |
2266 |
|
|
2267 |
|
|
2275 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
2276 |
*/ |
*/ |
2277 |
TChain *PamLevel2::GetRunTree(TList *fl){ |
TChain *PamLevel2::GetRunTree(TList *fl){ |
2278 |
|
// |
2279 |
|
// |
2280 |
|
// |
2281 |
|
if ( run_tree ){ |
2282 |
|
printf("WARNING: TChain *PamLevel2::GetRunTree(TList *fl) -- run_tree already exists!\n "); |
2283 |
|
return run_tree; |
2284 |
|
}; |
2285 |
|
// |
2286 |
TChain *R = new TChain("Run"); |
TChain *R = new TChain("Run"); |
2287 |
|
|
2288 |
// loop over files and create chains |
// loop over files and create chains |
2295 |
R->Add(name); |
R->Add(name); |
2296 |
}; |
}; |
2297 |
} |
} |
2298 |
|
|
2299 |
|
if(R->GetNtrees()){ |
2300 |
|
|
2301 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
2302 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
2303 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
2304 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
2305 |
|
|
2306 |
|
irunoffset = new int[R->GetNtrees()]; |
2307 |
|
cout << "----------------------------------------------------"<<endl; |
2308 |
|
cout << "irun\t | "; |
2309 |
|
cout << "tree\t |"; |
2310 |
|
// cout << "offset\t |"; |
2311 |
|
cout << "RUN\t"; |
2312 |
|
cout << "FRAG\t"; |
2313 |
|
cout << "NEVENTS\t"; |
2314 |
|
cout << "absolute time\t\t\t"; |
2315 |
|
cout << "on-board time"; |
2316 |
|
cout<<endl; |
2317 |
|
for (Int_t ii=0; ii<R->GetEntries(); ii++){ |
2318 |
|
R->GetEntry(ii); |
2319 |
|
cout << ii<< "\t | "; |
2320 |
|
cout << R->GetTreeNumber()<< "\t |"; |
2321 |
|
// cout << R->GetChainOffset()<< "\t |"; |
2322 |
|
cout <<GetRunInfo()->ID<<"\t"; |
2323 |
|
cout <<GetRunInfo()->ID_RUN_FRAG<<"\t"; |
2324 |
|
cout <<GetRunInfo()->NEVENTS<< "\t"; |
2325 |
|
cout <<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME <<"\t"; |
2326 |
|
cout <<GetRunInfo()->RUNHEADER_OBT<<" <---> "<<GetRunInfo()->RUNTRAILER_OBT<<"\t"; |
2327 |
|
cout <<endl; |
2328 |
|
irunoffset[R->GetTreeNumber()]=R->GetChainOffset(); |
2329 |
|
} |
2330 |
|
cout << "----------------------------------------------------"<<endl; |
2331 |
|
|
2332 |
|
|
2333 |
|
|
2334 |
|
}else{ |
2335 |
|
delete R; |
2336 |
|
R=0; |
2337 |
|
} |
2338 |
|
|
2339 |
|
run_tree = R; |
2340 |
|
|
2341 |
return R; |
return R; |
2342 |
|
|
2343 |
} |
} |
2351 |
* @return Pointer to a TTree |
* @return Pointer to a TTree |
2352 |
*/ |
*/ |
2353 |
TTree *PamLevel2::GetRunTree(TFile *f){ |
TTree *PamLevel2::GetRunTree(TFile *f){ |
2354 |
|
if ( run_tree ){ |
2355 |
|
printf("WARNING: TTree *PamLevel2::GetRunTree(TFile *f) -- run_tree already exists!\n "); |
2356 |
|
return run_tree; |
2357 |
|
}; |
2358 |
|
|
2359 |
|
|
2360 |
|
cout << "TTree *PamLevel2::GetRunTree(TFile *f) -- obsolte "<<endl; |
2361 |
|
|
2362 |
TTree *R = (TTree*)f->Get("Run"); |
TTree *T = (TTree*)f->Get("Run"); |
|
|
|
|
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
|
|
cout << "Run : set branch address RunInfo"<<endl; |
|
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
|
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
|
2363 |
|
|
2364 |
return R; |
if(T){ |
2365 |
|
T->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
2366 |
|
cout << "Run : set branch address RunInfo"<<endl; |
2367 |
|
T->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
2368 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
2369 |
|
|
2370 |
|
} |
2371 |
|
|
2372 |
|
run_tree = (TChain*)T; |
2373 |
|
|
2374 |
|
return T; |
2375 |
|
|
2376 |
} |
} |
2377 |
/** |
/** |
2379 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
2380 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
2381 |
*/ |
*/ |
2382 |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev){ |
2383 |
// |
// |
2384 |
// check if we have already called once GetEntry, if not call it |
// check if we have already called once GetEntry, if not call it |
2385 |
// |
// |
2386 |
if ( run->GetEntries() <= 0 ) return(false); |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- ATTENZIONE --- NON E` MANTENUTA!!!!!!!.... "<<endl; |
2387 |
// |
if(!run){ |
2388 |
Int_t oldrun = irun; |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl; |
2389 |
if ( irun < 0 ){ |
return(false); |
2390 |
irun = 0; |
} |
2391 |
run->GetEntry(0); |
if ( run->GetEntries() <= 0 ) return(false); |
2392 |
runfirstentry = 0ULL; |
// |
2393 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
|
2394 |
}; |
// Int_t oldrun = irun; |
2395 |
while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
Long64_t oldrun = irun; |
2396 |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
|
2397 |
irun++; |
// -------------------------------------- |
2398 |
run->GetEntry(irun); |
// if it is a full file (not preselected) |
2399 |
runfirstentry = runlastentry+1ULL; |
// -------------------------------------- |
2400 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
if(SELLI==0){ |
2401 |
}; |
|
2402 |
// |
// |
2403 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
// the absolute time is necessary to relate the event with the run |
2404 |
// |
// |
2405 |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
if( !GetOrbitalInfo() && !ISGP){ |
2406 |
// |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
2407 |
return(true); |
return(false); |
2408 |
// |
} |
2409 |
|
|
2410 |
|
ULong64_t abstime = 0; |
2411 |
|
if( GetOrbitalInfo() )abstime=GetOrbitalInfo()->absTime; |
2412 |
|
|
2413 |
|
|
2414 |
|
// |
2415 |
|
// the first time the routine is called, set run search from the beginning |
2416 |
|
// |
2417 |
|
if ( irun < 0LL ){ |
2418 |
|
irun = 0LL; |
2419 |
|
run->GetEntry(irun); |
2420 |
|
runfirstentry = 0LL; |
2421 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
2422 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
2423 |
|
|
2424 |
|
if( ISGP && run->GetEntries()!=1 ){ |
2425 |
|
cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run->GetEntries() << endl; |
2426 |
|
cout << "** WARNING ** run will not be updated"<<endl; |
2427 |
|
} |
2428 |
|
|
2429 |
|
}; |
2430 |
|
// |
2431 |
|
if(ISGP)abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
2432 |
|
// |
2433 |
|
if ( irun == run->GetEntries()-1LL && |
2434 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && |
2435 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2436 |
|
){ |
2437 |
|
irun = -1LL; |
2438 |
|
irunt = -1LL; |
2439 |
|
runfirstentry = 0LL; |
2440 |
|
runlastentry = -1LL; |
2441 |
|
}; |
2442 |
|
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
2443 |
|
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
2444 |
|
// |
2445 |
|
bool fromfirst = true; |
2446 |
|
// |
2447 |
|
while ( !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ |
2448 |
|
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
2449 |
|
irun++; |
2450 |
|
run->GetEntry(irun); |
2451 |
|
runfirstentry = runlastentry; |
2452 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; |
2453 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
2454 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2455 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
2456 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
2457 |
|
// printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME); |
2458 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
2459 |
|
// |
2460 |
|
// prevshift = 0; |
2461 |
|
// |
2462 |
|
if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){ |
2463 |
|
printf(" resetting irun (it should NOT happen!!!)\n"); |
2464 |
|
fromfirst = false; |
2465 |
|
irun = 0; |
2466 |
|
run->GetEntry(irun); |
2467 |
|
runfirstentry = 0ULL; |
2468 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
2469 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
2470 |
|
}; |
2471 |
|
// |
2472 |
|
}; |
2473 |
|
// |
2474 |
|
if ( |
2475 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && |
2476 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2477 |
|
) { |
2478 |
|
printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime); |
2479 |
|
return false; |
2480 |
|
} |
2481 |
|
// |
2482 |
|
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
2483 |
|
// |
2484 |
|
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
2485 |
|
// |
2486 |
|
prevshift = 0; |
2487 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2488 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
2489 |
|
return(true); |
2490 |
|
}; |
2491 |
|
// ---------------------------------------------------- |
2492 |
|
// if it is a preselected file (there is SelectionList) |
2493 |
|
// NBNB - the event tree MUST be read first |
2494 |
|
// ---------------------------------------------------- |
2495 |
|
if(SELLI==1){ |
2496 |
|
sel_tree->GetEntry(iev); |
2497 |
|
// cout << irun << " "<< irunentry << endl; |
2498 |
|
if(irun != oldrun){ |
2499 |
|
run->GetEntry(irun); |
2500 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2501 |
|
prevshift = 0; |
2502 |
|
return true; |
2503 |
|
} |
2504 |
|
return false; |
2505 |
|
} |
2506 |
|
|
2507 |
|
return false; |
2508 |
|
// |
2509 |
|
}; |
2510 |
|
|
2511 |
|
Bool_t PamLevel2::UpdateRunInfo(Long64_t iev){ |
2512 |
|
|
2513 |
|
if(!run_tree){ |
2514 |
|
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl; |
2515 |
|
return false; |
2516 |
|
} |
2517 |
|
if ( run_tree->GetEntries() <= 0 ) { |
2518 |
|
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl; |
2519 |
|
return(false); |
2520 |
|
} |
2521 |
|
|
2522 |
|
Int_t oldrun = irun; // store current run index |
2523 |
|
|
2524 |
|
// ----------------------------------------------------------------------- |
2525 |
|
// the first time the routine is called, set run search from the beginning |
2526 |
|
// ----------------------------------------------------------------------- |
2527 |
|
|
2528 |
|
if ( irun < 0 ){ |
2529 |
|
irun = 0LL; |
2530 |
|
irunt = 0LL; |
2531 |
|
irunentry = 0; |
2532 |
|
prevshift = 0; |
2533 |
|
run_tree->GetEntry(irun); |
2534 |
|
if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<<endl; |
2535 |
|
}; |
2536 |
|
// --------------------------------------------------------------- |
2537 |
|
// retrieve OBT and absolute time of the event |
2538 |
|
// --------------------------------------------------------------- |
2539 |
|
ULong64_t abstime = 0LL; |
2540 |
|
ULong64_t obt = 0LL; |
2541 |
|
if( GetOrbitalInfo() ){ |
2542 |
|
abstime = GetOrbitalInfo()->absTime; |
2543 |
|
obt = GetOrbitalInfo()->OBT; |
2544 |
|
// cout << " ABS >>> "<<abstime<<" OBT >>> "<<obt<<" "<<endl; |
2545 |
|
}else{ |
2546 |
|
abstime = GetRunInfo()->RUNHEADER_TIME; |
2547 |
|
obt = GetRunInfo()->RUNHEADER_OBT; |
2548 |
|
} |
2549 |
|
// cout << ISGP << " "<<abstime<<endl; |
2550 |
|
// --------------------------------------------------------------- |
2551 |
|
// the absolute time is necessary to relate the event with the run |
2552 |
|
// --------------------------------------------------------------- |
2553 |
|
// if( !GetOrbitalInfo() && !ISGP ){ |
2554 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
2555 |
|
// return(false); |
2556 |
|
// } |
2557 |
|
// ----------------------------------------------------------------------- |
2558 |
|
// if it is simulation, assign abstime by hand (temporaneo!!!) |
2559 |
|
// ----------------------------------------------------------------------- |
2560 |
|
// if(ISGP){ |
2561 |
|
// abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
2562 |
|
// obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO |
2563 |
|
// } |
2564 |
|
|
2565 |
|
|
2566 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2567 |
|
// if it is a full file (not preselected) |
2568 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2569 |
|
if(SELLI==0){ |
2570 |
|
|
2571 |
|
// --------------------------------------------------------------- |
2572 |
|
// increment dead and live-time counters |
2573 |
|
// (only when reading a file not preselected) |
2574 |
|
// --------------------------------------------------------------- |
2575 |
|
if(SELLI==0){ |
2576 |
|
if( GetTrigLevel2() ){ |
2577 |
|
totdltime[0]+=GetTrigLevel2()->dltime[0]; |
2578 |
|
totdltime[1]+=GetTrigLevel2()->dltime[1]; |
2579 |
|
} |
2580 |
|
totdltime[2]++; |
2581 |
|
} |
2582 |
|
// cout << setw(10)<<totdltime[0]<<setw(10)<<totdltime[1]<<setw(10)<<totdltime[2]<<endl; |
2583 |
|
|
2584 |
|
// // --------------------------------------------------------------- |
2585 |
|
// // retrieve OBT and absolute time of the event |
2586 |
|
// // --------------------------------------------------------------- |
2587 |
|
// ULong64_t abstime = 0; |
2588 |
|
// ULong64_t obt = 0; |
2589 |
|
// if( GetOrbitalInfo() ){ |
2590 |
|
// abstime = GetOrbitalInfo()->absTime; |
2591 |
|
// obt = GetOrbitalInfo()->OBT; |
2592 |
|
// } |
2593 |
|
// // --------------------------------------------------------------- |
2594 |
|
// // the absolute time is necessary to relate the event with the run |
2595 |
|
// // --------------------------------------------------------------- |
2596 |
|
// if( !GetOrbitalInfo() && !ISGP ){ |
2597 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
2598 |
|
// return(false); |
2599 |
|
// } |
2600 |
|
|
2601 |
|
// // ----------------------------------------------------------------------- |
2602 |
|
// // the first time the routine is called, set run search from the beginning |
2603 |
|
// // ----------------------------------------------------------------------- |
2604 |
|
// if ( irun < 0 ){ |
2605 |
|
// irun = 0LL; |
2606 |
|
// irunt = 0LL; |
2607 |
|
// irunentry = 0; |
2608 |
|
// prevshift = 0; |
2609 |
|
// run_tree->GetEntry(irun); |
2610 |
|
|
2611 |
|
// if( ISGP && run_tree->GetEntries()!=1 ){ |
2612 |
|
// cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run_tree->GetEntries() << endl; |
2613 |
|
// cout << "** WARNING ** run will not be updated"<<endl; |
2614 |
|
// } |
2615 |
|
// }; |
2616 |
|
|
2617 |
|
// // ----------------------------------------------------------------------- |
2618 |
|
// // if it is simulation, assign abstime by hand (temporaneo!!!) |
2619 |
|
// // ----------------------------------------------------------------------- |
2620 |
|
// if(ISGP){ |
2621 |
|
// abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
2622 |
|
// obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO |
2623 |
|
// } |
2624 |
|
// |
2625 |
|
bool fromfirst = true; // first loop over runs |
2626 |
|
|
2627 |
|
// Bool_t hasfrag = false; |
2628 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
2629 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
2630 |
|
|
2631 |
|
// ------------------------------------------------------ |
2632 |
|
// loop over runs to find the one that contains the event |
2633 |
|
// ------------------------------------------------------ |
2634 |
|
while ( |
2635 |
|
( |
2636 |
|
( |
2637 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2638 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) && |
2639 |
|
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2640 |
|
obt <= GetRunInfo()->RUNTRAILER_OBT) |
2641 |
|
) |
2642 |
|
|| GetRunInfo()->NEVENTS==0 |
2643 |
|
// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento |
2644 |
|
|| !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) |
2645 |
|
) |
2646 |
|
&& irun < run_tree->GetEntries() ){ |
2647 |
|
|
2648 |
|
// - - - - - - - - - - - - - |
2649 |
|
// irunentry = position of current entry, relative to the run |
2650 |
|
// prevshift = shift needed to synchronize l0 and l2 data (nested events) |
2651 |
|
// - - - - - - - - - - - - - |
2652 |
|
|
2653 |
|
// ----------------------------------------- |
2654 |
|
// store dead and live-time of previous run |
2655 |
|
// ----------------------------------------- |
2656 |
|
// if(SELLI==0){ |
2657 |
|
if(fromfirst){ |
2658 |
|
if(oldrun==irun){ |
2659 |
|
/// decrement counters |
2660 |
|
if( GetTrigLevel2()){ |
2661 |
|
totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time |
2662 |
|
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
2663 |
|
} |
2664 |
|
totdltime[2]--; //event counter |
2665 |
|
cout << endl; |
2666 |
|
cout << "n.events : "<<totdltime[2]<<endl; |
2667 |
|
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
2668 |
|
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
2669 |
|
}else{ |
2670 |
|
totdltime[0]=0;//live-time |
2671 |
|
totdltime[1]=0;//dead-time |
2672 |
|
totdltime[2]=0; //event counter |
2673 |
|
cout << " *** JUMP RUN *** irun "<<irun<<endl; |
2674 |
|
} |
2675 |
|
/// add an entry |
2676 |
|
if(run_tree_clone) |
2677 |
|
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
2678 |
|
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
2679 |
|
/// reset counters |
2680 |
|
if( GetTrigLevel2() ){ |
2681 |
|
totdltime[0]=GetTrigLevel2()->dltime[0];//live-time |
2682 |
|
totdltime[1]=0; //dead-time |
2683 |
|
} |
2684 |
|
totdltime[2]=1; //event counter |
2685 |
|
} |
2686 |
|
// } |
2687 |
|
|
2688 |
|
irun++; |
2689 |
|
// ------------------------------------ |
2690 |
|
// if the end of run tree is reached... |
2691 |
|
// ------------------------------------ |
2692 |
|
if( irun == run_tree->GetEntries() ){ |
2693 |
|
if(!fromfirst){ |
2694 |
|
// ----------------------------------------------------- |
2695 |
|
// if it happened already once and the run was not found |
2696 |
|
// ---> exit with error |
2697 |
|
// ----------------------------------------------------- |
2698 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl; |
2699 |
|
return false; |
2700 |
|
} |
2701 |
|
// ----------------------------------------- |
2702 |
|
// ...otherwise repeat search from beginning |
2703 |
|
// ----------------------------------------- |
2704 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- reached end of run tree. searchin again from beginning " <<endl; |
2705 |
|
fromfirst = false; |
2706 |
|
irun = 0LL; |
2707 |
|
runfirstentry = 0LL; |
2708 |
|
} |
2709 |
|
// ------------------------------------------------------------------- |
2710 |
|
// save the index of the first entry of the run, relative to pam_tree, |
2711 |
|
// and read a new run |
2712 |
|
// ------------------------------------------------------------------- |
2713 |
|
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2714 |
|
irunentry = 0; |
2715 |
|
prevshift = 0; |
2716 |
|
run_tree->GetEntry(irun); |
2717 |
|
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
2718 |
|
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2719 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
2720 |
|
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
2721 |
|
} |
2722 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
2723 |
|
// cout << "... where is the next fragment ??"<<endl; |
2724 |
|
// } |
2725 |
|
}; |
2726 |
|
|
2727 |
|
|
2728 |
|
// -------------------------------------- |
2729 |
|
// if there was no need to update the run |
2730 |
|
// ---> exit with FALSE |
2731 |
|
// -------------------------------------- |
2732 |
|
if ( irun == oldrun ) return(false); |
2733 |
|
|
2734 |
|
// -------------------------------------- |
2735 |
|
// ... otherwise |
2736 |
|
// -------------------------------------- |
2737 |
|
|
2738 |
|
|
2739 |
|
|
2740 |
|
|
2741 |
|
// -------------------------------------- |
2742 |
|
// ---> exit with TRUE |
2743 |
|
// -------------------------------------- |
2744 |
|
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2745 |
|
// ---------------------------------------------------- |
2746 |
|
// then check if the run has a fragment |
2747 |
|
// in this case we have to switch to the next fragment |
2748 |
|
// when the end of the first fragment is reached |
2749 |
|
// ---------------------------------------------------- |
2750 |
|
if( |
2751 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
2752 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
2753 |
|
true ){ |
2754 |
|
cout << "* fragment *"<<endl; |
2755 |
|
} |
2756 |
|
|
2757 |
|
return(true); |
2758 |
|
}; |
2759 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2760 |
|
// if it is a preselected file (there is SelectionList) |
2761 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2762 |
|
// irun = run entry relative to the chain |
2763 |
|
// irunt = run entry relative to the tree |
2764 |
|
if(SELLI==1){ |
2765 |
|
sel_tree->GetEntry(iev);// read irunt from SelectionList |
2766 |
|
irun = irunt + irunoffset[sel_tree->GetTreeNumber()];//NEWNEW |
2767 |
|
if(irun != oldrun){ |
2768 |
|
run_tree->GetEntry(irun); |
2769 |
|
// check if the time is ok (with merged files it is not...) |
2770 |
|
// if not loop over run and look for the proper entry |
2771 |
|
bool SECONDO_GIRO=false; |
2772 |
|
Long64_t irun_start = irun; |
2773 |
|
int offset_start = irunoffset[sel_tree->GetTreeNumber()]; |
2774 |
|
while ( |
2775 |
|
( |
2776 |
|
( |
2777 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2778 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2779 |
|
|| |
2780 |
|
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2781 |
|
obt <= GetRunInfo()->RUNTRAILER_OBT) |
2782 |
|
) |
2783 |
|
|| GetRunInfo()->NEVENTS==0 |
2784 |
|
) |
2785 |
|
// && irun < run_tree->GetEntries() |
2786 |
|
){ |
2787 |
|
cout << " (test) "; |
2788 |
|
cout << " tree "<<sel_tree->GetTreeNumber(); |
2789 |
|
cout << " irunt "<<irunt; |
2790 |
|
cout << " offset "<<irunoffset[sel_tree->GetTreeNumber()]; |
2791 |
|
cout << " abs "<<abstime; |
2792 |
|
cout <<" >> "<<GetRunInfo()->RUNHEADER_TIME<<" "<<GetRunInfo()->RUNTRAILER_TIME; |
2793 |
|
cout << " obt "<<obt; |
2794 |
|
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
2795 |
|
cout << " *** JUMP RUN *** irun "<<irun; |
2796 |
|
// if(!SECONDO_GIRO)cout << " (don't worry)"; |
2797 |
|
// else cout << " (start worring...)"; |
2798 |
|
cout << endl; |
2799 |
|
// irun++; |
2800 |
|
irunoffset[sel_tree->GetTreeNumber()]++; |
2801 |
|
irun = irunt + irunoffset[sel_tree->GetTreeNumber()];//NEWNEW |
2802 |
|
// if(irun == run_tree->GetEntries() && SECONDO_GIRO){ |
2803 |
|
if(irun == irun_start){ |
2804 |
|
cout << " ...grrrvzzkhhhajsdkj!!!! "<<endl; |
2805 |
|
irunoffset[sel_tree->GetTreeNumber()] = offset_start; |
2806 |
|
return false; |
2807 |
|
} |
2808 |
|
if(irun == run_tree->GetEntries()){ |
2809 |
|
SECONDO_GIRO=true; |
2810 |
|
irun=0; |
2811 |
|
irunoffset[sel_tree->GetTreeNumber()]=-irunt; |
2812 |
|
} |
2813 |
|
run_tree->GetEntry(irun); |
2814 |
|
} |
2815 |
|
|
2816 |
|
cout << " (test) "; |
2817 |
|
cout << " tree "<<sel_tree->GetTreeNumber(); |
2818 |
|
cout << " irunt "<<irunt; |
2819 |
|
cout << " offset "<<irunoffset[sel_tree->GetTreeNumber()]; |
2820 |
|
cout << " abs "<<abstime; |
2821 |
|
cout <<" >> "<<GetRunInfo()->RUNHEADER_TIME<<" "<<GetRunInfo()->RUNTRAILER_TIME; |
2822 |
|
cout << " obt "<<obt; |
2823 |
|
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
2824 |
|
cout << endl; |
2825 |
|
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2826 |
|
cout << endl; |
2827 |
|
prevshift = 0; |
2828 |
|
return true; |
2829 |
|
} |
2830 |
|
return false; |
2831 |
|
} |
2832 |
|
|
2833 |
|
return false; |
2834 |
|
// |
2835 |
}; |
}; |
2836 |
/** |
/** |
2837 |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
2838 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
2839 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
2840 |
*/ |
*/ |
2841 |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev){ |
2842 |
return(UpdateRunInfo((TChain*)run,iev)); |
return(UpdateRunInfo((TChain*)run,iev)); |
2843 |
}; |
}; |
2844 |
|
|
2845 |
//-------------------------------------- |
//-------------------------------------- |
2849 |
/** |
/** |
2850 |
* Set which trees shoul be analysed |
* Set which trees shoul be analysed |
2851 |
* @param detlist TString containing the sequence of trees required |
* @param detlist TString containing the sequence of trees required |
2852 |
*/ |
*/ |
2853 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
2854 |
|
|
2855 |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
// if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
2856 |
|
if( detlist.Contains("+ALL", TString::kIgnoreCase)){ |
2857 |
|
|
2858 |
|
cout << " ======================================================== "<<endl; |
2859 |
|
cout << " (( WARNING )) "<<endl; |
2860 |
|
cout << " The meaning of the option +ALL has changed!! "<<endl; |
2861 |
|
cout << " Now it includes really all (level0+level1+level2+gpamela)"<<endl; |
2862 |
|
cout << " and the file is discarded if it does not contain "<<endl; |
2863 |
|
cout << " all trees or if level0 files are not available!! "<<endl; |
2864 |
|
cout << " ======================================================== "<<endl; |
2865 |
|
|
2866 |
|
CAL0 = true; |
2867 |
CAL1 = true; |
CAL1 = true; |
2868 |
CAL2 = true; |
CAL2 = true; |
2869 |
TRK2 = true; |
TRK2 = true; |
2870 |
TRK1 = false; |
TRK1 = true; |
2871 |
TRKh = false; |
TRKh = true; |
2872 |
|
TRK0 = true; |
2873 |
TRG = true; |
TRG = true; |
2874 |
TOF = true; |
TOF = true; |
2875 |
|
TOF0 = true; |
2876 |
S4 = true; |
S4 = true; |
2877 |
ND = true; |
ND = true; |
2878 |
AC = true; |
AC = true; |
2879 |
ORB = true; |
ORB = true; |
2880 |
|
GP = true; |
2881 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
2882 |
|
CAL0 = false; |
2883 |
CAL1 = false; |
CAL1 = false; |
2884 |
CAL2 = false; |
CAL2 = false; |
2885 |
TRK2 = false; |
TRK2 = false; |
2886 |
TRK1 = false; |
TRK1 = false; |
2887 |
TRKh = false; |
TRKh = false; |
2888 |
|
TRK0 = false; |
2889 |
TRG = false; |
TRG = false; |
2890 |
TOF = false; |
TOF = false; |
2891 |
|
TOF0 = false; |
2892 |
S4 = false; |
S4 = false; |
2893 |
ND = false; |
ND = false; |
2894 |
AC = false; |
AC = false; |
2895 |
ORB = false; |
ORB = false; |
2896 |
|
GP = false; |
2897 |
}; |
}; |
2898 |
|
|
2899 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
2901 |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
2902 |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
2903 |
}; |
}; |
2904 |
|
|
2905 |
|
if( detlist.Contains("CAL0", TString::kIgnoreCase) ){ |
2906 |
|
if ( detlist.Contains("-CAL0", TString::kIgnoreCase) )CAL0=false; |
2907 |
|
if ( detlist.Contains("+CAL0", TString::kIgnoreCase) )CAL0=true; |
2908 |
|
}; |
2909 |
|
|
2910 |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
2911 |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
2918 |
CAL1=false; |
CAL1=false; |
2919 |
} |
} |
2920 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
2921 |
|
if( detlist.Contains("TRK0", TString::kIgnoreCase) ){ |
2922 |
|
if ( detlist.Contains("-TRK0", TString::kIgnoreCase) )TRK0=false; |
2923 |
|
if ( detlist.Contains("+TRK0", TString::kIgnoreCase) )TRK0=true; |
2924 |
|
}; |
2925 |
|
|
2926 |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
2927 |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
2928 |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
2951 |
|
|
2952 |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
2953 |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
2954 |
|
|
2955 |
|
if( detlist.Contains("-TOF0", TString::kIgnoreCase) )TOF0 = false; |
2956 |
|
else if( detlist.Contains("+TOF0", TString::kIgnoreCase) )TOF0 = true; |
2957 |
|
|
2958 |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
2959 |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
2967 |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
2968 |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
2969 |
|
|
2970 |
|
if( detlist.Contains("-GP", TString::kIgnoreCase) )GP = false; |
2971 |
|
else if( detlist.Contains("+GP", TString::kIgnoreCase) )GP = true; |
2972 |
|
|
2973 |
|
cout<< "tree/branch list from input --> "; |
2974 |
|
if(TRK0)cout<<"TRK0 "; |
2975 |
|
if(TRK1)cout<<"TRK1 "; |
2976 |
|
if(TRK2)cout<<"TRK2 "; |
2977 |
|
if(TRKh)cout<<"TRKH "; |
2978 |
|
if(CAL0)cout<<"CAL0 "; |
2979 |
|
if(CAL1)cout<<"CAL1 "; |
2980 |
|
if(CAL2)cout<<"CAL2 "; |
2981 |
|
if(TOF)cout<<"TOF "; |
2982 |
|
if(TRG)cout<<"TRG "; |
2983 |
|
if(AC)cout<<"AC "; |
2984 |
|
if(ND)cout<<"ND "; |
2985 |
|
if(S4)cout<<"S4 "; |
2986 |
|
if(ORB)cout<<"ORB "; |
2987 |
|
if(GP)cout<<"GP "; |
2988 |
|
cout << endl; |
2989 |
// cout<< "Set detector list --> "; |
// cout<< "Set detector list --> "; |
2990 |
// if(TRK1)cout<<"TRK1 "; |
// if(TRK1)cout<<"TRK1 "; |
2991 |
// if(TRK2)cout<<"TRK2 "; |
// if(TRK2)cout<<"TRK2 "; |
2992 |
// if(TRKh)cout<<"TRKH "; |
// if(TRKh)cout<<"TRKH "; |
2993 |
// if(CAL1)cout<<"CAL1 "; |
// if(CAL1)cout<<"CAL1 "; |
2994 |
// if(CAL2)cout<<"CAL2 "; |
// if(CAL2)cout<<"CAL2 "; |
2995 |
|
// if(TOF0)cout<<"TOF0 "; |
2996 |
// if(TOF)cout<<"TOF "; |
// if(TOF)cout<<"TOF "; |
2997 |
// if(TRG)cout<<"TRG "; |
// if(TRG)cout<<"TRG "; |
2998 |
// if(AC)cout<<"AC "; |
// if(AC)cout<<"AC "; |
3008 |
* Set tree/branch detector flags from the content of a tree |
* Set tree/branch detector flags from the content of a tree |
3009 |
*/ |
*/ |
3010 |
void PamLevel2::GetWhichTrees(TFile* f){ |
void PamLevel2::GetWhichTrees(TFile* f){ |
3011 |
|
|
3012 |
|
|
3013 |
|
|
3014 |
|
// cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<<endl; |
3015 |
// ----------- |
// ----------- |
3016 |
// reset flags |
// reset flags |
3017 |
// ----------- |
// ----------- |
3026 |
ND = false; |
ND = false; |
3027 |
AC = false; |
AC = false; |
3028 |
ORB = false; |
ORB = false; |
3029 |
|
GP = false; |
3030 |
|
|
3031 |
RUN = false; |
RUN = false; |
3032 |
|
|
3117 |
TRK2 = false; |
TRK2 = false; |
3118 |
TRKh = false; |
TRKh = false; |
3119 |
}else nev=nevt; |
}else nev=nevt; |
3120 |
T->Delete(); |
// T->Delete(); |
3121 |
}; |
}; |
3122 |
//========================================================= |
//========================================================= |
3123 |
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
3133 |
CAL1 = false; |
CAL1 = false; |
3134 |
CAL2 = false; |
CAL2 = false; |
3135 |
}else nev=nevt; |
}else nev=nevt; |
3136 |
T->Delete(); |
// T->Delete(); |
3137 |
}; |
}; |
3138 |
|
//========================================================= |
3139 |
|
if( !strcmp(key->GetName(),"h20") ){ |
3140 |
|
GP = true; |
3141 |
|
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
3142 |
|
if( nev && nevt!=nev){ |
3143 |
|
cout << "File: "<< f->GetName() <<" h20 tree has "<<nevt<<" events instead of "<<nev<< endl; |
3144 |
|
GP = false; |
3145 |
|
}else nev=nevt; |
3146 |
|
} |
3147 |
|
|
3148 |
}; |
}; |
3149 |
|
|
3150 |
delete lk; |
// delete lk; |
3151 |
|
|
3152 |
// cout<< "Get detector list from input file --> "; |
cout<< "tree/branch list from file --> "; |
3153 |
// if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
3154 |
// if(TRK2)cout<<"TRK2 "; |
if(TRK2)cout<<"TRK2 "; |
3155 |
// if(TRKh)cout<<"TRKH "; |
if(TRKh)cout<<"TRKH "; |
3156 |
// if(CAL1)cout<<"CAL1 "; |
if(CAL1)cout<<"CAL1 "; |
3157 |
// if(CAL2)cout<<"CAL2 "; |
if(CAL2)cout<<"CAL2 "; |
3158 |
// if(TOF)cout<<"TOF "; |
if(TOF)cout<<"TOF "; |
3159 |
// if(TRG)cout<<"TRG "; |
if(TRG)cout<<"TRG "; |
3160 |
// if(AC)cout<<"AC "; |
if(AC)cout<<"AC "; |
3161 |
// if(ND)cout<<"ND "; |
if(ND)cout<<"ND "; |
3162 |
// if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
3163 |
// if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
3164 |
// cout << endl; |
if(GP)cout<<"GP "; |
3165 |
|
cout << endl; |
3166 |
|
|
3167 |
return ; |
return ; |
3168 |
|
|
3191 |
Bool_t ND__ok = false; |
Bool_t ND__ok = false; |
3192 |
Bool_t AC__ok = false; |
Bool_t AC__ok = false; |
3193 |
Bool_t ORB__ok = false; |
Bool_t ORB__ok = false; |
3194 |
|
Bool_t GP__ok = false; |
3195 |
|
|
3196 |
Bool_t RUN__ok = false; |
Bool_t RUN__ok = false; |
3197 |
|
|
3198 |
|
Bool_t SELLI__ok = false; |
3199 |
|
|
3200 |
cout << "Checking file: "<<name<<endl; |
// cout << "Checking file: "<<name<<endl; |
3201 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
3202 |
if( !f || f->IsZombie() ){ |
if( !f || f->IsZombie() ){ |
3203 |
cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; |
3212 |
|
|
3213 |
while( (key = (TKey*)next()) ){ |
while( (key = (TKey*)next()) ){ |
3214 |
|
|
3215 |
|
// cout << key->GetName() << endl; |
3216 |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
3217 |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
3218 |
// nev_previous = nev; |
// nev_previous = nev; |
3223 |
// return false; |
// return false; |
3224 |
// }; |
// }; |
3225 |
|
|
3226 |
|
//========================================================= |
3227 |
|
// check if the file |
3228 |
|
|
3229 |
|
|
3230 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
3231 |
|
|
3232 |
//========================================================= |
//========================================================= |
3233 |
|
if( !strcmp(key->GetName(),"SelectionList" ) ){ |
3234 |
|
SELLI__ok = true; |
3235 |
|
if(SELLI==1){ |
3236 |
|
Int_t nevt = ((TTree*)f->Get("SelectionList"))->GetEntries(); |
3237 |
|
if( nev && nevt!=nev){ |
3238 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList tree has "<<nevt<<" events instead of "<<nev<< endl; |
3239 |
|
return false; |
3240 |
|
} |
3241 |
|
nev=nevt; |
3242 |
|
} |
3243 |
|
} |
3244 |
|
|
3245 |
|
//========================================================= |
3246 |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
3247 |
TRG__ok = true; |
TRG__ok = true; |
3248 |
if(TRG){ |
if(TRG){ |
3352 |
}; |
}; |
3353 |
T->Delete(); |
T->Delete(); |
3354 |
}; |
}; |
3355 |
|
//========================================================= |
3356 |
|
if( !strcmp(key->GetName(),"h20") ){ |
3357 |
|
ISGP = true; |
3358 |
|
GP__ok = true; |
3359 |
|
if(GP){ |
3360 |
|
Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); |
3361 |
|
if( nev && nevt!=nev){ |
3362 |
|
cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
3363 |
|
return false; |
3364 |
|
} |
3365 |
|
nev=nevt; |
3366 |
|
} |
3367 |
|
} |
3368 |
|
|
3369 |
}; |
}; |
3370 |
|
|
3371 |
|
if( SELLI==-1 )SELLI = (Int_t)SELLI__ok; |
3372 |
|
if( SELLI==0 && SELLI__ok ){ |
3373 |
|
cout << "File: "<< f->GetName() <<" discarded ---- found SelectionList (it is not a full-event file)" << endl; |
3374 |
|
return false; |
3375 |
|
} |
3376 |
|
if( SELLI==1 && !SELLI__ok ){ |
3377 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList missing" << endl; |
3378 |
|
return false; |
3379 |
|
} |
3380 |
|
|
3381 |
|
// cout << "SELLI "<<SELLI<<endl; |
3382 |
|
|
3383 |
// cout<< "CheckLevel2File(TString): detector list --> "; |
// cout<< "CheckLevel2File(TString): detector list --> "; |
3384 |
// if(TRK1__ok)cout<<"TRK1 "; |
// if(TRK1__ok)cout<<"TRK1 "; |
3385 |
// if(TRK2__ok)cout<<"TRK2 "; |
// if(TRK2__ok)cout<<"TRK2 "; |
3454 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
3455 |
return false; |
return false; |
3456 |
}; |
}; |
3457 |
|
if(GP && !GP__ok){ |
3458 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing h20 tree"<< endl; |
3459 |
|
return false; |
3460 |
|
}; |
3461 |
|
|
3462 |
|
|
3463 |
// lk->Delete(); |
// lk->Delete(); |
3476 |
// if(ND)cout<<"ND "; |
// if(ND)cout<<"ND "; |
3477 |
// if(S4)cout<<"S4 "; |
// if(S4)cout<<"S4 "; |
3478 |
// if(ORB)cout<<"ORB "; |
// if(ORB)cout<<"ORB "; |
3479 |
|
// if(GP)cout<<"GP "; |
3480 |
// cout << endl; |
// cout << endl; |
3481 |
|
|
3482 |
return true; |
return true; |
3493 |
cout << "Create clones of PAMELA trees "<<endl; |
cout << "Create clones of PAMELA trees "<<endl; |
3494 |
|
|
3495 |
Int_t i=0; |
Int_t i=0; |
3496 |
tree_clone[i] = fChain->GetTree()->CloneTree(0); |
pam_tree_clone[i] = fChain->GetTree()->CloneTree(0); |
3497 |
TString name = tree_clone[i]->GetName(); |
TString name = pam_tree_clone[i]->GetName(); |
3498 |
name.Append("_clone"); |
name.Append("_clone"); |
3499 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
3500 |
cout << tree_clone[i]->GetName() <<endl; |
cout << pam_tree_clone[i]->GetName() <<endl; |
3501 |
i++; |
i++; |
3502 |
|
|
3503 |
TList *li = fChain->GetListOfFriends(); |
TList *li = fChain->GetListOfFriends(); |
3507 |
while( (T_friend = (TFriendElement*)next()) ){ |
while( (T_friend = (TFriendElement*)next()) ){ |
3508 |
// 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; |
3509 |
// cout<<T_friend->GetTree()->GetName()<< endl; |
// cout<<T_friend->GetTree()->GetName()<< endl; |
3510 |
tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
pam_tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
3511 |
tree_clone[i]->SetAutoSave(1000000); |
pam_tree_clone[i]->SetAutoSave(1000000); |
3512 |
name = tree_clone[i]->GetName(); |
name = pam_tree_clone[i]->GetName(); |
3513 |
name.Append("_clone"); |
name.Append("_clone"); |
3514 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
3515 |
cout << tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
3516 |
i++; |
i++; |
3517 |
} |
} |
3518 |
|
|
3527 |
*/ |
*/ |
3528 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
3529 |
|
|
3530 |
|
|
3531 |
|
// if the pointer is null, create a default file |
3532 |
|
|
3533 |
|
if(!ofile){ |
3534 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
3535 |
|
ofile = new TFile("clone-tree.root","recreate"); |
3536 |
|
} |
3537 |
|
|
3538 |
ofile->cd(); |
ofile->cd(); |
3539 |
|
|
3540 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3541 |
cout << "Create new PAMELA trees "<<endl; |
cout << "Create new PAMELA trees "<<endl; |
3542 |
|
|
|
Int_t i=0; |
|
3543 |
|
|
3544 |
|
run_tree_clone = new TTree("Run","PAMELA Level2 data from the GL_RUN table "); |
3545 |
|
run_tree_clone->Branch("RunInfo","GL_RUN",GetPointerTo("RunInfo")); |
3546 |
|
cout << "Run : branch RunInfo"<<endl; |
3547 |
|
run_tree_clone->Branch("SoftInfo","SoftInfo",GetPointerTo("SoftInfo")); |
3548 |
|
cout << "Run : branch SoftInfo"<<endl; |
3549 |
|
// ------------------ |
3550 |
|
// replicate run tree |
3551 |
|
// ------------------ |
3552 |
|
// cout << "----------------------------------------------------"<<endl; |
3553 |
|
// cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl; |
3554 |
|
for (Int_t i=0; i<run_tree->GetEntries(); i++){ |
3555 |
|
run_tree->GetEntry(i); |
3556 |
|
// cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl; |
3557 |
|
run_tree_clone->Fill(); |
3558 |
|
} |
3559 |
|
cout << "----------------------------------------------------"<<endl; |
3560 |
|
|
3561 |
|
// ------------------------------------ |
3562 |
|
// add branch with dead and live times |
3563 |
|
// ------------------------------------ |
3564 |
|
run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l"); |
3565 |
|
cout << "Run : branch DeadLiveTime"<<endl; |
3566 |
|
|
3567 |
|
|
3568 |
|
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
3569 |
|
// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
3570 |
|
sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW |
3571 |
|
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); |
3572 |
|
|
3573 |
|
|
3574 |
|
Int_t i=0; |
3575 |
if(TRK1||TRK2||TRKh){ |
if(TRK1||TRK2||TRKh){ |
3576 |
tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
pam_tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
3577 |
if(TRK1) { |
if(TRK1) { |
3578 |
tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
3579 |
tree_clone[i]->BranchRef(); |
pam_tree_clone[i]->BranchRef(); |
3580 |
cout << "Tracker : branch TrkLevel1"<<endl; |
cout << "Tracker : branch TrkLevel1"<<endl; |
3581 |
|
// cout << "CreateCloneTrees " << GetTrkLevel1()<<endl; |
3582 |
}; |
}; |
3583 |
if(TRK2) { |
if(TRK2) { |
3584 |
tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
3585 |
cout << "Tracker : branch TrkLevel2"<<endl; |
cout << "Tracker : branch TrkLevel2"<<endl; |
3586 |
}; |
}; |
3587 |
if(TRKh) { |
if(TRKh) { |
3588 |
tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
3589 |
cout << "Tracker : branch TrkHough"<<endl; |
cout << "Tracker : branch TrkHough"<<endl; |
3590 |
}; |
}; |
3591 |
i++; |
i++; |
3593 |
|
|
3594 |
// Calorimeter |
// Calorimeter |
3595 |
if(CAL1||CAL2){ |
if(CAL1||CAL2){ |
3596 |
tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
pam_tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
3597 |
if(CAL1) { |
if(CAL1) { |
3598 |
tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
pam_tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
3599 |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
3600 |
}; |
}; |
3601 |
if(CAL2) { |
if(CAL2) { |
3602 |
tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
3603 |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
3604 |
}; |
}; |
3605 |
i++; |
i++; |
3607 |
|
|
3608 |
// ToF |
// ToF |
3609 |
if(TOF) { |
if(TOF) { |
3610 |
tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
3611 |
tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
3612 |
cout << "ToF : branch ToFLevel2"<<endl; |
cout << "ToF : branch ToFLevel2"<<endl; |
3613 |
i++; |
i++; |
3614 |
}; |
}; |
3615 |
// Trigger |
// Trigger |
3616 |
if(TRG) { |
if(TRG) { |
3617 |
tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
pam_tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
3618 |
tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
pam_tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
3619 |
cout << "Trigger : branch TrigLevel2"<<endl; |
cout << "Trigger : branch TrigLevel2"<<endl; |
3620 |
i++; |
i++; |
3621 |
}; |
}; |
3622 |
// S4 |
// S4 |
3623 |
if(S4) { |
if(S4) { |
3624 |
tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
pam_tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
3625 |
tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
pam_tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
3626 |
cout << "S4 : branch S4Level2"<<endl; |
cout << "S4 : branch S4Level2"<<endl; |
3627 |
i++; |
i++; |
3628 |
}; |
}; |
3629 |
// Neutron Detector |
// Neutron Detector |
3630 |
if(ND) { |
if(ND) { |
3631 |
tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
pam_tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
3632 |
tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
pam_tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
3633 |
cout << "NeutronD : branch NDLevel2"<<endl; |
cout << "NeutronD : branch NDLevel2"<<endl; |
3634 |
i++; |
i++; |
3635 |
}; |
}; |
3636 |
// Anticounters |
// Anticounters |
3637 |
if(AC) { |
if(AC) { |
3638 |
tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
pam_tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
3639 |
tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
pam_tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
3640 |
cout << "Anticounter : branch AcLevel2"<<endl; |
cout << "Anticounter : branch AcLevel2"<<endl; |
3641 |
i++; |
i++; |
3642 |
}; |
}; |
3643 |
// OrbitalInfo |
// OrbitalInfo |
3644 |
if(ORB) { |
if(ORB) { |
3645 |
tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
3646 |
tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
3647 |
|
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3648 |
|
i++; |
3649 |
|
}; |
3650 |
|
// GPamela |
3651 |
|
if(GP) { |
3652 |
|
pam_tree_clone[i] = new TTree("h20","PAMELA oribital info "); |
3653 |
|
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
3654 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3655 |
i++; |
i++; |
3656 |
}; |
}; |
3665 |
*/ |
*/ |
3666 |
//void PamLevel2::FillNewPamTree(TTree *T){ |
//void PamLevel2::FillNewPamTree(TTree *T){ |
3667 |
void PamLevel2::FillCloneTrees(){ |
void PamLevel2::FillCloneTrees(){ |
3668 |
|
|
3669 |
for(Int_t i=0; i<8; i++){ |
// cout << "PamLevel2::FillCloneTrees()" << irunentry << endl; |
3670 |
if(tree_clone[i])tree_clone[i]->Fill(); |
|
3671 |
|
for(Int_t i=0; i<NCLONES; i++){ |
3672 |
|
if(pam_tree_clone[i])pam_tree_clone[i]->Fill(); |
3673 |
} |
} |
3674 |
|
if(sel_tree_clone)sel_tree_clone->Fill(); |
3675 |
|
|
3676 |
} |
} |
3677 |
|
|
3678 |
|
|
3679 |
TTree* PamLevel2::GetCloneTree(TString name){ |
TTree* PamLevel2::GetCloneTree(TString name){ |
3680 |
|
|
3681 |
for(Int_t i=0; i<8; i++){ |
for(Int_t i=0; i<NCLONES; i++){ |
3682 |
if(tree_clone[i]){ |
if(pam_tree_clone[i]){ |
3683 |
TString na = tree_clone[i]->GetName(); |
TString na = pam_tree_clone[i]->GetName(); |
3684 |
if(!name.CompareTo(na))return tree_clone[i]; |
if(!name.CompareTo(na))return pam_tree_clone[i]; |
3685 |
}; |
}; |
3686 |
} |
} |
3687 |
|
if(run_tree_clone){ |
3688 |
|
TString na = run_tree_clone->GetName(); |
3689 |
|
if(!name.CompareTo(na))return run_tree_clone; |
3690 |
|
} |
3691 |
|
if(sel_tree_clone){ |
3692 |
|
TString na = sel_tree_clone->GetName(); |
3693 |
|
if(!name.CompareTo(na))return sel_tree_clone; |
3694 |
|
} |
3695 |
return NULL; |
return NULL; |
3696 |
|
|
3697 |
} |
} |
3698 |
void PamLevel2::WriteCloneTrees(){ |
void PamLevel2::WriteCloneTrees(){ |
3699 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3700 |
cout << "Write clones of PAMELA trees "<<endl; |
cout << "Write clones of PAMELA trees "<<endl; |
3701 |
for(Int_t i=0; i<8; i++){ |
cout << run_tree_clone->GetName()<<endl; |
3702 |
if(tree_clone[i]){ |
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
3703 |
cout << tree_clone[i]->GetName()<<endl; |
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
3704 |
tree_clone[i]->Write(); |
run_tree_clone->Write(); |
3705 |
|
cout << sel_tree_clone->GetName()<<endl; |
3706 |
|
sel_tree_clone->Write(); |
3707 |
|
for(Int_t i=0; i<NCLONES; i++){ |
3708 |
|
if(pam_tree_clone[i]){ |
3709 |
|
cout << pam_tree_clone[i]->GetName()<<endl; |
3710 |
|
pam_tree_clone[i]->Write(); |
3711 |
}; |
}; |
3712 |
} |
} |
3713 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3715 |
} |
} |
3716 |
|
|
3717 |
/** |
/** |
3718 |
* Create a new (empty) Pamela trees |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
3719 |
|
*/ |
3720 |
|
//Int_t PamLevel2::GetEntry(Int_t iee){ |
3721 |
|
Int_t PamLevel2::GetEntry(Long64_t iee){ |
3722 |
|
|
3723 |
|
// cout << "-------------------------------------"<<endl; |
3724 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
3725 |
|
|
3726 |
|
if(!pam_tree){ |
3727 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
3728 |
|
return 0; |
3729 |
|
} |
3730 |
|
|
3731 |
|
|
3732 |
|
// |
3733 |
|
// 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... |
3734 |
|
// |
3735 |
|
// if(!run_tree ){ |
3736 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
3737 |
|
// return 0; |
3738 |
|
// } |
3739 |
|
|
3740 |
|
Long64_t ii=0; |
3741 |
|
//------------------------------- |
3742 |
|
ii = iee; |
3743 |
|
if( !pam_tree->GetEntry(ii) ){ |
3744 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
3745 |
|
return 0; |
3746 |
|
} |
3747 |
|
|
3748 |
|
// |
3749 |
|
// ... 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. |
3750 |
|
// 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 |
3751 |
|
// a problem if you don't check the return code of getentry. |
3752 |
|
// |
3753 |
|
if(!run_tree ){ |
3754 |
|
if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1? |
3755 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
3756 |
|
return 0; |
3757 |
|
} else { |
3758 |
|
return 1; //cosi` se non c'e` run esce qua... |
3759 |
|
} |
3760 |
|
} |
3761 |
|
|
3762 |
|
//------------------------------- |
3763 |
|
ii = iee; |
3764 |
|
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
3765 |
|
// Bool_t UPDATED = UpdateRunInfo(ii); |
3766 |
|
UpdateRunInfo(ii); |
3767 |
|
if(SELLI==0)irunentry = iee-runfirstentry; |
3768 |
|
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
3769 |
|
|
3770 |
|
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
3771 |
|
|
3772 |
|
// cout << "irunentry "<<irunentry << endl; |
3773 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
3774 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
3775 |
|
|
3776 |
|
// if( TRK0 || CAL0 || TOF0 ){ |
3777 |
|
// if( !GetYodaEntry( ) ){ |
3778 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
3779 |
|
// return 0; |
3780 |
|
// } |
3781 |
|
// } |
3782 |
|
|
3783 |
|
|
3784 |
|
return 1; |
3785 |
|
|
3786 |
|
} |
3787 |
|
|
3788 |
|
TrkLevel0 *PamLevel2::GetTrkLevel0(){ |
3789 |
|
if( !TRK0 )return NULL; |
3790 |
|
if( !GetYodaEntry( ) ){ |
3791 |
|
cout << " Int_t PamLevel2::GetTrkLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3792 |
|
return 0; |
3793 |
|
} |
3794 |
|
return trk0_obj; |
3795 |
|
}; |
3796 |
|
CaloLevel0 *PamLevel2::GetCaloLevel0(){ |
3797 |
|
if( !CAL0 )return NULL; |
3798 |
|
if( !GetYodaEntry( ) ){ |
3799 |
|
cout << " Int_t PamLevel2::GetCaloLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3800 |
|
return 0; |
3801 |
|
} |
3802 |
|
return calo0_obj; |
3803 |
|
}; |
3804 |
|
|
3805 |
|
|
3806 |
|
/** |
3807 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
3808 |
|
* Given the run ID (...), if needed it query the DB and load the proper file. |
3809 |
|
* @return Pointer to the tree |
3810 |
*/ |
*/ |
|
// TTree* PamLevel2::GetNewPamTree(){ |
|
3811 |
|
|
|
// if(tree_clone)return tree_clone; |
|
3812 |
|
|
3813 |
// TTree *Tout = 0; |
TTree* PamLevel2::GetYodaTree( ){ |
3814 |
|
|
3815 |
|
// cout << "TTree* PamLevel2::GetYodaTree( )"<<endl; |
3816 |
|
//=================================== |
3817 |
|
// check if iroot has changed |
3818 |
|
//=================================== |
3819 |
|
if( irun<0 ){ |
3820 |
|
cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = "<<irun<<endl; |
3821 |
|
// cout << "In order to use this method you have to first load the RunInfo tree "<<endl; |
3822 |
|
return NULL; |
3823 |
|
} |
3824 |
|
Int_t irootnew = run_obj->ID_ROOT_L0; |
3825 |
|
// cout << "iroot "<<iroot<<endl; |
3826 |
|
// cout << "irootnew "<<irootnew<<endl; |
3827 |
|
|
3828 |
|
//=================================== |
3829 |
|
// load the level0 file |
3830 |
|
// (if not already loaded) |
3831 |
|
//=================================== |
3832 |
|
if( iroot != irootnew || !l0_tree){ |
3833 |
|
iroot = irootnew; |
3834 |
|
//=================================== |
3835 |
|
// open the DB connection |
3836 |
|
// (if not already opened) |
3837 |
|
//=================================== |
3838 |
|
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
3839 |
|
GL_ROOT glroot = GL_ROOT(); |
3840 |
|
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
3841 |
|
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
3842 |
|
return NULL; |
3843 |
|
}; |
3844 |
|
TString filename = glroot.PATH + glroot.NAME; |
3845 |
|
if(l0_file){ |
3846 |
|
l0_file->Close(); |
3847 |
|
l0_file->Delete(); |
3848 |
|
} |
3849 |
|
cout << "Opening LEVEL0 file: "<< filename << endl; |
3850 |
|
FileStat_t t; |
3851 |
|
if( gSystem->GetPathInfo(filename.Data(),t) ){ |
3852 |
|
cout << " PamLevel2::GetYodaTree() -- ERROR opening file "<<endl; |
3853 |
|
return NULL; |
3854 |
|
} |
3855 |
|
l0_file = new TFile(filename); |
3856 |
|
if( !l0_file )return NULL; |
3857 |
|
l0_tree = (TTree*)l0_file->Get("Physics"); |
3858 |
|
if(!h0_obj)h0_obj = new EventHeader(); |
3859 |
|
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
3860 |
|
prevshift = 0; |
3861 |
|
//--------------------------------------------------- |
3862 |
|
// TRACKER: |
3863 |
|
if(TRK0){ |
3864 |
|
if(!trk0_obj){ |
3865 |
|
trk0_obj = new TrkLevel0(); |
3866 |
|
trk0_obj->Set(); |
3867 |
|
}; |
3868 |
|
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
3869 |
|
} |
3870 |
|
//-------------------------------------------------- |
3871 |
|
// CALORIMETER: |
3872 |
|
if(CAL0){ |
3873 |
|
if(!calo0_obj){ |
3874 |
|
calo0_obj = new CaloLevel0(); |
3875 |
|
calo0_obj->Set(); |
3876 |
|
}; |
3877 |
|
l0_tree->SetBranchAddress("Calorimeter" ,calo0_obj->GetPointerToCalorimeterEvent()); |
3878 |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
3879 |
|
} |
3880 |
|
//--------------------------------------------------- |
3881 |
|
// TOF: |
3882 |
|
if(TOF0){ |
3883 |
|
cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<<endl; |
3884 |
|
} |
3885 |
|
|
3886 |
|
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
3887 |
|
|
3888 |
|
|
3889 |
|
}; |
3890 |
|
|
3891 |
|
// if(!dbc || (dbc && !dbc->IsConnected())){ |
3892 |
|
// cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
3893 |
|
// } |
3894 |
|
|
3895 |
|
if ( TRK0 ){ |
3896 |
|
TrkParams::Load(6); |
3897 |
|
if( !TrkParams::IsLoaded(6) ){ |
3898 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
3899 |
|
}; |
3900 |
|
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
3901 |
|
TrkParams::SetCalib(run_obj,dbc); |
3902 |
|
TrkParams::LoadCalib( ); |
3903 |
|
if( !TrkParams::CalibIsLoaded() ){ |
3904 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
3905 |
|
}; |
3906 |
|
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
3907 |
|
} |
3908 |
|
|
3909 |
|
|
3910 |
|
// cout << l0_tree << endl; |
3911 |
|
return l0_tree; |
3912 |
|
|
3913 |
|
} |
3914 |
|
|
3915 |
|
/** |
3916 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
3917 |
|
*/ |
3918 |
|
Int_t PamLevel2::GetYodaEntry(){ |
3919 |
|
|
3920 |
|
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
3921 |
|
if(!GetYodaTree())return 0; |
3922 |
|
|
3923 |
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
// patch |
3924 |
// cout << "Create new PAMELA trees "<<endl; |
if( irunentry < 0){ |
3925 |
|
// cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
3926 |
|
irunentry=0LL; |
3927 |
|
} |
3928 |
|
// --------------------------------- |
3929 |
|
// if file is NOT a preselected file |
3930 |
|
// --------------------------------- |
3931 |
|
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); |
3932 |
|
// cout << " irunentry "<<irunentry<<endl; |
3933 |
|
// cout << " EV_FROM "<<run_obj->EV_FROM<<endl; |
3934 |
|
// cout << " quellagiusta = irunentry + EV_FROM "<< quellagiusta << endl; |
3935 |
|
|
3936 |
|
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
3937 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
3938 |
|
// cout << " time "<< abstime << endl; |
3939 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
3940 |
|
|
3941 |
|
ULong64_t obt = 0; |
3942 |
|
ULong64_t pktn = 0; |
3943 |
|
if( GetOrbitalInfo() ){ |
3944 |
|
obt = GetOrbitalInfo()->OBT; |
3945 |
|
pktn = GetOrbitalInfo()->pkt_num; |
3946 |
|
} |
3947 |
|
|
3948 |
|
if( !GetOrbitalInfo() && !ISGP){ |
3949 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
3950 |
|
return 0; |
3951 |
|
} |
3952 |
|
if( obt==0 && pktn==0 && !ISGP ){ |
3953 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl; |
3954 |
|
return 0; |
3955 |
|
} |
3956 |
|
|
3957 |
|
// --------------------------------------------------------------------- |
3958 |
|
// ATTENTION!!! |
3959 |
|
// If data are not pre-processed with cleaner, the level0 tree may contain |
3960 |
|
// spurious nested physics packets. |
3961 |
|
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
3962 |
|
// while level2 tree DOES NOT!! |
3963 |
|
// This means that "quellagiusta" in these cases is not correct. |
3964 |
|
// In order to retrieve the correct level0 event, I implemented a check |
3965 |
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
3966 |
|
// is shift forward until when the packets match. |
3967 |
|
// --------------------------------------------------------------------- |
3968 |
|
Int_t answer = 0; |
3969 |
|
Int_t shift =0; |
3970 |
|
// printf(" siamo qui %i %i \n",shift,prevshift); |
3971 |
|
// Int_t maxshift = 50; // EMILIANO |
3972 |
|
do{ |
3973 |
|
if(shift>0){ |
3974 |
|
cout << " PKTNUM L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3975 |
|
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; |
3976 |
|
cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
3977 |
|
} |
3978 |
|
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
3979 |
|
shift++; |
3980 |
|
if( !GetEventHeader() ){ |
3981 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
3982 |
|
return 0; |
3983 |
|
} |
3984 |
|
|
3985 |
|
if(ISGP){ |
3986 |
|
obt = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO |
3987 |
|
pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO |
3988 |
|
} |
3989 |
|
|
3990 |
|
// cout << "PKTNUM "<<shift<<" == L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3991 |
|
// cout << " L2 --- "<< obt << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
3992 |
|
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
3993 |
|
// cout << " obt "<< obt << endl; |
3994 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
3995 |
|
// cout << " pktn "<< pktn << endl; |
3996 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
3997 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
3998 |
|
// |
3999 |
|
if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){ |
4000 |
|
prevshift = 0; |
4001 |
|
shift = -1; |
4002 |
|
}; |
4003 |
|
|
4004 |
|
}while( ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || |
4005 |
|
pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ) |
4006 |
|
&& (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
4007 |
|
|
4008 |
|
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
4009 |
|
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
4010 |
|
return 0; |
4011 |
|
} |
4012 |
|
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
4013 |
|
// return GetYodaTree()->GetEntry(quellagiusta); |
4014 |
|
if ( shift > 1 ) prevshift += (shift-1); |
4015 |
|
|
4016 |
|
return answer; |
4017 |
|
|
4018 |
// if(TRK1||TRK2||TRKh){ |
} |
4019 |
// TTree *T = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
/** |
4020 |
// if(TRK1) { |
* \Brief Set DB connection |
4021 |
// trk1_clone = new TrkLevel1(); |
*/ |
4022 |
// T->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
Bool_t PamLevel2::SetDBConnection(){ |
|
// 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"); |
|
|
// } |
|
4023 |
|
|
4024 |
// // Calorimeter |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
4025 |
// if(CAL1||CAL2){ |
cout<<"Connecting to DB"<<endl; |
4026 |
// TTree *C = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
cout<<"HOST "<<host<<endl; |
4027 |
// if(CAL1) { |
cout<<"USER "<<user<<endl; |
4028 |
// calo1_clone = new CaloLevel1(); |
cout<<"PSW "<<psw<<endl; |
4029 |
// C->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
4030 |
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
if( !dbc )return false; |
4031 |
// }; |
if( !dbc->IsConnected() )return false; |
4032 |
// if(CAL2) { |
stringstream myquery; // EMILIANO |
4033 |
// calo2_clone = new CaloLevel2(); |
myquery.str(""); // EMILIANO |
4034 |
// C->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
4035 |
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
dbc->Query(myquery.str().c_str()); // EMILIANO |
4036 |
// }; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
4037 |
// if(!Tout)Tout=C; |
return true; |
|
// 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; |
|
4038 |
|
|
4039 |
// tree_clone = Tout; |
} |
|
// tree_clone->SetDirectory(0); |
|
4040 |
|
|
4041 |
// return Tout; |
/** |
4042 |
// } |
* \Brief Add a friend to the pamela chain. |
4043 |
// /** |
* @param cname name of the chain to be added |
4044 |
// * Fill a tree (created with GetNewPamTree) |
*/ |
4045 |
// * |
|
4046 |
// */ |
TChain* PamLevel2::AddFriend(TString cname){ |
4047 |
// //void PamLevel2::FillNewPamTree(TTree *T){ |
|
4048 |
// void PamLevel2::FillNewPamTree(){ |
if(!GetPamTree()){ |
4049 |
|
cout << " TChain* PamLevel2::AddFriend(TString cname) --- a pamela tree must be created first"<<endl; |
4050 |
|
return NULL; |
4051 |
|
} |
4052 |
|
|
4053 |
|
|
4054 |
|
TChain *c = new TChain( cname.Data() ); |
4055 |
|
|
4056 |
|
TIter next( GetPamTree()->GetListOfFiles() ); |
4057 |
|
Int_t nf = 0; |
4058 |
|
TChainElement* element = 0; |
4059 |
|
while ((element = (TChainElement*) next())) { |
4060 |
|
c->Add(element->GetTitle()); |
4061 |
|
nf++; |
4062 |
|
} |
4063 |
|
|
4064 |
|
GetPamTree()->AddFriend(cname.Data()); |
4065 |
|
|
4066 |
|
cout << "external chain created and added to pamela friends :"<<cname<<endl; |
4067 |
|
cout << "n.files "<<nf<<endl; |
4068 |
|
|
4069 |
|
|
4070 |
|
return c; |
4071 |
|
|
4072 |
|
} |
4073 |
|
|
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
|
|
// 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 |
|
|
// } |
|
4074 |
|
|
|
// } |
|