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