StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructMuDstReader.cxx
1 /**********************************************************************
2  *
3  * $Id: StEStructMuDstReader.cxx,v 1.20 2012/11/16 21:19:07 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: event reader class for common MuDsts
10  * Uses the StMuDstMaker for real reading
11  *
12  ***********************************************************************/
13 #include "StEStructMuDstReader.h"
14 
15 #include "StEStructEventCuts.h"
16 #include "StEStructTrackCuts.h"
17 #include "StEStructPool/EventMaker/StEStructEvent.h"
18 #include "StEStructPool/EventMaker/StEStructTrack.h"
19 #include "StEStructPool/EventMaker/StEStructCentrality.h"
20 #include "StBTofPidTraits.h"
21 #include "StMuDSTMaker/COMMON/StMuBTofPidTraits.h"
22 
23 
24 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
25 #include "StMuDSTMaker/COMMON/StMuDst.h"
26 #include "StMuDSTMaker/COMMON/StMuEvent.h"
27 #include "StMuDSTMaker/COMMON/StMuTrack.h"
28 #include "StDetectorId.h"
29 
30 
31 StEStructMuDstReader::StEStructMuDstReader() {
32  mhasdEdxCuts = 0;
33  mhasToFCuts = 0;
34  mhasPrimaryCuts = 0;
35  mhasVertexRadiusCuts = 0;
36  mMaker = 0;
37  mECuts = 0;
38  mTCuts = 0;
39  mInChain = false;
40  mAmDone = false;
41  mUseGlobalTracks=false;
42  mPileup = new Pileup();
43 };
44 StEStructMuDstReader::StEStructMuDstReader(StMuDstMaker* maker,
45  StEStructEventCuts* ecuts,
46  StEStructTrackCuts* tcuts) {
47  mhasdEdxCuts = 0;
48  mhasToFCuts = 0;
49  mhasPrimaryCuts = 0;
50  mhasVertexRadiusCuts = 0;
51  mMaker = maker;
52  setEventCuts(ecuts);
53  setTrackCuts(tcuts);
54  mInChain = false;
55  mAmDone = false;
56  mUseGlobalTracks=false;
57  mPileup = new Pileup();
58 };
59 
60 //-------------------------------------------------------------------------
61 StEStructMuDstReader::~StEStructMuDstReader() {
62  delete mPileup;
63 };
64 
65 void StEStructMuDstReader::setMuDstMaker(StMuDstMaker* maker, bool inChain){
66  mInChain=inChain;
67  mMaker=maker;
68 };
69 
70 void StEStructMuDstReader::setEventCuts(StEStructEventCuts* ecuts) {
71  mECuts=ecuts;
72  if (!mECuts->doFillHists()) {
73  return;
74  }
75  // I want to create histograms for trigger ids here.
76  // However, I need an StMuEvent which I think I don't have until fillEvent.
77  // Create histograms there.
78  // Histograms for ToF cuts.
79  //>>>>>>>>>> Need to figure out where to fill these, and how to write them out.
80  if ( mECuts->hasToFFractionCut() ) {
81  mhasToFCuts = 1;
82  ToFBefore = new TH2F("dEdxToFNoCut2D","dEdxToFNoCut2D",50,1,1000,50,1,750);
83  ToFAfter = new TH2F("dEdxToFCut2D","dEdxToFCut2D",50,1,1000,50,1,750);
84  mECuts->addCutHists(ToFBefore, ToFAfter, "ToFPlots2D");
85  }
86  if ( mECuts->hasPrimaryFractionCut() ) {
87  mhasPrimaryCuts = 1;
88  PrimaryBefore = new TH2F("PrimVGlobNoCut2D","PrimVGlobNoCut2D",120,1,1200,200,1,2000);
89  PrimaryAfter = new TH2F("PrimVGlobCut2D","PrimVGlobCut2D",120,1,1200,200,1,2000);
90  mECuts->addCutHists(PrimaryBefore, PrimaryAfter, "PrimaryPlots2D");
91  }
92  if ( mECuts->hasPrimaryVertexRadiusCut() ) {
93  mhasVertexRadiusCuts = 1;
94  VRadiusBefore = new TH2F("VertexRadiusNoCut2D","VertexRadiusNoCut2D",50,-10,10,50,-10,10);
95  VRadiusAfter = new TH2F("VertexRadiusCut2D","VertexRadiusCut2D",50,-10,10,50,-10,10);
96  mECuts->addCutHists(VRadiusBefore, VRadiusAfter, "VertexRadiusPlots2D");
97  }
98 };
99 void StEStructMuDstReader::setTrackCuts(StEStructTrackCuts* tcuts) {
100  mTCuts=tcuts;
101  if (!mTCuts->doFillHists()) {
102  return;
103  }
104  if ( mTCuts->hasElectronCut() ) {
105  mhasdEdxCuts = 1;
106  dEdxBefore = new TH2F("dEdxNoCut2D","dEdxNoCut2D",150,-1.5,1.5,150,0,0.000015);
107  dEdxAfter = new TH2F("dEdxCut2D","dEdxCut2D",150,-1.5,1.5,150,0,0.000015);
108  mTCuts->addCutHists(dEdxBefore, dEdxAfter, "dEdxPlots2D");
109  }
110  dEdxBetaBefore = new TH3F("dEdxBetaNoCut3D","dEdxBetaNoCut3D",100,-2.0,2.0,100,0.0000015,0.000006,100,0.55,1.05);
111  dEdxBetaAfter = new TH3F("dEdxBetaCut3D","dEdxBetaCut3D",100,-2.0,2.0,100,0.0000015,0.000006,100,0.55,1.05);
112  mTCuts->addCutHists(dEdxBetaBefore, dEdxBetaAfter, "dEdxBetaPlots3D");
113 };
114 void StEStructMuDstReader::setUseGlobalTracks(bool global) {
115  mUseGlobalTracks=global;
116 };
117 
118 inline bool StEStructMuDstReader::setInChain(bool inChain) {
119  mInChain = inChain;
120  return mInChain;
121 };
122 inline bool StEStructMuDstReader::InChain(){ return mInChain; };
123 bool StEStructMuDstReader::hasMaker() { return (mMaker) ? true : false ; }
124 
125 
126 //-------------------------------------------------------------------------
127 StEStructEvent* StEStructMuDstReader::next() {
128 
129  StEStructEvent* retVal=NULL;
130  if(!mMaker) return retVal;
131  if(!mInChain){ // no chain to call Make()
132  int iret=mMaker->Make();
133  if(iret){
134  mAmDone=true;
135  return retVal;
136  }
137  }
138  if(!mMaker->muDst()) return retVal;
139  return fillEvent();
140 }
141 
142 //-------------------------------------------------------------------------
143 // Feb 14, 2006 djp Expunging all references to refMult that is stored in
144 // the MuDst. centrality cut will now always be on total
145 // number of tracks passing track cuts for MuDst. For
146 // Hijing this cut can be on number of tracks passing cuts
147 // or impact parameter.
148 // Apr 12, 2005 djp Jeff put centrality cuts into the event cuts and
149 // cut on refMult. I am changing this to use the
150 // centrality bin returned by the centrality object.
151 // This allows me to use total number of tracks passing cuts
152 // if I choose.
153 // The problem is that to use all tracks passing cuts we have to count tracks
154 // before we determine the centrality bin. Probably this amount of time is
155 // small compared to rest of analysis.
156 StEStructEvent* StEStructMuDstReader::fillEvent(){
157 
158  StEStructEvent* retVal = NULL;
159  StMuDst* muDst=mMaker->muDst();
160  StMuEvent* muEvent=muDst->event();
161  if(!muEvent) return retVal;
162 
163  retVal=new StEStructEvent();
164 
165  mNumGoodTracks = 0;
166 
167  float x;
168  float y;
169  float z;
170  bool useEvent = true;
171 
172  // Note: Recommended primary vertex cuts are made in StEStructEventCuts.h
173  x = muEvent->eventSummary().primaryVertexPosition().x();
174  y = muEvent->eventSummary().primaryVertexPosition().y();
175  z = muEvent->eventSummary().primaryVertexPosition().z();
176  int nMultVertex = 0;
177  if (muEvent->eventSummary().numberOfVertices()>1) {
178  nMultVertex++;
179  }
180 
181  // goodTrigger (currently) does a topological cut on vertex shape of the "current" primary vertex.
182  // Need to require tracks are associated with this vertex.
183  // Unless someone redefines the currentVertexIndex it will be set to 0 and the dca cuts should
184  // remove all tracks we don't want.
185  int good = 0;
186  mPrimaryVertexId = muDst->currentVertexIndex();
187  if ((fabs(x) < 1e-5) && (fabs(y) < 1e-5) && (fabs(z) < 1e-5)) {
188  useEvent = false;
189  } else if ( !mECuts->goodTrigger(muDst) ||
190  !mECuts->goodPrimaryVertexZ(z) ) {
191  useEvent = false;
192  } else {
193  good++;
194  }
195  if (!mECuts->goodPrimaryVertexRadius(sqrt(x*x+y*y))) {
196  useEvent = false;
197  }
198  StBTofHeader* btofHeader = muDst->btofHeader();
199  float vpdZ = 0;
200  if (btofHeader) {
201  vpdZ = btofHeader->vpdVz();
202  if (!mECuts->goodVPDVertex(z-vpdZ)) {
203  useEvent = false;
204  }
205  }
206 
207  int ndEdx = 0;
208  int nToF = 0;
209  int nTracks = countGoodTracks(&ndEdx, &nToF);
210  if (!mECuts->goodToFFraction(ndEdx, nToF)) {
211  useEvent = false;
212  }
213  int nGlobal = muDst->globalTracks()->GetEntries();
214  int nPrimary = muDst->primaryTracks()->GetEntries();
215  if (!mECuts->goodPrimaryFraction(nPrimary, nGlobal)) {
216  useEvent = false;
217  }
218 
219 // Feb2006 rjp ........
220 // currently for MuDst's all we have for centrality is NTracks
221 // if/when this changes and for EventGenerator readers, we will
222 // wrap these via .... if(cent->getCentType()==ESNTracks){....
223 //
224 
225  retVal->SetCentrality((double)nTracks);
226  if(!mECuts->goodCentrality(retVal->Centrality())) useEvent=false;
227 
228  retVal->SetRefMult( muEvent->refMult() );
229  retVal->SetctbMult( muEvent->ctbMultiplicity() );
230  retVal->SetNumPrim( muEvent->eventSummary().numberOfGoodPrimaryTracks() );
231 
232  if(useEvent){
233 
234  retVal->SetEventID(muEvent->eventNumber());
235  retVal->SetRunID(muEvent->runNumber());
236  retVal->SetVertex(x,y,z);
237  retVal->SetZDCe((float)muEvent->zdcAdcAttentuatedSumEast());
238  retVal->SetZDCw((float)muEvent->zdcAdcAttentuatedSumWest());
239  // I think this zdc coincidence rate is one number for the event
240  // Don't know how to get rate at time of event.
241  // Actually, in old runs this was true. Now it should be updated every
242  // 10 or 15 seconds throughout the run.
243  retVal->SetZDCCoincidence((float)muEvent->runInfo().zdcCoincidenceRate());
244  retVal->SetBField((float)muEvent->magneticField());
245 
246  if (!fillTracks(retVal)) useEvent=false;
247 
248  }
249 
250  // Fill (before) trigger information for this event
251  const StTriggerId& l0Nom = muEvent->triggerIdCollection().nominal();
252  int nTrig = 0;
253  for (unsigned int idx=0;idx<l0Nom.maxTriggerIds();idx++) {
254  if (0 == l0Nom.triggerId(idx)) {
255  break;
256  }
257  nTrig++;
258  }
259  for (int idx=0;idx<nTrig;idx++) {
260  mECuts->fillHistogram(mECuts->triggerWordName(),l0Nom.triggerId(idx),useEvent);
261  for (int idy=idx+1;idy<nTrig;idy++) {
262  mECuts->fillHistogram(mECuts->triggerWordName(),l0Nom.triggerId(idx),l0Nom.triggerId(idy),useEvent);
263  }
264  }
265  mECuts->fillHistogram(mECuts->primaryVertexZName(),z,useEvent);
266  if (btofHeader) {
267  mECuts->fillHistogram(mECuts->primaryVPDVertexName(),z-vpdZ,useEvent);
268  }
269  mECuts->fillHistogram(mECuts->centralityName(),(float)nTracks,useEvent);
270  mECuts->fillHistogram(mECuts->goodtoffractionName(),(float)ndEdx,(float)nToF,useEvent);
271 
272  mECuts->fillHistogram("ToFPlots",(double)ndEdx,(double)nToF,useEvent);
273  mECuts->fillHistogram("PrimaryPlots",(double)nPrimary,(double)nGlobal,useEvent);
274  mECuts->fillHistogram("VertexRadiusPlots",x,y,useEvent);
275 
276  // Two pileup cuts using my vertex finding.
277  // First we look for vertices which have tracks from only one side of TPC.
278  // Then we look for matching pileup vertices where one of them reconstructs near the primary vertex.
279  if (useEvent && mECuts->hasZVertMatchCut()) {
280  double zDist = 0; // Distance from z to nearest pileup half vertex.
281  int nPile = mPileup->find(muDst);
282  if ((nPile > 0) && (6 == mPileup->flag(0))) {
283  double zd1 = z - mPileup->z(0,2);
284  double zd2 = z - mPileup->z(0,3);
285  zDist = (fabs(zd1) < fabs(zd2)) ? zd1 : zd2;
286  if (!mECuts->goodZVertMatch(zDist)) {
287  useEvent = false;
288  }
289  mECuts->fillHistogram(mECuts->zVertMatchName(),zDist,useEvent);
290  }
291  }
292 
293  if (useEvent && mECuts->hasZVertSepCut()) {
294  double zDist; // Distance from z to nearest pileup vertex.
295  int mPile; // Multiplicity of nearest pileup vertex.
296  int nPile; // Total number of pileup vertices found (multiple of 2).
297  nPile = mPileup->nearest(muDst,z,&zDist,&mPile);
298  if (nPile > 0 && !mECuts->goodZVertSep(zDist)) {
299  useEvent = false;
300  }
301  mECuts->fillHistogram(mECuts->zVertSepName(),zDist,useEvent);
302  }
303 
304  if (!useEvent) {
305  delete retVal;
306  retVal=NULL;
307  }
308  if (retVal) retVal->FillChargeCollections(); //creates track list by charge
309 
310  return retVal;
311 }
312 
313 
314 //-------------------------------------------------------------
315 bool StEStructMuDstReader::fillTracks(StEStructEvent* estructEvent) {
316 
317  //
318  // create a single EbyE track, check cuts,
319  // fill variables, add to StEStructEvent tracks which
320  // does a copy.
321  //
322 
323  StMuDst* muDst=mMaker->muDst();
324  int numTracks;
325  if (mUseGlobalTracks) {
326  numTracks = muDst->globalTracks()->GetEntries();
327  } else {
328  numTracks = muDst->primaryTracks()->GetEntries();
329  }
330  if (0==numTracks) {
331  return false;
332  }
333 
334  StEStructTrack* eTrack = new StEStructTrack();
335  for(int i=0; i<numTracks; i++) {
336  bool useTrack=true;
337  eTrack->SetInComplete();
338  StMuTrack* track;
339  if (mUseGlobalTracks) {
340  track = muDst->globalTracks(i);
341  } else {
342  track = muDst->primaryTracks(i);
343  }
344  // Even global tracks are associated with a particular primary vertex (for calculating DCA).
345 // This check seems way too slow. See if we can get dca to calculate wrt mPrimaryVertex.
346 // if (track->vertexIndex() != mPrimaryVertexId) {
347 // continue;
348 // }
349 
350  float ptot = track->charge() * track->p().magnitude();
351  StMuBTofPidTraits dProb = track->btofPidTraits();
352  float beta = dProb.beta();
353 
354  useTrack = isTrackGoodToUse( track ); //this includes track kine cuts
355  mTCuts->fillHistograms(useTrack);
356 
357  mTCuts->fillHistogram("dEdxPlots",ptot,track->dEdx(),useTrack);
358  if (beta != 0) {
359  mTCuts->fillHistogram("dEdxBetaPlots",ptot,track->dEdx(),beta,useTrack);
360  }
361 
362  if (useTrack) {
363  fillEStructTrack(eTrack,track);
364  estructEvent->AddTrack(eTrack);
365  }
366  }
367  delete eTrack;
368  return true;
369 }
370 //-------------------------------------------------------------
371 // This method checks all track cuts.
372 // No histogramming or copying data around.
373 bool StEStructMuDstReader::isTrackGood(StMuTrack* track) {
374 
375  bool useTrack=true;
376 
377  // When using global tracks use the outerHelix to calculate eta, phi and dca.
378  Float_t mDCA;
379  if (mUseGlobalTracks) {
380  StMuDst* muDst=mMaker->muDst();
381  StMuEvent* muEvent=muDst->event();
382  const StThreeVectorF &pvert = muEvent->eventSummary().primaryVertexPosition();
383  StPhysicalHelixD helix = track->outerHelix();
384  double dist = helix.pathLength(pvert,false);
385  const StThreeVectorF &pos = helix.at(dist) - pvert;
386  const StThreeVectorF &dir = helix.cat(dist);
387 
388  mEta = dir.pseudoRapidity();
389  mPhi = dir.phi();
390  mDCA = pos.mag();
391  } else {
392  mEta = track->eta();
393  mPhi = track->phi();
394  mDCA = track->dcaGlobal(mPrimaryVertexId).magnitude();
395  }
396 
397  // Do eta cut first so my ThisCut can use the eta value.
398  useTrack = (mTCuts->goodEta(mEta) && useTrack);
399  useTrack = (mTCuts->goodFlag(track->flag()) && useTrack);
400  useTrack = (mTCuts->goodCharge(track->charge()) && useTrack);
401  useTrack = (mTCuts->goodNFitPoints(track->nHitsFit()) && useTrack);
402  useTrack = (mTCuts->goodNFitNMax((float)((float)track->nHitsFit()/(float)track->nHitsPoss())) && useTrack);
403  useTrack = (mTCuts->goodGlobalDCA(mDCA) && useTrack);
404  useTrack = (mTCuts->goodChi2(track->chi2()) && useTrack);
405  useTrack = (mTCuts->goodPhi(mPhi) && useTrack);
406  if(track->pt() < 0.15) useTrack = false; // basic pt cut, ranges checked in isTrackGoodToUse
407 
408 //>>>>> delta p_t / p_t cut. Make sure charge sign is well defined.
409 // Need P08 or later for this code.
410 // StMuDst* muDst=mMaker->muDst();
411 // int ic = track->index2Cov();
412 // if (ic > 0) {
413 // static StDcaGeometry *cov = muDst->covGlobTracks(ic);
414 // const float *err = cov->errMatrix();
415 // float dpTOverpT = sqrt(err[9])/track->pt(); //dpT/pT
416 // useTrack = (mTCuts->gooddPtByPt(dpTOverpT) && useTrack);
417 // }
418 //>>>>>
419 
420  //--> But add a quick electron removal... for selected p ranges
421  // Note I only want to do this if I am defining an electron dEdx cut.
422  if (mhasdEdxCuts && mTCuts->goodElectron( track->nSigmaElectron() ) && useTrack ) {
423  float p = (track->p()).mag();
424  if( (p>0.2 && p<0.45) || (p>0.7 && p<0.8) ) {
425  useTrack=false;
426  }
427  }
428  //--> end of electron pid
429 
430  // Try a mass cut using TOF to reject electrons.
431  // Expect TOF efficiency to be of order 60% but if we can get one of two that isn't bad.
432  // Do some QA plots before implementing. Probably end up with 1/beta and dEdx 2D cut.
433  //if (mTCuts->goodTOFEMass( track->Mass() ) && useTrack ) {
434  // useTrack=false;
435  //}
436 
437  return useTrack;
438 };
439 
440 //----includes call to isTrackGood ... and adds some more ....
441 bool StEStructMuDstReader::isTrackGoodToUse(StMuTrack* track){
442 
443  bool useTrack=isTrackGood(track);
444  if(useTrack){
445 
446  float pt = track->pt();
447  useTrack = (mTCuts->goodPt(pt) && useTrack);
448  float _r=pt/0.139;
449  float yt=log(sqrt(1+_r*_r)+_r);
450  useTrack = (mTCuts->goodYt(yt) && useTrack);
451  float mt = sqrt(pt*pt + 0.139*0.139);
452  float xt = 1 - exp( -1*(mt-0.139)/0.4 );
453  useTrack = (mTCuts->goodXt(xt) && useTrack);
454 
455  }
456  return useTrack;
457 };
458 
459 //-------------------------------------------------------------------------
460 //-------------------------------------------------------------
461 // This method counts all good track.
462 // No histogramming or copying data around.
463 int StEStructMuDstReader::countGoodTracks(int *ndEdx, int *nToF) {
464  mNumGoodTracks = 0;
465  int ndedx = 0;
466  int ntof = 0;
467  StMuDst* muDst=mMaker->muDst();
468  int numTracks;
469  if (mUseGlobalTracks) {
470  numTracks = muDst->globalTracks()->GetEntries();
471  } else {
472  numTracks = muDst->primaryTracks()->GetEntries();
473  }
474  if (0==numTracks) {
475  return 0;
476  }
477  // Want to compare pp analysis with |\eta| < 0.5 and |\eta| < 1.0
478  // countGoodTracks is used for centrality, so we change \eta cuts here
479  // (then change back at and)
480  // >>>>>Expect this code to normally be commented out.<<<<<
481 // double etaMin = mTCuts->meta[0];
482 // double etaMax = mTCuts->meta[1];
483 // mTCuts->meta[0] = -1;
484 // mTCuts->meta[1] = +1;
485 
486  for(int i=0; i<numTracks; i++) {
487  if (mUseGlobalTracks) {
488  if (isTrackGood(muDst->globalTracks(i))) {
489  mNumGoodTracks++;
490  if ((fabs(muDst->globalTracks(i)->nSigmaPion()) < 2) ||
491  (fabs(muDst->globalTracks(i)->nSigmaKaon()) < 2) ||
492  (fabs(muDst->globalTracks(i)->nSigmaProton()) < 2)) {
493  ndedx++;
494  }
495  StMuBTofPidTraits dProb = muDst->globalTracks(i)->btofPidTraits();
496  if ((fabs(dProb.sigmaPion()) < 2) ||
497  (fabs(dProb.sigmaKaon()) < 2) ||
498  (fabs(dProb.sigmaProton()) < 2)) {
499  ntof++;
500  }
501  }
502  } else {
503  if (isTrackGood(muDst->primaryTracks(i))) {
504  mNumGoodTracks++;
505  if ((fabs(muDst->primaryTracks(i)->nSigmaPion()) < 2) ||
506  (fabs(muDst->primaryTracks(i)->nSigmaKaon()) < 2) ||
507  (fabs(muDst->primaryTracks(i)->nSigmaProton()) < 2)) {
508  ndedx++;
509  }
510  StMuBTofPidTraits dProb = muDst->primaryTracks(i)->btofPidTraits();
511  if ((fabs(dProb.sigmaPion()) < 2) ||
512  (fabs(dProb.sigmaKaon()) < 2) ||
513  (fabs(dProb.sigmaProton()) < 2)) {
514  ntof++;
515  }
516  }
517  }
518  }
519  *ndEdx = ndedx;
520  *nToF = ntof;
521 // mTCuts->meta[0] = etaMin;
522 // mTCuts->meta[1] = etaMax;
523  return mNumGoodTracks;
524 }
525 
526 //-------------------------------------------------------------------------
527 void StEStructMuDstReader::fillEStructTrack(StEStructTrack* eTrack,StMuTrack* mTrack){
528 
529  StThreeVectorF p=mTrack->p();
530  eTrack->SetPx(p.x());
531  eTrack->SetPy(p.y());
532  eTrack->SetPz(p.z());
533 
534  StThreeVectorF b=mTrack->dca();
535  eTrack->SetBx(b.x());
536  eTrack->SetBy(b.y());
537  eTrack->SetBz(b.z());
538 
539  StThreeVectorF gb;
540  // In some productions we have dcaGlobal() = (0,0,0) for global tracks.
541  // dca() seems to be useful though.
542  if (mUseGlobalTracks) {
543 // gb = mTrack->dca();
544  gb = mTrack->dcaGlobal();
545  } else {
546  gb = mTrack->dcaGlobal();
547  }
548  if (0 == gb.x() && 0 == gb.y() && 0 == gb.z()) {
549  printf("Found track with dca = (0,0,0)\n");
550  }
551  eTrack->SetBxGlobal(gb.x());
552  eTrack->SetByGlobal(gb.y());
553  eTrack->SetBzGlobal(gb.z());
554 
555  eTrack->SetEta(mEta);
556  eTrack->SetPhi(mPhi);
557  eTrack->SetDedx(mTrack->dEdx());
558  eTrack->SetChi2(mTrack->chi2());
559  if (mUseGlobalTracks) {
560  eTrack->SetHelix(mTrack->outerHelix());
561  } else {
562  eTrack->SetHelix(mTrack->helix());
563  }
564 
565  //
566  // -> note in my analysis I chose nSigma instead of prob.
567  //
568  eTrack->SetPIDe_dEdx(mTrack->nSigmaElectron());
569  eTrack->SetPIDpi_dEdx(mTrack->nSigmaPion());
570  eTrack->SetPIDp_dEdx(mTrack->nSigmaProton());
571  eTrack->SetPIDk_dEdx(mTrack->nSigmaKaon());
572  eTrack->SetPIDd_dEdx(10000.);
573 
574 
575  StMuBTofPidTraits dProb = mTrack->btofPidTraits();
576  eTrack->SetPIDe_ToF(dProb.sigmaElectron());
577  eTrack->SetPIDpi_ToF(dProb.sigmaPion());
578  eTrack->SetPIDp_ToF(dProb.sigmaProton());
579  eTrack->SetPIDk_ToF(dProb.sigmaKaon());
580  eTrack->SetPIDd_ToF(999);
581  eTrack->SetBeta(dProb.beta());
582 
583  eTrack->SetNFitPoints(mTrack->nHitsFit());
584  eTrack->SetNFoundPoints(mTrack->nHits());
585  eTrack->SetNMaxPoints(mTrack->nHitsPoss());
586 
587  StTrackTopologyMap map = mTrack->topologyMap();
588 
589  eTrack->SetTopologyMapTPCNHits(map.numberOfHits(kTpcId));
590  eTrack->SetTopologyMapData(0,map.data(0));
591  eTrack->SetTopologyMapData(1,map.data(1));
592 
593  eTrack->SetDetectorID(1); //TPC
594  eTrack->SetFlag(mTrack->flag());
595  eTrack->SetCharge(mTrack->charge());
596 };
597 
598 
599 /***********************************************************************
600  *
601  * $Log: StEStructMuDstReader.cxx,v $
602  * Revision 1.20 2012/11/16 21:19:07 prindle
603  * Moved EventCuts, TrackCuts to EventReader. Affects most readers.
604  * Added support to write and read EStructEvents.
605  * Cuts: 3D histo support, switch to control filling of histogram for reading EStructEvents
606  * EventCuts: A few new cuts
607  * MuDstReader: Add 2D to some histograms, treat ToFCut, PrimaryCuts, VertexRadius histograms like other cut histograms.
608  * QAHists: Add refMult
609  * TrackCuts: Add some hijing cuts.
610  *
611  * Revision 1.19 2011/08/02 20:31:25 prindle
612  * Change string handling
613  * Added event cuts for VPD, good fraction of global tracks are primary, vertex
614  * found only from tracks on single side of TPC, good fraction of primary tracks have TOF hits..
615  * Added methods to check if cuts imposed
616  * Added 2010 200GeV and 62 GeV, 2011 19 GeV AuAu datasets, 200 GeV pp2pp 2009 dataset.
617  * Added TOF vs. dEdx vs. p_t histograms
618  * Fix participant histograms in QAHists.
619  * Added TOFEMass cut in TrackCuts although I think we want to supersede this.
620  *
621  * Revision 1.18 2010/09/02 21:20:09 prindle
622  * Cuts: Add flag to not fill histograms. Important when scanning files for sorting.
623  * EventCuts: Add radius cut on vertex, ToF fraction cut. Merge 2004 AuAu 200 GeV datasets.
624  * Add 7, 11 and 39 GeV dataset selections
625  * MuDstReader: Add 2D histograms for vertex radius and ToF fraction cuts.
626  * Modify countGoodTracks to return number of dEdx and ToF pid identified tracks.
627  * Include code to set track pid information from Dst.
628  * QAHists: New ToF QA hists. Modify dEdx to include signed momentum.
629  *
630  * Revision 1.17 2010/03/02 21:43:38 prindle
631  * Use outerHelix() for global tracks
632  * Add sensible triggerId histograms
633  * Starting to add support to sort events (available for Hijing)
634  *
635  * Revision 1.16 2009/05/08 00:04:22 prindle
636  * Just putting Yuri's TMath back in
637  *
638  * Revision 1.15 2008/12/02 23:35:34 prindle
639  * Added code for pileup rejection in EventCuts and MuDstReader.
640  * Modified trigger selections for some data sets in EventCuts.
641  *
642  * Revision 1.14 2008/05/01 23:35:57 prindle
643  * Found that for global tracks we sometimes have global dca = (0,0,0)
644  * Now use dca() when we are using global tracks.
645  *
646  * Revision 1.13 2008/03/19 22:01:59 prindle
647  * Updated some dataset definitions.
648  *
649  * Revision 1.12 2007/11/26 19:52:24 prindle
650  * Add cucu62, cucu200 2007ib production datasets.
651  * Included vertex cuts for case of ranked vertices. (Pass muDst pointer to EventCuts)
652  * Add n^(1/4) histograms to QAHists
653  *
654  * Revision 1.11 2007/05/27 22:43:35 msd
655  * Added new centrality plots to Empty analysis
656  *
657  * Revision 1.10 2007/01/26 17:09:29 msd
658  * Minor bug fix in AnalysisMaker, cleaned up EmptyAnalysis
659  *
660  * Revision 1.9 2006/04/11 17:50:45 prindle
661  * Remove inChain from constructor arguments (no longer used in macro)
662  *
663  * Revision 1.8 2006/04/06 00:54:01 prindle
664  * Tried to rationalize the way centrality is defined.
665  * Now the reader gives a float to StEStructEvent and this float is
666  * what is being used to define centrality. When we need a centrality
667  * bin index we pass this number into the centrality singleton object.
668  *
669  * Revision 1.7 2006/04/04 22:05:06 porter
670  * a handful of changes:
671  * - changed the StEStructAnalysisMaker to contain 1 reader not a list of readers
672  * - added StEStructQAHists object to contain histograms that did exist in macros or elsewhere
673  * - made centrality event cut taken from StEStructCentrality singleton
674  * - put in ability to get any max,min val from the cut class - one must call setRange in class
675  *
676  * Revision 1.6 2006/02/22 22:03:23 prindle
677  * Removed all references to multRef
678  *
679  * Revision 1.5 2005/09/14 17:08:34 msd
680  * Fixed compiler warnings, a few tweaks and upgrades
681  *
682  * Revision 1.4 2005/09/07 20:18:42 prindle
683  * AnalysisMaker: Keep track of currentAnalysis (for use in doEStruct macro)
684  * EventCuts.h: Added trigger cuts including cucu and year 4.
685  * MuDstReader: Added dE/dx histograms. Re-arranged code to count tracks
686  * before making centrality cut.
687  * TrackCuts: Random changes. Moved some variables from private to public.o
688  *
689  * Revision 1.1 2003/10/15 18:20:32 porter
690  * initial check in of Estruct Analysis maker codes.
691  *
692  *
693  *********************************************************************/
static TObjArray * globalTracks()
returns pointer to the global tracks list
Definition: StMuDst.h:303
virtual int Make()
StMuDst * muDst()
Definition: StMuDstMaker.h:425
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256
Double_t chi2() const
Returns chi2 of fit.
Definition: StMuTrack.h:251
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Definition: StHelix.cc:351
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
Definition: StMuTrack.cxx:407
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
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:259
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
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
Definition: StMuTrack.h:257
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
unsigned short refMult(int vtx_id=-1)
Reference multiplicity of charged particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
Definition: StMuEvent.cxx:195
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
UShort_t nHits() const
Bingchu.
Definition: StMuTrack.h:237
StThreeVectorF dca(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex.
Definition: StMuTrack.cxx:359
Double_t dEdx() const
Returns measured dE/dx value.
Definition: StMuTrack.h:248
static StBTofHeader * btofHeader()
returns pointer to the btofHeader - dongx
Definition: StMuDst.h:423
Double_t phi() const
Returns phi at point of dca to primary vertex.
Definition: StMuTrack.h:258
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.
static Int_t currentVertexIndex()
Get the index number of the current primary vertex.
Definition: StMuDst.h:260
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
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)
Definition: StMuTrack.cxx:412
StTrackTopologyMap topologyMap() const
Returns topology map.
Definition: StMuTrack.h:254
Definition: Pileup.h:79