]>
Commit | Line | Data |
---|---|---|
f74edaba | 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 --- | |
e957fea8 | 25 | |
f74edaba | 26 | // --- Standard library --- |
f74edaba | 27 | |
28 | // --- AliRoot header files --- | |
6f06e050 | 29 | #include "AliLog.h" |
e4778e0c | 30 | #include "AliPHOSCalibrManager.h" |
f74edaba | 31 | #include "AliPHOSCalibrationDB.h" |
f74edaba | 32 | ClassImp(AliPHOSCalibrationDB) |
33 | ||
34 | ||
35 | //____________________________________________________________________________ | |
3f7dbdb7 | 36 | AliPHOSCalibrationDB::AliPHOSCalibrationDB():fPedestals(), fGains() |
f74edaba | 37 | { |
f74edaba | 38 | } |
39 | //____________________________________________________________________________ | |
90cceaf6 | 40 | AliPHOSCalibrationDB::AliPHOSCalibrationDB(const char * database): |
e4778e0c | 41 | TNamed("AliPHOSCalibrationDB",database),fPedestals("Pedestals"),fGains("Gains"){ |
f74edaba | 42 | |
f74edaba | 43 | } |
44 | //____________________________________________________________________________ | |
45 | AliPHOSCalibrationDB::~AliPHOSCalibrationDB() | |
46 | { | |
f74edaba | 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 | |
e4778e0c | 52 | Float_t ret = (amp - fPedestals.Data(absId))*fGains.Data(absId); |
f74edaba | 53 | if(ret > 0) |
54 | return ret ; | |
55 | else | |
56 | return 0.0000001 ; //Should not be zero - to avoid FPE | |
57 | } | |
6f06e050 | 58 | |
f74edaba | 59 | //____________________________________________________________________________ |
e4778e0c | 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. | |
f74edaba | 63 | |
e4778e0c | 64 | AliPHOSCalibrManager * man = AliPHOSCalibrManager::GetInstance() ; |
65 | if(!man){ | |
66 | Error("GetParameters","AliPHOSCalibrManager not instanciated") ; | |
67 | return ; | |
f74edaba | 68 | } |
e4778e0c | 69 | |
6f06e050 | 70 | |
e4778e0c | 71 | man->GetParameters(fPedestals) ; |
72 | man->GetParameters(fGains) ; | |
f74edaba | 73 | } |
6f06e050 | 74 | |
f74edaba | 75 | //____________________________________________________________________________ |
76 | AliPHOSCalibrationDB& AliPHOSCalibrationDB::operator=(AliPHOSCalibrationDB const & cdb) | |
77 | { | |
78 | // | |
f74edaba | 79 | fPedestals=cdb.fPedestals ; |
e4778e0c | 80 | fGains = cdb.fGains; |
f74edaba | 81 | return *this ; |
82 | } |