]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSCalibrator.h
Compilation warnings fixed by T.P.
[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 /* $Id$ */
7
8 /* History of cvs commits:
9  *
10  * $Log$
11  */
12
13
14 //_________________________________________________________________________
15 //  Class for performing calibration in PHOS     
16 //                  
17 //*-- Author: D.Peressounko (RRC KI & SUBATECH)
18
19
20 // --- ROOT system ---
21 #include "TTask.h"
22 #include "TObjArray.h"
23 #include "TH1F.h"  
24
25 // --- Standard library ---
26
27 // --- AliRoot header files ---
28 class AliPHOSConTableDB ;
29 class AliPHOSDigit ;
30
31 class AliPHOSCalibrator: public TTask{
32
33 public:
34   AliPHOSCalibrator() ;          // ctor
35   AliPHOSCalibrator(const char* run, const char * title = "Default") ;
36   AliPHOSCalibrator(const AliPHOSCalibrator & ctor) : TTask(ctor) {
37     // cpy ctor: no implementation yet
38     // requested by the Coding Convention
39     Fatal("cpy ctor", "not implemented") ;
40   }
41  
42   virtual ~AliPHOSCalibrator() ; // dtor
43
44   void AddRun(const char * filename) ; //Add one more file to handle
45
46   virtual void Exec(Option_t * option) ; //Steering method 
47
48   void ScanPedestals(Option_t * option = "append") ;
49   void CalculatePedestals(void) ; //calulates pedestals
50   void ScanGains(Option_t * opt = "append") ; //calculates gains
51   void CalculateGains(void) ; //calculates gains
52
53   void PlotPedestal(Int_t channel) ; //plots distribution of pedestals for given channel
54   void PlotPedestals(void) ;
55   void PlotGain(Int_t channel) ; //Plot histo with gains for a channel
56   void PlotGains() ;             //Plot all gains
57
58   virtual void Print(const Option_t * = "") const ;
59
60   TH1F * PedestalHisto(Int_t channel)
61     {return dynamic_cast<TH1F* >(fPedHistos->At(channel)) ;} ;
62   TH1F * GainHisto(Int_t channel)
63     {return dynamic_cast<TH1F* >(fGainHistos->At(channel)) ;} ;
64
65   
66   TH1F * Pedestals(void){return fhPedestals ;}
67   TH1F * Gains(void){return fhGains ;}
68
69   //Clean resulting histograms
70   void Reset(void){if(fhPedestals)fhPedestals->Reset("ICE");
71                    if(fhGains)fhGains->Reset("ICE");}
72
73   //Set energy of beam used to calibrate
74   void SetBeamEnergy(Float_t e){fBeamEnergy = e;}
75
76   void SetConTableDB(const char * filename, const char * title = "Default") ;
77        //Connection table to convert RawId to AbsId
78
79   void SetNChan(UShort_t nch = 100)
80     {fNChan = nch ; }         //Sets number of channels in pedestal histos
81
82   void SetNGainBins(Int_t nbin = 100)
83     {fNGainBins = nbin ;}  //Set number of bins in gain histograms
84
85   void SetGainMax(Float_t hmax = 0.01)
86     {fGainMax = hmax ;}    //Set range of gain histograms
87
88   void ReadFromASCII(const char * filename) ; //Read gains and pedestals from ascii file
89
90   void WritePedestals(const char * version="v1") ;
91
92   void ReadPedestals(const char * version="v1") ;
93                       
94   void WriteGains(const char * version="v1") ;
95
96   void ReadGains(const char * version="v1") ;
97
98   AliPHOSCalibrator & operator = (const AliPHOSCalibrator & /*rvalue*/){
99     Fatal("operator =","assigment operator is not implemented") ;
100     return *this ;
101  }
102
103
104
105 private:
106   void Init() ;
107  
108 private:
109   TList  * fRunList ;          //list of runs to be handled
110   TObjArray * fPedHistos ;     //Resulting histograms of pedestals
111   TObjArray * fGainHistos;     //Results of Calibration 
112
113   TH1F *   fhPedestals ;      //Mean values of pedestals for different channels
114   TH1F *   fhPedestalsWid ;   //Widths of pedestal distributions for different channels
115   TH1F *   fhGains ;          //Final Gains from fitting procedure
116   TH1F *   fhGainsWid ;       //Width of final gains from fit
117
118   AliPHOSConTableDB * fctdb ; //!Connection map
119   TString  fConTableDB ;      //Name of ConTableDB
120   TString  fConTableDBFile ;  //File where ConTableDB is stored
121
122   Float_t  fBeamEnergy ;      //Calibration beam energy
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   ClassDef(AliPHOSCalibrator,1)  // description 
133
134 };
135
136 #endif // AliPHOSCALIBRATOR_H