1 #ifndef ALIITSONLINESDDINJECTORS_H
2 #define ALIITSONLINESDDINJECTORS_H
7 ///////////////////////////////////////////////////////////////////
9 // Class used for SDD injector analysis //
10 // Origin: F.Prino, Torino, prino@to.infn.it //
12 ///////////////////////////////////////////////////////////////////
14 #include "AliITSOnlineSDD.h"
20 class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
23 AliITSOnlineSDDInjectors();
24 AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid);
25 virtual ~AliITSOnlineSDDInjectors();
28 void SetThresholds(Float_t tl, Float_t th){
32 void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
36 void Set20MHzConfig(){
37 SetInjLineRange(0,10,20);
38 SetInjLineRange(1,50,70);
39 SetInjLineRange(2,100,120);
42 void Set40MHzConfig(){
43 SetInjLineRange(0,20,50);
44 SetInjLineRange(1,90,160);
45 SetInjLineRange(2,170,240);
48 void SetPolDegree(Int_t n){fPolDegree=n;}
49 void SetMinDriftSpeed(Float_t vmin){fMinDriftSpeed=vmin;}
50 void SetMaxDriftSpeed(Float_t vmax){fMaxDriftSpeed=vmax;}
51 void SetMaxDriftSpeedErr(Float_t maxval){
52 fMaxDriftSpeedErr=maxval;
54 void SetFitLimits(Int_t firstpad,Int_t lastpad){
55 fFirstPadForFit=firstpad;
56 fLastPadForFit=lastpad;
58 void SetPadStatusCutForFit(Int_t cutval=4){
59 fPadStatusCutForFit=cutval;
62 void SetTimeStep(Double_t tstep) {
65 void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
66 fUseTimeZeroSignal=useTZ;
68 void SetUseLine(Int_t iLine, Bool_t use=kTRUE){
69 if(iLine>=0 && iLine<kInjLines) fUseLine[iLine]=use;
71 TH1F* GetMeanDriftSpeedVsPadHisto() const;
72 TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
73 TGraphErrors* GetDriftSpeedGraph() const;
74 TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
75 Double_t* GetDriftSpeedFitParam()const{ return fParam;}
76 Double_t GetDriftSpeed(Int_t jpad) const{return fDriftSpeed[jpad];}
77 Double_t GetDriftSpeedErr(Int_t jpad) const{return fDriftSpeedErr[jpad];}
78 Double_t GetTimeBinZero() const{return fTbZero;}
80 Double_t GetTimeStep() const{return fTimeStep;}
81 Int_t GetAnodeNumber(Int_t iInjPad) const;
82 Int_t GetInjPadNumberFromAnode(Int_t nAnode) const;
83 Int_t GetInjPadStatus(Int_t jpad) const;
84 Int_t GetAnodeStatus(Int_t nAnode) const{
85 Int_t jpad=GetInjPadNumberFromAnode(nAnode);
86 return GetInjPadStatus(jpad);
88 Double_t GetCentroid(Int_t jpad, Int_t jlin) const {
89 if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
92 Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
93 if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
96 void PrintInjectorStatus();
97 void PrintCentroids();
98 void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
99 void WriteInjectorStatusToASCII();
100 Bool_t WriteToROOT(TFile *fil) const;
103 void AnalyzeEvent(TH2F* his);
104 void AddEvent(TH2F* his);
105 void FindGoodInjectors();
106 void FindCentroids();
107 void CalcDriftSpeed(Int_t jpad);
108 void CalcTimeBinZero();
109 void FitDriftSpeedVsAnode();
110 void PolyFit(Int_t degree=3);
111 Double_t GetMeanDriftSpeed(Int_t ipad) const{
112 if(fNEventsInPad[ipad]==0) return 0.;
113 return fSumDriftSpeed[ipad]/(Double_t)fNEventsInPad[ipad];
115 Double_t GetRMSDriftSpeed(Int_t ipad) const;
116 Double_t GetMeanPadStatusCut(Int_t ipad) const{
117 if(fNEventsInPad[ipad]==0) return 0.;
118 return (Double_t)fSumPadStatusCut[ipad]/(Double_t)fNEventsInPad[ipad];
120 Double_t GetMeanPadStatus(Int_t ipad) const{
121 if(fNEvents==0) return 0.;
122 return (Double_t)fSumPadStatus[ipad]/(Double_t)fNEvents;
125 void FitMeanDriftSpeedVsAnode();
131 enum {kInjPads = 33};
132 enum {kInjLines = 3};
134 AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
135 AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
136 static const Float_t fgkSaturation; // ADC saturation value (1008)
137 static const Float_t fgkDefaultLThreshold; // Default for fLowThreshold
138 static const Float_t fgkDefaultHThreshold; // Default for fHighThreshold
139 static const Float_t fgkDefaultMinSpeed; // Default for fMinDriftSpeed
140 static const Float_t fgkDefaultMaxSpeed; // Default for fMaxDriftSpeed
141 static const Float_t fgkDefaultMaxErr; // Default for fMaxDriftSpeedErr
142 static const Int_t fgkDefaultPolDegree; // Default for fPolDegree
143 static const Float_t fgkDefaultTimeStep; // Default for fTimeStep
144 static const UShort_t fgkDefaultTbMin[kInjLines]; // Defaults for fTbMin
145 static const UShort_t fgkDefaultTbMax[kInjLines]; // Defaults for fTbMax
148 TH2F* fHisto; // histogram of channel counts
149 Double_t fTbZero; // Time zero for injector event
150 Double_t fRMSTbZero; // Error on time zero
151 Double_t fPosition[kInjLines]; // Coordinates of injector lines
152 UShort_t fTbMin[kInjLines]; // Minimum time bin for each line
153 UShort_t fTbMax[kInjLines]; // Maximum time bin for each line
154 Bool_t fGoodInj[kInjPads][kInjLines]; // array of good injectors
155 Double_t fCentroid[kInjPads][kInjLines]; // array of time bin centroids
156 Double_t fRMSCentroid[kInjPads][kInjLines]; // array of time rms of injectors
157 Double_t fDriftSpeed[kInjPads]; // drift speed
158 Double_t fDriftSpeedErr[kInjPads]; // error on drift speed
159 Int_t fNEvents; // number of events
160 Int_t fNEventsInPad[kInjPads]; // number of events per pad
161 Double_t fSumDriftSpeed[kInjPads]; // drift speed summed over events
162 Double_t fSumSqDriftSpeed[kInjPads]; // drift speed^2 sum
163 Int_t fSumPadStatus[kInjPads]; // pad status sum
164 Int_t fSumPadStatusCut[kInjPads]; // pad status (> cut) sum
166 Double_t *fParam; // parameters of polinomial fit to
167 // drift speed vs. anode number
168 Int_t fPolDegree; // Degree of polynomial fit
169 Int_t fActualPolDegree; // Degree actually used (<=fPolDegree)
170 Float_t fMinDriftSpeed; // Minimum value for drift speed
171 Float_t fMaxDriftSpeed; // Maximum value for drift speed
172 Float_t fMaxDriftSpeedErr; // Maximum value for error on drift speed
173 Float_t fLowThreshold; // Low threshold for injector signal
174 Float_t fHighThreshold; // High threshold for injector signal
176 Bool_t fUseLine[kInjLines]; // Flag to use/not use a line
177 Int_t fFirstPadForFit; // first injector pad used in fit
178 Int_t fLastPadForFit; // last injector pad used in fit
179 Int_t fPadStatusCutForFit; // minimum value of pad status for fit
181 Double_t fTimeStep; // time bin value (25 or 50 ns)
182 Bool_t fUseTimeZeroSignal; // flag for usage of time zero signal
183 // in drift speed calculation
185 ClassDef(AliITSOnlineSDDInjectors,8)