79 |
|
|
80 |
ToFLevel2::ToFLevel2() { |
ToFLevel2::ToFLevel2() { |
81 |
// |
// |
82 |
// PMT = new TClonesArray("ToFPMT",12); //ELENA |
PMT = new TClonesArray("ToFPMT",12); |
83 |
// ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
ToFTrk = new TClonesArray("ToFTrkVar",2); |
|
PMT = 0; //ELENA |
|
|
ToFTrk = 0; //ELENA |
|
84 |
// |
// |
85 |
this->Clear(); |
this->Clear(); |
86 |
// |
// |
87 |
}; |
}; |
88 |
|
|
|
void ToFLevel2::Set(){//ELENA |
|
|
if(!PMT)PMT = new TClonesArray("ToFPMT",12); //ELENA |
|
|
if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
|
|
}//ELENA |
|
|
|
|
89 |
void ToFLevel2::Clear(){ |
void ToFLevel2::Clear(){ |
90 |
// |
// |
91 |
if(ToFTrk)ToFTrk->Delete(); //ELENA |
ToFTrk->Clear(); |
92 |
if(PMT)PMT->Delete(); //ELENA |
PMT->Clear(); |
93 |
memset(tof_j_flag, 0, 6*sizeof(Int_t)); |
memset(tof_j_flag, 0, 6*sizeof(Int_t)); |
94 |
unpackError = 0; |
unpackError = 0; |
95 |
// |
// |
96 |
}; |
}; |
97 |
|
|
|
void ToFLevel2::Delete(){ //ELENA |
|
|
// |
|
|
if(ToFTrk){ |
|
|
ToFTrk->Delete(); //ELENA |
|
|
delete ToFTrk; //ELENA |
|
|
} |
|
|
if(PMT){ |
|
|
PMT->Delete(); //ELENA |
|
|
delete PMT; //ELENA |
|
|
} //ELENA |
|
|
// |
|
|
}; //ELENA |
|
|
|
|
98 |
ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){ |
ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){ |
99 |
// |
// |
100 |
if(itrk >= ntrk()){ |
if(itrk >= ntrk()){ |
103 |
return(NULL); |
return(NULL); |
104 |
} |
} |
105 |
// |
// |
|
if(!ToFTrk)return 0; //ELENA |
|
106 |
TClonesArray &t = *(ToFTrk); |
TClonesArray &t = *(ToFTrk); |
107 |
ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk]; |
ToFTrkVar *toftrack = (ToFTrkVar*)t[itrk]; |
108 |
return toftrack; |
return toftrack; |
116 |
return(NULL); |
return(NULL); |
117 |
} |
} |
118 |
// |
// |
|
if(!PMT)return 0; //ELENA |
|
119 |
TClonesArray &t = *(PMT); |
TClonesArray &t = *(PMT); |
120 |
ToFPMT *tofpmt = (ToFPMT*)t[ihit]; |
ToFPMT *tofpmt = (ToFPMT*)t[ihit]; |
121 |
return tofpmt; |
return tofpmt; |
146 |
else return -1; |
else return -1; |
147 |
}; |
}; |
148 |
/** |
/** |
149 |
* Method to know if a given ToF paddle was hit, that is there is a TDC signal |
* Method to know if a given ToF paddle was hit, that is there is a TDC signal from both PMTs |
|
* from both PMTs |
|
150 |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
151 |
* @param paddle_id Paddle ID. |
* @param paddle_id Paddle ID. |
152 |
* @return 1 if the paddle was hit. |
* @return 1 if the paddle was hit. |
179 |
|
|
180 |
|
|
181 |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){ |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){ |
|
|
|
182 |
Float_t dedx = 0.; |
Float_t dedx = 0.; |
183 |
Int_t ip = 0; |
Int_t ip = 0; |
184 |
Int_t pmt_id = 0; |
Int_t pmt_id = 0; |
190 |
}; |
}; |
191 |
// |
// |
192 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
|
if(!trk) return 0; //ELENA |
|
193 |
// |
// |
194 |
for (Int_t i=0; i<trk->npmtadc; i++){ |
for (Int_t i=0; i<trk->npmtadc; i++){ |
195 |
// |
// |
197 |
// |
// |
198 |
pl = GetPlaneIndex(pmt_id); |
pl = GetPlaneIndex(pmt_id); |
199 |
// |
// |
200 |
if ( pl == ip ){ |
if ( pl == ip ) dedx += (trk->dedx).At(i); |
|
// // --- patch --- |
|
|
// bool ISNULL=false; |
|
|
// for(Int_t im=0; im< this->npmt(); im++){ |
|
|
// if(this->GetToFPMT(im)->pmt_id == pmt_id && this->GetToFPMT(im)->adc == 4095){ |
|
|
// cout << " ToFLevel2::GetdEdx(Int_t,Int_t) --> **warning** ADC(PMT="<<pmt_id<<") = 4095"<<endl; |
|
|
// ISNULL=true; |
|
|
// } |
|
|
// } |
|
|
// // --- patch --- |
|
|
// dedx += (trk->dedx).At(i)*(Int_t)(!ISNULL); |
|
|
dedx += (trk->dedx).At(i); |
|
|
} |
|
201 |
// |
// |
202 |
}; |
}; |
203 |
// |
// |
219 |
Int_t kk = 0; |
Int_t kk = 0; |
220 |
// |
// |
221 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
|
if(!trk)return; //ELENA |
|
222 |
// |
// |
223 |
for (Int_t i=0; i<trk->npmtadc; i++){ |
for (Int_t i=0; i<trk->npmtadc; i++){ |
224 |
// |
// |
232 |
for (Int_t i=0; i<npmt(); i++){ |
for (Int_t i=0; i<npmt(); i++){ |
233 |
// |
// |
234 |
ToFPMT *pmt = GetToFPMT(i); |
ToFPMT *pmt = GetToFPMT(i); |
|
if(!pmt)break; //ELENA |
|
235 |
// |
// |
236 |
GetPMTIndex(pmt->pmt_id,hh,kk); |
GetPMTIndex(pmt->pmt_id,hh,kk); |
237 |
// |
// |
340 |
for(Int_t i=0;i<6;i++) |
for(Int_t i=0;i<6;i++) |
341 |
l2->tof_j_flag[i]=tof_j_flag[i]; |
l2->tof_j_flag[i]=tof_j_flag[i]; |
342 |
|
|
343 |
if(ToFTrk){ //ELENA |
l2->ntoftrk = ToFTrk->GetEntries(); |
344 |
l2->ntoftrk = ToFTrk->GetEntries(); |
for(Int_t j=0;j<l2->ntoftrk;j++){ |
345 |
for(Int_t j=0;j<l2->ntoftrk;j++){ |
l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno; |
346 |
l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno; |
l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc; |
347 |
l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc; |
for(Int_t i=0;i<l2->npmttdc[j];i++){ |
348 |
for(Int_t i=0;i<l2->npmttdc[j];i++){ |
l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i); |
349 |
l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i); |
l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006 |
350 |
l2->tdcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->tdcflag.At(i); // gf: 30 Nov 2006 |
} |
351 |
} |
for(Int_t i=0;i<13;i++) |
352 |
for(Int_t i=0;i<13;i++) |
l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i]; |
353 |
l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i]; |
|
354 |
|
l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc; |
355 |
l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc; |
for(Int_t i=0;i<l2->npmtadc[j];i++){ |
356 |
for(Int_t i=0;i<l2->npmtadc[j];i++){ |
l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i); |
357 |
l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i); |
l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006 |
358 |
l2->adcflag[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->adcflag.At(i); // gf: 30 Nov 2006 |
l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i); |
359 |
l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i); |
} |
360 |
} |
for(Int_t i=0;i<3;i++){ |
361 |
for(Int_t i=0;i<3;i++){ |
l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; |
362 |
l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; |
l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; |
363 |
l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; |
} |
364 |
} |
} |
|
} |
|
|
} //ELENA |
|
365 |
|
|
366 |
if(PMT){ //ELENA |
l2->npmt = PMT->GetEntries(); |
367 |
l2->npmt = PMT->GetEntries(); |
for(Int_t j=0;j<l2->npmt;j++){ |
368 |
for(Int_t j=0;j<l2->npmt;j++){ |
l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id; |
369 |
l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id; |
l2->adc[j] =((ToFPMT*)PMT->At(j))->adc; |
370 |
l2->adc[j] =((ToFPMT*)PMT->At(j))->adc; |
l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw; |
371 |
l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw; |
} |
|
} |
|
|
} //ELENA |
|
372 |
} |
} |