]>
Commit | Line | Data |
---|---|---|
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 | |
23 | AliHLTPHOSGeometry::AliHLTPHOSGeometry() : | |
f710c5c9 | 24 | AliHLTCaloGeometry("PHOS"), |
16ce6bc0 | 25 | AliHLTLogging(), |
f710c5c9 | 26 | fGeoUtils(0) |
505b442d | 27 | { |
98baf84d | 28 | // See header file for class documentation |
ee72b4e5 | 29 | GetGeometryFromCDB(); |
505b442d | 30 | } |
31 | ||
32 | AliHLTPHOSGeometry::~AliHLTPHOSGeometry() | |
33 | { | |
98baf84d | 34 | // See header file for class documentation |
505b442d | 35 | } |
36 | ||
ea54e1c8 | 37 | void AliHLTPHOSGeometry::GetGlobalCoordinates ( AliHLTCaloRecPointDataStruct& recPoint, AliHLTCaloGlobalCoordinate& globalCoord ) |
505b442d | 38 | { |
98baf84d | 39 | // See header file for class documentation |
16ce6bc0 | 40 | if(!fGeoUtils) |
41 | { | |
42 | Logging(kHLTLogError, "HLT", "PHOS", "AliHLTPHOSGeometry::GetGlobalCoordinates: no geometry initialised"); | |
43 | return; | |
44 | } | |
45 | ||
cb8959d4 | 46 | Float_t x = recPoint.fX; |
47 | Float_t z = recPoint.fZ; | |
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 | |
54 | globalCoord.fX = coord[0]; | |
70cad768 | 55 | globalCoord.fY = coord[1]; |
56 | globalCoord.fZ = coord[2]; | |
16ce6bc0 | 57 | |
cb8959d4 | 58 | } |
59 | ||
60 | void AliHLTPHOSGeometry::ConvertRecPointCoordinates(Float_t &x, Float_t &z) const | |
61 | { | |
16ce6bc0 | 62 | // See header file for class documentation |
c67183bb | 63 | x = (x - (float)(fCaloConstants->GetNXCOLUMNSMOD())/2)*fCaloConstants->GetCELLSTEP(); |
64 | z = (z - ((float)(fCaloConstants->GetNZROWSMOD()))/2)*fCaloConstants->GetCELLSTEP(); | |
cb8959d4 | 65 | } |
66 | ||
67 | int AliHLTPHOSGeometry::GetGeometryFromCDB() | |
68 | { | |
69 | // See header file for documentation | |
cb8959d4 | 70 | |
71 | AliCDBPath path("GRP","Geometry","Data"); | |
72 | if(path.GetPath()) | |
73 | { | |
74 | // HLTInfo("configure from entry %s", path.GetPath()); | |
75 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
76 | if (pEntry) | |
77 | { | |
78 | if(!fGeoUtils) | |
79 | { | |
80 | delete fGeoUtils; | |
81 | fGeoUtils = 0; | |
82 | } | |
83 | ||
84 | gGeoManager = (TGeoManager*) pEntry->GetObject(); | |
85 | // HLTError("gGeoManager = 0x%x", gGeoManager); | |
86 | if(gGeoManager) | |
87 | { | |
88 | fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV"); | |
89 | } | |
90 | } | |
91 | else | |
92 | { | |
93 | // HLTError("can not fetch object \"%s\" from OCDB", path); | |
94 | } | |
95 | } | |
c22f5996 | 96 | return 0; |
505b442d | 97 | } |
cb8959d4 | 98 | |
99 | ||
16ce6bc0 | 100 | void AliHLTPHOSGeometry::GetCellAbsId ( UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId ) |
101 | { | |
102 | // See header file for class documentation | |
103 | if(!fGeoUtils) | |
104 | { | |
105 | Logging(kHLTLogError, "HLT", "PHOS", "AliHLTPHOSGeometry::GetCellAbsId: no geometry initialised"); | |
106 | return; | |
107 | } | |
108 | fGeoUtils->RelPosToAbsId(module, x, z, AbsId); | |
109 | } | |
cb8959d4 | 110 |