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