FairRoot/PandaRoot
PndSdsAdcChargeConversion.cxx
Go to the documentation of this file.
1 //
3 
4 
6 PndSdsAdcChargeConversion::PndSdsAdcChargeConversion(Int_t threshold, Int_t adcstep, Int_t resolution, Int_t VerboseLevel)
8 fVerboseLevel(VerboseLevel),
9 fThreshold(threshold),
10 fAdcStep(adcstep),
11 fResolution(resolution),
12 fMaxADC(0),
13 fTimeStep(0.)
14 {
15  fMaxADC = (Int_t)pow(2,fResolution);
16 }
17 
18 
20 {
21  if(charge <= fThreshold) return 0.; //underflow
22  Int_t ADC = (Int_t)floor(double(charge - fThreshold)/double(fAdcStep))+1;
23  if(ADC>fMaxADC) return fMaxADC; //overflow
24  return ADC;
25 }
26 
28 { //returns the charge for the given tot value
29  if (ADC<0){
30  if (fVerboseLevel>0)
31  Error("ConvertDigiValueToELoss(Double_t digi)","charge digitization value not calculated properly");
32  return -1;
33  }
34  if(ADC==0) return 0.5*fThreshold;
35  return (ADC-0.5)*fAdcStep+fThreshold;
36 }
37 
38 
40 {
41  // TODO: How is the uncertainty?
42  if(fabs(Charge) < 1e-6) return -1;
43  return fAdcStep/Charge;
44 }
45 
47 {
48  return (Int_t)time;
49  //Int_t temp = (Int_t)(time / ftimestep); // [clockcycles]
50  //time = temp*ftimestep + ftimestep; //[ns] to the following clock tick
51  //return (Int_t)TMath::Ceil(time); // [ns] with 1 ns number precision, casting cuts trailing digits, like floor()
52 }
53 
54 
56 {
57 
58  Double_t totaltime = MCEventTime;// [ns]
59  totaltime += time; // [ns]
60  //ftimewalk=GetTimeWalk(Charge);
61  //totaltime += ftimewalk;
62 
63  Double_t digitizedtime = DigitizeTime(totaltime);
64 
65  if (fVerboseLevel>2){
66  std::cout<<" +++charge: "<< Charge <<" "<<std::endl;
67  std::cout<<" time since event: "<< time <<" "<<std::endl;
68  //std::cout<<" timewalk: "<< ftimewalk <<std::endl;
69  std::cout<<" total time: "<< totaltime <<std::endl;
70  std::cout<<" digitized total time:"<< digitizedtime << "+++"<<std::endl;
71  }
72  return digitizedtime ; //digitalisiert
73 // return totaltime; // nicht digitalisiert
74 }
75 
77 {
78  return ceil(time);
79  //Int_t temp = (time) / ftimestep;
80  //time = temp *ftimestep + ftimestep;
81  //if (fVerboseLevel>2) std::cout << "temp " << temp << " time " << time << std::endl;
82  //return time;
83 }
84 
86 
virtual Double_t GetRelativeError(Double_t Charge)
Double_t DigitizeTime(Double_t time)
Double_t
PndSdsAdcChargeConversion(Int_t threshold=0, Int_t adcstep=1, Int_t resolution=8, Int_t VerboseLevel=0)
constructor
virtual Double_t DigiValueToCharge(Double_t digivalue)
Converts a given digitized charge into charge in electrons.
virtual Int_t GetTimeStamp(Double_t time)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double threshold
virtual Double_t ChargeToDigiValue(Double_t charge)
Converts a given charge in electrons into the electronics answer e.g. ToT [ns].
ClassImp(PndAnaContFact)