]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCCalibCE.h
SVN keyword Id is set
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibCE.h
CommitLineData
75d8233f 1#ifndef ALITPCCALIBCE_H
2#define ALITPCCALIBCE_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
3cd27a08 6////////////////////////////////////////////////////////////////////////////////////////
7// //
8// Implementation of the TPC Central Electrode calibration //
9// //
10////////////////////////////////////////////////////////////////////////////////////////
11
75d8233f 12#include <TVectorT.h>
880c3382 13#include "AliTPCCalibRawBase.h"
75d8233f 14class TH1S;
15class TH2S;
16class TH1F;
17class TTreeSRedirector;
18class AliTPCCalPad;
19class AliTPCROC;
20class AliTPCCalROC;
21class AliTPCParam;
22class AliRawReader;
23class AliTPCRawStream;
08205ed7 24class AliTPCRawStreamFast;
75d8233f 25class TGraph;
ac940b58 26class TMap;
04049c81 27
75d8233f 28struct eventHeaderStruct;
29
880c3382 30class AliTPCCalibCE : public AliTPCCalibRawBase {
31
75d8233f 32public:
880c3382 33 AliTPCCalibCE();
34 AliTPCCalibCE(const AliTPCCalibCE &sig);
35 AliTPCCalibCE(const TMap *config);
36 virtual ~AliTPCCalibCE();
37
38 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
39
40 virtual Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
41 const Int_t iTimeBin, const Float_t signal);
42 virtual void Analyse();
43
75d8233f 44 //
880c3382 45 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
46 AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
47 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
48 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
49 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
50
51 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object
52 const TObjArray* GetCalPadT0Err() const { return &fCalRocArrayT0Err; } // get calibration object
53 const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object
54 const TObjArray* GetCalPadRMS() const { return &fCalRocArrayRMS;} // get calibration object
55 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
56
57 TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
58 TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
59 TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
60
61 Float_t GetMeanT0rms() const {return fMeanT0rms;}
62 Float_t GetMeanQrms() const {return fMeanQrms;}
63 Float_t GetMeanRMSrms() const {return fMeanRMSrms;}
64
65 Int_t GetPeakDetectionMinus() const {return fPeakDetMinus;}
66 Int_t GetPeakDetectionPlus() const {return fPeakDetPlus;}
67 Int_t GetPeakIntRangeMinus() const {return fPeakIntMinus;}
68 Int_t GetPeakIntRangePlus() const {return fPeakIntPlus;}
69 Float_t GetNnoiseThresholdMax() const {return fNoiseThresholdMax;}
70 Float_t GetNnoiseThresholdSum() const {return fNoiseThresholdSum;}
71
72 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
73
7fb602b1 74 //needed here to merge ClibCE objects
880c3382 75 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
76 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
77
7fb602b1 78// TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
79// TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
880c3382 80 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
81 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
82
83 TVectorD* GetEventTimes() { return &fVEventTime; }
84 TVectorD* GetEventIds() { return &fVEventNumber; }
85
86 //
87 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
88 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
89 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
90 //
91 void SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakDetMinus=minus; fPeakDetPlus=plus;}
92 void SetRangePeakIntegral(Int_t minus, Int_t plus) { fPeakIntMinus=minus; fPeakIntPlus=plus;}
93 void SetNnoiseThresholdMax(Float_t n) {fNoiseThresholdMax=n;}
94 void SetNnoiseThresholdSum(Float_t n) {fNoiseThresholdSum=n;}
95 //
c3066940 96 void SetEventInfo(UInt_t runNumber,UInt_t timestamp, UInt_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
880c3382 97 //
98 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
99 void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
100 void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; }
101 //Getters
102 Int_t GetNeventsProcessed() const { return fNevents; }
103
104 Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
105
106 Float_t GetSecRejectRatio() const { return fSecRejectRatio; }
107
108 const TVectorF *GetTime0Side(Int_t side=0) const {return (side==0)?&fVTime0SideA:&fVTime0SideC;}
109 Float_t GetPeakIntegralMinus() const {return fPeakIntMinus;}
110 Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;}
111
112
113 void Merge(AliTPCCalibCE *ce);
114
115 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
116
bf57d87d 117private:
75d8233f 118 // reference histogram ranges
880c3382 119 Int_t fNbinsT0; // Number of bins for T0 reference histogram
120 Float_t fXminT0; // xmin of T0 reference histogram
121 Float_t fXmaxT0; // xmax of T0 reference histogram
122 Int_t fNbinsQ; // Number of bins for T0 reference histogram
123 Float_t fXminQ; // xmin of T0 reference histogram
124 Float_t fXmaxQ; // xmax of T0 reference histogram
125 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
126 Float_t fXminRMS; // xmin of T0 reference histogram
127 Float_t fXmaxRMS; // xmax of T0 reference histogram
128 Int_t fPeakDetMinus; // Consecutive timebins on rising edge to be regarded as a signal
129 Int_t fPeakDetPlus; // Consecutive timebins on falling edge to be regarded as a signal
130 Int_t fPeakIntMinus; // Peak integral range for COG determination. Bins used before max bin
131 Int_t fPeakIntPlus; // Peak integral range for COG determination. Bins used after max bin
132 Float_t fNoiseThresholdMax; // Analysis Treshold for signal finding: Max>fNoiseThresholdMax*PadNoise
133 Float_t fNoiseThresholdSum; // Analysis Treshold for signal finding: Sum>fNoiseThresholdSum*PadNoise
134
135 Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
136
137 Int_t fLastSector; //! Last sector processed
138
139 Float_t fSecRejectRatio; //! Needed percentage of signals in one chamber. Below it will be rejected
930a9868 140 // This is neede if we do not process a laser event
880c3382 141
142 AliTPCParam *fParam; //! TPC information
143
144 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
145 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
146 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
147 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
148
149 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
150 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
151 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
152 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
153 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
154
155 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
156 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
157 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
158
159 Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results
160 Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results
161 Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results
162
163 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
164
165 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
166 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
167 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
168 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
169 TVectorD fVEventTime; // Timestamps of the events
170 TVectorD fVEventNumber; // Eventnumbers of the events
171 TVectorF fVTime0SideA; // Mean Time0 for side A for all events
172 TVectorF fVTime0SideC; // Mean Time0 for side C for all events
880c3382 173 Double_t fEventId; //! Event Id of the current event
c3066940 174 UInt_t fOldRunNumber; //! Old Run Number
880c3382 175
176 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
177 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
178 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
179 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
180
181 Int_t fCurrentChannel; //! current channel processed
182 Int_t fCurrentSector; //! current sector processed
183 Int_t fCurrentRow; //! current row processed
184 Float_t fMaxPadSignal; //! maximum bin of current pad
185 Int_t fMaxTimeBin; //! time bin with maximum value
2963bcbf 186 Float_t fPadSignal[1024]; //! signal of current Pad
880c3382 187 Float_t fPadPedestal; //! Pedestal Value of current pad
188 Float_t fPadNoise; //! Noise Value of current pad
189
190 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
191 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
192 TVectorD fVMeanQ; //! Mean Q for each sector;
193 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
194
195 Float_t fCurrentCETimeRef; //! Time refernce of the current sector
196
197 void FindPedestal(Float_t part=.6);
198 void UpdateCETimeRef(); //Get the time reference of the last valid measurement in sector
199 void FindCESignal(TVectorD &param, Float_t &qSum, const TVectorF maxima);
200 void FindLocalMaxima(TVectorF &maxima);
201 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
202
203 TH2S* GetHisto(Int_t sector, TObjArray *arr,
204 Int_t nbinsY, Float_t ymin, Float_t ymax,
205 const Char_t *type, Bool_t force);
206 TH1S* GetHisto(Int_t sector, TObjArray *arr,
207 const Char_t *type, Bool_t force);
208
209 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
210
211 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
212 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
213
214 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
215
216 virtual void EndEvent();
217 virtual void ResetEvent();
218 void ResetPad();
219 void ProcessPad();
220 //debug
221 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
222 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
223 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
224
225 ClassDef(AliTPCCalibCE,8) //Implementation of the TPC Central Electrode calibration
75d8233f 226};
227
75d8233f 228#endif