FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndSdsFESimple Class Reference

#include <PndSdsFESimple.h>

Inheritance diagram for PndSdsFESimple:
PndSdsFE

Public Member Functions

 PndSdsFESimple ()
 
 PndSdsFESimple (double charsingtime, double constcurrent, double threshold, double frequency)
 
 ~PndSdsFESimple ()
 
void SetParameter (double chargingtime, double constcurrent, double threshold, double frequency)
 
 ClassDef (PndSdsFESimple, 1)
 
virtual double GetTotFromCharge (Double_t charge)
 
virtual double GetChargeFromTot (double tot)
 
virtual double GetTimeWalkFromCharge (double charge)
 
virtual double GetTimeWalkFromTot (double tot)
 
virtual double GetTimeBackToBaseline (double charge)
 
virtual double GetTimeStamp (double eventtime, double tof, double charge)
 
virtual double GetTimeStep ()
 
virtual void SetParameter (TString parName, double parValue)
 
virtual void SetThreshold (double threshold)
 

Protected Member Functions

double DigitizeTime (double time)
 
void CalcTimeOffSet ()
 
void CreateInterpolatorList ()
 
void SaveInterpolatorList (std::vector< double > charge, std::vector< double > tot)
 
void LoadInterpolatorList ()
 
void GetInterpolatorList ()
 

Protected Attributes

PndSdsFEAmpModelSimplefFrontEndModel
 
int fNumberOfSupportPoints
 
int fNumberOfMaxElectons
 
TF1 * fFunction
 
double fMaximumAmplitude
 
double fThreshold
 
double fBaselineEpsilon
 
double fToF
 
double fEventTime
 
double fTimeOffSet
 
double fTimeStep
 
double fFunctionRange
 
TRandom2 fRand
 
int i
 
double stepsize
 
std::vector< double > fCharge_list
 
std::vector< double > fTot_list
 
ROOT::Math::Interpolator * inter
 

Detailed Description

Definition at line 25 of file PndSdsFESimple.h.

Constructor & Destructor Documentation

PndSdsFESimple::PndSdsFESimple ( )

Definition at line 15 of file PndSdsFESimple.cxx.

References PndSdsFEAmpModelSimple::Definition(), PndSdsFE::fFrontEndModel, PndSdsFE::fFunction, PndSdsFE::fFunctionRange, PndSdsFE::fThreshold, PndSdsFE::fTimeStep, and PndSdsFE::GetInterpolatorList().

15  {
17  fFunctionRange = 22000;
19  fFunction->SetNpx(20000);
20 
21  fFunction->SetParName(0,"chargetime");
22  fFunction->SetParName(1,"constantcurrent");
23  fFunction->SetParName(2,"charge");
24 
25  fFunction->SetParameter("chargetime",100);
26  fFunction->SetParameter("constcurrent",60);
27 
28  fTimeStep = 1. / 150 * 1000.; // Dont forget to change the frequency here if you change it above
29  fThreshold = 1000;
30 
32 
33 }
double Definition(double *x, double *params)
TF1 * fFunction
Definition: PndSdsFE.h:104
void GetInterpolatorList()
Definition: PndSdsFE.cxx:175
double fTimeStep
Definition: PndSdsFE.h:111
double fFunctionRange
Definition: PndSdsFE.h:112
PndSdsFEAmpModelSimple * fFrontEndModel
Definition: PndSdsFE.h:99
double fThreshold
Definition: PndSdsFE.h:106
PndSdsFESimple::PndSdsFESimple ( double  charsingtime,
double  constcurrent,
double  threshold,
double  frequency 
)

Definition at line 35 of file PndSdsFESimple.cxx.

References PndSdsFEAmpModelSimple::Definition(), PndSdsFE::fFrontEndModel, PndSdsFE::fFunction, PndSdsFE::fFunctionRange, PndSdsFE::fThreshold, PndSdsFE::fTimeStep, PndSdsFE::GetInterpolatorList(), and threshold.

