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 *
6 * Author: federico ronchetti 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 "AliHLTEMCALGeometry.h"
18 #include "AliHLTEMCALConstants.h"
19 #include "AliCDBEntry.h"
20 #include "AliCDBManager.h"
21 #include "AliCDBPath.h"
24 ClassImp(AliHLTEMCALGeometry);
25 TGeoManager *gGeoManager = 0;
27 AliHLTEMCALGeometry::AliHLTEMCALGeometry() :
28 AliHLTCaloGeometry ("EMCAL"),
34 Int_t AliHLTEMCALGeometry::InitialiseGeometry()
37 return GetGeometryFromCDB();
41 AliHLTEMCALGeometry::~AliHLTEMCALGeometry()
47 AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord, Int_t iParticle)
51 // remove misalignments for 2010
52 //Float_t *fRot = fReco->GetMisalRotShiftArray();
53 //Float_t *fTrans = fReco->GetMisalTransShiftArray();
58 Float_t glob[] = {0.,0.,0.};
60 // Zeroing out misaligments
61 for (Int_t i = 0; i<14; i++) { fRot[i] = 0; fTrans[i] = 0; }
63 //assume only photon for the moment
65 if (recPoint.fX>=-0.5 && recPoint.fZ>=-0.5) // -0.5 is the extreme border of 0,0 cell
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);
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
81 fGeo->RecalculateTowerPosition(recPoint.fX, recPoint.fZ,recPoint.fModule, fDepth, fTrans, fRot, glob);
83 globalCoord.fX = glob[0];
84 globalCoord.fY = glob[1];
85 globalCoord.fZ = glob[2];
91 AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId)
96 Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
100 AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, (Int_t) x, (Int_t) z);
108 AliHLTEMCALGeometry::GetGeometryFromCDB()
110 // local path to OCDB
111 // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
113 AliCDBPath path("GRP","Geometry","Data");
116 // HLTInfo("configure from entry %s", path.GetPath());
117 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
127 gGeoManager = (TGeoManager*) pEntry->GetObject();
132 HLTDebug("Getting geometry from CDB");
133 fGeo = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
134 //fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
135 fReco = new AliEMCALRecoUtils;
137 // Old misalignments for 2010
138 // We don't use them now
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
153 //HLTError("can not fetch object \"%s\" from OCDB", path);
154 Logging(kHLTLogError, "HLT", "EMCAL", "can not fetch object from OCDB");
161 void AliHLTEMCALGeometry::GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z)
163 Int_t mod; // not super module
167 fGeo->GetCellIndex(absId, module, mod, tmpx, tmpz);
168 fGeo->GetCellPhiEtaIndexInSModule(module,mod,tmpx,tmpz, x, z);
170 HLTDebug("ID: %d, smodule: %d, mod: %d, x: %d, z: %d", absId, module, mod, x, z);