]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EMCAL/AliHLTEMCALGeometry.cxx
merged cluster and channel data
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALGeometry.cxx
CommitLineData
5308534b 1/**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2007 *
5 * *
6 * Author: federico ronchetti for the ALICE HLT Project.*
7 * *
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 **************************************************************************/
22406a6a 16
5308534b 17#include "AliHLTEMCALGeometry.h"
22406a6a 18#include "AliHLTEMCALConstants.h"
cdf43bb0 19#include "AliCDBEntry.h"
20#include "AliCDBManager.h"
21#include "AliCDBPath.h"
5308534b 22
5308534b 23
24ClassImp(AliHLTEMCALGeometry);
22406a6a 25TGeoManager *gGeoManager = 0;
5308534b 26
22406a6a 27AliHLTEMCALGeometry::AliHLTEMCALGeometry() :
28 AliHLTCaloGeometry ("EMCAL"),
fc6a3152 29 fGeo(0),fReco(0)
5308534b 30{
cdf43bb0 31 GetGeometryFromCDB();
5308534b 32}
33
7b3a0a0e 34Int_t AliHLTEMCALGeometry::InitialiseGeometry()
35{
36
37 return GetGeometryFromCDB();
38}
39
5308534b 40
41AliHLTEMCALGeometry::~AliHLTEMCALGeometry()
42{
43
44}
45
46void
5d3cb748 47AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord)
5308534b 48{
08a69753 49
fc6a3152 50 Float_t fDepth;
51 Float_t *fRot = fReco->GetMisalRotShiftArray();
52 Float_t *fTrans = fReco->GetMisalTransShiftArray();
53 Float_t glob[] = {0.,0.,0.};
08a69753 54
fc6a3152 55 //assume photo for the moment
56 fDepth = fReco->GetDepth(recPoint.fAmp,AliEMCALRecoUtils::kPhoton,recPoint.fModule);
85e654fb 57
fc6a3152 58 fGeo->RecalculateTowerPosition(recPoint.fX, recPoint.fZ,recPoint.fModule, fDepth, fTrans, fRot, glob);
85e654fb 59
fc6a3152 60 globalCoord.fX = glob[0];
61 globalCoord.fY = glob[1];
62 globalCoord.fZ = glob[2];
85e654fb 63
22406a6a 64
5308534b 65}
66
67void
b64e6e99 68AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId)
5308534b 69{
22406a6a 70
85e654fb 71 if(!fGeo)
72 {
73 Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
74 return;
22406a6a 75
85e654fb 76 }
08a69753 77 AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, (Int_t) x, (Int_t) z);
78
79
5308534b 80
22406a6a 81}
82
83
84int
85AliHLTEMCALGeometry::GetGeometryFromCDB()
86{
22406a6a 87
85e654fb 88 // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
22406a6a 89
90 AliCDBPath path("GRP","Geometry","Data");
91 if(path.GetPath())
92 {
93 // HLTInfo("configure from entry %s", path.GetPath());
94 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
95 if (pEntry)
96 {
08a69753 97 if(!fGeo)
22406a6a 98 {
08a69753 99 delete fGeo;
100 fGeo = 0;
22406a6a 101 }
102
103 gGeoManager = (TGeoManager*) pEntry->GetObject();
22406a6a 104
105 if(gGeoManager)
106 {
107 fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
fc6a3152 108 fReco = new AliEMCALRecoUtils;
109 // FIXME
110 // need to be parametrized
111 // misalignment corrections to be put into OCDB
112
113 fReco->SetMisalTransShift(0,1.08);
114 fReco->SetMisalTransShift(1,8.35);
115 fReco->SetMisalTransShift(2,1.12); //sector 0
116 fReco->SetMisalRotShift(3,-8.05);
117 fReco->SetMisalRotShift(4,8.05);
118 fReco->SetMisalTransShift(3,-0.42);
119 fReco->SetMisalTransShift(5,1.55);//sector 1
120
22406a6a 121 }
122
123 }
124 else
125 {
08a69753 126 //HLTError("can not fetch object \"%s\" from OCDB", path);
127 Logging(kHLTLogError, "HLT", "EMCAL", "can not fetch object from OCDB");
128
22406a6a 129 }
130 }
131 return 0;
132}