]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCCalibCE.h
Additional protection. Do not issue AliFatal in case of corrupted data (cosmic test)
[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>
13class TObjArray;
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;
26struct eventHeaderStruct;
27
28class AliTPCCalibCE : public TObject {
29
30public:
31 AliTPCCalibCE();
32 AliTPCCalibCE(const AliTPCCalibCE &sig);
33 virtual ~AliTPCCalibCE();
34
35 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
36
08205ed7 37 Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
38 Bool_t ProcessEventFast(AliRawReader *rawReader);
39
75d8233f 40
41 Bool_t ProcessEvent(AliTPCRawStream *rawStream);
42 Bool_t ProcessEvent(AliRawReader *rawReader);
43 Bool_t ProcessEvent(eventHeaderStruct *event);
44
45 Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
46 const Int_t iTimeBin, const Float_t signal);
47 void Analyse();
48 //
3cd27a08 49 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
50 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
75d8233f 51 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
52 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
53
3cd27a08 54 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // 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
75d8233f 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 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
64
7fb602b1 65 //needed here to merge ClibCE objects
66 TObjArray* GetParamArrayPol1(Int_t sector, Bool_t force=kFALSE);
67 TObjArray* GetParamArrayPol2(Int_t sector, Bool_t force=kFALSE);
68
69// TObjArray* GetTMeanArrayEvent(){ return &fTMeanArrayEvent; }
70// TObjArray* GetQMeanArrayEvent(){ return &fQMeanArrayEvent; }
71 TVectorF* GetTMeanEvents(Int_t sector, Bool_t force=kFALSE);
72 TVectorF* GetQMeanEvents(Int_t sector, Bool_t force=kFALSE);
73
74 TVectorD* GetEventTimes() { return &fVEventTime; }
75 TVectorD* GetEventIds() { return &fVEventNumber; }
76
75d8233f 77 Short_t GetDebugLevel() const { return fDebugLevel; }
78 //
79 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
80 //
81 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
82 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
83 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
84 //
7fb602b1 85 void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
86 void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
87
88 void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
75d8233f 89
90 void SetOldRCUformat(Bool_t format=kTRUE){ fOldRCUformat = format; }
91
92 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
93
bf57d87d 94 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
95
75d8233f 96 Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
97 Int_t GetLastTimeBin() const { return fLastTimeBin; }
98
3cd27a08 99 Int_t GetNeventsProcessed() const { return fNevents; }
75d8233f 100
7fb602b1 101 void Merge(AliTPCCalibCE *ce);
102
75d8233f 103 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
104
105 void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
106
bf57d87d 107private:
75d8233f 108 Int_t fFirstTimeBin; // First Time bin needed for analysis
109 Int_t fLastTimeBin; // Last Time bin needed for analysis
110
111 // reference histogram ranges
112 Int_t fNbinsT0; // Number of bins for T0 reference histogram
113 Float_t fXminT0; // xmin of T0 reference histogram
114 Float_t fXmaxT0; // xmax of T0 reference histogram
115 Int_t fNbinsQ; // Number of bins for T0 reference histogram
116 Float_t fXminQ; // xmin of T0 reference histogram
117 Float_t fXmaxQ; // xmax of T0 reference histogram
118 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
119 Float_t fXminRMS; // xmin of T0 reference histogram
120 Float_t fXmaxRMS; // xmax of T0 reference histogram
121
122 Int_t fLastSector; //! Last sector processed
123
124 Bool_t fOldRCUformat; //! Should we use the old RCU format for data reading
125
126 AliTPCROC *fROC; //! ROC information
127 AliTPCParam *fParam; //! TPC information
128
129 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
130 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
131 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
132 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
75d8233f 133
134 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
135 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
136 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
137 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
138
139 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
140 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
141 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
142
143 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
144
75d8233f 145 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
146 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
bf57d87d 147 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
148 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
75d8233f 149 TVectorD fVEventTime; // Timestamps of the events
150 TVectorD fVEventNumber; // Eventnumbers of the events
151 Int_t fNevents; // Event counter
7fb602b1 152 Double_t fTimeStamp; //! Timestamp of the current event
153 Double_t fEventId; //! Event Id of the current event
154 Double_t fRunNumber; //! Run Number of the current event
155 Double_t fOldRunNumber; //! Old Run Number
75d8233f 156
157 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
158 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
159 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
160 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
161
162 Int_t fCurrentChannel; //! current channel processed
163 Int_t fCurrentSector; //! current sector processed
164 Int_t fCurrentRow; //! current row processed
165 Float_t fMaxPadSignal; //! maximum bin of current pad
166 Int_t fMaxTimeBin; //! time bin with maximum value
167 TVectorF fPadSignal; //! signal of current Pad
168 Float_t fPadPedestal; //! Pedestal Value of current pad
169 Float_t fPadNoise; //! Noise Value of current pad
170
171 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
172 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
bf57d87d 173 TVectorD fVMeanQ; //! Mean Q for each sector;
174 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
75d8233f 175 //debugging
3cd27a08 176// Int_t fEvent;
75d8233f 177 TTreeSRedirector *fDebugStreamer; //! debug streamer
178
3cd27a08 179 Short_t fDebugLevel; // debug level
75d8233f 180 //! debugging
181
182 void FindPedestal(Float_t part=.6);
183 void FindCESignal(TVectorD &param, Float_t &qSum, const TVectorF maxima);
184 void FindLocalMaxima(TVectorF &maxima);
3cd27a08 185 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
75d8233f 186
187 TH2S* GetHisto(Int_t sector, TObjArray *arr,
188 Int_t nbinsY, Float_t ymin, Float_t ymax,
189 Char_t *type, Bool_t force);
190 TH1S* GetHisto(Int_t sector, TObjArray *arr,
191 Char_t *type, Bool_t force);
192
3cd27a08 193 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
75d8233f 194
3cd27a08 195 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
75d8233f 196 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
197
3cd27a08 198 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
75d8233f 199
200 void ResetEvent();
201 void ResetPad();
202 void ProcessPad();
203 void EndEvent();
204
205
206 //debug
75d8233f 207 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
208 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
209 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
210
9c754ce7 211 ClassDef(AliTPCCalibCE,3) //Implementation of the TPC Central Electrode calibration
7fb602b1 212
75d8233f 213};
214
215
216
217#endif
218