StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRareTrack.cxx
1 #include "StRareTrack.h"
2 #include "StEventTypes.h"
3 #include "StMessMgr.h"
4 double dEdx_formula(double momentum, double mass);
5 ClassImp(StRareTrack)
6 
8 
9 StRareTrack::StRareTrack(StPrimaryTrack* track){
10  StGlobalTrack* gtrack = static_cast<StGlobalTrack*>((StTrack*)track);
11  fdca = gtrack->impactParameter();
12  fnpntpossible = track->numberOfPossiblePoints();
13  ftracknumber = track->key();
14  fiflag = track->flag();
15  fchisqxy = track->fitTraits().chi2(0);
16  fchisqz = track->fitTraits().chi2(1);
17  fnpntfit = track->fitTraits().numberOfFitPoints();
18  fpx = track->geometry()->momentum().x();
19  fpy = track->geometry()->momentum().y();
20  fpz = track->geometry()->momentum().z();
21  fchargesign = track->geometry()->charge();
22  ftrigtype = 0;
23  fdedx = 0.0;
24  fndedx = 0;
25  StSPtrVecTrackPidTraits& traits=track->pidTraits();
26  StDedxPidTraits* dedxPidTr;
27  for (unsigned int itrait = 0; itrait < traits.size(); itrait++){
28  dedxPidTr = 0;
29  if (traits[itrait]->detector() == kTpcId) {
30  StTrackPidTraits* thisTrait = traits[itrait];
31  dedxPidTr = dynamic_cast<StDedxPidTraits*>(thisTrait);
32  if (dedxPidTr && dedxPidTr->method() == kTruncatedMeanId) {
33  fdedx = 1e6*dedxPidTr->mean();
34  fndedx = dedxPidTr->numberOfPoints();
35  }
36  }
37  }
38 
39 }
40 
41 float StRareTrack::dedxExpected(float mass, float charge) const {
42  float real_mom = p()*charge;
43  float dedx = charge*charge*dEdx_formula(real_mom,mass);
44  return dedx;
45 }
46 
47 void StRareTrack::SetTrigType(int type) {ftrigtype = type;}