Line data Source code
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 TH1F;
18 : class TH2F;
19 : class TGraphErrors;
20 : class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
21 :
22 : public:
23 : AliITSOnlineSDDInjectors();
24 : AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid);
25 : virtual ~AliITSOnlineSDDInjectors();
26 :
27 :
28 : void SetThresholds(Int_t ilin, Float_t tl, Float_t th){
29 0 : fLowThreshold[ilin]=tl;
30 0 : fHighThreshold[ilin]=th;
31 0 : }
32 : void SetMaxNumberOfCellsPerAnode(Int_t maxc=40){
33 0 : fMaxCellsAboveThreshold=maxc;
34 0 : }
35 :
36 : void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
37 0 : fTbMin[jlin]=tbmin;
38 0 : fTbMax[jlin]=tbmax;
39 0 : }
40 : void Set20MHzConfig();
41 : void Set40MHzConfig();
42 :
43 0 : void SetPolDegree(Int_t n){fPolDegree=n;}
44 0 : void SetMinDriftSpeed(Float_t vmin){fMinDriftSpeed=vmin;}
45 0 : void SetMaxDriftSpeed(Float_t vmax){fMaxDriftSpeed=vmax;}
46 : void SetMaxDriftSpeedErr(Float_t maxval){
47 0 : fMaxDriftSpeedErr=maxval;
48 0 : }
49 : void SetFitLimits(Int_t firstpad,Int_t lastpad){
50 0 : fFirstPadForFit=firstpad;
51 0 : fLastPadForFit=lastpad;
52 0 : }
53 : void SetPadStatusCutForFit(Int_t cutval=4){
54 0 : fPadStatusCutForFit=cutval;
55 0 : }
56 : void SetDefaults();
57 : void SetTimeStep(Double_t tstep) {
58 0 : fTimeStep=tstep;
59 0 : }
60 : void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
61 0 : fUseTimeZeroSignal=useTZ;
62 0 : }
63 : void SetUseLine(Int_t iLine, Bool_t use=kTRUE){
64 0 : if(iLine>=0 && iLine<kInjLines) fUseLine[iLine]=use;
65 0 : }
66 : TH1F* GetMeanDriftSpeedVsPadHisto() const;
67 : TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
68 : TGraphErrors* GetDriftSpeedGraph() const;
69 : TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
70 0 : Double_t* GetDriftSpeedFitParam()const{ return fParam;}
71 0 : Double_t GetDriftSpeed(Int_t jpad) const{return fDriftSpeed[jpad];}
72 0 : Double_t GetDriftSpeedErr(Int_t jpad) const{return fDriftSpeedErr[jpad];}
73 0 : Double_t GetTimeBinZero() const{return fTbZero;}
74 :
75 0 : 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 0 : Int_t jpad=GetInjPadNumberFromAnode(nAnode);
81 0 : return GetInjPadStatus(jpad);
82 : }
83 : Double_t GetCentroid(Int_t jpad, Int_t jlin) const {
84 0 : if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
85 0 : else return -9999.;
86 0 : }
87 : Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
88 0 : if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
89 0 : else return 0;
90 0 : }
91 : void PrintInjectorStatus();
92 : void PrintCentroids();
93 : void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
94 : void WriteInjectorStatusToASCII();
95 : Bool_t WriteToROOT(TFile *fil) const;
96 :
97 : void Reset();
98 : void AnalyzeEvent(TH2F* his);
99 : void AddEvent(TH2F* his);
100 : void FindGoodInjectors();
101 : void FindCentroids();
102 : void CalcDriftSpeed(Int_t jpad);
103 : void CalcTimeBinZero();
104 : void FitDriftSpeedVsAnode();
105 : void PolyFit(Int_t degree=3);
106 : Double_t GetMeanDriftSpeed(Int_t ipad) const{
107 0 : if(fNEventsInPad[ipad]==0) return 0.;
108 0 : return fSumDriftSpeed[ipad]/(Double_t)fNEventsInPad[ipad];
109 0 : }
110 : Double_t GetRMSDriftSpeed(Int_t ipad) const;
111 : Double_t GetMeanPadStatusCut(Int_t ipad) const{
112 0 : if(fNEventsInPad[ipad]==0) return 0.;
113 0 : return (Double_t)fSumPadStatusCut[ipad]/(Double_t)fNEventsInPad[ipad];
114 0 : }
115 : Double_t GetMeanPadStatus(Int_t ipad) const{
116 0 : if(fNEvents==0) return 0.;
117 0 : return (Double_t)fSumPadStatus[ipad]/(Double_t)fNEvents;
118 0 : }
119 :
120 : void FitMeanDriftSpeedVsAnode();
121 :
122 : protected:
123 : void SetPositions();
124 : private:
125 :
126 : enum {kInjPads = 33};
127 : enum {kInjLines = 3};
128 :
129 : AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
130 : AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
131 : static const Float_t fgkSaturation; // ADC saturation value (1008)
132 : static const Float_t fgkDefaultLThreshold; // Default for fLowThreshold
133 : static const Float_t fgkDefaultLThreshold1; // Default for fLowThreshold
134 : static const Float_t fgkDefaultHThreshold; // Default for fHighThreshold
135 : static const Float_t fgkDefaultHThreshold1; // Default for fHighThreshold
136 : static const Float_t fgkDefaultMinSpeed; // Default for fMinDriftSpeed
137 : static const Float_t fgkDefaultMaxSpeed; // Default for fMaxDriftSpeed
138 : static const Float_t fgkDefaultMaxErr; // Default for fMaxDriftSpeedErr
139 : static const Int_t fgkDefaultPolDegree; // Default for fPolDegree
140 : static const Float_t fgkDefaultTimeStep; // Default for fTimeStep
141 : static const UShort_t fgkDefaultTbMin[kInjLines]; // Defaults for fTbMin
142 : static const UShort_t fgkDefaultTbMax[kInjLines]; // Defaults for fTbMax
143 :
144 :
145 : TH2F* fHisto; // histogram of channel counts
146 : Double_t fTbZero; // Time zero for injector event
147 : Double_t fRMSTbZero; // Error on time zero
148 : Double_t fPosition[kInjLines]; // Coordinates of injector lines
149 : UShort_t fTbMin[kInjLines]; // Minimum time bin for each line
150 : UShort_t fTbMax[kInjLines]; // Maximum time bin for each line
151 : Bool_t fGoodInj[kInjPads][kInjLines]; // array of good injectors
152 : Double_t fCentroid[kInjPads][kInjLines]; // array of time bin centroids
153 : Double_t fRMSCentroid[kInjPads][kInjLines]; // array of time rms of injectors
154 : Double_t fDriftSpeed[kInjPads]; // drift speed
155 : Double_t fDriftSpeedErr[kInjPads]; // error on drift speed
156 : Int_t fNEvents; // number of events
157 : Int_t fNEventsInPad[kInjPads]; // number of events per pad
158 : Double_t fSumDriftSpeed[kInjPads]; // drift speed summed over events
159 : Double_t fSumSqDriftSpeed[kInjPads]; // drift speed^2 sum
160 : Int_t fSumPadStatus[kInjPads]; // pad status sum
161 : Int_t fSumPadStatusCut[kInjPads]; // pad status (> cut) sum
162 :
163 : Double_t *fParam; // parameters of polinomial fit to
164 : // drift speed vs. anode number
165 : Int_t fPolDegree; // Degree of polynomial fit
166 : Int_t fActualPolDegree; // Degree actually used (<=fPolDegree)
167 : Float_t fMinDriftSpeed; // Minimum value for drift speed
168 : Float_t fMaxDriftSpeed; // Maximum value for drift speed
169 : Float_t fMaxDriftSpeedErr; // Maximum value for error on drift speed
170 : Float_t fLowThreshold[kInjLines]; // Low threshold for injector signal
171 : Float_t fHighThreshold[kInjLines]; // High threshold for injector signal
172 :
173 : Bool_t fUseLine[kInjLines]; // Flag to use/not use a line
174 : Int_t fFirstPadForFit; // first injector pad used in fit
175 : Int_t fLastPadForFit; // last injector pad used in fit
176 : Int_t fPadStatusCutForFit; // minimum value of pad status for fit
177 :
178 : Double_t fTimeStep; // time bin value (25 or 50 ns)
179 : Bool_t fUseTimeZeroSignal; // flag for usage of time zero signal
180 : // in drift speed calculation
181 :
182 : Int_t fMaxCellsAboveThreshold; // cut to remove noisy anodes
183 :
184 116 : ClassDef(AliITSOnlineSDDInjectors,9)
185 : };
186 : #endif
|