StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_tpcSlewingC.h
1 #ifndef St_tpcSlewingC_h
2 #define St_tpcSlewingC_h
3 
4 #include "TChair.h"
5 #include "tables/St_tpcSlewing_Table.h"
6 #include "St_tpcPadConfigC.h"
7 
8 class St_tpcSlewingC : public TChair {
9  public:
10  static St_tpcSlewingC* instance();
11  tpcSlewing_st *Struct(Int_t i = 0) const {return ((St_tpcSlewing*) Table())->GetTable()+i;}
12  UInt_t getNumRows() const {return GetNRows();}
13  Int_t type(Int_t i = 0) const {return Struct(i)->type;}
14  Int_t npar(Int_t i = 0) const {return Struct(i)->npar;}
15  Double_t minT(Int_t i = 0) const {return Struct(i)->min;}
16  Double_t a(Int_t i = 0, Int_t n = 0) const {return Struct(i)->a[n];}
17  Double_t slewing(Int_t sector, Int_t i = 0, Double_t q = 0) {
18  if (St_tpcPadConfigC::instance()->iTpc(sector)) return 0;
19  switch (type(i)) {
20  case 1001 : { return func1001(q,a(i,0),a(i,1),a(i,2),a(i,3)); }
21  // define other functions as needed
22  default : {}
23  }
24  return 0;
25  }
26  Double_t correctedT(Int_t sector, Int_t padrow, Double_t q, Double_t T) { // T [microsec]
27  if (St_tpcPadConfigC::instance()->iTpc(sector)) return T;
28  Int_t inout = (St_tpcPadConfigC::instance()->IsRowInner(sector,padrow) ? 0 : 1); // padrow = 1..45
29  return T - (T > minT(inout) ? slewing(sector,inout,q) : 0);
30  }
31  protected:
32  St_tpcSlewingC(St_tpcSlewing *table=0) : TChair(table) {}
33  virtual ~St_tpcSlewingC() {fgInstance = 0;}
34  Double_t func1001(Double_t q, Double_t p0, Double_t p1, Double_t p2, Double_t p3) {
35  // An exponential of [1/sqrt(q)]^p3
36  if (q <= 0.0) return 0;
37  return p0 * TMath::Exp(-p1*TMath::Power(q,-0.5*p3)) + p2;
38  }
39  private:
40  static St_tpcSlewingC* fgInstance;
41  ClassDefChair(St_tpcSlewing, tpcSlewing_st )
42  ClassDef(St_tpcSlewingC,1) //C++ TChair for tpcSlewing table class
43 };
44 #endif
Definition: TChair.h:27