]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCdataQA.h
-fiorellas update
[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 <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 AliTPCRawStream;
20 class AliTPCRawStreamV3;
21 class AliRawReader;
22 class AliTPCAltroMapping;
23 class AliTPCCalPad;
24 class TMap; 
25 struct eventHeaderStruct;
26
27 class AliTPCdataQA : public TH1F {
28
29 public:
30   AliTPCdataQA();
31   AliTPCdataQA(const AliTPCdataQA &ped);
32   AliTPCdataQA(const TMap *config);
33   virtual ~AliTPCdataQA();
34
35   AliTPCdataQA& operator = (const  AliTPCdataQA &source);
36  void  DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
37  void MakeTree(const char *fname="QApad.root") const;
38
39   //
40   Bool_t ProcessEvent(AliTPCRawStream *const rawStream);
41   Bool_t ProcessEvent(AliTPCRawStreamV3 *const rawStreamV3);
42   Bool_t ProcessEvent(AliRawReader    *const rawReader);
43   Bool_t ProcessEventOld(AliRawReader    *const rawReader);
44   Bool_t ProcessEvent(eventHeaderStruct   *const event);
45
46   void   Analyse();
47   //
48   //
49   void SetPedestal(AliTPCCalPad *const pedestalCal){ fPedestal = pedestalCal;}
50   void SetNoise(AliTPCCalPad *const noiseCal){ fNoise = noiseCal;}
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   // DQM getter
99   Bool_t    GetIsDQM() const { return fIsDQM; }
100
101   void  SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax;}  // Set time bin range that is used for the pedestal calibration
102   void  SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range for the pedestal calibration
103   void  SetMaxEvents   (Int_t value) { fMaxEvents = value; }
104   void  SetEventsPerBin(Int_t value) { fEventsPerBin = value; }
105   
106   // DQM setter
107   void  SetIsDQM(Bool_t value) { fIsDQM = value; }
108
109 private:
110   Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad,
111                const Int_t iTimeBin, Float_t signal,
112                const Int_t iPatch=-1, const Int_t iBranch=-1);
113   void  FindLocalMaxima(const Int_t iSector);
114
115   void MakeArrays();                // Create arrays for random data acces
116   void CleanArrays();               // Clean arrays for random data acces
117   void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, 
118                       const Float_t signal); // Fill arrays with signals
119   void GetPadAndTimeBin(Int_t bin, Int_t& iPad, Int_t& iTimeBin); // Get pad and time bin corresponding to the 1d bin
120   Float_t GetQ(const Float_t* adcArray, const Int_t time,
121                const Int_t pad, const Int_t maxTimeBins, 
122                Int_t& timeMin,Int_t& timeMax,Int_t& padMin,Int_t& padMax) const;
123   void UpdateEventHistograms();
124
125   Int_t fFirstTimeBin;              //  First Time bin needed for analysis
126   Int_t fLastTimeBin;               //  Last Time bin needed for analysis
127   Int_t fAdcMin;                    //  min adc channel of pedestal value
128   Int_t fAdcMax;                    //  max adc channel of pedestal value
129
130   AliTPCAltroMapping **fMapping;    //! Altro Mapping object
131   //
132   //
133   AliTPCCalPad * fPedestal;         //! option to set pedestal cal object
134   AliTPCCalPad * fNoise;            //! option to set noise cal object
135   AliTPCCalPad * fNLocalMaxima;     // local maximas found
136   AliTPCCalPad * fMaxCharge;        // max charge
137   AliTPCCalPad * fMeanCharge;       // mean charge
138   AliTPCCalPad * fNoThreshold;      // number of digits
139   AliTPCCalPad * fNTimeBins;        // timebins width of cluster
140   AliTPCCalPad * fNPads;            // pads with of cluster
141   AliTPCCalPad * fTimePosition;     // Time position of local maximum
142   AliTPCCalPad * fOverThreshold10;  //! local maxima with qMax over threshold
143   AliTPCCalPad * fOverThreshold20;  //! local maxima with qMax over threshold
144   AliTPCCalPad * fOverThreshold30;  //! local maxima with qMax over threshold
145
146   TProfile* fHistQVsTimeSideA;      // Q vs time (side A)
147   TProfile* fHistQVsTimeSideC;      // Q vs time (side C)
148   TProfile* fHistQMaxVsTimeSideA;   // QMax vs time (side A)
149   TProfile* fHistQMaxVsTimeSideC;   // QMax vs time (side C)
150
151   TH1F* fHistOccupancyVsEvent;      // Occupancy vs event number (~time)
152   TH1F* fHistNclustersVsEvent;      // Nclusters vs event number (~time)
153
154   Int_t   fEventCounter;            // event Counter
155   Bool_t  fIsAnalysed;              // Set to true after Analyse has been called
156
157   Int_t fMaxEvents;                 // Max events for event histograms
158   Int_t fEventsPerBin;              // Events per bin for event histograms
159   Int_t fSignalCounter;             // Signal counter
160   Int_t fClusterCounter;            // Cluster counter
161   //
162   //  Expand buffer
163   //
164   Float_t** fAllBins;              //! array for digit using random access
165   Int_t**   fAllSigBins;           //! array of pointers to the indexes over threshold
166   Int_t*    fAllNSigBins;          //! 
167   Int_t fRowsMax;                  //!  Maximum number of time bins
168   Int_t fPadsMax;                  //!  Maximum number of time bins
169   Int_t fTimeBinsMax;              //!  Maximum number of time bins
170
171   // DQM variables
172   Bool_t fIsDQM;                   //!  Is DQM -> Simple output (no 2D!)
173   TProfile* fHistOccVsSector;      //!  Occ vs sector (for DQM only)
174   TProfile2D* fHistOcc2dVsSector;  //!  Occ vs sector 2D (for DQM only)
175   TProfile* fHistQVsSector;        //!  Q vs sector (for DQM only)
176   TProfile* fHistQmaxVsSector;     //!  QMax vs sector (for DQM only)
177   TArrayD* fOccVec;                //!  Occupancy help counter for DQM
178   TArrayD* fOccMaxVec;             //!  Occupancy help normlization for DQM
179   TArrayD* fOccVecFine;            //!  "2D" occupancy help counter for DQM
180   TArrayD* fOccMaxVecFine;         //!  "2D" occupancy help normlization for DQM
181   
182
183   ClassDef(AliTPCdataQA, 5)  // Implementation of the TPC Raw QA
184 };
185
186
187
188 #endif
189