FairRoot/PandaRoot
PndEmcClusterDistances.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 //
4 // Description:
5 // Class PndEmcClusterDistances
6 //
7 // Environment:
8 // Software developed for the BaBar Detector at the SLAC B-Factory.
9 //
10 // Author List:
11 // Stephen J. Gowdy Originator
12 //
13 // Copyright Information:
14 // Copyright (C) 1998 University of Edinburgh
15 //
16 // Dima Melnichuk, adaption for pandaroot
17 //------------------------------------------------------------------------
18 
19 #include "PndEmcClusterDistances.h"
20 #include "PndEmcStructure.h"
21 #include "PndEmcDataTypes.h"
22 #include "PndEmcTwoCoordIndex.h"
23 #include "PndEmcCluster.h"
24 #include "PndEmcDigi.h"
25 #include "PndEmcXtal.h"
26 
27 #include "assert.h"
28 
29 PndEmcClusterDistances::PndEmcClusterDistances(const PndEmcCluster &toUse, const TClonesArray *digiArray):
30 PndEmcAbsClusterProperty( toUse, digiArray ),
31 fShowerMaxLocation(new TVector3()),
32 fClusterLocation(new TVector3()),
33 fTheGeom(new PndEmcXtal()),
34 fTheNormalToFrontFace(new TVector3()),
35 fDistanceOfPlane(0),
36 fClusPhi(0),
37 fClusTheta(0)
38 {
39  TVector3 clusLocation(toUse.where());
40 
41  fClusterLocation = new TVector3(clusLocation.x(), clusLocation.y(), clusLocation.z());
42 
43  fShowerMaxLocation = new TVector3(*fClusterLocation);
44 
45  Double_t showerMax = (log(toUse.energy()/0.0145) + 0.5) * 1.86;
46 
47  fShowerMaxLocation->SetMag(fClusterLocation->Mag() + showerMax);
48 
49  PndEmcTwoCoordIndex *theTCI=PndEmcStructure::Instance()->locateIndex(fShowerMaxLocation->Theta(),fShowerMaxLocation->Phi());
50 
51  assert(theTCI != 0);
52 
54  fTheGeom = tciXtalMap.find(theTCI)->second;
55 
57 
58  fDistanceOfPlane = fTheNormalToFrontFace->Dot(*fShowerMaxLocation);
59 
60  fClusPhi = toUse.phi();
61  fClusTheta = toUse.theta();
62 
63 }
64 
66  PndEmcAbsClusterProperty( theDistance ),
67  fShowerMaxLocation( new TVector3(*(theDistance.fShowerMaxLocation)) ),
68  fClusterLocation( new TVector3(*(theDistance.fClusterLocation)) ),
69  fTheGeom( theDistance.fTheGeom ),
70  fTheNormalToFrontFace( theDistance.fTheNormalToFrontFace ),
71  fDistanceOfPlane( theDistance.fDistanceOfPlane ),
72  fClusPhi( theDistance.fClusPhi ),
73  fClusTheta( theDistance.fClusTheta )
74 {
75 }
76 //--------------
77 // Destructor --
78 //--------------
79 
81 {
82  delete fClusterLocation;
83  delete fShowerMaxLocation;
84 }
85 
86 //-------------
87 // Methods --
88 //-------------
89 
90 Double_t
92 
93  TVector3 digiWhere(theDigi->where());
94  TVector3 vecDigiWhere(digiWhere.x(), digiWhere.y(), digiWhere.z());
95 
97  PndEmcXtal *theXtalGeom = tciXtalMap.find(theDigi->GetTCI())->second;
98 
99 
100  const TVector3 digiNormal = theXtalGeom->normalToFrontFace();
101 
102  Double_t normalProduct = fTheNormalToFrontFace->Dot(digiNormal);
103 
104  Double_t distToFF = fTheNormalToFrontFace->Dot(vecDigiWhere);
105 
106  Double_t digiDepth = (fDistanceOfPlane - distToFF)/normalProduct;
107 
108  TVector3 digiPerp(vecDigiWhere + digiDepth*digiNormal - *(fShowerMaxLocation));
109 
110  return digiPerp.Mag();
111 
112 }
113 
114 Double_t
116 
117  TVector3 digiWhere(theDigi->where());
118  TVector3 vecDigiWhere(digiWhere.x(), digiWhere.y(), digiWhere.z());
119 
120  return fClusterLocation->Angle(vecDigiWhere);
121 }
122 
123 Double_t
125  Double_t phi = theDigi->GetPhi();
126  Double_t theta = theDigi->GetTheta();
127  Double_t phiDiff = phi - fClusPhi;
128  while( phiDiff> TMath::Pi() ) phiDiff -= 2*TMath::Pi();
129  while( phiDiff< -TMath::Pi() ) phiDiff += 2*TMath::Pi();
130 
131  Double_t thetaDiff = theta - fClusTheta;
132 
133  return sqrt(phiDiff*phiDiff + thetaDiff* thetaDiff);
134 }
135 
TVector3 where() const
represents the reconstructed hit of one emc crystal
Definition: PndEmcDigi.h:40
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
represents coordinates of one crystal
Definition: PndEmcXtal.h:36
stores crystal index coordinates (x,y) or (theta,phi)
Double_t AngularDistance(const PndEmcDigi *const) const
PndEmcClusterDistances(const PndEmcCluster &cluster, const TClonesArray *digiArray)
Double_t GetTheta() const
Definition: PndEmcDigi.h:101
const TVector3 & normalToFrontFace() const
Definition: PndEmcXtal.cxx:151
Double_t
const PndEmcTciXtalMap & GetTciXtalMap() const
a cluster (group of neighboring crystals) of hit emc crystals
Definition: PndEmcCluster.h:29
PndEmcTwoCoordIndex * locateIndex(double theta, double phi) const
Double_t GetPhi() const
Definition: PndEmcDigi.h:102
std::map< PndEmcTwoCoordIndex *, PndEmcXtal * > PndEmcTciXtalMap
Double_t AngularSeparation(const PndEmcDigi *const) const
virtual Double_t energy() const
ClassImp(PndAnaContFact)
const TVector3 & where() const
Definition: PndEmcDigi.h:111
Double_t theta() const
static PndEmcStructure * Instance()
Double_t Pi
Double_t phi() const
Double_t RadialDistance(const PndEmcDigi *const) const
PndEmcTwoCoordIndex * GetTCI() const
Definition: PndEmcDigi.cxx:216