| 22 |
N = 5; |
N = 5; |
| 23 |
R = 3; |
R = 3; |
| 24 |
// |
// |
| 25 |
|
debug = false; |
| 26 |
|
// |
| 27 |
}; |
}; |
| 28 |
|
|
| 29 |
void CaloNuclei::Clear(){ |
void CaloNuclei::Clear(){ |
| 30 |
// |
// |
| 31 |
|
tr = 0; |
| 32 |
interplane = 0; |
interplane = 0; |
| 33 |
preq = 0.; |
preq = 0.; |
| 34 |
postq = 0.; |
postq = 0.; |
| 46 |
// |
// |
| 47 |
Process(); |
Process(); |
| 48 |
// |
// |
| 49 |
printf("===================================================================\n"); |
printf("========================================================================\n"); |
| 50 |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
printf(" OBT: %u PKT: %u ATIME: %u Track %i \n",OBT,PKT,atime,tr); |
| 51 |
printf(" interplane [number of available dE/dx before interaction]: %i\n",interplane); |
printf(" interplane [number of available dE/dx before interaction]: %i\n",interplane); |
| 52 |
printf(" ethr [threshold used to determine interplane]:............ %f \n",ethr); |
printf(" ethr [threshold used to determine interplane]:............ %f \n",ethr); |
| 53 |
printf(" dedx1 [dE/dx from the first calorimeter plane]:........... %f \n",dedx1); |
printf(" dedx1 [dE/dx from the first calorimeter plane]:........... %f \n",dedx1); |
| 60 |
printf(" N [no of used plane]:..................................... %i \n",N); |
printf(" N [no of used plane]:..................................... %i \n",N); |
| 61 |
printf(" R [no strip used per plane ]:............................. %i \n",R); |
printf(" R [no strip used per plane ]:............................. %i \n",R); |
| 62 |
printf(" qpremeanN [truncated mean using N planes and R strips]:... %f \n",qpremeanN); |
printf(" qpremeanN [truncated mean using N planes and R strips]:... %f \n",qpremeanN); |
| 63 |
printf("===================================================================\n"); |
printf("========================================================================\n"); |
| 64 |
// |
// |
| 65 |
}; |
}; |
| 66 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
void CaloNuclei::Process(){ |
void CaloNuclei::Process(){ |
| 74 |
// |
Process(0); |
| 75 |
|
}; |
| 76 |
|
|
| 77 |
|
void CaloNuclei::Process(Int_t ntr){ |
| 78 |
|
// |
| 79 |
if ( !L2 ){ |
if ( !L2 ){ |
| 80 |
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"); |
| 81 |
printf(" ERROR: CaloNuclei variables not filled \n"); |
printf(" ERROR: CaloNuclei variables not filled \n"); |
| 97 |
// |
// |
| 98 |
if ( !newentry ) return; |
if ( !newentry ) return; |
| 99 |
// |
// |
| 100 |
// printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
tr = ntr; |
| 101 |
|
// |
| 102 |
|
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
| 103 |
// |
// |
| 104 |
Clear(); |
Clear(); |
| 105 |
// |
// |
| 106 |
PamTrack *track = 0; |
PamTrack *track = 0; |
| 107 |
track = L2->GetTrack(0); |
track = L2->GetTrack(ntr); |
| 108 |
// |
// |
| 109 |
Int_t view = 0; |
Int_t view = 0; |
| 110 |
Int_t plane = 0; |
Int_t plane = 0; |
| 146 |
// |
// |
| 147 |
retry: |
retry: |
| 148 |
// |
// |
| 149 |
// printf("retry\n"); |
if ( debug ) printf("retry\n"); |
| 150 |
// |
// |
| 151 |
interplane = 0; |
interplane = 0; |
| 152 |
// |
// |
| 170 |
if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] && |
if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] && |
| 171 |
( strip == (track->GetCaloTrack()->tibar[plane][view]-1) || strip == (track->GetCaloTrack()->tibar[plane][view]-2) || strip == (track->GetCaloTrack()->tibar[plane][view]) ) |
( strip == (track->GetCaloTrack()->tibar[plane][view]-1) || strip == (track->GetCaloTrack()->tibar[plane][view]-2) || strip == (track->GetCaloTrack()->tibar[plane][view]) ) |
| 172 |
&& true ){ |
&& true ){ |
| 173 |
// printf(" inside loop: ii %i mip %f view %i plane %i strip %i tibar %i nhit %i splane %i sview %i \n",ii,mip,view,plane,strip,track->GetCaloTrack()->tibar[plane][view]-1,nhit[view],splane[view],sview[view]); |
if ( debug ) printf(" inside loop: ii %i mip %f view %i plane %i strip %i tibar %i nhit %i splane %i sview %i \n",ii,mip,view,plane,strip,track->GetCaloTrack()->tibar[plane][view]-1,nhit[view],splane[view],sview[view]); |
| 174 |
interpl[view] = plane; |
interpl[view] = plane; |
| 175 |
interv[view] = view; |
interv[view] = view; |
| 176 |
if ( splane[view] != plane || sview[view] != view ){ |
if ( splane[view] != plane || sview[view] != view ){ |
| 177 |
if ( nhit[view] > 1 ){ |
if ( nhit[view] > 1 ){ |
| 178 |
wmulthit[view] = true; |
wmulthit[view] = true; |
| 179 |
|
// if ( splane[view] == -1 ) splane[view] = 0; // |
| 180 |
|
// if ( sview[view] == -1 ) sview[view] = view; // |
| 181 |
interpl[view] = splane[view]; |
interpl[view] = splane[view]; |
| 182 |
interv[view] = sview[view]; |
interv[view] = sview[view]; |
|
// ii = L2->GetCaloLevel1()->istrip; |
|
| 183 |
}; |
}; |
| 184 |
if ( plane > splane[view]+gapth ){ |
if ( plane > splane[view]+gapth ){ |
| 185 |
wgap[view] = true; |
wgap[view] = true; |
| 186 |
|
// if ( splane[view] == -1 ) splane[view] = 0;// |
| 187 |
|
// if ( sview[view] == -1 ) sview[view] = view; // |
| 188 |
interpl[view] = splane[view]; |
interpl[view] = splane[view]; |
| 189 |
interv[view] = sview[view]; |
interv[view] = sview[view]; |
|
// ii = L2->GetCaloLevel1()->istrip; |
|
| 190 |
}; |
}; |
| 191 |
splane[view] = plane; |
splane[view] = plane; |
| 192 |
sview[view] = view; |
sview[view] = view; |
| 200 |
// |
// |
| 201 |
}; |
}; |
| 202 |
// |
// |
| 203 |
// printf("conversion interpl %i interv %i multhit %i interplane %i \n",interpl[0],interv[0],multhit,interplane); |
if (debug ) printf("conversion interpl %i interv %i multhit %i interplane %i \n",interpl[0],interv[0],multhit,interplane); |
| 204 |
Int_t winterplane[2] = {-1,-1}; |
Int_t winterplane[2] = {-1,-1}; |
| 205 |
// |
// |
| 206 |
for ( Int_t view = 0; view < 2; view++){ |
for ( Int_t view = 0; view < 2; view++){ |
| 239 |
}; |
}; |
| 240 |
}; |
}; |
| 241 |
// |
// |
| 242 |
// printf("2conversion interpl %i interv %i multhit %i interplane %i \n",interpl[1],interv[1],multhit,interplane); |
if ( debug ) printf("2conversion interpl %i interv %i multhit %i interplane %i \n",interpl[1],interv[1],multhit,interplane); |
| 243 |
// printf("3conversion winterpl0 %i winterpl1 %i \n",winterplane[0],winterplane[1]); |
if ( debug ) printf("3conversion winterpl0 %i winterpl1 %i \n",winterplane[0],winterplane[1]); |
| 244 |
// |
// |
| 245 |
Int_t ipl = 0; |
Int_t ipl = 0; |
| 246 |
if ( interplane > 0 ){ |
if ( interplane > 0 ){ |
| 278 |
qsplane = plane; |
qsplane = plane; |
| 279 |
qsview = view; |
qsview = view; |
| 280 |
ind++; |
ind++; |
| 281 |
if ( ind > 199 ) printf(" AAAGH!! \n"); |
if ( debug && ind > 199 ) printf(" AAAGH!! \n"); |
| 282 |
qme[ind] = 0.; |
qme[ind] = 0.; |
| 283 |
}; |
}; |
| 284 |
qme[ind] += mip; |
qme[ind] += mip; |
| 290 |
qsplane2 = plane; |
qsplane2 = plane; |
| 291 |
qsview2 = view; |
qsview2 = view; |
| 292 |
ind2++; |
ind2++; |
| 293 |
if ( ind2 > 2112 ) printf(" AAAGH!! \n"); |
if ( debug && ind2 > 2112 ) printf(" AAAGH!! \n"); |
| 294 |
qme2[ind2] = 0.; |
qme2[ind2] = 0.; |
| 295 |
}; |
}; |
| 296 |
qme2[ind2] += mip; |
qme2[ind2] += mip; |
| 306 |
// |
// |
| 307 |
// here we must calculate qpremean, order vector qme, select 3 lowest measurements and caculate the mean... |
// here we must calculate qpremean, order vector qme, select 3 lowest measurements and caculate the mean... |
| 308 |
// |
// |
| 309 |
// for (Int_t l=0; l < interplane; l++){ |
if ( debug ){ |
| 310 |
// printf(" qme[%i] = %f \n",l,qme[l]); |
for (Int_t l=0; l < interplane; l++){ |
| 311 |
// // // if ( qme[ind] < 6.25 ) qme[ind] = 10000.; |
printf(" qme[%i] = %f \n",l,qme[l]); |
| 312 |
// }; |
}; |
| 313 |
|
}; |
| 314 |
|
// |
| 315 |
Long64_t work[200]; |
Long64_t work[200]; |
| 316 |
ind = 0; |
ind = 0; |
| 317 |
Int_t l = 0; |
Int_t l = 0; |
| 327 |
if ( qm >= qmt ){ |
if ( qm >= qmt ){ |
| 328 |
if ( l < 3 ) qpremean += qm; |
if ( l < 3 ) qpremean += qm; |
| 329 |
l++; |
l++; |
| 330 |
// printf(" value no %i qm %f qmt %f \n",l,qm,qmt); |
if ( debug ) printf(" value no %i qm %f qmt %f \n",l,qm,qmt); |
| 331 |
}; |
}; |
| 332 |
ind++; |
ind++; |
| 333 |
}; |
}; |
| 334 |
// |
// |
| 335 |
|
qpremean /= l; |
| 336 |
|
// |
| 337 |
ind = 0; |
ind = 0; |
| 338 |
l = 0; |
l = 0; |
| 339 |
while ( l < uplim && ind < interplane ){ |
while ( l < uplim && ind < interplane ){ |
| 341 |
if ( qm2 >= qmt ){ |
if ( qm2 >= qmt ){ |
| 342 |
if ( l < N ) qpremeanN += qm2; |
if ( l < N ) qpremeanN += qm2; |
| 343 |
l++; |
l++; |
| 344 |
// printf(" value no %i qm %f qmt %f \n",l,qm,qmt); |
if ( debug ) printf(" qm2 value no %i qm %f qmt %f \n",l,qm2,qmt); |
| 345 |
}; |
}; |
| 346 |
ind++; |
ind++; |
| 347 |
}; |
}; |
| 348 |
// |
// |
| 349 |
qpremean /= l; |
qpremeanN /= l; |
|
qpremeanN /= N; |
|
|
// |
|
|
// printf(" charge is %f \n",sqrt(qpremean)); |
|
| 350 |
// |
// |
| 351 |
// printf("preq postq\n"); |
if ( debug ) printf(" charge is %f \n",sqrt(qpremean)); |
| 352 |
// |
// |
| 353 |
if ( mesethr != ethr && interplane >= 3 && !aldone ){ |
if ( mesethr != ethr && interplane >= 3 && !aldone ){ |
| 354 |
Float_t mesethr2 = (sqrt(qpremean) - 0.50)*(sqrt(qpremean) - 0.50); |
Float_t mesethr2 = (sqrt(qpremean) - 0.50)*(sqrt(qpremean) - 0.50); |
| 362 |
}; |
}; |
| 363 |
}; |
}; |
| 364 |
// |
// |
| 365 |
// printf(" esci \n"); |
if ( debug ) printf(" esci \n"); |
| 366 |
// |
// |
| 367 |
}; |
}; |