StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFmsPointPair.cxx
1 /***************************************************************************
2  *
3  * $Id: StFmsPointPair.cxx,v 2.4 2017/11/20 20:01:49 smirnovd Exp $
4  *
5  * Author: Akio Ogawa, Sep 2015
6  ***************************************************************************
7  *
8  * Description: Implementation of StFmsPointPair
9  *
10  ***************************************************************************
11  *
12  * $Log: StFmsPointPair.cxx,v $
13  * Revision 2.4 2017/11/20 20:01:49 smirnovd
14  * Remove StRoot/ from included header prefix
15  *
16  * Revision 2.3 2017/02/20 16:32:58 ullrich
17  * Changing F to D for StLorentzVector
18  *
19  * Revision 2.2 2015/10/21 14:52:54 ullrich
20  * Added methods x() and y()
21  *
22  * Revision 2.1 2015/09/14 16:15:50 ullrich
23  * Initial Revision.
24  *
25  *
26  ***************************************************************************/
27 #include "StFmsPointPair.h"
28 #include "StFmsPoint.h"
29 #include "St_base/StMessMgr.h"
30 #include "TMath.h"
31 
32 static const char rcsid[] = "$Id: StFmsPointPair.cxx,v 2.4 2017/11/20 20:01:49 smirnovd Exp $";
33 
34 StFmsPointPair::StFmsPointPair() : mFpsPid(0), mConeRadius{0.100, 0.070, 0.030}
35 {
36  memset(mConeEnergy,0,sizeof(mConeEnergy));
37  mFourMomentum.setPx(0.0);
38  mFourMomentum.setPy(0.0);
39  mFourMomentum.setPz(0.0);
40  mFourMomentum.setE(0.0);
41 }
42 
43 StFmsPointPair::StFmsPointPair(StFmsPoint* p) : StFmsPointPair() {
44  addPoint(p);
45 }
46 
47 StFmsPointPair::StFmsPointPair(StFmsPoint* p1, StFmsPoint* p2) : StFmsPointPair() {
48  addPoint(p1);
49  addPoint(p2);
50 }
51 
52 StFmsPointPair::~StFmsPointPair() { /* no op */ }
53 
54 void StFmsPointPair::addPoint(StFmsPoint* p) {
55  mPoints.push_back(p);
56  mFourMomentum = mFourMomentum + StLorentzVectorD((double)p->fourMomentum().x(),
57  (double)p->fourMomentum().y(),
58  (double)p->fourMomentum().z(),
59  (double)p->fourMomentum().e());
60  mFpsPid += (p->fpsPid()/10)*pow(10,nPoints()-1);
61 }
62 
63 StFmsPoint* StFmsPointPair::point(int v) {
64  if (v>=0 && v<nPoints()) return mPoints[v];
65  return 0;
66 }
67 
68 //hack need to expand for n>2
69 float StFmsPointPair::x() const {
70  return
71  (mPoints[0]->XYZ().x() * mPoints[0]->energy() +
72  mPoints[1]->XYZ().x() * mPoints[1]->energy() ) /
73  (mPoints[0]->energy() + mPoints[1]->energy());
74 }
75 
76 //hack need to expand for n>2
77 float StFmsPointPair::y() const {
78  return
79  (mPoints[0]->XYZ().y() * mPoints[0]->energy() +
80  mPoints[1]->XYZ().y() * mPoints[1]->energy() ) /
81  (mPoints[0]->energy() + mPoints[1]->energy());
82 }
83 
84 float StFmsPointPair::dgg() const {
85  if (nPoints()!=2) return -1.0;
86  return (mPoints[0]->XYZ() - mPoints[1]->XYZ()).mag();
87 }
88 
89 float StFmsPointPair::zgg() const {
90  if (nPoints()!=2) return -1.0;
91  float e1=mPoints[0]->energy();
92  float e2=mPoints[1]->energy();
93  return fabs(e1-e2)/(e1+e2);
94 }
95 
96 float StFmsPointPair::coneRadius(int cone) const {
97  if (cone>=0 && cone<kFmsPointMaxCone) return mConeRadius[cone];
98  return 0.0;
99 }
100 
101 float StFmsPointPair::coneEnergy(int cone) const {
102  if (cone>=0 && cone<kFmsPointMaxCone) return mConeEnergy[cone];
103  return 0.0;
104 }
105 
106 float StFmsPointPair::coneEnergyFraction(int cone) const {
107  if (cone>=0 && cone<kFmsPointMaxCone && mConeEnergy[cone]>0.0) return energy()/mConeEnergy[cone];
108  return -1.0;
109 }
110 
111 void StFmsPointPair::setConeEnergy(int cone, float energy) {
112  if (cone>=0 && cone<kFmsPointMaxCone)
113  mConeEnergy[cone]=energy;
114 }
115 
116 void StFmsPointPair::print(int opt) {
117  cout << Form("StFmsPointPair: N=%3d E=%6.1f pT=%6.2f eta=%6.2f Zgg=%6.3f Dgg=%7.3f M=%6.3f ",
118  nPoints(),energy(),pT(),eta(),zgg(),dgg(),mass());
119  for(int cone=0; cone<kFmsPointMaxCone; cone++) {
120  cout << Form("R%d=%6.3f ", int(coneRadius(cone)*1000.0+0.5),coneEnergyFraction(cone));
121  }
122  cout << Form("PID=%d PointId: ",fpsPid());
123  for(int i=0; i<nPoints(); i++) {
124  cout << Form("%3d ",mPoints[i]->id());
125  }
126  cout << endl;
127 }