]>
Commit | Line | Data |
---|---|---|
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> |
ac940b58 | 13 | #include <TObjArray.h> |
75d8233f | 14 | class TH1S; |
15 | class TH2S; | |
16 | class TH1F; | |
17 | class TTreeSRedirector; | |
18 | class AliTPCCalPad; | |
19 | class AliTPCROC; | |
20 | class AliTPCCalROC; | |
21 | class AliTPCParam; | |
22 | class AliRawReader; | |
23 | class AliTPCRawStream; | |
08205ed7 | 24 | class AliTPCRawStreamFast; |
75d8233f | 25 | class TGraph; |
04049c81 | 26 | class AliTPCAltroMapping; |
ac940b58 | 27 | class TMap; |
04049c81 | 28 | |
75d8233f | 29 | struct eventHeaderStruct; |
30 | ||
31 | class AliTPCCalibCE : public TObject { | |
32 | ||
33 | public: | |
34 | AliTPCCalibCE(); | |
35 | AliTPCCalibCE(const AliTPCCalibCE &sig); | |
ac940b58 | 36 | AliTPCCalibCE(const TMap *config); |
75d8233f | 37 | virtual ~AliTPCCalibCE(); |
38 | ||
39 | AliTPCCalibCE& operator = (const AliTPCCalibCE &source); | |
40 | ||
08205ed7 | 41 | Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast); |
42 | Bool_t ProcessEventFast(AliRawReader *rawReader); | |
43 | ||
75d8233f | 44 | |
45 | Bool_t ProcessEvent(AliTPCRawStream *rawStream); | |
46 | Bool_t ProcessEvent(AliRawReader *rawReader); | |
47 | Bool_t ProcessEvent(eventHeaderStruct *event); | |
48 | ||
49 | Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad, | |
50 | const Int_t iTimeBin, const Float_t signal); | |
51 | void Analyse(); | |
04049c81 | 52 | // |
53 | AliTPCAltroMapping **GetAltroMapping() { return fMapping; }; | |
54 | void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; }; | |
55 | ||
75d8233f | 56 | // |
3cd27a08 | 57 | AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector |
ef7f7670 | 58 | AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector |
3cd27a08 | 59 | AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector |
75d8233f | 60 | AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector |
61 | AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector | |
62 | ||
ef7f7670 | 63 | const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object |
64 | const TObjArray* GetCalPadT0Err() const { return &fCalRocArrayT0Err; } // get calibration object | |
65 | const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object | |
66 | const TObjArray* GetCalPadRMS() const { return &fCalRocArrayRMS;} // get calibration object | |
3cd27a08 | 67 | const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object |
75d8233f | 68 | |
69 | TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram | |
70 | TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram | |
71 | TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram | |
72 | ||
4f57cad7 | 73 | Float_t GetMeanT0rms() const {return fMeanT0rms;} |
74 | Float_t GetMeanQrms() const {return fMeanQrms;} | |
75 | Float_t GetMeanRMSrms() const {return fMeanRMSrms;} | |
76 | ||
77 | Int_t GetPeakDetectionMinus() const {return fPeakMinus;} | |
78 | Int_t GetPeakDetectionPlus() const {return fPeakPlus;} | |
79 | Float_t GetNnoiseThresholdMax() const {return fNoiseThresholdMax;} | |
80 | Float_t GetNnoiseThresholdSum() const {return fNoiseThresholdSum;} | |
4c6d06dc | 81 | |
75d8233f | 82 | TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram |
83 | ||
7fb602b1 | 84 | //needed here to merge ClibCE objects |
85 | TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE); | |
86 | TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE); | |
87 | ||
88 | // TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; } | |
89 | // TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; } | |
90 | TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE); | |
91 | TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE); | |
92 | ||
93 | TVectorD* GetEventTimes() { return &fVEventTime; } | |
94 | TVectorD* GetEventIds() { return &fVEventNumber; } | |
95 | ||
75d8233f | 96 | Short_t GetDebugLevel() const { return fDebugLevel; } |
97 | // | |
98 | void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected | |
99 | // | |
100 | void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms | |
101 | void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms | |
102 | void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms | |
103 | // | |
4c6d06dc | 104 | void SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakMinus=minus; fPeakPlus=plus;} |
105 | void SetNnoiseThresholdMax(Float_t n) {fNoiseThresholdMax=n;} | |
106 | void SetNnoiseThresholdSum(Float_t n) {fNoiseThresholdSum=n;} | |
107 | // | |
7fb602b1 | 108 | void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; } |
109 | void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; } | |
110 | ||
111 | void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;} | |
75d8233f | 112 | |
75d8233f | 113 | void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;} |
114 | ||
bf57d87d | 115 | void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;} |
116 | ||
4c6d06dc | 117 | void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; } |
118 | ||
930a9868 | 119 | void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; } |
120 | ||
75d8233f | 121 | Int_t GetFirstTimeBin() const { return fFirstTimeBin; } |
122 | Int_t GetLastTimeBin() const { return fLastTimeBin; } | |
123 | ||
3cd27a08 | 124 | Int_t GetNeventsProcessed() const { return fNevents; } |
75d8233f | 125 | |
4c6d06dc | 126 | Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; } |
127 | ||
930a9868 | 128 | Float_t GetSecRejectRatio() const { return fSecRejectRatio; } |
129 | ||
4c6d06dc | 130 | |
7fb602b1 | 131 | void Merge(AliTPCCalibCE *ce); |
132 | ||
75d8233f | 133 | TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0); |
134 | ||
135 | void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE); | |
136 | ||
bf57d87d | 137 | private: |
75d8233f | 138 | Int_t fFirstTimeBin; // First Time bin needed for analysis |
139 | Int_t fLastTimeBin; // Last Time bin needed for analysis | |
140 | ||
141 | // reference histogram ranges | |
142 | Int_t fNbinsT0; // Number of bins for T0 reference histogram | |
143 | Float_t fXminT0; // xmin of T0 reference histogram | |
144 | Float_t fXmaxT0; // xmax of T0 reference histogram | |
145 | Int_t fNbinsQ; // Number of bins for T0 reference histogram | |
146 | Float_t fXminQ; // xmin of T0 reference histogram | |
147 | Float_t fXmaxQ; // xmax of T0 reference histogram | |
148 | Int_t fNbinsRMS; // Number of bins for T0 reference histogram | |
149 | Float_t fXminRMS; // xmin of T0 reference histogram | |
150 | Float_t fXmaxRMS; // xmax of T0 reference histogram | |
4c6d06dc | 151 | Int_t fPeakMinus; // Consecutive timebins on rising edge to be regarded as a signal |
152 | Int_t fPeakPlus; // Consecutive timebins on falling edge to be regarded as a signal | |
153 | Float_t fNoiseThresholdMax; // Analysis Treshold for signal finding: Max>fNoiseThresholdMax*PadNoise | |
154 | Float_t fNoiseThresholdSum; // Analysis Treshold for signal finding: Sum>fNoiseThresholdSum*PadNoise | |
155 | ||
156 | Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals! | |
75d8233f | 157 | |
158 | Int_t fLastSector; //! Last sector processed | |
159 | ||
930a9868 | 160 | Float_t fSecRejectRatio; //! Needed percentage of signals in one chamber. Below it will be rejected |
161 | // This is neede if we do not process a laser event | |
75d8233f | 162 | |
163 | AliTPCROC *fROC; //! ROC information | |
04049c81 | 164 | AliTPCAltroMapping **fMapping; //! Altro Mapping object |
75d8233f | 165 | AliTPCParam *fParam; //! TPC information |
166 | ||
167 | AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC | |
168 | AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC | |
169 | AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC | |
170 | AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC | |
75d8233f | 171 | |
172 | TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration | |
ef7f7670 | 173 | TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration |
75d8233f | 174 | TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration |
175 | TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration | |
176 | TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers | |
177 | ||
178 | TObjArray fHistoQArray; // Calibration histograms for Charge distribution | |
179 | TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution | |
180 | TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution | |
181 | ||
ef7f7670 | 182 | Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results |
183 | Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results | |
184 | Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results | |
185 | ||
75d8233f | 186 | TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors |
187 | ||
75d8233f | 188 | TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit |
189 | TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit | |
bf57d87d | 190 | TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event |
191 | TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event | |
75d8233f | 192 | TVectorD fVEventTime; // Timestamps of the events |
193 | TVectorD fVEventNumber; // Eventnumbers of the events | |
ef7f7670 | 194 | // TVectorD fVTime0Side[2]; // Mean Time0 for each side for all events |
75d8233f | 195 | Int_t fNevents; // Event counter |
7fb602b1 | 196 | Double_t fTimeStamp; //! Timestamp of the current event |
197 | Double_t fEventId; //! Event Id of the current event | |
198 | Double_t fRunNumber; //! Run Number of the current event | |
199 | Double_t fOldRunNumber; //! Old Run Number | |
75d8233f | 200 | |
201 | TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections | |
202 | TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer | |
203 | TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer | |
204 | TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer | |
205 | ||
ef7f7670 | 206 | Int_t fCurrentChannel; //! current channel processed |
207 | Int_t fCurrentSector; //! current sector processed | |
208 | Int_t fCurrentRow; //! current row processed | |
209 | Float_t fMaxPadSignal; //! maximum bin of current pad | |
210 | Int_t fMaxTimeBin; //! time bin with maximum value | |
211 | TVectorF fPadSignal; //! signal of current Pad | |
212 | Float_t fPadPedestal; //! Pedestal Value of current pad | |
213 | Float_t fPadNoise; //! Noise Value of current pad | |
75d8233f | 214 | |
215 | TVectorD fVTime0Offset; //! Time0 Offset for each sector; | |
216 | TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector; | |
bf57d87d | 217 | TVectorD fVMeanQ; //! Mean Q for each sector; |
218 | TVectorD fVMeanQCounter; //! Mean Q counter for each sector; | |
ef7f7670 | 219 | |
ac940b58 | 220 | Float_t fCurrentCETimeRef; //! Time refernce of the current sector |
75d8233f | 221 | //debugging |
3cd27a08 | 222 | // Int_t fEvent; |
75d8233f | 223 | TTreeSRedirector *fDebugStreamer; //! debug streamer |
ac940b58 | 224 | |
75d8233f | 225 | |
3cd27a08 | 226 | Short_t fDebugLevel; // debug level |
75d8233f | 227 | //! debugging |
228 | ||
229 | void FindPedestal(Float_t part=.6); | |
ac940b58 | 230 | void UpdateCETimeRef(); //Get the time reference of the last valid measurement in sector |
75d8233f | 231 | void FindCESignal(TVectorD ¶m, Float_t &qSum, const TVectorF maxima); |
232 | void FindLocalMaxima(TVectorF &maxima); | |
3cd27a08 | 233 | Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const; |
75d8233f | 234 | |
235 | TH2S* GetHisto(Int_t sector, TObjArray *arr, | |
236 | Int_t nbinsY, Float_t ymin, Float_t ymax, | |
a6e0ebfe | 237 | const Char_t *type, Bool_t force); |
75d8233f | 238 | TH1S* GetHisto(Int_t sector, TObjArray *arr, |
a6e0ebfe | 239 | const Char_t *type, Bool_t force); |
75d8233f | 240 | |
3cd27a08 | 241 | AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const; |
75d8233f | 242 | |
3cd27a08 | 243 | TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const; |
75d8233f | 244 | TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE); |
245 | ||
3cd27a08 | 246 | TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const; |
75d8233f | 247 | |
248 | void ResetEvent(); | |
249 | void ResetPad(); | |
250 | void ProcessPad(); | |
251 | void EndEvent(); | |
252 | ||
253 | ||
254 | //debug | |
75d8233f | 255 | TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE); |
256 | TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE); | |
257 | TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE); | |
258 | ||
4c6d06dc | 259 | ClassDef(AliTPCCalibCE,7) //Implementation of the TPC Central Electrode calibration |
7fb602b1 | 260 | |
75d8233f | 261 | }; |
262 | ||
263 | ||
264 | ||
265 | #endif | |
266 |