StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StL3RareTrack.cxx
1 //
2 // StL3RareTrack.cxx
3 //
4 // Christof struck
5 //
6 // -------------------------------------------
7 
8 #include "StL3RareTrack.h"
9 #include "Rtypes.h"
10 #include "StEventTypes.h"
11 
12 double dEdx_formula(double momentum, double mass);
13 
14 ClassImp(StL3RareTrack)
15 
17 {
18  mDca2d = 0;
19  mNPntpossible = 0;
20  mTracknumber = 0;
21  mFlag = 0;
22  mNPntfit = 0;
23  mChisqXY = 0;
24  mChisqSZ = 0;
25  mPx = 0;
26  mPy = 0;
27  mPz = 0;
28  mChargesign = 0;
29  mTrigType = 0;
30  mDedx = 0.0;
31 }
32 
33 
34 StL3RareTrack::StL3RareTrack(StGlobalTrack* track)
35 {
36  mDca2d = track->impactParameter();
37  mNPntpossible = track->numberOfPossiblePoints();
38  mTracknumber = track->key();
39  mFlag = track->flag();
40  mNPntfit = track->detectorInfo()->numberOfPoints();
41  mChisqXY = track->fitTraits().chi2(0)/mNPntfit;
42  mChisqSZ = track->fitTraits().chi2(1)/mNPntfit;
43  mPx = track->geometry()->momentum().x();
44  mPy = track->geometry()->momentum().y();
45  mPz = track->geometry()->momentum().z();
46  mChargesign = track->geometry()->charge();
47  mTrigType = 0;
48  mDedx = 0.0;
49  mNDedx = 0;
50  StSPtrVecTrackPidTraits& traits = track->pidTraits();
51  StDedxPidTraits* dedxPidTr;
52  for (unsigned int itrait = 0; itrait < traits.size(); itrait++){
53  dedxPidTr = 0;
54  if (traits[itrait]->detector() == kTpcId) {
55  StTrackPidTraits* thisTrait = traits[itrait];
56  dedxPidTr = dynamic_cast<StDedxPidTraits*>(thisTrait);
57  if (dedxPidTr && dedxPidTr->method() == kTruncatedMeanId) {
58  // adjust dE/dx by a factor of 2 to match offline
59  mDedx = 2 * dedxPidTr->mean();
60  mNDedx = dedxPidTr->numberOfPoints();
61  }
62  }
63  }
64 
65 }
66 
67 
68 float StL3RareTrack::dedxExpected(float mass, float charge) const {
69  float real_mom = p()*charge;
70  float dedx = charge*charge*dEdx_formula(real_mom,mass);
71  return dedx;
72 }
73 
74 void StL3RareTrack::SetTrigType(int type) {mTrigType = type;}