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;
28 struct eventHeaderStruct;
30 class AliTPCCalibCE : public AliTPCCalibRawBase {
34 AliTPCCalibCE(const AliTPCCalibCE &sig);
35 AliTPCCalibCE(const TMap *config);
36 virtual ~AliTPCCalibCE();
38 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
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();
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
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
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
61 Float_t GetMeanT0rms() const {return fMeanT0rms;}
62 Float_t GetMeanQrms() const {return fMeanQrms;}
63 Float_t GetMeanRMSrms() const {return fMeanRMSrms;}
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;}
72 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
74 //needed here to merge ClibCE objects
75 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
76 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
78 // TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
79 // TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
80 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
81 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
83 TVectorD* GetEventTimes() { return &fVEventTime; }
84 TVectorD* GetEventIds() { return &fVEventNumber; }
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
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;}
96 void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
97 void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
98 void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
100 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
101 void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
102 void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; }
104 Int_t GetNeventsProcessed() const { return fNevents; }
106 Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
108 Float_t GetSecRejectRatio() const { return fSecRejectRatio; }
110 const TVectorF *GetTime0Side(Int_t side=0) const {return (side==0)?&fVTime0SideA:&fVTime0SideC;}
111 Float_t GetPeakIntegralMinus() const {return fPeakIntMinus;}
112 Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;}
115 void Merge(AliTPCCalibCE *ce);
117 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
120 // reference histogram ranges
121 Int_t fNbinsT0; // Number of bins for T0 reference histogram
122 Float_t fXminT0; // xmin of T0 reference histogram
123 Float_t fXmaxT0; // xmax of T0 reference histogram
124 Int_t fNbinsQ; // Number of bins for T0 reference histogram
125 Float_t fXminQ; // xmin of T0 reference histogram
126 Float_t fXmaxQ; // xmax of T0 reference histogram
127 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
128 Float_t fXminRMS; // xmin of T0 reference histogram
129 Float_t fXmaxRMS; // xmax of T0 reference histogram
130 Int_t fPeakDetMinus; // Consecutive timebins on rising edge to be regarded as a signal
131 Int_t fPeakDetPlus; // Consecutive timebins on falling edge to be regarded as a signal
132 Int_t fPeakIntMinus; // Peak integral range for COG determination. Bins used before max bin
133 Int_t fPeakIntPlus; // Peak integral range for COG determination. Bins used after max bin
134 Float_t fNoiseThresholdMax; // Analysis Treshold for signal finding: Max>fNoiseThresholdMax*PadNoise
135 Float_t fNoiseThresholdSum; // Analysis Treshold for signal finding: Sum>fNoiseThresholdSum*PadNoise
137 Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
139 Int_t fLastSector; //! Last sector processed
141 Float_t fSecRejectRatio; //! Needed percentage of signals in one chamber. Below it will be rejected
142 // This is neede if we do not process a laser event
144 AliTPCParam *fParam; //! TPC information
146 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
147 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
148 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
149 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
151 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
152 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
153 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
154 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
155 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
157 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
158 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
159 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
161 Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results
162 Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results
163 Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results
165 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
167 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
168 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
169 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
170 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
171 TVectorD fVEventTime; // Timestamps of the events
172 TVectorD fVEventNumber; // Eventnumbers of the events
173 TVectorF fVTime0SideA; // Mean Time0 for side A for all events
174 TVectorF fVTime0SideC; // Mean Time0 for side C for all events
175 Double_t fTimeStamp; //! Timestamp of the current event
176 Double_t fEventId; //! Event Id of the current event
177 Double_t fRunNumber; //! Run Number of the current event
178 Double_t fOldRunNumber; //! Old Run Number
180 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
181 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
182 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
183 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
185 Int_t fCurrentChannel; //! current channel processed
186 Int_t fCurrentSector; //! current sector processed
187 Int_t fCurrentRow; //! current row processed
188 Float_t fMaxPadSignal; //! maximum bin of current pad
189 Int_t fMaxTimeBin; //! time bin with maximum value
190 TVectorF fPadSignal; //! signal of current Pad
191 Float_t fPadPedestal; //! Pedestal Value of current pad
192 Float_t fPadNoise; //! Noise Value of current pad
194 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
195 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
196 TVectorD fVMeanQ; //! Mean Q for each sector;
197 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
199 Float_t fCurrentCETimeRef; //! Time refernce of the current sector
201 void FindPedestal(Float_t part=.6);
202 void UpdateCETimeRef(); //Get the time reference of the last valid measurement in sector
203 void FindCESignal(TVectorD ¶m, Float_t &qSum, const TVectorF maxima);
204 void FindLocalMaxima(TVectorF &maxima);
205 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
207 TH2S* GetHisto(Int_t sector, TObjArray *arr,
208 Int_t nbinsY, Float_t ymin, Float_t ymax,
209 const Char_t *type, Bool_t force);
210 TH1S* GetHisto(Int_t sector, TObjArray *arr,
211 const Char_t *type, Bool_t force);
213 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
215 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
216 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
218 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
220 virtual void EndEvent();
221 virtual void ResetEvent();
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