1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 #include "AliHLTEMCALDigitHandler.h"
18 #include "AliRunLoader.h"
19 #include "AliEMCALLoader.h"
20 #include "AliHLTEMCALGeometry.h"
22 #include "AliEMCALDigit.h"
23 #include "AliEMCALCalibData.h"
24 #include "AliCDBManager.h"
25 #include "AliCDBEntry.h"
26 #include "AliCDBPath.h"
28 AliHLTEMCALDigitHandler *AliHLTEMCALDigitHandler::fgkInstance = NULL;
30 AliHLTEMCALDigitHandler::AliHLTEMCALDigitHandler() : AliHLTCaloDigitHandler("EMCAL")
36 AliHLTEMCALDigitHandler::~AliHLTEMCALDigitHandler()
41 AliHLTEMCALDigitHandler* AliHLTEMCALDigitHandler::Instance()
45 fgkInstance = new AliHLTEMCALDigitHandler;
50 Int_t AliHLTEMCALDigitHandler::Init(AliRunLoader* runLoader)
53 fGeometry = new AliHLTEMCALGeometry();
54 if (fGeometry) fGeometry->InitialiseGeometry();
57 HLTFatal("Could not get gains from CDB");
61 Int_t nev = AliHLTCaloDigitHandler::Init(runLoader);
66 fDetLoader = dynamic_cast<AliEMCALLoader*>(fRunLoader->GetDetectorLoader("EMCAL"));
69 HLTFatal("Could not get EMCAL loader");
82 Int_t AliHLTEMCALDigitHandler::ConvertDigit(AliDigitNew *digit)
84 AliEMCALDigit *dig = dynamic_cast<AliEMCALDigit*>(digit);
88 HLTError("Wrong data, cannot create digits");
96 fGeometry->GetLocalCoordinatesFromAbsId(dig->GetId(), module, x, z);
97 AliHLTCaloDigitDataStruct *hDig = &(fDigits[module][fDigitsInModule[module]]);
99 hDig->fID = dig->GetId();
102 hDig->fModule = module;
103 hDig->fEnergy = dig->GetAmplitude()*(fCalibData->GetADCchannel(module, z, x));
104 hDig->fTime = dig->GetTime();
105 hDig->fAmplitude = 0;
106 hDig->fOverflow = false;
107 hDig->fHgPresent = true;
108 hDig->fAssociatedCluster = -1;
109 fDigitsInModule[module]++;
114 int AliHLTEMCALDigitHandler::GetGainsFromCDB()
116 // See header file for class documentation
118 AliCDBPath path("EMCAL","Calib","Data");
121 // HLTInfo("configure from entry %s", path.GetPath());
122 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
125 fCalibData = (AliEMCALCalibData*)pEntry->GetObject();
129 // HLTError("can not fetch object \"%s\" from CDB", path);
133 if(!fCalibData) return -1;