StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHighPtTagsMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StHighPtTagsMaker.cxx,v 1.2 2007/04/28 17:56:17 perev Exp $
4  *
5  * Author: Thomas Henry, July 2004, base on Gene Van Beuren, Feb 1999
6  ***************************************************************************
7  *
8  * Description: Maker to fill the High Pt Tags
9  *
10  ***************************************************************************
11  *
12  * $Log: StHighPtTagsMaker.cxx,v $
13  * Revision 1.2 2007/04/28 17:56:17 perev
14  * Redundant StChain.h removed
15  *
16  * Revision 1.1 2004/07/30 23:02:05 calderon
17  * Revised entry after testing. Commented out data members that are used
18  * as local variables in fillTag(). Speeded up primary track loop. Added
19  * protection against null pointers.
20  *
21  * Revision 1.0 2004/07/27 12:02:00 thenry
22  * Created
23  *
24  **************************************************************************/
25 #include "StHighPtTagsMaker.h"
26 #include "StEvent.h"
27 #include "StEventTypes.h"
28 #include "StTrack.h"
29 #include "TMath.h"
30 #include "PhysicalConstants.h"
31 #include "phys_constants.h"
32 #include "StThreeVector.hh"
33 
34 ClassImp(StHighPtTagsMaker)
35 
36 StHighPtTagsMaker::StHighPtTagsMaker(const char *name, const char *title)
37  : StMaker(name, title)
38 {
39  mEvent = 0;
40  mTagTable = 0; // init pointer to tag table
41 }
42 
43 StHighPtTagsMaker::~StHighPtTagsMaker()
44 {
45  if(mTagTable != 0)
46  delete mTagTable;
47  mTagTable = 0; // clean up
48 }
49 
50 Int_t StHighPtTagsMaker::Init()
51 {
52 // mHighPtTrack = 0;
53 // mMaxRawEtBEMCTower = 0;
54 // mMaxRawEtEEMCTower = 0;
55 
56  return StMaker::Init();
57 }
58 
60 {
61  mTagTable = new HighPtTag_st;
62  mEvent = (StEvent *) GetInputDS("StEvent");
63  if (!mEvent) return kStOK; // If no event, we're done
64 
65  fillTag();
66  St_HighPtTag *HighPtTag = new St_HighPtTag("HighPtTag",1);
67  AddData(HighPtTag);
68  HighPtTag->AddAt(mTagTable,0);
69  delete mTagTable; mTagTable=0;
70  return kStOK;
71 }
72 
73 
74 HighPtTag_st* StHighPtTagsMaker::tag()
75 {
76  return mTagTable;
77 }
78 
79 void StHighPtTagsMaker::fillTag()
80 {
81  //max Pt temporary variables
82  Float_t mHighPtTrack=0.0;
83  Float_t mMaxRawEtBEMCTower=0.0;
84  Float_t mMaxRawEtEEMCTower=0.0;
85 
86  // speed up the code by looking at primary tracks directly
87  if (mEvent->primaryVertex()) {
88  StSPtrVecPrimaryTrack& primTracks = mEvent->primaryVertex()->daughters();
89  for(StSPtrVecPrimaryTrackIterator i=primTracks.begin(); i!=primTracks.end(); ++i) {
90  StTrack* mtrack = *i;
91  if (!mtrack) continue;
92  if(mtrack->flag()<=0) continue;
93  if(mtrack->fitTraits().numberOfFitPoints() < 15) continue;
94  StThreeVectorF mom = mtrack->geometry()->momentum();
95  if(mom.pseudoRapidity() > 1.5) continue;
96  if(mom.perp() > mHighPtTrack)
97  mHighPtTrack = mom.perp();
98  }
99  }
100  StEmcCollection *emcCol = mEvent->emcCollection();
101  if (emcCol) {
102  StEmcDetector *bemc = emcCol->detector(kBarrelEmcTowerId);
103  StEmcDetector *eemc = emcCol->detector(kEndcapEmcTowerId);
104  if (bemc) {
105  Int_t bemcModules = bemc->numberOfModules();
106  for(int i = 0; i < bemcModules; i++) {
107  StEmcModule* mod = bemc->module(i+1);
108  StSPtrVecEmcRawHit &hits = mod->hits();
109  for(StSPtrVecEmcRawHitIterator it=hits.begin(); it!=hits.end(); ++it) {
110  if(mMaxRawEtBEMCTower < (*it)->energy())
111  mMaxRawEtBEMCTower = (*it)->energy();
112  }
113  } // module loop
114  } // check for barrel detector
115  if (eemc) {
116  Int_t eemcModules = eemc->numberOfModules();
117  for(int i = 0; i < eemcModules; i++) {
118  StEmcModule* mod = eemc->module(i+1);
119  StSPtrVecEmcRawHit &hits = mod->hits();
120  for(StSPtrVecEmcRawHitIterator it=hits.begin(); it!=hits.end(); ++it) {
121  if(mMaxRawEtEEMCTower < (*it)->energy())
122  mMaxRawEtEEMCTower = (*it)->energy();
123  }
124  }// module loop
125  }// check for endcap detector
126  }// check for emc collection
127 
128  mTagTable->HighPtTrack = mHighPtTrack;
129  mTagTable->MaxRawEtBEMCTower = mMaxRawEtBEMCTower;
130  mTagTable->MaxRawEtEEMCTower = mMaxRawEtEEMCTower;
131 }
132 
133 void StHighPtTagsMaker::printTag(ostream& os)
134 {
135  os << "--- High Pt Tag Table ---" << endl;
136  if (!mTagTable)
137  os << "(empty)" << endl;
138  else {
139  os << "Pt of High Pt Track: " << mTagTable->HighPtTrack << endl;
140  os << "Maximum Raw Et of BEMC Towers: " << mTagTable->MaxRawEtBEMCTower << endl;
141  os << "Maximum Raw Et of EEMC Towers: " << mTagTable->MaxRawEtEEMCTower << endl;
142  }
143 }
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
Definition: Stypes.h:40
A maker to fill the HighPt tags.