]>
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 | { |
05e3dce8 | 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 | |
03a0ff8a | 47 | AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord, Int_t iParticle) |
5308534b | 48 | { |
08a69753 | 49 | |
03a0ff8a | 50 | Float_t fDepth = 0; |
51 | // remove misalignments for 2010 | |
52 | //Float_t *fRot = fReco->GetMisalRotShiftArray(); | |
53 | //Float_t *fTrans = fReco->GetMisalTransShiftArray(); | |
54 | ||
55 | Float_t fRot[15]; | |
56 | Float_t fTrans[15]; | |
57 | ||
fc6a3152 | 58 | Float_t glob[] = {0.,0.,0.}; |
08a69753 | 59 | |
03a0ff8a | 60 | // Zeroing out misaligments |
61 | for (Int_t i = 0; i<14; i++) { fRot[i] = 0; fTrans[i] = 0; } | |
62 | ||
63 | //assume only photon for the moment | |
64 | ||
65 | if (recPoint.fX>=-0.5 && recPoint.fZ>=-0.5) // -0.5 is the extreme border of 0,0 cell | |
66 | ||
67 | { | |
68 | if (iParticle == 1) // electron case | |
69 | fDepth = fReco->GetDepth(recPoint.fAmp, AliEMCALRecoUtils::kElectron, recPoint.fModule); | |
70 | else if (iParticle == 2) // hadron case | |
71 | fDepth = fReco->GetDepth(recPoint.fAmp, AliEMCALRecoUtils::kHadron, recPoint.fModule); | |
72 | else // anything else is photon | |
73 | fDepth = fReco->GetDepth(recPoint.fAmp, AliEMCALRecoUtils::kPhoton, recPoint.fModule); | |
74 | } | |
75 | ||
76 | else { | |
77 | HLTDebug("W-AliHLTEMCALGeometry: got cluster with negative flags in coordinates."); | |
78 | return; // we don't want to give out strange coordinates to event display | |
79 | } | |
85e654fb | 80 | |
fc6a3152 | 81 | fGeo->RecalculateTowerPosition(recPoint.fX, recPoint.fZ,recPoint.fModule, fDepth, fTrans, fRot, glob); |
85e654fb | 82 | |
fc6a3152 | 83 | globalCoord.fX = glob[0]; |
84 | globalCoord.fY = glob[1]; | |
85 | globalCoord.fZ = glob[2]; | |
85e654fb | 86 | |
22406a6a | 87 | |
5308534b | 88 | } |
03a0ff8a | 89 | |
5308534b | 90 | void |
b64e6e99 | 91 | AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId) |
5308534b | 92 | { |
22406a6a | 93 | |
85e654fb | 94 | if(!fGeo) |
95 | { | |
96 | Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised"); | |
97 | return; | |
22406a6a | 98 | |
85e654fb | 99 | } |
08a69753 | 100 | AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, (Int_t) x, (Int_t) z); |
101 | ||
102 | ||
5308534b | 103 | |
22406a6a | 104 | } |
105 | ||
106 | ||
107 | int | |
108 | AliHLTEMCALGeometry::GetGeometryFromCDB() | |
109 | { | |
03a0ff8a | 110 | // local path to OCDB |
85e654fb | 111 | // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
22406a6a | 112 | |
113 | AliCDBPath path("GRP","Geometry","Data"); | |
114 | if(path.GetPath()) | |
115 | { | |
116 | // HLTInfo("configure from entry %s", path.GetPath()); | |
117 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
118 | if (pEntry) | |
119 | { | |
08a69753 | 120 | if(!fGeo) |
22406a6a | 121 | { |
08a69753 | 122 | delete fGeo; |
123 | fGeo = 0; | |
22406a6a | 124 | } |
86cbf5e7 | 125 | if(!gGeoManager) |
126 | { | |
127 | gGeoManager = (TGeoManager*) pEntry->GetObject(); | |
128 | } | |
22406a6a | 129 | |
130 | if(gGeoManager) | |
131 | { | |
86cbf5e7 | 132 | HLTDebug("Getting geometry from CDB"); |
e8ea8cf2 | 133 | fGeo = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1"); |
134 | //fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL"); | |
fc6a3152 | 135 | fReco = new AliEMCALRecoUtils; |
03a0ff8a | 136 | |
137 | // Old misalignments for 2010 | |
138 | // We don't use them now | |
139 | /* | |
fc6a3152 | 140 | fReco->SetMisalTransShift(0,1.08); |
141 | fReco->SetMisalTransShift(1,8.35); | |
142 | fReco->SetMisalTransShift(2,1.12); //sector 0 | |
143 | fReco->SetMisalRotShift(3,-8.05); | |
144 | fReco->SetMisalRotShift(4,8.05); | |
145 | fReco->SetMisalTransShift(3,-0.42); | |
146 | fReco->SetMisalTransShift(5,1.55);//sector 1 | |
03a0ff8a | 147 | */ |
22406a6a | 148 | } |
149 | ||
150 | } | |
151 | else | |
152 | { | |
08a69753 | 153 | //HLTError("can not fetch object \"%s\" from OCDB", path); |
154 | Logging(kHLTLogError, "HLT", "EMCAL", "can not fetch object from OCDB"); | |
155 | ||
22406a6a | 156 | } |
157 | } | |
158 | return 0; | |
159 | } | |
86cbf5e7 | 160 | |
161 | void AliHLTEMCALGeometry::GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z) | |
162 | { | |
163 | Int_t mod; // not super module | |
164 | Int_t tmpx; | |
165 | Int_t tmpz; | |
166 | ||
167 | fGeo->GetCellIndex(absId, module, mod, tmpx, tmpz); | |
168 | fGeo->GetCellPhiEtaIndexInSModule(module,mod,tmpx,tmpz, x, z); | |
169 | ||
170 | HLTDebug("ID: %d, smodule: %d, mod: %d, x: %d, z: %d", absId, module, mod, x, z); | |
171 | } |