]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSGeometry.cxx
- loading geometry from CDB
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSGeometry.cxx
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 AliHLTCaloGeometry("PHOS"),
25 fGeoUtils(0)
26 {
27  // See header file for class documentation
28 }
29
30 AliHLTPHOSGeometry::~AliHLTPHOSGeometry()
31 {
32 // See header file for class documentation
33 }
34
35 void AliHLTPHOSGeometry::GetGlobalCoordinates ( AliHLTCaloRecPointDataStruct& recPoint, AliHLTCaloGlobalCoordinate& globalCoord )
36 {
37    // See header file for class documentation
38    Float_t x = recPoint.fX;
39    Float_t z = recPoint.fZ;
40    
41    ConvertRecPointCoordinates(x, z);
42
43    TVector3 coord;
44    
45    fGeoUtils->Local2Global(recPoint.fModule, x, z, coord);
46    
47    globalCoord.fX = coord[0];
48    globalCoord.fZ = coord[1];
49    globalCoord.fY = coord[2];
50 }
51
52 void AliHLTPHOSGeometry::ConvertRecPointCoordinates(Float_t &x, Float_t &z) const
53 {
54    x = (x - fCaloConstants->GetNXCOLUMNSMOD())*fCaloConstants->GetCELLSTEP();
55    z = (z - fCaloConstants->GetNZROWSMOD())*fCaloConstants->GetCELLSTEP();
56 }
57
58 int AliHLTPHOSGeometry::GetGeometryFromCDB()
59 {
60    // See header file for documentation
61     //HLTInfo("Getting geometry...");
62
63    AliCDBPath path("GRP","Geometry","Data");
64    if(path.GetPath())
65     {
66       //      HLTInfo("configure from entry %s", path.GetPath());
67       AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
68       if (pEntry) 
69         {
70           if(!fGeoUtils) 
71             {
72               delete fGeoUtils;
73               fGeoUtils = 0;
74             }
75
76           gGeoManager = (TGeoManager*) pEntry->GetObject();
77 //        HLTError("gGeoManager = 0x%x", gGeoManager);
78           if(gGeoManager)
79             {
80               fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
81             }
82         }
83       else
84         {
85 //          HLTError("can not fetch object \"%s\" from OCDB", path);
86         }
87     }
88 }
89
90
91