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 ////////////////////////////////////////////////////////////////////////////////////////
17 class TTreeSRedirector;
23 class AliTPCRawStream;
24 class AliTPCRawStreamFast;
26 class AliTPCAltroMapping;
28 struct eventHeaderStruct;
30 class AliTPCCalibCE : public TObject {
34 AliTPCCalibCE(const AliTPCCalibCE &sig);
35 virtual ~AliTPCCalibCE();
37 AliTPCCalibCE& operator = (const AliTPCCalibCE &source);
39 Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
40 Bool_t ProcessEventFast(AliRawReader *rawReader);
43 Bool_t ProcessEvent(AliTPCRawStream *rawStream);
44 Bool_t ProcessEvent(AliRawReader *rawReader);
45 Bool_t ProcessEvent(eventHeaderStruct *event);
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);
51 AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
52 void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
55 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
56 AliTPCCalROC* GetCalRocT0Err(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
57 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
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
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
65 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
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
71 const Float_t GetMeanT0rms() {return fMeanT0rms;}
72 const Float_t GetMeanQrms() {return fMeanQrms;}
73 const Float_t GetMeanRMSrms() {return fMeanRMSrms;}
75 TH1S* GetHistoTmean(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
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);
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);
86 TVectorD* GetEventTimes() { return &fVEventTime; }
87 TVectorD* GetEventIds() { return &fVEventNumber; }
89 Short_t GetDebugLevel() const { return fDebugLevel; }
91 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
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
97 void SetTimeStampEvent(Double_t timestamp){ fTimeStamp = timestamp; }
98 void SetRunNumber(Double_t eventnumber){ fRunNumber = eventnumber; }
100 void SetEventInfo(Double_t runNumber, Double_t timestamp, Double_t eventId){ fRunNumber=runNumber; fTimeStamp=timestamp; fEventId=eventId;}
102 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
104 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
106 Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
107 Int_t GetLastTimeBin() const { return fLastTimeBin; }
109 Int_t GetNeventsProcessed() const { return fNevents; }
111 void Merge(AliTPCCalibCE *ce);
113 TGraph *MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0);
115 void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
118 Int_t fFirstTimeBin; // First Time bin needed for analysis
119 Int_t fLastTimeBin; // Last Time bin needed for analysis
121 // reference histogram ranges
122 Int_t fNbinsT0; // Number of bins for T0 reference histogram
123 Float_t fXminT0; // xmin of T0 reference histogram
124 Float_t fXmaxT0; // xmax of T0 reference histogram
125 Int_t fNbinsQ; // Number of bins for T0 reference histogram
126 Float_t fXminQ; // xmin of T0 reference histogram
127 Float_t fXmaxQ; // xmax of T0 reference histogram
128 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
129 Float_t fXminRMS; // xmin of T0 reference histogram
130 Float_t fXmaxRMS; // xmax of T0 reference histogram
132 Int_t fLastSector; //! Last sector processed
135 AliTPCROC *fROC; //! ROC information
136 AliTPCAltroMapping **fMapping; //! Altro Mapping object
137 AliTPCParam *fParam; //! TPC information
139 AliTPCCalPad *fPedestalTPC; //! Pedestal Information whole TPC
140 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
141 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
142 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
144 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
145 TObjArray fCalRocArrayT0Err; // Array of AliTPCCalROC class for the error (rms) of Time0 calibration
146 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
147 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
148 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
150 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
151 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
152 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
154 Float_t fMeanT0rms; // mean of the rms of all pad T0 fits, used as error estimation of T0 results
155 Float_t fMeanQrms; // mean of the rms of all pad Q fits, used as error estimation of Q results
156 Float_t fMeanRMSrms; // mean of the rms of all pad TMS fits, used as error estimation of RMS results
158 TObjArray fHistoTmean; //! Calibration histograms of the mean CE position for all sectors
160 TObjArray fParamArrayEventPol1; // Store mean arrival time parameters for each sector event by event from global plane fit
161 TObjArray fParamArrayEventPol2; // Store mean arrival time parameters for each sector event by event from global parabola fit
162 TObjArray fTMeanArrayEvent; // Store mean arrival time for each sector event by event
163 TObjArray fQMeanArrayEvent; // Store mean arrival Charge for each sector event by event
164 TVectorD fVEventTime; // Timestamps of the events
165 TVectorD fVEventNumber; // Eventnumbers of the events
166 // TVectorD fVTime0Side[2]; // Mean Time0 for each side for all events
167 Int_t fNevents; // Event counter
168 Double_t fTimeStamp; //! Timestamp of the current event
169 Double_t fEventId; //! Event Id of the current event
170 Double_t fRunNumber; //! Run Number of the current event
171 Double_t fOldRunNumber; //! Old Run Number
173 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
174 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
175 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
176 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
178 Int_t fCurrentChannel; //! current channel processed
179 Int_t fCurrentSector; //! current sector processed
180 Int_t fCurrentRow; //! current row processed
181 Float_t fMaxPadSignal; //! maximum bin of current pad
182 Int_t fMaxTimeBin; //! time bin with maximum value
183 TVectorF fPadSignal; //! signal of current Pad
184 Float_t fPadPedestal; //! Pedestal Value of current pad
185 Float_t fPadNoise; //! Noise Value of current pad
187 TVectorD fVTime0Offset; //! Time0 Offset for each sector;
188 TVectorD fVTime0OffsetCounter; //! Time0 Offset counter for each sector;
189 TVectorD fVMeanQ; //! Mean Q for each sector;
190 TVectorD fVMeanQCounter; //! Mean Q counter for each sector;
194 TTreeSRedirector *fDebugStreamer; //! debug streamer
196 Short_t fDebugLevel; // debug level
199 void FindPedestal(Float_t part=.6);
200 void FindCESignal(TVectorD ¶m, Float_t &qSum, const TVectorF maxima);
201 void FindLocalMaxima(TVectorF &maxima);
202 Bool_t IsPeak(Int_t pos, Int_t tminus, Int_t tplus) const;
204 TH2S* GetHisto(Int_t sector, TObjArray *arr,
205 Int_t nbinsY, Float_t ymin, Float_t ymax,
206 Char_t *type, Bool_t force);
207 TH1S* GetHisto(Int_t sector, TObjArray *arr,
208 Char_t *type, Bool_t force);
210 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
212 TVectorF* GetVectSector(Int_t sector, TObjArray *arr, UInt_t size, Bool_t force=kFALSE) const;
213 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
215 TObjArray* GetParamArray(Int_t sector, TObjArray *arr, Bool_t force=kFALSE) const;
224 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
225 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
226 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
228 ClassDef(AliTPCCalibCE,6) //Implementation of the TPC Central Electrode calibration