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