]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSOnlineSDDInjectors.h
Shorten names
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSDDInjectors.h
CommitLineData
348f80b7 1#ifndef ALIITSONLINESDDINJECTORS_H
2#define ALIITSONLINESDDINJECTORS_H
3
4
84df0230 5/* $Id$ */
9f026db8 6
348f80b7 7///////////////////////////////////////////////////////////////////
8// //
9// Class used for SDD injector analysis //
10// Origin: F.Prino, Torino, prino@to.infn.it //
11// //
12///////////////////////////////////////////////////////////////////
9f026db8 13
0e5e647a 14#include "AliITSOnlineSDD.h"
348f80b7 15
9f026db8 16
e5b2f7f2 17class TH1F;
348f80b7 18class TH2F;
19class TGraphErrors;
20class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
21
22 public:
23 AliITSOnlineSDDInjectors();
979b5a5f 24 AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid);
348f80b7 25 virtual ~AliITSOnlineSDDInjectors();
26
b255f56d 27
b9585d25 28 void SetThresholds(Int_t ilin, Float_t tl, Float_t th){
29 fLowThreshold[ilin]=tl;
30 fHighThreshold[ilin]=th;
9f026db8 31 }
b9585d25 32 void SetMaxNumberOfCellsPerAnode(Int_t maxc=40){
33 fMaxCellsAboveThreshold=maxc;
34 }
35
9f026db8 36 void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
37 fTbMin[jlin]=tbmin;
38 fTbMax[jlin]=tbmax;
39 }
b9585d25 40 void Set20MHzConfig();
41 void Set40MHzConfig();
42
915c0469 43 void SetPolDegree(Int_t n){fPolDegree=n;}
9f026db8 44 void SetMinDriftSpeed(Float_t vmin){fMinDriftSpeed=vmin;}
45 void SetMaxDriftSpeed(Float_t vmax){fMaxDriftSpeed=vmax;}
46 void SetMaxDriftSpeedErr(Float_t maxval){
47 fMaxDriftSpeedErr=maxval;
348f80b7 48 }
9f026db8 49 void SetFitLimits(Int_t firstpad,Int_t lastpad){
50 fFirstPadForFit=firstpad;
51 fLastPadForFit=lastpad;
348f80b7 52 }
915c0469 53 void SetPadStatusCutForFit(Int_t cutval=4){
9f026db8 54 fPadStatusCutForFit=cutval;
348f80b7 55 }
9f026db8 56 void SetDefaults();
2ca27861 57 void SetTimeStep(Double_t tstep) {
f4e26d31 58 fTimeStep=tstep;
59 }
784a52ed 60 void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
61 fUseTimeZeroSignal=useTZ;
62 }
1397fe91 63 void SetUseLine(Int_t iLine, Bool_t use=kTRUE){
64 if(iLine>=0 && iLine<kInjLines) fUseLine[iLine]=use;
65 }
e5b2f7f2 66 TH1F* GetMeanDriftSpeedVsPadHisto() const;
9f026db8 67 TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
68 TGraphErrors* GetDriftSpeedGraph() const;
84df0230 69 TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
2ca27861 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;}
9f026db8 74
2ca27861 75 Double_t GetTimeStep() const{return fTimeStep;}
9f026db8 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 }
2ca27861 83 Double_t GetCentroid(Int_t jpad, Int_t jlin) const {
9f026db8 84 if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
c668f182 85 else return -9999.;
86 }
9f026db8 87 Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
88 if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
c668f182 89 else return 0;
90 }
9f026db8 91 void PrintInjectorStatus();
348f80b7 92 void PrintCentroids();
4c82df4c 93 void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
50d25e98 94 void WriteInjectorStatusToASCII();
456ec396 95 Bool_t WriteToROOT(TFile *fil) const;
348f80b7 96
2ca27861 97 void Reset();
98 void AnalyzeEvent(TH2F* his);
99 void AddEvent(TH2F* his);
348f80b7 100 void FindGoodInjectors();
101 void FindCentroids();
9f026db8 102 void CalcDriftSpeed(Int_t jpad);
348f80b7 103 void CalcTimeBinZero();
9f026db8 104 void FitDriftSpeedVsAnode();
3bc883e9 105 void PolyFit(Int_t degree=3);
2ca27861 106 Double_t GetMeanDriftSpeed(Int_t ipad) const{
e89a0633 107 if(fNEventsInPad[ipad]==0) return 0.;
108 return fSumDriftSpeed[ipad]/(Double_t)fNEventsInPad[ipad];
2ca27861 109 }
110 Double_t GetRMSDriftSpeed(Int_t ipad) const;
e89a0633 111 Double_t GetMeanPadStatusCut(Int_t ipad) const{
112 if(fNEventsInPad[ipad]==0) return 0.;
113 return (Double_t)fSumPadStatusCut[ipad]/(Double_t)fNEventsInPad[ipad];
114 }
115 Double_t GetMeanPadStatus(Int_t ipad) const{
116 if(fNEvents==0) return 0.;
117 return (Double_t)fSumPadStatus[ipad]/(Double_t)fNEvents;
118 }
119
2ca27861 120 void FitMeanDriftSpeedVsAnode();
348f80b7 121
122 protected:
123 void SetPositions();
124 private:
125
9f026db8 126 enum {kInjPads = 33};
127 enum {kInjLines = 3};
348f80b7 128
129 AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
130 AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
9f026db8 131 static const Float_t fgkSaturation; // ADC saturation value (1008)
132 static const Float_t fgkDefaultLThreshold; // Default for fLowThreshold
b9585d25 133 static const Float_t fgkDefaultLThreshold1; // Default for fLowThreshold
9f026db8 134 static const Float_t fgkDefaultHThreshold; // Default for fHighThreshold
b9585d25 135 static const Float_t fgkDefaultHThreshold1; // Default for fHighThreshold
9f026db8 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
915c0469 139 static const Int_t fgkDefaultPolDegree; // Default for fPolDegree
f4e26d31 140 static const Float_t fgkDefaultTimeStep; // Default for fTimeStep
9f026db8 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
2ca27861 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
e89a0633 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
2ca27861 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
e89a0633 156 Int_t fNEvents; // number of events
157 Int_t fNEventsInPad[kInjPads]; // number of events per pad
2ca27861 158 Double_t fSumDriftSpeed[kInjPads]; // drift speed summed over events
159 Double_t fSumSqDriftSpeed[kInjPads]; // drift speed^2 sum
e89a0633 160 Int_t fSumPadStatus[kInjPads]; // pad status sum
161 Int_t fSumPadStatusCut[kInjPads]; // pad status (> cut) sum
2ca27861 162
e89a0633 163 Double_t *fParam; // parameters of polinomial fit to
9f026db8 164 // drift speed vs. anode number
e89a0633 165 Int_t fPolDegree; // Degree of polynomial fit
166 Int_t fActualPolDegree; // Degree actually used (<=fPolDegree)
9f026db8 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
b9585d25 170 Float_t fLowThreshold[kInjLines]; // Low threshold for injector signal
171 Float_t fHighThreshold[kInjLines]; // High threshold for injector signal
9f026db8 172
1397fe91 173 Bool_t fUseLine[kInjLines]; // Flag to use/not use a line
9f026db8 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
b9585d25 178 Double_t fTimeStep; // time bin value (25 or 50 ns)
784a52ed 179 Bool_t fUseTimeZeroSignal; // flag for usage of time zero signal
180 // in drift speed calculation
9f026db8 181
b9585d25 182 Int_t fMaxCellsAboveThreshold; // cut to remove noisy anodes
183
184 ClassDef(AliITSOnlineSDDInjectors,9)
348f80b7 185};
186#endif