]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibPulser.h
The angular correction calibration (Marian)
[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 class TObjArray;
14 class TH2S;
15 class TTreeSRedirector;
16 class AliTPCCalPad;
17 class AliTPCROC;
18 class AliTPCCalROC;
19 class AliTPCParam;
20 class AliRawReader;
21 class AliTPCRawStream;
22 class AliTPCRawStreamFast;
23 struct eventHeaderStruct;
24
25 class AliTPCCalibPulser : public TObject {
26
27 public:
28     AliTPCCalibPulser();
29     AliTPCCalibPulser(const AliTPCCalibPulser &sig);
30     virtual ~AliTPCCalibPulser();
31
32     AliTPCCalibPulser& operator = (const  AliTPCCalibPulser &source);
33
34     Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
35     Bool_t ProcessEventFast(AliRawReader            *rawReader);
36
37
38     Bool_t ProcessEvent(AliTPCRawStream *rawStream);
39     Bool_t ProcessEvent(AliRawReader    *rawReader);
40     Bool_t ProcessEvent(eventHeaderStruct   *event);
41
42     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     void Analyse();
45     //
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     Short_t GetDebugLevel()     const { return fDebugLevel;    }
61     //
62     void  SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin;   fLastTimeBin=lastTimeBin;  } //Set range in which the pulser signal is expected
63     //
64     void  SetRangeRefQ  (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ   = nBins; fXminQ   = xMin; fXmaxQ   = xMax; }   //Set range for Q reference histograms
65     void  SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0  = nBins; fXminT0  = xMin; fXmaxT0  = xMax; }   //Set range for T0 reference histograms
66     void  SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; }   //Set range for T0 reference histograms
67
68     void  SetOldRCUformat(Bool_t format=kTRUE){ fOldRCUformat = format; }
69
70     void  SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
71
72     void  SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
73
74     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
75     Int_t GetLastTimeBin()    const { return fLastTimeBin;   }
76
77     void Merge(AliTPCCalibPulser *sig);
78
79     void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
80     //
81     // Test functions
82     TObjArray* TestBinning();
83
84 private:
85     Int_t fFirstTimeBin;              //  First Time bin needed for analysis
86     Int_t fLastTimeBin;               //  Last Time bin needed for analysis
87
88     // reference histogram ranges
89     Int_t   fNbinsT0;                 //  Number of bins for T0 reference histogram
90     Float_t fXminT0;                  //  xmin   of T0 reference histogram
91     Float_t fXmaxT0;                  //  xmax   of T0 reference histogram
92     Int_t   fNbinsQ;                  //  Number of bins for T0 reference histogram
93     Float_t fXminQ;                   //  xmin   of T0 reference histogram
94     Float_t fXmaxQ;                   //  xmax   of T0 reference histogram
95     Int_t   fNbinsRMS;                //  Number of bins for T0 reference histogram
96     Float_t fXminRMS;                 //  xmin   of T0 reference histogram
97     Float_t fXmaxRMS;                 //  xmax   of T0 reference histogram
98
99     Int_t     fLastSector;            //! Last sector processed
100
101     Bool_t  fOldRCUformat;            //! Should we use the old RCU format for data reading
102
103     AliTPCROC   *fROC;                //! ROC information
104     AliTPCParam *fParam;              //! TPC information
105
106     AliTPCCalPad *fPedestalTPC;       //! Pedestal Information
107     AliTPCCalPad *fPadNoiseTPC;       //! Pad noise Information whole TPC
108     AliTPCCalROC *fPedestalROC;       //! Pedestal Information for current ROC
109     AliTPCCalROC *fPadNoiseROC;       //! Pad noise Information for current ROC
110 //    Bool_t fBpedestal;                //! are we running with pedestal substraction
111
112
113     TObjArray fCalRocArrayT0;         //  Array of AliTPCCalROC class for Time0 calibration
114     TObjArray fCalRocArrayQ;          //  Array of AliTPCCalROC class for Charge calibration
115     TObjArray fCalRocArrayRMS;        //  Array of AliTPCCalROC class for signal width calibration
116     TObjArray fCalRocArrayOutliers;  //  Array of AliTPCCalROC class for signal outliers
117
118     TObjArray fHistoQArray;           //  Calibration histograms for Charge distribution
119     TObjArray fHistoT0Array;          //  Calibration histograms for Time0  distribution
120     TObjArray fHistoRMSArray;         //  Calibration histograms for signal width distribution
121
122     TObjArray fPadTimesArrayEvent;    //! Pad Times for the event, before mean Time0 corrections
123     TObjArray fPadQArrayEvent;        //! Charge for the event, only needed for debugging streamer
124     TObjArray fPadRMSArrayEvent;      //! Signal width for the event, only needed for debugging streamer
125     TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
126
127     Int_t     fCurrentChannel;         //! current channel processed
128     Int_t     fCurrentSector;          //! current sector processed
129     Int_t     fCurrentRow;             //! current row processed
130     Float_t   fMaxPadSignal;           //! maximum bin of current pad
131     Int_t     fMaxTimeBin;             //! time bin with maximum value
132     TVectorF  fPadSignal;              //! signal of current Pad
133     Float_t   fPadPedestal;            //! Pedestal Value of current pad
134     Float_t   fPadNoise;               //! Noise Value of current pad
135
136     TVectorF  fVTime0Offset;          //!  Time0 Offset from preprocessing for each sector;
137     TVectorF  fVTime0OffsetCounter;   //!  Time0 Offset from preprocessing for each sector;
138
139     //debugging
140 //    Int_t fEvent;                      //  Number of events processed
141     TTreeSRedirector *fDebugStreamer;  //! debug streamer
142
143     Short_t fDebugLevel;               //  debug Level
144     //! debugging
145
146     void   FindPedestal(Float_t part=.6);
147     void FindPulserSignal(TVectorD &param, Float_t &qSum);
148
149     TH2S* GetHisto(Int_t sector, TObjArray *arr,
150                    Int_t nbinsY, Float_t ymin, Float_t ymax,
151                    Char_t *type, Bool_t force);
152
153
154     AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
155
156     TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
157
158     void ResetEvent();
159     void ResetPad();
160     void ProcessPad();
161     void EndEvent();
162
163
164     //debug
165     TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
166     TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
167     TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
168     TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
169
170
171   ClassDef(AliTPCCalibPulser,1)           //Implementation of the TPC pulser calibration
172 };
173
174
175
176 #endif
177