]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibPulser.h
Updating READMEgeometry:
[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  SetIsZeroSuppressed(Bool_t zs=kTRUE){ fIsZeroSuppressed=zs;}
78
79     void  SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
80     void  SetOutliers(AliTPCCalPad *outliers)  {fOutliers = outliers;}
81
82     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
83     Int_t GetLastTimeBin()    const { return fLastTimeBin;   }
84
85     Bool_t GetIsZeroSupperssed() const { return fIsZeroSuppressed; }
86
87     void Merge(AliTPCCalibPulser *sig);
88
89     void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
90     //
91     // Test functions
92     TObjArray* TestBinning();
93
94 private:
95     Int_t fFirstTimeBin;              //  First Time bin needed for analysis
96     Int_t fLastTimeBin;               //  Last Time bin needed for analysis
97
98     // reference histogram ranges
99     Int_t   fNbinsT0;                 //  Number of bins for T0 reference histogram
100     Float_t fXminT0;                  //  xmin   of T0 reference histogram
101     Float_t fXmaxT0;                  //  xmax   of T0 reference histogram
102     Int_t   fNbinsQ;                  //  Number of bins for T0 reference histogram
103     Float_t fXminQ;                   //  xmin   of T0 reference histogram
104     Float_t fXmaxQ;                   //  xmax   of T0 reference histogram
105     Int_t   fNbinsRMS;                //  Number of bins for T0 reference histogram
106     Float_t fXminRMS;                 //  xmin   of T0 reference histogram
107     Float_t fXmaxRMS;                 //  xmax   of T0 reference histogram
108
109     Bool_t  fIsZeroSuppressed;        //  if data is zero suppressed
110
111     Int_t     fLastSector;            //! Last sector processed
112
113
114     AliTPCROC   *fROC;                //! ROC information  
115     AliTPCAltroMapping **fMapping;    //! Altro Mapping object
116     AliTPCParam *fParam;              //! TPC information
117
118     AliTPCCalPad *fPedestalTPC;       //! Pedestal Information
119     AliTPCCalPad *fPadNoiseTPC;       //! Pad noise Information whole TPC
120     AliTPCCalPad *fOutliers;          //! Outlier information. Those will not be used for calculating the T0
121     AliTPCCalROC *fPedestalROC;       //! Pedestal Information for current ROC
122     AliTPCCalROC *fPadNoiseROC;       //! Pad noise Information for current ROC
123 //    Bool_t fBpedestal;                //! are we running with pedestal substraction
124
125
126     TObjArray fCalRocArrayT0;         //  Array of AliTPCCalROC class for Time0 calibration
127     TObjArray fCalRocArrayQ;          //  Array of AliTPCCalROC class for Charge calibration
128     TObjArray fCalRocArrayRMS;        //  Array of AliTPCCalROC class for signal width calibration
129     TObjArray fCalRocArrayOutliers;  //  Array of AliTPCCalROC class for signal outliers
130
131     TObjArray fHistoQArray;           //  Calibration histograms for Charge distribution
132     TObjArray fHistoT0Array;          //  Calibration histograms for Time0  distribution
133     TObjArray fHistoRMSArray;         //  Calibration histograms for signal width distribution
134
135     TObjArray fPadTimesArrayEvent;    //! Pad Times for the event, before mean Time0 corrections
136     TObjArray fPadQArrayEvent;        //! Charge for the event, only needed for debugging streamer
137     TObjArray fPadRMSArrayEvent;      //! Signal width for the event, only needed for debugging streamer
138     TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
139
140     Int_t     fCurrentChannel;         //! current channel processed
141     Int_t     fCurrentSector;          //! current sector processed
142     Int_t     fCurrentRow;             //! current row processed
143     Float_t   fMaxPadSignal;           //! maximum bin of current pad
144     Int_t     fMaxTimeBin;             //! time bin with maximum value
145     TVectorF  fPadSignal;              //! signal of current Pad
146     Float_t   fPadPedestal;            //! Pedestal Value of current pad
147     Float_t   fPadNoise;               //! Noise Value of current pad
148
149     TVectorF  fVTime0Offset;          //!  Time0 Offset from preprocessing for each sector;
150     TVectorF  fVTime0OffsetCounter;   //!  Time0 Offset from preprocessing for each sector;
151
152     //debugging
153 //    Int_t fEvent;                      //  Number of events processed
154     TTreeSRedirector *fDebugStreamer;  //! debug streamer
155
156     Short_t fDebugLevel;               //  debug Level
157     //! debugging
158
159     void   FindPedestal(Float_t part=.6);
160     void FindPulserSignal(TVectorD &param, Float_t &qSum);
161
162     TH2S* GetHisto(Int_t sector, TObjArray *arr,
163                    Int_t nbinsY, Float_t ymin, Float_t ymax,
164                    Char_t *type, Bool_t force);
165
166
167     AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
168
169     TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
170
171     void ResetEvent();
172     void ResetPad();
173     void ProcessPad();
174     void EndEvent();
175
176
177     //debug
178     TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
179     TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
180     TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
181     TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
182
183
184   ClassDef(AliTPCCalibPulser,3)           //Implementation of the TPC pulser calibration
185 };
186
187
188
189 #endif
190