]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Base/AliTPCdataQA.h
Adding possibility to calculate the 3D distortion maps
[u/mrichter/AliRoot.git] / TPC / Base / 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 <TProfile.h>
10 #include <TProfile2D.h>
11 #include "AliRecoParam.h"
12
13 #include <TArray.h>
14
15 class TH2F;
16 class TTreeSRedirector;
17 class AliTPCROC;
18 class AliTPCCalROC;
19 class AliTPCRawStreamV3;
20 class AliRawReader;
21 class AliTPCAltroMapping;
22 class AliTPCCalPad;
23 class TMap; 
24 struct eventHeaderStruct;
25
26 class AliTPCdataQA : public TH1F {
27
28 public:
29   AliTPCdataQA();
30   AliTPCdataQA(const AliTPCdataQA &ped);
31   AliTPCdataQA(const TMap *config);
32   virtual ~AliTPCdataQA();
33
34   AliTPCdataQA& operator = (const  AliTPCdataQA &source);
35  void  DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
36  void MakeTree(const char *fname="QApad.root") const;
37
38   //
39   Bool_t ProcessEvent(AliTPCRawStreamV3 *const rawStreamV3);
40   Bool_t ProcessEvent(AliRawReader    *const rawReader);
41   Bool_t ProcessEvent(eventHeaderStruct   *const event);
42
43   void   Analyse();
44   //
45   //
46   void SetPedestal(AliTPCCalPad *const pedestalCal){ fPedestal = pedestalCal;}
47   void SetNoise(AliTPCCalPad *const noiseCal){ fNoise = noiseCal;}
48
49   // DQM methods
50   void FillOccupancyProfile();
51   void ResetProfiles();
52
53
54   AliTPCCalPad *GetNoThreshold() const { return fNoThreshold;}
55   AliTPCCalPad *GetMaxCharge() const { return fMaxCharge;}
56   AliTPCCalPad *GetMeanCharge() const { return fMeanCharge;}
57   AliTPCCalPad *GetNLocalMaxima() const { return fNLocalMaxima;}
58   AliTPCCalPad *GetOverThreshold10() const { return fOverThreshold10;}
59   AliTPCCalPad *GetOverThreshold20() const { return fOverThreshold20;}
60   AliTPCCalPad *GetOverThreshold30() const { return fOverThreshold30;}
61   AliTPCCalPad *GetNTimeBins() const { return fNTimeBins;}
62   AliTPCCalPad *GetNPads() const { return fNPads;}
63   AliTPCCalPad *GetTimePosition() const { return fTimePosition;}
64   TProfile* GetHistQVsTimeSideA()    const {return fHistQVsTimeSideA;}
65   TProfile* GetHistQVsTimeSideC()    const {return fHistQVsTimeSideC;}
66   TProfile* GetHistQMaxVsTimeSideA() const {return fHistQMaxVsTimeSideA;}
67   TProfile* GetHistQMaxVsTimeSideC() const {return fHistQMaxVsTimeSideC;}
68   TH1F*     GetHistOccupancyVsEventConst() const {return fHistOccupancyVsEvent;}
69   TH1F*     GetHistNclustersVsEventConst() const {return fHistNclustersVsEvent;}
70   TH1F*     GetHistOccupancyVsEvent();
71   TH1F*     GetHistNclustersVsEvent();
72
73   // DQM output
74   TProfile* GetHistOccVsSector()  const { return fHistOccVsSector; }
75   TProfile2D* GetHistOcc2dVsSector() const { return fHistOcc2dVsSector; }
76   TProfile* GetHistQVsSector()    const { return fHistQVsSector; }
77   TProfile* GetHistQmaxVsSector() const { return fHistQmaxVsSector; }
78
79   //
80   AliTPCAltroMapping **GetAltroMapping() const { return fMapping; };
81   void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
82   //
83   //
84   Int_t  GetFirstTimeBin() const { return fFirstTimeBin; }
85   Int_t  GetLastTimeBin()  const { return fLastTimeBin;  }
86   Int_t  GetAdcMin()       const { return fAdcMin;       }
87   Int_t  GetAdcMax()       const { return fAdcMax;       }
88   Int_t  GetEventCounter() const { return fEventCounter; }
89   Bool_t GetIsAnalysed()   const { return fIsAnalysed;   }
90   Int_t  GetMaxEvents()      const { return fMaxEvents;     }
91   Int_t  GetEventsPerBin()   const { return fEventsPerBin;  }
92   Int_t  GetSignalCounter()  const { return fSignalCounter; }
93   Int_t  GetClusterCounter() const { return fClusterCounter;}
94
95   // DQM getter
96   Bool_t    GetIsDQM() const { return fIsDQM; }
97
98   void  SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax;}  // Set time bin range that is used for the pedestal calibration
99   void  SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range for the pedestal calibration
100   void  SetMaxEvents   (Int_t value) { fMaxEvents = value; }
101   void  SetEventsPerBin(Int_t value) { fEventsPerBin = value; }
102   
103   // DQM setter
104   void  SetIsDQM(Bool_t value) { fIsDQM = value; }
105
106 private:
107   Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad,
108                const Int_t iTimeBin, Float_t signal,
109                const Int_t iPatch=-1, const Int_t iBranch=-1);
110   void  FindLocalMaxima(const Int_t iSector);
111
112   void MakeArrays();                // Create arrays for random data acces
113   void CleanArrays();               // Clean arrays for random data acces
114   void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, 
115                       const Float_t signal); // Fill arrays with signals
116   void GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin); // Get pad and time bin corresponding to the 1d bin
117   Float_t GetQ(const Float_t* adcArray, const Int_t time,
118                const Int_t pad, const Int_t maxTimeBins, 
119                Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax) const;
120   void UpdateEventHistograms();
121
122   Int_t fFirstTimeBin;              //  First Time bin needed for analysis
123   Int_t fLastTimeBin;               //  Last Time bin needed for analysis
124   Int_t fAdcMin;                    //  min adc channel of pedestal value
125   Int_t fAdcMax;                    //  max adc channel of pedestal value
126
127   AliTPCAltroMapping **fMapping;    //! Altro Mapping object
128   //
129   //
130   AliTPCCalPad * fPedestal;         //! option to set pedestal cal object
131   AliTPCCalPad * fNoise;            //! option to set noise cal object
132   AliTPCCalPad * fNLocalMaxima;     // local maximas found
133   AliTPCCalPad * fMaxCharge;        // max charge
134   AliTPCCalPad * fMeanCharge;       // mean charge
135   AliTPCCalPad * fNoThreshold;      // number of digits
136   AliTPCCalPad * fNTimeBins;        // timebins width of cluster
137   AliTPCCalPad * fNPads;            // pads with of cluster
138   AliTPCCalPad * fTimePosition;     // Time position of local maximum
139   AliTPCCalPad * fOverThreshold10;  //! local maxima with qMax over threshold
140   AliTPCCalPad * fOverThreshold20;  //! local maxima with qMax over threshold
141   AliTPCCalPad * fOverThreshold30;  //! local maxima with qMax over threshold
142
143   TProfile* fHistQVsTimeSideA;      // Q vs time (side A)
144   TProfile* fHistQVsTimeSideC;      // Q vs time (side C)
145   TProfile* fHistQMaxVsTimeSideA;   // QMax vs time (side A)
146   TProfile* fHistQMaxVsTimeSideC;   // QMax vs time (side C)
147
148   TH1F* fHistOccupancyVsEvent;      // Occupancy vs event number (~time)
149   TH1F* fHistNclustersVsEvent;      // Nclusters vs event number (~time)
150
151   Int_t   fEventCounter;            // event Counter
152   Bool_t  fIsAnalysed;              // Set to true after Analyse has been called
153
154   Int_t fMaxEvents;                 // Max events for event histograms
155   Int_t fEventsPerBin;              // Events per bin for event histograms
156   Int_t fSignalCounter;             // Signal counter
157   Int_t fClusterCounter;            // Cluster counter
158   //
159   //  Expand buffer
160   //
161   Float_t** fAllBins;              //! array for digit using random access
162   Int_t**   fAllSigBins;           //! array of pointers to the indexes over threshold
163   Int_t*    fAllNSigBins;          //! 
164   Int_t fRowsMax;                  //!  Maximum number of time bins
165   Int_t fPadsMax;                  //!  Maximum number of time bins
166   Int_t fTimeBinsMax;              //!  Maximum number of time bins
167
168   // DQM variables
169   Bool_t fIsDQM;                   //!  Is DQM -> Simple output (no 2D!)
170   TProfile* fHistOccVsSector;      //!  Occ vs sector (for DQM only)
171   TProfile2D* fHistOcc2dVsSector;  //!  Occ vs sector 2D (for DQM only)
172   TProfile* fHistQVsSector;        //!  Q vs sector (for DQM only)
173   TProfile* fHistQmaxVsSector;     //!  QMax vs sector (for DQM only)
174   TArrayD* fOccVec;                //!  Occupancy help counter for DQM
175   TArrayD* fOccMaxVec;             //!  Occupancy help normlization for DQM
176   TArrayD* fOccVecFine;            //!  "2D" occupancy help counter for DQM
177   TArrayD* fOccMaxVecFine;         //!  "2D" occupancy help normlization for DQM
178   
179
180   ClassDef(AliTPCdataQA, 5)  // Implementation of the TPC Raw QA
181 };
182
183
184
185 #endif
186