| 147 |
// |
// |
| 148 |
}; //ELENA |
}; //ELENA |
| 149 |
|
|
| 150 |
|
/** |
| 151 |
|
* Retrieves the itrk-th tof track stored in the array |
| 152 |
|
* @param itrk Array index (min 0, max ToFLevel2::ntrk()) |
| 153 |
|
* |
| 154 |
|
*/ |
| 155 |
ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){ |
ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){ |
| 156 |
// |
// |
| 157 |
if(itrk >= ntrk()){ |
if(itrk >= ntrk()){ |
| 168 |
|
|
| 169 |
/** |
/** |
| 170 |
* Retrieves the tof track matching the seqno-th tracker stored track. |
* Retrieves the tof track matching the seqno-th tracker stored track. |
| 171 |
|
* @param seqno Track sequential number |
| 172 |
|
* (seqno = -1 for standalone tof track, seqno=0-TrkLevel2::ntrk() for tof tracks associated to a tracker track) |
| 173 |
* |
* |
| 174 |
*/ |
*/ |
| 175 |
ToFTrkVar *ToFLevel2::GetToFStoredTrack(int seqno){ |
ToFTrkVar *ToFLevel2::GetToFStoredTrack(int seqno){ |
| 311 |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
| 312 |
*/ |
*/ |
| 313 |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ |
| 314 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
// ToFTrkVar *trk = GetToFTrkVar(notrack); |
| 315 |
|
ToFTrkVar *trk = GetToFStoredTrack(notrack);//Elena 2015 |
| 316 |
return this->GetdEdx(trk, plane, adcfl); |
return this->GetdEdx(trk, plane, adcfl); |
| 317 |
} |
} |
| 318 |
|
|
| 327 |
* The method was modified for the "ToF-standalone" part in february 2015 |
* The method was modified for the "ToF-standalone" part in february 2015 |
| 328 |
* The "adcfl" option is not very useful (an artificial dEdx is per |
* The "adcfl" option is not very useful (an artificial dEdx is per |
| 329 |
* definition= 1 mip and not a real measurement), anyway left in the code |
* definition= 1 mip and not a real measurement), anyway left in the code |
| 330 |
* @param trk Pointer to TofTrkVar class |
* @param trk Pointer to TofTrkVar object |
| 331 |
* @param plane Plane index (0,1,2,3,4,5) |
* @param plane Plane index (0,1,2,3,4,5) |
| 332 |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
| 333 |
*/ |
*/ |
| 338 |
Int_t SatWarning; |
Int_t SatWarning; |
| 339 |
Int_t pad=-1; |
Int_t pad=-1; |
| 340 |
// |
// |
| 341 |
|
if(!trk) cout << "ToFLevel2::GetdEdx(...) ---> NULL ToFTrkVar obj "<<endl; |
| 342 |
if(!trk) return 0; //ELENA |
if(!trk) return 0; //ELENA |
| 343 |
// |
// |
| 344 |
// ToF standalone part |
// ToF standalone part |
| 345 |
// |
// |
| 346 |
if ( trk->trkseqno == -1 ){ |
if ( trk->trkseqno == -1 ){ |
| 347 |
|
|
| 348 |
ToFTrkVar *t_tof = trk; |
// ToFTrkVar *t_tof = trk; |
| 349 |
|
|
| 350 |
// 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) |
| 351 |
|
|
| 358 |
// Get the dEdx of this paddle using "GetdEdxPaddle" |
// Get the dEdx of this paddle using "GetdEdxPaddle" |
| 359 |
if (Ipaddle>-1) { |
if (Ipaddle>-1) { |
| 360 |
Int_t pad = GetPaddleid(plane,Ipaddle); |
Int_t pad = GetPaddleid(plane,Ipaddle); |
| 361 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
| 362 |
dedx = PadEdx; |
dedx = PadEdx; |
| 363 |
} |
} |
| 364 |
|
|
| 371 |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
| 372 |
Int_t paddleid=ii; |
Int_t paddleid=ii; |
| 373 |
Int_t pad = GetPaddleid(plane,paddleid); |
Int_t pad = GetPaddleid(plane,paddleid); |
| 374 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
| 375 |
dedx += PadEdx; |
dedx += PadEdx; |
| 376 |
} |
} |
| 377 |
} |
} |
| 381 |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
| 382 |
Int_t paddleid=ii; |
Int_t paddleid=ii; |
| 383 |
pad = GetPaddleid(plane,paddleid); |
pad = GetPaddleid(plane,paddleid); |
| 384 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
| 385 |
dedx += PadEdx; |
dedx += PadEdx; |
| 386 |
} |
} |
| 387 |
} |
} |
| 462 |
*/ |
*/ |
| 463 |
Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){ |
Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){ |
| 464 |
// |
// |
| 465 |
short tof[4][24] = { |
static const short tof[4][24] = { |
| 466 |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
| 467 |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
| 468 |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
| 498 |
*/ |
*/ |
| 499 |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ |
| 500 |
// |
// |
| 501 |
short tof[4][24] = { |
static const short tof[4][24] = { |
| 502 |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
| 503 |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
| 504 |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
| 538 |
*/ |
*/ |
| 539 |
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){ |
| 540 |
|
|
| 541 |
/* |
// ToFTrkVar *trk = GetToFTrkVar(notrack); |
| 542 |
Float_t PMTsat[48] = { |
ToFTrkVar *trk = GetToFStoredTrack(notrack); //Elena 2015 |
| 543 |
3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, |
this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning); |
|
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]; |
|
|
// |
|
|
ToFTrkVar *trk = GetToFTrkVar(notrack); |
|
|
if(!trk) return; //ELENA |
|
|
// |
|
|
|
|
|
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]; |
|
| 544 |
|
|
| 545 |
}; |
}; |
| 546 |
|
|
| 589 |
Int_t pmt_id = -1; |
Int_t pmt_id = -1; |
| 590 |
Float_t adcraw[48]; |
Float_t adcraw[48]; |
| 591 |
// |
// |
| 592 |
|
if(!trk)cout << "ToFLevel2::GetdEdxPaddle(...) ---> NULL ToFTrkVar obj "<<endl; |
| 593 |
if(!trk) return; //ELENA |
if(!trk) return; //ELENA |
| 594 |
// |
// |
| 595 |
|
|
| 660 |
|
|
| 661 |
TString pmtname = " "; |
TString pmtname = " "; |
| 662 |
|
|
| 663 |
TString photoS[48] = { |
static const TString photoS[48] = { |
| 664 |
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
| 665 |
"S11_4B", |
"S11_4B", |
| 666 |
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
| 1120 |
* @param cut on chi2 |
* @param cut on chi2 |
| 1121 |
*/ |
*/ |
| 1122 |
|
|
|
Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
|
| 1123 |
|
|
| 1124 |
// cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl; |
Float_t ToFTrkVar::CalcBeta( Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
| 1125 |
|
|
| 1126 |
|
|
| 1127 |
Float_t bxx = 100.; |
Float_t bxx = 100.; |
| 1128 |
// |
// |
| 1129 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = this; |
|
if(!trk) return 0; //ELENA |
|
| 1130 |
|
|
| 1131 |
|
|
| 1132 |
Float_t chi2,xhelp,beta_mean; |
Float_t chi2,xhelp,beta_mean; |
| 1153 |
for (Int_t i=0; i<trk->npmttdc; i++){ |
for (Int_t i=0; i<trk->npmttdc; i++){ |
| 1154 |
// |
// |
| 1155 |
pmt_id = (trk->pmttdc).At(i); |
pmt_id = (trk->pmttdc).At(i); |
| 1156 |
pmt_plane = GetPlaneIndex(pmt_id); |
pmt_plane = ToFLevel2::GetPlaneIndex(pmt_id); |
| 1157 |
tdcfl = (trk->tdcflag).At(i); |
tdcfl = (trk->tdcflag).At(i); |
| 1158 |
if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag |
if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag |
| 1159 |
}; |
}; |
| 1240 |
// |
// |
| 1241 |
return(bxx); |
return(bxx); |
| 1242 |
}; |
}; |
| 1243 |
|
//////////////////////////////////////////////////// |
| 1244 |
|
//////////////////////////////////////////////////// |
| 1245 |
|
/** |
| 1246 |
|
* See ToFTrkVar::CalcBeta(Float_t,Float_t, Float_t). |
| 1247 |
|
*/ |
| 1248 |
|
Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
| 1249 |
|
|
| 1250 |
|
// cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl; |
| 1251 |
|
|
| 1252 |
|
// ToFTrkVar *trk = GetToFTrkVar(notrack); //wrong! |
| 1253 |
|
ToFTrkVar *trk = GetToFStoredTrack(notrack);//Elena Apr 2015 |
| 1254 |
|
if(!trk) return 0; //ELENA |
| 1255 |
|
|
| 1256 |
|
return trk->CalcBeta(resmax,qualitycut,chi2cut); |
| 1257 |
|
|
| 1258 |
|
}; |
| 1259 |
|
|
| 1260 |
|
|
| 1261 |
//////////////////////////////////////////////////// |
//////////////////////////////////////////////////// |