| 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){ | 
| 306 | * The method was modified for the "ToF-standalone" part in february 2015 | * The method was modified for the "ToF-standalone" part in february 2015 | 
| 307 | * The "adcfl" option is not very useful (an artificial dEdx is per | * The "adcfl" option is not very useful (an artificial dEdx is per | 
| 308 | * 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 | 
| 309 | * @param notrack Track Number | * @param notrack Track Number (array index, ranging from 0 to ntrk()) | 
| 310 | * @param plane Plane index (0,1,2,3,4,5) | * @param plane Plane index (0,1,2,3,4,5) | 
| 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(seqno);//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 | 
| 392 | /** | /** | 
| 393 | * Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix | * Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix | 
| 394 | * with the time-walk corrected TDC values. | * with the time-walk corrected TDC values. | 
| 395 | * @param notrack Track Number | * @param notrack Track Number (arry index, ranging from 0 to ntrk()) | 
| 396 | * @param adc  ADC_C matrix with dEdx values | * @param adc  ADC_C matrix with dEdx values | 
| 397 | * @param tdc  TDC matrix | * @param tdc  TDC matrix | 
| 398 | */ | */ | 
| 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}, | 
| 530 | * Method to get the dEdx from a given ToF paddle. | * Method to get the dEdx from a given ToF paddle. | 
| 531 | * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise | * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise | 
| 532 | * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000 | * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000 | 
| 533 | * @param notrack Track Number | * @param notrack Track Number (-1 for standalone info) | 
| 534 | * @param Paddle index (0,1,...,23). | * @param Paddle index (0,1,...,23). | 
| 535 | * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) | * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) | 
| 536 | * @param PadEdx dEdx from a given ToF paddle | * @param PadEdx dEdx from a given ToF paddle | 
| 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); | ToFTrkVar *trk = GetToFTrkVar(notrack); | 
| 542 |  | //    ToFTrkVar *trk = GetToFStoredTrack(seqno); //Elena 2015 | 
| 543 | this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning); | this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning); | 
| 544 |  |  | 
| 545 | }; | }; | 
| 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 |  | * @param notrack Track Number (arry index, ranging from 0 to ntrk()) | 
| 1248 |  | */ | 
| 1249 |  | Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){ | 
| 1250 |  |  | 
| 1251 |  | //  cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl; | 
| 1252 |  |  | 
| 1253 |  | ToFTrkVar *trk = GetToFTrkVar(notrack); | 
| 1254 |  | //    ToFTrkVar *trk = GetToFStoredTrack(seqno);//Elena Apr 2015 | 
| 1255 |  | if(!trk) return 0; //ELENA | 
| 1256 |  |  | 
| 1257 |  | return trk->CalcBeta(resmax,qualitycut,chi2cut); | 
| 1258 |  |  | 
| 1259 |  | }; | 
| 1260 |  |  | 
| 1261 |  |  | 
| 1262 | //////////////////////////////////////////////////// | //////////////////////////////////////////////////// |