36 #include "StPrimaryVertex.h"
37 #include "StContainers.h"
38 #include "StPrimaryTrack.h"
39 #include "StTrackGeometry.h"
40 #include "StTrackFitTraits.h"
41 #include "StEventSummary.h"
42 #include "StEmcCollection.h"
43 #include "StEmcDetector.h"
44 #include "StEmcModule.h"
45 #include "StEmcRawHit.h"
48 #include "StThreeVectorD.hh"
50 #include "StEmcUtil/geometry/StEmcGeom.h"
51 #include "StEmcUtil/projection/StEmcPosition.h"
53 int countTrackTowerMatches(
StEvent* event) {
56 if (!event)
return -9999;
57 if (!(event->primaryVertex()))
return -9999;
58 if (!(event->emcCollection()))
return -9999;
59 if (!(event->emcCollection()->detector(kBarrelEmcTowerId)))
return -9999;
65 StEmcGeom* bemcGeom = StEmcGeom::getEmcGeom(
"bemc");
66 const double Radius = bemcGeom->Radius();
67 int trackTowerPairs = 0;
70 const StSPtrVecPrimaryTrack& trackArray =
event->primaryVertex()->daughters();
71 StEmcDetector* stBEMCDetector=
event->emcCollection()->detector(kBarrelEmcTowerId);
77 for (
unsigned int ipr1=0; ipr1<trackArray.size(); ++ipr1) {
81 if (!ptrack1)
continue;
82 if (ptrack1->flag()<=0)
continue;
83 if (ptrack1->fitTraits().numberOfFitPoints(kTpcId)<15)
continue;
85 if (mom1.mag()<2.)
continue;
86 if (fabs(mom1.pseudoRapidity())>1.5)
continue;
93 bool tok = emcPos.
trackOnEmc(&trackPosition, &trackMomentum, ptrack1,
94 event->summary()->magneticField(), Radius);
105 int moduleH, etaH, subH, id;
106 bemcGeom->
getBin(trackPosition.phi(), trackPosition.pseudoRapidity(), moduleH, etaH, subH);
107 bemcGeom->getId(moduleH, etaH, subH,
id);
112 StEmcModule* module = stBEMCDetector->module(moduleH);
113 const StSPtrVecEmcRawHit& modHits = module->hits();
114 for (
size_t i=0; i<modHits.size();++i) {
122 if (hit->eta()==
static_cast<unsigned int>(etaH) && hit->sub()==subH) {
131 int adc =
static_cast<int>(hit->adc());
133 if (adc-30>360) ++trackTowerPairs;
139 return trackTowerPairs;
Bool_t trackOnEmc(StThreeVectorD *position, StThreeVectorD *momentum, const StTrack *const track, Double_t magField, Double_t emcRadius=225.405) const
Track projection utility.
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const