]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/PHOSTasks/ClusterSelection/AliPHOSLogbackCluster.cxx
added AliPHOSLogbackCluster::GetGeometry
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / ClusterSelection / AliPHOSLogbackCluster.cxx
CommitLineData
eeec9023 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
936c2a53 18#include "AliLog.h"
eeec9023 19#include "AliPHOSLogbackCluster.h"
936c2a53 20#include <AliPHOSGeometry.h>
eeec9023 21
22ClassImp(AliPHOSLogbackCluster)
23
24//______________________________________________________________________________
25AliPHOSLogbackCluster::AliPHOSLogbackCluster(AliVCluster* cluster)
26: fE( cluster->E() )
27{
28 //TODO: fCoreE
29
30 cluster->GetPosition( fPosition );
31}
32
33AliPHOSLogbackCluster::~AliPHOSLogbackCluster()
34{
35}
36
37
38TLorentzVector AliPHOSLogbackCluster::GetMomentum(Double_t * vertex)
39{
40 // Returns TLorentzVector with momentum of the cluster. Only valid for clusters
41 // identified as photons or pi0 (overlapped gamma) produced on the vertex
42 // Vertex can be recovered with esd pointer doing:
43 //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
44
45 Double_t pos[3]={ fPosition[0] - vertex[0],
46 fPosition[1] - vertex[1],
47 fPosition[2] - vertex[2] };
48
49 Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2] ) ;
50
936c2a53 51 return TLorentzVector( fE*pos[0]/r, fE*pos[1]/r, fE*pos[2]/r, fE) ;
eeec9023 52}
936c2a53 53
54
55AliPHOSGeometry* AliPHOSLogbackCluster::GetGeometry()
56{
57 // Gets Geometry, from OADB
58
59 static AliPHOSGeometry* sGeometry = 0x0;
60
61 //Init geometry
62 if(!sGeometry){
63 AliOADBContainer geomContainer("phosGeo_AliPHOSLogbackCluster");
64 geomContainer.InitFromFile("$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root","PHOSRotationMatrixes");
65 TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(fRunNumber,"PHOSRotationMatrixes");
66 sGeometry = AliPHOSGeometry::GetInstance("IHEP") ;
67 for(Int_t mod=0; mod<5; mod++) {
68 if(!matrixes->At(mod)) {
69 // Please note that not all modules are present as of 2014
70 // if( fDebug )
71 // AliInfo(Form("No PHOS Matrix for mod:%d, geo=%p\n", mod, sGeometry));
72 AliDebug(2, Form("No PHOS Matrix for mod:%d, geo=%p\n", mod, sGeometry) );
73 continue;
74 }
75 else {
76 sGeometry->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod) ;
77 if( fDebug >1 )
78 AliInfo(Form("Adding PHOS Matrix for mod:%d, geo=%p\n", mod, sGeometry));
79 }
80 }
81 }
82
83 return sGeometry;
84}