]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSCalibrationDB.cxx
Detector name is hard-coded in ctor (B.Polichtchouk)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSCalibrationDB.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //_________________________________________________________________________
19 // Short description  
20 //
21 //*-- Author :  D.Peressounko (RRC KI & SUBATECH) 
22 //////////////////////////////////////////////////////////////////////////////
23
24 // --- ROOT system ---
25
26 // --- Standard library ---
27
28 // --- AliRoot header files ---
29 #include "AliLog.h"  
30 #include "AliPHOSCalibrManager.h"
31 #include "AliPHOSCalibrationDB.h"
32 ClassImp(AliPHOSCalibrationDB)
33
34
35 //____________________________________________________________________________ 
36   AliPHOSCalibrationDB::AliPHOSCalibrationDB():fPedestals(), fGains()
37 {
38 }
39 //____________________________________________________________________________ 
40 AliPHOSCalibrationDB::AliPHOSCalibrationDB(const char * database):
41   TNamed("AliPHOSCalibrationDB",database),fPedestals("Pedestals"),fGains("Gains"){
42
43
44 //____________________________________________________________________________ 
45   AliPHOSCalibrationDB::~AliPHOSCalibrationDB()
46 {
47 }
48 //____________________________________________________________________________ 
49 Float_t AliPHOSCalibrationDB::Calibrate(Int_t amp, Int_t absId)const 
50 {
51   //if absID is known, return calibrated energy, else - zero
52   Float_t ret = (amp - fPedestals.Data(absId))*fGains.Data(absId); 
53   if(ret > 0)
54     return ret ;
55   else
56     return 0.0000001 ; //Should not be zero - to avoid FPE
57 }
58
59 //____________________________________________________________________________
60 void AliPHOSCalibrationDB::GetParameters(void){
61   //In this method we read calibration parameters using AliPHOSCalibrManager
62   //This manager should be configured to read from correct source.
63
64   AliPHOSCalibrManager * man = AliPHOSCalibrManager::GetInstance() ;
65   if(!man){
66     Error("GetParameters","AliPHOSCalibrManager not instanciated") ;
67     return ;
68   }
69
70
71   man->GetParameters(fPedestals) ;
72   man->GetParameters(fGains) ;
73 }
74
75 //____________________________________________________________________________
76 AliPHOSCalibrationDB& AliPHOSCalibrationDB::operator=(AliPHOSCalibrationDB const & cdb)
77 {
78   //
79   fPedestals=cdb.fPedestals ;
80   fGains = cdb.fGains;
81   return *this ;
82 }