FairRoot/PandaRoot
PndMvdCalcTot.cxx
Go to the documentation of this file.
1 #include "PndMvdCalcTot.h"
2 
3 Double_t PndMvdCalcTot::GetTot(Double_t fcharge){ //returns the TOT in ns
4  if (fa <= 0){
5  std::cout<<"-W- <PndMvdCalcTot::GetTot(Double_t fcharge)>: falling ration is less or equal zero -> now set to 60 e/ns"<<std::endl;
6  fa = 60.;
7  }
8 
9  Q = fcharge;
10  Qt = fthreshold;
11 
12 //Error handling: if there is a parameter leading to a division by zero Q=Qt=1 is set to prevent this
13 
14  if (Qt < 0){
15  std::cout<<"-W- <PndMvdCalcTot::GetTot(Double_t fcharge)>: threshold is less than zero -> now set to 0 eV"<<std::endl;
16  Qt = 0.;
17  }
18 
19  if ((Q <= Qt) or (Q <= 0)){
20  std::cout<<"-W- <PndMvdCalcTot::GetTot(Double_t fcharge)>: charge is equal or less than threshold -> zero TOT"<<std::endl;
21  Q = 1.;
22  Qt = 1.;
23  }
24 
25  t1e = (ftr*Qt/Q+ftimeoffset); //exact time when signal is over threshold
26  t2e = (Q-Qt)/fa+ftimeoffset+ftr; //exact time when signal is again below threshold
27 
28  //return (t2e-t1e); //turn off clock
29  return GetTotWC();
30 }
31 
32 Double_t PndMvdCalcTot::GetTotWC(){ //calculates start time, stop time with a clock
33  fstarttime = (Int_t) ( t1e / ftimestep ) * ftimestep + ftimestep; //quantization of the start signal
34  fstoptime = (Int_t) ( t2e / ftimestep ) * ftimestep + ftimestep; //quantization of the stop signal
35 /*
36  std::cout<<" start point exact: "<<t1e<<std::endl;
37  std::cout<<" stop point exact: "<<t2e<<std::endl;
38  std::cout<<" time step is: "<<ftimestep<<" ns"<<std::endl;
39  std::cout<<" fclockfrequency is: "<<fclockfrequency<<" MHz"<<std::endl;
40  std::cout<<" time offset is: "<<ftimeoffset<<" ns"<<std::endl;
41  std::cout<<" start point is: "<<fstarttime<<" ns"<<std::endl;
42  std::cout<<" stop point is: "<<fstoptime<<" ns"<<std::endl;
43 */
44  return (fstoptime-fstarttime);
45 }
46 
47 void PndMvdCalcTot::SetStartOffset(){ //function called for different events to set different time offsets
48  ftimeoffset = fRand.Uniform(ftimestep);
49 }
50 
52  ftr = tr;
53  fa = a;
55 }
56 
57 
58 Double_t PndMvdCalcTot::GetPileUpTime(Double_t fcharge){ //returns the time the detector is not sensitive for other events
59  return (ftr + fcharge / fa);
60 }
Double_t GetPileUpTime(Double_t fcharge)
Double_t t2e
Definition: PndMvdCalcTot.h:69
Double_t ftimestep
Definition: PndMvdCalcTot.h:71
Double_t fthreshold
Definition: PndMvdCalcTot.h:65
TRandom2 fRand
Definition: PndMvdCalcTot.h:78
Double_t fstoptime
Definition: PndMvdCalcTot.h:73
Double_t t1e
Definition: PndMvdCalcTot.h:69
Double_t GetTot(Double_t fcharge)
Int_t a
Definition: anaLmdDigi.C:126
Double_t fstarttime
Definition: PndMvdCalcTot.h:72
void SetParameter(Double_t tr, Double_t a, Double_t threshold)
Double_t
Double_t ftimeoffset
Definition: PndMvdCalcTot.h:74
Double_t ftr
Definition: PndMvdCalcTot.h:66
double threshold
void SetStartOffset()
Double_t GetTotWC()