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