]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSOnlineSDDInjectors.h
Bug fix - the dep energy should be divided by the MIP energy to form the counts
[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   void SetThresholds(Float_t tl, Float_t th){
27     fLowThreshold=tl;
28     fHighThreshold=th;
29   }
30   void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
31     fTbMin[jlin]=tbmin;
32     fTbMax[jlin]=tbmax;
33   }
34   void SetPolOrder(Int_t n){fPolOrder=n;}
35   void SetMinDriftSpeed(Float_t vmin){fMinDriftSpeed=vmin;}
36   void SetMaxDriftSpeed(Float_t vmax){fMaxDriftSpeed=vmax;}
37   void SetMaxDriftSpeedErr(Float_t maxval){
38     fMaxDriftSpeedErr=maxval;
39   }
40   void SetFitLimits(Int_t firstpad,Int_t lastpad){
41     fFirstPadForFit=firstpad;
42     fLastPadForFit=lastpad;
43   }
44   void SetPadStatusCutForFit(Int_t cutval=1){
45     fPadStatusCutForFit=cutval;
46   }
47   void SetDefaults();
48   void SetTimeStep(Float_t tstep) {
49     fTimeStep=tstep;
50   }
51
52   TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
53   TGraphErrors* GetDriftSpeedGraph() const;
54   TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
55   Float_t* GetDriftSpeedFitParam()const{ return fParam;}
56   Float_t GetDriftSpeed(Int_t jpad) const{return fDriftSpeed[jpad];}
57   Float_t GetDriftSpeedErr(Int_t jpad) const{return fDriftSpeedErr[jpad];}
58   Float_t GetTimeBinZero() const{return fTbZero;}
59
60   Float_t GetTimeStep() const{return fTimeStep;}
61   Int_t GetAnodeNumber(Int_t iInjPad) const;
62   Int_t GetInjPadNumberFromAnode(Int_t nAnode) const;
63   Int_t GetInjPadStatus(Int_t jpad) const;  
64   Int_t GetAnodeStatus(Int_t nAnode) const{
65     Int_t jpad=GetInjPadNumberFromAnode(nAnode);
66     return GetInjPadStatus(jpad);
67   }  
68   Float_t GetCentroid(Int_t jpad, Int_t jlin) const {
69     if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
70     else return -9999.;
71   }
72   Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
73     if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
74     else return 0;
75   }
76   void PrintInjectorStatus();
77   void PrintCentroids();
78   void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
79
80   void Reset();      
81   void AnalyzeEvent(TH2F* his);      
82   void FindGoodInjectors();
83   void FindCentroids();
84   void CalcDriftSpeed(Int_t jpad);
85   void CalcTimeBinZero();
86   void FitDriftSpeedVsAnode();
87
88  protected:
89   void SetPositions();
90  private:
91
92   enum {kInjPads  = 33};
93   enum {kInjLines = 3};
94
95   AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
96   AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
97   static const Float_t fgkSaturation;        // ADC saturation value (1008)
98   static const Float_t fgkDefaultLThreshold;  // Default for fLowThreshold
99   static const Float_t fgkDefaultHThreshold;  // Default for fHighThreshold
100   static const Float_t fgkDefaultMinSpeed;   // Default for fMinDriftSpeed
101   static const Float_t fgkDefaultMaxSpeed;   // Default for fMaxDriftSpeed
102   static const Float_t fgkDefaultMaxErr;     // Default for fMaxDriftSpeedErr
103   static const Int_t   fgkDefaultPolOrder;   // Default for fPolOrder
104   static const Float_t fgkDefaultTimeStep;   // Default for fTimeStep
105   static const UShort_t   fgkDefaultTbMin[kInjLines];  // Defaults for fTbMin
106   static const UShort_t   fgkDefaultTbMax[kInjLines];  // Defaults for fTbMax
107
108
109   TH2F* fHisto;                              // histogram of channel counts
110   Float_t fTbZero;                           // Time zero for injector event
111   Float_t fPosition[kInjLines];              // Coordinates of injector lines
112   UShort_t fTbMin[kInjLines];                // Minimum time bin for each line
113   UShort_t fTbMax[kInjLines];                // Maximum time bin for each line
114   Bool_t fGoodInj[kInjPads][kInjLines];      // array of good injectors
115   Float_t fCentroid[kInjPads][kInjLines];    // array of time bin centroids
116   Float_t fRMSCentroid[kInjPads][kInjLines]; // array of time rms of injectors
117   Float_t fDriftSpeed[kInjPads];             // drift speed
118   Float_t fDriftSpeedErr[kInjPads];          // error on drift speed
119   Float_t *fParam;                           // parameters of polinomial fit to
120                                              // drift speed vs. anode number
121   Int_t fPolOrder;                   // order of polinomial fit
122   Float_t fMinDriftSpeed;            // Minimum value for drift speed
123   Float_t fMaxDriftSpeed;            // Maximum value for drift speed
124   Float_t fMaxDriftSpeedErr;         // Maximum value for error on drift speed
125   Float_t fLowThreshold;             // Low threshold for injector signal
126   Float_t fHighThreshold;            // High threshold for injector signal
127
128   Int_t fFirstPadForFit;             // first injector pad used in fit
129   Int_t fLastPadForFit;              // last injector pad used in fit
130   Int_t fPadStatusCutForFit;         // minimum value of pad status for fit
131
132   Float_t fTimeStep;                 // time bin value (25 or 50 ns)
133
134   ClassDef(AliITSOnlineSDDInjectors,4)
135 };
136 #endif