]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibPulser.h
mixing example
[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 TTreeSRedirector;
17 class AliTPCCalPad;
18 class AliTPCROC;
19 class AliTPCCalROC;
20 class AliTPCParam;
21 class AliRawReader;
22 class AliTPCRawStream;
23 class AliTPCRawStreamFast;
24 class AliTPCAltroMapping;
25
26 struct eventHeaderStruct;
27
28 class AliTPCCalibPulser : public TObject {
29
30 public:
31     AliTPCCalibPulser();
32     AliTPCCalibPulser(const AliTPCCalibPulser &sig);
33     virtual ~AliTPCCalibPulser();
34
35     void Reset();
36
37     AliTPCCalibPulser& operator = (const  AliTPCCalibPulser &source);
38
39     Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
40     Bool_t ProcessEventFast(AliRawReader            *rawReader);
41
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();
50      //
51     AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
52     void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
53     //
54     AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
55     AliTPCCalROC* GetCalRocQ  (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
56     AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
57     AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
58
59     const TObjArray* GetCalPadT0()  const { return &fCalRocArrayT0; }      // get calibration object
60     const TObjArray* GetCalPadQ()   const { return &fCalRocArrayQ;  }      // get calibration object
61     const TObjArray* GetCalPadRMS() const{ return &fCalRocArrayRMS;}      // get calibration object
62     const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;}      // get calibration object
63
64     TH2S* GetHistoQ  (Int_t sector, Bool_t force=kFALSE);           // get refernce histogram
65     TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE);           // get refernce histogram
66     TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE);           // get refernce histogram
67
68     Short_t GetDebugLevel()     const { return fDebugLevel;    }
69     //
70     void  SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin;   fLastTimeBin=lastTimeBin;  } //Set range in which the pulser signal is expected
71     //
72     void  SetRangeRefQ  (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ   = nBins; fXminQ   = xMin; fXmaxQ   = xMax; }   //Set range for Q reference histograms
73     void  SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0  = nBins; fXminT0  = xMin; fXmaxT0  = xMax; }   //Set range for T0 reference histograms
74     void  SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; }   //Set range for T0 reference histograms
75
76     void  SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
77
78     void  SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;}
79
80     void  SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
81     void  SetOutliers(AliTPCCalPad *outliers)  {fOutliers = outliers;}
82
83     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
84     Int_t GetLastTimeBin()    const { return fLastTimeBin;   }
85
86     Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; }
87
88     void Merge(AliTPCCalibPulser *sig);
89
90     void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
91     //
92     // Test functions
93     TObjArray* TestBinning();
94
95 private:
96     Int_t fFirstTimeBin;              //  First Time bin needed for analysis
97     Int_t fLastTimeBin;               //  Last Time bin needed for analysis
98
99     // reference histogram ranges
100     Int_t   fNbinsT0;                 //  Number of bins for T0 reference histogram
101     Float_t fXminT0;                  //  xmin   of T0 reference histogram
102     Float_t fXmaxT0;                  //  xmax   of T0 reference histogram
103     Int_t   fNbinsQ;                  //  Number of bins for T0 reference histogram
104     Float_t fXminQ;                   //  xmin   of T0 reference histogram
105     Float_t fXmaxQ;                   //  xmax   of T0 reference histogram
106     Int_t   fNbinsRMS;                //  Number of bins for T0 reference histogram
107     Float_t fXminRMS;                 //  xmin   of T0 reference histogram
108     Float_t fXmaxRMS;                 //  xmax   of T0 reference histogram
109
110     Bool_t  fIsZeroSuppressed;        //  if data is zero suppressed
111
112     Int_t     fLastSector;            //! Last sector processed
113
114
115     AliTPCROC   *fROC;                //! ROC information  
116     AliTPCAltroMapping **fMapping;    //! Altro Mapping object
117     AliTPCParam *fParam;              //! TPC information
118
119     AliTPCCalPad *fPedestalTPC;       //! Pedestal Information
120     AliTPCCalPad *fPadNoiseTPC;       //! Pad noise Information whole TPC
121     AliTPCCalPad *fOutliers;          //! Outlier information. Those will not be used for calculating the T0
122     AliTPCCalROC *fPedestalROC;       //! Pedestal Information for current ROC
123     AliTPCCalROC *fPadNoiseROC;       //! Pad noise Information for current ROC
124 //    Bool_t fBpedestal;                //! are we running with pedestal substraction
125
126
127     TObjArray fCalRocArrayT0;         //  Array of AliTPCCalROC class for Time0 calibration
128     TObjArray fCalRocArrayQ;          //  Array of AliTPCCalROC class for Charge calibration
129     TObjArray fCalRocArrayRMS;        //  Array of AliTPCCalROC class for signal width calibration
130     TObjArray fCalRocArrayOutliers;  //  Array of AliTPCCalROC class for signal outliers
131
132     TObjArray fHistoQArray;           //  Calibration histograms for Charge distribution
133     TObjArray fHistoT0Array;          //  Calibration histograms for Time0  distribution
134     TObjArray fHistoRMSArray;         //  Calibration histograms for signal width distribution
135
136     TObjArray fPadTimesArrayEvent;    //! Pad Times for the event, before mean Time0 corrections
137     TObjArray fPadQArrayEvent;        //! Charge for the event, only needed for debugging streamer
138     TObjArray fPadRMSArrayEvent;      //! Signal width for the event, only needed for debugging streamer
139     TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
140
141     Int_t     fCurrentChannel;         //! current channel processed
142     Int_t     fCurrentSector;          //! current sector processed
143     Int_t     fCurrentRow;             //! current row 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     //debugging
154 //    Int_t fEvent;                      //  Number of events processed
155     TTreeSRedirector *fDebugStreamer;  //! debug streamer
156
157     Short_t fDebugLevel;               //  debug Level
158     //! debugging
159
160     void   FindPedestal(Float_t part=.6);
161     void FindPulserSignal(TVectorD &param, Float_t &qSum);
162
163     TH2S* GetHisto(Int_t sector, TObjArray *arr,
164                    Int_t nbinsY, Float_t ymin, Float_t ymax,
165                    Char_t *type, Bool_t force);
166
167
168     AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
169
170     TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
171
172     void ResetEvent();
173     void ResetPad();
174     void ProcessPad();
175     void EndEvent();
176
177
178     //debug
179     TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
180     TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
181     TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
182     TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
183
184
185   ClassDef(AliTPCCalibPulser,3)           //Implementation of the TPC pulser calibration
186 };
187
188
189
190 #endif
191