]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSGeometry.cxx
- fixing major bug in clusterizer causing almost all events to contain only one cluster
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSGeometry.cxx
CommitLineData
505b442d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
5 * *
6 * Permission to use, copy, modify and distribute this software and its *
7 * documentation strictly for non-commercial purposes is hereby granted *
8 * without fee, provided that the above copyright notice appears in all *
9 * copies and that both the copyright notice and this permission notice *
10 * appear in the supporting documentation. The authors make no claims *
11 * about the suitability of this software for any purpose. It is *
12 * provided "as is" without express or implied warranty. *
13 **************************************************************************
14*/
15
16#include "AliHLTPHOSGeometry.h"
f710c5c9 17#include "AliPHOSGeoUtils.h"
cb8959d4 18#include "TGeoManager.h"
19#include "AliCDBManager.h"
20#include "AliCDBEntry.h"
21#include "TVector3.h"
505b442d 22
23AliHLTPHOSGeometry::AliHLTPHOSGeometry() :
f710c5c9 24AliHLTCaloGeometry("PHOS"),
25fGeoUtils(0)
505b442d 26{
98baf84d 27 // See header file for class documentation
ee72b4e5 28 GetGeometryFromCDB();
505b442d 29}
30
31AliHLTPHOSGeometry::~AliHLTPHOSGeometry()
32{
98baf84d 33// See header file for class documentation
505b442d 34}
03a0ff8a 35// FR: PHOS doesn't use iParticle for now
36void AliHLTPHOSGeometry::GetGlobalCoordinates ( AliHLTCaloRecPointDataStruct& recPoint, AliHLTCaloGlobalCoordinate& globalCoord, Int_t /* iParticle */ )
505b442d 37{
98baf84d 38 // See header file for class documentation
16ce6bc0 39 if(!fGeoUtils)
40 {
41 Logging(kHLTLogError, "HLT", "PHOS", "AliHLTPHOSGeometry::GetGlobalCoordinates: no geometry initialised");
42 return;
43 }
44
cb8959d4 45 Float_t x = recPoint.fX;
46 Float_t z = recPoint.fZ;
03a0ff8a 47
ee72b4e5 48
cb8959d4 49 ConvertRecPointCoordinates(x, z);
c67183bb 50
cb8959d4 51 TVector3 coord;
16ce6bc0 52 fGeoUtils->Local2Global(fCaloConstants->GetNMODULES() - recPoint.fModule, x, z, coord);
cb8959d4 53
03a0ff8a 54
cb8959d4 55 globalCoord.fX = coord[0];
70cad768 56 globalCoord.fY = coord[1];
57 globalCoord.fZ = coord[2];
16ce6bc0 58
cb8959d4 59}
60
61void AliHLTPHOSGeometry::ConvertRecPointCoordinates(Float_t &x, Float_t &z) const
62{
16ce6bc0 63 // See header file for class documentation
c67183bb 64 x = (x - (float)(fCaloConstants->GetNXCOLUMNSMOD())/2)*fCaloConstants->GetCELLSTEP();
65 z = (z - ((float)(fCaloConstants->GetNZROWSMOD()))/2)*fCaloConstants->GetCELLSTEP();
cb8959d4 66}
67
68int AliHLTPHOSGeometry::GetGeometryFromCDB()
69{
70 // See header file for documentation
cb8959d4 71
72 AliCDBPath path("GRP","Geometry","Data");
73 if(path.GetPath())
74 {
75 // HLTInfo("configure from entry %s", path.GetPath());
76 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
77 if (pEntry)
78 {
79 if(!fGeoUtils)
80 {
81 delete fGeoUtils;
82 fGeoUtils = 0;
83 }
84
85 gGeoManager = (TGeoManager*) pEntry->GetObject();
cb8959d4 86 if(gGeoManager)
87 {
88 fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
89 }
55f9b287 90 else
91 {
92 HLTError("can not get gGeoManager from OCDB");
93 }
cb8959d4 94 }
95 else
96 {
55f9b287 97 HLTError("can not fetch object \"%s\" from OCDB", path.GetPath().Data());
cb8959d4 98 }
99 }
c22f5996 100 return 0;
505b442d 101}
cb8959d4 102
103
16ce6bc0 104void AliHLTPHOSGeometry::GetCellAbsId ( UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId )
105 {
106 // See header file for class documentation
107 if(!fGeoUtils)
108 {
109 Logging(kHLTLogError, "HLT", "PHOS", "AliHLTPHOSGeometry::GetCellAbsId: no geometry initialised");
110 return;
111 }
112 fGeoUtils->RelPosToAbsId(module, x, z, AbsId);
113 }
cb8959d4 114