17 |
// |
// |
18 |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
19 |
// |
// |
|
OBT = 0; |
|
|
PKT = 0; |
|
|
atime = 0; |
|
|
sntr = "start"; |
|
|
AOBT = 0; |
|
|
APKT = 0; |
|
|
aatime = 0; |
|
|
asntr = "start"; |
|
|
// |
|
|
debug = false; |
|
|
// |
|
|
fLong = false; |
|
20 |
fSimu = false; |
fSimu = false; |
21 |
fPl = 1; |
this->Set(); |
|
fRad = -1; |
|
|
// |
|
|
this->DefineGeometry(); |
|
|
fXosel = true; |
|
|
fXesel = true; |
|
|
fYosel = true; |
|
|
fYesel = true; |
|
|
fConv_rxe = 44.4; |
|
|
fConv_rxo = 44.4; |
|
|
fConv_ryo = 44.4; |
|
|
fConv_rye = 44.4; |
|
22 |
// |
// |
23 |
} |
} |
24 |
|
|
30 |
// |
// |
31 |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
32 |
// |
// |
33 |
|
fSimu = simulation; |
34 |
|
this->Set(); |
35 |
|
// |
36 |
|
} |
37 |
|
|
38 |
|
void CaloEnergy::Delete(){ |
39 |
|
Clear(); |
40 |
|
delete this; |
41 |
|
} |
42 |
|
|
43 |
|
void CaloEnergy::UseLevel2(){ |
44 |
|
if ( clong ){ |
45 |
|
delete clong; |
46 |
|
clong = new CaloLong(L2); |
47 |
|
clong->SplitInto(0,22); |
48 |
|
}; |
49 |
|
if ( cp ) delete cp; |
50 |
|
cp = NULL; |
51 |
|
} |
52 |
|
|
53 |
|
void CaloEnergy::UseCaloPreSampler(){ |
54 |
|
// |
55 |
|
// use the presampler setting forcefitmode to 1000 means to force the DV routine to find the track inside the calorimeter using the "shower" approach developed for electrons |
56 |
|
// |
57 |
|
if ( !cp ) cp = new CaloPreSampler(L2); |
58 |
|
cp->SplitInto(0,22); |
59 |
|
cp->SetForceFitMode(1000); |
60 |
|
// cp->UseTracker(false); |
61 |
|
// cp->ForceCaloFit(); |
62 |
|
// cp->SetDebug(true); |
63 |
|
// cp->Process(); |
64 |
|
if ( clong ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer()); |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
void CaloEnergy::UseLongFit(){ |
69 |
|
fPl = 0; |
70 |
|
fLong = true; |
71 |
|
if ( !clong ){ |
72 |
|
clong = new CaloLong(L2); |
73 |
|
if ( cp ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer()); |
74 |
|
clong->SplitInto(0,22); |
75 |
|
}; |
76 |
|
// |
77 |
|
} |
78 |
|
|
79 |
|
void CaloEnergy::Set(){ |
80 |
|
// |
81 |
|
// set default values, NB default conversion factor for energy is just very approximated! |
82 |
|
// |
83 |
OBT = 0; |
OBT = 0; |
84 |
PKT = 0; |
PKT = 0; |
85 |
atime = 0; |
atime = 0; |
92 |
// |
// |
93 |
debug = false; |
debug = false; |
94 |
// |
// |
95 |
|
indep = false; |
96 |
|
// |
97 |
|
fAllpl = true; |
98 |
fLong = false; |
fLong = false; |
|
fSimu = simulation; |
|
99 |
fPl = 1; |
fPl = 1; |
100 |
fRad = -1; |
fRad = -1; |
101 |
|
cp = NULL; |
102 |
|
clong = NULL; |
103 |
|
x0max = -1.; |
104 |
|
// |
105 |
|
multicol = false; |
106 |
// |
// |
107 |
this->DefineGeometry(); |
this->DefineGeometry(); |
108 |
fXosel =true; |
fXosel =true; |
113 |
fConv_rxo = 44.4; |
fConv_rxo = 44.4; |
114 |
fConv_ryo = 44.4; |
fConv_ryo = 44.4; |
115 |
fConv_rye = 44.4; |
fConv_rye = 44.4; |
116 |
|
fXomin = 1000; |
117 |
|
fXemin = 1000; |
118 |
|
fYomin = 1000; |
119 |
|
fYemin = 1000; |
120 |
|
// |
121 |
|
this->UseCaloPreSampler(); // use it by default, to go back to "standard" mode use CaloEnergy::UseLevel2(). |
122 |
// |
// |
123 |
} |
} |
|
|
|
|
void CaloEnergy::SetConversionFactor(TString section, Float_t conv){ |
|
|
section.ToUpper(); |
|
|
if ( section.Contains("XO") ) fConv_rxo = conv; |
|
|
if ( section.Contains("XE") ) fConv_rxe = conv; |
|
|
if ( section.Contains("YO") ) fConv_ryo = conv; |
|
|
if ( section.Contains("YE") ) fConv_rye = conv; |
|
|
} |
|
|
|
|
|
Float_t CaloEnergy::GetConversionFactor(TString section){ |
|
|
section.ToUpper(); |
|
|
if ( section.Contains("XO") ) return(fConv_rxo); |
|
|
if ( section.Contains("XE") ) return(fConv_rxe); |
|
|
if ( section.Contains("YO") ) return(fConv_ryo); |
|
|
if ( section.Contains("YE") ) return(fConv_rye); |
|
|
printf(" ERROR: section not recognized \n"); |
|
|
return(-1000.); |
|
|
} |
|
|
|
|
|
Int_t CaloEnergy::GetMaxplane(TString section){ |
|
|
section.ToUpper(); |
|
|
if ( section.Contains("XO") ) return fMax_planexo; |
|
|
if ( section.Contains("XE") ) return fMax_planexe; |
|
|
if ( section.Contains("YO") ) return fMax_planeyo; |
|
|
if ( section.Contains("YE") ) return fMax_planeye; |
|
|
return(-1); |
|
|
} |
|
|
|
|
124 |
void CaloEnergy::DefineGeometry(){ |
void CaloEnergy::DefineGeometry(){ |
125 |
// |
// |
126 |
fM = 2. + 0.096; // real position from cbar |
// Use CaloStrip to determine once the position of border strips for each section |
127 |
fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. |
// |
128 |
|
// fM = 2. + 0.096; // real position from cbar BUG the 0.096 is already taken into account in the border calculation made by Giovanna |
129 |
|
fM = 2. ; // real position from cbar |
130 |
|
// fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. BUG! this way we count from the silicon border not from the silicon sensitive area |
131 |
|
fM1 = 2. - 0.122 - 0.096 + 0.096; // due to calculation of xe1 etc. |
132 |
if ( fM1 < 0. ) fM1 = 0.; |
if ( fM1 < 0. ) fM1 = 0.; |
133 |
// |
// |
134 |
CaloStrip *cs = new CaloStrip(fSimu); |
CaloStrip *cs = new CaloStrip(fSimu); |
135 |
|
// |
136 |
// vista y piano 0 striscia 0 |
// view y plane 0 strip 0 |
137 |
cs->Set(1,0,0); |
cs->Set(1,0,0); |
138 |
xe1= cs->GetY(); |
xe1= cs->GetY(); |
139 |
z1= cs->GetZ(); |
// view y plane 0 strip 31 |
|
// vista y piano 0 striscia 31 |
|
140 |
cs->Set(1,0,31); |
cs->Set(1,0,31); |
141 |
xe2= cs->GetY(); |
xe2= cs->GetY(); |
142 |
// vista y piano 0 striscia 32 |
// view y plane 0 strip 32 |
143 |
cs->Set(1,0,32); |
cs->Set(1,0,32); |
144 |
xe3= cs->GetY(); |
xe3= cs->GetY(); |
145 |
// vista y piano 0 striscia 63 |
// view y plane 0 strip 63 |
146 |
cs->Set(1,0,63); |
cs->Set(1,0,63); |
147 |
xe4= cs->GetY(); |
xe4= cs->GetY(); |
148 |
// vista y piano 0 striscia 64 |
// view y plane 0 strip 64 |
149 |
cs->Set(1,0,64); |
cs->Set(1,0,64); |
150 |
xe5= cs->GetY(); |
xe5= cs->GetY(); |
151 |
// vista y piano 0 striscia 95 |
// view y plane 0 strip 95 |
152 |
cs->Set(1,0,95); |
cs->Set(1,0,95); |
153 |
xe6= cs->GetY(); |
xe6= cs->GetY(); |
154 |
|
// view x plane 0 strip 0 |
|
// vista x piano 0 striscia 0 |
|
155 |
cs->Set(0,0,0); |
cs->Set(0,0,0); |
156 |
yo1= cs->GetX(); |
yo1= cs->GetX(); |
157 |
z2= cs->GetZ(); |
// view x plane 0 strip 31 |
|
// vista x piano 0 striscia 31 |
|
158 |
cs->Set(0,0,31); |
cs->Set(0,0,31); |
159 |
yo2= cs->GetX(); |
yo2= cs->GetX(); |
160 |
// vista x piano 0 striscia 32 |
// view x plane 0 strip 32 |
161 |
cs->Set(0,0,32); |
cs->Set(0,0,32); |
162 |
yo3= cs->GetX(); |
yo3= cs->GetX(); |
163 |
// vista x piano 0 striscia 63 |
// view x plane 0 strip 63 |
164 |
cs->Set(0,0,63); |
cs->Set(0,0,63); |
165 |
yo4= cs->GetX(); |
yo4= cs->GetX(); |
166 |
// vista x piano 0 striscia 64 |
// view x plane 0 strip 64 |
167 |
cs->Set(0,0,64); |
cs->Set(0,0,64); |
168 |
yo5= cs->GetX(); |
yo5= cs->GetX(); |
169 |
// vista x piano 0 striscia 95 |
// view x plane 0 strip 95 |
170 |
cs->Set(0,0,95); |
cs->Set(0,0,95); |
171 |
yo6= cs->GetX(); |
yo6= cs->GetX(); |
172 |
|
// view y plane 1 strip 0 |
|
|
|
|
// vista y piano 1 striscia 0 |
|
173 |
cs->Set(1,1,0); |
cs->Set(1,1,0); |
174 |
xo1= cs->GetY(); |
xo1= cs->GetY(); |
175 |
z3= cs->GetZ(); |
// view y plane 1 strip 31 |
|
// vista y piano 1 striscia 31 |
|
176 |
cs->Set(1,1,31); |
cs->Set(1,1,31); |
177 |
xo2= cs->GetY(); |
xo2= cs->GetY(); |
178 |
// vista y piano 1 striscia 32 |
// view y plane 1 strip 32 |
179 |
cs->Set(1,1,32); |
cs->Set(1,1,32); |
180 |
xo3= cs->GetY(); |
xo3= cs->GetY(); |
181 |
// vista y piano 1 striscia 63 |
// view y plane 1 strip 63 |
182 |
cs->Set(1,1,63); |
cs->Set(1,1,63); |
183 |
xo4= cs->GetY(); |
xo4= cs->GetY(); |
184 |
// vista y piano 1 striscia 64 |
// view y plane 1 strip 64 |
185 |
cs->Set(1,1,64); |
cs->Set(1,1,64); |
186 |
xo5= cs->GetY(); |
xo5= cs->GetY(); |
187 |
// vista y piano 1 striscia 95 |
// view y plane 1 strip 95 |
188 |
cs->Set(1,1,95); |
cs->Set(1,1,95); |
189 |
xo6= cs->GetY(); |
xo6= cs->GetY(); |
190 |
|
// view x plane 1 strip 0 |
|
// vista x piano 1 striscia 0 |
|
191 |
cs->Set(0,1,0); |
cs->Set(0,1,0); |
192 |
ye1= cs->GetX(); |
ye1= cs->GetX(); |
193 |
z4= cs->GetZ(); |
// view x plane 1 strip 31 |
|
// vista x piano 1 striscia 31 |
|
194 |
cs->Set(0,1,31); |
cs->Set(0,1,31); |
195 |
ye2= cs->GetX(); |
ye2= cs->GetX(); |
196 |
// vista x piano 1 striscia 32 |
// view x plane 1 strip 32 |
197 |
cs->Set(0,1,32); |
cs->Set(0,1,32); |
198 |
ye3= cs->GetX(); |
ye3= cs->GetX(); |
199 |
// vista x piano 1 striscia 63 |
// view x plane 1 strip 63 |
200 |
cs->Set(0,1,63); |
cs->Set(0,1,63); |
201 |
ye4= cs->GetX(); |
ye4= cs->GetX(); |
202 |
// vista x piano 1 striscia 64 |
// view x plane 1 strip 64 |
203 |
cs->Set(0,1,64); |
cs->Set(0,1,64); |
204 |
ye5= cs->GetX(); |
ye5= cs->GetX(); |
205 |
// vista x piano 1 striscia 95 |
// view x plane 1 strip 95 |
206 |
cs->Set(0,1,95); |
cs->Set(0,1,95); |
207 |
ye6= cs->GetX(); |
ye6= cs->GetX(); |
|
|
|
208 |
// |
// |
209 |
for (Int_t p = 0; p<22; p ++){ |
for (Int_t p = 0; p<22; p ++){ |
210 |
for (Int_t v = 0; v<2; v++ ){ |
for (Int_t v = 0; v<2; v++ ){ |
211 |
cs->Set(v,p,0); |
cs->Set(v,p,0); |
212 |
trk_z[p][v]= cs->GetZ(); // << cooordinata Z piano |
trk_z[p][v]= cs->GetZ(); // Z coord for each plane |
213 |
}; |
}; |
214 |
}; |
}; |
215 |
// |
// |
219 |
|
|
220 |
void CaloEnergy::Clear(){ |
void CaloEnergy::Clear(){ |
221 |
// |
// |
222 |
|
// clear variables |
223 |
|
// |
224 |
|
fPartsel = false; |
225 |
|
fSel = false; |
226 |
|
fXosel = false; |
227 |
|
fXesel = false; |
228 |
|
fYosel = false; |
229 |
|
fYesel = false; |
230 |
|
fCount = 0.; |
231 |
fEnergy = 0.; |
fEnergy = 0.; |
232 |
fEnergyxe = 0.; |
fEnergyxe = 0.; |
233 |
fEnergyxo = 0.; |
fEnergyxo = 0.; |
234 |
fEnergyye = 0.; |
fEnergyye = 0.; |
235 |
fEnergyyo = 0.; |
fEnergyyo = 0.; |
236 |
|
fMax_plane = 0; |
237 |
|
fMax_planexo = 0; |
238 |
|
fMax_planexe = 0; |
239 |
|
fMax_planeyo = 0; |
240 |
|
fMax_planeye = 0; |
241 |
|
xomax_en= 0.; |
242 |
|
xemax_en= 0.; |
243 |
|
yomax_en= 0.; |
244 |
|
yemax_en= 0.; |
245 |
|
// |
246 |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
memset(enstrip,0,2*22*96*(sizeof(Float_t))); |
247 |
en = 0.; |
en = 0.; |
248 |
view = 0; |
view = 0; |
252 |
energyyo = 0.; |
energyyo = 0.; |
253 |
energyxo = 0.; |
energyxo = 0.; |
254 |
energyye = 0.; |
energyye = 0.; |
255 |
|
fYoout = 0; |
256 |
|
fYeout = 0; |
257 |
|
fXoout = 0; |
258 |
|
fXeout = 0; |
259 |
|
fXEen_maxplane = 0.; |
260 |
|
fXOen_maxplane = 0.; |
261 |
|
fYEen_maxplane = 0.; |
262 |
|
fYOen_maxplane = 0.; |
263 |
memset(en_xep,0,11*sizeof(Float_t)); |
memset(en_xep,0,11*sizeof(Float_t)); |
264 |
memset(en_yep,0,11*sizeof(Float_t)); |
memset(en_yep,0,11*sizeof(Float_t)); |
265 |
memset(en_xop,0,11*sizeof(Float_t)); |
memset(en_xop,0,11*sizeof(Float_t)); |
266 |
memset(en_yop,0,11*sizeof(Float_t)); |
memset(en_yop,0,11*sizeof(Float_t)); |
267 |
// |
// |
268 |
|
fColumn = -1; |
269 |
|
fColXE = -1; |
270 |
|
fColXO = -1; |
271 |
|
fColYE = -1; |
272 |
|
fColYO = -1; |
273 |
|
memset(encol,0,2*3*sizeof(Float_t)); |
274 |
|
entot[0] = 0.; |
275 |
|
entot[1] = 0.; |
276 |
|
// |
277 |
} |
} |
278 |
|
|
279 |
void CaloEnergy::Print(){ |
void CaloEnergy::Print(){ |
287 |
printf(" fMax_planeyo :......... %i \n",fMax_planeyo); |
printf(" fMax_planeyo :......... %i \n",fMax_planeyo); |
288 |
printf(" fMax_planeye :......... %i \n",fMax_planeye); |
printf(" fMax_planeye :......... %i \n",fMax_planeye); |
289 |
printf(" fCount :.............. %f \n",fCount); |
printf(" fCount :.............. %f \n",fCount); |
290 |
|
printf(" fSel :.............. %i \n",fSel); |
291 |
|
printf(" fPartsel:.............. %i \n",fPartsel); |
292 |
printf(" fXesel :.............. %i \n",fXesel); |
printf(" fXesel :.............. %i \n",fXesel); |
293 |
printf(" fXosel :.............. %i \n",fXosel); |
printf(" fXosel :.............. %i \n",fXosel); |
294 |
printf(" fYesel :.............. %i \n",fYesel); |
printf(" fYesel :.............. %i \n",fYesel); |
295 |
printf(" fYosel :.............. %i \n",fYosel); |
printf(" fYosel :.............. %i \n",fYosel); |
296 |
|
printf(" fXemin :.............. %i \n",fXemin); |
297 |
|
printf(" fXomin :.............. %i \n",fXomin); |
298 |
|
printf(" fYemin :.............. %i \n",fYemin); |
299 |
|
printf(" fYomin :.............. %i \n",fYomin); |
300 |
|
printf(" fXeout :.............. %i \n",fXeout); |
301 |
|
printf(" fXoout :.............. %i \n",fXoout); |
302 |
|
printf(" fYeout :.............. %i \n",fYeout); |
303 |
|
printf(" fYoout :.............. %i \n",fYoout); |
304 |
printf(" fSimu :.............. %i \n",fSimu); |
printf(" fSimu :.............. %i \n",fSimu); |
305 |
printf(" fM :.............. %f \n",fM); |
printf(" fM :.............. %f \n",fM); |
306 |
printf(" fM1 :.............. %f \n",fM1); |
printf(" fM1 :.............. %f \n",fM1); |
307 |
printf(" fRad :.............. %i \n",fRad); |
printf(" fRad :.............. %i \n",fRad); |
308 |
printf(" fPl :.............. %i \n",fPl); |
printf(" fPl :.............. %i \n",fPl); |
309 |
|
printf(" fColumn :.............. %i \n",fColumn); |
310 |
|
printf(" multicol:.............. %i \n",multicol); |
311 |
|
printf(" encol x :.............. %f \n",this->GetEncol(0)); |
312 |
|
printf(" encol y :.............. %f \n",this->GetEncol(1)); |
313 |
|
printf(" entot x :.............. %f \n",this->GetEntot(0)); |
314 |
|
printf(" entot y :.............. %f \n",this->GetEntot(1)); |
315 |
|
printf(" fColXE :.............. %i \n",fColXE); |
316 |
|
printf(" fColXO :.............. %i \n",fColXO); |
317 |
|
printf(" fColYE :.............. %i \n",fColYE); |
318 |
|
printf(" fColYO :.............. %i \n",fColYO); |
319 |
printf(" fConv_rxe ............. %f \n",fConv_rxe); |
printf(" fConv_rxe ............. %f \n",fConv_rxe); |
320 |
printf(" fConv_rxo ............. %f \n",fConv_rxo); |
printf(" fConv_rxo ............. %f \n",fConv_rxo); |
321 |
printf(" fConv_ryo ............. %f \n",fConv_ryo); |
printf(" fConv_ryo ............. %f \n",fConv_ryo); |
325 |
printf(" energyxo:.............. %f \n",energyxo); |
printf(" energyxo:.............. %f \n",energyxo); |
326 |
printf(" energyye:.............. %f \n",energyye); |
printf(" energyye:.............. %f \n",energyye); |
327 |
printf(" energyyo:.............. %f \n",energyyo); |
printf(" energyyo:.............. %f \n",energyyo); |
328 |
|
printf(" fXEen_maxplane:........ %f \n",fXEen_maxplane); |
329 |
|
printf(" fXOen_maxplane:........ %f \n",fXOen_maxplane); |
330 |
|
printf(" fYEen_maxplane:........ %f \n",fYEen_maxplane); |
331 |
|
printf(" fYOen_maxplane:........ %f \n",fYOen_maxplane); |
332 |
|
printf(" x0max :.............. %f \n",x0max); |
333 |
printf(" debug :.............. %i \n",debug); |
printf(" debug :.............. %i \n",debug); |
334 |
|
|
335 |
printf("========================================================================\n"); |
printf("========================================================================\n"); |
336 |
// |
// |
337 |
} |
} |
338 |
|
|
339 |
void CaloEnergy::Delete(){ |
void CaloEnergy::SetMinimumContainment(TString section, Int_t plane){ |
340 |
Clear(); |
section.ToUpper(); |
341 |
|
if ( section.Contains("XO") ) fXomin = plane; |
342 |
|
if ( section.Contains("XE") ) fXemin = plane; |
343 |
|
if ( section.Contains("YO") ) fYomin = plane; |
344 |
|
if ( section.Contains("YE") ) fYemin = plane; |
345 |
} |
} |
346 |
|
|
347 |
|
void CaloEnergy::SetMinimumContainment(Int_t plane){ |
348 |
|
this->SetMinimumContainment("XEXOYEYO",plane); |
349 |
|
} |
350 |
|
|
351 |
Bool_t CaloEnergy::IsInsideAcceptance(TString section){ |
void CaloEnergy::SetConversionFactor(TString section, Float_t conv){ |
352 |
return(this->IsInsideAcceptance(section,true)); |
section.ToUpper(); |
353 |
|
if ( section.Contains("XO") ) fConv_rxo = conv; |
354 |
|
if ( section.Contains("XE") ) fConv_rxe = conv; |
355 |
|
if ( section.Contains("YO") ) fConv_ryo = conv; |
356 |
|
if ( section.Contains("YE") ) fConv_rye = conv; |
357 |
|
} |
358 |
|
|
359 |
|
void CaloEnergy::SetConversionFactor(Float_t conv){ |
360 |
|
this->SetConversionFactor("XEXOYEYO",conv); |
361 |
|
} |
362 |
|
|
363 |
|
Int_t CaloEnergy::GetMinimumContainment(TString section){ |
364 |
|
section.ToUpper(); |
365 |
|
if ( section.Contains("XO") ) return(fXomin); |
366 |
|
if ( section.Contains("XE") ) return(fXemin); |
367 |
|
if ( section.Contains("YE") ) return(fYemin); |
368 |
|
if ( section.Contains("YO") ) return(fYomin); |
369 |
|
printf(" ERROR: section not recognized \n"); |
370 |
|
return(-1000); |
371 |
|
} |
372 |
|
|
373 |
|
Float_t CaloEnergy::GetConversionFactor(TString section){ |
374 |
|
section.ToUpper(); |
375 |
|
if ( section.Contains("XO") ) return(fConv_rxo); |
376 |
|
if ( section.Contains("XE") ) return(fConv_rxe); |
377 |
|
if ( section.Contains("YO") ) return(fConv_ryo); |
378 |
|
if ( section.Contains("YE") ) return(fConv_rye); |
379 |
|
printf(" ERROR: section not recognized \n"); |
380 |
|
return(-1000.); |
381 |
|
} |
382 |
|
|
383 |
|
Int_t CaloEnergy::GetMaxplane(TString section){ |
384 |
|
section.ToUpper(); |
385 |
|
if ( section.Contains("XO") ) return fMax_planexo; |
386 |
|
if ( section.Contains("XE") ) return fMax_planexe; |
387 |
|
if ( section.Contains("YO") ) return fMax_planeyo; |
388 |
|
if ( section.Contains("YE") ) return fMax_planeye; |
389 |
|
return(-1); |
390 |
|
} |
391 |
|
|
392 |
|
Int_t CaloEnergy::GetColumn(TString section){ |
393 |
|
section.ToUpper(); |
394 |
|
if ( section.Contains("XO") ) return fColXO; |
395 |
|
if ( section.Contains("XE") ) return fColXE; |
396 |
|
if ( section.Contains("YO") ) return fColYO; |
397 |
|
if ( section.Contains("YE") ) return fColYE; |
398 |
|
return(-1); |
399 |
|
} |
400 |
|
|
401 |
|
Float_t CaloEnergy::GetMipEnergyAtMaxplane(TString section){ |
402 |
|
printf(" WARNING: OBSOLETE METHOD, use GetMipEnergyAtMaxplane(TString) instead! \n"); |
403 |
|
return (this->GetEnergyAtMaxplane(section)); |
404 |
|
} |
405 |
|
|
406 |
|
Float_t CaloEnergy::GetEnergyAtMaxplane(TString section){ |
407 |
|
section.ToUpper(); |
408 |
|
if ( section.Contains("XO") ) return xomax_en; |
409 |
|
if ( section.Contains("XE") ) return xemax_en; |
410 |
|
if ( section.Contains("YO") ) return yomax_en; |
411 |
|
if ( section.Contains("YE") ) return yemax_en; |
412 |
|
return(-1); |
413 |
} |
} |
414 |
|
|
415 |
Bool_t CaloEnergy::IsInsideAcceptance(TString section, Bool_t fast){ |
Float_t CaloEnergy::GetMaxEnergy(TString section){ |
416 |
|
printf(" WARNING: OBSOLETE METHOD, use GetMipEnergy(TString) instead! \n"); |
417 |
|
return (this->GetMipEnergy(section)); |
418 |
|
} |
419 |
|
|
420 |
|
Float_t CaloEnergy::GetMipEnergy(TString section){ |
421 |
|
section.ToUpper(); |
422 |
|
if ( fLong ){ |
423 |
|
this->Process(section); |
424 |
|
return fXOen_maxplane; |
425 |
|
} else { |
426 |
|
if ( section.Contains("XO") ) return fXOen_maxplane; |
427 |
|
if ( section.Contains("XE") ) return fXEen_maxplane; |
428 |
|
if ( section.Contains("YO") ) return fYOen_maxplane; |
429 |
|
if ( section.Contains("YE") ) return fYEen_maxplane; |
430 |
|
}; |
431 |
|
return(-1); |
432 |
|
} |
433 |
|
|
434 |
|
Float_t CaloEnergy::GetEncol(Int_t i){ |
435 |
|
if ( fColumn > -1 && (((fXesel || fXosel)&&i==1) || ((fYesel || fYosel)&&i==0)) ){ |
436 |
|
Int_t t = -1; |
437 |
|
if ( i == 0 ){ |
438 |
|
if ( fColumn == 0 || fColumn == 3 || fColumn == 6 ) t = 0; |
439 |
|
if ( fColumn == 1 || fColumn == 4 || fColumn == 7 ) t = 1; |
440 |
|
if ( fColumn == 2 || fColumn == 5 || fColumn == 8 ) t = 2; |
441 |
|
} else { |
442 |
|
if ( fColumn == 0 || fColumn == 1 || fColumn == 2 ) t = 0; |
443 |
|
if ( fColumn == 3 || fColumn == 4 || fColumn == 5 ) t = 1; |
444 |
|
if ( fColumn == 6 || fColumn == 7 || fColumn == 8 ) t = 2; |
445 |
|
}; |
446 |
|
if ( debug ) printf(" encol: i %i t %i encol %f \n",i,t,encol[i][t]); |
447 |
|
return encol[i][t]; |
448 |
|
}; |
449 |
|
return(-1.); |
450 |
|
} |
451 |
|
|
452 |
|
Float_t CaloEnergy::GetMaxEnergy(){ |
453 |
|
printf(" WARNING: OBSOLETE METHOD, use GetMipEnergy() instead! \n"); |
454 |
|
return (this->GetMipEnergy()); |
455 |
|
} |
456 |
|
|
457 |
|
Float_t CaloEnergy::GetMipEnergy(){ |
458 |
|
if ( fLong ){ |
459 |
|
if ( debug ) printf(" oh! call process! with asntr %s and sntr %s \n",asntr.Data(),sntr.Data()); |
460 |
|
this->Process(asntr); |
461 |
|
}; |
462 |
|
return((fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane)); |
463 |
|
} |
464 |
|
|
465 |
|
|
466 |
|
Bool_t CaloEnergy::IsInsideAcceptance(TString section){ |
467 |
// |
// |
468 |
|
// check if the event is inside the acceptance of the given section(s) |
469 |
// |
// |
470 |
TString ntr = section; |
TString ntr = section; |
471 |
if ( !L2 ){ |
if ( !L2 ){ |
488 |
newentry = true; |
newentry = true; |
489 |
}; |
}; |
490 |
// |
// |
491 |
|
// if we have already called this method for this event and no input changed then return fSel and exit |
492 |
|
// |
493 |
if ( !newentry ) return fSel; |
if ( !newentry ) return fSel; |
494 |
// |
// |
495 |
|
// process the event |
496 |
|
// |
497 |
if ( debug ) printf(" ########## IsInsideAcceptance ######### \n"); |
if ( debug ) printf(" ########## IsInsideAcceptance ######### \n"); |
498 |
// |
// |
499 |
fSel = false; |
// clear variables |
500 |
|
// |
501 |
|
this->Clear(); |
502 |
|
// |
503 |
section.ToUpper(); |
section.ToUpper(); |
|
fXosel = false; |
|
|
fXesel = false; |
|
|
fYosel = false; |
|
|
fYesel = false; |
|
|
fCount = 0.; |
|
504 |
// |
// |
505 |
Int_t ss = Int_t(section.Contains("XO"))+Int_t(section.Contains("XE"))+Int_t(section.Contains("YO"))+Int_t(section.Contains("YE")); |
// Count the number of section(s) given as input |
506 |
if ( ss > 1 ) fast = false; |
// |
507 |
if ( !ss ){ |
Int_t fNumSec = Int_t(section.Contains("XO"))+Int_t(section.Contains("XE"))+Int_t(section.Contains("YO"))+Int_t(section.Contains("YE")); |
508 |
|
if ( !fNumSec ){ |
509 |
printf(" ERROR: section must be XO or XE or YO or YE while it is %s \n",section.Data()); |
printf(" ERROR: section must be XO or XE or YO or YE while it is %s \n",section.Data()); |
510 |
|
return false; |
511 |
|
}; |
512 |
|
// |
513 |
|
// If the presampler object exists then use the presampler output instead of the level2 output |
514 |
|
// |
515 |
|
CaloLevel2 *cl2 = NULL; |
516 |
|
if ( cp ){ |
517 |
|
cl2 = cp->GetCaloLevel2(); |
518 |
|
} else { |
519 |
|
cl2 = L2->GetCaloLevel2(); |
520 |
|
}; |
521 |
|
// |
522 |
|
// get the energy for every strip of the calorimeter |
523 |
|
// |
524 |
|
for (Int_t ch=0; ch< L2->GetCaloLevel1()->istrip; ch++){ |
525 |
|
en = L2->GetCaloLevel1()->DecodeEstrip(ch,view,plane,strip); |
526 |
|
enstrip[view][plane][strip]=en; |
527 |
|
}; |
528 |
|
// |
529 |
|
if ( debug && ((fM1+0.122-0.244*(Float_t)fRad) < 0.) ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad)); |
530 |
|
// |
531 |
|
// sum energy plane by plane for each sections |
532 |
|
// |
533 |
|
Float_t fen_xep[11]; |
534 |
|
Float_t fen_xop[11]; |
535 |
|
Float_t fen_yep[11]; |
536 |
|
Float_t fen_yop[11]; |
537 |
|
memset(fen_xep,0,11*sizeof(Float_t)); |
538 |
|
memset(fen_xop,0,11*sizeof(Float_t)); |
539 |
|
memset(fen_yep,0,11*sizeof(Float_t)); |
540 |
|
memset(fen_yop,0,11*sizeof(Float_t)); |
541 |
|
// |
542 |
|
for (Int_t i=0;i<11;i++){ |
543 |
|
for(strip=0; strip<96; strip++) { |
544 |
|
fen_xep[i] += enstrip[1][2*i][strip]; |
545 |
|
fen_yop[i] += enstrip[0][2*i][strip]; |
546 |
|
fen_xop[i] += enstrip[1][(2*i)+1][strip]; |
547 |
|
fen_yep[i] += enstrip[0][(2*i)+1][strip]; |
548 |
|
if ( fRad < 0 ){ |
549 |
|
// |
550 |
|
// run over all the strips of the plane |
551 |
|
// |
552 |
|
en_xep[i] += enstrip[1][2*i][strip]; |
553 |
|
en_yop[i] += enstrip[0][2*i][strip]; |
554 |
|
en_xop[i] += enstrip[1][(2*i)+1][strip]; |
555 |
|
en_yep[i] += enstrip[0][(2*i)+1][strip]; |
556 |
|
} else { |
557 |
|
// |
558 |
|
// use only the strips inside a cylinder of given radius fRad |
559 |
|
// |
560 |
|
if ( cl2->cibar[2*i][1] >= 1 && cl2->cibar[2*i][1] <= 96 && |
561 |
|
(strip >= (cl2->cibar[2*i][1]-1-fRad)) && (strip <= (cl2->cibar[2*i][1]-1+fRad)) ) en_xep[i] += enstrip[1][2*i][strip]; |
562 |
|
|
563 |
|
if ( cl2->cibar[2*i][0] >= 1 && cl2->cibar[2*i][0] <= 96 && |
564 |
|
(strip >= (cl2->cibar[2*i][0]-1-fRad)) && (strip <= (cl2->cibar[2*i][0]-1+fRad)) ) en_yop[i] += enstrip[0][2*i][strip]; |
565 |
|
|
566 |
|
if ( cl2->cibar[(2*i)+1][1] >= 1 && cl2->cibar[(2*i)+1][1] <= 96 && |
567 |
|
(strip >= (cl2->cibar[(2*i)+1][1]-1-fRad)) && (strip <= (cl2->cibar[(2*i)+1][1]-1+fRad)) ) en_xop[i] += enstrip[1][(2*i)+1][strip]; |
568 |
|
|
569 |
|
if ( cl2->cibar[(2*i)+1][0] >= 1 && cl2->cibar[(2*i)+1][0] <= 96 && |
570 |
|
(strip >= (cl2->cibar[(2*i)+1][0]-1-fRad)) && (strip <= (cl2->cibar[(2*i)+1][0]-1+fRad)) ) en_yep[i] += enstrip[0][(2*i)+1][strip]; |
571 |
|
}; |
572 |
|
}; |
573 |
|
if ( debug ) printf(" ex_xep[%i] %f cibar %i \n",i,en_xep[i],cl2->cibar[2*i][1]); |
574 |
|
if ( debug ) printf(" ex_xop[%i] %f cibar %i \n",i,en_xop[i],cl2->cibar[(2*i)+1][1]); |
575 |
|
if ( debug ) printf(" ex_yep[%i] %f cibar %i \n",i,en_yep[i],cl2->cibar[(2*i)+1][0]); |
576 |
|
if ( debug ) printf(" ex_yop[%i] %f cibar %i \n",i,en_yop[i],cl2->cibar[2*i][0]); |
577 |
|
energyxe += en_xep[i]; |
578 |
|
energyyo += en_yop[i]; |
579 |
|
energyxo += en_xop[i]; |
580 |
|
energyye += en_yep[i]; |
581 |
|
}; |
582 |
|
// |
583 |
|
// Find the plane of maximum for each section |
584 |
|
// |
585 |
|
// |
586 |
|
Int_t xen = 0; |
587 |
|
Int_t yon = 0; |
588 |
|
Int_t xon = 0; |
589 |
|
Int_t yen = 0; |
590 |
|
Float_t en = 0.; |
591 |
|
// |
592 |
|
if ( section.Contains("XE") ){ |
593 |
|
yon++; |
594 |
|
xon++; |
595 |
|
yen++; |
596 |
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
597 |
|
en = fen_xep[ipl]; |
598 |
|
if ( !fAllpl ) en = en_xep[ipl]; |
599 |
|
if(en > xemax_en) { |
600 |
|
xemax_en = en; |
601 |
|
fMax_planexe = ipl; |
602 |
|
}; |
603 |
|
}; |
604 |
|
}; |
605 |
|
// |
606 |
|
if ( section.Contains("YO") ){ |
607 |
|
xon++; |
608 |
|
yen++; |
609 |
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
610 |
|
en = fen_yop[ipl]; |
611 |
|
if ( !fAllpl ) en = en_yop[ipl]; |
612 |
|
if(en > yomax_en) { |
613 |
|
yomax_en = en; |
614 |
|
fMax_planeyo = ipl; |
615 |
|
}; |
616 |
|
}; |
617 |
|
}; |
618 |
|
// |
619 |
|
if ( section.Contains("XO") ){ |
620 |
|
yen++; |
621 |
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
622 |
|
en = fen_xop[ipl]; |
623 |
|
if ( !fAllpl ) en = en_xop[ipl]; |
624 |
|
if(en > xomax_en) { |
625 |
|
xomax_en = en; |
626 |
|
fMax_planexo = ipl; |
627 |
|
}; |
628 |
|
}; |
629 |
|
}; |
630 |
|
// |
631 |
|
if ( section.Contains("YE") ){ |
632 |
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
633 |
|
en = fen_yep[ipl]; |
634 |
|
if ( !fAllpl ) en = en_yep[ipl]; |
635 |
|
if(en > yemax_en) { |
636 |
|
yemax_en = en; |
637 |
|
fMax_planeye = ipl; |
638 |
|
}; |
639 |
|
}; |
640 |
|
}; |
641 |
|
// |
642 |
|
// the maximum is given externally as X0, convert it to plane and section |
643 |
|
// |
644 |
|
if ( x0max > 0. ){ |
645 |
|
if ( debug ) printf(" CALCULATE MAX PLANE GIVEN X0 ASSUMING PERPENDICULAR TRACK \n"); |
646 |
|
Int_t wpl = (Int_t)roundf(x0max/0.76); |
647 |
|
Bool_t isY = false; |
648 |
|
if ( ((x0max/0.76)-(Float_t)wpl) > 0. ) isY = true; |
649 |
|
xomax_en = 0.; |
650 |
|
yemax_en = 0.; |
651 |
|
xemax_en = 0.; |
652 |
|
yomax_en = 0.; |
653 |
|
// |
654 |
|
if ( !(wpl%2) ){ |
655 |
|
// 0, 2, 4, ... |
656 |
|
if ( isY ){ |
657 |
|
if ( section.Contains("YO") ) yomax_en = 1000.; |
658 |
|
if ( section.Contains("XE") ) xemax_en = 500.; |
659 |
|
fMax_planeyo=wpl/2; |
660 |
|
fMax_planexe=wpl/2; |
661 |
|
if ( section.Contains("XO") ) xomax_en = 10.; |
662 |
|
if ( section.Contains("YE") ) yemax_en = 5.; |
663 |
|
} else { |
664 |
|
if ( section.Contains("YO") ) yomax_en = 500.; |
665 |
|
if ( section.Contains("XE") ) xemax_en = 1000.; |
666 |
|
fMax_planeyo=wpl/2; |
667 |
|
fMax_planexe=wpl/2; |
668 |
|
if ( section.Contains("XO") ) xomax_en = 5.; |
669 |
|
if ( section.Contains("YE") ) yemax_en = 10.; |
670 |
|
}; |
671 |
|
} else { |
672 |
|
// 1, 3, 5, ... |
673 |
|
if ( isY ){ |
674 |
|
if ( section.Contains("YE") ) yemax_en = 1000.; |
675 |
|
if ( section.Contains("XO") ) xomax_en = 500.; |
676 |
|
fMax_planeye=(wpl-1)/2; |
677 |
|
fMax_planexo=(wpl-1)/2; |
678 |
|
if ( section.Contains("XE") ) xemax_en = 10.; |
679 |
|
if ( section.Contains("YO") ) yomax_en = 5.; |
680 |
|
} else { |
681 |
|
if ( section.Contains("YE") ) yemax_en = 500.; |
682 |
|
if ( section.Contains("XO") ) xomax_en = 1000.; |
683 |
|
fMax_planeye=(wpl-1)/2; |
684 |
|
fMax_planexo=(wpl-1)/2; |
685 |
|
if ( section.Contains("XE") ) xemax_en = 5.; |
686 |
|
if ( section.Contains("YO") ) yomax_en = 10.; |
687 |
|
}; |
688 |
|
}; |
689 |
|
if ( debug ) printf(" x0max %f x0max/0.76 %f wpl %i isY %i yomax_en %f xemax_en %f yemax_en %f xomax_en %f fMaxplane %i %i %i %i\n",x0max,(x0max/0.76),wpl,isY,yomax_en,xemax_en,yemax_en,xomax_en,fMax_planeyo,fMax_planexe,fMax_planeye,fMax_planexo); |
690 |
|
}; |
691 |
|
// |
692 |
|
Int_t nPl = fPl; |
693 |
|
// |
694 |
|
// Set the maximum in case of coherent mode was selected |
695 |
|
// |
696 |
|
if ( !indep ){ |
697 |
|
nPl = 0; |
698 |
|
if ( debug ) printf(" A: Check maximum, coherent mode: xoen %f yoen %f xeen %f yeen %f xomax %i yomax %i xemax %i yemax %i\n",xomax_en,yomax_en,xemax_en,yemax_en,fMax_planexo,fMax_planeyo,fMax_planexe,fMax_planeye); |
699 |
|
Int_t nummod = 0; |
700 |
|
Int_t numexpl = 0; |
701 |
|
if ( xomax_en > xemax_en && xomax_en > yemax_en && xomax_en > yomax_en ){ |
702 |
|
// |
703 |
|
// Section XO contains the maximum energy release per plane of the whole calorimeter |
704 |
|
// |
705 |
|
if ( debug ) printf(" XO is MAX %i %i %i %i\n",xen,yon,xon,yen); |
706 |
|
// |
707 |
|
// fMax_plane is the plane of maximum + number of additional dE/dx measurement counting planes from 0 to 43 |
708 |
|
// |
709 |
|
fMax_plane = (fNumSec * fMax_planexo) +(Float_t)xon + fPl; |
710 |
|
// |
711 |
|
// nummod is the integer part of the number of modules in which the maximum is contained |
712 |
|
// |
713 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
714 |
|
// |
715 |
|
// numexpl is the number of additional planes (0,1,2) inside the module |
716 |
|
// |
717 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
718 |
|
// |
719 |
|
}; |
720 |
|
if ( xemax_en > xomax_en && xemax_en > yemax_en && xemax_en > yomax_en ){ |
721 |
|
if ( debug ) printf(" XE is MAX %i %i %i %i\n",xen,yon,xon,yen); |
722 |
|
fMax_plane = (fNumSec * fMax_planexe) +(Float_t)xen + fPl; |
723 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
724 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
725 |
|
// |
726 |
|
}; |
727 |
|
|
728 |
|
if ( yemax_en > xomax_en && yemax_en > xemax_en && yemax_en > yomax_en ){ |
729 |
|
if ( debug ) printf(" YE is MAX %i %i %i %i\n",xen,yon,xon,yen); |
730 |
|
fMax_plane = (fNumSec * fMax_planeye) +(Float_t)yen + fPl; |
731 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
732 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
733 |
|
// |
734 |
|
}; |
735 |
|
if ( yomax_en > xemax_en && yomax_en > yemax_en && yomax_en > xomax_en ){ |
736 |
|
if ( debug ) printf(" YO is MAX %i %i %i %i\n",xen,yon,xon,yen); |
737 |
|
fMax_plane = (fNumSec * fMax_planeyo) +(Float_t)yon + fPl; |
738 |
|
nummod = (Int_t)(((Float_t)fMax_plane)/(Float_t)fNumSec); |
739 |
|
numexpl = (Int_t)((Float_t)fMax_plane-(Float_t)fNumSec*(Float_t)nummod); |
740 |
|
// |
741 |
|
}; |
742 |
|
// |
743 |
|
// find the plane up to which is necessary to integrate the energy for each section |
744 |
|
// |
745 |
|
Int_t a = 0; |
746 |
|
Int_t b = 0; |
747 |
|
Int_t c = 0; |
748 |
|
if ( numexpl > xen ) a = 1; |
749 |
|
if ( numexpl > yon ) b = 1; |
750 |
|
if ( numexpl > xon ) c = 1; |
751 |
|
fMax_planexe = nummod; |
752 |
|
fMax_planeyo = nummod - 1 + a; |
753 |
|
fMax_planexo = nummod - 1 + b; |
754 |
|
fMax_planeye = nummod - 1 + c; |
755 |
|
if ( debug ) printf(" fMax_plane %f nummod %i numexpl %i a %i b %i c %i \n",fMax_plane,nummod,numexpl,a,b,c); |
756 |
|
if ( debug ) printf(" DONE: Check maximum, coherent mode: xoen %f yoen %f xeen %f yeen %f xomax %i yomax %i xemax %i yemax %i\n",xomax_en,yomax_en,xemax_en,yemax_en,fMax_planexo,fMax_planeyo,fMax_planexe,fMax_planeye); |
757 |
}; |
}; |
758 |
// |
// |
759 |
Float_t track_coordx[22][2]; |
// for each plane of the calorimeter find the position of the track in the direction along the strip (where we do not have a measurement from the selected plane) by looking at the plane above/below of the other view and extrapolating the trajectory to the given plane |
760 |
Float_t track_coordy[22][2]; |
// |
761 |
// |
// |
762 |
Float_t tgx_cl2; |
Float_t tgx_cl2; |
763 |
Float_t tgy_cl2; |
Float_t tgy_cl2; |
764 |
tgx_cl2 = L2->GetCaloLevel2()->tanx[0]; |
tgx_cl2 = cl2->tanx[0]; |
765 |
tgy_cl2 = L2->GetCaloLevel2()->tany[0]; |
tgy_cl2 = cl2->tany[0]; |
766 |
// |
// |
767 |
for (Int_t p=0; p<22; p++){ |
for (Int_t p=0; p<22; p++){ |
768 |
track_coordy[p][1] = L2->GetCaloLevel2()->cbar[p][1]; |
track_coordy[p][1] = cl2->cbar[p][1]; |
769 |
track_coordx[p][1] = L2->GetCaloLevel2()->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
track_coordx[p][1] = cl2->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
770 |
track_coordx[p][0] = L2->GetCaloLevel2()->cbar[p][0]; |
// track_coordx[p][1] = cl2->cbar[p][0] + fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2; |
771 |
track_coordy[p][0] = L2->GetCaloLevel2()->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
track_coordx[p][0] = cl2->cbar[p][0]; |
772 |
|
track_coordy[p][0] = cl2->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
773 |
|
// track_coordy[p][0] = cl2->cbar[p][1] + fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2; |
774 |
if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]); |
if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]); |
775 |
}; |
}; |
776 |
// |
// |
777 |
if ( debug ) printf(" acceptance fast %i ss %i tgx %f tgy %f\n",fast,ss,tgx_cl2,tgy_cl2); |
if ( debug ) printf(" acceptance fNumSec %i tgx %f tgy %f\n",fNumSec,tgx_cl2,tgy_cl2); |
778 |
// |
// |
779 |
if ( section.Contains("XO") ){ |
if ( section.Contains("XO") ){ |
780 |
|
// |
781 |
|
// find the column hit in the first plane |
782 |
|
// |
783 |
|
Int_t ix = -1; |
784 |
|
Int_t iy = -1; |
785 |
|
if ( track_coordx[(2*0)+1][1] >= (-12.054+fM) && track_coordx[(2*0)+1][1] <= (-4.246-fM) ) ix = 0; |
786 |
|
if ( track_coordx[(2*0)+1][1] >= ( -4.004+fM) && track_coordx[(2*0)+1][1] <= ( 3.804-fM) ) ix = 1; |
787 |
|
if ( track_coordx[(2*0)+1][1] >= ( 4.046+fM) && track_coordx[(2*0)+1][1] <= (11.854-fM) ) ix = 2; |
788 |
|
if ( cl2->cbar[(2*0)+1][1] >= (xo1 + fM1) && cl2->cbar[(2*0)+1][1] <= (xo2 - fM1) ) iy = 0; |
789 |
|
if ( cl2->cbar[(2*0)+1][1] >= (xo3 + fM1) && cl2->cbar[(2*0)+1][1] <= (xo4 - fM1) ) iy = 1; |
790 |
|
if ( cl2->cbar[(2*0)+1][1] >= (xo5 + fM1) && cl2->cbar[(2*0)+1][1] <= (xo6 - fM1) ) iy = 2; |
791 |
|
if ( ix > -1 && iy > -1 ) fColXO = ix + iy*3; |
792 |
|
// |
793 |
|
// check event is inside XO acceptance, if multicol is false (SingleColumn mode) then the track must be contained in a column. |
794 |
|
// |
795 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
796 |
if |
if (( |
797 |
( |
( track_coordx[(2*i)+1][1] >= (-12.054+fM) && track_coordx[(2*i)+1][1] <= (-4.246-fM) && (ix == 0 || multicol) ) || |
798 |
(((track_coordx[2*i+1][1]>=(-12.054+fM))&& |
( track_coordx[(2*i)+1][1] >= ( -4.004+fM) && track_coordx[(2*i)+1][1] <= ( 3.804-fM) && (ix == 1 || multicol) ) || |
799 |
(track_coordx[2*i+1][1]<=(-4.246-fM)))&& |
( track_coordx[(2*i)+1][1] >= ( 4.046+fM) && track_coordx[(2*i)+1][1] <= (11.854-fM) && (ix == 2 || multicol) ) |
800 |
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
) && ( |
801 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
( cl2->cbar[(2*i)+1][1] >= (xo1 + fM1) && cl2->cbar[(2*i)+1][1] <= (xo2 - fM1) && (iy == 0 || multicol) ) || |
802 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
( cl2->cbar[(2*i)+1][1] >= (xo3 + fM1) && cl2->cbar[(2*i)+1][1] <= (xo4 - fM1) && (iy == 1 || multicol) ) || |
803 |
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
( cl2->cbar[(2*i)+1][1] >= (xo5 + fM1) && cl2->cbar[(2*i)+1][1] <= (xo6 - fM1) && (iy == 2 || multicol) ) |
804 |
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
)){ |
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordx[2*i+1][1]>=(-4.004+fM))&& |
|
|
(track_coordx[2*i+1][1]<=(3.804-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordx[2*i+1][1]>=(4.046+fM))&& |
|
|
(track_coordx[2*i+1][1]<=(11.854-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo2 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo4 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][1]>=xo5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][1]<=xo6 - fM1 )))) |
|
|
){ |
|
805 |
fXosel = true; |
fXosel = true; |
806 |
|
fXoout = i; |
807 |
} else { |
} else { |
|
if ( fast ) return false; |
|
808 |
fXosel = false; |
fXosel = false; |
809 |
break; |
break; |
810 |
}; |
}; |
811 |
}; |
}; |
812 |
|
// |
813 |
|
// if it goes out of the acceptance BUT the plane up to which we are integrating the energy is contained then the event is "partially" contained |
814 |
|
// |
815 |
|
if ( !fXosel && fXoout >= fXomin && fXoout >= (Int_t)(fMax_planexo+nPl) ){ |
816 |
|
if ( debug ) printf(" XO: this event is only partially contained: fXoout %i fXomin %i fMax_planexo + nPl %i \n",fXoout,fXomin,(Int_t)(fMax_planexo+nPl)); |
817 |
|
fPartsel = true; |
818 |
|
fXosel = true; |
819 |
|
}; |
820 |
|
// |
821 |
|
// event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section |
822 |
|
// |
823 |
|
if ( fXosel ){ |
824 |
|
for (Int_t iplm=0; iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)); iplm++){ |
825 |
|
fXOen_maxplane += en_xop[iplm]; |
826 |
|
if ( debug ) printf(" XO iplm %i fXOen_maxplane %f en_xop[iplm] %f\n",iplm,fXOen_maxplane,en_xop[iplm]); |
827 |
|
}; |
828 |
|
fEnergyxo = fXOen_maxplane/fConv_rxo; |
829 |
|
// |
830 |
|
for (Int_t i=0;i<11;i++){ |
831 |
|
for(strip=0; strip<96; strip++) { |
832 |
|
// |
833 |
|
// run over all the strips of the plane |
834 |
|
// |
835 |
|
if ( strip >= 0 && strip < 32 ) encol[1][0] += enstrip[1][(2*i)+1][strip]; |
836 |
|
if ( strip >= 32 && strip < 64 ) encol[1][1] += enstrip[1][(2*i)+1][strip]; |
837 |
|
if ( strip >= 64 && strip < 96 ) encol[1][2] += enstrip[1][(2*i)+1][strip]; |
838 |
|
entot[1] += enstrip[1][(2*i)+1][strip]; |
839 |
|
// |
840 |
|
}; |
841 |
|
}; |
842 |
|
}; |
843 |
}; |
}; |
844 |
// |
// |
845 |
if ( section.Contains("XE") ){ |
if ( section.Contains("XE") ){ |
846 |
|
// |
847 |
|
// find the column hit in the first plane |
848 |
|
// |
849 |
|
Int_t ix = -1; |
850 |
|
Int_t iy = -1; |
851 |
|
if ( track_coordx[(2*0)][1] >= (-11.854+fM) && track_coordx[(2*0)][1] <= (-4.046-fM) ) ix = 0; |
852 |
|
if ( track_coordx[(2*0)][1] >= ( -3.804+fM) && track_coordx[(2*0)][1] <= ( 4.004-fM) ) ix = 1; |
853 |
|
if ( track_coordx[(2*0)][1] >= ( 4.246+fM) && track_coordx[(2*0)][1] <= (12.054-fM) ) ix = 2; |
854 |
|
if ( cl2->cbar[(2*0)][1] >= (xe1 + fM1) && cl2->cbar[(2*0)][1] <= (xe2 - fM1) ) iy = 0; |
855 |
|
if ( cl2->cbar[(2*0)][1] >= (xe3 + fM1) && cl2->cbar[(2*0)][1] <= (xe4 - fM1) ) iy = 1; |
856 |
|
if ( cl2->cbar[(2*0)][1] >= (xe5 + fM1) && cl2->cbar[(2*0)][1] <= (xe6 - fM1) ) iy = 2; |
857 |
|
if ( ix > -1 && iy > -1 ) fColXE = ix + iy*3; |
858 |
|
// |
859 |
|
// check event is inside XO acceptance |
860 |
|
// |
861 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
862 |
if |
if (( |
863 |
( |
( track_coordx[(2*i)][1] >= (-11.854+fM) && track_coordx[(2*i)][1] <= (-4.046-fM) && (ix == 0 || multicol) ) || |
864 |
(((track_coordx[2*i][1]>=(-11.854+fM))&& |
( track_coordx[(2*i)][1] >= ( -3.804+fM) && track_coordx[(2*i)][1] <= ( 4.004-fM) && (ix == 1 || multicol) ) || |
865 |
(track_coordx[2*i][1]<=(-4.046-fM)))&& |
( track_coordx[(2*i)][1] >= ( 4.246+fM) && track_coordx[(2*i)][1] <= (12.054-fM) && (ix == 2 || multicol) ) |
866 |
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
) && ( |
867 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1 ))|| |
( cl2->cbar[(2*i)][1] >= (xe1 + fM1) && cl2->cbar[(2*i)][1] <= (xe2 - fM1) && (iy == 0 || multicol) ) || |
868 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
( cl2->cbar[(2*i)][1] >= (xe3 + fM1) && cl2->cbar[(2*i)][1] <= (xe4 - fM1) && (iy == 1 || multicol) ) || |
869 |
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1 ))|| |
( cl2->cbar[(2*i)][1] >= (xe5 + fM1) && cl2->cbar[(2*i)][1] <= (xe6 - fM1) && (iy == 2 || multicol) ) |
870 |
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
)){ |
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordx[2*i][1]>=(-3.804+fM))&& |
|
|
(track_coordx[2*i][1]<=(4.004-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordx[2*i][1]>=(4.246+fM))&& |
|
|
(track_coordx[2*i][1]<=(12.054-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i][1]>=xe1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe2 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe4 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][1]>=xe5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][1]<=xe6 - fM1 )))) |
|
|
){ |
|
871 |
fXesel = true; |
fXesel = true; |
872 |
|
fXeout = i; |
873 |
} else { |
} else { |
|
if ( fast ) return false; |
|
874 |
fXesel = false; |
fXesel = false; |
875 |
break; |
break; |
876 |
}; |
}; |
877 |
}; |
}; |
878 |
|
// |
879 |
|
if ( !fXesel && fXeout >= fXemin && fXeout >= (Int_t)(fMax_planexe+nPl) ){ |
880 |
|
if ( debug ) printf(" XE: this event is only partially contained: fXeout %i fXemin %i fMax_planexe + nPl %i \n",fXeout,fXemin,(Int_t)(fMax_planexe+nPl)); |
881 |
|
fPartsel = true; |
882 |
|
fXesel = true; |
883 |
|
}; |
884 |
|
if ( fXesel ){ |
885 |
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++){ |
886 |
|
fXEen_maxplane += en_xep[iplm]; |
887 |
|
if ( debug ) printf(" XE iplm %i fXOen_maxplane %f en_xop[iplm] %f\n",iplm,fXEen_maxplane,en_xep[iplm]); |
888 |
|
}; |
889 |
|
fEnergyxe = fXEen_maxplane/fConv_rxe; |
890 |
|
// |
891 |
|
for (Int_t i=0;i<11;i++){ |
892 |
|
for(strip=0; strip<96; strip++) { |
893 |
|
// |
894 |
|
// run over all the strips of the plane |
895 |
|
// |
896 |
|
if ( strip >= 0 && strip < 32 ) encol[1][0] += enstrip[1][(2*i)][strip]; |
897 |
|
if ( strip >= 32 && strip < 64 ) encol[1][1] += enstrip[1][(2*i)][strip]; |
898 |
|
if ( strip >= 64 && strip < 96 ) encol[1][2] += enstrip[1][(2*i)][strip]; |
899 |
|
entot[1] += enstrip[1][(2*i)][strip]; |
900 |
|
// |
901 |
|
}; |
902 |
|
}; |
903 |
|
}; |
904 |
}; |
}; |
905 |
// |
// |
906 |
if ( section.Contains("YE") ){ |
if ( section.Contains("YE") ){ |
907 |
|
// |
908 |
|
// find the column hit in the first plane |
909 |
|
// |
910 |
|
Int_t ix = -1; |
911 |
|
Int_t iy = -1; |
912 |
|
if ( track_coordy[(2*0)+1][0] >= (-12.154+fM) && track_coordy[(2*0)+1][0] <= (-4.346-fM) ) iy = 0; |
913 |
|
if ( track_coordy[(2*0)+1][0] >= ( -4.104+fM) && track_coordy[(2*0)+1][0] <= ( 3.704-fM) ) iy = 1; |
914 |
|
if ( track_coordy[(2*0)+1][0] >= ( 3.946+fM) && track_coordy[(2*0)+1][0] <= (11.754-fM) ) iy = 2; |
915 |
|
if ( cl2->cbar[(2*0)+1][0] >= (ye1 + fM1) && cl2->cbar[(2*0)+1][0] <= (ye2 - fM1) ) ix = 0; |
916 |
|
if ( cl2->cbar[(2*0)+1][0] >= (ye3 + fM1) && cl2->cbar[(2*0)+1][0] <= (ye4 - fM1) ) ix = 1; |
917 |
|
if ( cl2->cbar[(2*0)+1][0] >= (ye5 + fM1) && cl2->cbar[(2*0)+1][0] <= (ye6 - fM1) ) ix = 2; |
918 |
|
if ( ix > -1 && iy > -1 ) fColYE = ix + iy*3; |
919 |
|
// |
920 |
|
// check event is inside XO acceptance |
921 |
|
// |
922 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
923 |
if |
if (( |
924 |
( |
( track_coordy[(2*i)+1][0] >= (-12.154+fM) && track_coordy[(2*i)+1][0] <= (-4.346-fM) && (iy == 0 || multicol) ) || |
925 |
(((track_coordy[2*i+1][0]>=(-12.154+fM))&& |
( track_coordy[(2*i)+1][0] >= ( -4.104+fM) && track_coordy[(2*i)+1][0] <= ( 3.704-fM) && (iy == 1 || multicol) ) || |
926 |
(track_coordy[2*i+1][0]<=(-4.346-fM)))&& |
( track_coordy[(2*i)+1][0] >= ( 3.946+fM) && track_coordy[(2*i)+1][0] <= (11.754-fM) && (iy == 2 || multicol) ) |
927 |
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
) && ( |
928 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
( cl2->cbar[(2*i)+1][0] >= (ye1 + fM1) && cl2->cbar[(2*i)+1][0] <= (ye2 - fM1) && (ix == 0 || multicol) ) || |
929 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
( cl2->cbar[(2*i)+1][0] >= (ye3 + fM1) && cl2->cbar[(2*i)+1][0] <= (ye4 - fM1) && (ix == 1 || multicol) ) || |
930 |
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
( cl2->cbar[(2*i)+1][0] >= (ye5 + fM1) && cl2->cbar[(2*i)+1][0] <= (ye6 - fM1) && (ix == 2 || multicol) ) |
931 |
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
)){ |
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordy[2*i+1][0]>=(-4.104+fM))&& |
|
|
(track_coordy[2*i+1][0]<=(3.704-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordy[2*i+1][0]>=(3.946+fM))&& |
|
|
(track_coordy[2*i+1][0]<=(11.754-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye2 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye4 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i+1][0]>=ye5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i+1][0]<=ye6 - fM1 )))) |
|
|
){ |
|
932 |
fYesel = true; |
fYesel = true; |
933 |
|
fYeout = i; |
934 |
} else { |
} else { |
|
if ( fast ) return false; |
|
935 |
fYesel = false; |
fYesel = false; |
936 |
break; |
break; |
937 |
}; |
}; |
938 |
}; |
}; |
939 |
|
// |
940 |
|
if ( !fYesel && fYeout >= fYemin && fYeout >= (Int_t)(fMax_planeye+nPl) ){ |
941 |
|
if ( debug ) printf(" YE: this event is only partially contained: fYeout %i fYemin %i fMax_planeye + nPl %i \n",fYeout,fYemin,(Int_t)(fMax_planeye+nPl)); |
942 |
|
fPartsel = true; |
943 |
|
fYesel = true; |
944 |
|
}; |
945 |
|
if ( fYesel ){ |
946 |
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeye+nPl)) ;iplm++) fYEen_maxplane += en_yep[iplm]; |
947 |
|
fEnergyye = fYEen_maxplane/fConv_rye; |
948 |
|
// |
949 |
|
for (Int_t i=0;i<11;i++){ |
950 |
|
for(strip=0; strip<96; strip++) { |
951 |
|
// |
952 |
|
// run over all the strips of the plane |
953 |
|
// |
954 |
|
if ( strip >= 0 && strip < 32 ) encol[0][0] += enstrip[0][(2*i)+1][strip]; |
955 |
|
if ( strip >= 32 && strip < 64 ) encol[0][1] += enstrip[0][(2*i)+1][strip]; |
956 |
|
if ( strip >= 64 && strip < 96 ) encol[0][2] += enstrip[0][(2*i)+1][strip]; |
957 |
|
entot[0] += enstrip[0][(2*i)+1][strip]; |
958 |
|
// |
959 |
|
}; |
960 |
|
}; |
961 |
|
// |
962 |
|
}; |
963 |
}; |
}; |
964 |
// |
// |
965 |
if ( section.Contains("YO") ){ |
if ( section.Contains("YO") ){ |
966 |
|
// |
967 |
|
// find the column hit in the first plane |
968 |
|
// |
969 |
|
Int_t ix = -1; |
970 |
|
Int_t iy = -1; |
971 |
|
if ( track_coordy[(2*0)][0] >= (-11.954+fM) && track_coordy[(2*0)][0] <= (-4.146-fM) ) iy = 0; |
972 |
|
if ( track_coordy[(2*0)][0] >= ( -3.904+fM) && track_coordy[(2*0)][0] <= ( 3.904-fM) ) iy = 1; |
973 |
|
if ( track_coordy[(2*0)][0] >= ( 4.146+fM) && track_coordy[(2*0)][0] <= (11.954-fM) ) iy = 2; |
974 |
|
if ( cl2->cbar[(2*0)][0] >= (yo1 + fM1) && cl2->cbar[(2*0)][0] <= (yo2 - fM1) ) ix = 0; |
975 |
|
if ( cl2->cbar[(2*0)][0] >= (yo3 + fM1) && cl2->cbar[(2*0)][0] <= (yo4 - fM1) ) ix = 1; |
976 |
|
if ( cl2->cbar[(2*0)][0] >= (yo5 + fM1) && cl2->cbar[(2*0)][0] <= (yo6 - fM1) ) ix = 2; |
977 |
|
if ( ix > -1 && iy > -1 ) fColYO = ix + iy*3; |
978 |
|
// |
979 |
|
// check event is inside XO acceptance |
980 |
|
// |
981 |
for (Int_t i=0; i<11; i++) { |
for (Int_t i=0; i<11; i++) { |
982 |
if ( debug ) printf(" i %i track_coordy[2*i][0] %f L2->GetCaloLevel2()->cbar[2*i][0] %f \n",i,track_coordy[2*i][0],L2->GetCaloLevel2()->cbar[2*i][0]); |
if (( |
983 |
if ( debug ) printf(" i %i fm %f fm1 %f yo1 %g yo2 %f yo3 %f yo4 %f yo5 %f yo6 %f \n",i,fM,fM1,yo1,yo2,yo3,yo4,yo5,yo6); |
( track_coordy[(2*i)][0] >= (-11.954+fM) && track_coordy[(2*i)][0] <= (-4.146-fM) && (iy == 0 || multicol) ) || |
984 |
if |
( track_coordy[(2*i)][0] >= ( -3.904+fM) && track_coordy[(2*i)][0] <= ( 3.904-fM) && (iy == 1 || multicol) ) || |
985 |
( |
( track_coordy[(2*i)][0] >= ( 4.146+fM) && track_coordy[(2*i)][0] <= (11.954-fM) && (iy == 2 || multicol) ) |
986 |
(((track_coordy[2*i][0]>=(-11.954+fM))&& |
) && ( |
987 |
(track_coordy[2*i][0]<=(-4.146-fM)))&& |
( cl2->cbar[(2*i)][0] >= (yo1 + fM1) && cl2->cbar[(2*i)][0] <= (yo2 - fM1) && (ix == 0 || multicol) ) || |
988 |
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
( cl2->cbar[(2*i)][0] >= (yo3 + fM1) && cl2->cbar[(2*i)][0] <= (yo4 - fM1) && (ix == 1 || multicol) ) || |
989 |
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1 ))|| |
( cl2->cbar[(2*i)][0] >= (yo5 + fM1) && cl2->cbar[(2*i)][0] <= (yo6 - fM1) && (ix == 2 || multicol) ) |
990 |
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
)){ |
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordy[2*i][0]>=(-3.904+fM))&& |
|
|
(track_coordy[2*i][0]<=(+3.904-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 ))))|| |
|
|
|
|
|
(((track_coordy[2*i][0]>=(4.146+fM))&& |
|
|
(track_coordy[2*i][0]<=(11.954-fM)))&& |
|
|
(((L2->GetCaloLevel2()->cbar[2*i][0]>=yo1 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo2 - fM1))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo3 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo4 - fM1 ))|| |
|
|
((L2->GetCaloLevel2()->cbar[2*i][0]>=yo5 + fM1)&& |
|
|
(L2->GetCaloLevel2()->cbar[2*i][0]<=yo6 - fM1 )))) |
|
|
){ |
|
991 |
fYosel = true; |
fYosel = true; |
992 |
|
fYoout = i; |
993 |
} else { |
} else { |
|
if ( fast ) return false; |
|
994 |
fYosel = false; |
fYosel = false; |
995 |
break; |
break; |
996 |
}; |
}; |
997 |
}; |
}; |
998 |
|
// |
999 |
|
if ( !fYosel && fYoout >= fYomin && fYoout >= (Int_t)(fMax_planeyo+nPl) ){ |
1000 |
|
if ( debug ) printf(" YO: this event is only partially contained: fYoout %i fYomin %i fMax_planeyo + nPl %i \n",fYoout,fYomin,(Int_t)(fMax_planeyo+nPl)); |
1001 |
|
fPartsel = true; |
1002 |
|
fYosel = true; |
1003 |
|
}; |
1004 |
|
if ( fYosel ){ |
1005 |
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeyo+nPl)) ;iplm++) fYOen_maxplane += en_yop[iplm]; |
1006 |
|
fEnergyyo = fYOen_maxplane/fConv_ryo; |
1007 |
|
// |
1008 |
|
for (Int_t i=0;i<11;i++){ |
1009 |
|
for(strip=0; strip<96; strip++) { |
1010 |
|
// |
1011 |
|
// run over all the strips of the plane |
1012 |
|
// |
1013 |
|
if ( strip >= 0 && strip < 32 ) encol[0][0] += enstrip[0][(2*i)][strip]; |
1014 |
|
if ( strip >= 32 && strip < 64 ) encol[0][1] += enstrip[0][(2*i)][strip]; |
1015 |
|
if ( strip >= 64 && strip < 96 ) encol[0][2] += enstrip[0][(2*i)][strip]; |
1016 |
|
entot[0] += enstrip[0][(2*i)][strip]; |
1017 |
|
// |
1018 |
|
}; |
1019 |
|
}; |
1020 |
|
}; |
1021 |
}; |
}; |
1022 |
// |
// |
1023 |
fSel = ( fXesel || fYesel || fXosel || fYosel ); |
// Count the number of sections in which the event is contained |
1024 |
|
// |
1025 |
fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel); |
fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel); |
1026 |
|
// |
1027 |
|
if ( indep ){ |
1028 |
|
// |
1029 |
|
// independent mode, average the energy measurement and max plane of the contained sections |
1030 |
|
// |
1031 |
|
fSel = ( fXesel || fYesel || fXosel || fYosel ); |
1032 |
|
fMax_plane = (Float_t)(fMax_planeyo+fMax_planeye+fMax_planexo+fMax_planexe)/fCount; |
1033 |
|
fEnergy = (fEnergyxe+fEnergyyo+fEnergyye+fEnergyxo)/fCount; |
1034 |
|
// |
1035 |
|
} else { |
1036 |
|
// |
1037 |
|
// coherent mode, sum the energy [MIP] of the given sections and convert using fConv_rxo. **** NB: it is assumed that the conversion factor is unique and the method SetConvertionFactor(Float_t) has been used**** The event is selected only if it is contained in all the given sections |
1038 |
|
// |
1039 |
|
if ( fCount != fNumSec ){ |
1040 |
|
fSel = false; |
1041 |
|
} else { |
1042 |
|
fSel = true; |
1043 |
|
}; |
1044 |
|
fEnergy = (fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane)/fConv_rxo; |
1045 |
|
if ( fSel ){ |
1046 |
|
if ( fXesel ) fColumn = fColXE; |
1047 |
|
if ( fXosel ){ |
1048 |
|
if ( fColXO != fColumn && fColumn > -1 ){ |
1049 |
|
printf(" ERROR! mismatch in column number between different sections! fColumn %i fColXO %i \n",fColumn,fColXO); |
1050 |
|
} else { |
1051 |
|
fColumn = fColXO; |
1052 |
|
}; |
1053 |
|
}; |
1054 |
|
if ( fYesel ){ |
1055 |
|
if ( fColYE != fColumn && fColumn > -1 ){ |
1056 |
|
printf(" ERROR! mismatch in column number between different sections! fColumn %i fColYE %i \n",fColumn,fColYE); |
1057 |
|
} else { |
1058 |
|
fColumn = fColYE; |
1059 |
|
}; |
1060 |
|
}; |
1061 |
|
if ( fYosel ){ |
1062 |
|
if ( fColYO != fColumn && fColumn > -1 ){ |
1063 |
|
printf(" ERROR! mismatch in column number between different sections! fColumn %i fColYO %i \n",fColumn,fColYO); |
1064 |
|
} else { |
1065 |
|
fColumn = fColYO; |
1066 |
|
}; |
1067 |
|
}; |
1068 |
|
}; |
1069 |
|
}; |
1070 |
|
// |
1071 |
|
if ( debug ) printf("sel %i indep %i fMax_plane %f conv_r %f en_maxplane %f encalo %f \n",fSel,indep,fMax_plane,fConv_rxo,fXOen_maxplane,fEnergy); |
1072 |
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel); |
1073 |
// |
// |
1074 |
|
// finish exit |
1075 |
|
// |
1076 |
return fSel; |
return fSel; |
1077 |
// |
// |
1078 |
} |
} |
1085 |
|
|
1086 |
void CaloEnergy::Process(TString section){ |
void CaloEnergy::Process(TString section){ |
1087 |
// |
// |
1088 |
|
// process the event |
1089 |
|
// |
1090 |
TString ntr = section; |
TString ntr = section; |
1091 |
if ( !L2 ){ |
if ( !L2 ){ |
1092 |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
1108 |
newentry = true; |
newentry = true; |
1109 |
}; |
}; |
1110 |
// |
// |
1111 |
|
// if we have already called this method for this event and no input changed then return fSel and exit |
1112 |
|
// |
1113 |
if ( !newentry ) return; |
if ( !newentry ) return; |
1114 |
// |
// |
1115 |
|
// process the event |
1116 |
|
// |
1117 |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u section %s\n",OBT,PKT,atime,section.Data()); |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u section %s\n",OBT,PKT,atime,section.Data()); |
1118 |
// |
// |
1119 |
Clear(); |
// check if the cylinder of integration can go out of the sensor given the frame which has been set (if we use all the calorimeter fRad is < 0 and the printout is suppressed) |
1120 |
// |
// |
1121 |
if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad)); |
if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad)); |
1122 |
// |
// |
1123 |
if ( fLong ){ |
if ( fLong ){ |
1124 |
// use long fit to measure energy |
if ( debug ) printf(" ==================================================================> LONGITUDINAL FIT! \n"); |
1125 |
} else { |
// |
1126 |
|
// use long fit to measure energy |
1127 |
// |
// |
1128 |
if ( this->IsInsideAcceptance(section) ){ |
if ( this->IsInsideAcceptance(section) ){ |
1129 |
// |
// |
1130 |
for (Int_t ch=0; ch< L2->GetCaloLevel1()->istrip; ch++){ |
if ( debug ) printf(" ==================================================================> LONG INSIDE! \n"); |
1131 |
en = L2->GetCaloLevel1()->DecodeEstrip(ch,view,plane,strip); |
// |
1132 |
enstrip[view][plane][strip]=en; |
Float_t myene[2][22]; |
1133 |
}; |
memset(myene,0,(sizeof(Float_t))*2*22); |
1134 |
for (Int_t i=0;i<11;i++){ |
for (Int_t j=0; j<11; j++){ |
1135 |
for(strip=0; strip<96; strip++) { |
if ( section.Contains("XE") ) myene[1][2*j] = en_xep[j]; |
1136 |
if ( fRad < 0 ){ |
if ( section.Contains("YO") ) myene[0][2*j] = en_yop[j]; |
1137 |
en_xep[i] += enstrip[1][2*i][strip]; |
if ( section.Contains("XO") ) myene[1][(2*j)+1] = en_xop[j]; |
1138 |
en_yop[i] += enstrip[0][2*i][strip]; |
if ( section.Contains("YE") ) myene[0][(2*j)+1] = en_yep[j]; |
|
en_xop[i] += enstrip[1][2*i+1][strip]; |
|
|
en_yep[i] += enstrip[0][2*i+1][strip]; |
|
|
} else { |
|
|
if ( strip >= L2->GetCaloLevel2()->cibar[2*i][1]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i][1]-1+fRad ) en_xep[i] += enstrip[1][2*i][strip]; |
|
|
if ( strip >= L2->GetCaloLevel2()->cibar[2*i][0]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i][0]-1+fRad ) en_yop[i] += enstrip[0][2*i][strip]; |
|
|
if ( strip >= L2->GetCaloLevel2()->cibar[2*i+1][1]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i+1][1]-1+fRad ) en_xop[i] += enstrip[1][2*i+1][strip]; |
|
|
if ( strip >= L2->GetCaloLevel2()->cibar[2*i+1][0]-1-fRad && strip <= L2->GetCaloLevel2()->cibar[2*i+1][0]-1+fRad ) en_yep[i] += enstrip[0][2*i+1][strip]; |
|
|
}; |
|
|
}; |
|
|
energyxe += en_xep[i]; |
|
|
energyyo += en_yop[i]; |
|
|
energyxo += en_xop[i]; |
|
|
energyye += en_yep[i]; |
|
|
}; |
|
|
fMax_plane = 0; |
|
|
fMax_planexo = 0; |
|
|
fMax_planexe = 0; |
|
|
fMax_planeyo = 0; |
|
|
fMax_planeye = 0; |
|
|
Float_t en_maxplane = 0.; |
|
|
Float_t max_en= 0.; |
|
|
if ( fXosel ){ |
|
|
max_en = 0.; |
|
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
|
|
if(en_xop[ipl] > max_en) { |
|
|
max_en = en_xop[ipl]; |
|
|
fMax_planexo = ipl; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+fPl)) ;iplm++) en_maxplane += en_xop[iplm]; |
|
|
fEnergyxo = en_maxplane/fConv_rxo; |
|
|
}; |
|
|
if ( fXesel ){ |
|
|
max_en = 0.; |
|
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
|
|
if(en_xep[ipl] > max_en) { |
|
|
max_en = en_xep[ipl]; |
|
|
fMax_planexe = ipl; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+fPl)) ;iplm++) en_maxplane += en_xep[iplm]; |
|
|
fEnergyxe = en_maxplane/fConv_rxe; |
|
|
}; |
|
|
if ( fYosel ){ |
|
|
max_en = 0.; |
|
|
for (Int_t ipl =0; ipl < 11; ipl ++) { |
|
|
if(en_yop[ipl] > max_en) { |
|
|
max_en = en_yop[ipl]; |
|
|
fMax_planeyo = ipl; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeyo+fPl)) ;iplm++) en_maxplane += en_yop[iplm]; |
|
|
fEnergyyo = en_maxplane/fConv_ryo; |
|
1139 |
}; |
}; |
1140 |
if ( fYesel ){ |
clong->UnMaskSections(); |
1141 |
max_en = 0.; |
if ( !(section.Contains("YE")) ) clong->MaskSection("YE"); |
1142 |
for (Int_t ipl =0; ipl < 11; ipl ++) { |
if ( !(section.Contains("YO")) ) clong->MaskSection("YO"); |
1143 |
if(en_yep[ipl] > max_en) { |
if ( !(section.Contains("XO")) ) clong->MaskSection("XO"); |
1144 |
max_en = en_yep[ipl]; |
if ( !(section.Contains("XE")) ) clong->MaskSection("XE"); |
1145 |
fMax_planeye = ipl; |
clong->ForceNextFit(); |
1146 |
}; |
clong->SetEnergies(myene); |
1147 |
}; |
if ( debug ){ |
1148 |
// |
clong->Fit(true); |
1149 |
for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planeye+fPl)) ;iplm++) en_maxplane += en_yep[iplm]; |
} else { |
1150 |
fEnergyye = en_maxplane/fConv_rye; |
clong->Fit(); |
1151 |
|
}; |
1152 |
|
if ( clong->GetLowerLimit() != 0. || clong->GetUpperLimit() != 0. ){ |
1153 |
|
fXOen_maxplane = clong->Get_defE0(); |
1154 |
|
} else { |
1155 |
|
fXOen_maxplane = clong->Get_E0(); |
1156 |
}; |
}; |
1157 |
|
fMax_plane = clong->Get_tmax(); |
1158 |
|
fYOen_maxplane = 0.; |
1159 |
|
fYEen_maxplane = 0.; |
1160 |
|
fXEen_maxplane = 0.; |
1161 |
|
fEnergy=fXOen_maxplane/fConv_rxo; |
1162 |
|
if ( fEnergy != fEnergy || clong->Get_fitresult() != 0 ) fEnergy = -1.; |
1163 |
|
// if ( fEnergy != fEnergy ) fEnergy = 1.; |
1164 |
|
// |
1165 |
|
} else { |
1166 |
|
// |
1167 |
|
// if the event is not in the acceptance, return a negative energy. |
1168 |
|
// |
1169 |
|
if ( debug ) printf(" Outside acceptance \n"); |
1170 |
|
fEnergy *= -1.; |
1171 |
// |
// |
1172 |
fMax_plane = (Float_t)(fMax_planeyo+fMax_planeye+fMax_planexo+fMax_planexe)/fCount; |
}; |
1173 |
fEnergy = (fEnergyxe+fEnergyyo+fEnergyye+fEnergyxo)/fCount; |
// |
1174 |
|
} else { |
1175 |
|
// |
1176 |
|
// use the energy measurement |
1177 |
|
// |
1178 |
|
if ( this->IsInsideAcceptance(section) ){ |
1179 |
|
// |
1180 |
|
// the event is good |
1181 |
// |
// |
|
if ( debug ) printf(" fMax_plane %f conv_r %f en_maxplane %f encalo %f \n",fMax_plane,fConv_rxo,en_maxplane,fEnergy); |
|
1182 |
if ( debug ) printf(" XE %i XO %i YE %i YO %i \n",fXesel,fXosel,fYesel,fYosel); |
if ( debug ) printf(" XE %i XO %i YE %i YO %i \n",fXesel,fXosel,fYesel,fYosel); |
1183 |
// |
// |
1184 |
} else { |
} else { |
1185 |
|
// |
1186 |
|
// if the event is not in the acceptance, return a negative energy. |
1187 |
|
// |
1188 |
if ( debug ) printf(" Outside acceptance \n"); |
if ( debug ) printf(" Outside acceptance \n"); |
1189 |
fEnergy = -1.; |
fEnergy *= -1.; |
1190 |
|
// |
1191 |
}; |
}; |
1192 |
}; |
}; |
1193 |
// |
// |