]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibPulser.h
Correct character constantness
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibPulser.h
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
6 /////////////////////////////////////////////////////////////////////////////////////////
7 //                                                                                     //
8 //                  Implementation of the TPC pulser calibration                       //
9 //                                                                                     //
10 /////////////////////////////////////////////////////////////////////////////////////////
11
12 #include <TVectorT.h>
13 #include <TObject.h>
14 #include <TObjArray.h>
15 class TH2S;
16 class TH2F;
17 class TTreeSRedirector;
18 class AliTPCCalPad;
19 class AliTPCROC;
20 class AliTPCCalROC;
21 class AliTPCParam;
22 class AliRawReader;
23 class AliTPCRawStream;
24 class AliTPCRawStreamFast;
25 class AliTPCAltroMapping;
26 class TMap;
27
28 struct eventHeaderStruct;
29
30 class AliTPCCalibPulser : public TObject {
31
32 public:
33     AliTPCCalibPulser();
34     AliTPCCalibPulser(const AliTPCCalibPulser &sig);
35     AliTPCCalibPulser(const TMap *config);
36     virtual ~AliTPCCalibPulser();
37
38     void Reset();
39
40     AliTPCCalibPulser& operator = (const  AliTPCCalibPulser &source);
41
42     Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
43     Bool_t ProcessEventFast(AliRawReader            *rawReader);
44
45
46     Bool_t ProcessEvent(AliTPCRawStream *rawStream);
47     Bool_t ProcessEvent(AliRawReader    *rawReader);
48     Bool_t ProcessEvent(eventHeaderStruct   *event);
49
50     Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
51                const Int_t iTimeBin, const Float_t signal);
52     void Analyse();
53      //
54     AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
55     void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
56     //
57     AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
58     AliTPCCalROC* GetCalRocQ  (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
59     AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
60     AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
61
62     const TObjArray* GetCalPadT0()  const { return &fCalRocArrayT0; }      // 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
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
71     TH2F* GetHistoTSec();                                        // mean abs time distribution histogram
72
73     Float_t GetMeanTimeSector(Int_t sector) const {return fVMeanTimeSector[sector];}
74     const TVectorF* GetMeanTimeSectorArray() const {return &fVMeanTimeSector;}
75
76     Short_t GetDebugLevel()     const { return fDebugLevel;    }
77     //
78     void  SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin;   fLastTimeBin=lastTimeBin;  } //Set range in which the pulser signal is expected
79     //
80     void  SetRangeRefQ  (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ   = nBins; fXminQ   = xMin; fXmaxQ   = xMax; }   //Set range for Q reference histograms
81     void  SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0  = nBins; fXminT0  = xMin; fXmaxT0  = xMax; }   //Set range for T0 reference histograms
82     void  SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; }   //Set range for T0 reference histograms
83
84     void  SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
85
86     void  SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;}
87
88     void  SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
89     void  SetOutliers(AliTPCCalPad *outliers)  {fOutliers = outliers;}
90
91     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
92     Int_t GetLastTimeBin()    const { return fLastTimeBin;   }
93
94     Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; }
95
96     void Merge(AliTPCCalibPulser *sig);
97
98     void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
99     //
100     // Test functions
101     TObjArray* TestBinning();
102
103 private:
104     Int_t fFirstTimeBin;              //  First Time bin needed for analysis
105     Int_t fLastTimeBin;               //  Last Time bin needed for analysis
106
107     // reference histogram ranges
108     Int_t   fNbinsT0;                 //  Number of bins for T0 reference histogram
109     Float_t fXminT0;                  //  xmin   of T0 reference histogram
110     Float_t fXmaxT0;                  //  xmax   of T0 reference histogram
111     Int_t   fNbinsQ;                  //  Number of bins for T0 reference histogram
112     Float_t fXminQ;                   //  xmin   of T0 reference histogram
113     Float_t fXmaxQ;                   //  xmax   of T0 reference histogram
114     Int_t   fNbinsRMS;                //  Number of bins for T0 reference histogram
115     Float_t fXminRMS;                 //  xmin   of T0 reference histogram
116     Float_t fXmaxRMS;                 //  xmax   of T0 reference histogram
117
118     Bool_t  fIsZeroSuppressed;        //  if data is zero suppressed
119
120     Int_t     fLastSector;            //! Last sector processed
121
122
123     AliTPCROC   *fROC;                //! ROC information  
124     AliTPCAltroMapping **fMapping;    //! Altro Mapping object
125     AliTPCParam *fParam;              //! TPC information
126
127     AliTPCCalPad *fPedestalTPC;       //! Pedestal Information
128     AliTPCCalPad *fPadNoiseTPC;       //! Pad noise Information whole TPC
129     AliTPCCalPad *fOutliers;          //! Outlier information. Those will not be used for calculating the T0
130     AliTPCCalROC *fPedestalROC;       //! Pedestal Information for current ROC
131     AliTPCCalROC *fPadNoiseROC;       //! Pad noise Information for current ROC
132 //    Bool_t fBpedestal;                //! are we running with pedestal substraction
133
134
135     TObjArray fCalRocArrayT0;         //  Array of AliTPCCalROC class for Time0 calibration
136     TObjArray fCalRocArrayQ;          //  Array of AliTPCCalROC class for Charge calibration
137     TObjArray fCalRocArrayRMS;        //  Array of AliTPCCalROC class for signal width calibration
138     TObjArray fCalRocArrayOutliers;  //  Array of AliTPCCalROC class for signal outliers
139
140     TObjArray fHistoQArray;           //  Calibration histograms for Charge distribution
141     TObjArray fHistoT0Array;          //  Calibration histograms for Time0  distribution
142     TObjArray fHistoRMSArray;         //  Calibration histograms for signal width distribution
143
144     TH2F *fHMeanTimeSector;           //  Timing distribution per sector
145     TVectorF  fVMeanTimeSector;       //  Mean time per sector from analysis of fHMeanTimeSector
146
147     TObjArray fPadTimesArrayEvent;    //! Pad Times for the event, before mean Time0 corrections
148     TObjArray fPadQArrayEvent;        //! Charge for the event, only needed for debugging streamer
149     TObjArray fPadRMSArrayEvent;      //! Signal width for the event, only needed for debugging streamer
150     TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
151
152     Int_t     fCurrentChannel;         //! current channel processed
153     Int_t     fCurrentSector;          //! current sector processed
154     Int_t     fCurrentRow;             //! current row processed
155     Int_t     fCurrentPad;             //! current pad processed
156     Float_t   fMaxPadSignal;           //! maximum bin of current pad
157     Int_t     fMaxTimeBin;             //! time bin with maximum value
158     TVectorF  fPadSignal;              //! signal of current Pad
159     Float_t   fPadPedestal;            //! Pedestal Value of current pad
160     Float_t   fPadNoise;               //! Noise Value of current pad
161
162     TVectorF  fVTime0Offset;          //!  Time0 Offset from preprocessing for each sector;
163     TVectorF  fVTime0OffsetCounter;   //!  Time0 Offset from preprocessing for each sector;
164
165
166     //debugging
167 //    Int_t fEvent;                      //  Number of events processed
168     TTreeSRedirector *fDebugStreamer;  //! debug streamer
169
170     Short_t fDebugLevel;               //  debug Level
171     //! debugging
172
173     void   FindPedestal(Float_t part=.6);
174     void FindPulserSignal(TVectorD &param, Float_t &qSum);
175
176     TH2S* GetHisto(Int_t sector, TObjArray *arr,
177                    Int_t nbinsY, Float_t ymin, Float_t ymax,
178                    const Char_t *type, Bool_t force);
179
180
181     AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
182
183     TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
184
185     Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad);
186
187     void ResetEvent();
188     void ResetPad();
189     void ProcessPad();
190     void EndEvent();
191
192
193     //debug
194     TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
195     TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
196     TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
197     TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
198
199
200
201   ClassDef(AliTPCCalibPulser,4)           //Implementation of the TPC pulser calibration
202 };
203
204
205
206 #endif
207