35  {
37  fFunctionRange = 22000;
39  fFunction->SetNpx(20000);
40 
41  fFunction->SetParName(0,"chargetime");
42  fFunction->SetParName(1,"constantcurrent");
43  fFunction->SetParName(2,"charge");
44 
45  fFunction->SetParameter(0,chargetime);
46  fFunction->SetParameter(1,constcurrent);
47 
48  fTimeStep = 1. / frequency * 1000.;
50 
52 
53 }
double Definition(double *x, double *params)
TF1 * fFunction
Definition: PndSdsFE.h:104
void GetInterpolatorList()
Definition: PndSdsFE.cxx:175
double fTimeStep
Definition: PndSdsFE.h:111
double threshold
double fFunctionRange
Definition: PndSdsFE.h:112
PndSdsFEAmpModelSimple * fFrontEndModel
Definition: PndSdsFE.h:99
double fThreshold
Definition: PndSdsFE.h:106
PndSdsFESimple::~PndSdsFESimple ( )

Definition at line 67 of file PndSdsFESimple.cxx.

67  {
68 }

Member Function Documentation

void PndSdsFE::CalcTimeOffSet ( )
protectedinherited

Definition at line 100 of file PndSdsFE.cxx.

References PndSdsFE::fRand, PndSdsFE::fTimeOffSet, and PndSdsFE::fTimeStep.

Referenced by PndSdsFE::PndSdsFE().

100  {
101  fTimeOffSet = fRand.Uniform(fTimeStep);
102 }
double fTimeStep
Definition: PndSdsFE.h:111
double fTimeOffSet
Definition: PndSdsFE.h:110
TRandom2 fRand
Definition: PndSdsFE.h:113
PndSdsFESimple::ClassDef ( PndSdsFESimple  ,
 
)
void PndSdsFE::CreateInterpolatorList ( )
protectedinherited

Definition at line 104 of file PndSdsFE.cxx.

References PndSdsFE::fCharge_list, PndSdsFE::fNumberOfMaxElectons, PndSdsFE::fNumberOfSupportPoints, PndSdsFE::fThreshold, PndSdsFE::fTot_list, PndSdsFE::GetTotFromCharge(), PndSdsFE::i, printf(), PndSdsFE::SaveInterpolatorList(), and PndSdsFE::stepsize.

Referenced by PndSdsFE::GetInterpolatorList().

