]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSCalibrationDB.cxx
Interface simplified
[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 "AliPHOSCalibrManager.h"
30 #include "AliPHOSCalibrationDB.h"
31 ClassImp(AliPHOSCalibrationDB)
32
33
34 //____________________________________________________________________________ 
35   AliPHOSCalibrationDB::AliPHOSCalibrationDB():TNamed() 
36 {
37 }
38 //____________________________________________________________________________ 
39 AliPHOSCalibrationDB::AliPHOSCalibrationDB(const char * database):
40   TNamed("AliPHOSCalibrationDB",database),fPedestals("Pedestals"),fGains("Gains"){
41
42
43 //____________________________________________________________________________ 
44   AliPHOSCalibrationDB::~AliPHOSCalibrationDB()
45 {
46 }
47 //____________________________________________________________________________ 
48 Float_t AliPHOSCalibrationDB::Calibrate(Int_t amp, Int_t absId)const 
49 {
50   //if absID is known, return calibrated energy, else - zero
51   Float_t ret = (amp - fPedestals.Data(absId))*fGains.Data(absId); 
52   if(ret > 0)
53     return ret ;
54   else
55     return 0.0000001 ; //Should not be zero - to avoid FPE
56 }
57 //____________________________________________________________________________
58 void AliPHOSCalibrationDB::GetParameters(void){
59   //In this method we read calibration parameters using AliPHOSCalibrManager
60   //This manager should be configured to read from correct source.
61
62   AliPHOSCalibrManager * man = AliPHOSCalibrManager::GetInstance() ;
63   if(!man){
64     Error("GetParameters","AliPHOSCalibrManager not instanciated") ;
65     return ;
66   }
67
68   man->GetParameters(fPedestals) ;
69   man->GetParameters(fGains) ;
70   
71 }
72 //____________________________________________________________________________
73 AliPHOSCalibrationDB& AliPHOSCalibrationDB::operator=(AliPHOSCalibrationDB const & cdb)
74 {
75   //
76   fPedestals=cdb.fPedestals ;
77   fGains = cdb.fGains;
78   return *this ;
79 }