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