]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRecoParamHandler.cxx
- added handlers for reconstruction parameters
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRecoParamHandler.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
5  *                                                                        *
6  * Permission to use, copy, modify and distribute this software and its   *
7  * documentation strictly for non-commercial purposes is hereby granted   *
8  * without fee, provided that the above copyright notice appears in all   *
9  * copies and that both the copyright notice and this permission notice   *
10  * appear in the supporting documentation. The authors make no claims     *
11  * about the suitability of this software for any purpose. It is          *
12  * provided "as is" without express or implied warranty.                  *
13  **************************************************************************/
14
15 #include "AliHLTPHOSRecoParamHandler.h"
16 #include "AliCDBManager.h"
17 #include "AliCDBEntry.h"
18 #include "AliPHOSRecoParam.h"
19 #include "AliPHOSPIDv1.h"
20 #include "TObjArray.h"
21
22 AliHLTPHOSRecoParamHandler::AliHLTPHOSRecoParamHandler() :
23 AliHLTCaloRecoParamHandler("PHOS")
24 ,fRecoParamPtr(0),
25 fPHOSPidPtr(0)
26 {
27    // See header file for class documentation
28    
29    fPHOSPidPtr = new AliPHOSPIDv1();
30    
31 }
32
33
34 AliHLTPHOSRecoParamHandler::~AliHLTPHOSRecoParamHandler()
35 {
36    // See header file for class documentation
37    if(fRecoParamPtr) delete fRecoParamPtr; fRecoParamPtr = 0;
38    
39 }
40
41 Int_t AliHLTPHOSRecoParamHandler::GetParametersFromCDB()
42 {
43    // See header file for documentation
44    AliCDBPath path("PHOS","Calib","RecoParam");
45    if(path.GetPath())
46     {
47 //      HLTInfo("configure from entry %s", path.GetPath());
48       AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
49       if (pEntry) 
50         {
51           if(!fRecoParamPtr) 
52             {
53               delete fRecoParamPtr;
54               fRecoParamPtr = 0;
55             }
56             TObjArray *paramArray = dynamic_cast<TObjArray*>(pEntry->GetObject());
57             fRecoParamPtr = dynamic_cast<AliPHOSRecoParam*>(paramArray->At(0));
58             if(!fRecoParamPtr)
59             {
60                return -1;
61             }
62             fLogWeight = fRecoParamPtr->GetEMCLogWeight();
63             fRecPointMemberThreshold = fRecoParamPtr->GetEMCMinE();
64             fRecPointThreshold = fRecoParamPtr->GetEMCClusteringThreshold();
65         }
66       else
67         {
68 //          HLTError("can not fetch object \"%s\" from OCDB", path);
69             return -1;
70         }
71     }
72     return 0;
73 }
74
75 Float_t AliHLTPHOSRecoParamHandler::GetCorrectedEnergy ( Float_t e )
76 {
77    // See header file for class documentation
78    return fPHOSPidPtr->GetCalibratedEnergy(e);
79 }
80