9 #include "StEmcUtil/geometry/StEmcGeom.h"
10 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
11 #include "StEventTypes.h"
12 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
13 #include "StMuTrackFourVec.h"
15 #include "StMuTrackEmu.h"
16 #include "StMuTowerEmu.h"
17 #include "StMcTrackEmu.h"
18 #include "StSpinPool/StJetEvent/StJetEventTypes.h"
20 #include "StJetFinder/StProtoJet.h"
22 #include "StFourPMaker.h"
23 #include "StBET4pMaker.h"
28 #include "StjeJetEventTreeWriter.h"
32 StjeJetEventTreeWriter::StjeJetEventTreeWriter(
const char* outFileName)
33 : _OutFileName(outFileName)
39 void StjeJetEventTreeWriter::addJetFinder(
StFourPMaker* fourPMaker,
const vector<const AbstractFourVec*>* particleList, list<StProtoJet>* protoJetList,
const char* name,
StJets*)
43 anaCtl._branchName = name;
44 anaCtl._fourPMaker = fourPMaker;
45 anaCtl._protoJetList = protoJetList;
48 _analyzerCtlList.push_back(anaCtl);
51 void StjeJetEventTreeWriter::Init()
53 _outFile =
new TFile(_OutFileName,
"recreate");
54 _jetTree =
new TTree(
"jet",
"jetTree");
56 for (vector<AnalyzerCtl>::iterator iAnalyzer = _analyzerCtlList.begin(); iAnalyzer != _analyzerCtlList.end(); ++iAnalyzer)
57 _jetTree->Branch(iAnalyzer->_branchName.c_str(),
"StJetEvent", &iAnalyzer->_jetEvent);
59 _jetTree->BranchRef();
62 void StjeJetEventTreeWriter::Finish()
70 void StjeJetEventTreeWriter::fillJetTreeHeader(
int iAnalyzer)
72 StJetEvent* jetEvent = _analyzerCtlList[iAnalyzer]._jetEvent;
73 StFourPMaker* fourPMaker = _analyzerCtlList[iAnalyzer]._fourPMaker;
76 jetEvent->mEventId = fourPMaker->GetEventNumber();
77 jetEvent->mDatime = fourPMaker->GetDateTime();
80 void StjeJetEventTreeWriter::fillJetTree(
int iAnalyzer,
int iVertex)
82 AnalyzerCtl& analyzerCtl = _analyzerCtlList[iAnalyzer];
83 fillJetTreeForOneVertex(analyzerCtl._jetEvent,analyzerCtl._protoJetList,analyzerCtl._fourPMaker,iVertex);
86 void StjeJetEventTreeWriter::fillJetTreeForOneVertex(
StJetEvent* jetEvent, list<StProtoJet>* protoJetList,
StFourPMaker* fourPMaker,
int iVertex)
89 copyVertex(fourPMaker->getVertexNodes()[iVertex].vertex,jetVertex);
90 for (list<StProtoJet>::iterator protojet = protoJetList->begin(); protojet != protoJetList->end(); ++protojet)
91 jetVertex->addJet(fillJet(jetEvent,jetVertex,*protojet));
96 StJetCandidate* jet = jetEvent->newJet(jetVertex->position(),TLorentzVector(protojet.px(),protojet.py(),protojet.pz(),protojet.e()));
99 const StProtoJet::FourVecList& particleList = protojet.list();
100 for (StProtoJet::FourVecList::const_iterator iParticle = particleList.begin(); iParticle != particleList.end(); ++iParticle) {
105 track->mId = t->id();
106 track->mDetectorId = t->detectorId();
107 track->mFlag = t->flag();
108 track->mCharge = t->charge();
109 track->mNHits = t->nHits();
110 track->mNHitsFit = t->nHitsFit();
111 track->mNHitsPoss = t->nHitsPoss();
112 track->mNHitsDedx = t->nHitsDedx();
113 track->mDedx = t->dEdx();
114 track->mBeta = t->beta();
115 track->mFirstPoint = t->firstPoint();
116 track->mLastPoint = t->lastPoint();
117 track->mExitTowerId = t->exitTowerId();
118 track->mExitDetectorId = t->exitDetectorId();
119 track->mExitPoint.SetPtEtaPhi(t->bemcRadius(),t->etaext(),t->phiext());
120 track->mDca.SetXYZ(t->dcaX(),t->dcaY(),t->dcaZ());
121 track->mDcaD = t->dcaD();
122 track->mChi2 = t->chi2();
123 track->mChi2Prob = t->chi2prob();
124 TVector3 mom(t->px(),t->py(),t->pz());
125 track->mPt = mom.Pt();
126 track->mEta = mom.Eta();
127 track->mPhi = mom.Phi();
128 track->mNSigmaPion = t->nSigmaPion();
129 track->mNSigmaKaon = t->nSigmaKaon();
130 track->mNSigmaProton = t->nSigmaProton();
131 track->mNSigmaElectron = t->nSigmaElectron();
132 jet->addTrack(track)->setJet(jet);
137 tower->mId = t->id();
138 tower->mDetectorId = t->detectorId();
139 tower->mAdc = t->adc();
140 tower->mPedestal = t->pedestal();
141 tower->mRms = t->rms();
142 tower->mStatus = t->status();
147 TVector3 mom(t->px(),t->py(),t->pz());
148 float energy = mom.Mag();
150 switch (t->detectorId()) {
151 case kBarrelEmcTowerId:
152 mom.SetPtEtaPhi(StEmcGeom::instance(
"bemc")->Radius(),mom.Eta(),mom.Phi());
154 case kEndcapEmcTowerId:
159 mom -= jetVertex->position();
162 tower->mPt = mom.Pt();
163 tower->mEta = mom.Eta();
164 tower->mPhi = mom.Phi();
165 jet->addTower(tower)->setJet(jet);
172 part->mEta = t->eta();
173 part->mPhi = t->phi();
176 part->mPdg = t->pdg();
177 part->mStatus = t->status();
178 jet->addParticle(part)->setJet(jet);
182 float sumTowerPt = jet->sumTowerPt();
183 float sumTrackPt = jet->sumTrackPt();
185 jet->mRt = sumTowerPt/(sumTowerPt+sumTrackPt);
187 jet->setVertex(jetVertex);
194 jetVertex->mPosition = muVertex->position().xyz();
195 jetVertex->mPosError = muVertex->posError().xyz();
196 jetVertex->mVertexFinderId = muVertex->vertexFinderId();
197 jetVertex->mRanking = muVertex->ranking();
198 jetVertex->mNTracksUsed = muVertex->nTracksUsed();
199 jetVertex->mNBTOFMatch = muVertex->nBTOFMatch();
200 jetVertex->mNCTBMatch = muVertex->nCTBMatch();
201 jetVertex->mNBEMCMatch = muVertex->nBEMCMatch();
202 jetVertex->mNEEMCMatch = muVertex->nEEMCMatch();
203 jetVertex->mNCrossCentralMembrane = muVertex->nCrossCentralMembrane();
204 jetVertex->mSumTrackPt = muVertex->sumTrackPt();
205 jetVertex->mMeanDip = muVertex->meanDip();
206 jetVertex->mChiSquared = muVertex->chiSquared();
207 jetVertex->mRefMultPos = muVertex->refMultPos();
208 jetVertex->mRefMultNeg = muVertex->refMultNeg();
209 jetVertex->mRefMultFtpcWest = muVertex->refMultFtpcWest();
210 jetVertex->mRefMultFtpcEast = muVertex->refMultFtpcEast();
static EEmcGeomSimple & Instance()
returns a reference to a static instance of EEmcGeomSimple
virtual Int_t GetRunNumber() const
Returns the current RunNumber.