]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSOnlineSDDInjectors.h
Added check for wrong records in the config file (R. Shaoyan)
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSDDInjectors.h
1 #ifndef ALIITSONLINESDDINJECTORS_H
2 #define ALIITSONLINESDDINJECTORS_H
3
4
5 /* $Id$ */
6
7 ///////////////////////////////////////////////////////////////////
8 //                                                               //
9 // Class used for SDD injector analysis                           //
10 // Origin: F.Prino, Torino, prino@to.infn.it                     //
11 //                                                               //
12 ///////////////////////////////////////////////////////////////////
13
14 #include "AliITSOnlineSDD.h"
15
16
17 class TH2F;
18 class TGraphErrors;
19 class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
20
21  public:
22   AliITSOnlineSDDInjectors();      
23   AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid);
24   virtual ~AliITSOnlineSDDInjectors();
25
26
27   void SetThresholds(Float_t tl, Float_t th){
28     fLowThreshold=tl;
29     fHighThreshold=th;
30   }
31   void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
32     fTbMin[jlin]=tbmin;
33     fTbMax[jlin]=tbmax;
34   }
35   void Set20MHzConfig(){
36     SetInjLineRange(0,10,20);
37     SetInjLineRange(1,50,70);
38     SetInjLineRange(2,100,120);
39     SetTimeStep(50.);
40   }
41   void Set40MHzConfig(){
42     SetInjLineRange(0,20,50);
43     SetInjLineRange(1,90,160);
44     SetInjLineRange(2,170,240);
45     SetTimeStep(25.);
46   }
47   void SetPolOrder(Int_t n){fPolOrder=n;}
48   void SetMinDriftSpeed(Float_t vmin){fMinDriftSpeed=vmin;}
49   void SetMaxDriftSpeed(Float_t vmax){fMaxDriftSpeed=vmax;}
50   void SetMaxDriftSpeedErr(Float_t maxval){
51     fMaxDriftSpeedErr=maxval;
52   }
53   void SetFitLimits(Int_t firstpad,Int_t lastpad){
54     fFirstPadForFit=firstpad;
55     fLastPadForFit=lastpad;
56   }
57   void SetPadStatusCutForFit(Int_t cutval=1){
58     fPadStatusCutForFit=cutval;
59   }
60   void SetDefaults();
61   void SetTimeStep(Double_t tstep) {
62     fTimeStep=tstep;
63   }
64   void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
65     fUseTimeZeroSignal=useTZ;
66   }
67   TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
68   TGraphErrors* GetDriftSpeedGraph() const;
69   TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
70   Double_t* GetDriftSpeedFitParam()const{ return fParam;}
71   Double_t GetDriftSpeed(Int_t jpad) const{return fDriftSpeed[jpad];}
72   Double_t GetDriftSpeedErr(Int_t jpad) const{return fDriftSpeedErr[jpad];}
73   Double_t GetTimeBinZero() const{return fTbZero;}
74
75   Double_t GetTimeStep() const{return fTimeStep;}
76   Int_t GetAnodeNumber(Int_t iInjPad) const;
77   Int_t GetInjPadNumberFromAnode(Int_t nAnode) const;
78   Int_t GetInjPadStatus(Int_t jpad) const;  
79   Int_t GetAnodeStatus(Int_t nAnode) const{
80     Int_t jpad=GetInjPadNumberFromAnode(nAnode);
81     return GetInjPadStatus(jpad);
82   }  
83   Double_t GetCentroid(Int_t jpad, Int_t jlin) const {
84     if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
85     else return -9999.;
86   }
87   Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
88     if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
89     else return 0;
90   }
91   void PrintInjectorStatus();
92   void PrintCentroids();
93   void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
94
95   void Reset();
96   void AnalyzeEvent(TH2F* his);
97   void AddEvent(TH2F* his);
98   void FindGoodInjectors();
99   void FindCentroids();
100   void CalcDriftSpeed(Int_t jpad);
101   void CalcTimeBinZero();
102   void FitDriftSpeedVsAnode();
103   Double_t GetMeanDriftSpeed(Int_t ipad) const{
104     if(fNEvents==0) return 0.;
105     return fSumDriftSpeed[ipad]/(Double_t)fNEvents;
106   }
107   Double_t GetRMSDriftSpeed(Int_t ipad) const;
108   void FitMeanDriftSpeedVsAnode();
109
110  protected:
111   void SetPositions();
112  private:
113
114   enum {kInjPads  = 33};
115   enum {kInjLines = 3};
116
117   AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
118   AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
119   static const Float_t fgkSaturation;        // ADC saturation value (1008)
120   static const Float_t fgkDefaultLThreshold;  // Default for fLowThreshold
121   static const Float_t fgkDefaultHThreshold;  // Default for fHighThreshold
122   static const Float_t fgkDefaultMinSpeed;   // Default for fMinDriftSpeed
123   static const Float_t fgkDefaultMaxSpeed;   // Default for fMaxDriftSpeed
124   static const Float_t fgkDefaultMaxErr;     // Default for fMaxDriftSpeedErr
125   static const Int_t   fgkDefaultPolOrder;   // Default for fPolOrder
126   static const Float_t fgkDefaultTimeStep;   // Default for fTimeStep
127   static const UShort_t   fgkDefaultTbMin[kInjLines];  // Defaults for fTbMin
128   static const UShort_t   fgkDefaultTbMax[kInjLines];  // Defaults for fTbMax
129
130
131   TH2F* fHisto;                              // histogram of channel counts
132   Double_t fTbZero;                           // Time zero for injector event
133   Double_t fRMSTbZero;                        // Error on time zero 
134   Double_t fPosition[kInjLines];              // Coordinates of injector lines
135   UShort_t fTbMin[kInjLines];                // Minimum time bin for each line
136   UShort_t fTbMax[kInjLines];                // Maximum time bin for each line
137   Bool_t fGoodInj[kInjPads][kInjLines];      // array of good injectors
138   Double_t fCentroid[kInjPads][kInjLines];    // array of time bin centroids
139   Double_t fRMSCentroid[kInjPads][kInjLines]; // array of time rms of injectors
140   Double_t fDriftSpeed[kInjPads];             // drift speed  
141   Double_t fDriftSpeedErr[kInjPads];          // error on drift speed
142   Int_t fNEvents;                            // number of events
143   Double_t fSumDriftSpeed[kInjPads];          // drift speed summed over events  
144   Double_t fSumSqDriftSpeed[kInjPads];        // drift speed^2 sum
145   
146   Double_t *fParam;                           // parameters of polinomial fit to
147                                              // drift speed vs. anode number
148   Int_t fPolOrder;                   // order of polinomial fit
149   Float_t fMinDriftSpeed;            // Minimum value for drift speed
150   Float_t fMaxDriftSpeed;            // Maximum value for drift speed
151   Float_t fMaxDriftSpeedErr;         // Maximum value for error on drift speed
152   Float_t fLowThreshold;             // Low threshold for injector signal
153   Float_t fHighThreshold;            // High threshold for injector signal
154
155   Int_t fFirstPadForFit;             // first injector pad used in fit
156   Int_t fLastPadForFit;              // last injector pad used in fit
157   Int_t fPadStatusCutForFit;         // minimum value of pad status for fit
158
159   Double_t fTimeStep;                 // time bin value (25 or 50 ns)
160   Bool_t fUseTimeZeroSignal;         // flag for usage of time zero signal
161                                      // in drift speed calculation
162
163   ClassDef(AliITSOnlineSDDInjectors,6)
164 };
165 #endif