1 |
/** |
/** |
2 |
* \file ToFLevel2.cpp |
* \file ToFLevel2.cpp |
3 |
* \author Gianfranca DeRosa, Wolfgang Menn |
* \author Gianfranca DeRosa, Wolfgang Menn |
4 |
|
* |
5 |
|
* WM dec 2008: Description of "GetdEdx" changed |
6 |
|
* WM dec 2008: "GetdEdxPaddle" modified: Now includes saturation limit |
7 |
|
* PMTs higher than the saturation limit are not used for dEdx |
8 |
*/ |
*/ |
9 |
|
|
10 |
#include <ToFLevel2.h> |
#include <ToFLevel2.h> |
|
|
|
11 |
using namespace std; |
using namespace std; |
|
|
|
12 |
ClassImp(ToFPMT); |
ClassImp(ToFPMT); |
13 |
ClassImp(ToFTrkVar); |
ClassImp(ToFTrkVar); |
14 |
ClassImp(ToFLevel2); |
ClassImp(ToFLevel2); |
218 |
return npad; |
return npad; |
219 |
}; |
}; |
220 |
|
|
221 |
|
//wm Nov 08 |
222 |
//gf Apr 07 |
//gf Apr 07 |
223 |
/** |
/** |
224 |
* Method to get the mean dEdx from a given ToF plane. This current version |
* Method to get the mean dEdx from a ToF layer - ATTENTION: |
225 |
* is just summing up all PMT signals, which will not give proper results, |
* It will sum up the dEdx of all the paddles, but since by definition |
226 |
* and needs a revision. |
* only the paddle hitted by the track gets a dEdx value and the other |
227 |
|
* paddles are set to zero, the output is just the dEdx of the hitted |
228 |
|
* paddle in each layer! |
229 |
|
* The "adcfl" option is not very useful (an artificial dEdx is per |
230 |
|
* definition= 1 mip and not a real measurement), anyway left in the code |
231 |
* @param notrack Track Number |
* @param notrack Track Number |
232 |
* @param plane Plane index (0,1,2,3,4,5) |
* @param plane Plane index (0,1,2,3,4,5) |
233 |
* @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; ) |
387 |
|
|
388 |
|
|
389 |
|
|
390 |
|
// wm Nov 08 revision - saturation values included |
391 |
/// gf Apr 07 |
/// gf Apr 07 |
|
|
|
392 |
/** |
/** |
393 |
* Method to get the dEdx from a given ToF paddle. |
* Method to get the dEdx from a given ToF paddle. |
394 |
|
* If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise |
395 |
|
* just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000 |
396 |
* @param notrack Track Number |
* @param notrack Track Number |
397 |
* @param Paddle index (0,1,...,23). |
* @param Paddle index (0,1,...,23). |
398 |
* @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; ) |
401 |
*/ |
*/ |
402 |
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){ |
403 |
|
|
404 |
|
/* |
405 |
|
Float_t PMTsat[48] = { |
406 |
|
3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, |
407 |
|
3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03, |
408 |
|
3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53, |
409 |
|
3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98, |
410 |
|
3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66, |
411 |
|
3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ; |
412 |
|
*/ |
413 |
|
|
414 |
|
// new values from Napoli dec 2008 |
415 |
|
Float_t PMTsat[48] = { |
416 |
|
3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27, |
417 |
|
3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14, |
418 |
|
3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62, |
419 |
|
3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26, |
420 |
|
3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18, |
421 |
|
3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 }; |
422 |
|
|
423 |
|
for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.; // safety margin |
424 |
|
|
425 |
|
|
426 |
PadEdx = 0.; |
PadEdx = 0.; |
427 |
SatWarning = 1000; |
// SatWarning = 1000; |
428 |
|
SatWarning = 0; // 0=good, increase for each bad PMT |
429 |
|
|
430 |
Float_t dEdx[48] = {0}; |
Float_t dEdx[48] = {0}; |
431 |
Int_t pmt_id = -1; |
Int_t pmt_id = -1; |
457 |
adcraw[pmtright] = pmt->adc; |
adcraw[pmtright] = pmt->adc; |
458 |
} |
} |
459 |
} |
} |
460 |
|
|
461 |
|
|
462 |
for (Int_t i=0; i<trk->npmtadc; i++){ |
for (Int_t i=0; i<trk->npmtadc; i++){ |
463 |
|
|
470 |
} |
} |
471 |
} |
} |
472 |
|
|
473 |
if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; |
|
474 |
|
// if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; //old version |
475 |
if(dEdx[pmtleft]!=0 && dEdx[pmtright]!=0){ |
|
476 |
PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; |
// Increase SatWarning Counter for each PMT>Sat |
477 |
} |
if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++; |
478 |
if(dEdx[pmtleft]==0 && dEdx[pmtright]!=0){ |
if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++; |
479 |
PadEdx = dEdx[pmtright]; |
|
480 |
} |
// if ADC > sat set dEdx=1000 |
481 |
if(dEdx[pmtleft]!=0 && dEdx[pmtright]==0){ |
if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.; |
482 |
PadEdx = dEdx[pmtleft]; |
if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ; |
483 |
} |
|
484 |
|
// if two PMT are good, take mean dEdx, otherwise only the good dEdx |
485 |
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; |
486 |
|
if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright]; |
487 |
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft]; |
488 |
|
|
|
return; |
|
489 |
}; |
}; |
490 |
// |
// |
491 |
|
|
542 |
|
|
543 |
}; |
}; |
544 |
|
|
545 |
|
// wm jun 08 |
|
// gf Apr 07 |
|
546 |
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ |
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane){ |
547 |
|
return GetPaddleIdOfTrack(xtr ,ytr ,plane, 0.4); |
548 |
|
} |
549 |
|
|
550 |
|
// gf Apr 07 |
551 |
|
Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin){ |
552 |
|
|
553 |
Double_t xt,yt,xl,xh,yl,yh; |
Double_t xt,yt,xl,xh,yl,yh; |
554 |
|
|
555 |
Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; |
Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85}; |
579 |
yh = 33.0/2. ; |
yh = 33.0/2. ; |
580 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
581 |
for (Int_t i1=0; i1<8;i1++){ |
for (Int_t i1=0; i1<8;i1++){ |
582 |
xl = tof11_x[i1] - (5.1-0.4)/2. ; |
xl = tof11_x[i1] - (5.1-margin)/2. ; |
583 |
xh = tof11_x[i1] + (5.1-0.4)/2. ; |
xh = tof11_x[i1] + (5.1-margin)/2. ; |
584 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
585 |
} |
} |
586 |
} |
} |
597 |
|
|
598 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
599 |
for (Int_t i1=0; i1<6;i1++){ |
for (Int_t i1=0; i1<6;i1++){ |
600 |
yl = tof12_y[i1] - (5.5-0.4)/2. ; |
yl = tof12_y[i1] - (5.5-margin)/2. ; |
601 |
yh = tof12_y[i1] + (5.5-0.4)/2. ; |
yh = tof12_y[i1] + (5.5-margin)/2. ; |
602 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
603 |
} |
} |
604 |
} |
} |
615 |
|
|
616 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
617 |
for (Int_t i1=0; i1<2;i1++){ |
for (Int_t i1=0; i1<2;i1++){ |
618 |
yl = tof21_y[i1] - (7.5-0.4)/2. ; |
yl = tof21_y[i1] - (7.5-margin)/2. ; |
619 |
yh = tof21_y[i1] + (7.5-0.4)/2. ; |
yh = tof21_y[i1] + (7.5-margin)/2. ; |
620 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
621 |
} |
} |
622 |
} |
} |
632 |
|
|
633 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
634 |
for (Int_t i1=0; i1<2;i1++){ |
for (Int_t i1=0; i1<2;i1++){ |
635 |
xl = tof22_x[i1] - (9.0-0.4)/2. ; |
xl = tof22_x[i1] - (9.0-margin)/2. ; |
636 |
xh = tof22_x[i1] + (9.0-0.4)/2. ; |
xh = tof22_x[i1] + (9.0-margin)/2. ; |
637 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
638 |
} |
} |
639 |
} |
} |
649 |
|
|
650 |
if ((yt>yl)&&(yt<yh)) { |
if ((yt>yl)&&(yt<yh)) { |
651 |
for (Int_t i1=0; i1<3;i1++){ |
for (Int_t i1=0; i1<3;i1++){ |
652 |
xl = tof31_x[i1] - (6.0-0.4)/2. ; |
xl = tof31_x[i1] - (6.0-margin)/2. ; |
653 |
xh = tof31_x[i1] + (6.0-0.4)/2. ; |
xh = tof31_x[i1] + (6.0-margin)/2. ; |
654 |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
if ((xt>xl)&&(xt<xh)) paddleidoftrack=i1; |
655 |
} |
} |
656 |
} |
} |
666 |
|
|
667 |
if ((xt>xl)&&(xt<xh)) { |
if ((xt>xl)&&(xt<xh)) { |
668 |
for (Int_t i1=0; i1<3;i1++){ |
for (Int_t i1=0; i1<3;i1++){ |
669 |
yl = tof32_y[i1] - (5.0-0.4)/2. ; |
yl = tof32_y[i1] - (5.0-margin)/2. ; |
670 |
yh = tof32_y[i1] + (5.0-0.4)/2. ; |
yh = tof32_y[i1] + (5.0-margin)/2. ; |
671 |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
if ((yt>yl)&&(yt<yh)) paddleidoftrack=i1; |
672 |
} |
} |
673 |
} |
} |
735 |
|
|
736 |
void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ |
void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){ |
737 |
pmtleft=paddle*2; |
pmtleft=paddle*2; |
738 |
pmtright= pmtleft+1; |
pmtright= pmtleft+1; |
739 |
return; |
return; |
740 |
} |
} |
741 |
|
|
859 |
} |
} |
860 |
padid=paddle+somma; |
padid=paddle+somma; |
861 |
return padid; |
return padid; |
862 |
|
|
863 |
} |
} |
864 |
|
|
865 |
|
|
943 |
|
|
944 |
} |
} |
945 |
|
|
946 |
|
|
947 |
|
|
948 |
/// wm feb 08 |
/// wm feb 08 |
949 |
|
|
950 |
/** |
/** |
1091 |
//////////////////////////////////////////////////// |
//////////////////////////////////////////////////// |
1092 |
|
|
1093 |
|
|
|
|
|
1094 |
/** |
/** |
1095 |
* 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). |
1096 |
*/ |
*/ |