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