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