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