| 15 |
pmt_id = 0; |
pmt_id = 0; |
| 16 |
adc = 0.; |
adc = 0.; |
| 17 |
tdc_tw = 0.; |
tdc_tw = 0.; |
| 18 |
|
tdc = 0.; |
| 19 |
} |
} |
| 20 |
|
|
| 21 |
ToFPMT::ToFPMT(const ToFPMT &t){ |
ToFPMT::ToFPMT(const ToFPMT &t){ |
| 22 |
pmt_id = t.pmt_id; |
pmt_id = t.pmt_id; |
| 23 |
adc = t.adc; |
adc = t.adc; |
| 24 |
tdc_tw = t.tdc_tw; |
tdc_tw = t.tdc_tw; |
| 25 |
|
tdc = t.tdc; |
| 26 |
} |
} |
| 27 |
|
|
| 28 |
void ToFPMT::Clear(){ |
void ToFPMT::Clear(Option_t *t){ |
| 29 |
pmt_id = 0; |
pmt_id = 0; |
| 30 |
adc = 0.; |
adc = 0.; |
| 31 |
tdc_tw = 0.; |
tdc_tw = 0.; |
| 32 |
|
tdc = 0.; |
| 33 |
} |
} |
| 34 |
|
|
| 35 |
|
|
| 48 |
memset(beta, 0, 13*sizeof(Float_t)); |
memset(beta, 0, 13*sizeof(Float_t)); |
| 49 |
memset(xtofpos, 0, 3*sizeof(Float_t)); |
memset(xtofpos, 0, 3*sizeof(Float_t)); |
| 50 |
memset(ytofpos, 0, 3*sizeof(Float_t)); |
memset(ytofpos, 0, 3*sizeof(Float_t)); |
| 51 |
|
memset(xtr_tof, 0, 6*sizeof(Float_t)); |
| 52 |
|
memset(ytr_tof, 0, 6*sizeof(Float_t)); |
| 53 |
// |
// |
| 54 |
}; |
}; |
| 55 |
|
|
| 56 |
void ToFTrkVar::Clear() { |
void ToFTrkVar::Clear(Option_t *t) { |
| 57 |
trkseqno = 0; |
trkseqno = 0; |
| 58 |
npmttdc = 0; |
npmttdc = 0; |
| 59 |
npmtadc = 0; |
npmtadc = 0; |
| 66 |
memset(beta, 0, 13*sizeof(Float_t)); |
memset(beta, 0, 13*sizeof(Float_t)); |
| 67 |
memset(xtofpos, 0, 3*sizeof(Float_t)); |
memset(xtofpos, 0, 3*sizeof(Float_t)); |
| 68 |
memset(ytofpos, 0, 3*sizeof(Float_t)); |
memset(ytofpos, 0, 3*sizeof(Float_t)); |
| 69 |
|
memset(xtr_tof, 0, 6*sizeof(Float_t)); |
| 70 |
|
memset(ytr_tof, 0, 6*sizeof(Float_t)); |
| 71 |
// |
// |
| 72 |
}; |
}; |
| 73 |
|
|
| 86 |
memcpy(beta,t.beta,sizeof(beta)); |
memcpy(beta,t.beta,sizeof(beta)); |
| 87 |
memcpy(xtofpos,t.xtofpos,sizeof(xtofpos)); |
memcpy(xtofpos,t.xtofpos,sizeof(xtofpos)); |
| 88 |
memcpy(ytofpos,t.ytofpos,sizeof(ytofpos)); |
memcpy(ytofpos,t.ytofpos,sizeof(ytofpos)); |
| 89 |
|
memcpy(xtr_tof,t.xtr_tof,sizeof(xtr_tof)); |
| 90 |
|
memcpy(ytr_tof,t.ytr_tof,sizeof(ytr_tof)); |
| 91 |
// |
// |
| 92 |
}; |
}; |
| 93 |
|
|
| 107 |
if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
| 108 |
}//ELENA |
}//ELENA |
| 109 |
|
|
| 110 |
void ToFLevel2::Clear(){ |
void ToFLevel2::Clear(Option_t *t){ |
| 111 |
// |
// |
| 112 |
if(ToFTrk)ToFTrk->Delete(); //ELENA |
if(ToFTrk)ToFTrk->Delete(); //ELENA |
| 113 |
if(PMT)PMT->Delete(); //ELENA |
if(PMT)PMT->Delete(); //ELENA |
| 116 |
// |
// |
| 117 |
}; |
}; |
| 118 |
|
|
| 119 |
void ToFLevel2::Delete(){ //ELENA |
void ToFLevel2::Delete(Option_t *t){ //ELENA |
| 120 |
// |
// |
| 121 |
if(ToFTrk){ |
if(ToFTrk){ |
| 122 |
ToFTrk->Delete(); //ELENA |
ToFTrk->Delete(); //ELENA |
| 162 |
//-------------------------------------- |
//-------------------------------------- |
| 163 |
/** |
/** |
| 164 |
* Method to get the plane ID (11 12 21 22 31 32) from the plane index (0 1 2 3 4 5) |
* Method to get the plane ID (11 12 21 22 31 32) from the plane index (0 1 2 3 4 5) |
| 165 |
|
* @param Plane index (0,1,2,3,4,5). |
| 166 |
*/ |
*/ |
| 167 |
Int_t ToFLevel2::GetToFPlaneID(Int_t ip){ |
Int_t ToFLevel2::GetToFPlaneID(Int_t ip){ |
| 168 |
if(ip>=0 && ip<6)return 10*((int)(ip/2+1.1))+(ip%2)+1; |
if(ip>=0 && ip<6)return 10*((int)(ip/2+1.1))+(ip%2)+1; |
| 170 |
}; |
}; |
| 171 |
/** |
/** |
| 172 |
* Method to get the plane index (0 1 2 3 4 5) from the plane ID (11 12 21 22 31 32) |
* Method to get the plane index (0 1 2 3 4 5) from the plane ID (11 12 21 22 31 32) |
| 173 |
|
* @param plane Plane ID (11, 12, 21, 22, 31, 32) |
| 174 |
*/ |
*/ |
| 175 |
Int_t ToFLevel2::GetToFPlaneIndex(Int_t plane_id){ |
Int_t ToFLevel2::GetToFPlaneIndex(Int_t plane_id){ |
| 176 |
if( |
if( |
| 185 |
}; |
}; |
| 186 |
/** |
/** |
| 187 |
* 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 |
| 188 |
* from both PMTs |
* from both PMTs. The method uses the "tof_j_flag" variable. |
| 189 |
* @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). |
| 190 |
* @param paddle_id Paddle ID. |
* @param paddle_id Paddle ID. |
| 191 |
* @return 1 if the paddle was hit. |
* @return 1 if the paddle was hit. |
| 217 |
}; |
}; |
| 218 |
|
|
| 219 |
|
|
| 220 |
|
//gf Apr 07 |
| 221 |
/** |
/** |
| 222 |
* Method to get the mean dEdx from a given ToF plane |
* Method to get the mean dEdx from a given ToF plane. This current version |
| 223 |
|
* is just summing up all PMT signals, which will not give proper results, |
| 224 |
|
* and needs a revision. |
| 225 |
* @param notrack Track Number |
* @param notrack Track Number |
| 226 |
* @param plane Plane index (0,1,2,3,4,5). |
* @param plane Plane index (0,1,2,3,4,5) |
| 227 |
|
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
| 228 |
*/ |
*/ |
| 229 |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane){ |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ |
| 230 |
|
|
| 231 |
Float_t dedx = 0.; |
Float_t dedx = 0.; |
| 232 |
Int_t ip = 0; |
Float_t PadEdx =0.; |
| 233 |
Int_t pmt_id = 0; |
Int_t SatWarning; |
| 234 |
Int_t pl = 0; |
Int_t pad=-1; |
|
if ( plane >= 6 ){ |
|
|
ip = GetToFPlaneIndex(plane); |
|
|
} else { |
|
|
ip = plane; |
|
|
}; |
|
| 235 |
// |
// |
| 236 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
| 237 |
if(!trk) return 0; //ELENA |
if(!trk) return 0; //ELENA |
| 238 |
// |
// |
| 239 |
for (Int_t i=0; i<trk->npmtadc; i++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
| 240 |
// |
Int_t paddleid=ii; |
| 241 |
pmt_id = (trk->pmtadc).At(i); |
pad = GetPaddleid(plane,paddleid); |
| 242 |
// |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
| 243 |
pl = GetPlaneIndex(pmt_id); |
dedx += PadEdx; |
|
// |
|
|
if ( pl == ip ) dedx += (trk->dedx).At(i); |
|
|
// |
|
| 244 |
}; |
}; |
| 245 |
// |
// |
| 246 |
return(dedx); |
return(dedx); |
| 247 |
}; |
}; |
| 248 |
|
|
|
|
|
| 249 |
/** |
/** |
| 250 |
* Method to fill the ADC_C (dEdx) and TDC matrix (4,12) |
* Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix |
| 251 |
|
* with the time-walk corrected TDC values. |
| 252 |
* @param notrack Track Number |
* @param notrack Track Number |
| 253 |
* @param adc ADC_C matrix with dEdx values |
* @param adc ADC_C matrix with dEdx values |
| 254 |
* @param tdc TDC matrix |
* @param tdc TDC matrix |
| 309 |
return(-1); |
return(-1); |
| 310 |
}; |
}; |
| 311 |
|
|
| 312 |
|
|
| 313 |
/** |
/** |
| 314 |
* Method to get the PMT_ID if the index (4,12) is given |
* Method to get the PMT_ID if the index (4,12) is given. We have 4 channels on |
| 315 |
|
* each of the 12 half-boards, this method decodes which PMT is cables to which |
| 316 |
|
* channel. |
| 317 |
* @param hh Channel |
* @param hh Channel |
| 318 |
* @param kk HalfBoard |
* @param kk HalfBoard |
| 319 |
*/ |
*/ |
| 345 |
return ind; |
return ind; |
| 346 |
}; |
}; |
| 347 |
|
|
|
/** |
|
|
* Method to get the PMT name (like "S11_1A") if the PMT_ID is given |
|
|
* @param ind PMT_ID (0 - 47) |
|
|
*/ |
|
|
TString ToFLevel2::GetPMTName(Int_t ind){ |
|
|
|
|
|
TString pmtname = " "; |
|
|
|
|
|
TString photoS[48] = { |
|
|
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", "S11_4B", |
|
|
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", "S11_8B", |
|
|
"S12_1A", "S12_1B", "S12_2A", "S12_2B", "S12_3A", "S12_3B", "S12_4A", "S12_4B", "S12_5A", "S12_5B", "S12_6A", "S12_6B", |
|
|
"S21_1A", "S21_1B", "S21_2A", "S21_2B", |
|
|
"S22_1A", "S22_1B", "S22_2A", "S22_2B", |
|
|
"S31_1A", "S31_1B", "S31_2A", "S31_2B", "S31_3A", "S31_3B", |
|
|
"S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" |
|
|
}; |
|
|
|
|
|
|
|
|
pmtname = photoS[ind].Data(); |
|
|
|
|
|
return pmtname; |
|
|
}; |
|
| 348 |
|
|
| 349 |
/** |
/** |
| 350 |
* Method to get the PMT index if the PMT ID is given |
* Method to get the PMT index if the PMT ID is given. This method is the |
| 351 |
|
* "reverse" of method "GetPMTid" |
| 352 |
* @param ind PMT_ID (0 - 47) |
* @param ind PMT_ID (0 - 47) |
| 353 |
* @param hb HalfBoard |
* @param hb HalfBoard |
| 354 |
* @param ch Channel |
* @param ch Channel |
| 379 |
return; |
return; |
| 380 |
}; |
}; |
| 381 |
|
|
| 382 |
|
|
| 383 |
|
|
| 384 |
|
|
| 385 |
|
/// gf Apr 07 |
| 386 |
|
|
| 387 |
|
/** |
| 388 |
|
* Method to get the dEdx from a given ToF paddle. |
| 389 |
|
* @param notrack Track Number |
| 390 |
|
* @param Paddle index (0,1,...,23). |
| 391 |
|
* @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
| 392 |
|
* @param PadEdx dEdx from a given ToF paddle |
| 393 |
|
* @param SatWarning 1 if the PMT ios near saturation region (adcraw ~3000) |
| 394 |
|
*/ |
| 395 |
|
void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ |
| 396 |
|
|
| 397 |
|
PadEdx = 0.; |
| 398 |
|
SatWarning = 1000; |
| 399 |
|
|
| 400 |
|
Float_t dEdx[48] = {0}; |
| 401 |
|
Int_t pmt_id = -1; |
| 402 |
|
Float_t adcraw[48]; |
| 403 |
|
// |
| 404 |
|
ToFTrkVar *trk = GetToFTrkVar(notrack); |
| 405 |
|
if(!trk) return; //ELENA |
| 406 |
|
// |
| 407 |
|
|
| 408 |
|
Int_t pmtleft=-1; |
| 409 |
|
Int_t pmtright=-1; |
| 410 |
|
GetPaddlePMT(paddleid, pmtleft, pmtright); |
| 411 |
|
|
| 412 |
|
adcraw[pmtleft] = 4095; |
| 413 |
|
adcraw[pmtright] = 4095; |
| 414 |
|
|
| 415 |
|
|
| 416 |
|
for (Int_t jj=0; jj<npmt(); jj++){ |
| 417 |
|
|
| 418 |
|
ToFPMT *pmt = GetToFPMT(jj); |
| 419 |
|
if(!pmt)break; //ELENA |
| 420 |
|
|
| 421 |
|
pmt_id = pmt->pmt_id; |
| 422 |
|
if(pmt_id==pmtleft){ |
| 423 |
|
adcraw[pmtleft] = pmt->adc; |
| 424 |
|
} |
| 425 |
|
|
| 426 |
|
if(pmt_id==pmtright){ |
| 427 |
|
adcraw[pmtright] = pmt->adc; |
| 428 |
|
} |
| 429 |
|
} |
| 430 |
|
|
| 431 |
|
for (Int_t i=0; i<trk->npmtadc; i++){ |
| 432 |
|
|
| 433 |
|
if((trk->adcflag).At(i)==0 || adcfl==100){ |
| 434 |
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = (trk->dedx).At(i); |
| 435 |
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = (trk->dedx).At(i); |
| 436 |
|
}else{ |
| 437 |
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = 0.; |
| 438 |
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = 0.; |
| 439 |
|
} |
| 440 |
|
} |
| 441 |
|
|
| 442 |
|
if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; |
| 443 |
|
|
| 444 |
|
if(dEdx[pmtleft]!=0 && dEdx[pmtright]!=0){ |
| 445 |
|
PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; |
| 446 |
|
} |
| 447 |
|
if(dEdx[pmtleft]==0 && dEdx[pmtright]!=0){ |
| 448 |
|
PadEdx = dEdx[pmtright]; |
| 449 |
|
} |
| 450 |
|
if(dEdx[pmtleft]!=0 && dEdx[pmtright]==0){ |
| 451 |
|
PadEdx = dEdx[pmtleft]; |
| 452 |
|
} |
| 453 |
|
|
| 454 |
|
return; |
| 455 |
|
}; |
| 456 |
|
// |
| 457 |
|
|
| 458 |
|
|
| 459 |
|
// gf Apr 07 |
| 460 |
|
|
| 461 |
|
/** |
| 462 |
|
* Method to get the PMT name (like "S11_1A") if the PMT_ID is given. |
| 463 |
|
* Indexes of corresponding plane, paddle and pmt are also given as output. |
| 464 |
|
* @param ind PMT_ID (0 - 47) |
| 465 |
|
* @param iplane plane index (0 - 5) |
| 466 |
|
* @param ipaddle paddle index (relative to the plane) |
| 467 |
|
* @param ipmt pmt index (0(A), 1(B)) |
| 468 |
|
*/ |
| 469 |
|
TString ToFLevel2::GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt){ |
| 470 |
|
|
| 471 |
|
TString pmtname = " "; |
| 472 |
|
|
| 473 |
|
TString photoS[48] = { |
| 474 |
|
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
| 475 |
|
"S11_4B", |
| 476 |
|
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
| 477 |
|
"S11_8B", |
| 478 |
|
"S12_1A", "S12_1B", "S12_2A", "S12_2B", "S12_3A", "S12_3B", "S12_4A", |
| 479 |
|
"S12_4B", "S12_5A", "S12_5B", "S12_6A", "S12_6B", |
| 480 |
|
"S21_1A", "S21_1B", "S21_2A", "S21_2B", |
| 481 |
|
"S22_1A", "S22_1B", "S22_2A", "S22_2B", |
| 482 |
|
"S31_1A", "S31_1B", "S31_2A", "S31_2B", "S31_3A", "S31_3B", |
| 483 |
|
"S32_1A", "S32_1B", "S32_2A", "S32_2B", "S32_3A", "S32_3B" |
| 484 |
|
}; |
| 485 |
|
|
| 486 |
|
|
| 487 |
|
pmtname = photoS[ind].Data(); |
| 488 |
|
|
| 489 |
|
TString ss = pmtname(1,2); |
| 490 |
|
iplane = (int)(atoi(ss.Data())/10)*2-3+atoi(ss.Data())%10; |
| 491 |
|
ss = pmtname(4); |
| 492 |
|
ipaddle = atoi(ss.Data())-1 ; |
| 493 |
|
if( pmtname.Contains("A") )ipmt=0; |
| 494 |
|
if( pmtname.Contains("B") )ipmt=1; |
| 495 |
|
|
| 496 |
|
return pmtname; |
| 497 |
|
}; |
| 498 |
|
/** |
| 499 |
|
* Method to get the PMT name (like "S11_1A") if the PMT_ID is given |
| 500 |
|
* @param ind PMT_ID (0 - 47) |
| 501 |
|
*/ |
| 502 |
|
TString ToFLevel2::GetPMTName(Int_t ind){ |
| 503 |
|
|
| 504 |
|
Int_t iplane = -1; |
| 505 |
|
Int_t ipaddle = -1; |
| 506 |
|
Int_t ipmt = -1; |
| 507 |
|
return GetPMTName(ind,iplane,ipaddle,ipmt); |
| 508 |
|
|
| 509 |
|
}; |
| 510 |
|
|
| 511 |
|
|
| 512 |
|
// gf Apr 07 |
| 513 |
|
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ |
| 514 |
|
|
| 515 |
|
Double_t xt,yt,xl,xh,yl,yh; |
| 516 |
|
|
| 517 |
|
Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; |
| 518 |
|
Float_t tof12_y[6] = { -13.75,-8.25,-2.75,2.75,8.25,13.75}; |
| 519 |
|
Float_t tof21_y[2] = { 3.75,-3.75}; |
| 520 |
|
Float_t tof22_x[2] = { -4.5,4.5}; |
| 521 |
|
Float_t tof31_x[3] = { -6.0,0.,6.0}; |
| 522 |
|
Float_t tof32_y[3] = { -5.0,0.0,5.0}; |
| 523 |
|
|
| 524 |
|
// S11 8 paddles 33.0 x 5.1 cm |
| 525 |
|
// S12 6 paddles 40.8 x 5.5 cm |
| 526 |
|
// S21 2 paddles 18.0 x 7.5 cm |
| 527 |
|
// S22 2 paddles 15.0 x 9.0 cm |
| 528 |
|
// S31 3 paddles 15.0 x 6.0 cm |
| 529 |
|
// S32 3 paddles 18.0 x 5.0 cm |
| 530 |
|
|
| 531 |
|
Int_t paddleidoftrack=-1; |
| 532 |
|
// |
| 533 |
|
|
| 534 |
|
//--- S11 ------ |
| 535 |
|
|
| 536 |
|
if(plane==0){ |
| 537 |
|
xt = xtr; |
| 538 |
|
yt = ytr; |
| 539 |
|
paddleidoftrack=-1; |
| 540 |
|
yl = -33.0/2. ; |
| 541 |
|
yh = 33.0/2. ; |
| 542 |
|
if ((yt>yl)&&(yt<yh)) { |
| 543 |
|
for (Int_t i1=0; i1<8;i1++){ |
| 544 |
|
xl = tof11_x[i1] - (5.1-0.4)/2. ; |
| 545 |
|
xh = tof11_x[i1] + (5.1-0.4)/2. ; |
| 546 |
|
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
| 547 |
|
} |
| 548 |
|
} |
| 549 |
|
} |
| 550 |
|
// cout<<"S11 "<<paddleidoftrack[0]<<"\n"; |
| 551 |
|
|
| 552 |
|
//--- S12 ------- |
| 553 |
|
if(plane==1){ |
| 554 |
|
xt = xtr; |
| 555 |
|
yt = ytr; |
| 556 |
|
paddleidoftrack=-1; |
| 557 |
|
xl = -40.8/2. ; |
| 558 |
|
xh = 40.8/2. ; |
| 559 |
|
|
| 560 |
|
if ((xt>xl)&&(xt<xh)) { |
| 561 |
|
for (Int_t i1=0; i1<6;i1++){ |
| 562 |
|
yl = tof12_y[i1] - (5.5-0.4)/2. ; |
| 563 |
|
yh = tof12_y[i1] + (5.5-0.4)/2. ; |
| 564 |
|
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
| 565 |
|
} |
| 566 |
|
} |
| 567 |
|
} |
| 568 |
|
|
| 569 |
|
//--- S21 ------ |
| 570 |
|
|
| 571 |
|
if(plane==2){ |
| 572 |
|
xt = xtr; |
| 573 |
|
yt = ytr; |
| 574 |
|
paddleidoftrack=-1; |
| 575 |
|
xl = -18./2. ; |
| 576 |
|
xh = 18./2. ; |
| 577 |
|
|
| 578 |
|
if ((xt>xl)&&(xt<xh)) { |
| 579 |
|
for (Int_t i1=0; i1<2;i1++){ |
| 580 |
|
yl = tof21_y[i1] - (7.5-0.4)/2. ; |
| 581 |
|
yh = tof21_y[i1] + (7.5-0.4)/2. ; |
| 582 |
|
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
| 583 |
|
} |
| 584 |
|
} |
| 585 |
|
} |
| 586 |
|
|
| 587 |
|
//--- S22 ------ |
| 588 |
|
if(plane==3){ |
| 589 |
|
xt = xtr; |
| 590 |
|
yt = ytr; |
| 591 |
|
paddleidoftrack=-1; |
| 592 |
|
yl = -15./2. ; |
| 593 |
|
yh = 15./2. ; |
| 594 |
|
|
| 595 |
|
if ((yt>yl)&&(yt<yh)) { |
| 596 |
|
for (Int_t i1=0; i1<2;i1++){ |
| 597 |
|
xl = tof22_x[i1] - (9.0-0.4)/2. ; |
| 598 |
|
xh = tof22_x[i1] + (9.0-0.4)/2. ; |
| 599 |
|
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
| 600 |
|
} |
| 601 |
|
} |
| 602 |
|
} |
| 603 |
|
|
| 604 |
|
//--- S31 ------ |
| 605 |
|
if(plane==4){ |
| 606 |
|
xt = xtr; |
| 607 |
|
yt = ytr; |
| 608 |
|
paddleidoftrack=-1; |
| 609 |
|
yl = -15.0/2. ; |
| 610 |
|
yh = 15.0/2. ; |
| 611 |
|
|
| 612 |
|
if ((yt>yl)&&(yt<yh)) { |
| 613 |
|
for (Int_t i1=0; i1<3;i1++){ |
| 614 |
|
xl = tof31_x[i1] - (6.0-0.4)/2. ; |
| 615 |
|
xh = tof31_x[i1] + (6.0-0.4)/2. ; |
| 616 |
|
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
| 617 |
|
} |
| 618 |
|
} |
| 619 |
|
} |
| 620 |
|
|
| 621 |
|
//--- S32 ------ |
| 622 |
|
if(plane==5){ |
| 623 |
|
xt = xtr; |
| 624 |
|
yt = ytr; |
| 625 |
|
paddleidoftrack=-1; |
| 626 |
|
xl = -18.0/2. ; |
| 627 |
|
xh = 18.0/2. ; |
| 628 |
|
|
| 629 |
|
if ((xt>xl)&&(xt<xh)) { |
| 630 |
|
for (Int_t i1=0; i1<3;i1++){ |
| 631 |
|
yl = tof32_y[i1] - (5.0-0.4)/2. ; |
| 632 |
|
yh = tof32_y[i1] + (5.0-0.4)/2. ; |
| 633 |
|
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
| 634 |
|
} |
| 635 |
|
} |
| 636 |
|
} |
| 637 |
|
|
| 638 |
|
return paddleidoftrack; |
| 639 |
|
|
| 640 |
|
} |
| 641 |
|
|
| 642 |
|
// |
| 643 |
|
|
| 644 |
|
// gf Apr 07 |
| 645 |
|
|
| 646 |
|
void ToFLevel2::GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle){ |
| 647 |
|
|
| 648 |
|
plane = GetPlaneIndex(pmt_id); |
| 649 |
|
|
| 650 |
|
if(plane == 0){ |
| 651 |
|
if(pmt_id==0 || pmt_id==1)paddle=0; |
| 652 |
|
if(pmt_id==2 || pmt_id==3)paddle=1; |
| 653 |
|
if(pmt_id==4 || pmt_id==5)paddle=2; |
| 654 |
|
if(pmt_id==6 || pmt_id==7)paddle=3; |
| 655 |
|
if(pmt_id==8 || pmt_id==9)paddle=4; |
| 656 |
|
if(pmt_id==10 || pmt_id==11)paddle=5; |
| 657 |
|
if(pmt_id==12 || pmt_id==13)paddle=6; |
| 658 |
|
if(pmt_id==14 || pmt_id==15)paddle=7; |
| 659 |
|
} |
| 660 |
|
|
| 661 |
|
if(plane == 1){ |
| 662 |
|
if(pmt_id==16 || pmt_id==17)paddle=0; |
| 663 |
|
if(pmt_id==18 || pmt_id==19)paddle=1; |
| 664 |
|
if(pmt_id==20 || pmt_id==21)paddle=2; |
| 665 |
|
if(pmt_id==22 || pmt_id==23)paddle=3; |
| 666 |
|
if(pmt_id==24 || pmt_id==25)paddle=4; |
| 667 |
|
if(pmt_id==26 || pmt_id==27)paddle=5; |
| 668 |
|
} |
| 669 |
|
|
| 670 |
|
if(plane == 2){ |
| 671 |
|
if(pmt_id==28 || pmt_id==29)paddle=0; |
| 672 |
|
if(pmt_id==30 || pmt_id==31)paddle=1; |
| 673 |
|
} |
| 674 |
|
|
| 675 |
|
if(plane == 3){ |
| 676 |
|
if(pmt_id==32 || pmt_id==33)paddle=0; |
| 677 |
|
if(pmt_id==34 || pmt_id==35)paddle=1; |
| 678 |
|
} |
| 679 |
|
|
| 680 |
|
if(plane == 4){ |
| 681 |
|
if(pmt_id==36 || pmt_id==37)paddle=0; |
| 682 |
|
if(pmt_id==38 || pmt_id==39)paddle=1; |
| 683 |
|
if(pmt_id==40 || pmt_id==41)paddle=2; |
| 684 |
|
} |
| 685 |
|
|
| 686 |
|
if(plane == 5){ |
| 687 |
|
if(pmt_id==42 || pmt_id==43)paddle=0; |
| 688 |
|
if(pmt_id==44 || pmt_id==45)paddle=1; |
| 689 |
|
if(pmt_id==46 || pmt_id==47)paddle=2; |
| 690 |
|
} |
| 691 |
|
return; |
| 692 |
|
} |
| 693 |
|
|
| 694 |
|
// |
| 695 |
|
|
| 696 |
|
// gf Apr 07 |
| 697 |
|
|
| 698 |
|
void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ |
| 699 |
|
|
| 700 |
|
if(paddle==0){ |
| 701 |
|
pmtleft=0; |
| 702 |
|
pmtright=1; |
| 703 |
|
} |
| 704 |
|
|
| 705 |
|
if(paddle==1){ |
| 706 |
|
pmtleft=2; |
| 707 |
|
pmtright=3; |
| 708 |
|
} |
| 709 |
|
|
| 710 |
|
if(paddle==2){ |
| 711 |
|
pmtleft=4; |
| 712 |
|
pmtright=5; |
| 713 |
|
} |
| 714 |
|
|
| 715 |
|
if(paddle==3){ |
| 716 |
|
pmtleft=6; |
| 717 |
|
pmtright=7; |
| 718 |
|
} |
| 719 |
|
|
| 720 |
|
if(paddle==4){ |
| 721 |
|
pmtleft=8; |
| 722 |
|
pmtright=9; |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
if(paddle==5){ |
| 726 |
|
pmtleft=10; |
| 727 |
|
pmtright=11; |
| 728 |
|
} |
| 729 |
|
|
| 730 |
|
if(paddle==6){ |
| 731 |
|
pmtleft=12; |
| 732 |
|
pmtright=13; |
| 733 |
|
} |
| 734 |
|
|
| 735 |
|
if(paddle==7){ |
| 736 |
|
pmtleft=14; |
| 737 |
|
pmtright=15; |
| 738 |
|
} |
| 739 |
|
|
| 740 |
|
if(paddle==8){ |
| 741 |
|
pmtleft=16; |
| 742 |
|
pmtright=17; |
| 743 |
|
} |
| 744 |
|
|
| 745 |
|
if(paddle==9){ |
| 746 |
|
pmtleft=18; |
| 747 |
|
pmtright=19; |
| 748 |
|
} |
| 749 |
|
|
| 750 |
|
if(paddle==10){ |
| 751 |
|
pmtleft=20; |
| 752 |
|
pmtright=21; |
| 753 |
|
} |
| 754 |
|
|
| 755 |
|
if(paddle==11){ |
| 756 |
|
pmtleft=22; |
| 757 |
|
pmtright=23; |
| 758 |
|
} |
| 759 |
|
|
| 760 |
|
if(paddle==12){ |
| 761 |
|
pmtleft=24; |
| 762 |
|
pmtright=25; |
| 763 |
|
} |
| 764 |
|
|
| 765 |
|
if(paddle==13){ |
| 766 |
|
pmtleft=26; |
| 767 |
|
pmtright=27; |
| 768 |
|
} |
| 769 |
|
|
| 770 |
|
if(paddle==14){ |
| 771 |
|
pmtleft=28; |
| 772 |
|
pmtright=29; |
| 773 |
|
} |
| 774 |
|
|
| 775 |
|
if(paddle==15){ |
| 776 |
|
pmtleft=30; |
| 777 |
|
pmtright=31; |
| 778 |
|
} |
| 779 |
|
|
| 780 |
|
if(paddle==16){ |
| 781 |
|
pmtleft=32; |
| 782 |
|
pmtright=33; |
| 783 |
|
} |
| 784 |
|
|
| 785 |
|
if(paddle==17){ |
| 786 |
|
pmtleft=34; |
| 787 |
|
pmtright=35; |
| 788 |
|
} |
| 789 |
|
|
| 790 |
|
if(paddle==18){ |
| 791 |
|
pmtleft=36; |
| 792 |
|
pmtright=37; |
| 793 |
|
} |
| 794 |
|
|
| 795 |
|
if(paddle==19){ |
| 796 |
|
pmtleft=38; |
| 797 |
|
pmtright=39; |
| 798 |
|
} |
| 799 |
|
|
| 800 |
|
if(paddle==20){ |
| 801 |
|
pmtleft=40; |
| 802 |
|
pmtright=41; |
| 803 |
|
} |
| 804 |
|
|
| 805 |
|
if(paddle==21){ |
| 806 |
|
pmtleft=42; |
| 807 |
|
pmtright=43; |
| 808 |
|
} |
| 809 |
|
|
| 810 |
|
if(paddle==22){ |
| 811 |
|
pmtleft=44; |
| 812 |
|
pmtright=45; |
| 813 |
|
} |
| 814 |
|
|
| 815 |
|
if(paddle==23){ |
| 816 |
|
pmtleft=46; |
| 817 |
|
pmtright=47; |
| 818 |
|
} |
| 819 |
|
|
| 820 |
|
return; |
| 821 |
|
} |
| 822 |
|
|
| 823 |
|
// |
| 824 |
|
|
| 825 |
|
|
| 826 |
|
|
| 827 |
|
// // gf Apr 07 |
| 828 |
|
|
| 829 |
|
void ToFLevel2::GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright){ |
| 830 |
|
|
| 831 |
|
Int_t i1; |
| 832 |
|
|
| 833 |
|
Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; |
| 834 |
|
Float_t tof12_y[6] = { -13.75,-8.25,-2.75,2.75,8.25,13.75}; |
| 835 |
|
Float_t tof21_y[2] = { 3.75,-3.75}; |
| 836 |
|
Float_t tof22_x[2] = { -4.5,4.5}; |
| 837 |
|
Float_t tof31_x[3] = { -6.0,0.,6.0}; |
| 838 |
|
Float_t tof32_y[3] = { -5.0,0.0,5.0}; |
| 839 |
|
|
| 840 |
|
// S11 8 paddles 33.0 x 5.1 cm |
| 841 |
|
// S12 6 paddles 40.8 x 5.5 cm |
| 842 |
|
// S21 2 paddles 18.0 x 7.5 cm |
| 843 |
|
// S22 2 paddles 15.0 x 9.0 cm |
| 844 |
|
// S31 3 paddles 15.0 x 6.0 cm |
| 845 |
|
// S32 3 paddles 18.0 x 5.0 cm |
| 846 |
|
|
| 847 |
|
if(plane==0) |
| 848 |
|
{ |
| 849 |
|
for (i1=0; i1<8;i1++){ |
| 850 |
|
if(i1 == paddle){ |
| 851 |
|
xleft = tof11_x[i1] - 5.1/2.; |
| 852 |
|
xright = tof11_x[i1] + 5.1/2.; |
| 853 |
|
yleft = -33.0/2.; |
| 854 |
|
yright = 33.0/2.; |
| 855 |
|
} |
| 856 |
|
} |
| 857 |
|
} |
| 858 |
|
|
| 859 |
|
if(plane==1) |
| 860 |
|
{ |
| 861 |
|
for (i1=0; i1<6;i1++){ |
| 862 |
|
if(i1 == paddle){ |
| 863 |
|
xleft = -40.8/2.; |
| 864 |
|
xright = 40.8/2.; |
| 865 |
|
yleft = tof12_y[i1] - 5.5/2.; |
| 866 |
|
yright = tof12_y[i1] + 5.5/2.; |
| 867 |
|
} |
| 868 |
|
} |
| 869 |
|
} |
| 870 |
|
|
| 871 |
|
if(plane==2) |
| 872 |
|
{ |
| 873 |
|
for (i1=0; i1<2;i1++){ |
| 874 |
|
if(i1 == paddle){ |
| 875 |
|
xleft = -18./2.; |
| 876 |
|
xright = 18./2.; |
| 877 |
|
yleft = tof21_y[i1] - 7.5/2.; |
| 878 |
|
yright = tof21_y[i1] + 7.5/2.; |
| 879 |
|
} |
| 880 |
|
} |
| 881 |
|
} |
| 882 |
|
|
| 883 |
|
if(plane==3) |
| 884 |
|
{ |
| 885 |
|
for (i1=0; i1<2;i1++){ |
| 886 |
|
if(i1 == paddle){ |
| 887 |
|
xleft = tof22_x[i1] - 9.0/2.; |
| 888 |
|
xright = tof22_x[i1] + 9.0/2.; |
| 889 |
|
yleft = -15./2.; |
| 890 |
|
yright = 15./2.; |
| 891 |
|
} |
| 892 |
|
} |
| 893 |
|
} |
| 894 |
|
|
| 895 |
|
|
| 896 |
|
if(plane==4) |
| 897 |
|
{ |
| 898 |
|
for (i1=0; i1<3;i1++){ |
| 899 |
|
if(i1 == paddle){ |
| 900 |
|
xleft = tof31_x[i1] - 6.0/2.; |
| 901 |
|
xright = tof31_x[i1] + 6.0/2.; |
| 902 |
|
yleft = -15./2.; |
| 903 |
|
yright = 15./2.; |
| 904 |
|
} |
| 905 |
|
} |
| 906 |
|
} |
| 907 |
|
|
| 908 |
|
if(plane==5) |
| 909 |
|
{ |
| 910 |
|
for (i1=0; i1<3;i1++){ |
| 911 |
|
if(i1 == paddle){ |
| 912 |
|
xleft = -18.0/2.; |
| 913 |
|
xright = 18.0/2.; |
| 914 |
|
yleft = tof32_y[i1] - 5.0/2.; |
| 915 |
|
yright = tof32_y[i1] + 5.0/2.; |
| 916 |
|
} |
| 917 |
|
} |
| 918 |
|
} |
| 919 |
|
return; |
| 920 |
|
} |
| 921 |
|
|
| 922 |
|
// gf Apr 07 |
| 923 |
|
/** |
| 924 |
|
* Method to get the paddle index (0,...23) if the plane ID and the paddle id in the plane is given. |
| 925 |
|
* This method is the |
| 926 |
|
* "reverse" of method "GetPaddlePlane" |
| 927 |
|
* @param plane (0 - 5) |
| 928 |
|
* @param paddle (plane=0, paddle = 0,...5) |
| 929 |
|
* @param padid (0 - 23) |
| 930 |
|
*/ |
| 931 |
|
Int_t ToFLevel2::GetPaddleid(Int_t plane, Int_t paddle) |
| 932 |
|
{ |
| 933 |
|
|
| 934 |
|
Int_t padid=-1; |
| 935 |
|
Int_t pads11=8; |
| 936 |
|
Int_t pads12=6; |
| 937 |
|
Int_t pads21=2; |
| 938 |
|
Int_t pads22=2; |
| 939 |
|
Int_t pads31=3; |
| 940 |
|
// Int_t pads32=3; |
| 941 |
|
|
| 942 |
|
|
| 943 |
|
if(plane == 0){ |
| 944 |
|
padid=paddle; |
| 945 |
|
} |
| 946 |
|
|
| 947 |
|
if(plane == 1){ |
| 948 |
|
padid=pads11+paddle; |
| 949 |
|
} |
| 950 |
|
|
| 951 |
|
if(plane == 2){ |
| 952 |
|
padid=pads11+pads12+paddle; |
| 953 |
|
} |
| 954 |
|
|
| 955 |
|
if(plane == 3){ |
| 956 |
|
padid=pads11+pads12+pads21+paddle; |
| 957 |
|
} |
| 958 |
|
|
| 959 |
|
if(plane == 4){ |
| 960 |
|
padid=pads11+pads12+pads21+pads22+paddle; |
| 961 |
|
} |
| 962 |
|
|
| 963 |
|
if(plane == 5){ |
| 964 |
|
padid=pads11+pads12+pads21+pads22+pads31+paddle; |
| 965 |
|
} |
| 966 |
|
|
| 967 |
|
return padid; |
| 968 |
|
|
| 969 |
|
} |
| 970 |
|
|
| 971 |
|
|
| 972 |
|
// gf Apr 07 |
| 973 |
|
/** |
| 974 |
|
* Method to get the plane ID and the paddle id in the plane if the paddle index (0,...23) is given. |
| 975 |
|
* This method is the |
| 976 |
|
* "reverse" of method "GetPaddleid" |
| 977 |
|
* @param pad (0 - 23) |
| 978 |
|
* @param plane (0 - 5) |
| 979 |
|
* @param paddle (plane=0, paddle = 0,...5) |
| 980 |
|
*/ |
| 981 |
|
void ToFLevel2::GetPaddlePlane(Int_t pad, Int_t &plane, Int_t &paddle) |
| 982 |
|
{ |
| 983 |
|
|
| 984 |
|
Int_t pads11=8; |
| 985 |
|
Int_t pads12=6; |
| 986 |
|
Int_t pads21=2; |
| 987 |
|
Int_t pads22=2; |
| 988 |
|
Int_t pads31=3; |
| 989 |
|
// Int_t pads32=3; |
| 990 |
|
|
| 991 |
|
if(pad<8){ |
| 992 |
|
plane=0; |
| 993 |
|
paddle=pad; |
| 994 |
|
return; |
| 995 |
|
} |
| 996 |
|
|
| 997 |
|
if(7<pad<14){ |
| 998 |
|
plane=1; |
| 999 |
|
paddle=pad-pads11; |
| 1000 |
|
return; |
| 1001 |
|
} |
| 1002 |
|
|
| 1003 |
|
if(13<pad<16){ |
| 1004 |
|
plane=2; |
| 1005 |
|
paddle=pad-pads11-pads12; |
| 1006 |
|
return; |
| 1007 |
|
} |
| 1008 |
|
|
| 1009 |
|
if(15<pad<18){ |
| 1010 |
|
plane=3; |
| 1011 |
|
paddle=pad-pads11-pads12-pads21; |
| 1012 |
|
return; |
| 1013 |
|
} |
| 1014 |
|
|
| 1015 |
|
if(17<pad<21){ |
| 1016 |
|
plane=4; |
| 1017 |
|
paddle=pad-pads11-pads12-pads21-pads22; |
| 1018 |
|
return; |
| 1019 |
|
} |
| 1020 |
|
|
| 1021 |
|
if(20<pad<24){ |
| 1022 |
|
plane=5; |
| 1023 |
|
paddle=pad-pads11-pads12-pads21-pads22-pads31; |
| 1024 |
|
return; |
| 1025 |
|
} |
| 1026 |
|
|
| 1027 |
|
} |
| 1028 |
|
|
| 1029 |
|
|
| 1030 |
|
Int_t ToFLevel2::GetNPaddle(Int_t plane){ |
| 1031 |
|
|
| 1032 |
|
Int_t npaddle=-1; |
| 1033 |
|
|
| 1034 |
|
Int_t pads11=8; |
| 1035 |
|
Int_t pads12=6; |
| 1036 |
|
Int_t pads21=2; |
| 1037 |
|
Int_t pads22=2; |
| 1038 |
|
Int_t pads31=3; |
| 1039 |
|
Int_t pads32=3; |
| 1040 |
|
|
| 1041 |
|
if(plane==0)npaddle=pads11; |
| 1042 |
|
if(plane==1)npaddle=pads12; |
| 1043 |
|
if(plane==2)npaddle=pads21; |
| 1044 |
|
if(plane==3)npaddle=pads22; |
| 1045 |
|
if(plane==4)npaddle=pads31; |
| 1046 |
|
if(plane==5)npaddle=pads32; |
| 1047 |
|
|
| 1048 |
|
return npaddle; |
| 1049 |
|
|
| 1050 |
|
} |
| 1051 |
|
|
| 1052 |
|
//////////////////////////////////////////////////// |
| 1053 |
|
|
| 1054 |
|
|
| 1055 |
|
|
| 1056 |
/** |
/** |
| 1057 |
* Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). |
* Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common). |
| 1058 |
*/ |
*/ |
| 1083 |
l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; |
l2->xtofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtofpos[i]; |
| 1084 |
l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; |
l2->ytofpos[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytofpos[i]; |
| 1085 |
} |
} |
| 1086 |
|
for(Int_t i=0;i<6;i++){ |
| 1087 |
|
l2->xtr_tof[i][j]=((ToFTrkVar*)ToFTrk->At(j))->xtr_tof[i]; |
| 1088 |
|
l2->ytr_tof[i][j]=((ToFTrkVar*)ToFTrk->At(j))->ytr_tof[i]; |
| 1089 |
|
} |
| 1090 |
} |
} |
| 1091 |
} //ELENA |
} //ELENA |
| 1092 |
|
|