StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
1 /*
2 David Kapukchyan
3 April 21, 2021
4 First instance of pulse db class to contain all the basic variables for the pulse shape from DEP boards as well as the functional forms
5  */
20 #include <iostream>
22 #include "TDataSet.h"
23 #include "TMath.h"
24 #include "TGraphAsymmErrors.h"
25 #include "TF1.h"
26 #include "St_base/StMessMgr.h"
28 class StFcsDbPulse : public TDataSet {
30  public:
31  StFcsDbPulse(const char* name = "fcsPulse");
32  virtual ~StFcsDbPulse();
33  int Init();
35  //Basic contants
36  static double sqrtpi(){return sqrt(TMath::Pi());}
37  static double sqrt2pi(){return sqrt(2.0*TMath::Pi());}
39  //Constants for simulating pulses
40  void setTBPerRC(double v){mTBPerRC = v;}
41  double TBPerRC()const{return mTBPerRC;}
42  double nsecPerTB()const{return 107.0/TBPerRC();}
43  double BeamLengthSig()const{return 10.0/nsecPerTB();}
53  void setTail(int tail);
55  void setGSigma(double v){mGSigma = v;}
56  void setA1(double v){mA1 = v;}
57  void setA2(double v){mA2 = v;}
58  void setXoff1(double v){mXoff1 = v;}
59  void setXoff2(double v){mXoff2 = v;}
60  void setTau1(double v){mTau1 = v;}
61  void setTau2(double v){mTau2 = v;}
62  void setP1(double v){mP1 = v;}
63  void setP2(double v){mP2 = v;}
65  //Variables related to the tail function
66  double GSigma()const{return mGSigma;}
67  double A1()const{return mA1;}
68  double A2()const{return mA2;}
69  double Xoff1()const{return mXoff1;}
70  double Xoff2()const{return mXoff2;}
71  double Tau1()const{return mTau1;}
72  double Tau2()const{return mTau2;}
73  double P1()const{return mP1;}
74  double P2()const{return mP2;}
85  static void setTGraphAsymmErrors(TGraphAsymmErrors* gae, const int &i, const double &adc, double Yerr, double YerrSat);
96  double pulseShape(double* x, double* p);
111  double multiPulseShape(double* x, double* p);
120  TF1* createPulse(double xlow=0, double xhigh=1,int npars=5 );
129  static int GenericPadPos(int value, int Nvals, int PadNums );
138  static int PadNum4x4(int det, int col, int row);
149  static Int_t getYMinMax(TGraphAsymmErrors* gae, Double_t &Ymin, Double_t &Ymax, Double_t xmin=-5, Double_t xmax=2000);
151  virtual void Print(Option_t* opt = "") const;
153  protected:
154  double mTBPerRC;
155  double mGSigma;
156  //Pulse shape constants
157  double mA1;
158  double mA2;
159  double mXoff1;
160  double mXoff2;
161  double mTau1;
162  double mTau2;
163  double mP1;
164  double mP2;
166  private:
167  int mTail;
168  static const int mAdcSaturation = 4000;
170  ClassDef(StFcsDbPulse, 1);
171 };
173 #endif
static double sqrtpi()
Definition: StFcsDbPulse.h:36
double mXoff1
pulse shape tail: x offset of first xexp function
Definition: StFcsDbPulse.h:159
double A1() const
Definition: StFcsDbPulse.h:67
StFcsDbPulse(const char *name="fcsPulse")
Definition: StFcsDbPulse.cxx:5
double P1() const
Definition: StFcsDbPulse.h:73
double nsecPerTB() const
nanoseconds per timebin
Definition: StFcsDbPulse.h:42
void setXoff2(double v)
Definition: StFcsDbPulse.h:59
void setP1(double v)
Definition: StFcsDbPulse.h:62
static Int_t getYMinMax(TGraphAsymmErrors *gae, Double_t &Ymin, Double_t &Ymax, Double_t xmin=-5, Double_t xmax=2000)
Finds minimum and maximum y-values in a TGraph and returns index for max y.
TF1 * createPulse(double xlow=0, double xhigh=1, int npars=5)
Function to create pulse shape for FCS, 5 parameters is minimum.
double BeamLengthSig() const
beam length sigma
Definition: StFcsDbPulse.h:43
double mP1
pulse shape tail: power of first xexp function
Definition: StFcsDbPulse.h:163
double Xoff2() const
Definition: StFcsDbPulse.h:70
int Init()
Initialize object.
double A2() const
Definition: StFcsDbPulse.h:68
static double sqrt2pi()
Definition: StFcsDbPulse.h:37
void setXoff1(double v)
Definition: StFcsDbPulse.h:58
double mXoff2
pulse shape tail: x offset of second xexp function
Definition: StFcsDbPulse.h:160
void setTBPerRC(double v)
Definition: StFcsDbPulse.h:40
double mGSigma
pulse shape nominal sigma of Gaussian part
Definition: StFcsDbPulse.h:155
static void setTGraphAsymmErrors(TGraphAsymmErrors *gae, const int &i, const double &adc, double Yerr, double YerrSat)
Figure out and set the errors on FCS pulse data stored in a TGraphAsymmErrors object.
double P2() const
Definition: StFcsDbPulse.h:74
static int GenericPadPos(int value, int Nvals, int PadNums)
Function to tell you pad number when drawing multiple objects on the same pad.
void setTau1(double v)
Definition: StFcsDbPulse.h:60
double Tau1() const
Definition: StFcsDbPulse.h:71
double mTau2
pulse shape tail: scale of second xexp function
Definition: StFcsDbPulse.h:162
double Tau2() const
Definition: StFcsDbPulse.h:72
virtual ~StFcsDbPulse()
static int PadNum4x4(int det, int col, int row)
Function that gives pad number when drawing a specific detector id.
double mA1
pulse shape tail: height of first xexp function
Definition: StFcsDbPulse.h:157
void setA2(double v)
Definition: StFcsDbPulse.h:57
double mA2
pulse shape tail: height of second xexp function
Definition: StFcsDbPulse.h:158
double multiPulseShape(double *x, double *p)
Multi-pulse shape function constant+gaus+xexp+xexp for many pulses.
double TBPerRC() const
Definition: StFcsDbPulse.h:41
double mTau1
pulse shape tail: scale of first xexp function
Definition: StFcsDbPulse.h:161
void setA1(double v)
Definition: StFcsDbPulse.h:56
double pulseShape(double *x, double *p)
Single pulse shape gaus+xexp+xexp.
void setP2(double v)
Definition: StFcsDbPulse.h:63
double mTBPerRC
number of timebins in one RHIC crossing
Definition: StFcsDbPulse.h:154
void setGSigma(double v)
Definition: StFcsDbPulse.h:55
double mP2
pulse shape tail: power of second xexp function
Definition: StFcsDbPulse.h:164
void setTau2(double v)
Definition: StFcsDbPulse.h:61
double Xoff1() const
Definition: StFcsDbPulse.h:69
double GSigma() const
Definition: StFcsDbPulse.h:66
void setTail(int tail)
Sets the variables needed by the sum of xexp functions that describe the tail of the pulse shape...
virtual void Print(Option_t *opt="") const
Print all the constants associated with this class.