StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcPoint.cxx
1 
11 #include "StEEmcPoint.h"
12 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
13 #include <iostream>
14 
15 #include "StEvent/StEmcPoint.h"
16 
17 ClassImp(StEEmcPoint);
18 
19 // ----------------------------------------------------------------------------
20 StEEmcPoint::StEEmcPoint()
21  : TObject()
22 {
23  mEmcPoint=0;
24  mRelatives=999;
25  for ( Int_t i=0;i<4;i++ ) mEnergy[i]=0.;
26  mResidueU=0.;
27  mResidueV=0.;
28  StEEmcClusterVec_t temp;
29  for ( Int_t i=0;i<4;i++ ) mTowerClusters.push_back(temp);
30  mKey=-1; // default invalid key
31 }
32 
33 // ----------------------------------------------------------------------------
34 StEEmcPoint::StEEmcPoint( const StEEmcPoint &p )
35  : TObject(p)
36 {
37 
38  mPosition = p.mPosition;
39  for ( Int_t i = 0; i < 4; i++ )
40  mEnergy[i] = p.mEnergy[i];
41  mFraction = p.mFraction;
42  mTowers = p.mTowers;
43  mWeights = p.mWeights;
44  mSmdClusters[0] = p.mSmdClusters[0];
45  mSmdClusters[1] = p.mSmdClusters[1];
46  mEmcPoint = p.mEmcPoint;
47  mRelatives = p.mRelatives;
48  mTowerClusters = p.mTowerClusters;
49 
50  mSector = p.mSector;
51  mSigma = p.mSigma;
52  mU = p.mU;
53  mV = p.mV;
54 
55  mResidueU = p.mResidueU;
56  mResidueV = p.mResidueV;
57 
58  mKey=p.mKey;
59 
60 }
61 
62 // ----------------------------------------------------------------------------
64 {
65 
67 
68  mEmcPoint = new StEmcPoint();
69  mEmcPoint->setEnergy( energy() );
70  mEmcPoint->setPosition( position );
71 
74  StThreeVectorF error( 1.0, 1.0, 1.0 );
75  mEmcPoint->setPositionError( error );
76 
80  mEmcPoint->addCluster( kEndcapEmcTowerId, 0 );
81 
82  mEmcPoint->addCluster( kEndcapSmdUStripId, mSmdClusters[0].stemc() );
83  mEmcPoint->addCluster( kEndcapSmdVStripId, mSmdClusters[1].stemc() );
84 
85  return mEmcPoint;
86 
87 }
88 
89 // --------------------------------------------------------------------------
90 Bool_t StEEmcPoint::chiSquare( const StEEmcPoint &other ) const
91 {
92 
95 
96  Float_t myChi2 = ( mSmdClusters[0].energy() - mSmdClusters[1].energy() );
97  myChi2 *= myChi2;
98 
99  Float_t otherChi2 = ( other.mSmdClusters[0].energy() - other.mSmdClusters[1].energy() );
100  otherChi2 *= otherChi2;
101 
102  return myChi2 < otherChi2;
103 
104 }
105 
106 // ----------------------------------------------------------------------------
107 void StEEmcPoint::print() const
108 {
109 
110  std::cout << "---------------------------------" << std::endl;
111  std::cout << " X=" << mPosition.X()
112  << " Y=" << mPosition.Y()
113  << " energy: T=" << mEnergy[0] << " P=" << mEnergy[1] << " Q=" << mEnergy[2] << " R=" << mEnergy[3]
114  << " frac=" << mFraction
115  << std::endl;
116 
117  for ( UInt_t i=0; i<mTowers.size(); i++ )
118  mTowers[i].print();
119 
120  for (UInt_t l = 0;l <= 3;l++) {
121  const StEEmcClusterVec_t &v = clusters(l);
122  std::cout << "layer " << l << ": # clusters " << v.size() << std::endl;
123  for (UInt_t i = 0;i < v.size();i++) {
124  const StEEmcCluster &c = v[i];
125  std::cout << "layer " << l << ", cluster " << i << std::endl;
126  c.print();
127  }
128  }
129 
130  std::cout << "ucluster:" << std::endl;
131  mSmdClusters[0].print();
132  std::cout << "vcluster:" << std::endl;
133  mSmdClusters[1].print();
134 
135 }
Base class for representing EEMC points.
Definition: StEEmcPoint.h:24
Bool_t chiSquare(const StEEmcPoint &other) const
Chi2 sort method.
Definition: StEEmcPoint.cxx:90
StEEmcTowerVec_t mTowers
Definition: StEEmcPoint.h:169
StEEmcSmdCluster mSmdClusters[2]
Smd clusters associated with this point.
Definition: StEEmcPoint.h:162
Float_t mSigma
Width.
Definition: StEEmcPoint.h:151
void print() const
Prints cluster data.
Float_t mFraction
...
Definition: StEEmcPoint.h:146
StEmcPoint * mEmcPoint
Pointer to corresponding StEmcPoint (StEvent only)
Definition: StEEmcPoint.h:177
Float_t mResidueU
Residual in U.
Definition: StEEmcPoint.h:157
std::vector< StEEmcClusterVec_t > mTowerClusters
Tower clusters in each layer.
Definition: StEEmcPoint.h:165
void print() const
print
Int_t mRelatives
Number of points which share tower energy with this point.
Definition: StEEmcPoint.h:174
Float_t mU
Mean U.
Definition: StEEmcPoint.h:153
TVector3 mPosition
Position of the point.
Definition: StEEmcPoint.h:142
std::vector< Float_t > mWeights
Vector of weights.
Definition: StEEmcPoint.h:171
Float_t mEnergy[4]
Energy of the point.
Definition: StEEmcPoint.h:144
const TVector3 & position() const
Get the position of this point.
Definition: StEEmcPoint.h:60
A base class for describing clusters of EEMC towers.
Definition: StEEmcCluster.h:50
Float_t v() const
Returns mean V position.
Definition: StEEmcPoint.h:100
StEmcPoint * stemc()
Definition: StEEmcPoint.cxx:63
Float_t energy()
Get the energy of this point.
Definition: StEEmcPoint.h:39
Int_t mSector
Sector.
Definition: StEEmcPoint.h:149
Float_t mV
Mean V.
Definition: StEEmcPoint.h:155
Float_t mResidueV
Residual in V.
Definition: StEEmcPoint.h:159
StEEmcClusterVec_t & clusters(Int_t layer)
Returns tower clusters for the specified layer 0=T, 1=P, 2=Q, 3=R, 4+=crash.
Definition: StEEmcPoint.h:53