StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTPCMuDst.cxx
1 // $Id: StjTPCMuDst.cxx,v 1.10 2012/12/23 16:48:18 pibero Exp $
2 #include "StjTPCMuDst.h"
3 
4 #include "StEventTypes.h"
5 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
6 
7 #include <mudst/StMuEmcPosition.h>
8 #include <StEmcUtil/geometry/StEmcGeom.h>
9 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
10 
11 #include <TVector3.h>
12 
13 #include "StMuDSTMaker/COMMON/StMuBTofHit.h"
14 
15 int StjTPCMuDst::currentVertexIndex() const
16 {
18 }
19 
20 void StjTPCMuDst::setVertexIndex(int i)
21 {
23 }
24 
25 int StjTPCMuDst::numberOfVertices() const
26 {
27  return StMuDst::numberOfPrimaryVertices();
28 }
29 
30 StjPrimaryVertex StjTPCMuDst::getVertex() const
31 {
33 
34  if (StMuPrimaryVertex* muVertex = StMuDst::primaryVertex()) {
35  vertex.mPosition = muVertex->position().xyz();
36  vertex.mPosError = muVertex->posError().xyz();
37  vertex.mVertexFinderId = muVertex->vertexFinderId();
38  vertex.mRanking = muVertex->ranking();
39  vertex.mNTracksUsed = muVertex->nTracksUsed();
40  vertex.mNBTOFMatch = muVertex->nBTOFMatch();
41  vertex.mNCTBMatch = muVertex->nCTBMatch();
42  vertex.mNBEMCMatch = muVertex->nBEMCMatch();
43  vertex.mNEEMCMatch = muVertex->nEEMCMatch();
44  vertex.mNCrossCentralMembrane = muVertex->nCrossCentralMembrane();
45  vertex.mSumTrackPt = muVertex->sumTrackPt();
46  vertex.mMeanDip = muVertex->meanDip();
47  vertex.mChiSquared = muVertex->chiSquared();
48  vertex.mRefMultPos = muVertex->refMultPos();
49  vertex.mRefMultNeg = muVertex->refMultNeg();
50  vertex.mRefMultFtpcEast = muVertex->refMultFtpcEast();
51  vertex.mRefMultFtpcWest = muVertex->refMultFtpcWest();
52  }
53 
54  return vertex;
55 }
56 
57 StjTrackList StjTPCMuDst::getTrackList()
58 {
59  StjTrackList ret;
60 
61  int nTracks = StMuDst::numberOfPrimaryTracks();
62 
63  double magneticField = StMuDst::event()->magneticField()/10.0; // Tesla
64  for(int i = 0; i < nTracks; ++i) {
65  const StMuTrack* mutrack = StMuDst::primaryTracks(i);
66 
67  if(mutrack->flag() < 0) continue;
68 
69  if(mutrack->topologyMap().trackFtpcEast() || mutrack->topologyMap().trackFtpcWest()) continue;
70 
71  StjTrack track = createTrack(mutrack, i, magneticField);
72 
73  ret.push_back(track);
74  }
75 
76  return ret;
77 }
78 
79 StjTrack StjTPCMuDst::createTrack(const StMuTrack* mutrack, int i, double magneticField)
80 {
82 
83  track.runNumber = StMuDst::event()->runId();
84  track.eventId = StMuDst::event()->eventId();
85  track.detectorId = kTpcId;
86 
87  TVector3 p(mutrack->momentum().x(), mutrack->momentum().y(), mutrack->momentum().z());
88 
89 
90  track.pt = p.Pt();
91  track.eta = p.Eta();
92  track.phi = p.Phi();
93  track.flag = mutrack->flag();
94  track.nHits = mutrack->nHits();
95  track.charge = mutrack->charge();
96  track.nHitsPoss = mutrack->nHitsPoss();
97  track.nHitsDedx = mutrack->nHitsDedx();
98  track.nHitsFit = mutrack->nHitsFit();
99  track.nSigmaPion = mutrack->nSigmaPion();
100  track.nSigmaKaon = mutrack->nSigmaKaon();
101  track.nSigmaProton = mutrack->nSigmaProton();
102  track.nSigmaElectron = mutrack->nSigmaElectron();
103  track.Tdca = mutrack->dcaGlobal().mag();
104  track.dcaX = mutrack->dcaGlobal().x();
105  track.dcaY = mutrack->dcaGlobal().y();
106  track.dcaZ = mutrack->dcaZ();
107  track.dcaD = mutrack->dcaD();
108  track.chi2 = mutrack->chi2();
109  track.chi2prob = mutrack->chi2prob();
110  track.BField = magneticField;
111 
112  track.btofTrayId = -999;
113  // Getting BTOF TrayID
114  if(mutrack->index2BTofHit()>=0) { // to make sure that there is a BTOF hit
115  track.btofTrayId = mutrack->tofHit()->tray();
116  }
117  track.nSigmaTofPion = mutrack->btofPidTraits().sigmaPion();
118  track.nSigmaTofKaon = mutrack->btofPidTraits().sigmaKaon();
119  track.nSigmaTofProton = mutrack->btofPidTraits().sigmaProton();
120  track.nSigmaTofElectron = mutrack->btofPidTraits().sigmaElectron();
121 
122  // The optimum BEMC radius to use in extrapolating the track was determined to be 238.6 cm
123  // (slightly behind the shower max plane) in Murad Sarsour's electron jets analysis.
124  // http://cyclotron.tamu.edu/star/2006Jets/nov27_2007/details.html
125 
126  track.bemcRadius = 238.6; // cm
127 
128  StThreeVectorF vertex = StMuDst::primaryVertex()->position();
129  track.vertexZ = vertex.z();
130 
131  StThreeVectorD momentumAt, positionAt;
132  StMuEmcPosition EmcPosition;
133 
134  if (EmcPosition.trackOnEmc(&positionAt, &momentumAt, mutrack, magneticField, track.bemcRadius))
135  {
136  track.exitDetectorId = kBarrelEmcTowerId;
137  track.exitEta = positionAt.pseudoRapidity();
138  track.exitPhi = positionAt.phi();
139  StEmcGeom::instance("bemc")->getId(track.exitPhi, track.exitEta, track.exitTowerId);
140  }
141  else if (EmcPosition.trackOnEEmc(&positionAt, &momentumAt, mutrack, magneticField, kEEmcZSMD))
142  {
143  track.exitDetectorId = kEndcapEmcTowerId;
144  track.exitEta = positionAt.pseudoRapidity();
145  track.exitPhi = positionAt.phi();
146  int sector, subsector, etabin;
147  EEmcGeomSimple::Instance().getTower(positionAt.xyz(),sector,subsector,etabin);
148  track.exitTowerId = sector*60+subsector*12+etabin;
149  }
150  else
151  {
152  track.exitDetectorId = -999;
153  track.exitEta = -999;
154  track.exitPhi = -999;
155  track.exitTowerId = -999;
156  }
157 
158  track.dEdx = mutrack->dEdx();
159  track.beta = mutrack->globalTrack() ? mutrack->globalTrack()->btofPidTraits().beta() : 0;
160  track.trackIndex = i;
161  track.id = mutrack->id();
162  track.idTruth = mutrack->idTruth();
163  track.qaTruth = mutrack->qaTruth();
164  track.firstPoint = mutrack->firstPoint().xyz();
165  track.lastPoint = mutrack->lastPoint().xyz();
166 
167  return track;
168 }
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
Definition: StMuDst.h:322
Double_t chi2prob() const
Returns probability of fit.
Definition: StMuTrack.h:252
static EEmcGeomSimple & Instance()
returns a reference to a static instance of EEmcGeomSimple
short id() const
Returns the track id(or key), is unique for a track node, i.e. global and primary tracks have the sam...
Definition: StMuTrack.h:228
UShort_t nHitsDedx() const
Return number of hits used for dEdx.
Definition: StMuTrack.h:238
Float_t dcaZ(Int_t vtx_id=-1) const
Z component of global DCA.
Definition: StMuTrack.cxx:351
Double_t chi2() const
Returns chi2 of fit.
Definition: StMuTrack.h:251
UShort_t nHitsFit() const
Return total number of hits used in fit.
Definition: StMuTrack.h:239
short flag() const
Returns flag, (see StEvent manual for type information)
Definition: StMuTrack.h:230
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
Double_t nSigmaPion() const
Returns Craig&#39;s distance to the calculated dE/dx band for pions in units of sigma.
Definition: StMuTrack.h:245
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
Definition: StMuTrack.h:261
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
Double_t nSigmaElectron() const
Returns Craig&#39;s distance to the calculated dE/dx band for electrons in units of sigma.
Definition: StMuTrack.h:244
UShort_t nHitsPoss() const
Return number of possible hits on track.
Definition: StMuTrack.cxx:242
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:260
bool trackOnEEmc(StThreeVectorD *position, StThreeVectorD *momentum, const StMuTrack *track, double magField=0.5, double z=kEEmcZSMD) const
Project track into EEMC at SMD depth (magnetic field must be in Tesla)
UShort_t nHits() const
Bingchu.
Definition: StMuTrack.h:237
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
Definition: StMuTrack.h:262
Double_t dEdx() const
Returns measured dE/dx value.
Definition: StMuTrack.h:248
Double_t nSigmaProton() const
Returns Craig&#39;s distance to the calculated dE/dx band for protons in units of sigma.
Definition: StMuTrack.h:247
float sigmaElectron() const
PID functions.
bool getTower(const TVector3 &r, int &sec, int &sub, int &etabin, Float_t &dphi, Float_t &deta) const
Float_t dcaD(Int_t vtx_id=-1) const
Signed radial component of global DCA (projected)
Definition: StMuTrack.cxx:332
static Int_t currentVertexIndex()
Get the index number of the current primary vertex.
Definition: StMuDst.h:260
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
Definition: StMuTrack.h:272
StThreeVectorF dcaGlobal(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex of associated global track.
Definition: StMuTrack.cxx:371
Double_t nSigmaKaon() const
Returns Craig&#39;s distance to the calculated dE/dx band for kaons in units of sigma.
Definition: StMuTrack.h:246
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
Definition: StMuDst.cxx:273
StTrackTopologyMap topologyMap() const
Returns topology map.
Definition: StMuTrack.h:254
bool trackOnEmc(StThreeVectorD *, StThreeVectorD *, const StMuTrack *, double, double=225.405)
StjTrack projection utility.