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