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