]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCCalibCE.h
- Small fix for CAF that messed-up user tasks after filters
[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>
13class TObjArray;
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;
04049c81 26class AliTPCAltroMapping;
27
75d8233f 28struct eventHeaderStruct;
29
30class AliTPCCalibCE : public TObject {
31
32public:
33 AliTPCCalibCE();
34 AliTPCCalibCE(const AliTPCCalibCE &sig);
35 virtual ~AliTPCCalibCE();
36
37 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
38
08205ed7 39 Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
40 Bool_t ProcessEventFast(AliRawReader *rawReader);
41
75d8233f 42
43 Bool_t ProcessEvent(AliTPCRawStream *rawStream);
44 Bool_t ProcessEvent(AliRawReader *rawReader);
45 Bool_t ProcessEvent(eventHeaderStruct *event);
46
47 Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
48 const Int_t iTimeBin, const Float_t signal);
49 void Analyse();
04049c81 50 //
51 AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
52 void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
53
75d8233f 54 //
3cd27a08 55 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
ef7f7670 56 AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
3cd27a08 57 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
75d8233f 58 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
59 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
60
ef7f7670 61 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object
62 const TObjArray* GetCalPadT0Err() const { return &fCalRocArrayT0Err; } // get calibration object
63 const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object
64 const TObjArray* GetCalPadRMS() const { return &fCalRocArrayRMS;} // get calibration object
3cd27a08 65 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
75d8233f 66
67 TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
68 TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
69 TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
70
ef7f7670 71 const Float_t GetMeanT0rms() {return fMeanT0rms;}
72 const Float_t GetMeanQrms() {return fMeanQrms;}
73 const Float_t GetMeanRMSrms() {return fMeanRMSrms;}
74
75d8233f 75 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
76
7fb602b1 77 //needed here to merge ClibCE objects
78 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
79 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
80
81// TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
82// TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
83 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
84 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
85
86 TVectorD* GetEventTimes() { return &fVEventTime; }
87 TVectorD* GetEventIds() { return &fVEventNumber; }
88
75d8233f 89 Short_t GetDebugLevel() const { return fDebugLevel; }
90 //
91 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
92 //
93 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
94 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
95 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
96 //
7fb602b1 97 void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
98 void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
99
100 void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
75d8233f 101
75d8233f 102 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
103
bf57d87d 104 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
105
75d8233f 106 Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
107 Int_t GetLastTimeBin() const { return fLastTimeBin; }
108
3cd27a08 109 Int_t GetNeventsProcessed() const { return fNevents; }
75d8233f 110
7fb602b1 111 void Merge(AliTPCCalibCE *ce);
112
75d8233f 113 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
114
115 void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
116
bf57d87d 117private:
75d8233f 118 Int_t fFirstTimeBin; // First Time bin needed for analysis
119 Int_t fLastTimeBin; // Last Time bin needed for analysis
120
121 // reference histogram ranges
122 Int_t fNbinsT0; // Number of bins for T0 reference histogram
123 Float_t fXminT0; // xmin of T0 reference histogram
124 Float_t fXmaxT0; // xmax of T0 reference histogram
125 Int_t fNbinsQ; // Number of bins for T0 reference histogram
126 Float_t fXminQ; // xmin of T0 reference histogram
127 Float_t fXmaxQ; // xmax of T0 reference histogram
128 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
129 Float_t fXminRMS; // xmin of T0 reference histogram
130 Float_t fXmaxRMS; // xmax of T0 reference histogram
131
132 Int_t fLastSector; //! Last sector processed
133
75d8233f 134
135 AliTPCROC *fROC; //! ROC information
04049c81 136 AliTPCAltroMapping **fMapping; //! Altro Mapping object
75d8233f 137 AliTPCParam *fParam; //! TPC information
138
139 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
140 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
141 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
142 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
75d8233f 143
144 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
ef7f7670 145 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
75d8233f 146 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
147 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
148 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
149
150 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
151 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
152 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
153
ef7f7670 154 Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results
155 Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results
156 Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results
157
75d8233f 158 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
159
75d8233f 160 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
161 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
bf57d87d 162 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
163 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
75d8233f 164 TVectorD fVEventTime; // Timestamps of the events
165 TVectorD fVEventNumber; // Eventnumbers of the events
ef7f7670 166// TVectorD fVTime0Side[2]; // Mean Time0 for each side for all events
75d8233f 167 Int_t fNevents; // Event counter
7fb602b1 168 Double_t fTimeStamp; //! Timestamp of the current event
169 Double_t fEventId; //! Event Id of the current event
170 Double_t fRunNumber; //! Run Number of the current event
171 Double_t fOldRunNumber; //! Old Run Number
75d8233f 172
173 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
174 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
175 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
176 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
177
ef7f7670 178 Int_t fCurrentChannel; //! current channel processed
179 Int_t fCurrentSector; //! current sector processed
180 Int_t fCurrentRow; //! current row processed
181 Float_t fMaxPadSignal; //! maximum bin of current pad
182 Int_t fMaxTimeBin; //! time bin with maximum value
183 TVectorF fPadSignal; //! signal of current Pad
184 Float_t fPadPedestal; //! Pedestal Value of current pad
185 Float_t fPadNoise; //! Noise Value of current pad
75d8233f 186
187 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
188 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
bf57d87d 189 TVectorD fVMeanQ; //! Mean Q for each sector;
190 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
ef7f7670 191
75d8233f 192 //debugging
3cd27a08 193// Int_t fEvent;
75d8233f 194 TTreeSRedirector *fDebugStreamer; //! debug streamer
195
3cd27a08 196 Short_t fDebugLevel; // debug level
75d8233f 197 //! debugging
198
199 void FindPedestal(Float_t part=.6);
200 void FindCESignal(TVectorD &param, Float_t &qSum, const TVectorF maxima);
201 void FindLocalMaxima(TVectorF &maxima);
3cd27a08 202 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
75d8233f 203
204 TH2S* GetHisto(Int_t sector, TObjArray *arr,
205 Int_t nbinsY, Float_t ymin, Float_t ymax,
206 Char_t *type, Bool_t force);
207 TH1S* GetHisto(Int_t sector, TObjArray *arr,
208 Char_t *type, Bool_t force);
209
3cd27a08 210 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
75d8233f 211
3cd27a08 212 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
75d8233f 213 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
214
3cd27a08 215 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
75d8233f 216
217 void ResetEvent();
218 void ResetPad();
219 void ProcessPad();
220 void EndEvent();
221
222
223 //debug
75d8233f 224 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
225 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
226 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
227
9a090ccd 228 ClassDef(AliTPCCalibCE,6) //Implementation of the TPC Central Electrode calibration
7fb602b1 229
75d8233f 230};
231
232
233
234#endif
235