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 "AliTPCCalibRawBase.h"
17 class TTreeSRedirector;
23 class AliTPCRawStream;
24 class AliTPCRawStreamFast;
29 struct eventHeaderStruct;
31 class AliTPCCalibCE : public AliTPCCalibRawBase {
35 AliTPCCalibCE(const AliTPCCalibCE &sig);
36 AliTPCCalibCE(const TMap *config);
37 virtual ~AliTPCCalibCE();
39 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
41 virtual Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
42 const Int_t iTimeBin, const Float_t signal);
43 virtual void Analyse();
46 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
47 AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
48 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
49 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
50 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
52 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object
53 const TObjArray* GetCalPadT0Err() const { return &fCalRocArrayT0Err; } // get calibration object
54 const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object
55 const TObjArray* GetCalPadRMS() const { return &fCalRocArrayRMS;} // get calibration object
56 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
58 TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
59 TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
60 TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
62 Float_t GetMeanT0rms() const {return fMeanT0rms;}
63 Float_t GetMeanQrms() const {return fMeanQrms;}
64 Float_t GetMeanRMSrms() const {return fMeanRMSrms;}
66 Int_t GetPeakDetectionMinus() const {return fPeakDetMinus;}
67 Int_t GetPeakDetectionPlus() const {return fPeakDetPlus;}
68 Int_t GetPeakIntRangeMinus() const {return fPeakIntMinus;}
69 Int_t GetPeakIntRangePlus() const {return fPeakIntPlus;}
70 Float_t GetNnoiseThresholdMax() const {return fNoiseThresholdMax;}
71 Float_t GetNnoiseThresholdSum() const {return fNoiseThresholdSum;}
73 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
75 //needed here to merge ClibCE objects
76 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
77 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
79 // TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
80 // TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
81 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
82 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
84 const TVectorD* GetEventTimes() const { return &fVEventTime; }
85 const TVectorD* GetEventIds() const { return &fVEventNumber; }
88 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
89 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
90 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
92 void SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakDetMinus=minus; fPeakDetPlus=plus;}
93 void SetRangePeakIntegral(Int_t minus, Int_t plus) { fPeakIntMinus=minus; fPeakIntPlus=plus;}
94 void SetNnoiseThresholdMax(Float_t n) {fNoiseThresholdMax=n;}
95 void SetNnoiseThresholdSum(Float_t n) {fNoiseThresholdSum=n;}
97 void SetEventInfo(UInt_t runNumber,UInt_t timestamp, UInt_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
99 void SetPedestalDatabase(AliTPCCalPad * const pedestalTPC, AliTPCCalPad * const padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
100 void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
101 void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; }
103 Int_t GetNeventsProcessed() const { return fNevents; }
105 Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
107 Float_t GetSecRejectRatio() const { return fSecRejectRatio; }
109 const TVectorF *GetTime0Side(Int_t side=0) const {return (side==0)?&fVTime0SideA:&fVTime0SideC;}
110 Float_t GetPeakIntegralMinus() const {return fPeakIntMinus;}
111 Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;}
114 void Merge(AliTPCCalibCE * const ce);
115 virtual Long64_t Merge(TCollection * const list);
117 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
120 virtual void EndEvent();
121 virtual void ResetEvent();
124 // reference histogram ranges
125 Int_t fNbinsT0; // Number of bins for T0 reference histogram
126 Float_t fXminT0; // xmin of T0 reference histogram
127 Float_t fXmaxT0; // xmax of T0 reference histogram
128 Int_t fNbinsQ; // Number of bins for T0 reference histogram
129 Float_t fXminQ; // xmin of T0 reference histogram
130 Float_t fXmaxQ; // xmax of T0 reference histogram
131 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
132 Float_t fXminRMS; // xmin of T0 reference histogram
133 Float_t fXmaxRMS; // xmax of T0 reference histogram
134 Int_t fPeakDetMinus; // Consecutive timebins on rising edge to be regarded as a signal
135 Int_t fPeakDetPlus; // Consecutive timebins on falling edge to be regarded as a signal
136 Int_t fPeakIntMinus; // Peak integral range for COG determination. Bins used before max bin
137 Int_t fPeakIntPlus; // Peak integral range for COG determination. Bins used after max bin
138 Float_t fNoiseThresholdMax; // Analysis Treshold for signal finding: Max>fNoiseThresholdMax*PadNoise
139 Float_t fNoiseThresholdSum; // Analysis Treshold for signal finding: Sum>fNoiseThresholdSum*PadNoise
141 Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
143 Int_t fLastSector; //! Last sector processed
145 Float_t fSecRejectRatio; //! Needed percentage of signals in one chamber. Below it will be rejected
146 // This is neede if we do not process a laser event
148 AliTPCParam *fParam; //! TPC information
150 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
151 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
152 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
153 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
155 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
156 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
157 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
158 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
159 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
161 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
162 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
163 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
165 Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results
166 Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results
167 Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results
169 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
171 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
172 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
173 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
174 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
175 TVectorD fVEventTime; // Timestamps of the events
176 TVectorD fVEventNumber; // Eventnumbers of the events
177 TVectorF fVTime0SideA; // Mean Time0 for side A for all events
178 TVectorF fVTime0SideC; // Mean Time0 for side C for all events
179 Double_t fEventId; //! Event Id of the current event
180 UInt_t fOldRunNumber; //! Old Run Number
182 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
183 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
184 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
185 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
187 Int_t fCurrentChannel; //! current channel processed
188 Int_t fCurrentSector; //! current sector processed
189 Int_t fCurrentRow; //! current row processed
190 Float_t fMaxPadSignal; //! maximum bin of current pad
191 Int_t fMaxTimeBin; //! time bin with maximum value
192 Float_t fPadSignal[1024]; //! signal of current Pad
193 Float_t fPadPedestal; //! Pedestal Value of current pad
194 Float_t fPadNoise; //! Noise Value of current pad
196 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
197 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
198 TVectorD fVMeanQ; //! Mean Q for each sector;
199 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
201 Float_t fCurrentCETimeRef; //! Time refernce of the current sector
203 void FindPedestal(Float_t part=.6);
204 void UpdateCETimeRef(); //Get the time reference of the last valid measurement in sector
205 void FindCESignal(TVectorD ¶m, Float_t &qSum, const TVectorF maxima);
206 void FindLocalMaxima(TVectorF &maxima);
207 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
209 TH2S* GetHisto(Int_t sector, TObjArray *arr,
210 Int_t nbinsY, Float_t ymin, Float_t ymax,
211 const Char_t *type, Bool_t force);
212 TH1S* GetHisto(Int_t sector, TObjArray *arr,
213 const Char_t *type, Bool_t force);
215 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
217 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
218 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
220 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
225 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
226 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
227 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
229 ClassDef(AliTPCCalibCE,8) //Implementation of the TPC Central Electrode calibration