]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSDD.h
Changing once more (hopefully we get it correct this time...) the logic to trig the...
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.h
1 #ifndef ALIITSRESPONSESDD_H
2 #define ALIITSRESPONSESDD_H
3  
4 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6  
7
8 #include <TObject.h>
9 #include <AliLog.h>
10
11 /* $Id$ */
12
13 /////////////////////////////////////////////////////////////
14 //  Base settings for the ITS response classes.            //  
15 //  The data member of this class are static and set once  //
16 //  for all the modules.                                   //    
17 ///////////////////////////////////////////////////////////// 
18
19 class AliITSresponseSDD : public TObject {
20  public:
21   enum {kVDCorr2Side = BIT(14)};   // if bit set, the object contains separate corrections for 2 sides
22   //
23   AliITSresponseSDD();
24   virtual ~AliITSresponseSDD(){};
25
26   virtual void SetSideATimeZero(Float_t tzero){
27     SetLayer3ATimeZero(tzero);
28     SetLayer4ATimeZero(tzero);
29   }
30   virtual void SetSideCTimeZero(Float_t tzero){
31     SetLayer3CTimeZero(tzero);
32     SetLayer4CTimeZero(tzero);
33   }
34   virtual void SetLayer3ATimeZero(Float_t tzero){
35     for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderATimeZero(3,iLad,tzero);      
36   }
37   virtual void SetLayer3CTimeZero(Float_t tzero){
38     for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderCTimeZero(3,iLad,tzero);
39   }
40   virtual void SetLayer4ATimeZero(Float_t tzero){
41     for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderATimeZero(4,iLad,tzero);      
42   }
43   virtual void SetLayer4CTimeZero(Float_t tzero){
44     for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderCTimeZero(4,iLad,tzero);
45   }
46   virtual void SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero);
47   virtual void SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero);
48   virtual void SetModuleTimeZero(Int_t modIndex, Float_t tzero){
49     if(modIndex<kNSPDmods || modIndex>kNSPDmods+kNSDDmods) AliError(Form("SDD module number %d out of range",modIndex));
50     fTimeZero[modIndex-kNSPDmods]=tzero;
51   }
52
53   virtual void SetDeltaVDrift(Int_t modIndex, Float_t dv, Bool_t rightSide=kFALSE) {
54     int ind = GetVDIndex(modIndex,rightSide);
55     if (ind>=0) fDeltaVDrift[ind] = dv;
56   }
57
58   virtual Float_t GetDeltaVDrift(Int_t modIndex,Bool_t rightSide=kFALSE) const {
59     int ind = GetVDIndex(modIndex,rightSide);
60     return ind<0 ? 0.:fDeltaVDrift[ind];
61   }
62   // 
63   Bool_t IsVDCorr2Side()                       const {return TestBit(kVDCorr2Side);}
64   void   SetVDCorr2Side(Bool_t v=kTRUE)              {SetBit(kVDCorr2Side,v);}
65   //
66   static Float_t DefaultTimeOffset() {return fgkTimeOffsetDefault;}
67   virtual void SetTimeOffset(Float_t to){fTimeOffset = to;}
68   virtual Float_t GetTimeOffset()const {return fTimeOffset;}
69   virtual Float_t GetTimeZero(Int_t modIndex) const {
70     if(modIndex<kNSPDmods || modIndex>kNSPDmods+kNSDDmods){
71       AliError(Form("SDD module number %d out of range",modIndex));
72       return 0.;
73     }
74     return fTimeZero[modIndex-kNSPDmods];
75   }
76
77   virtual void SetADC2keV(Float_t conv){fADC2keV=conv;}
78   virtual Float_t GetADC2keV()const {return fADC2keV;}
79   virtual void SetADCtokeV(Int_t modIndex, Float_t conv){
80     if(modIndex<kNSPDmods || modIndex>kNSPDmods+kNSDDmods) AliError(Form("SDD module number %d out of range",modIndex));
81     fADCtokeV[modIndex-kNSPDmods]=conv;
82   }
83   virtual Float_t GetADCtokeV(Int_t modIndex) const {
84     if(modIndex<kNSPDmods || modIndex>kNSPDmods+kNSDDmods){
85       AliError(Form("SDD module number %d out of range",modIndex));
86       return 0.;
87     }
88     return fADCtokeV[modIndex-kNSPDmods];
89   }
90
91   virtual void SetChargevsTime(Float_t slope){fChargevsTime=slope;}
92   virtual Float_t GetChargevsTime()const {return fChargevsTime;}
93
94   static Float_t DefaultADC2keV() {return fgkADC2keVDefault;}
95   static Float_t DefaultChargevsTime() {return fgkChargevsTimeDefault;}
96
97   static Float_t GetCarlosRXClockPeriod() {return fgkCarlosRXClockPeriod;}
98
99
100  protected:
101     //
102   virtual Int_t GetVDIndex(Int_t modIndex, Bool_t rightSide=kFALSE) const {
103     int ind = modIndex - kNSPDmods;
104     if(ind<0 || ind>=kNSDDmods) {AliError(Form("SDD module number %d out of range",modIndex)); return -1;}
105     return (rightSide && IsVDCorr2Side()) ? ind + kNSDDmods : ind;
106   }
107
108
109  protected:
110
111   enum {kNSPDmods = 240};
112   enum {kNSDDmods = 260};
113   enum {kNLaddersLay3 = 14};
114   enum {kNLaddersLay4 = 22};
115
116
117   static const Float_t fgkTimeOffsetDefault;   // default for fTimeOffset
118   static const Float_t fgkADC2keVDefault;      // default for fADC2keV
119   static const Float_t fgkChargevsTimeDefault; // default for fChargevsTime
120   static const Float_t fgkCarlosRXClockPeriod; // clock period for CarlosRX
121
122   Float_t  fTimeOffset;             // Time offset due to electronic delays 
123                                     // --> obsolete, kept for backw. comp. 
124   Float_t  fTimeZero[kNSDDmods];    // Time Zero for each module
125   Float_t  fDeltaVDrift[2*kNSDDmods];  // Vdrift correction (um/ns) for each module left (<kNSDDmods) and right (>=kNSDDmods) sides
126   Float_t  fADC2keV;                // Conversion factor from ADC to keV
127                                     // --> obsolete, kept for backw. comp. 
128   Float_t  fChargevsTime;           // Correction for zero suppression effect
129   Float_t  fADCtokeV[kNSDDmods]; // ADC to keV conversion for each module
130
131  private:
132
133   AliITSresponseSDD(const AliITSresponseSDD &ob); // copy constructor
134   AliITSresponseSDD& operator=(const AliITSresponseSDD & /* source */); // ass. op.
135
136   ClassDef(AliITSresponseSDD,20) 
137      
138     };
139 #endif