]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSCalibrator.h
Allowing coding conventions to be checked
[u/mrichter/AliRoot.git] / PHOS / AliPHOSCalibrator.h
1 #ifndef ALIPHOSCALIBRATOR_H
2 #define ALIPHOSCALIBRATOR_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 //  Class for performing calibration in PHOS     
9 //                  
10 //*-- Author: D.Peressounko (RRC KI & SUBATECH)
11
12
13 // --- ROOT system ---
14 #include "TTask.h"
15 #include "TObjArray.h"
16 #include "TH1F.h"  
17
18 // --- Standard library ---
19
20 // --- AliRoot header files ---
21 class AliPHOSConTableDB ;
22 class AliPHOSDigit ;
23
24 class AliPHOSCalibrator: public TTask{
25
26 public:
27   AliPHOSCalibrator() ;          // ctor
28   AliPHOSCalibrator(const char* run, const char * title = "Default") ;
29   AliPHOSCalibrator(const AliPHOSCalibrator & ctor) : TTask(ctor) {
30     // cpy ctor: no implementation yet
31     // requested by the Coding Convention
32     Fatal("cpy ctor", "not implemented") ;
33   }
34  
35   virtual ~AliPHOSCalibrator() ; // dtor
36
37   void AddRun(const char * filename) ; //Add one more file to handle
38
39   virtual void Exec(Option_t * option) ; //Steering method 
40
41   void ScanPedestals(Option_t * option = "append") ;
42   void CalculatePedestals(void) ; //calulates pedestals
43   void ScanGains(Option_t * opt = "append") ; //calculates gains
44   void CalculateGains(void) ; //calculates gains
45
46   void PlotPedestal(Int_t channel) ; //plots distribution of pedestals for given channel
47   void PlotPedestals(void) ;
48   void PlotGain(Int_t channel) ; //Plot histo with gains for a channel
49   void PlotGains() ;             //Plot all gains
50
51   virtual void Print() const ;
52
53   TH1F * PedestalHisto(Int_t channel)
54     {return dynamic_cast<TH1F* >(fPedHistos->At(channel)) ;} ;
55   TH1F * GainHisto(Int_t channel)
56     {return dynamic_cast<TH1F* >(fGainHistos->At(channel)) ;} ;
57
58   
59   TH1F * Pedestals(void){return fhPedestals ;}
60   TH1F * Gains(void){return fhGains ;}
61
62   void SetPedestalPattern(UShort_t pattern = 257)
63     {fPedPat = pattern ;} ;   //Sets trigger pattern for PEDESTAL events
64   void SetPulserPattern(UShort_t pattern = 33)
65     {fPulPat = pattern ;} ;   //Sets trigger pattern for PULSER events
66   void SetLEDPattern(UShort_t pattern = 129)
67     {fLEDPat = pattern ;} ;   //Sets trigger pattern for LED events
68   void SetWideBeamPattern(UShort_t pattern = 1027)
69     {fWBPat = pattern ;} ;    //Sets trigger pattern for WIDE BEAM events
70   void SetNarrowBeamPattern(UShort_t pattern = 1029)
71     {fNBPat = pattern ;} ;    //Sets trigger pattern for NARROW BEAM events
72
73   void SetConTableDB(const char * filename, const char * title = "Default") ;
74        //Connection table to convert RawId to AbsId
75
76   void SetNChan(UShort_t nch = 100)
77     {fNChan = nch ; }         //Sets number of channels in pedestal histos
78
79   void SetNGainBins(Int_t nbin = 100)
80     {fNGainBins = nbin ;}  //Set number of bins in gain histograms
81
82   void SetGainMax(Float_t hmax = 0.01)
83     {fGainMax = hmax ;}    //Set range of gain histograms
84
85   void WritePedestals(const char * version="v1",
86                       Int_t begValidRange = 0,
87                       Int_t endValidRange = 0) ;
88
89   void ReadPedestals(const char * version="v1",
90                      Int_t ValidRange = 0) ;
91                       
92   void WriteGains(const char * version="v1",
93                       Int_t begValidRange = 0,
94                       Int_t endValidRange = 0) ;
95
96   void ReadGains(const char * version="v1",
97                      Int_t ValidRange = 0) ;
98
99   AliPHOSCalibrator & operator = (const AliPHOSCalibrator & /*rvalue*/){
100     Fatal("operator =","assigment operator is not implemented") ;
101     return *this ;
102  }
103
104
105
106 private:
107   void Init() ;
108  
109 private:
110   TList  * fRunList ;          //list of runs to be handled
111   TObjArray * fPedHistos ;     //Resulting histograms of pedestals
112   TObjArray * fGainHistos;     //Results of Calibration 
113
114   TH1F *   fhPedestals ;      //Mean values of pedestals for different channels
115   TH1F *   fhPedestalsWid ;   //Widths of pedestal distributions for different channels
116   TH1F *   fhGains ;          //Final Gains from fitting procedure
117   TH1F *   fhGainsWid ;       //Width of final gains from fit
118
119   AliPHOSConTableDB * fctdb ; //!Connection map
120   TString  fConTableDB ;      //Name of ConTableDB
121   TString  fConTableDBFile ;  //File where ConTableDB is stored
122
123   Float_t  fGainAcceptCorr;   //Maximal deviation from mean Gain (factor)
124   Float_t  fAcceptCorr ;      //Maximal deviation of Pedestal from mean for good channel
125
126   Float_t  fGainMax ;         //Range used in Gain histos
127   Int_t    fNGainBins ;       //Number of bins in Gain histos
128
129   Int_t    fNch ;             //Number of channels to calibrate
130   UShort_t fNChan ;           //Number of bins in pedestal histos
131
132   UShort_t fPedPat ;     //trigger pattern for PEDESTAL events
133   UShort_t fPulPat ;     //trigger pattern for PULSER events
134   UShort_t fLEDPat ;     //trigger pattern for LED events
135   UShort_t fWBPat ;      //trigger pattern for WIDE BEAM events
136   UShort_t fNBPat ;      //trigger pattern for NARROW BEAM events
137
138   ClassDef(AliPHOSCalibrator,1)  // description 
139
140 };
141
142 #endif // AliPHOSCALIBRATOR_H