to use AliPhysicsSelection class
[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
9f026db8 28 void SetThresholds(Float_t tl, Float_t th){
29 fLowThreshold=tl;
30 fHighThreshold=th;
31 }
32 void SetInjLineRange(Int_t jlin, Int_t tbmin, Int_t tbmax){
33 fTbMin[jlin]=tbmin;
34 fTbMax[jlin]=tbmax;
35 }
b255f56d 36 void Set20MHzConfig(){
37 SetInjLineRange(0,10,20);
38 SetInjLineRange(1,50,70);
39 SetInjLineRange(2,100,120);
40 SetTimeStep(50.);
41 }
42 void Set40MHzConfig(){
43 SetInjLineRange(0,20,50);
44 SetInjLineRange(1,90,160);
45 SetInjLineRange(2,170,240);
46 SetTimeStep(25.);
47 }
9f026db8 48 void SetPolOrder(Int_t n){fPolOrder=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;
348f80b7 53 }
9f026db8 54 void SetFitLimits(Int_t firstpad,Int_t lastpad){
55 fFirstPadForFit=firstpad;
56 fLastPadForFit=lastpad;
348f80b7 57 }
9f026db8 58 void SetPadStatusCutForFit(Int_t cutval=1){
59 fPadStatusCutForFit=cutval;
348f80b7 60 }
9f026db8 61 void SetDefaults();
2ca27861 62 void SetTimeStep(Double_t tstep) {
f4e26d31 63 fTimeStep=tstep;
64 }
784a52ed 65 void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
66 fUseTimeZeroSignal=useTZ;
67 }
e5b2f7f2 68 TH1F* GetMeanDriftSpeedVsPadHisto() const;
9f026db8 69 TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
70 TGraphErrors* GetDriftSpeedGraph() const;
84df0230 71 TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
2ca27861 72 Double_t* GetDriftSpeedFitParam()const{ return fParam;}
73 Double_t GetDriftSpeed(Int_t jpad) const{return fDriftSpeed[jpad];}
74 Double_t GetDriftSpeedErr(Int_t jpad) const{return fDriftSpeedErr[jpad];}
75 Double_t GetTimeBinZero() const{return fTbZero;}
9f026db8 76
2ca27861 77 Double_t GetTimeStep() const{return fTimeStep;}
9f026db8 78 Int_t GetAnodeNumber(Int_t iInjPad) const;
79 Int_t GetInjPadNumberFromAnode(Int_t nAnode) const;
80 Int_t GetInjPadStatus(Int_t jpad) const;
81 Int_t GetAnodeStatus(Int_t nAnode) const{
82 Int_t jpad=GetInjPadNumberFromAnode(nAnode);
83 return GetInjPadStatus(jpad);
84 }
2ca27861 85 Double_t GetCentroid(Int_t jpad, Int_t jlin) const {
9f026db8 86 if(jpad<kInjPads && jlin<kInjLines) return fCentroid[jpad][jlin];
c668f182 87 else return -9999.;
88 }
9f026db8 89 Bool_t IsInjectorGood(Int_t jpad, Int_t jlin) const {
90 if(jpad<kInjPads && jlin<kInjLines) return fGoodInj[jpad][jlin];
c668f182 91 else return 0;
92 }
9f026db8 93 void PrintInjectorStatus();
348f80b7 94 void PrintCentroids();
4c82df4c 95 void WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend=0);
50d25e98 96 void WriteInjectorStatusToASCII();
456ec396 97 Bool_t WriteToROOT(TFile *fil) const;
348f80b7 98
2ca27861 99 void Reset();
100 void AnalyzeEvent(TH2F* his);
101 void AddEvent(TH2F* his);
348f80b7 102 void FindGoodInjectors();
103 void FindCentroids();
9f026db8 104 void CalcDriftSpeed(Int_t jpad);
348f80b7 105 void CalcTimeBinZero();
9f026db8 106 void FitDriftSpeedVsAnode();
2ca27861 107 Double_t GetMeanDriftSpeed(Int_t ipad) const{
108 if(fNEvents==0) return 0.;
109 return fSumDriftSpeed[ipad]/(Double_t)fNEvents;
110 }
111 Double_t GetRMSDriftSpeed(Int_t ipad) const;
112 void FitMeanDriftSpeedVsAnode();
348f80b7 113
114 protected:
115 void SetPositions();
116 private:
117
9f026db8 118 enum {kInjPads = 33};
119 enum {kInjLines = 3};
348f80b7 120
121 AliITSOnlineSDDInjectors(const AliITSOnlineSDDInjectors& source);
122 AliITSOnlineSDDInjectors& operator = (const AliITSOnlineSDDInjectors& source);
9f026db8 123 static const Float_t fgkSaturation; // ADC saturation value (1008)
124 static const Float_t fgkDefaultLThreshold; // Default for fLowThreshold
125 static const Float_t fgkDefaultHThreshold; // Default for fHighThreshold
126 static const Float_t fgkDefaultMinSpeed; // Default for fMinDriftSpeed
127 static const Float_t fgkDefaultMaxSpeed; // Default for fMaxDriftSpeed
128 static const Float_t fgkDefaultMaxErr; // Default for fMaxDriftSpeedErr
129 static const Int_t fgkDefaultPolOrder; // Default for fPolOrder
f4e26d31 130 static const Float_t fgkDefaultTimeStep; // Default for fTimeStep
9f026db8 131 static const UShort_t fgkDefaultTbMin[kInjLines]; // Defaults for fTbMin
132 static const UShort_t fgkDefaultTbMax[kInjLines]; // Defaults for fTbMax
133
134
135 TH2F* fHisto; // histogram of channel counts
2ca27861 136 Double_t fTbZero; // Time zero for injector event
137 Double_t fRMSTbZero; // Error on time zero
138 Double_t fPosition[kInjLines]; // Coordinates of injector lines
9f026db8 139 UShort_t fTbMin[kInjLines]; // Minimum time bin for each line
140 UShort_t fTbMax[kInjLines]; // Maximum time bin for each line
141 Bool_t fGoodInj[kInjPads][kInjLines]; // array of good injectors
2ca27861 142 Double_t fCentroid[kInjPads][kInjLines]; // array of time bin centroids
143 Double_t fRMSCentroid[kInjPads][kInjLines]; // array of time rms of injectors
144 Double_t fDriftSpeed[kInjPads]; // drift speed
145 Double_t fDriftSpeedErr[kInjPads]; // error on drift speed
146 Int_t fNEvents; // number of events
147 Double_t fSumDriftSpeed[kInjPads]; // drift speed summed over events
148 Double_t fSumSqDriftSpeed[kInjPads]; // drift speed^2 sum
149
150 Double_t *fParam; // parameters of polinomial fit to
9f026db8 151 // drift speed vs. anode number
152 Int_t fPolOrder; // order of polinomial fit
153 Float_t fMinDriftSpeed; // Minimum value for drift speed
154 Float_t fMaxDriftSpeed; // Maximum value for drift speed
155 Float_t fMaxDriftSpeedErr; // Maximum value for error on drift speed
156 Float_t fLowThreshold; // Low threshold for injector signal
157 Float_t fHighThreshold; // High threshold for injector signal
158
159 Int_t fFirstPadForFit; // first injector pad used in fit
160 Int_t fLastPadForFit; // last injector pad used in fit
161 Int_t fPadStatusCutForFit; // minimum value of pad status for fit
162
2ca27861 163 Double_t fTimeStep; // time bin value (25 or 50 ns)
784a52ed 164 Bool_t fUseTimeZeroSignal; // flag for usage of time zero signal
165 // in drift speed calculation
9f026db8 166
2ca27861 167 ClassDef(AliITSOnlineSDDInjectors,6)
348f80b7 168};
169#endif