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