StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHeavyTagMaker.cxx
1 /* $Id: StHeavyTagMaker.cxx,v 1.4 2007/04/28 17:56:16 perev Exp $
2  *
3  * Author: Manuel Calderon de la Barca Sanchez, July 2004
4  ***************************************************************************
5  *
6  * Description: Maker to fill the Heavy Flavor Tags
7  *
8  * StHeavyTagMaker class for Heavy Flavor Reconstruction Tags
9  * The tags that are currently filled are:
10  * 1) The number of tracks above 3 different mass thresholds
11  * -m_charm = 1.25 GeV/c^2
12  * -m_beauty = 4.2 GeV/c^2
13  * 7 GeV/c^2
14  * 2) The number of tracks above p>2 GeV/c that point to a tower
15  * with ADC-30>360, which should roughly correspond to towers above
16  * Et=3 GeV. The mean pedestal is 30 adc counts, and 360 roughly
17  * corresponds to the 3 GeV, based on a sample of 10 events in
18  * the AuAu62 run, which gives 0.0083 GeV/adc
19  *
20  * 3) The largest pair invariant mass in the event, assuming the electron mass.
21  *
22  ***************************************************************************
23  *
24  * $Log: StHeavyTagMaker.cxx,v $
25  * Revision 1.4 2007/04/28 17:56:16 perev
26  * Redundant StChain.h removed
27  *
28  * Revision 1.3 2004/08/26 03:24:10 jeromel
29  * Fixed wrong indexing
30  *
31  * Revision 1.2 2004/07/29 23:06:11 calderon
32  * Changed adc cut to match towers to 360 ADC counts,
33  * and documented the origin.
34  * Added Description to cxx file.
35  * Removed unnecessary static_cast for StDetectorId
36  *
37  **************************************************************************/
38 
39 #include "StHeavyTagMaker.h"
40 #include "tables/St_HeavyTag_Table.h"
41 
42 #include "StEvent.h"
43 #include "StMessMgr.h"
44 #include "StEventUtilities/StuRefMult.hh"
45 
46 // prototypes for helper functions
47 float largestPairMass(StEvent*);
48 int countTrackTowerMatches(StEvent*);
49 
50 ClassImp(StHeavyTagMaker)
51 
52 StHeavyTagMaker::StHeavyTagMaker(const char *name,const char* title)
53  : StMaker(name,title),
54  mTagTable(0),
55  mEvent(0)
56 {
57  // StHeavyTagMaker constructor
58  // mass of Cquark (from PDG: 1 < m_c < 1.4 GeV)
59  // mass of Bquark (from PDG: 4 < m_b < 4.5 GeV)
60  // 3d threshold, set to 7 GeV so each threshold is in steps of ~3 GeV
61  mMassThres[0] = 1.2;
62  mMassThres[1] = 4.25;
63  mMassThres[2] = 7.0;
64 }
65 
66 StHeavyTagMaker::~StHeavyTagMaker(){
67  // StHeavyTagMaker destructor
68 }
69 
70 Int_t StHeavyTagMaker::Init(){
71  //
72  return StMaker::Init();
73 }
74 
76 
77 
78  // Make - this method is called in loop for each event
79 
80 
81  // Create a data set and add the table to it.
82  mTagTable = new HeavyTag_st;
83  mEvent = (StEvent*) GetInputDS("StEvent");
84  if (!mEvent) return kStOk; // if no event, there is nothing to do.
85 
86  // fill tag here
87  fillTag();
88 
89  // after tag is filled, add it to the data area of the maker
90  St_HeavyTag* heavyTag = new St_HeavyTag("HeavyTag",1);
91  AddData(heavyTag);
92  heavyTag->AddAt(mTagTable,0); // AddAt takes a HeavyTag_st*
93 
94  delete mTagTable;
95  mTagTable=0;
96  // heavyTag is not deleted, control is passed to Maker by adding it to its
97  // dataset branch.
98  return kStOk;
99 }
100 void StHeavyTagMaker::fillTag() {
101 
102  // Count the tracks with p>thres for 3 different
103  // thresholds
104 
105  // Initialize the track counters
106  int tracksGtMass1 = 0;
107  int tracksGtMass2 = 0;
108  int tracksGtMass3 = 0;
109 
110  // now count up the number of interesting tracks
111  // We just check for the momentum above the c and b quark masses
112  // using some loose, but sensible cuts:
113  // flag>0
114  // tpc fit points>15
115  // |eta|<1.5
116  const_StPrimaryTrackIterator itr;
118  float momentum;
119  if (mEvent->primaryVertex()){
120  const StSPtrVecPrimaryTrack& tracks = mEvent->primaryVertex()->daughters();
121  for (itr=tracks.begin();itr != tracks.end(); itr++){
122  track = *itr;
123  if (!track) continue;
124  if (track->flag()<=0) continue;
125  if (track->fitTraits().numberOfFitPoints(kTpcId)<15) continue;
126  StThreeVectorF mom = track->geometry()->momentum();
127  if (fabs(mom.pseudoRapidity())>1.5) continue;
128  momentum = mom.mag();
129  // check for momentum above mass thresholds
130  if (momentum<mMassThres[0]) continue; // step out if p<thres1
131  ++tracksGtMass1; // increase count for thres1
132  if (momentum<mMassThres[1]) continue; // step out if p<thres2
133  ++tracksGtMass2; // increase count for thres2
134  if (momentum>mMassThres[2]) ++tracksGtMass3; // count if p>thres3
135  } // loop over tracks
136  } // check for primary vertex
137 
138 
139 
140  mTagTable->mNumberOfTracksAboveThres[0] = tracksGtMass1;
141  mTagTable->mNumberOfTracksAboveThres[1] = tracksGtMass2;
142  mTagTable->mNumberOfTracksAboveThres[2] = tracksGtMass3;
143  mTagTable->mNumberOfTrackToTowerMatches = countTrackTowerMatches(mEvent);
144  mTagTable->mLargestPairMass = largestPairMass(mEvent);
145 
146  if (Debug()>0) {
147  cout << "Heavy Flavor Tags for Run " << mEvent->runId() << " Event: " << mEvent->id() << endl;
148  cout << "Tracks above m_c : " << mTagTable->mNumberOfTracksAboveThres[0] << endl;
149  cout << "Tracks above m_b : " << mTagTable->mNumberOfTracksAboveThres[1] << endl;
150  cout << "Tracks above 7GeV : " << mTagTable->mNumberOfTracksAboveThres[2] << endl;
151  cout << "Track-Tower Matches " << mTagTable->mNumberOfTrackToTowerMatches << endl;
152  cout << "Largest Inv. Mass : " << mTagTable->mLargestPairMass << endl;
153 
154  }
155  return;
156 }
157 
158 HeavyTag_st* StHeavyTagMaker::tag()
159 {
160  return mTagTable;
161 }
162 
163 
164 
165 
166 
167 
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
virtual Int_t Make()
Definition: Stypes.h:41