| 1 |
#include <CaloNuclei.h> |
| 2 |
|
| 3 |
//-------------------------------------- |
| 4 |
/** |
| 5 |
* Default constructor |
| 6 |
*/ |
| 7 |
CaloNuclei::CaloNuclei(){ |
| 8 |
Clear(); |
| 9 |
}; |
| 10 |
|
| 11 |
CaloNuclei::CaloNuclei(PamLevel2 *l2p){ |
| 12 |
// |
| 13 |
Clear(); |
| 14 |
// |
| 15 |
L2 = l2p; |
| 16 |
// |
| 17 |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
| 18 |
// |
| 19 |
OBT = 0; |
| 20 |
PKT = 0; |
| 21 |
atime = 0; |
| 22 |
N = 5; |
| 23 |
R = 3; |
| 24 |
// |
| 25 |
debug = false; |
| 26 |
usetrack = true; |
| 27 |
// |
| 28 |
}; |
| 29 |
|
| 30 |
void CaloNuclei::Clear(){ |
| 31 |
// |
| 32 |
tr = 0; |
| 33 |
sntr = 0; |
| 34 |
interplane = 0; |
| 35 |
preq = 0.; |
| 36 |
postq = 0.; |
| 37 |
dedx1 = 0.; |
| 38 |
dedx3 = 0.; |
| 39 |
qpremean = 0.; |
| 40 |
qpremeanN = 0.; |
| 41 |
// |
| 42 |
multhit = false; |
| 43 |
gap = false; |
| 44 |
// |
| 45 |
}; |
| 46 |
|
| 47 |
void CaloNuclei::Print(){ |
| 48 |
// |
| 49 |
Process(); |
| 50 |
// |
| 51 |
printf("========================================================================\n"); |
| 52 |
printf(" OBT: %u PKT: %u ATIME: %u Track %i Use track %i \n",OBT,PKT,atime,tr,usetrack); |
| 53 |
printf(" interplane [number of available dE/dx before interaction]:.. %i\n",interplane); |
| 54 |
printf(" ethr [threshold used to determine interplane]:.............. %f \n",ethr); |
| 55 |
printf(" dedx1 [dE/dx from the first calorimeter plane]:............. %f \n",dedx1); |
| 56 |
printf(" stdedx1 [dE/dx from the first calorimeter plane standalone]: %f \n",stdedx1); |
| 57 |
printf(" dedx3 [dE/dx (average) if the first 3 Si planes]:........... %f \n",dedx3); |
| 58 |
printf(" multhit [true if interplane determined by multiple hits]:... %i \n",multhit); |
| 59 |
printf(" gap [true if interplane determined by a gap]:............... %i \n",gap); |
| 60 |
printf(" preq [total energy in MIP before the interaction plane]:.... %f \n",preq); |
| 61 |
printf(" postq [total energy in MIP after the interaction plane]:.... %f \n",postq); |
| 62 |
printf(" qpremean [truncated mean using 3 planes and 3 strips]:...... %f \n",qpremean); |
| 63 |
printf(" N [no of used plane]:....................................... %i \n",N); |
| 64 |
printf(" R [no strip used per plane ]:............................... %i \n",R); |
| 65 |
printf(" qpremeanN [truncated mean using N planes and R strips]:..... %f \n",qpremeanN); |
| 66 |
printf("========================================================================\n"); |
| 67 |
// |
| 68 |
}; |
| 69 |
|
| 70 |
void CaloNuclei::Delete(){ |
| 71 |
Clear(); |
| 72 |
//delete this; |
| 73 |
}; |
| 74 |
|
| 75 |
|
| 76 |
void CaloNuclei::Process(){ |
| 77 |
Process(0); |
| 78 |
}; |
| 79 |
|
| 80 |
void CaloNuclei::Process(Int_t ntr){ |
| 81 |
// |
| 82 |
if ( !L2 ){ |
| 83 |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
| 84 |
printf(" ERROR: CaloNuclei variables not filled \n"); |
| 85 |
return; |
| 86 |
}; |
| 87 |
// |
| 88 |
Bool_t newentry = false; |
| 89 |
// |
| 90 |
if ( L2->IsORB() ){ |
| 91 |
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || ntr != sntr ){ |
| 92 |
newentry = true; |
| 93 |
OBT = L2->GetOrbitalInfo()->OBT; |
| 94 |
PKT = L2->GetOrbitalInfo()->pkt_num; |
| 95 |
atime = L2->GetOrbitalInfo()->absTime; |
| 96 |
sntr = ntr; |
| 97 |
}; |
| 98 |
} else { |
| 99 |
newentry = true; |
| 100 |
}; |
| 101 |
// |
| 102 |
if ( !newentry ) return; |
| 103 |
// |
| 104 |
tr = ntr; |
| 105 |
// |
| 106 |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
| 107 |
// |
| 108 |
Clear(); |
| 109 |
if ( debug ) printf(" Always calculate stdedx1 \n"); |
| 110 |
// |
| 111 |
// Always calculate stdedx1 |
| 112 |
// |
| 113 |
Int_t view = 0; |
| 114 |
Int_t plane = 0; |
| 115 |
Int_t strip = 0; |
| 116 |
Int_t indx = 0; |
| 117 |
Float_t vfpl[96]; |
| 118 |
Int_t stfpl[96]; |
| 119 |
memset(vfpl, 0, 96*sizeof(Float_t)); |
| 120 |
memset(stfpl, 0, 96*sizeof(Int_t)); |
| 121 |
Float_t mip = 0.; |
| 122 |
for ( Int_t i=0; i<L2->GetCaloLevel1()->istrip; i++ ){ |
| 123 |
// |
| 124 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 125 |
// |
| 126 |
// put in vfpl vector the energy release on the first plane |
| 127 |
// |
| 128 |
if ( strip != -1 && view == 1 && plane == 0 ) { |
| 129 |
stfpl[indx] = strip; |
| 130 |
vfpl[indx] = mip; |
| 131 |
indx++; |
| 132 |
}; |
| 133 |
// |
| 134 |
}; |
| 135 |
// |
| 136 |
if ( debug ) printf(" find energy released along the strip of maximum on the first plane and on the two neighbour strips \n"); |
| 137 |
// |
| 138 |
// find energy released along the strip of maximum on the first plane and on the two neighbour strips |
| 139 |
// |
| 140 |
if ( indx > 0 ){ |
| 141 |
Int_t mindx = (Int_t)TMath::LocMax(indx,stfpl); |
| 142 |
for (Int_t ii=0; ii<indx; ii++){ |
| 143 |
if ( stfpl[ii] == stfpl[mindx] ) stdedx1 += vfpl[ii]; |
| 144 |
if ( (mindx-1)>=0 && stfpl[ii] == stfpl[mindx-1] ) stdedx1 += vfpl[ii]; |
| 145 |
if ( (mindx+1)<96 && stfpl[ii] == stfpl[mindx+1] ) stdedx1 += vfpl[ii]; |
| 146 |
}; |
| 147 |
} else { |
| 148 |
stdedx1 = 0.; |
| 149 |
}; |
| 150 |
// |
| 151 |
if ( debug ) printf(" if ( !usetrack ) return: usetrack %i ntr %i \n",usetrack,ntr); |
| 152 |
// |
| 153 |
// |
| 154 |
if ( !usetrack ) return; |
| 155 |
// |
| 156 |
PamTrack *ptrack = 0; |
| 157 |
CaloTrkVar *track = 0; |
| 158 |
if ( ntr >= 0 ){ |
| 159 |
ptrack = L2->GetTrack(ntr); |
| 160 |
if ( ptrack ) track = ptrack->GetCaloTrack(); |
| 161 |
} else { |
| 162 |
track = L2->GetCaloStoredTrack(ntr); |
| 163 |
}; |
| 164 |
// |
| 165 |
if ( !track && ntr >= 0 ){ |
| 166 |
printf(" ERROR: cannot find any track!\n"); |
| 167 |
printf(" ERROR: CaloNuclei variables not completely filled \n"); |
| 168 |
return; |
| 169 |
}; |
| 170 |
// |
| 171 |
// Float_t defethr = 6. * 0.90; |
| 172 |
Float_t defethr = 6.25; // = (sqrt(9) - 0.5) ** 2.; |
| 173 |
// |
| 174 |
// Calculate dedx1 and dedx3 |
| 175 |
// |
| 176 |
for ( Int_t i=0; i<L2->GetCaloLevel1()->istrip; i++ ){ |
| 177 |
// |
| 178 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 179 |
// |
| 180 |
if ( ntr >= 0 ){ |
| 181 |
// |
| 182 |
if ( strip != -1 && |
| 183 |
view == 1 && |
| 184 |
plane == 0 && |
| 185 |
( strip == (track->tibar[0][1]-1) || strip == (track->tibar[0][1]-2) || strip == (track->tibar[0][1]) ) |
| 186 |
&& true ){ |
| 187 |
dedx1 += mip; |
| 188 |
}; |
| 189 |
if ( strip != -1 && |
| 190 |
(( view == 1 && ( plane == 0 || plane == 1 ) ) || |
| 191 |
( view == 0 && plane == 0 )) && |
| 192 |
(( view == 0 && ( strip == track->tibar[0][0] || strip == (track->tibar[0][0]-1) || strip == (track->tibar[0][0]-2) )) || |
| 193 |
( view == 1 && ( strip == track->tibar[0][1] || strip == (track->tibar[0][1]-1) || strip == (track->tibar[0][1]-2) )) || |
| 194 |
( view == 1 && ( strip == track->tibar[1][1] || strip == (track->tibar[1][1]-1) || strip == (track->tibar[1][1]-2) ))) && |
| 195 |
true ){ |
| 196 |
dedx3 += mip; |
| 197 |
}; |
| 198 |
} else { |
| 199 |
// |
| 200 |
if ( strip != -1 && |
| 201 |
view == 1 && |
| 202 |
plane == 0 && |
| 203 |
( strip == (L2->GetCaloLevel2()->cibar[0][1]-1) || strip == (L2->GetCaloLevel2()->cibar[0][1]-2) || strip == (L2->GetCaloLevel2()->cibar[0][1]) ) |
| 204 |
&& true ){ |
| 205 |
dedx1 += mip; |
| 206 |
}; |
| 207 |
if ( strip != -1 && |
| 208 |
(( view == 1 && ( plane == 0 || plane == 1 ) ) || |
| 209 |
( view == 0 && plane == 0 )) && |
| 210 |
(( view == 0 && ( strip == L2->GetCaloLevel2()->cibar[0][0] || strip == (L2->GetCaloLevel2()->cibar[0][0]-1) || strip == (L2->GetCaloLevel2()->cibar[0][0]-2) )) || |
| 211 |
( view == 1 && ( strip == L2->GetCaloLevel2()->cibar[0][1] || strip == (L2->GetCaloLevel2()->cibar[0][1]-1) || strip == (L2->GetCaloLevel2()->cibar[0][1]-2) )) || |
| 212 |
( view == 1 && ( strip == L2->GetCaloLevel2()->cibar[1][1] || strip == (L2->GetCaloLevel2()->cibar[1][1]-1) || strip == (L2->GetCaloLevel2()->cibar[1][1]-2) ))) && |
| 213 |
true ){ |
| 214 |
dedx3 += mip; |
| 215 |
}; |
| 216 |
}; |
| 217 |
// |
| 218 |
}; |
| 219 |
// |
| 220 |
dedx3 /= 3.; |
| 221 |
// Float_t mesethr = dedx1 * 0.90; |
| 222 |
Float_t mesethr = 0.; |
| 223 |
if ( dedx1 > 0. ) mesethr = (sqrt(dedx1) - 0.50)*(sqrt(dedx1) - 0.50); |
| 224 |
Bool_t aldone = false; |
| 225 |
// |
| 226 |
retry: |
| 227 |
// |
| 228 |
if ( debug ) printf("retry\n"); |
| 229 |
// |
| 230 |
interplane = 0; |
| 231 |
// |
| 232 |
ethr = TMath::Max(defethr,mesethr); |
| 233 |
// |
| 234 |
// Find the interaction plane "interplane" |
| 235 |
// |
| 236 |
Int_t gapth = 3; |
| 237 |
Int_t nhit[2] = {0,0}; |
| 238 |
Int_t splane[2] = {-1,-1}; |
| 239 |
Int_t sview[2] = {-1,-1}; |
| 240 |
Int_t interpl[2] = {-1,-1}; |
| 241 |
Int_t interv[2] = {-1,-1}; |
| 242 |
Bool_t wmulthit[2] = {false,false}; |
| 243 |
Bool_t wgap[2] = {false,false}; |
| 244 |
Int_t ii = 0; |
| 245 |
while ( ii<L2->GetCaloLevel1()->istrip ){ |
| 246 |
// |
| 247 |
mip = L2->GetCaloLevel1()->DecodeEstrip(ii,view,plane,strip); |
| 248 |
// |
| 249 |
if ( ntr >= 0 ){ |
| 250 |
if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] && |
| 251 |
( strip == (track->tibar[plane][view]-1) || strip == (track->tibar[plane][view]-2) || strip == (track->tibar[plane][view]) ) |
| 252 |
&& true ){ |
| 253 |
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->tibar[plane][view]-1,nhit[view],splane[view],sview[view]); |
| 254 |
interpl[view] = plane; |
| 255 |
interv[view] = view; |
| 256 |
if ( splane[view] != plane || sview[view] != view ){ |
| 257 |
if ( nhit[view] > 1 ){ |
| 258 |
wmulthit[view] = true; |
| 259 |
// if ( splane[view] == -1 ) splane[view] = 0; // |
| 260 |
// if ( sview[view] == -1 ) sview[view] = view; // |
| 261 |
interpl[view] = splane[view]; |
| 262 |
interv[view] = sview[view]; |
| 263 |
}; |
| 264 |
if ( plane > splane[view]+gapth ){ |
| 265 |
wgap[view] = true; |
| 266 |
// if ( splane[view] == -1 ) splane[view] = 0;// |
| 267 |
// if ( sview[view] == -1 ) sview[view] = view; // |
| 268 |
interpl[view] = splane[view]; |
| 269 |
interv[view] = sview[view]; |
| 270 |
}; |
| 271 |
splane[view] = plane; |
| 272 |
sview[view] = view; |
| 273 |
nhit[view] = 1; |
| 274 |
} else { |
| 275 |
nhit[view]++; |
| 276 |
}; |
| 277 |
}; |
| 278 |
} else { |
| 279 |
if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] && |
| 280 |
( strip == (L2->GetCaloLevel2()->cibar[plane][view]-1) || strip == (L2->GetCaloLevel2()->cibar[plane][view]-2) || strip == (L2->GetCaloLevel2()->cibar[plane][view]) ) |
| 281 |
&& true ){ |
| 282 |
if ( debug ) printf(" inside loop: ii %i mip %f view %i plane %i strip %i cibar %i nhit %i splane %i sview %i \n",ii,mip,view,plane,strip,L2->GetCaloLevel2()->cibar[plane][view]-1,nhit[view],splane[view],sview[view]); |
| 283 |
interpl[view] = plane; |
| 284 |
interv[view] = view; |
| 285 |
if ( splane[view] != plane || sview[view] != view ){ |
| 286 |
if ( nhit[view] > 1 ){ |
| 287 |
wmulthit[view] = true; |
| 288 |
// if ( splane[view] == -1 ) splane[view] = 0; // |
| 289 |
// if ( sview[view] == -1 ) sview[view] = view; // |
| 290 |
interpl[view] = splane[view]; |
| 291 |
interv[view] = sview[view]; |
| 292 |
}; |
| 293 |
if ( plane > splane[view]+gapth ){ |
| 294 |
wgap[view] = true; |
| 295 |
// if ( splane[view] == -1 ) splane[view] = 0;// |
| 296 |
// if ( sview[view] == -1 ) sview[view] = view; // |
| 297 |
interpl[view] = splane[view]; |
| 298 |
interv[view] = sview[view]; |
| 299 |
}; |
| 300 |
splane[view] = plane; |
| 301 |
sview[view] = view; |
| 302 |
nhit[view] = 1; |
| 303 |
} else { |
| 304 |
nhit[view]++; |
| 305 |
}; |
| 306 |
}; |
| 307 |
}; |
| 308 |
// |
| 309 |
ii++; |
| 310 |
// |
| 311 |
}; |
| 312 |
// |
| 313 |
if (debug ) printf("conversion interpl %i interv %i multhit %i interplane %i \n",interpl[0],interv[0],multhit,interplane); |
| 314 |
Int_t winterplane[2] = {-1,-1}; |
| 315 |
// |
| 316 |
for ( Int_t view = 0; view < 2; view++){ |
| 317 |
// |
| 318 |
if ( nhit[view] > 1 && !wmulthit[view] && !wgap[view] ){ |
| 319 |
wmulthit[view] = true; |
| 320 |
interpl[view] = splane[view]; |
| 321 |
interv[view] = sview[view]; |
| 322 |
}; |
| 323 |
// |
| 324 |
if ( wmulthit[view] ) multhit = true; |
| 325 |
if ( wgap[view] ) gap = true; |
| 326 |
// |
| 327 |
// convert view and plane number of interaction plane into number of available dE/dx measurements before the interaction plane |
| 328 |
// |
| 329 |
if ( interpl[view] >= 0 ) { |
| 330 |
if ( interv[view] == 0 ){ |
| 331 |
winterplane[view] = (1 + interpl[view]) * 2; |
| 332 |
} else { |
| 333 |
winterplane[view] = (1 + interpl[view]) + (1 + interpl[view] - 1); |
| 334 |
}; |
| 335 |
if ( wmulthit[view] ) winterplane[view]--; |
| 336 |
}; |
| 337 |
}; |
| 338 |
if ( winterplane[0] > 0 && winterplane[1] > 0 ){ |
| 339 |
if ( multhit ){ |
| 340 |
interplane = TMath::Min(winterplane[0],winterplane[1]); |
| 341 |
} else { |
| 342 |
interplane = TMath::Max(winterplane[0],winterplane[1]); |
| 343 |
}; |
| 344 |
} else { |
| 345 |
if ( !winterplane[0] || !winterplane[1] ){ |
| 346 |
interplane = 0; |
| 347 |
} else { |
| 348 |
interplane = TMath::Max(winterplane[0],winterplane[1]); |
| 349 |
}; |
| 350 |
}; |
| 351 |
// |
| 352 |
if ( debug ) printf("2conversion interpl %i interv %i multhit %i interplane %i \n",interpl[1],interv[1],multhit,interplane); |
| 353 |
if ( debug ) printf("3conversion winterpl0 %i winterpl1 %i \n",winterplane[0],winterplane[1]); |
| 354 |
// |
| 355 |
Int_t ipl = 0; |
| 356 |
if ( interplane > 0 ){ |
| 357 |
// |
| 358 |
// Calculate preq, postq, qpremean |
| 359 |
// |
| 360 |
ii = 0; |
| 361 |
Int_t ind = -1; |
| 362 |
Int_t qsplane = -1; |
| 363 |
Int_t qsview = -1; |
| 364 |
Int_t ind2 = -1; |
| 365 |
Int_t qsplane2 = -1; |
| 366 |
Int_t qsview2 = -1; |
| 367 |
Float_t qme[200]; |
| 368 |
memset(qme,0,200*sizeof(Float_t)); |
| 369 |
Float_t qme2[2112]; |
| 370 |
memset(qme2,0,2112*sizeof(Float_t)); |
| 371 |
// |
| 372 |
while ( ii<L2->GetCaloLevel1()->istrip ){ |
| 373 |
// |
| 374 |
mip = L2->GetCaloLevel1()->DecodeEstrip(ii,view,plane,strip); |
| 375 |
// |
| 376 |
if ( strip != -1 ){ |
| 377 |
if ( view == 0 ){ |
| 378 |
ipl = (1 + plane) * 2; |
| 379 |
} else { |
| 380 |
ipl = (1 + plane) + (1 + plane - 1 ); |
| 381 |
}; |
| 382 |
if ( ipl > interplane ){ |
| 383 |
postq += mip; |
| 384 |
} else { |
| 385 |
preq += mip; |
| 386 |
if ( ntr >= 0 ){ |
| 387 |
if ( strip == (track->tibar[plane][view]-1) || strip == (track->tibar[plane][view]-2) || strip == (track->tibar[plane][view]) ){ |
| 388 |
if ( qsplane != plane || qsview != view ){ |
| 389 |
qsplane = plane; |
| 390 |
qsview = view; |
| 391 |
ind++; |
| 392 |
if ( debug && ind > 199 ) printf(" AAAGH!! \n"); |
| 393 |
qme[ind] = 0.; |
| 394 |
}; |
| 395 |
qme[ind] += mip; |
| 396 |
}; |
| 397 |
for ( Int_t ns = 0; ns < R ; ns++){ |
| 398 |
Int_t ms = track->tibar[plane][view] - 1 - ns + (R - 1)/2; |
| 399 |
if ( strip == ms ){ |
| 400 |
if ( qsplane2 != plane || qsview2 != view ){ |
| 401 |
qsplane2 = plane; |
| 402 |
qsview2 = view; |
| 403 |
ind2++; |
| 404 |
if ( debug && ind2 > 2112 ) printf(" AAAGH!! \n"); |
| 405 |
qme2[ind2] = 0.; |
| 406 |
}; |
| 407 |
qme2[ind2] += mip; |
| 408 |
}; |
| 409 |
}; |
| 410 |
} else { |
| 411 |
if ( strip == (L2->GetCaloLevel2()->cibar[plane][view]-1) || strip == (L2->GetCaloLevel2()->cibar[plane][view]-2) || strip == (L2->GetCaloLevel2()->cibar[plane][view]) ){ |
| 412 |
if ( qsplane != plane || qsview != view ){ |
| 413 |
qsplane = plane; |
| 414 |
qsview = view; |
| 415 |
ind++; |
| 416 |
if ( debug && ind > 199 ) printf(" AAAGH!! \n"); |
| 417 |
qme[ind] = 0.; |
| 418 |
}; |
| 419 |
qme[ind] += mip; |
| 420 |
}; |
| 421 |
for ( Int_t ns = 0; ns < R ; ns++){ |
| 422 |
Int_t ms = L2->GetCaloLevel2()->cibar[plane][view] - 1 - ns + (R - 1)/2; |
| 423 |
if ( strip == ms ){ |
| 424 |
if ( qsplane2 != plane || qsview2 != view ){ |
| 425 |
qsplane2 = plane; |
| 426 |
qsview2 = view; |
| 427 |
ind2++; |
| 428 |
if ( debug && ind2 > 2112 ) printf(" AAAGH!! \n"); |
| 429 |
qme2[ind2] = 0.; |
| 430 |
}; |
| 431 |
qme2[ind2] += mip; |
| 432 |
}; |
| 433 |
}; |
| 434 |
}; |
| 435 |
}; |
| 436 |
// |
| 437 |
}; |
| 438 |
// |
| 439 |
ii++; |
| 440 |
// |
| 441 |
}; |
| 442 |
// |
| 443 |
// here we must calculate qpremean, order vector qme, select 3 lowest measurements and caculate the mean... |
| 444 |
// |
| 445 |
if ( debug ){ |
| 446 |
for (Int_t l=0; l < interplane; l++){ |
| 447 |
printf(" qme[%i] = %f \n",l,qme[l]); |
| 448 |
}; |
| 449 |
}; |
| 450 |
// |
| 451 |
Long64_t work[200]; |
| 452 |
ind = 0; |
| 453 |
Int_t l = 0; |
| 454 |
Int_t RN = 0; |
| 455 |
Float_t qm = 0.; |
| 456 |
Float_t qm2 = 0.; |
| 457 |
// |
| 458 |
Float_t qmt = ethr*0.8; // *0.9 |
| 459 |
// |
| 460 |
Int_t uplim = TMath::Max(3,N); |
| 461 |
// |
| 462 |
while ( l < uplim && ind < interplane ){ |
| 463 |
qm = TMath::KOrdStat(interplane,qme,ind,work); |
| 464 |
if ( qm >= qmt ){ |
| 465 |
if ( l < 3 ){ |
| 466 |
qpremean += qm; |
| 467 |
RN++; |
| 468 |
}; |
| 469 |
l++; |
| 470 |
if ( debug ) printf(" value no %i qm %f qmt %f \n",l,qm,qmt); |
| 471 |
}; |
| 472 |
ind++; |
| 473 |
}; |
| 474 |
// |
| 475 |
qpremean /= (Float_t)RN; |
| 476 |
// |
| 477 |
ind = 0; |
| 478 |
l = 0; |
| 479 |
RN = 0; |
| 480 |
while ( l < uplim && ind < interplane ){ |
| 481 |
qm2 = TMath::KOrdStat(interplane,qme2,ind,work); |
| 482 |
if ( qm2 >= qmt ){ |
| 483 |
if ( l < N ){ |
| 484 |
qpremeanN += qm2; |
| 485 |
RN++; |
| 486 |
}; |
| 487 |
l++; |
| 488 |
if ( debug ) printf(" qm2 value no %i qm %f qmt %f RN %i \n",l,qm2,qmt,RN); |
| 489 |
}; |
| 490 |
ind++; |
| 491 |
}; |
| 492 |
// |
| 493 |
qpremeanN /= (Float_t)RN; |
| 494 |
// |
| 495 |
if ( debug ) printf(" charge is %f \n",sqrt(qpremean)); |
| 496 |
// |
| 497 |
if ( mesethr != ethr && interplane >= 3 && !aldone ){ |
| 498 |
Float_t mesethr2 = (sqrt(qpremean) - 0.50)*(sqrt(qpremean) - 0.50); |
| 499 |
if ( mesethr2 < mesethr*0.90 ){ |
| 500 |
mesethr = (sqrt(dedx1) - 0.25)*(sqrt(dedx1) - 0.25); |
| 501 |
} else { |
| 502 |
mesethr = mesethr2; |
| 503 |
}; |
| 504 |
aldone = true; |
| 505 |
if ( mesethr > defethr ) goto retry; |
| 506 |
}; |
| 507 |
}; |
| 508 |
// |
| 509 |
if ( debug ) this->Print(); |
| 510 |
if ( debug ) printf(" esci \n"); |
| 511 |
// |
| 512 |
}; |