]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCCalibCE.h
trying to fix memory leaks
[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;
15class TH2S;
16class TH1F;
17class TTreeSRedirector;
18class AliTPCCalPad;
19class AliTPCROC;
20class AliTPCCalROC;
21class AliTPCParam;
22class AliRawReader;
23class AliTPCRawStream;
08205ed7 24class AliTPCRawStreamFast;
75d8233f 25class TGraph;
ac940b58 26class TMap;
7442bceb 27class TCollection;
04049c81 28
75d8233f 29struct eventHeaderStruct;
30
880c3382 31class AliTPCCalibCE : public AliTPCCalibRawBase {
32
75d8233f 33public:
880c3382 34 AliTPCCalibCE();
35 AliTPCCalibCE(const AliTPCCalibCE &sig);
36 AliTPCCalibCE(const TMap *config);
37 virtual ~AliTPCCalibCE();
38
39 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
40
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();
44
75d8233f 45 //
880c3382 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
51
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
57
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
61
62 Float_t GetMeanT0rms() const {return fMeanT0rms;}
63 Float_t GetMeanQrms() const {return fMeanQrms;}
64 Float_t GetMeanRMSrms() const {return fMeanRMSrms;}
65
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;}
72
73 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
74
7fb602b1 75 //needed here to merge ClibCE objects
880c3382 76 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
77 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
78
7fb602b1 79// TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
80// TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
880c3382 81 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
82 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
83
7442bceb 84 const TVectorD* GetEventTimes() const { return &fVEventTime; }
85 const TVectorD* GetEventIds() const { return &fVEventNumber; }
880c3382 86
87 //
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
91 //
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;}
96 //
c3066940 97 void SetEventInfo(UInt_t runNumber,UInt_t timestamp, UInt_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
880c3382 98 //
7442bceb 99 void SetPedestalDatabase(AliTPCCalPad * const pedestalTPC, AliTPCCalPad * const padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
880c3382 100 void SetIsZeroSuppressed(Bool_t zs=kTRUE) { fIsZeroSuppressed=zs; }
101 void SetSecRejectRatio(Float_t ratio) { fSecRejectRatio=ratio; }
102 //Getters
103 Int_t GetNeventsProcessed() const { return fNevents; }
104
105 Bool_t GetIsZeroSuppressed() const { return fIsZeroSuppressed; }
106
107 Float_t GetSecRejectRatio() const { return fSecRejectRatio; }
108
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;}
112
113
7442bceb 114 void Merge(AliTPCCalibCE * const ce);
115 virtual Long64_t Merge(TCollection * const list);
880c3382 116
117 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
7442bceb 118
119protected:
120 virtual void EndEvent();
121 virtual void ResetEvent();
122
bf57d87d 123private:
75d8233f 124 // reference histogram ranges
880c3382 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
140
141 Bool_t fIsZeroSuppressed; // If data is Zero Suppressed -> Don't subtrakt pedestals!
142
143 Int_t fLastSector; //! Last sector processed
144
145 Float_t fSecRejectRatio; //! Needed percentage of signals in one chamber. Below it will be rejected
930a9868 146 // This is neede if we do not process a laser event
880c3382 147
148 AliTPCParam *fParam; //! TPC information
149
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
154
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
160
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
164
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
168
169 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
170
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
880c3382 179 Double_t fEventId; //! Event Id of the current event
c3066940 180 UInt_t fOldRunNumber; //! Old Run Number
880c3382 181
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
186
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
2963bcbf 192 Float_t fPadSignal[1024]; //! signal of current Pad
880c3382 193 Float_t fPadPedestal; //! Pedestal Value of current pad
194 Float_t fPadNoise; //! Noise Value of current pad
195
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;
200
201 Float_t fCurrentCETimeRef; //! Time refernce of the current sector
202
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 &param, 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;
208
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);
214
215 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
216
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);
219
220 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
221
880c3382 222 void ResetPad();
223 void ProcessPad();
224 //debug
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);
228
229 ClassDef(AliTPCCalibCE,8) //Implementation of the TPC Central Electrode calibration
75d8233f 230};
231
75d8233f 232#endif