336 |
// |
// |
337 |
if ( trk->trkseqno == -1 ){ |
if ( trk->trkseqno == -1 ){ |
338 |
|
|
339 |
ToFTrkVar *t_tof = trk; |
// ToFTrkVar *t_tof = trk; |
340 |
|
|
341 |
// Find the hitted paddle (two good TDC values) using the tof_j_flag (from tofl2com.for) |
// Find the hitted paddle (two good TDC values) using the tof_j_flag (from tofl2com.for) |
342 |
|
|
349 |
// Get the dEdx of this paddle using "GetdEdxPaddle" |
// Get the dEdx of this paddle using "GetdEdxPaddle" |
350 |
if (Ipaddle>-1) { |
if (Ipaddle>-1) { |
351 |
Int_t pad = GetPaddleid(plane,Ipaddle); |
Int_t pad = GetPaddleid(plane,Ipaddle); |
352 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
353 |
dedx = PadEdx; |
dedx = PadEdx; |
354 |
} |
} |
355 |
|
|
362 |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
363 |
Int_t paddleid=ii; |
Int_t paddleid=ii; |
364 |
Int_t pad = GetPaddleid(plane,paddleid); |
Int_t pad = GetPaddleid(plane,paddleid); |
365 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
366 |
dedx += PadEdx; |
dedx += PadEdx; |
367 |
} |
} |
368 |
} |
} |
372 |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
373 |
Int_t paddleid=ii; |
Int_t paddleid=ii; |
374 |
pad = GetPaddleid(plane,paddleid); |
pad = GetPaddleid(plane,paddleid); |
375 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
376 |
dedx += PadEdx; |
dedx += PadEdx; |
377 |
} |
} |
378 |
} |
} |
529 |
*/ |
*/ |
530 |
void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ |
void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ |
531 |
|
|
|
/* |
|
|
Float_t PMTsat[48] = { |
|
|
3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, |
|
|
3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03, |
|
|
3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53, |
|
|
3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98, |
|
|
3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66, |
|
|
3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ; |
|
|
*/ |
|
|
|
|
|
// new values from Napoli dec 2008 |
|
|
Float_t PMTsat[48] = { |
|
|
3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27, |
|
|
3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14, |
|
|
3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62, |
|
|
3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26, |
|
|
3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18, |
|
|
3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 }; |
|
|
|
|
|
for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.; // safety margin |
|
|
|
|
|
|
|
|
PadEdx = 0.; |
|
|
// SatWarning = 1000; |
|
|
SatWarning = 0; // 0=good, increase for each bad PMT |
|
|
|
|
|
Float_t dEdx[48] = {0}; |
|
|
Int_t pmt_id = -1; |
|
|
Float_t adcraw[48]; |
|
|
// |
|
532 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
533 |
if(!trk) return; //ELENA |
this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning); |
|
// |
|
|
|
|
|
Int_t pmtleft=-1; |
|
|
Int_t pmtright=-1; |
|
|
GetPaddlePMT(paddleid, pmtleft, pmtright); |
|
|
|
|
|
adcraw[pmtleft] = 4095; |
|
|
adcraw[pmtright] = 4095; |
|
|
|
|
|
|
|
|
for (Int_t jj=0; jj<npmt(); jj++){ |
|
|
|
|
|
ToFPMT *pmt = GetToFPMT(jj); |
|
|
if(!pmt)break; //ELENA |
|
|
|
|
|
pmt_id = pmt->pmt_id; |
|
|
if(pmt_id==pmtleft){ |
|
|
adcraw[pmtleft] = pmt->adc; |
|
|
} |
|
|
|
|
|
if(pmt_id==pmtright){ |
|
|
adcraw[pmtright] = pmt->adc; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (Int_t i=0; i<trk->npmtadc; i++){ |
|
|
|
|
|
if((trk->adcflag).At(i)==0 || adcfl==100){ |
|
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = (trk->dedx).At(i); |
|
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = (trk->dedx).At(i); |
|
|
}else{ |
|
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = 0.; |
|
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = 0.; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; //old version |
|
|
|
|
|
// Increase SatWarning Counter for each PMT>Sat |
|
|
if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++; |
|
|
if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++; |
|
|
|
|
|
// if ADC > sat set dEdx=1000 |
|
|
if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.; |
|
|
if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ; |
|
|
|
|
|
// if two PMT are good, take mean dEdx, otherwise only the good dEdx |
|
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; |
|
|
if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright]; |
|
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft]; |
|
534 |
|
|
535 |
}; |
}; |
536 |
|
|