104  {
105 
106  fNumberOfSupportPoints = 2000;
107  fNumberOfMaxElectons = 630000;
109 
110  //printf("stepsize %f \n",stepsize);
111 
112  for( i=0; i < fNumberOfSupportPoints; i++){
113  if(i*stepsize<fThreshold){
114  continue;
115  }
116  else{
117 
118  fTot_list.push_back(i*stepsize);
119  fCharge_list.push_back(GetTotFromCharge(i*stepsize));
120 
121  //printf("x-value %f ,y-value %f \n",fCharge_list.back(),fTot_list.back());
122  //printf("x-value %f ,y-value %f \n",fCharge_list[],fTot_list.back());
123 
124  if(fTot_list.back()< fTot_list.back()-1) {
125  printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%d \n",i );
126  printf("x-value[i-3] %f ,x-value[i-2] %f \n",fTot_list.back()-3,fTot_list.back()-2);
127 
128  printf("x-value[i] %f ,x-value[i-1] %f \n",fTot_list.back(),fTot_list.back());
129  }
130  }
131  }
132 
134 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
virtual double GetTotFromCharge(Double_t charge)
Definition: PndSdsFE.cxx:26
std::vector< double > fCharge_list
Definition: PndSdsFE.h:117
int i
Definition: PndSdsFE.h:114
std::vector< double > fTot_list
Definition: PndSdsFE.h:118
void SaveInterpolatorList(std::vector< double > charge, std::vector< double > tot)
Definition: PndSdsFE.cxx:136
int fNumberOfMaxElectons
Definition: PndSdsFE.h:102
int fNumberOfSupportPoints
Definition: PndSdsFE.h:101
double fThreshold
Definition: PndSdsFE.h:106
double stepsize
Definition: PndSdsFE.h:115
double PndSdsFE::DigitizeTime ( double  time)
protectedinherited

Definition at line 90 of file PndSdsFE.cxx.

References PndSdsFE::fTimeStep.

Referenced by PndSdsFE::GetTimeStamp(), and PndSdsFE::GetTotFromCharge().

90  {
91 
92  return TMath::Floor(( time / fTimeStep )) * fTimeStep + fTimeStep;
93 }
double fTimeStep
Definition: PndSdsFE.h:111
double PndSdsFE::GetChargeFromTot ( double  tot)
virtualinherited

Definition at line 65 of file PndSdsFE.cxx.

References PndSdsFE::inter.

Referenced by PndSdsFE::GetTimeWalkFromTot().

65  {
66  return inter->Eval(tot);
67 }
ROOT::Math::Interpolator * inter
Definition: PndSdsFE.h:119
void PndSdsFE::GetInterpolatorList ( )
protectedinherited

Definition at line 175 of file PndSdsFE.cxx.

References PndSdsFE::CreateInterpolatorList(), PndSdsFE::fFrontEndModel, PndSdsFE::fThreshold, PndSdsFEAmpModelSimple::GetModelNumber(), PndSdsFE::LoadInterpolatorList(), and s.

Referenced by PndSdsFESimple().

175  {
176  // is list available?
177 
178  char s[20];
179  sprintf(s,"interpolatorlist-modelnumber_%i-thr_%g.root",fFrontEndModel->GetModelNumber(),fThreshold);
180 
181  TFile *fInFile = new TFile(s,"read");
182 
183  if(fInFile->IsZombie()) {
184  std::cout << "No interpolator list to load, create one... " << std::endl;
187  return;
188  }
189  else
190  {
191  std::cout << "Loading Interpolator List " << std::endl;
193  return;
194  }
195 
196 }
void CreateInterpolatorList()
Definition: PndSdsFE.cxx:104
TLorentzVector s
Definition: Pnd2DStar.C:50
void LoadInterpolatorList()
Definition: PndSdsFE.cxx:198
PndSdsFEAmpModelSimple * fFrontEndModel
Definition: PndSdsFE.h:99
double fThreshold
Definition: PndSdsFE.h:106
double PndSdsFE::GetTimeBackToBaseline ( double  charge)
virtualinherited

Definition at line 84 of file PndSdsFE.cxx.

References PndSdsFE::fBaselineEpsilon, PndSdsFE::fFunction, and PndSdsFE::fMaximumAmplitude.

84  {
85  fFunction->SetParameter("charge",Charge);
86  fMaximumAmplitude = fFunction->GetMaximumX();
87  return fFunction->GetX(fBaselineEpsilon,fMaximumAmplitude,fFunction->GetXmax());
88 }
double fBaselineEpsilon
Definition: PndSdsFE.h:107
TF1 * fFunction
Definition: PndSdsFE.h:104
double fMaximumAmplitude
Definition: PndSdsFE.h:105
double PndSdsFE::GetTimeStamp ( double  eventtime,
double  tof,
double  charge 
)
virtualinherited

Definition at line 95 of file PndSdsFE.cxx.

References PndSdsFE::DigitizeTime(), and PndSdsFE::GetTimeWalkFromCharge().

95  {
96  //GetChargeToTimeWalk(charge);
97  return DigitizeTime(GetTimeWalkFromCharge(charge)+eventtime+tof);
98 
99 }
virtual double GetTimeWalkFromCharge(double charge)
Definition: PndSdsFE.cxx:77
double DigitizeTime(double time)
Definition: PndSdsFE.cxx:90
virtual double PndSdsFE::GetTimeStep ( )
inlinevirtualinherited

Definition at line 60 of file PndSdsFE.h.

References PndSdsFE::fTimeStep.

Referenced by PndSdsTimeWalkCorrTask::Exec(), and PndSdsTimeWalkCorrTask::FinishTask().

60 {return fTimeStep;}
double fTimeStep
Definition: PndSdsFE.h:111
double PndSdsFE::GetTimeWalkFromCharge ( double  charge)
virtualinherited

Definition at line 77 of file PndSdsFE.cxx.

References PndSdsFE::fFunction, PndSdsFE::fMaximumAmplitude, and PndSdsFE::fThreshold.

Referenced by PndSdsFE::GetTimeStamp().

77  {
78  fFunction->SetParameter("charge",Charge);
79  fMaximumAmplitude = fFunction->GetMaximumX();
80  double result = fFunction->GetX(fThreshold,0,fMaximumAmplitude); //(xmin<x<xmax)
81  return result;
82 }
TF1 * fFunction
Definition: PndSdsFE.h:104
double fMaximumAmplitude
Definition: PndSdsFE.h:105
double fThreshold
Definition: PndSdsFE.h:106
double PndSdsFE::GetTimeWalkFromTot ( double  tot)
virtualinherited

Definition at line 69 of file PndSdsFE.cxx.

References PndSdsFE::fFunction, PndSdsFE::fMaximumAmplitude, PndSdsFE::fThreshold, and PndSdsFE::GetChargeFromTot().

Referenced by PndSdsTimeWalkCorrTask::Exec(), and PndSdsTimeWalkCorrTask::FinishTask().

69  {
70  fFunction->SetParameter("charge",GetChargeFromTot(tot));
71  fMaximumAmplitude = fFunction->GetMaximumX();
72  return fFunction->GetX(fThreshold,0,fMaximumAmplitude); //(xmin<x<xmax)
73 
74 }
virtual double GetChargeFromTot(double tot)
Definition: PndSdsFE.cxx:65
TF1 * fFunction
Definition: PndSdsFE.h:104
double fMaximumAmplitude
Definition: PndSdsFE.h:105
double fThreshold
Definition: PndSdsFE.h:106
double PndSdsFE::GetTotFromCharge ( Double_t  charge)
virtualinherited

Definition at line 26 of file PndSdsFE.cxx.

References PndSdsFE::DigitizeTime(), PndSdsFE::fFunction, PndSdsFE::fMaximumAmplitude, PndSdsFE::fThreshold, and PndSdsFE::fTimeOffSet.

Referenced by PndSdsFE::CreateInterpolatorList().

26  {
27 
28  fFunction->SetParameter("charge",Charge);
29  fMaximumAmplitude = fFunction->GetMaximumX();
30 
31  if (fFunction->GetParameter("constantcurrent") <= 0){
32  Error("PndSdsFE::GetTotFromCharge","const. current is less or equal zero -> now set to 60 e/ns");
33  fFunction->SetParameter("constantcurrent",60);
34  }
35 
36  if (fFunction->GetParameter("chargetime")<= 0){
37  Error("PndSdsFE::GetTotFromCharge","charge time is less than zero -> now set to 100 ns");
38  fFunction->SetParameter("chargetime",100);
39  }
40 
41  if (fThreshold < 0){
42  Error("PndSdsFE::GetTotFromCharge","Threshold is less than zero -> now set to 0 e");
43  fThreshold = 0;
44  }
45 
46  if (fFunction->GetParameter("charge")<= fThreshold){
47  Warning("PndSdsFE::GetTotFromCharge","charge is equal or less than threshold -> zero TOT");
48  return 0;
49  }
50 
51  double start_exakt=fFunction->GetX(fThreshold,0,fMaximumAmplitude );
52  double stop_exakt=fFunction->GetX(fThreshold,fMaximumAmplitude,fFunction->GetXmax());
53 
54  double start=DigitizeTime(start_exakt+fTimeOffSet);
55  double stop=DigitizeTime(stop_exakt+fTimeOffSet);
56 // printf("start exakt:%f \n",start_exakt);
57 // printf("start :%f \n",start);
58 // printf("stop exakt:%f \n",stop_exakt);
59 // printf("stop :%f \n",stop);
60 
61  return stop-start; // with digitization
62  //return stop_exakt - start_exakt; // without digitization
63 }
TF1 * fFunction
Definition: PndSdsFE.h:104
double fMaximumAmplitude
Definition: PndSdsFE.h:105
double DigitizeTime(double time)
Definition: PndSdsFE.cxx:90
double fTimeOffSet
Definition: PndSdsFE.h:110
double fThreshold
Definition: PndSdsFE.h:106
void PndSdsFE::LoadInterpolatorList ( )
protectedinherited

Definition at line 198 of file PndSdsFE.cxx.

References PndSdsFE::fCharge_list, PndSdsFE::fFrontEndModel, PndSdsFE::fThreshold, PndSdsFE::fTot_list, PndSdsFEAmpModelSimple::GetModelNumber(), and PndSdsFE::inter.

Referenced by PndSdsFE::GetInterpolatorList().

198  {
199 
200  char dd[20];
201  sprintf(dd,"interpolatorlist-modelnumber_%i-thr_%g.root",fFrontEndModel->GetModelNumber(),fThreshold);
202 
203  TFile *fInFile = new TFile(dd);
204 
205  if(fInFile->IsZombie()) {
206  std::cout << "PndSdsFE::LoadInterpolatorList(): error loading root file " << std::endl;
207 
208  return;
209  }
210  else
211  {
212  std::cout << "PndSdsFE::LoadInterpolatorList(): Loading list done " << std::endl;
213 
214  }
215 
216  TVectorD *charge = (TVectorD*)fInFile->Get("charge");
217  TVectorD *tot = (TVectorD*)fInFile->Get("tot");
218 
219  int size_charge = charge->GetNoElements();
220  int size_tot = tot->GetNoElements();
221 
222  fCharge_list.clear();
223  fCharge_list.clear();
224 
225  for(int bxx=0; bxx < size_charge;bxx++)
226  {
227  //fCharge_list.push_back(charge[bxx]);
228  fCharge_list.push_back((*charge)[bxx]);
229 
230  }
231 
232  for(int byy=0; byy < size_tot;byy++)
233  {
234  // fTot_list.push_back(tot);
235  fTot_list.push_back((*tot)[byy]);
236  }
237 
238  inter = new ROOT::Math::Interpolator(fCharge_list,fTot_list, ROOT::Math::Interpolation::kCSPLINE);
239 }
std::vector< double > fCharge_list
Definition: PndSdsFE.h:117
ROOT::Math::Interpolator * inter
Definition: PndSdsFE.h:119
std::vector< double > fTot_list
Definition: PndSdsFE.h:118
PndSdsFEAmpModelSimple * fFrontEndModel
Definition: PndSdsFE.h:99
double fThreshold
Definition: PndSdsFE.h:106
void PndSdsFE::SaveInterpolatorList ( std::vector< double >  charge,
std::vector< double >  tot 
)
protectedinherited

Definition at line 136 of file PndSdsFE.cxx.

References f1, PndSdsFE::fFrontEndModel, PndSdsFE::fThreshold, PndSdsFEAmpModelSimple::GetModelNumber(), and s.

Referenced by PndSdsFE::CreateInterpolatorList().

136  {
137 
138  // To save an object to a root file it needs to inherit from TObject.
139  // std::vector does not inherit from TObject, but TVectorD does.
140  // so i convert the std::vector to a TVectorD and save them to a root file.
141 
142  int size_x = charge.size();
143  int size_y = tot.size();
144 
145  TVectorD charge_root(size_x);
146  TVectorD tot_root(size_y);
147 
148  for(int bx=0; bx < size_x;bx++)
149  {
150  charge_root[bx] = charge.at(bx);
151  }
152 
153  for(int by=0; by < size_x;by++)
154  {
155  tot_root[by] = tot.at(by);
156  }
157 
158  // in den namen der interpolatorliste sollte die threshold und das model hinein. sind diese beiden angaben identisch
159  // ist die interpolatorliste eindeutig.
160 
161  char s[20];
162 
163  sprintf(s,"interpolatorlist-modelnumber_%i-thr_%g.root",fFrontEndModel->GetModelNumber(),fThreshold);
164 
165  TFile f1(s,"RECREATE");
166 
167  TGraph* graph = new TGraph(charge.size(), &charge.at(0),&tot.at(0));
168  graph->Draw("AP");
169  graph->Write();
170 
171  charge_root.Write("charge");
172  tot_root.Write("tot");
173 }
TF1 * f1
Definition: reco_analys2.C:50
TLorentzVector s
Definition: Pnd2DStar.C:50
PndSdsFEAmpModelSimple * fFrontEndModel
Definition: PndSdsFE.h:99
double fThreshold
Definition: PndSdsFE.h:106
void PndSdsFESimple::SetParameter ( double  chargingtime,
double  constcurrent,
double  threshold,
double  frequency 
)

Definition at line 55 of file PndSdsFESimple.cxx.

References PndSdsFE::fFunction, PndSdsFE::fThreshold, PndSdsFE::fTimeStep, and threshold.

56 {
57  if(fFunction)
58  {
59  fFunction->SetParameter(0,chargingtime);
60  fFunction->SetParameter(1,constcurrent);
61  }
63  fTimeStep = 1. / frequency * 1000.;
64  return;
65 }
TF1 * fFunction
Definition: PndSdsFE.h:104
double fTimeStep
Definition: PndSdsFE.h:111
double threshold
double fThreshold
Definition: PndSdsFE.h:106
void PndSdsFE::SetParameter ( TString  parName,
double  parValue 
)
virtualinherited

Definition at line 22 of file PndSdsFE.cxx.

References PndSdsFE::fFunction.

22  {
23  fFunction->SetParameter(parName.Data(), parValue);
24 }
TF1 * fFunction
Definition: PndSdsFE.h:104
virtual void PndSdsFE::SetThreshold ( double  threshold)
inlinevirtualinherited

Definition at line 62 of file PndSdsFE.h.

References PndSdsFE::fThreshold, and threshold.

double threshold
double fThreshold
Definition: PndSdsFE.h:106

Member Data Documentation

double PndSdsFE::fBaselineEpsilon
protectedinherited

Definition at line 107 of file PndSdsFE.h.

Referenced by PndSdsFE::GetTimeBackToBaseline(), and PndSdsFE::operator=().

std::vector<double> PndSdsFE::fCharge_list
protectedinherited
double PndSdsFE::fEventTime
protectedinherited

Definition at line 109 of file PndSdsFE.h.

Referenced by PndSdsFE::operator=().

PndSdsFEAmpModelSimple* PndSdsFE::fFrontEndModel
protectedinherited
TF1* PndSdsFE::fFunction
protectedinherited
double PndSdsFE::fFunctionRange
protectedinherited

Definition at line 112 of file PndSdsFE.h.

Referenced by PndSdsFE::operator=(), and PndSdsFESimple().

double PndSdsFE::fMaximumAmplitude
protectedinherited
int PndSdsFE::fNumberOfMaxElectons
protectedinherited

Definition at line 102 of file PndSdsFE.h.

Referenced by PndSdsFE::CreateInterpolatorList(), and PndSdsFE::operator=().

int PndSdsFE::fNumberOfSupportPoints
protectedinherited

Definition at line 101 of file PndSdsFE.h.

Referenced by PndSdsFE::CreateInterpolatorList(), and PndSdsFE::operator=().

TRandom2 PndSdsFE::fRand
protectedinherited

Definition at line 113 of file PndSdsFE.h.

Referenced by PndSdsFE::CalcTimeOffSet(), and PndSdsFE::operator=().

double PndSdsFE::fThreshold
protectedinherited
double PndSdsFE::fTimeOffSet
protectedinherited
double PndSdsFE::fTimeStep
protectedinherited
double PndSdsFE::fToF
protectedinherited

Definition at line 108 of file PndSdsFE.h.

Referenced by PndSdsFE::operator=().

std::vector<double> PndSdsFE::fTot_list
protectedinherited
int PndSdsFE::i
protectedinherited

Definition at line 114 of file PndSdsFE.h.

Referenced by PndSdsFE::CreateInterpolatorList(), and PndSdsFE::operator=().

ROOT::Math::Interpolator* PndSdsFE::inter
protectedinherited
double PndSdsFE::stepsize
protectedinherited

Definition at line 115 of file PndSdsFE.h.

Referenced by PndSdsFE::CreateInterpolatorList(), and PndSdsFE::operator=().


The documentation for this class was generated from the following files: