76 |
PMT = new TClonesArray("ToFPMT",12); |
PMT = new TClonesArray("ToFPMT",12); |
77 |
ToFTrk = new TClonesArray("ToFTrkVar",2); |
ToFTrk = new TClonesArray("ToFTrkVar",2); |
78 |
// |
// |
79 |
memset(tof_j_flag, 0, 6*sizeof(Int_t)); |
this->Clear(); |
80 |
|
// |
81 |
}; |
}; |
82 |
|
|
83 |
void ToFLevel2::Clear(){ |
void ToFLevel2::Clear(){ |
85 |
ToFTrk->Clear(); |
ToFTrk->Clear(); |
86 |
PMT->Clear(); |
PMT->Clear(); |
87 |
memset(tof_j_flag, 0, 6*sizeof(Int_t)); |
memset(tof_j_flag, 0, 6*sizeof(Int_t)); |
88 |
|
unpackError = 0; |
89 |
// |
// |
90 |
}; |
}; |
91 |
|
|
219 |
pmt_id = (trk->pmtadc).At(i); |
pmt_id = (trk->pmtadc).At(i); |
220 |
// |
// |
221 |
GetPMTIndex(pmt_id,hh,kk); |
GetPMTIndex(pmt_id,hh,kk); |
222 |
adc[hh][kk] = (trk->dedx).At(i); |
adc[kk][hh] = (trk->dedx).At(i); |
223 |
// |
// |
224 |
}; |
}; |
225 |
// |
// |
229 |
// |
// |
230 |
GetPMTIndex(pmt->pmt_id,hh,kk); |
GetPMTIndex(pmt->pmt_id,hh,kk); |
231 |
// |
// |
232 |
tdc[hh][kk] = pmt->tdc_tw; |
tdc[kk][hh] = pmt->tdc_tw; |
233 |
// |
// |
234 |
}; |
}; |
235 |
// |
// |
300 |
}; |
}; |
301 |
|
|
302 |
|
|
303 |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t hb, Int_t ch){ |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ |
304 |
// |
// |
305 |
short tof[4][24] = { |
short tof[4][24] = { |
306 |
{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}, |
313 |
while (k < 24){ |
while (k < 24){ |
314 |
Int_t j = 0; |
Int_t j = 0; |
315 |
while (j < 2){ |
while (j < 2){ |
316 |
|
/* tofEvent->tdc[ch][hb] */ |
|
/* tofEvent->tdc[ch][hb] */ |
|
|
|
|
317 |
if( ind == 2*k + j ){ |
if( ind == 2*k + j ){ |
318 |
ch = tof[2*j][k] - 1; |
ch = tof[2*j][k] - 1; |
319 |
hb = tof[2*j + 1][k] - 1; |
hb = tof[2*j + 1][k] - 1; |
320 |
break; |
return; |
321 |
}; |
}; |
322 |
j++; |
j++; |
323 |
}; |
}; |
325 |
}; |
}; |
326 |
return; |
return; |
327 |
}; |
}; |
328 |
|
|
329 |
|
/** |
330 |
|
* Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). |
331 |
|
*/ |
332 |
|
void ToFLevel2::GetLevel2Struct(cToFLevel2 *l2) const{ |
333 |
|
|
334 |
|
for(Int_t i=0;i<6;i++) |
335 |
|
l2->tof_j_flag[i]=tof_j_flag[i]; |
336 |
|
|
337 |
|
l2->ntoftrk = ToFTrk->GetEntries(); |
338 |
|
for(Int_t j=0;j<l2->ntoftrk;j++){ |
339 |
|
l2->toftrkseqno[j]= ((ToFTrkVar*)ToFTrk->At(j))->trkseqno; |
340 |
|
l2->npmttdc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmttdc; |
341 |
|
for(Int_t i=0;i<l2->npmttdc[j];i++) |
342 |
|
l2->pmttdc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmttdc.At(i); |
343 |
|
for(Int_t i=0;i<13;i++) |
344 |
|
l2->beta[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->beta[i]; |
345 |
|
|
346 |
|
l2->npmtadc[j]= ((ToFTrkVar*)ToFTrk->At(j))->npmtadc; |
347 |
|
for(Int_t i=0;i<l2->npmtadc[j];i++){ |
348 |
|
l2->pmtadc[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->pmtadc.At(i); |
349 |
|
l2->dedx[i][j] = ((ToFTrkVar*)ToFTrk->At(j))->dedx.At(i); |
350 |
|
} |
351 |
|
for(Int_t i=0;i<3;i++){ |
352 |
|
l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; |
353 |
|
l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; |
354 |
|
} |
355 |
|
} |
356 |
|
|
357 |
|
l2->npmt = PMT->GetEntries(); |
358 |
|
for(Int_t j=0;j<l2->npmt;j++){ |
359 |
|
l2->pmt_id[j] = ((ToFPMT*)PMT->At(j))->pmt_id; |
360 |
|
l2->adc[j] =((ToFPMT*)PMT->At(j))->adc; |
361 |
|
l2->tdc_tw[j] =((ToFPMT*)PMT->At(j))->tdc_tw; |
362 |
|
} |
363 |
|
} |