]>
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"), |
25 | fGeoUtils(0) | |
505b442d | 26 | { |
98baf84d | 27 | // See header file for class documentation |
cc537c68 | 28 | |
505b442d | 29 | } |
30 | ||
31 | AliHLTPHOSGeometry::~AliHLTPHOSGeometry() | |
32 | { | |
98baf84d | 33 | // See header file for class documentation |
505b442d | 34 | } |
03a0ff8a | 35 | // FR: PHOS doesn't use iParticle for now |
36 | void AliHLTPHOSGeometry::GetGlobalCoordinates ( AliHLTCaloRecPointDataStruct& recPoint, AliHLTCaloGlobalCoordinate& globalCoord, Int_t /* iParticle */ ) | |
505b442d | 37 | { |
98baf84d | 38 | // See header file for class documentation |
cc537c68 | 39 | if(!fIsInitialised) { InitialiseGeometry(); } |
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; | |
03a0ff8a | 48 | |
ee72b4e5 | 49 | |
cb8959d4 | 50 | ConvertRecPointCoordinates(x, z); |
c67183bb | 51 | |
cb8959d4 | 52 | TVector3 coord; |
16ce6bc0 | 53 | fGeoUtils->Local2Global(fCaloConstants->GetNMODULES() - recPoint.fModule, x, z, coord); |
cb8959d4 | 54 | |
03a0ff8a | 55 | |
cb8959d4 | 56 | globalCoord.fX = coord[0]; |
70cad768 | 57 | globalCoord.fY = coord[1]; |
58 | globalCoord.fZ = coord[2]; | |
16ce6bc0 | 59 | |
cb8959d4 | 60 | } |
61 | ||
62 | void AliHLTPHOSGeometry::ConvertRecPointCoordinates(Float_t &x, Float_t &z) const | |
63 | { | |
16ce6bc0 | 64 | // See header file for class documentation |
c67183bb | 65 | x = (x - (float)(fCaloConstants->GetNXCOLUMNSMOD())/2)*fCaloConstants->GetCELLSTEP(); |
66 | z = (z - ((float)(fCaloConstants->GetNZROWSMOD()))/2)*fCaloConstants->GetCELLSTEP(); | |
cb8959d4 | 67 | } |
68 | ||
69 | int AliHLTPHOSGeometry::GetGeometryFromCDB() | |
70 | { | |
71 | // See header file for documentation | |
cb8959d4 | 72 | |
73 | AliCDBPath path("GRP","Geometry","Data"); | |
74 | if(path.GetPath()) | |
75 | { | |
76 | // HLTInfo("configure from entry %s", path.GetPath()); | |
77 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
78 | if (pEntry) | |
79 | { | |
cc537c68 | 80 | if(fGeoUtils) |
cb8959d4 | 81 | { |
82 | delete fGeoUtils; | |
83 | fGeoUtils = 0; | |
84 | } | |
cc537c68 | 85 | |
86 | if(!gGeoManager) gGeoManager = (TGeoManager*) pEntry->GetObject(); | |
87 | ||
cb8959d4 | 88 | if(gGeoManager) |
89 | { | |
90 | fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV"); | |
cc537c68 | 91 | if(fGeoUtils) fIsInitialised = kTRUE; |
cb8959d4 | 92 | } |
55f9b287 | 93 | else |
94 | { | |
95 | HLTError("can not get gGeoManager from OCDB"); | |
96 | } | |
cb8959d4 | 97 | } |
98 | else | |
99 | { | |
55f9b287 | 100 | HLTError("can not fetch object \"%s\" from OCDB", path.GetPath().Data()); |
cb8959d4 | 101 | } |
102 | } | |
c22f5996 | 103 | return 0; |
505b442d | 104 | } |
cb8959d4 | 105 | |
106 | ||
16ce6bc0 | 107 | void AliHLTPHOSGeometry::GetCellAbsId ( UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId ) |
108 | { | |
109 | // See header file for class documentation | |
110 | if(!fGeoUtils) | |
111 | { | |
112 | Logging(kHLTLogError, "HLT", "PHOS", "AliHLTPHOSGeometry::GetCellAbsId: no geometry initialised"); | |
113 | return; | |
114 | } | |
115 | fGeoUtils->RelPosToAbsId(module, x, z, AbsId); | |
116 | } | |
cb8959d4 | 117 | |
cc537c68 | 118 | void AliHLTPHOSGeometry::GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z) |
119 | { | |
120 | Int_t rel[4]; | |
121 | fGeoUtils->AbsToRelNumbering(absId, rel); | |
122 | module = rel[0]-1; | |
123 | z = rel[2]; | |
124 | x = rel[3]; | |
125 | } |