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 */
6 ////////////////////////////////////////////////////////////////////////////////////////
8 // Implementation of the TPC Central Electrode calibration //
10 ////////////////////////////////////////////////////////////////////////////////////////
13 #include <TObjArray.h>
17 class TTreeSRedirector;
23 class AliTPCRawStream;
24 class AliTPCRawStreamFast;
26 class AliTPCAltroMapping;
29 struct eventHeaderStruct;
31 class AliTPCCalibCE : public TObject {
35 AliTPCCalibCE(const AliTPCCalibCE &sig);
36 AliTPCCalibCE(const TMap *config);
37 virtual ~AliTPCCalibCE();
39 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
41 Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
42 Bool_t ProcessEventFast(AliRawReader *rawReader);
45 Bool_t ProcessEvent(AliTPCRawStream *rawStream);
46 Bool_t ProcessEvent(AliRawReader *rawReader);
47 Bool_t ProcessEvent(eventHeaderStruct *event);
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);
53 AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
54 void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
57 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
58 AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
59 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
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
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
67 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
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
73 Float_t GetMeanT0rms() const {return fMeanT0rms;}
74 Float_t GetMeanQrms() const {return fMeanQrms;}
75 Float_t GetMeanRMSrms() const {return fMeanRMSrms;}
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;}
82 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
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);
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);
93 TVectorD* GetEventTimes() { return &fVEventTime; }
94 TVectorD* GetEventIds() { return &fVEventNumber; }
96 Short_t GetDebugLevel() const { return fDebugLevel; }
98 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
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
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;}
108 void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
109 void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
111 void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
113 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
115 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
117 void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
119 void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; }
121 Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
122 Int_t GetLastTimeBin() const { return fLastTimeBin; }
124 Int_t GetNeventsProcessed() const { return fNevents; }
126 Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
128 Float_t GetSecRejectRatio() const { return fSecRejectRatio; }
131 void Merge(AliTPCCalibCE *ce);
133 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
135 void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
138 Int_t fFirstTimeBin; // First Time bin needed for analysis
139 Int_t fLastTimeBin; // Last Time bin needed for analysis
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
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
156 Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
158 Int_t fLastSector; //! Last sector processed
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
163 AliTPCROC *fROC; //! ROC information
164 AliTPCAltroMapping **fMapping; //! Altro Mapping object
165 AliTPCParam *fParam; //! TPC information
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
172 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
173 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
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
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
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
186 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
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
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
192 TVectorD fVEventTime; // Timestamps of the events
193 TVectorD fVEventNumber; // Eventnumbers of the events
194 // TVectorD fVTime0Side[2]; // Mean Time0 for each side for all events
195 Int_t fNevents; // Event counter
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
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
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
215 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
216 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
217 TVectorD fVMeanQ; //! Mean Q for each sector;
218 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
220 Float_t fCurrentCETimeRef; //! Time refernce of the current sector
223 TTreeSRedirector *fDebugStreamer; //! debug streamer
226 Short_t fDebugLevel; // debug level
229 void FindPedestal(Float_t part=.6);
230 void UpdateCETimeRef(); //Get the time reference of the last valid measurement in sector
231 void FindCESignal(TVectorD ¶m, Float_t &qSum, const TVectorF maxima);
232 void FindLocalMaxima(TVectorF &maxima);
233 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
235 TH2S* GetHisto(Int_t sector, TObjArray *arr,
236 Int_t nbinsY, Float_t ymin, Float_t ymax,
237 const Char_t *type, Bool_t force);
238 TH1S* GetHisto(Int_t sector, TObjArray *arr,
239 const Char_t *type, Bool_t force);
241 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
243 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
244 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
246 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
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);
259 ClassDef(AliTPCCalibCE,7) //Implementation of the TPC Central Electrode calibration