]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EMCAL/AliHLTEMCALGeometry.cxx
merged cluster and channel data
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALGeometry.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the Experimental Nuclear     *
3  * Physics Group, Dep. of Physics                                         *
4  * University of Oslo, Norway, 2007                                       *
5  *                                                                        *
6  * Author: federico ronchetti         for the ALICE HLT Project.*
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 #include "AliHLTEMCALGeometry.h"
18 #include "AliHLTEMCALConstants.h"
19 #include "AliCDBEntry.h"
20 #include "AliCDBManager.h"
21 #include "AliCDBPath.h"
22
23
24 ClassImp(AliHLTEMCALGeometry);
25 TGeoManager *gGeoManager = 0;
26
27 AliHLTEMCALGeometry::AliHLTEMCALGeometry() :
28         AliHLTCaloGeometry ("EMCAL"),
29         fGeo(0),fReco(0)
30 {
31   GetGeometryFromCDB();
32 }
33
34 Int_t AliHLTEMCALGeometry::InitialiseGeometry()
35 {
36    
37    return GetGeometryFromCDB();
38 }
39
40
41 AliHLTEMCALGeometry::~AliHLTEMCALGeometry()
42 {
43
44 }
45   
46 void 
47 AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord)
48 {
49
50   Float_t fDepth;
51   Float_t *fRot = fReco->GetMisalRotShiftArray();
52   Float_t *fTrans = fReco->GetMisalTransShiftArray();
53   Float_t glob[] = {0.,0.,0.};
54
55   //assume photo for the moment
56   fDepth = fReco->GetDepth(recPoint.fAmp,AliEMCALRecoUtils::kPhoton,recPoint.fModule);
57   
58   fGeo->RecalculateTowerPosition(recPoint.fX, recPoint.fZ,recPoint.fModule, fDepth, fTrans, fRot, glob);
59   
60   globalCoord.fX = glob[0];
61   globalCoord.fY = glob[1];
62   globalCoord.fZ = glob[2];
63   
64
65 }
66  
67 void 
68 AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId)
69 {
70
71   if(!fGeo)
72     {
73       Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
74       return;
75
76     }
77         AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, (Int_t) x, (Int_t) z);
78
79
80         
81 }
82
83
84 int
85 AliHLTEMCALGeometry::GetGeometryFromCDB()
86 {
87
88   // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
89
90   AliCDBPath path("GRP","Geometry","Data");
91   if(path.GetPath())
92     {
93       //      HLTInfo("configure from entry %s", path.GetPath());
94       AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
95       if (pEntry)
96         {
97           if(!fGeo)
98             {
99               delete fGeo;
100               fGeo = 0;
101             }
102
103           gGeoManager = (TGeoManager*) pEntry->GetObject();
104
105           if(gGeoManager)
106             {
107               fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
108               fReco = new AliEMCALRecoUtils;
109               // FIXME
110               // need to be parametrized
111               // misalignment corrections to be put into OCDB
112
113               fReco->SetMisalTransShift(0,1.08); 
114               fReco->SetMisalTransShift(1,8.35); 
115               fReco->SetMisalTransShift(2,1.12); //sector 0
116               fReco->SetMisalRotShift(3,-8.05); 
117               fReco->SetMisalRotShift(4,8.05); 
118               fReco->SetMisalTransShift(3,-0.42); 
119               fReco->SetMisalTransShift(5,1.55);//sector 1
120               
121             }
122
123         }
124       else
125         {
126           //HLTError("can not fetch object \"%s\" from OCDB", path);
127           Logging(kHLTLogError, "HLT", "EMCAL", "can not fetch object from OCDB");
128
129         }
130     }
131   return 0;
132 }