]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCdataQA.h
Effective C++ + add RMS and MEAN to the analysis
[u/mrichter/AliRoot.git] / TPC / AliTPCdataQA.h
1 #ifndef ALITPCDATAQA_H
2 #define ALITPCDATAQA_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 #include <TH1F.h>
9 #include <TObjArray.h>
10
11 class TArrayF;
12 class TH2F;
13 class TTreeSRedirector;
14 class AliTPCROC;
15 class AliTPCCalROC;
16 class AliTPCRawStream;
17 class AliTPCRawStreamFast;
18 class AliRawReader;
19 class AliTPCAltroMapping;
20 class AliTPCCalPad; 
21 struct eventHeaderStruct;
22
23 class AliTPCdataQA : public TH1F {
24
25 public:
26   AliTPCdataQA();
27   AliTPCdataQA(const AliTPCdataQA &ped);
28   virtual ~AliTPCdataQA();
29
30   AliTPCdataQA& operator = (const  AliTPCdataQA &source);
31  void  DumpToFile(const Char_t *filename, const Char_t *dir="", const Bool_t append=kFALSE);
32  void MakeTree(const char *fname="QApad.root");
33
34   //
35   Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
36   Bool_t ProcessEventFast(AliRawReader        *rawReader);
37   Bool_t ProcessEvent(AliTPCRawStream *rawStream);
38   Bool_t ProcessEvent(AliRawReader    *rawReader);
39   Bool_t ProcessEvent(eventHeaderStruct   *event);
40
41   void   Analyse();
42   //
43   //
44   void SetPedestal(AliTPCCalPad *pedestalCal){ fPedestal = pedestalCal;}
45   void SetNoise(AliTPCCalPad *noiseCal){ fNoise = noiseCal;}
46
47   AliTPCCalPad *GetNoThreshold() const { return fNoThreshold;}
48   AliTPCCalPad *GetMaxCharge() const { return fMaxCharge;}
49   AliTPCCalPad *GetMeanCharge() const { return fMeanCharge;}
50   AliTPCCalPad *GetNLocalMaxima() const { return fNLocalMaxima;}
51   AliTPCCalPad *GetOverThreshold10() const { return fOverThreshold10;}
52   AliTPCCalPad *GetOverThreshold20() const { return fOverThreshold20;}
53   AliTPCCalPad *GetOverThreshold30() const { return fOverThreshold30;}
54   AliTPCCalPad *GetNTimeBins() const { return fNTimeBins;}
55   AliTPCCalPad *GetNPads() const { return fNPads;}
56   AliTPCCalPad *GetTimePosition() const { return fTimePosition;}
57
58   //
59   AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
60   void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
61   //
62   //
63   Int_t  GetFirstTimeBin() const { return fFirstTimeBin; }
64   Int_t  GetLastTimeBin()  const { return fLastTimeBin;  }
65   Int_t  GetAdcMin()       const { return fAdcMin;       }
66   Int_t  GetAdcMax()       const { return fAdcMax;       }
67   Int_t  GetEventCounter() const { return fEventCounter; }
68   Bool_t GetOldRCUformat() const { return fOldRCUformat;   }
69   Bool_t GetIsAnalysed()   const { return fIsAnalysed;   }
70   void  SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax;}  // Set time bin range that is used for the pedestal calibration
71   void  SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range for the pedestal calibration
72
73   void  SetOldRCUformat(Bool_t format=kTRUE) { fOldRCUformat = format; }
74
75
76 private:
77   Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad,
78                const Int_t iTimeBin, Float_t signal);
79   void  FindLocalMaxima(const Int_t iSector);
80
81   void MakeArrays();                // Create arrays for random data acces
82   void CleanArrays();               // Clean arrays for random data acces
83   void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, 
84                       const Float_t signal); // Fill arrays with signals
85   void GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin); // Get pad and time bin corresponding to the 1d bin
86   Float_t GetQ(const Float_t* adcArray, const Int_t time,
87                const Int_t pad, const Int_t maxTimeBins, 
88                Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax);
89
90   Int_t fFirstTimeBin;              //  First Time bin needed for analysis
91   Int_t fLastTimeBin;               //  Last Time bin needed for analysis
92   Int_t fAdcMin;                    //  min adc channel of pedestal value
93   Int_t fAdcMax;                    //  max adc channel of pedestal value
94   Bool_t  fOldRCUformat;            //! Should we use the old RCU format for data reading
95
96   AliTPCAltroMapping **fMapping;    //! Altro Mapping object
97   //
98   //
99   AliTPCCalPad * fPedestal;         //! option to set pedestal cal object
100   AliTPCCalPad * fNoise;            //! option to set noise cal object
101   AliTPCCalPad * fNLocalMaxima;     // local maximas found
102   AliTPCCalPad * fMaxCharge;        // max charge
103   AliTPCCalPad * fMeanCharge;       // mean charge
104   AliTPCCalPad * fNoThreshold;      // number of digits
105   AliTPCCalPad * fNTimeBins;        // timebins width of cluster
106   AliTPCCalPad * fNPads;            // pads with of cluster
107   AliTPCCalPad * fTimePosition;     // Time position of local maximum
108   AliTPCCalPad * fOverThreshold10;  //! local maxima with qMax over threshold
109   AliTPCCalPad * fOverThreshold20;  //! local maxima with qMax over threshold
110   AliTPCCalPad * fOverThreshold30;  //! local maxima with qMax over threshold
111
112   Int_t   fEventCounter;            // event Counter
113   Bool_t  fIsAnalysed;              // Set to true after Analyse has been called
114   //
115   //  Expand buffer
116   //
117   Float_t** fAllBins;              //! array for digit using random access
118   Int_t**   fAllSigBins;           //! array of pointers to the indexes over threshold
119   Int_t*    fAllNSigBins;          //! 
120   Int_t fRowsMax;                  //!  Maximum number of time bins
121   Int_t fPadsMax;                  //!  Maximum number of time bins
122   Int_t fTimeBinsMax;              //!  Maximum number of time bins
123
124
125 public:
126   ClassDef(AliTPCdataQA, 2)  // Implementation of the TPC pedestal and noise calibration
127 };
128
129
130
131 #endif
132