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; |
ftcalopar1 = 0; |
71 |
ftcalopar2 = 0ULL; |
ttcalopar1 = 0; |
72 |
ttcalopar2 = 0ULL; |
ftcalopar2 = 0; |
73 |
|
ttcalopar2 = 0; |
74 |
|
ftcalopar3 = 0; |
75 |
|
ttcalopar3 = 0; |
76 |
} |
} |
77 |
|
|
78 |
/** |
/** |
79 |
* Initialize CaloProcessing object |
* Initialize CaloProcessing object |
80 |
**/ |
**/ |
81 |
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){ |
82 |
// |
// |
83 |
debug = isdeb; |
debug = isdeb; |
84 |
verbose = isverb; |
verbose = isverb; |
94 |
GL_CALO_CALIB *glcalo = new GL_CALO_CALIB(); |
GL_CALO_CALIB *glcalo = new GL_CALO_CALIB(); |
95 |
// |
// |
96 |
sgnl = 0; |
sgnl = 0; |
97 |
|
UInt_t uptime = 0; |
98 |
// |
// |
99 |
for (Int_t s = 0; s < 4; s++){ |
for (Int_t s = 0; s < 4; s++){ |
100 |
idcalib[s] = 0ULL; |
idcalib[s] = 0; |
101 |
fromtime[s] = 0ULL; |
fromtime[s] = 0; |
102 |
totime[s] = 0ULL; |
totime[s] = 0; |
103 |
calibno[s] = 0; |
calibno[s] = 0; |
104 |
ClearCalibVals(s); |
ClearCalibVals(s); |
105 |
// |
// |
106 |
sgnl = glcalo->Query_GL_CALO_CALIB(hs,s,dbc); |
sgnl = glcalo->Query_GL_CALO_CALIB(hs,uptime,s,dbc); |
107 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
108 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
109 |
return; |
return; |
110 |
}; |
}; |
111 |
// |
// |
112 |
idcalib[s] = glcalo->ID_REG_CALIBCALPED; |
idcalib[s] = glcalo->ID_ROOT_L0; |
113 |
fromtime[s] = glcalo->FROM_TIME; |
fromtime[s] = glcalo->FROM_TIME; |
114 |
totime[s] = glcalo->TO_TIME; |
if ( glcalo->TO_TIME < hs ){ // calibration is corrupted and we are using the one that preceed the good one |
115 |
calibno[s] = glcalo->EV_REG_CALIBCALPED; |
totime[s] = uptime; |
116 |
// |
} else { |
117 |
if ( totime[s] == 0ULL){ |
totime[s] = glcalo->TO_TIME; |
118 |
|
}; |
119 |
|
calibno[s] = glcalo->EV_ROOT; |
120 |
|
// |
121 |
|
if ( totime[s] == 0 ){ |
122 |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
123 |
ClearCalibVals(s); |
ClearCalibVals(s); |
124 |
sgnl = 100; |
sgnl = 100; |
131 |
if ( verbose ) printf("\n"); |
if ( verbose ) printf("\n"); |
132 |
for (Int_t s = 0; s < 4; s++){ |
for (Int_t s = 0; s < 4; s++){ |
133 |
if ( verbose ) printf(" ** SECTION %i **\n",s); |
if ( verbose ) printf(" ** SECTION %i **\n",s); |
134 |
if ( totime[s] > 0ULL ){ |
if ( totime[s] > 0 ){ |
135 |
// |
// |
136 |
sgnl = glroot->Query_GL_ROOT(idcalib[s],dbc); |
sgnl = glroot->Query_GL_ROOT(idcalib[s],dbc); |
137 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
138 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
139 |
return; |
return; |
140 |
}; |
}; |
141 |
// |
// |
142 |
stringstream name; |
stringstream name; |
143 |
name.str(""); |
name.str(""); |
144 |
name << glroot->PATH.Data() << "/"; |
name << glroot->PATH.Data() << "/"; |
145 |
name << glroot->NAME.Data(); |
name << glroot->NAME.Data(); |
146 |
// |
// |
147 |
fcalname[s] = (TString)name.str().c_str(); |
fcalname[s] = (TString)name.str().c_str(); |
148 |
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]); |
149 |
} else { |
} else { |
150 |
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); |
151 |
}; |
}; |
152 |
sgnl = LoadCalib(s); |
sgnl = LoadCalib(s); |
153 |
if ( sgnl ) break; |
if ( sgnl ) break; |
154 |
}; |
}; |
155 |
// |
// |
156 |
|
delete glcalo; |
157 |
|
delete glroot; |
158 |
|
// |
159 |
return; |
return; |
160 |
// |
// |
161 |
} |
} |
162 |
|
|
163 |
Int_t CaloProcessing::ChkCalib(TSQLServer *dbc, ULong64_t atime){ |
Int_t CaloProcessing::ChkCalib(TSQLServer *dbc, UInt_t atime){ |
164 |
Int_t sgnl = 0; |
Int_t sgnl = 0; |
165 |
for ( Int_t s = 0; s < 4; s++){ |
for ( Int_t s = 0; s < 4; s++){ |
166 |
if ( atime > totime[s] ){ |
if ( atime > totime[s] ){ |
167 |
|
if ( !dbc->IsConnected() ) throw -116; |
168 |
sgnl = Update(dbc,atime,s); |
sgnl = Update(dbc,atime,s); |
169 |
if ( sgnl < 0 ) return(sgnl); |
if ( sgnl < 0 ) return(sgnl); |
170 |
}; |
}; |
172 |
return(sgnl); |
return(sgnl); |
173 |
} |
} |
174 |
|
|
175 |
Int_t CaloProcessing::ChkParam(TSQLServer *dbc, ULong64_t runheader){ |
Int_t CaloProcessing::ChkParam(TSQLServer *dbc, UInt_t runheader){ |
176 |
stringstream calfile; |
stringstream calfile; |
177 |
|
stringstream bmfile; |
178 |
stringstream aligfile; |
stringstream aligfile; |
179 |
Int_t error = 0; |
Int_t error = 0; |
180 |
FILE *f = 0; |
FILE *f = 0; |
181 |
|
ifstream badfile; |
182 |
GL_PARAM *glparam = new GL_PARAM(); |
GL_PARAM *glparam = new GL_PARAM(); |
183 |
// |
// |
184 |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
if ( calopar1 || ( ttcalopar1 != 0 && ttcalopar1 < runheader ) ){ |
189 |
if ( verbose ) printf(" Querying DB for calorimeter parameters files...\n"); |
if ( verbose ) printf(" Querying DB for calorimeter parameters files...\n"); |
190 |
// |
// |
191 |
error = 0; |
error = 0; |
192 |
error = glparam->Query_GL_PARAM(runheader,"Calorimeter ADC to MIP",dbc); |
error = glparam->Query_GL_PARAM(runheader,101,dbc); |
193 |
if ( error < 0 ) return(error); |
if ( error < 0 ) return(error); |
194 |
// |
// |
195 |
calfile.str(""); |
calfile.str(""); |
222 |
// |
// |
223 |
// |
// |
224 |
error = 0; |
error = 0; |
225 |
error = glparam->Query_GL_PARAM(runheader,"Calorimeter alignement",dbc); |
error = glparam->Query_GL_PARAM(runheader,102,dbc); |
226 |
if ( error < 0 ) return(error); |
if ( error < 0 ) return(error); |
227 |
// |
// |
228 |
aligfile.str(""); |
aligfile.str(""); |
231 |
ftcalopar2 = glparam->FROM_TIME; |
ftcalopar2 = glparam->FROM_TIME; |
232 |
ttcalopar2 = glparam->TO_TIME; |
ttcalopar2 = glparam->TO_TIME; |
233 |
// |
// |
234 |
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()); |
235 |
f = fopen(aligfile.str().c_str(),"rb"); |
f = fopen(aligfile.str().c_str(),"rb"); |
236 |
if ( !f ){ |
if ( !f ){ |
237 |
if ( verbose ) printf(" CALORIMETER - ERROR: no alignement file!\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: no alignement file!\n"); |
250 |
fclose(f); |
fclose(f); |
251 |
}; |
}; |
252 |
// |
// |
253 |
|
// Load offline bad strip mask |
254 |
|
// |
255 |
|
if ( calopar3 || ( ttcalopar3 != 0 && ttcalopar3 < runheader ) ){ |
256 |
|
calopar3 = false; |
257 |
|
// |
258 |
|
// determine where I can find calorimeter alignment file |
259 |
|
// |
260 |
|
// |
261 |
|
error = 0; |
262 |
|
error = glparam->Query_GL_PARAM(runheader,103,dbc); |
263 |
|
if ( error < 0 ) return(error); |
264 |
|
// |
265 |
|
bmfile.str(""); |
266 |
|
bmfile << glparam->PATH.Data() << "/"; |
267 |
|
bmfile << glparam->NAME.Data(); |
268 |
|
ftcalopar3 = glparam->FROM_TIME; |
269 |
|
ttcalopar3 = glparam->TO_TIME; |
270 |
|
// |
271 |
|
if ( verbose ) printf("\n Using bad strip offline mask file: \n %s \n\n",bmfile.str().c_str()); |
272 |
|
badfile.open(bmfile.str().c_str()); |
273 |
|
if ( !badfile ){ |
274 |
|
if ( verbose ) printf(" CALORIMETER - ERROR: no bad strip offline mask file!\n"); |
275 |
|
return(-115); |
276 |
|
}; |
277 |
|
// |
278 |
|
Bool_t isdone = false; |
279 |
|
Int_t bad = 0; |
280 |
|
Int_t view = 1; |
281 |
|
Int_t strip = 0; |
282 |
|
Int_t plane = 21; |
283 |
|
while ( !isdone ) { |
284 |
|
badfile >> bad; |
285 |
|
obadmask[view][plane][strip] = bad; |
286 |
|
if ( debug && bad ) printf(" SETTING view %i plane %i strip %i BAD = %i \n",view,plane,strip,bad); |
287 |
|
strip++; |
288 |
|
if ( strip > 95 ){ |
289 |
|
strip = 0; |
290 |
|
plane--; |
291 |
|
if ( plane < 0 ){ |
292 |
|
plane = 21; |
293 |
|
view--; |
294 |
|
}; |
295 |
|
if ( view < 0 ) isdone = true; |
296 |
|
}; |
297 |
|
}; |
298 |
|
// |
299 |
|
badfile.close(); |
300 |
|
}; |
301 |
|
// |
302 |
|
delete glparam; |
303 |
|
// |
304 |
return(0); |
return(0); |
305 |
} |
} |
306 |
|
|
311 |
Float_t rms = 0.; |
Float_t rms = 0.; |
312 |
base[l][m][pre] = 0.; |
base[l][m][pre] = 0.; |
313 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
314 |
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.) { |
315 |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
minstrip = dexy[l][m][e]-calped[l][m][e]; |
316 |
rms = calthr[l][m][pre]; |
rms = calthr[l][m][pre]; |
317 |
}; |
}; |
363 |
Int_t val = 0; |
Int_t val = 0; |
364 |
Int_t del = 1100; |
Int_t del = 1100; |
365 |
if ( clevel2->trigty != 2. ){ |
if ( clevel2->trigty != 2. ){ |
366 |
|
Bool_t ck = false; |
367 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
368 |
val = (Int_t)de->calselftrig[sec][6]; |
val = (Int_t)de->calselftrig[sec][6]; |
369 |
del = delay(val); |
del = delay(val); |
370 |
if ( del < 1100 ){ |
if ( del < 1100 ){ |
371 |
|
clevel2->wartrig = 0.; |
372 |
clevel2->trigty = 3.; |
clevel2->trigty = 3.; |
373 |
|
ck = true; |
374 |
break; |
break; |
375 |
}; |
}; |
376 |
}; |
}; |
377 |
|
if ( !ck ) clevel2->wartrig = 100.; |
378 |
|
} else { |
379 |
|
Bool_t ck = false; |
380 |
|
for (Int_t sec = 0; sec < 4; sec++){ |
381 |
|
val = (Int_t)de->calselftrig[sec][6]; |
382 |
|
del = delay(val); |
383 |
|
if ( del < 1100 ){ |
384 |
|
clevel2->wartrig = 0.; |
385 |
|
ck = true; |
386 |
|
}; |
387 |
|
}; |
388 |
|
if ( !ck ) clevel2->wartrig = 100.; |
389 |
}; |
}; |
390 |
// |
// |
391 |
Int_t se = 5; |
Int_t se = 5; |
409 |
Int_t chdone[4] = {0,0,0,0}; |
Int_t chdone[4] = {0,0,0,0}; |
410 |
Int_t pe = 0; |
Int_t pe = 0; |
411 |
// |
// |
412 |
|
Float_t ener0 = 0.; |
413 |
|
Float_t cbase0 = 0.; |
414 |
|
Bool_t pproblem = false; |
415 |
|
// |
416 |
|
Float_t tim = 0.; |
417 |
|
Int_t plo = 0; |
418 |
|
Int_t fbi = 0; |
419 |
|
Int_t cle = 0; |
420 |
|
// |
421 |
// run over views and planes |
// run over views and planes |
422 |
// |
// |
423 |
for (Int_t l = 0; l < 2; l++){ |
for (Int_t l = 0; l < 2; l++){ |
474 |
// run over preamplifiers |
// run over preamplifiers |
475 |
// |
// |
476 |
pre = -1; |
pre = -1; |
477 |
|
cbase0 = 0.; |
478 |
for (Int_t i = 0; i < 3; i++){ |
for (Int_t i = 0; i < 3; i++){ |
479 |
for (Int_t j = 0; j < 2; j++){ |
for (Int_t j = 0; j < 2; j++){ |
480 |
pre = j + i*2; |
pre = j + i*2; |
483 |
// |
// |
484 |
if ( !isRAW ) { |
if ( !isRAW ) { |
485 |
base[l][m][pre] = de->base[l][m][pre] ; |
base[l][m][pre] = de->base[l][m][pre] ; |
486 |
|
cbase0 += base[l][m][pre]; |
487 |
} else { |
} else { |
488 |
// |
// |
489 |
// if it is a raw event and we haven't checked |
// if it is a raw event and we haven't checked |
490 |
// yet, calculate the baseline. |
// yet, calculate the baseline. |
491 |
// |
// |
492 |
FindBaseRaw(l,m,pre); |
FindBaseRaw(l,m,pre); |
493 |
|
cbase0 += base[l][m][pre]; |
494 |
}; |
}; |
495 |
}; |
}; |
496 |
}; |
}; |
498 |
// run over strips |
// run over strips |
499 |
// |
// |
500 |
pre = -1; |
pre = -1; |
501 |
|
ener0 = 0.; |
502 |
for (Int_t i = 0 ; i < 3 ; i++){ |
for (Int_t i = 0 ; i < 3 ; i++){ |
503 |
ip[i] = 0; |
ip[i] = 0; |
504 |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
508 |
doneb = 0; |
doneb = 0; |
509 |
donec = 0; |
donec = 0; |
510 |
pre++; |
pre++; |
511 |
qpre[pre] = 0; |
qpre[pre] = 0.; |
512 |
}; |
}; |
513 |
// |
// |
514 |
// baseline check and calculation |
// baseline check and calculation |
559 |
doneb = 1; |
doneb = 1; |
560 |
}; |
}; |
561 |
ener = dexyc[l][m][n]; |
ener = dexyc[l][m][n]; |
562 |
|
ener0 += ener; |
563 |
clevel1->estrip[n][m][l] = 0.; |
clevel1->estrip[n][m][l] = 0.; |
564 |
if ( base0>0 && base0 < 30000. ){ |
if ( base0>0 && base0 < 30000. ){ |
565 |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
582 |
ipre = ip[i] - 1; |
ipre = ip[i] - 1; |
583 |
}; |
}; |
584 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
585 |
clevel1->estrip[j][m][l] = clevel1->estrip[j][m][l] + (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
586 |
}; |
}; |
587 |
}; |
}; |
588 |
if (ck == 2){ |
if (ck == 2){ |
589 |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
590 |
ipre = j/16 + 1; |
ipre = j/16 + 1; |
591 |
clevel1->estrip[j][m][l] = clevel1->estrip[j][m][l] + qpre[ipre] * 0.00478; |
clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; |
592 |
}; |
}; |
593 |
}; |
}; |
594 |
}; |
}; |
595 |
|
// |
596 |
|
if ( ener0 == 0. && cbase0 == 0. && !pproblem && clevel2->perr[se] == 0){ |
597 |
|
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); |
598 |
|
pproblem = true; |
599 |
|
pe++; |
600 |
|
}; |
601 |
// |
// |
602 |
Int_t j4 = -4; |
Int_t j4 = -4; |
603 |
Int_t jjj = -3; |
Int_t jjj = -3; |
608 |
j4++; |
j4++; |
609 |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
610 |
if ( jj >= 0 && jj < 96 ){ |
if ( jj >= 0 && jj < 96 ){ |
611 |
if ( jj != 0 && jj != 32 && jj != 64 ) 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; |
612 |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] = ene[jj+1] - clevel1->estrip[jj][m][l] * 0.01581; |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; |
613 |
}; |
}; |
614 |
if ( jjj >= 0 && jjj < 96 ){ |
if ( jjj >= 0 && jjj < 96 ){ |
615 |
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 != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; |
616 |
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 != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; |
617 |
}; |
}; |
618 |
if ( j4 >= 0 && j4 < 96 ){ |
if ( j4 >= 0 && j4 < 96 ){ |
619 |
// |
// |
620 |
// 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! =================> |
621 |
// |
// |
622 |
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 ){ |
623 |
clevel1->estrip[j4][m][l] = 0.; |
clevel1->estrip[j4][m][l] = 0.; |
624 |
}; |
}; |
625 |
|
// |
626 |
|
// code and save the energy for each strip in svstrip |
627 |
|
// |
628 |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
629 |
|
// |
630 |
|
tim = 100000.; |
631 |
|
plo = m; |
632 |
|
fbi = 0; |
633 |
|
if ( clevel1->estrip[j4][m][l] > 0.99995 ){ |
634 |
|
tim = 10000.; |
635 |
|
plo = m; |
636 |
|
fbi = 1; |
637 |
|
}; |
638 |
|
if ( clevel1->estrip[j4][m][l] > 9.9995 ){ |
639 |
|
tim = 1000.; |
640 |
|
plo = 22 + m; |
641 |
|
fbi = 1; |
642 |
|
}; |
643 |
|
if ( clevel1->estrip[j4][m][l] > 99.995 ){ |
644 |
|
tim = 100.; |
645 |
|
plo = 22 + m; |
646 |
|
fbi = 0; |
647 |
|
}; |
648 |
|
if ( clevel1->estrip[j4][m][l] > 999.95 ){ |
649 |
|
tim = 10.; |
650 |
|
plo = 44 + m; |
651 |
|
fbi = 0; |
652 |
|
}; |
653 |
|
if ( clevel1->estrip[j4][m][l] > 9999.5 ){ |
654 |
|
tim = 1.; |
655 |
|
plo = 66 + m; |
656 |
|
fbi = 0; |
657 |
|
}; |
658 |
|
// |
659 |
|
cle = (Int_t)lroundf(tim*clevel1->estrip[j4][m][l]); |
660 |
|
// |
661 |
if ( l == 0 ){ |
if ( l == 0 ){ |
662 |
// |
// |
663 |
// +-PPSSmmmm.mmmm |
// +-PPSSmmmm.mmmm |
664 |
// |
// |
665 |
svstrip[istrip] = ((Float_t)m)*1000000. + ((Float_t)j4)*10000. + clevel1->estrip[j4][m][l]; |
svstrip[istrip] = fbi*1000000000 + plo*10000000 + j4*100000 + cle; |
666 |
} else { |
} else { |
667 |
svstrip[istrip] = -(((Float_t)m)*1000000. + ((Float_t)j4)*10000. + clevel1->estrip[j4][m][l]); |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
668 |
}; |
}; |
669 |
|
// |
670 |
|
// if ( ei >= -770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); |
671 |
|
// 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); |
672 |
|
// if ( ei >= -770 ) printf(" svstrip %i \n",svstrip[istrip]); |
673 |
|
// |
674 |
istrip++; |
istrip++; |
675 |
}; |
}; |
676 |
}; |
}; |
724 |
t_ca->qlow = clevel2->qlow; |
t_ca->qlow = clevel2->qlow; |
725 |
t_ca->nlow = (Int_t)clevel2->nlow; |
t_ca->nlow = (Int_t)clevel2->nlow; |
726 |
// |
// |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
|
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
|
|
// |
|
727 |
if ( trkseqno == -1 ){ |
if ( trkseqno == -1 ){ |
728 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
729 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
730 |
ca->tanx = clevel2->tanx; |
ca->tanx[1] = clevel2->tanx; |
731 |
ca->tany = clevel2->tany; |
ca->tany[1] = clevel2->tany; |
732 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
733 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
734 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
// memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
735 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
// memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
736 |
|
memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); |
737 |
|
memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); |
738 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
739 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[2] = clevel2->varcfit[0]; |
740 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[3] = clevel2->varcfit[1]; |
741 |
|
ca->npcfit[2] = clevel2->npcfit[0]; |
742 |
|
ca->npcfit[3] = clevel2->npcfit[1]; |
743 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
744 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
745 |
|
} else { |
746 |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
747 |
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
748 |
}; |
}; |
749 |
|
// |
750 |
// |
// |
751 |
|
if ( !(ca->CaloTrk) ) ca->CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA |
752 |
TClonesArray &t = *ca->CaloTrk; |
TClonesArray &t = *ca->CaloTrk; |
753 |
new(t[nutrk]) CaloTrkVar(*t_ca); |
new(t[nutrk]) CaloTrkVar(*t_ca); |
754 |
// |
// |
755 |
|
delete t_ca; |
756 |
|
// |
757 |
ClearTrkVar(); |
ClearTrkVar(); |
758 |
} |
} |
759 |
|
|
761 |
calol2cm(); |
calol2cm(); |
762 |
} |
} |
763 |
|
|
764 |
void CaloProcessing::FillCommonVar(CaloLevel2 *ca){ |
void CaloProcessing::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ |
765 |
// |
// |
766 |
ca->good = clevel2->good; |
ca->good = clevel2->good; |
767 |
if ( clevel2->trigty == 2. ){ |
if ( clevel2->trigty == 2. ){ |
769 |
} else { |
} else { |
770 |
ca->selftrigger = 0; |
ca->selftrigger = 0; |
771 |
}; |
}; |
772 |
|
// |
773 |
|
ca->selftrigger += (Int_t)clevel2->wartrig; |
774 |
|
// |
775 |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
776 |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
777 |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
|
ca->estrip = TArrayF(0,svstrip); |
|
778 |
ca->nstrip = (Int_t)clevel2->nstrip; |
ca->nstrip = (Int_t)clevel2->nstrip; |
779 |
ca->qtot = clevel2->qtot; |
ca->qtot = clevel2->qtot; |
780 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
781 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
782 |
ca->tanx = clevel2->tanx; |
ca->tanx[0] = clevel2->tanx; |
783 |
ca->tany = clevel2->tany; |
ca->tany[0] = clevel2->tany; |
784 |
ca->nx22 = (Int_t)clevel2->nx22; |
ca->nx22 = (Int_t)clevel2->nx22; |
785 |
ca->qx22 = clevel2->qx22; |
ca->qx22 = clevel2->qx22; |
786 |
ca->qmax = clevel2->qmax; |
ca->qmax = clevel2->qmax; |
787 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
788 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
|
ca->estrip = TArrayF(ca->nstrip,svstrip); |
|
789 |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
790 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
791 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[0] = clevel2->varcfit[0]; |
792 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[1] = clevel2->varcfit[1]; |
793 |
|
ca->npcfit[0] = clevel2->npcfit[0]; |
794 |
|
ca->npcfit[1] = clevel2->npcfit[1]; |
795 |
|
ca->fitmode[0] = clevel2->fmode[0]; |
796 |
|
ca->fitmode[1] = clevel2->fmode[1]; |
797 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
798 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
799 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
800 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
801 |
// |
// |
802 |
|
if ( c1 ){ |
803 |
|
c1->istrip = istrip; |
804 |
|
c1->estrip = TArrayI(istrip,svstrip); |
805 |
|
}; |
806 |
|
// |
807 |
} |
} |
808 |
|
|
809 |
void CaloProcessing::ClearStructs(){ |
void CaloProcessing::ClearStructs(){ |
814 |
void CaloProcessing::RunClose(){ |
void CaloProcessing::RunClose(){ |
815 |
l0tr->Delete(); |
l0tr->Delete(); |
816 |
ClearStructs(); |
ClearStructs(); |
817 |
for ( Int_t l = 0; l < 2; l++ ){ |
// |
818 |
for ( Int_t m = 0; m < 22; m++ ){ |
memset(dexy, 0, 2*22*96*sizeof(Float_t)); |
819 |
for ( Int_t n = 0; n < 96; n++ ){ |
memset(dexyc, 0, 2*22*96*sizeof(Float_t)); |
820 |
dexy[l][m][n] = 0.; |
memset(base, 0, 2*22*6*sizeof(Float_t)); |
821 |
dexyc[l][m][n] = 0.; |
memset(sbase, 0, 2*22*6*sizeof(Float_t)); |
822 |
if ( n < 6 ){ |
// |
|
base[l][m][n] = 0.; |
|
|
sbase[l][m][n] = 0.; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
823 |
} |
} |
824 |
|
|
825 |
// |
// |
852 |
clevel2->dX0l = 0.; |
clevel2->dX0l = 0.; |
853 |
clevel2->elen = 0.; |
clevel2->elen = 0.; |
854 |
clevel2->selen = 0.; |
clevel2->selen = 0.; |
855 |
memcpy(clevel1->al_p,e_clevel1->al_p,sizeof(clevel1->al_p)); |
memset(clevel1->al_p, 0, 5*2*sizeof(Double_t)); |
856 |
memcpy(clevel2->tibar,e_clevel2->tibar,sizeof(clevel2->tibar)); |
memset(clevel2->tibar, 0, 2*22*sizeof(Int_t)); |
857 |
memcpy(clevel2->tbar,e_clevel2->tbar,sizeof(clevel2->tbar)); |
memset(clevel2->tbar, 0, 2*22*sizeof(Float_t)); |
858 |
} |
} |
859 |
|
|
860 |
void CaloProcessing::ClearCommonVar(){ |
void CaloProcessing::ClearCommonVar(){ |
861 |
istrip = 0; |
istrip = 0; |
862 |
clevel2->trigty = -1.; |
clevel2->trigty = -1.; |
863 |
|
clevel2->wartrig = 0.; |
864 |
clevel2->good = 0; |
clevel2->good = 0; |
865 |
clevel2->nstrip = 0.; |
clevel2->nstrip = 0.; |
866 |
clevel2->qtot = 0.; |
clevel2->qtot = 0.; |
867 |
clevel2->impx = 0.; |
// clevel2->impx = 0.; |
868 |
clevel2->impy = 0.; |
// clevel2->impy = 0.; |
869 |
clevel2->tanx = 0.; |
clevel2->tanx = 0.; // this is correct since it refers to the fortran structure |
870 |
clevel2->tany = 0.; |
clevel2->tany = 0.; // this is correct since it refers to the fortran structure |
871 |
clevel2->qmax = 0.; |
clevel2->qmax = 0.; |
872 |
clevel2->nx22 = 0.; |
clevel2->nx22 = 0.; |
873 |
clevel2->qx22 = 0.; |
clevel2->qx22 = 0.; |
874 |
memcpy(clevel2->perr,e_clevel2->perr,sizeof(clevel2->perr)); |
memset(clevel2->perr, 0, 4*sizeof(Int_t)); |
875 |
memcpy(clevel2->swerr,e_clevel2->swerr,sizeof(clevel2->swerr)); |
memset(clevel2->swerr, 0, 4*sizeof(Int_t)); |
876 |
memcpy(clevel2->crc,e_clevel2->crc,sizeof(clevel2->crc)); |
memset(clevel2->crc, 0, 4*sizeof(Int_t)); |
877 |
memcpy(clevel2->qq,e_clevel2->qq,sizeof(clevel2->qq)); |
memset(clevel2->qq, 0, 4*sizeof(Int_t)); |
878 |
memcpy(clevel2->planemax,e_clevel2->planemax,sizeof(clevel2->planemax)); |
memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); |
879 |
memcpy(clevel2->varcfit,e_clevel2->varcfit,sizeof(clevel2->varcfit)); |
memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); |
880 |
memcpy(clevel2->npcfit,e_clevel2->npcfit,sizeof(clevel2->npcfit)); |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
881 |
memcpy(clevel2->cibar,e_clevel2->cibar,sizeof(clevel2->cibar)); |
memset(clevel2->fmode, 0, 2*sizeof(Int_t)); |
882 |
memcpy(clevel2->cbar,e_clevel2->cbar,sizeof(clevel2->cbar)); |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
883 |
|
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |
884 |
} |
} |
885 |
|
|
886 |
void CaloProcessing::ClearCalibVals(Int_t s){ |
void CaloProcessing::ClearCalibVals(Int_t s){ |
934 |
return; |
return; |
935 |
} |
} |
936 |
|
|
937 |
Int_t CaloProcessing::Update(TSQLServer *dbc, ULong64_t atime, Int_t s){ |
Int_t CaloProcessing::Update(TSQLServer *dbc, UInt_t atime, Int_t s){ |
938 |
// |
// |
939 |
Int_t sgnl = 0; |
Int_t sgnl = 0; |
940 |
// |
// |
942 |
// |
// |
943 |
sgnl = 0; |
sgnl = 0; |
944 |
// |
// |
945 |
idcalib[s] = 0ULL; |
idcalib[s] = 0; |
946 |
fromtime[s] = 0ULL; |
fromtime[s] = 0; |
947 |
totime[s] = 0ULL; |
totime[s] = 0; |
948 |
calibno[s] = 0; |
calibno[s] = 0; |
949 |
ClearCalibVals(s); |
ClearCalibVals(s); |
950 |
// |
// |
951 |
sgnl = glcalo->Query_GL_CALO_CALIB(atime,s,dbc); |
UInt_t uptime = 0; |
952 |
|
// |
953 |
|
sgnl = glcalo->Query_GL_CALO_CALIB(atime,uptime,s,dbc); |
954 |
if ( sgnl < 0 ){ |
if ( sgnl < 0 ){ |
955 |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
if ( verbose ) printf(" CALORIMETER - ERROR: error from GLTables\n"); |
956 |
return(sgnl); |
return(sgnl); |
957 |
}; |
}; |
958 |
// |
// |
959 |
idcalib[s] = glcalo->ID_REG_CALIBCALPED; |
idcalib[s] = glcalo->ID_ROOT_L0; |
960 |
fromtime[s] = glcalo->FROM_TIME; |
fromtime[s] = glcalo->FROM_TIME; |
961 |
totime[s] = glcalo->TO_TIME; |
if ( glcalo->TO_TIME < atime ){ // calibration is corrupted and we are using the one that preceed the good one |
962 |
calibno[s] = glcalo->EV_REG_CALIBCALPED; |
totime[s] = uptime; |
963 |
|
} else { |
964 |
|
totime[s] = glcalo->TO_TIME; |
965 |
|
}; |
966 |
|
// totime[s] = glcalo->TO_TIME; |
967 |
|
calibno[s] = glcalo->EV_ROOT; |
968 |
// |
// |
969 |
if ( totime[s] == 0ULL){ |
if ( totime[s] == 0 ){ |
970 |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
if ( verbose ) printf(" CALORIMETER - WARNING: data with no associated calibration\n"); |
971 |
ClearCalibVals(s); |
ClearCalibVals(s); |
972 |
sgnl = 100; |
sgnl = 100; |
990 |
name << glroot->NAME.Data(); |
name << glroot->NAME.Data(); |
991 |
// |
// |
992 |
fcalname[s] = (TString)name.str().c_str(); |
fcalname[s] = (TString)name.str().c_str(); |
993 |
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]); |
994 |
// |
// |
995 |
sgnl = LoadCalib(s); |
sgnl = LoadCalib(s); |
996 |
// |
// |
997 |
if ( sgnl != 0 ) return(sgnl); |
if ( sgnl != 0 ) return(sgnl); |
998 |
|
delete glcalo; |
999 |
|
delete glroot; |
1000 |
// |
// |
1001 |
return(0); |
return(0); |
1002 |
// |
// |
1016 |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
1017 |
if ( !tr ) return(-109); |
if ( !tr ) return(-109); |
1018 |
// |
// |
|
TBranch *registry = tr->GetBranch("Registry"); |
|
1019 |
TBranch *calo = tr->GetBranch("CalibCalPed"); |
TBranch *calo = tr->GetBranch("CalibCalPed"); |
1020 |
// |
// |
|
pamela::RegistryEvent *reg = 0; |
|
1021 |
pamela::CalibCalPedEvent *ce = 0; |
pamela::CalibCalPedEvent *ce = 0; |
1022 |
tr->SetBranchAddress("CalibCalPed", &ce); |
tr->SetBranchAddress("CalibCalPed", &ce); |
|
tr->SetBranchAddress("Registry", ®); |
|
1023 |
// |
// |
1024 |
Long64_t ncalibs = registry->GetEntries(); |
Long64_t ncalibs = calo->GetEntries(); |
1025 |
// |
// |
1026 |
if ( !ncalibs ) return(-110); |
if ( !ncalibs ) return(-110); |
1027 |
// |
// |
1028 |
registry->GetEntry(calibno[s]); |
calo->GetEntry(calibno[s]); |
|
// |
|
|
calo->GetEntry(reg->event); |
|
1029 |
// |
// |
1030 |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
1031 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
for ( Int_t d=0 ; d<11 ;d++ ){ |