Update TPCCEda to write output file in parts (to avoid too big files produced in...
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibPulser.h
CommitLineData
467a4b25 1#ifndef ALITPCCALIBPULSER_H
2#define ALITPCCALIBPULSER_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 pulser calibration //
9// //
10/////////////////////////////////////////////////////////////////////////////////////////
e47beb2b 11
3cd27a08 12#include <TVectorT.h>
880c3382 13#include "AliTPCCalibRawBase.h"
3fe25c38 14#include <TObjArray.h>
467a4b25 15class TH2S;
ac940b58 16class TH2F;
467a4b25 17class TTreeSRedirector;
18class AliTPCCalPad;
19class AliTPCROC;
20class AliTPCCalROC;
21class AliTPCParam;
22class AliRawReader;
23class AliTPCRawStream;
08205ed7 24class AliTPCRawStreamFast;
ac940b58 25class TMap;
04049c81 26
467a4b25 27struct eventHeaderStruct;
28
880c3382 29class AliTPCCalibPulser : public AliTPCCalibRawBase {
467a4b25 30
31public:
880c3382 32 AliTPCCalibPulser();
33 AliTPCCalibPulser(const AliTPCCalibPulser &sig);
34 AliTPCCalibPulser(const TMap *config);
35 virtual ~AliTPCCalibPulser();
36
37 void Reset();
38
39 AliTPCCalibPulser& operator = (const AliTPCCalibPulser &source);
40
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();
04049c81 45 //
880c3382 46 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
47 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
48 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
49 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
50
51 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object
52 const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object
53 const TObjArray* GetCalPadRMS() const{ return &fCalRocArrayRMS;} // get calibration object
54 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
55
56 TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
57 TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
58 TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
59
60 TH2F* GetHistoTSec(); // mean abs time distribution histogram
61
62 Float_t GetMeanTimeSector(Int_t sector) const {return fVMeanTimeSector[sector];}
63 const TVectorF* GetMeanTimeSectorArray() const {return &fVMeanTimeSector;}
64
65 Short_t GetDebugLevel() const { return fDebugLevel; }
467a4b25 66 //
880c3382 67 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
467a4b25 68 //
880c3382 69 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
70 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
71 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
72 void SetRangePeakIntegral(Int_t minus, Int_t plus) { fPeakIntMinus=minus; fPeakIntPlus=plus;}
73
74 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
75
76 void SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;}
77
7442bceb 78 void SetPedestalDatabase(AliTPCCalPad * const pedestalTPC, AliTPCCalPad * const padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
79 void SetOutliers(AliTPCCalPad * const outliers) {fOutliers = outliers;}
880c3382 80
81 Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; }
82
83 Float_t GetPeakIntegralMinus() const {return fPeakIntMinus;}
84 Float_t GetPeakIntegralPlus() const {return fPeakIntPlus;}
85
7442bceb 86 void Merge(AliTPCCalibPulser * const sig);
87 virtual Long64_t Merge(TCollection * const list);
88
880c3382 89 //
90 // Test functions
91 TObjArray* TestBinning();
92
7442bceb 93protected:
94 virtual void ResetEvent();
95 virtual void EndEvent();
96
467a4b25 97private:
467a4b25 98 // reference histogram ranges
880c3382 99 Int_t fNbinsT0; // Number of bins for T0 reference histogram
100 Float_t fXminT0; // xmin of T0 reference histogram
101 Float_t fXmaxT0; // xmax of T0 reference histogram
102 Int_t fNbinsQ; // Number of bins for T0 reference histogram
103 Float_t fXminQ; // xmin of T0 reference histogram
104 Float_t fXmaxQ; // xmax of T0 reference histogram
105 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
106 Float_t fXminRMS; // xmin of T0 reference histogram
107 Float_t fXmaxRMS; // xmax of T0 reference histogram
108 Int_t fPeakIntMinus; // Peak integral range for COG determination. Bins used before max bin
109 Int_t fPeakIntPlus; // Peak integral range for COG determination. Bins used after max bin
110
111 Bool_t fIsZeroSuppressed; // if data is zero suppressed
112
113 Int_t fLastSector; //! Last sector processed
114
115 AliTPCParam *fParam; //! TPC information
116
117 AliTPCCalPad *fPedestalTPC; //! Pedestal Information
118 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
119 AliTPCCalPad *fOutliers; //! Outlier information. Those will not be used for calculating the T0
120 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
121 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
122
123 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
124 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
125 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
126 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
127
128 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
129 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
130 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
131
132 TH2F *fHMeanTimeSector; // Timing distribution per sector
133 TVectorF fVMeanTimeSector; // Mean time per sector from analysis of fHMeanTimeSector
134
135 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
136 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
137 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
138 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
139
140 Int_t fCurrentChannel; //! current channel processed
141 Int_t fCurrentSector; //! current sector processed
142 Int_t fCurrentRow; //! current row processed
143 Int_t fCurrentPad; //! current pad processed
144 Float_t fMaxPadSignal; //! maximum bin of current pad
145 Int_t fMaxTimeBin; //! time bin with maximum value
146 TVectorF fPadSignal; //! signal of current Pad
147 Float_t fPadPedestal; //! Pedestal Value of current pad
148 Float_t fPadNoise; //! Noise Value of current pad
149
150 TVectorF fVTime0Offset; //! Time0 Offset from preprocessing for each sector;
151 TVectorF fVTime0OffsetCounter; //! Time0 Offset from preprocessing for each sector;
152
153
154 void FindPedestal(Float_t part=.6);
155 void FindPulserSignal(TVectorD &param, Float_t &qSum);
156
157 TH2S* GetHisto(Int_t sector, TObjArray *arr,
158 Int_t nbinsY, Float_t ymin, Float_t ymax,
159 const Char_t *type, Bool_t force);
160
161
162 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
163
164 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
165
166 Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad);
167
880c3382 168 void ResetPad();
169 void ProcessPad();
170
171
172 //debug
173 TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
174 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
175 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
176 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
c3066940 177
880c3382 178
179 ClassDef(AliTPCCalibPulser,5) //Implementation of the TPC pulser calibration
467a4b25 180};
181
182
183
184#endif
185