]>
Commit | Line | Data |
---|---|---|
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 | |
24 | ClassImp(AliHLTEMCALGeometry); | |
22406a6a | 25 | TGeoManager *gGeoManager = 0; |
5308534b | 26 | |
22406a6a | 27 | AliHLTEMCALGeometry::AliHLTEMCALGeometry() : |
28 | AliHLTCaloGeometry ("EMCAL"), | |
fc6a3152 | 29 | fGeo(0),fReco(0) |
5308534b | 30 | { |
cdf43bb0 | 31 | GetGeometryFromCDB(); |
5308534b | 32 | } |
33 | ||
7b3a0a0e | 34 | Int_t AliHLTEMCALGeometry::InitialiseGeometry() |
35 | { | |
36 | ||
37 | return GetGeometryFromCDB(); | |
38 | } | |
39 | ||
5308534b | 40 | |
41 | AliHLTEMCALGeometry::~AliHLTEMCALGeometry() | |
42 | { | |
43 | ||
44 | } | |
45 | ||
46 | void | |
5d3cb748 | 47 | AliHLTEMCALGeometry::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 | ||
67 | void | |
b64e6e99 | 68 | AliHLTEMCALGeometry::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 | ||
84 | int | |
85 | AliHLTEMCALGeometry::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 | } |