Line data Source code
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 : **************************************************************************/
16 :
17 : #include "AliHLTEMCALGeometry.h"
18 : #include "AliHLTEMCALConstants.h"
19 : #include "AliCDBEntry.h"
20 : #include "AliCDBManager.h"
21 : #include "AliCDBPath.h"
22 :
23 :
24 6 : ClassImp(AliHLTEMCALGeometry);
25 : TGeoManager *gGeoManager = 0;
26 :
27 : AliHLTEMCALGeometry::AliHLTEMCALGeometry(Int_t runnumber) :
28 0 : AliHLTCaloGeometry ("EMCAL"),
29 0 : fGeo(0),fReco(0)
30 0 : {
31 0 : GetGeometryFromCDB(runnumber);
32 0 : }
33 :
34 : Int_t AliHLTEMCALGeometry::InitialiseGeometry()
35 : {
36 :
37 0 : return GetGeometryFromCDB();
38 : }
39 :
40 :
41 0 : AliHLTEMCALGeometry::~AliHLTEMCALGeometry()
42 0 : {
43 :
44 0 : }
45 :
46 : void
47 : AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord, Int_t iParticle)
48 : {
49 :
50 : Float_t fDepth = 0;
51 : // remove misalignments for 2010
52 : //Float_t *fRot = fReco->GetMisalRotShiftArray();
53 : //Float_t *fTrans = fReco->GetMisalTransShiftArray();
54 :
55 0 : Float_t fRot[15];
56 0 : Float_t fTrans[15];
57 :
58 0 : Float_t glob[] = {0.,0.,0.};
59 :
60 : // Zeroing out misaligments
61 0 : for (Int_t i = 0; i<14; i++) { fRot[i] = 0; fTrans[i] = 0; }
62 :
63 : //assume only photon for the moment
64 :
65 0 : if (recPoint.fX>=-0.5 && recPoint.fZ>=-0.5) // -0.5 is the extreme border of 0,0 cell
66 :
67 : {
68 0 : if (iParticle == 1) // electron case
69 0 : fDepth = fReco->GetDepth(recPoint.fAmp, AliEMCALRecoUtils::kElectron, recPoint.fModule);
70 0 : else if (iParticle == 2) // hadron case
71 0 : fDepth = fReco->GetDepth(recPoint.fAmp, AliEMCALRecoUtils::kHadron, recPoint.fModule);
72 : else // anything else is photon
73 0 : 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 0 : return; // we don't want to give out strange coordinates to event display
79 : }
80 :
81 0 : fGeo->RecalculateTowerPosition(recPoint.fX, recPoint.fZ,recPoint.fModule, fDepth, fTrans, fRot, glob);
82 :
83 0 : globalCoord.fX = glob[0];
84 0 : globalCoord.fY = glob[1];
85 0 : globalCoord.fZ = glob[2];
86 :
87 :
88 0 : }
89 :
90 : void
91 : AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId)
92 : {
93 :
94 0 : if(!fGeo)
95 : {
96 0 : Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
97 0 : return;
98 :
99 : }
100 0 : AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, (Int_t) x, (Int_t) z);
101 :
102 :
103 :
104 0 : }
105 :
106 :
107 : int
108 : AliHLTEMCALGeometry::GetGeometryFromCDB(Int_t runnumber)
109 : {
110 : // local path to OCDB
111 : // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
112 :
113 0 : AliCDBPath path("GRP","Geometry","Data");
114 0 : if(path.GetPath())
115 : {
116 : // HLTInfo("configure from entry %s", path.GetPath());
117 0 : AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
118 0 : if (pEntry)
119 : {
120 0 : if(!fGeo)
121 : {
122 0 : delete fGeo;
123 0 : fGeo = 0;
124 0 : }
125 0 : if(!gGeoManager)
126 : {
127 0 : gGeoManager = (TGeoManager*) pEntry->GetObject();
128 0 : }
129 :
130 0 : if(gGeoManager)
131 : {
132 : HLTDebug("Getting geometry from CDB");
133 0 : if(runnumber < 0)
134 0 : fGeo = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
135 : else
136 0 : fGeo = AliEMCALGeometry::GetInstanceFromRunNumber(runnumber);
137 : //fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
138 0 : fReco = new AliEMCALRecoUtils;
139 :
140 : // Old misalignments for 2010
141 : // We don't use them now
142 : /*
143 : fReco->SetMisalTransShift(0,1.08);
144 : fReco->SetMisalTransShift(1,8.35);
145 : fReco->SetMisalTransShift(2,1.12); //sector 0
146 : fReco->SetMisalRotShift(3,-8.05);
147 : fReco->SetMisalRotShift(4,8.05);
148 : fReco->SetMisalTransShift(3,-0.42);
149 : fReco->SetMisalTransShift(5,1.55);//sector 1
150 : */
151 0 : }
152 :
153 : }
154 : else
155 : {
156 : //HLTError("can not fetch object \"%s\" from OCDB", path);
157 0 : Logging(kHLTLogError, "HLT", "EMCAL", "can not fetch object from OCDB");
158 :
159 : }
160 0 : }
161 : return 0;
162 0 : }
163 :
164 : void AliHLTEMCALGeometry::GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z)
165 : {
166 0 : Int_t mod; // not super module
167 0 : Int_t tmpx;
168 0 : Int_t tmpz;
169 :
170 0 : fGeo->GetCellIndex(absId, module, mod, tmpx, tmpz);
171 0 : fGeo->GetCellPhiEtaIndexInSModule(module,mod,tmpx,tmpz, x, z);
172 :
173 : HLTDebug("ID: %d, smodule: %d, mod: %d, x: %d, z: %d", absId, module, mod, x, z);
174 0 : }
|