]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Base/AliTPCdataQA.h
o add Reset function to CalPad and CalROC o Add functionality to AliTPCdataQA - Reset...
[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 #include <TBits.h>
7 #include <TH1F.h>
8 #include <TProfile.h>
9 #include <TProfile2D.h>
10 #include "AliRecoParam.h"
11
12 #include <TArray.h>
13
14 class TH2F;
15 class TTreeSRedirector;
16 class AliTPCROC;
17 class AliTPCCalROC;
18 class AliTPCRawStreamV3;
19 class AliRawReader;
20 class AliTPCAltroMapping;
21 class AliTPCCalPad;
22 class TMap;
23 class TObjArray;
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   void SetMinQMax               (Float_t minQmax  ) { fMinQMax                = minQmax; }
50   void SetRequireNeighbouringPad(Bool_t  req=kTRUE) { fRequireNeighbouringPad = req;     }
51   
52   // DQM methods
53   void FillOccupancyProfile();
54   void ResetProfiles();
55
56
57   AliTPCCalPad *GetNoThreshold() const { return fNoThreshold;}
58   AliTPCCalPad *GetMaxCharge() const { return fMaxCharge;}
59   AliTPCCalPad *GetMeanCharge() const { return fMeanCharge;}
60   AliTPCCalPad *GetNLocalMaxima() const { return fNLocalMaxima;}
61   AliTPCCalPad *GetOverThreshold10() const { return fOverThreshold10;}
62   AliTPCCalPad *GetOverThreshold20() const { return fOverThreshold20;}
63   AliTPCCalPad *GetOverThreshold30() const { return fOverThreshold30;}
64   AliTPCCalPad *GetNTimeBins() const { return fNTimeBins;}
65   AliTPCCalPad *GetNPads() const { return fNPads;}
66   AliTPCCalPad *GetTimePosition() const { return fTimePosition;}
67   TProfile* GetHistQVsTimeSideA()    const {return fHistQVsTimeSideA;}
68   TProfile* GetHistQVsTimeSideC()    const {return fHistQVsTimeSideC;}
69   TProfile* GetHistQMaxVsTimeSideA() const {return fHistQMaxVsTimeSideA;}
70   TProfile* GetHistQMaxVsTimeSideC() const {return fHistQMaxVsTimeSideC;}
71   TH1F*     GetHistOccupancyVsEventConst() const {return fHistOccupancyVsEvent;}
72   TH1F*     GetHistNclustersVsEventConst() const {return fHistNclustersVsEvent;}
73   TH1F*     GetHistOccupancyVsEvent();
74   TH1F*     GetHistNclustersVsEvent();
75
76   // DQM output
77   TProfile* GetHistOccVsSector()  const { return fHistOccVsSector; }
78   TProfile2D* GetHistOcc2dVsSector() const { return fHistOcc2dVsSector; }
79   TProfile* GetHistQVsSector()    const { return fHistQVsSector; }
80   TProfile* GetHistQmaxVsSector() const { return fHistQmaxVsSector; }
81
82   //
83   AliTPCAltroMapping **GetAltroMapping() const { return fMapping; };
84   void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
85   //
86   //
87   Int_t  GetFirstTimeBin() const { return fFirstTimeBin; }
88   Int_t  GetLastTimeBin()  const { return fLastTimeBin;  }
89   Int_t  GetAdcMin()       const { return fAdcMin;       }
90   Int_t  GetAdcMax()       const { return fAdcMax;       }
91   Int_t  GetEventCounter() const { return fEventCounter; }
92   Bool_t GetIsAnalysed()   const { return fIsAnalysed;   }
93   Int_t  GetMaxEvents()      const { return fMaxEvents;     }
94   Int_t  GetEventsPerBin()   const { return fEventsPerBin;  }
95   Int_t  GetSignalCounter()  const { return fSignalCounter; }
96   Int_t  GetClusterCounter() const { return fClusterCounter;}
97
98   Float_t GetMinQMax()                const { return fMinQMax;                }
99   Bool_t  GetRequireNeighbouringPad() const { return fRequireNeighbouringPad; }
100   
101   // DQM getter
102   Bool_t    GetIsDQM() const { return fIsDQM; }
103
104   void  SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax;}  // Set time bin range that is used for the pedestal calibration
105   void  SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range for the pedestal calibration
106   void  SetMaxEvents   (Int_t value) { fMaxEvents = value; }
107   void  SetEventsPerBin(Int_t value) { fEventsPerBin = value; }
108   
109   // DQM setter
110   void  SetIsDQM(Bool_t value) { fIsDQM = value; }
111
112   void ResetData();
113
114   void SetChamberStatus(UInt_t roc, Bool_t status) { fActiveChambers.SetBitNumber(roc,status); }
115   Bool_t GetChamberStatus(UInt_t roc) {return fActiveChambers.TestBitNumber(roc);}
116 private:
117   Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad,
118                const Int_t iTimeBin, Float_t signal,
119                const Int_t iPatch=-1, const Int_t iBranch=-1);
120   void  FindLocalMaxima(const Int_t iSector);
121
122   void MakeArrays();                // Create arrays for random data acces
123   void CleanArrays();               // Clean arrays for random data acces
124   void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, 
125                       const Float_t signal); // Fill arrays with signals
126   void GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin); // Get pad and time bin corresponding to the 1d bin
127   Float_t GetQ(const Float_t* adcArray, const Int_t time,
128                const Int_t pad, const Int_t maxTimeBins, 
129                Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax) const;
130   void UpdateEventHistograms();
131
132   void Init();
133
134   TObjArray *ConfigArrRocs(TObjArray *arr, const Text_t* name);
135
136   Int_t fFirstTimeBin;              //  First Time bin needed for analysis
137   Int_t fLastTimeBin;               //  Last Time bin needed for analysis
138   Int_t fAdcMin;                    //  min adc channel of pedestal value
139   Int_t fAdcMax;                    //  max adc channel of pedestal value
140   Float_t fMinQMax;                 //  Minimun charge for Maximum ADC in cluster
141   Bool_t fRequireNeighbouringPad;   //  If clusterer should require a neighbouring pad to accept it
142   
143
144   AliTPCAltroMapping **fMapping;    //! Altro Mapping object
145   //
146   //
147   AliTPCCalPad * fPedestal;         //! option to set pedestal cal object
148   AliTPCCalPad * fNoise;            //! option to set noise cal object
149   AliTPCCalPad * fNLocalMaxima;     // local maximas found
150   AliTPCCalPad * fMaxCharge;        // max charge
151   AliTPCCalPad * fMeanCharge;       // mean charge
152   AliTPCCalPad * fNoThreshold;      // number of digits
153   AliTPCCalPad * fNTimeBins;        // timebins width of cluster
154   AliTPCCalPad * fNPads;            // pads with of cluster
155   AliTPCCalPad * fTimePosition;     // Time position of local maximum
156   AliTPCCalPad * fOverThreshold10;  //! local maxima with qMax over threshold
157   AliTPCCalPad * fOverThreshold20;  //! local maxima with qMax over threshold
158   AliTPCCalPad * fOverThreshold30;  //! local maxima with qMax over threshold
159
160   TProfile* fHistQVsTimeSideA;      // Q vs time (side A)
161   TProfile* fHistQVsTimeSideC;      // Q vs time (side C)
162   TProfile* fHistQMaxVsTimeSideA;   // QMax vs time (side A)
163   TProfile* fHistQMaxVsTimeSideC;   // QMax vs time (side C)
164
165   TH1F* fHistOccupancyVsEvent;      // Occupancy vs event number (~time)
166   TH1F* fHistNclustersVsEvent;      // Nclusters vs event number (~time)
167
168   Int_t   fEventCounter;            // event Counter
169   Bool_t  fIsAnalysed;              // Set to true after Analyse has been called
170
171   Int_t fMaxEvents;                 // Max events for event histograms
172   Int_t fEventsPerBin;              // Events per bin for event histograms
173   Int_t fSignalCounter;             // Signal counter
174   Int_t fClusterCounter;            // Cluster counter
175
176   TBits fActiveChambers;           // configured ROCs
177
178   //
179   //  Expand buffer
180   //
181   Float_t** fAllBins;              //! array for digit using random access
182   Int_t**   fAllSigBins;           //! array of pointers to the indexes over threshold
183   Int_t*    fAllNSigBins;          //! 
184   Int_t fRowsMax;                  //!  Maximum number of time bins
185   Int_t fPadsMax;                  //!  Maximum number of time bins
186   Int_t fTimeBinsMax;              //!  Maximum number of time bins
187
188   // DQM variables
189   Bool_t fIsDQM;                   //!  Is DQM -> Simple output (no 2D!)
190   TProfile* fHistOccVsSector;      //!  Occ vs sector (for DQM only)
191   TProfile2D* fHistOcc2dVsSector;  //!  Occ vs sector 2D (for DQM only)
192   TProfile* fHistQVsSector;        //!  Q vs sector (for DQM only)
193   TProfile* fHistQmaxVsSector;     //!  QMax vs sector (for DQM only)
194   TArrayD* fOccVec;                //!  Occupancy help counter for DQM
195   TArrayD* fOccMaxVec;             //!  Occupancy help normlization for DQM
196   TArrayD* fOccVecFine;            //!  "2D" occupancy help counter for DQM
197   TArrayD* fOccMaxVecFine;         //!  "2D" occupancy help normlization for DQM
198   
199
200   ClassDef(AliTPCdataQA, 6)  // Implementation of the TPC Raw QA
201 };
202
203
204
205 #endif
206