18 |
// YODA headers |
// YODA headers |
19 |
// |
// |
20 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
|
#include <RegistryEvent.h> |
|
21 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
22 |
#include <CalibCalPedEvent.h> |
#include <CalibCalPedEvent.h> |
23 |
// |
// |
45 |
// |
// |
46 |
|
|
47 |
CaloProcessing::~CaloProcessing(){ |
CaloProcessing::~CaloProcessing(){ |
48 |
|
delete de; |
49 |
delete this; |
delete this; |
50 |
} |
} |
51 |
|
|
52 |
CaloProcessing::CaloProcessing(){ |
CaloProcessing::CaloProcessing(){ |
|
e_clevel1 = new struct FlCaLevel1; |
|
|
e_clevel2 = new struct FlCaLevel2; |
|
|
e_clevel2->ncore = 0; |
|
|
e_clevel2->qcore = 0.; |
|
|
e_clevel2->noint = 0.; |
|
|
e_clevel2->ncyl = 0.; |
|
|
e_clevel2->qcyl = 0.; |
|
|
e_clevel2->qtrack = 0.; |
|
|
e_clevel2->qtrackx = 0.; |
|
|
e_clevel2->qtracky = 0.; |
|
|
e_clevel2->dxtrack = 0.; |
|
|
e_clevel2->dytrack = 0.; |
|
|
e_clevel2->qlast = 0.; |
|
|
e_clevel2->nlast = 0.; |
|
|
e_clevel2->qpre = 0.; |
|
|
e_clevel2->npre = 0.; |
|
|
e_clevel2->qpresh = 0.; |
|
|
e_clevel2->npresh = 0.; |
|
|
e_clevel2->qlow = 0.; |
|
|
e_clevel2->nlow = 0.; |
|
|
e_clevel2->qtr = 0.; |
|
|
e_clevel2->ntr = 0.; |
|
|
e_clevel2->elen = 0.; |
|
|
e_clevel2->selen = 0.; |
|
|
e_clevel1->good2 = 0; |
|
|
e_clevel1->trkchi2 = 0; |
|
|
for (Int_t il = 0; il<2 ; il++){ |
|
|
for ( Int_t jl = 0; jl<22; jl++){ |
|
|
if ( jl < 5 ) e_clevel1->al_p[jl][il] = 0.; |
|
|
for ( Int_t ml = 0; ml<96; ml++){ |
|
|
e_clevel1->estrip[ml][jl][il] = 0.; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
e_clevel2->trigty = 0.; |
|
|
e_clevel2->good = 0; |
|
|
e_clevel2->nstrip = 0.; |
|
|
e_clevel2->qtot = 0.; |
|
|
e_clevel2->impx = 0.; |
|
|
e_clevel2->impy = 0.; |
|
|
e_clevel2->tanx = 0.; |
|
|
e_clevel2->tany = 0.; |
|
|
e_clevel2->qmax = 0.; |
|
|
e_clevel2->nx22 = 0.; |
|
|
e_clevel2->qx22 = 0.; |
|
|
e_clevel2->planetot = 0.; |
|
|
e_clevel2->qmean = 0.; |
|
|
e_clevel2->dX0l = 0.; |
|
|
for (Int_t il = 0; il<4 ; il++){ |
|
|
e_clevel2->perr[il] = 0; |
|
|
e_clevel2->swerr[il] = 0; |
|
|
e_clevel2->crc[il] = 0; |
|
|
e_clevel2->qq[il] = 0.; |
|
|
if ( il < 2 ){ |
|
|
e_clevel2->varcfit[il] = 0.; |
|
|
e_clevel2->planemax[il] = 0; |
|
|
e_clevel2->npcfit[il] = 0; |
|
|
for ( Int_t jl = 0; jl<22; jl++){ |
|
|
e_clevel2->cibar[jl][il] = 0; |
|
|
e_clevel2->tibar[jl][il] = 0; |
|
|
e_clevel2->cbar[jl][il] = 0.; |
|
|
e_clevel2->tbar[jl][il] = 0.; |
|
|
}; |
|
|
}; |
|
|
}; |
|
53 |
// |
// |
54 |
extern struct FlCaLevel1 clevel1_; |
extern struct FlCaLevel1 clevel1_; |
55 |
extern struct FlCaLevel2 clevel2_; |
extern struct FlCaLevel2 clevel2_; |
58 |
// |
// |
59 |
trkseqno = 0; |
trkseqno = 0; |
60 |
ClearStructs(); |
ClearStructs(); |
61 |
for ( Int_t l = 0; l < 2; l++ ){ |
// |
62 |
for ( Int_t m = 0; m < 22; m++ ){ |
memset(dexy, 0, 2*22*96*sizeof(Float_t)); |
63 |
for ( Int_t n = 0; n < 96; n++ ){ |
memset(dexyc, 0, 2*22*96*sizeof(Float_t)); |
64 |
dexy[l][m][n] = 0.; |
memset(mip, 0, 2*22*96*sizeof(Float_t)); |
65 |
dexyc[l][m][n] = 0.; |
memset(base, 0, 2*22*6*sizeof(Float_t)); |
66 |
mip[l][m][n] = 0.; |
memset(sbase, 0, 2*22*6*sizeof(Float_t)); |
|
if ( n < 6 ){ |
|
|
base[l][m][n] = 0.; |
|
|
sbase[l][m][n] = 0.; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
67 |
calopar1 = true; |
calopar1 = true; |
68 |
calopar2 = true; |
calopar2 = true; |
69 |
ftcalopar1 = 0ULL; |
calopar3 = true; |
70 |
ttcalopar1 = 0ULL; |
crosst = true; |
71 |
ftcalopar2 = 0ULL; |
ftcalopar1 = 0; |
72 |
ttcalopar2 = 0ULL; |
ttcalopar1 = 0; |
73 |
|
ftcalopar2 = 0; |
74 |
|
ttcalopar2 = 0; |
75 |
|
ftcalopar3 = 0; |
76 |
|
ttcalopar3 = 0; |
77 |
} |
} |
78 |
|
|
79 |
|
void CaloProcessing::SetCrossTalk(Bool_t ct){ |
80 |
|
crosst = ct; |
81 |
|
}; |
82 |
|
|
83 |
/** |
/** |
84 |
* Initialize CaloProcessing object |
* Initialize CaloProcessing object |
85 |
**/ |
**/ |
86 |
void CaloProcessing::ProcessingInit(TSQLServer *dbc, ULong64_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
void CaloProcessing::ProcessingInit(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){ |
87 |
// |
// |
88 |
debug = isdeb; |
debug = isdeb; |
89 |
verbose = isverb; |
verbose = isverb; |
99 |
GL_CALO_CALIB *glcalo = new GL_CALO_CALIB(); |
GL_CALO_CALIB *glcalo = new GL_CALO_CALIB(); |
100 |
// |
// |
101 |
sgnl = 0; |
sgnl = 0; |
102 |
|
UInt_t uptime = 0; |
103 |
// |
// |
104 |
for (Int_t s = 0; s < 4; s++){ |
for (Int_t s = 0; s < 4; s++){ |
105 |
idcalib[s] = 0ULL; |
idcalib[s] = 0; |
106 |
fromtime[s] = 0ULL; |
fromtime[s] = 0; |
107 |
totime[s] = 0ULL; |
totime[s] = 0; |
108 |
calibno[s] = 0; |
calibno[s] = 0; |
109 |
ClearCalibVals(s); |
ClearCalibVals(s); |
110 |
// |
// |
111 |
sgnl = glcalo->Query_GL_CALO_CALIB(hs,s,dbc); |
sgnl = glcalo->Query_GL_CALO_CALIB(hs,uptime,s,dbc); |
112 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
113 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
114 |
return; |
return; |
115 |
}; |
}; |
116 |
// |
// |
117 |
idcalib[s] = glcalo->ID_REG_CALIBCALPED; |
idcalib[s] = glcalo->ID_ROOT_L0; |
118 |
fromtime[s] = glcalo->FROM_TIME; |
fromtime[s] = glcalo->FROM_TIME; |
119 |
totime[s] = glcalo->TO_TIME; |
if ( glcalo->TO_TIME < hs ){ // calibration is corrupted and we are using the one that preceed the good one |
120 |
calibno[s] = glcalo->EV_REG_CALIBCALPED; |
totime[s] = uptime; |
121 |
// |
} else { |
122 |
if ( totime[s] == 0ULL){ |
totime[s] = glcalo->TO_TIME; |
123 |
|
}; |
124 |
|
calibno[s] = glcalo->EV_ROOT; |
125 |
|
// |
126 |
|
if ( totime[s] == 0 ){ |
127 |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
128 |
ClearCalibVals(s); |
ClearCalibVals(s); |
129 |
sgnl = 100; |
sgnl = 100; |
136 |
if ( verbose ) printf("\n"); |
if ( verbose ) printf("\n"); |
137 |
for (Int_t s = 0; s < 4; s++){ |
for (Int_t s = 0; s < 4; s++){ |
138 |
if ( verbose ) printf(" ** SECTION %i **\n",s); |
if ( verbose ) printf(" ** SECTION %i **\n",s); |
139 |
if ( totime[s] > 0ULL ){ |
if ( totime[s] > 0 ){ |
140 |
// |
// |
141 |
sgnl = glroot->Query_GL_ROOT(idcalib[s],dbc); |
sgnl = glroot->Query_GL_ROOT(idcalib[s],dbc); |
142 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
143 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
144 |
return; |
return; |
145 |
}; |
}; |
146 |
// |
// |
147 |
stringstream name; |
stringstream name; |
148 |
name.str(""); |
name.str(""); |
149 |
name << glroot->PATH.Data() << "/"; |
name << glroot->PATH.Data() << "/"; |
150 |
name << glroot->NAME.Data(); |
name << glroot->NAME.Data(); |
151 |
// |
// |
152 |
fcalname[s] = (TString)name.str().c_str(); |
fcalname[s] = (TString)name.str().c_str(); |
153 |
if ( verbose ) printf(" - runheader at time %llu. From time %llu to time %llu \n use file %s \n calibration at entry %i \n\n",hs,fromtime[s],totime[s],fcalname[s].Data(),calibno[s]); |
if ( verbose ) printf(" - runheader at time %u. From time %u to time %u \n use file %s \n calibration at entry %i \n\n",hs,fromtime[s],totime[s],fcalname[s].Data(),calibno[s]); |
154 |
} else { |
} else { |
155 |
if ( verbose ) printf(" - runheader at time %llu. NO CALIBRATION INCLUDE THE RUNHEADER! ",hs); |
if ( verbose ) printf(" - runheader at time %u. NO CALIBRATION INCLUDE THE RUNHEADER! ",hs); |
156 |
}; |
}; |
157 |
sgnl = LoadCalib(s); |
sgnl = LoadCalib(s); |
158 |
if ( sgnl ) break; |
if ( sgnl ) break; |
165 |
// |
// |
166 |
} |
} |
167 |
|
|
168 |
Int_t CaloProcessing::ChkCalib(TSQLServer *dbc, ULong64_t atime){ |
Int_t CaloProcessing::ChkCalib(TSQLServer *dbc, UInt_t atime){ |
169 |
Int_t sgnl = 0; |
Int_t sgnl = 0; |
170 |
for ( Int_t s = 0; s < 4; s++){ |
for ( Int_t s = 0; s < 4; s++){ |
171 |
if ( atime > totime[s] ){ |
if ( atime > totime[s] ){ |
172 |
|
if ( !dbc->IsConnected() ) throw -116; |
173 |
sgnl = Update(dbc,atime,s); |
sgnl = Update(dbc,atime,s); |
174 |
if ( sgnl < 0 ) return(sgnl); |
if ( sgnl < 0 ) return(sgnl); |
175 |
}; |
}; |
177 |
return(sgnl); |
return(sgnl); |
178 |
} |
} |
179 |
|
|
180 |
Int_t CaloProcessing::ChkParam(TSQLServer *dbc, ULong64_t runheader){ |
Int_t CaloProcessing::ChkParam(TSQLServer *dbc, UInt_t runheader){ |
181 |
stringstream calfile; |
stringstream calfile; |
182 |
|
stringstream bmfile; |
183 |
stringstream aligfile; |
stringstream aligfile; |
184 |
Int_t error = 0; |
Int_t error = 0; |
185 |
FILE *f = 0; |
FILE *f = 0; |
186 |
|
ifstream badfile; |
187 |
GL_PARAM *glparam = new GL_PARAM(); |
GL_PARAM *glparam = new GL_PARAM(); |
188 |
// |
// |
189 |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
194 |
if ( verbose ) printf(" Querying DB for calorimeter parameters files...\n"); |
if ( verbose ) printf(" Querying DB for calorimeter parameters files...\n"); |
195 |
// |
// |
196 |
error = 0; |
error = 0; |
197 |
error = glparam->Query_GL_PARAM(runheader,"Calorimeter ADC to MIP",dbc); |
error = glparam->Query_GL_PARAM(runheader,101,dbc); |
198 |
if ( error < 0 ) return(error); |
if ( error < 0 ) return(error); |
199 |
// |
// |
200 |
calfile.str(""); |
calfile.str(""); |
227 |
// |
// |
228 |
// |
// |
229 |
error = 0; |
error = 0; |
230 |
error = glparam->Query_GL_PARAM(runheader,"Calorimeter alignement",dbc); |
error = glparam->Query_GL_PARAM(runheader,102,dbc); |
231 |
if ( error < 0 ) return(error); |
if ( error < 0 ) return(error); |
232 |
// |
// |
233 |
aligfile.str(""); |
aligfile.str(""); |
236 |
ftcalopar2 = glparam->FROM_TIME; |
ftcalopar2 = glparam->FROM_TIME; |
237 |
ttcalopar2 = glparam->TO_TIME; |
ttcalopar2 = glparam->TO_TIME; |
238 |
// |
// |
239 |
if ( verbose ) printf("\n Using alignment file: \n %s \n\n",aligfile.str().c_str()); |
if ( verbose ) printf("\n Using alignment file: \n %s \n",aligfile.str().c_str()); |
240 |
f = fopen(aligfile.str().c_str(),"rb"); |
f = fopen(aligfile.str().c_str(),"rb"); |
241 |
if ( !f ){ |
if ( !f ){ |
242 |
if ( verbose ) printf(" CALORIMETER - ERROR: no alignement file!\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: no alignement file!\n"); |
255 |
fclose(f); |
fclose(f); |
256 |
}; |
}; |
257 |
// |
// |
258 |
|
// Load offline bad strip mask |
259 |
|
// |
260 |
|
if ( calopar3 || ( ttcalopar3 != 0 && ttcalopar3 < runheader ) ){ |
261 |
|
calopar3 = false; |
262 |
|
// |
263 |
|
// determine where I can find calorimeter alignment file |
264 |
|
// |
265 |
|
// |
266 |
|
error = 0; |
267 |
|
error = glparam->Query_GL_PARAM(runheader,103,dbc); |
268 |
|
if ( error < 0 ) return(error); |
269 |
|
// |
270 |
|
bmfile.str(""); |
271 |
|
bmfile << glparam->PATH.Data() << "/"; |
272 |
|
bmfile << glparam->NAME.Data(); |
273 |
|
ftcalopar3 = glparam->FROM_TIME; |
274 |
|
ttcalopar3 = glparam->TO_TIME; |
275 |
|
// |
276 |
|
if ( verbose ) printf("\n Using bad strip offline mask file: \n %s \n\n",bmfile.str().c_str()); |
277 |
|
badfile.open(bmfile.str().c_str()); |
278 |
|
if ( !badfile ){ |
279 |
|
if ( verbose ) printf(" CALORIMETER - ERROR: no bad strip offline mask file!\n"); |
280 |
|
return(-115); |
281 |
|
}; |
282 |
|
// |
283 |
|
Bool_t isdone = false; |
284 |
|
Int_t bad = 0; |
285 |
|
Int_t view = 1; |
286 |
|
Int_t strip = 0; |
287 |
|
Int_t plane = 21; |
288 |
|
while ( !isdone ) { |
289 |
|
badfile >> bad; |
290 |
|
obadmask[view][plane][strip] = bad; |
291 |
|
if ( debug && bad ) printf(" SETTING view %i plane %i strip %i BAD = %i \n",view,plane,strip,bad); |
292 |
|
strip++; |
293 |
|
if ( strip > 95 ){ |
294 |
|
strip = 0; |
295 |
|
plane--; |
296 |
|
if ( plane < 0 ){ |
297 |
|
plane = 21; |
298 |
|
view--; |
299 |
|
}; |
300 |
|
if ( view < 0 ) isdone = true; |
301 |
|
}; |
302 |
|
}; |
303 |
|
// |
304 |
|
badfile.close(); |
305 |
|
}; |
306 |
|
// |
307 |
delete glparam; |
delete glparam; |
|
// delete f; |
|
308 |
// |
// |
309 |
return(0); |
return(0); |
310 |
} |
} |
316 |
Float_t rms = 0.; |
Float_t rms = 0.; |
317 |
base[l][m][pre] = 0.; |
base[l][m][pre] = 0.; |
318 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
319 |
if ( calgood[l][m][e] == 0. && dexy[l][m][e]-calped[l][m][e] < minstrip && dexy[l][m][e] > 0.) { |
if ( calgood[l][m][e] == 0. && obadmask[l][m][e] == 0 && dexy[l][m][e]-calped[l][m][e] < minstrip && dexy[l][m][e] > 0.) { |
320 |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
321 |
rms = calthr[l][m][pre]; |
rms = calthr[l][m][pre]; |
322 |
}; |
}; |
368 |
Int_t val = 0; |
Int_t val = 0; |
369 |
Int_t del = 1100; |
Int_t del = 1100; |
370 |
if ( clevel2->trigty != 2. ){ |
if ( clevel2->trigty != 2. ){ |
371 |
|
Bool_t ck = false; |
372 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
373 |
val = (Int_t)de->calselftrig[sec][6]; |
val = (Int_t)de->calselftrig[sec][6]; |
374 |
del = delay(val); |
del = delay(val); |
375 |
if ( del < 1100 ){ |
if ( del < 1100 ){ |
376 |
|
clevel2->wartrig = 0.; |
377 |
clevel2->trigty = 3.; |
clevel2->trigty = 3.; |
378 |
|
ck = true; |
379 |
break; |
break; |
380 |
}; |
}; |
381 |
}; |
}; |
382 |
|
if ( !ck ) clevel2->wartrig = 100.; |
383 |
|
} else { |
384 |
|
Bool_t ck = false; |
385 |
|
for (Int_t sec = 0; sec < 4; sec++){ |
386 |
|
val = (Int_t)de->calselftrig[sec][6]; |
387 |
|
del = delay(val); |
388 |
|
if ( del < 1100 ){ |
389 |
|
clevel2->wartrig = 0.; |
390 |
|
ck = true; |
391 |
|
}; |
392 |
|
}; |
393 |
|
if ( !ck ) clevel2->wartrig = 100.; |
394 |
}; |
}; |
395 |
// |
// |
396 |
Int_t se = 5; |
Int_t se = 5; |
414 |
Int_t chdone[4] = {0,0,0,0}; |
Int_t chdone[4] = {0,0,0,0}; |
415 |
Int_t pe = 0; |
Int_t pe = 0; |
416 |
// |
// |
417 |
|
Float_t ener0 = 0.; |
418 |
|
Float_t cbase0 = 0.; |
419 |
|
Bool_t pproblem = false; |
420 |
|
// |
421 |
|
Float_t tim = 0.; |
422 |
|
Int_t plo = 0; |
423 |
|
Int_t fbi = 0; |
424 |
|
Int_t cle = 0; |
425 |
|
// |
426 |
// run over views and planes |
// run over views and planes |
427 |
// |
// |
428 |
for (Int_t l = 0; l < 2; l++){ |
for (Int_t l = 0; l < 2; l++){ |
479 |
// run over preamplifiers |
// run over preamplifiers |
480 |
// |
// |
481 |
pre = -1; |
pre = -1; |
482 |
|
cbase0 = 0.; |
483 |
for (Int_t i = 0; i < 3; i++){ |
for (Int_t i = 0; i < 3; i++){ |
484 |
for (Int_t j = 0; j < 2; j++){ |
for (Int_t j = 0; j < 2; j++){ |
485 |
pre = j + i*2; |
pre = j + i*2; |
488 |
// |
// |
489 |
if ( !isRAW ) { |
if ( !isRAW ) { |
490 |
base[l][m][pre] = de->base[l][m][pre] ; |
base[l][m][pre] = de->base[l][m][pre] ; |
491 |
|
cbase0 += base[l][m][pre]; |
492 |
} else { |
} else { |
493 |
// |
// |
494 |
// if it is a raw event and we haven't checked |
// if it is a raw event and we haven't checked |
495 |
// yet, calculate the baseline. |
// yet, calculate the baseline. |
496 |
// |
// |
497 |
FindBaseRaw(l,m,pre); |
FindBaseRaw(l,m,pre); |
498 |
|
cbase0 += base[l][m][pre]; |
499 |
}; |
}; |
500 |
}; |
}; |
501 |
}; |
}; |
503 |
// run over strips |
// run over strips |
504 |
// |
// |
505 |
pre = -1; |
pre = -1; |
506 |
|
ener0 = 0.; |
507 |
for (Int_t i = 0 ; i < 3 ; i++){ |
for (Int_t i = 0 ; i < 3 ; i++){ |
508 |
ip[i] = 0; |
ip[i] = 0; |
509 |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
513 |
doneb = 0; |
doneb = 0; |
514 |
donec = 0; |
donec = 0; |
515 |
pre++; |
pre++; |
516 |
qpre[pre] = 0; |
qpre[pre] = 0.; |
517 |
}; |
}; |
518 |
// |
// |
519 |
// baseline check and calculation |
// baseline check and calculation |
564 |
doneb = 1; |
doneb = 1; |
565 |
}; |
}; |
566 |
ener = dexyc[l][m][n]; |
ener = dexyc[l][m][n]; |
567 |
|
ener0 += ener; |
568 |
clevel1->estrip[n][m][l] = 0.; |
clevel1->estrip[n][m][l] = 0.; |
569 |
if ( base0>0 && base0 < 30000. ){ |
if ( base0>0 && base0 < 30000. ){ |
570 |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
580 |
}; |
}; |
581 |
}; |
}; |
582 |
}; |
}; |
583 |
if (ck == 1){ |
if ( crosst ){ |
584 |
if (ip[i]%2 == 0) { |
if (ck == 1){ |
585 |
ipre = ip[i] + 1; |
if (ip[i]%2 == 0) { |
586 |
} else { |
ipre = ip[i] + 1; |
587 |
ipre = ip[i] - 1; |
} else { |
588 |
}; |
ipre = ip[i] - 1; |
589 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
}; |
590 |
clevel1->estrip[j][m][l] = clevel1->estrip[j][m][l] + (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
591 |
|
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
592 |
|
}; |
593 |
}; |
}; |
594 |
}; |
if (ck == 2){ |
595 |
if (ck == 2){ |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
596 |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
ipre = j/16 + 1; |
597 |
ipre = j/16 + 1; |
clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; |
598 |
clevel1->estrip[j][m][l] = clevel1->estrip[j][m][l] + qpre[ipre] * 0.00478; |
}; |
599 |
}; |
}; |
600 |
}; |
}; |
601 |
}; |
}; |
602 |
|
// |
603 |
|
if ( ener0 == 0. && cbase0 == 0. && !pproblem && clevel2->perr[se] == 0){ |
604 |
|
if ( verbose ) printf(" L0 entry %i : calorimeter power problems! event marked as bad perr %f swerr %X view %i plane %i \n",ei,de->perror[se],de->stwerr[se],l,m); |
605 |
|
pproblem = true; |
606 |
|
pe++; |
607 |
|
}; |
608 |
// |
// |
609 |
Int_t j4 = -4; |
Int_t j4 = -4; |
610 |
Int_t jjj = -3; |
Int_t jjj = -3; |
614 |
jjj++; |
jjj++; |
615 |
j4++; |
j4++; |
616 |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
617 |
if ( jj >= 0 && jj < 96 ){ |
if ( crosst ){ |
618 |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] = ene[jj-1] - clevel1->estrip[jj][m][l] * 0.01581; |
if ( jj >= 0 && jj < 96 ){ |
619 |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] = ene[jj+1] - clevel1->estrip[jj][m][l] * 0.01581; |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] += -clevel1->estrip[jj][m][l] * 0.01581; |
620 |
}; |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; |
621 |
if ( jjj >= 0 && jjj < 96 ){ |
}; |
622 |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] = clevel1->estrip[jjj-1][m][l] - ene[jjj] * 0.01581; |
if ( jjj >= 0 && jjj < 96 ){ |
623 |
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] = clevel1->estrip[jjj+1][m][l] - ene[jjj] * 0.01581; |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; |
624 |
|
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; |
625 |
|
}; |
626 |
}; |
}; |
627 |
if ( j4 >= 0 && j4 < 96 ){ |
if ( j4 >= 0 && j4 < 96 ){ |
628 |
// |
// |
629 |
// NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <===V============ IMPORTANT! =================> |
// NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <=============== IMPORTANT! =================> |
630 |
// |
// |
631 |
if ( clevel1->estrip[j4][m][l]!=0. && ( clevel1->estrip[j4][m][l] < clevel1->emin || calrms[l][m][j4] > 26 )){ |
if ( obadmask[l][m][j4] == 1 || clevel1->estrip[j4][m][l] <= clevel1->emin || calrms[l][m][j4] > 26 ){ |
632 |
clevel1->estrip[j4][m][l] = 0.; |
clevel1->estrip[j4][m][l] = 0.; |
633 |
}; |
}; |
634 |
|
// |
635 |
|
// code and save the energy for each strip in svstrip |
636 |
|
// |
637 |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
638 |
|
// |
639 |
|
tim = 100000.; |
640 |
|
plo = m; |
641 |
|
fbi = 0; |
642 |
|
if ( clevel1->estrip[j4][m][l] > 0.99995 ){ |
643 |
|
tim = 10000.; |
644 |
|
plo = m; |
645 |
|
fbi = 1; |
646 |
|
}; |
647 |
|
if ( clevel1->estrip[j4][m][l] > 9.9995 ){ |
648 |
|
tim = 1000.; |
649 |
|
plo = 22 + m; |
650 |
|
fbi = 1; |
651 |
|
}; |
652 |
|
if ( clevel1->estrip[j4][m][l] > 99.995 ){ |
653 |
|
tim = 100.; |
654 |
|
plo = 22 + m; |
655 |
|
fbi = 0; |
656 |
|
}; |
657 |
|
if ( clevel1->estrip[j4][m][l] > 999.95 ){ |
658 |
|
tim = 10.; |
659 |
|
plo = 44 + m; |
660 |
|
fbi = 0; |
661 |
|
}; |
662 |
|
if ( clevel1->estrip[j4][m][l] > 9999.5 ){ |
663 |
|
tim = 1.; |
664 |
|
plo = 66 + m; |
665 |
|
fbi = 0; |
666 |
|
}; |
667 |
|
// |
668 |
|
cle = (Int_t)lroundf(tim*clevel1->estrip[j4][m][l]); |
669 |
|
// |
670 |
if ( l == 0 ){ |
if ( l == 0 ){ |
671 |
// |
// |
672 |
// +-PPSSmmmm.mmmm |
// +-PPSSmmmm.mmmm |
673 |
// |
// |
674 |
svstrip[istrip] = ((Float_t)m)*1000000. + ((Float_t)j4)*10000. + clevel1->estrip[j4][m][l]; |
svstrip[istrip] = fbi*1000000000 + plo*10000000 + j4*100000 + cle; |
675 |
} else { |
} else { |
676 |
svstrip[istrip] = -(((Float_t)m)*1000000. + ((Float_t)j4)*10000. + clevel1->estrip[j4][m][l]); |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
677 |
}; |
}; |
678 |
|
// |
679 |
|
// if ( ei >= -770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); |
680 |
|
// if ( ei >= -770 ) printf(" num lim %i fbi %i tim %f plo %i cle %i \n",numeric_limits<Int_t>::max(),fbi,tim,plo,cle); |
681 |
|
// if ( ei >= -770 ) printf(" svstrip %i \n",svstrip[istrip]); |
682 |
|
// |
683 |
istrip++; |
istrip++; |
684 |
}; |
}; |
685 |
}; |
}; |
733 |
t_ca->qlow = clevel2->qlow; |
t_ca->qlow = clevel2->qlow; |
734 |
t_ca->nlow = (Int_t)clevel2->nlow; |
t_ca->nlow = (Int_t)clevel2->nlow; |
735 |
// |
// |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
|
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
|
|
// |
|
736 |
if ( trkseqno == -1 ){ |
if ( trkseqno == -1 ){ |
737 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
738 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
739 |
ca->tanx = clevel2->tanx; |
ca->tanx[1] = clevel2->tanx; |
740 |
ca->tany = clevel2->tany; |
ca->tany[1] = clevel2->tany; |
741 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
742 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
743 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
// memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
744 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
// memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
745 |
|
memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); |
746 |
|
memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); |
747 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
748 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[2] = clevel2->varcfit[0]; |
749 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[3] = clevel2->varcfit[1]; |
750 |
|
ca->npcfit[2] = clevel2->npcfit[0]; |
751 |
|
ca->npcfit[3] = clevel2->npcfit[1]; |
752 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
753 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
754 |
|
} else { |
755 |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
756 |
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
757 |
}; |
}; |
758 |
|
// |
759 |
// |
// |
760 |
|
if ( !(ca->CaloTrk) ) ca->CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA |
761 |
TClonesArray &t = *ca->CaloTrk; |
TClonesArray &t = *ca->CaloTrk; |
762 |
new(t[nutrk]) CaloTrkVar(*t_ca); |
new(t[nutrk]) CaloTrkVar(*t_ca); |
763 |
// |
// |
770 |
calol2cm(); |
calol2cm(); |
771 |
} |
} |
772 |
|
|
773 |
void CaloProcessing::FillCommonVar(CaloLevel2 *ca){ |
void CaloProcessing::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ |
774 |
// |
// |
775 |
ca->good = clevel2->good; |
ca->good = clevel2->good; |
776 |
if ( clevel2->trigty == 2. ){ |
if ( clevel2->trigty == 2. ){ |
778 |
} else { |
} else { |
779 |
ca->selftrigger = 0; |
ca->selftrigger = 0; |
780 |
}; |
}; |
781 |
|
// |
782 |
|
ca->selftrigger += (Int_t)clevel2->wartrig; |
783 |
|
// |
784 |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
785 |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
786 |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
|
ca->estrip = TArrayF(0,svstrip); |
|
787 |
ca->nstrip = (Int_t)clevel2->nstrip; |
ca->nstrip = (Int_t)clevel2->nstrip; |
788 |
ca->qtot = clevel2->qtot; |
ca->qtot = clevel2->qtot; |
789 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
790 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
791 |
ca->tanx = clevel2->tanx; |
ca->tanx[0] = clevel2->tanx; |
792 |
ca->tany = clevel2->tany; |
ca->tany[0] = clevel2->tany; |
793 |
ca->nx22 = (Int_t)clevel2->nx22; |
ca->nx22 = (Int_t)clevel2->nx22; |
794 |
ca->qx22 = clevel2->qx22; |
ca->qx22 = clevel2->qx22; |
795 |
ca->qmax = clevel2->qmax; |
ca->qmax = clevel2->qmax; |
796 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
797 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
|
ca->estrip = TArrayF(ca->nstrip,svstrip); |
|
798 |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
799 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
800 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[0] = clevel2->varcfit[0]; |
801 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[1] = clevel2->varcfit[1]; |
802 |
|
ca->npcfit[0] = clevel2->npcfit[0]; |
803 |
|
ca->npcfit[1] = clevel2->npcfit[1]; |
804 |
|
ca->fitmode[0] = clevel2->fmode[0]; |
805 |
|
ca->fitmode[1] = clevel2->fmode[1]; |
806 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
807 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
808 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
809 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
810 |
// |
// |
811 |
|
if ( c1 ){ |
812 |
|
c1->istrip = istrip; |
813 |
|
c1->estrip = TArrayI(istrip,svstrip); |
814 |
|
}; |
815 |
|
// |
816 |
} |
} |
817 |
|
|
818 |
void CaloProcessing::ClearStructs(){ |
void CaloProcessing::ClearStructs(){ |
823 |
void CaloProcessing::RunClose(){ |
void CaloProcessing::RunClose(){ |
824 |
l0tr->Delete(); |
l0tr->Delete(); |
825 |
ClearStructs(); |
ClearStructs(); |
826 |
for ( Int_t l = 0; l < 2; l++ ){ |
// |
827 |
for ( Int_t m = 0; m < 22; m++ ){ |
memset(dexy, 0, 2*22*96*sizeof(Float_t)); |
828 |
for ( Int_t n = 0; n < 96; n++ ){ |
memset(dexyc, 0, 2*22*96*sizeof(Float_t)); |
829 |
dexy[l][m][n] = 0.; |
memset(base, 0, 2*22*6*sizeof(Float_t)); |
830 |
dexyc[l][m][n] = 0.; |
memset(sbase, 0, 2*22*6*sizeof(Float_t)); |
831 |
if ( n < 6 ){ |
// |
|
base[l][m][n] = 0.; |
|
|
sbase[l][m][n] = 0.; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
832 |
} |
} |
833 |
|
|
834 |
// |
// |
861 |
clevel2->dX0l = 0.; |
clevel2->dX0l = 0.; |
862 |
clevel2->elen = 0.; |
clevel2->elen = 0.; |
863 |
clevel2->selen = 0.; |
clevel2->selen = 0.; |
864 |
memcpy(clevel1->al_p,e_clevel1->al_p,sizeof(clevel1->al_p)); |
memset(clevel1->al_p, 0, 5*2*sizeof(Double_t)); |
865 |
memcpy(clevel2->tibar,e_clevel2->tibar,sizeof(clevel2->tibar)); |
memset(clevel2->tibar, 0, 2*22*sizeof(Int_t)); |
866 |
memcpy(clevel2->tbar,e_clevel2->tbar,sizeof(clevel2->tbar)); |
memset(clevel2->tbar, 0, 2*22*sizeof(Float_t)); |
867 |
} |
} |
868 |
|
|
869 |
void CaloProcessing::ClearCommonVar(){ |
void CaloProcessing::ClearCommonVar(){ |
870 |
istrip = 0; |
istrip = 0; |
871 |
clevel2->trigty = -1.; |
clevel2->trigty = -1.; |
872 |
|
clevel2->wartrig = 0.; |
873 |
clevel2->good = 0; |
clevel2->good = 0; |
874 |
clevel2->nstrip = 0.; |
clevel2->nstrip = 0.; |
875 |
clevel2->qtot = 0.; |
clevel2->qtot = 0.; |
876 |
clevel2->impx = 0.; |
// clevel2->impx = 0.; |
877 |
clevel2->impy = 0.; |
// clevel2->impy = 0.; |
878 |
clevel2->tanx = 0.; |
clevel2->tanx = 0.; // this is correct since it refers to the fortran structure |
879 |
clevel2->tany = 0.; |
clevel2->tany = 0.; // this is correct since it refers to the fortran structure |
880 |
clevel2->qmax = 0.; |
clevel2->qmax = 0.; |
881 |
clevel2->nx22 = 0.; |
clevel2->nx22 = 0.; |
882 |
clevel2->qx22 = 0.; |
clevel2->qx22 = 0.; |
883 |
memcpy(clevel2->perr,e_clevel2->perr,sizeof(clevel2->perr)); |
memset(clevel2->perr, 0, 4*sizeof(Int_t)); |
884 |
memcpy(clevel2->swerr,e_clevel2->swerr,sizeof(clevel2->swerr)); |
memset(clevel2->swerr, 0, 4*sizeof(Int_t)); |
885 |
memcpy(clevel2->crc,e_clevel2->crc,sizeof(clevel2->crc)); |
memset(clevel2->crc, 0, 4*sizeof(Int_t)); |
886 |
memcpy(clevel2->qq,e_clevel2->qq,sizeof(clevel2->qq)); |
memset(clevel2->qq, 0, 4*sizeof(Int_t)); |
887 |
memcpy(clevel2->planemax,e_clevel2->planemax,sizeof(clevel2->planemax)); |
memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); |
888 |
memcpy(clevel2->varcfit,e_clevel2->varcfit,sizeof(clevel2->varcfit)); |
memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); |
889 |
memcpy(clevel2->npcfit,e_clevel2->npcfit,sizeof(clevel2->npcfit)); |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
890 |
memcpy(clevel2->cibar,e_clevel2->cibar,sizeof(clevel2->cibar)); |
memset(clevel2->fmode, 0, 2*sizeof(Int_t)); |
891 |
memcpy(clevel2->cbar,e_clevel2->cbar,sizeof(clevel2->cbar)); |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
892 |
|
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |
893 |
} |
} |
894 |
|
|
895 |
void CaloProcessing::ClearCalibVals(Int_t s){ |
void CaloProcessing::ClearCalibVals(Int_t s){ |
943 |
return; |
return; |
944 |
} |
} |
945 |
|
|
946 |
Int_t CaloProcessing::Update(TSQLServer *dbc, ULong64_t atime, Int_t s){ |
Int_t CaloProcessing::Update(TSQLServer *dbc, UInt_t atime, Int_t s){ |
947 |
// |
// |
948 |
Int_t sgnl = 0; |
Int_t sgnl = 0; |
949 |
// |
// |
951 |
// |
// |
952 |
sgnl = 0; |
sgnl = 0; |
953 |
// |
// |
954 |
idcalib[s] = 0ULL; |
idcalib[s] = 0; |
955 |
fromtime[s] = 0ULL; |
fromtime[s] = 0; |
956 |
totime[s] = 0ULL; |
totime[s] = 0; |
957 |
calibno[s] = 0; |
calibno[s] = 0; |
958 |
ClearCalibVals(s); |
ClearCalibVals(s); |
959 |
// |
// |
960 |
sgnl = glcalo->Query_GL_CALO_CALIB(atime,s,dbc); |
UInt_t uptime = 0; |
961 |
|
// |
962 |
|
sgnl = glcalo->Query_GL_CALO_CALIB(atime,uptime,s,dbc); |
963 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
964 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
965 |
return(sgnl); |
return(sgnl); |
966 |
}; |
}; |
967 |
// |
// |
968 |
idcalib[s] = glcalo->ID_REG_CALIBCALPED; |
idcalib[s] = glcalo->ID_ROOT_L0; |
969 |
fromtime[s] = glcalo->FROM_TIME; |
fromtime[s] = glcalo->FROM_TIME; |
970 |
totime[s] = glcalo->TO_TIME; |
if ( glcalo->TO_TIME < atime ){ // calibration is corrupted and we are using the one that preceed the good one |
971 |
calibno[s] = glcalo->EV_REG_CALIBCALPED; |
totime[s] = uptime; |
972 |
|
} else { |
973 |
|
totime[s] = glcalo->TO_TIME; |
974 |
|
}; |
975 |
|
// totime[s] = glcalo->TO_TIME; |
976 |
|
calibno[s] = glcalo->EV_ROOT; |
977 |
// |
// |
978 |
if ( totime[s] == 0ULL){ |
if ( totime[s] == 0 ){ |
979 |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
980 |
ClearCalibVals(s); |
ClearCalibVals(s); |
981 |
sgnl = 100; |
sgnl = 100; |
999 |
name << glroot->NAME.Data(); |
name << glroot->NAME.Data(); |
1000 |
// |
// |
1001 |
fcalname[s] = (TString)name.str().c_str(); |
fcalname[s] = (TString)name.str().c_str(); |
1002 |
if ( verbose ) printf(" - event at time %llu. From time %llu to time %llu \n use file %s \n calibration at entry %i \n\n",atime,fromtime[s],totime[s],fcalname[s].Data(),calibno[s]); |
if ( verbose ) printf(" - event at time %u. From time %u to time %u \n use file %s \n calibration at entry %i \n\n",atime,fromtime[s],totime[s],fcalname[s].Data(),calibno[s]); |
1003 |
// |
// |
1004 |
sgnl = LoadCalib(s); |
sgnl = LoadCalib(s); |
1005 |
// |
// |
1025 |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
1026 |
if ( !tr ) return(-109); |
if ( !tr ) return(-109); |
1027 |
// |
// |
|
TBranch *registry = tr->GetBranch("Registry"); |
|
1028 |
TBranch *calo = tr->GetBranch("CalibCalPed"); |
TBranch *calo = tr->GetBranch("CalibCalPed"); |
1029 |
// |
// |
|
pamela::RegistryEvent *reg = 0; |
|
1030 |
pamela::CalibCalPedEvent *ce = 0; |
pamela::CalibCalPedEvent *ce = 0; |
1031 |
tr->SetBranchAddress("CalibCalPed", &ce); |
tr->SetBranchAddress("CalibCalPed", &ce); |
|
tr->SetBranchAddress("Registry", ®); |
|
1032 |
// |
// |
1033 |
Long64_t ncalibs = registry->GetEntries(); |
Long64_t ncalibs = calo->GetEntries(); |
1034 |
// |
// |
1035 |
if ( !ncalibs ) return(-110); |
if ( !ncalibs ) return(-110); |
1036 |
// |
// |
1037 |
registry->GetEntry(calibno[s]); |
calo->GetEntry(calibno[s]); |
|
// |
|
|
calo->GetEntry(reg->event); |
|
1038 |
// |
// |
1039 |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
1040 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
for ( Int_t d=0 ; d<11 ;d++ ){ |