10 #include "StAnaPars.h"
11 #include "StjTPCMuDst.h"
13 #include "StjBEMCMuDst.h"
14 #include "StjEEMCMuDst.h"
15 #include "StjMCMuDst.h"
16 #include "StjTPCNull.h"
17 #include "StjBEMCNull.h"
18 #include "StjEEMCNull.h"
19 #include "StjAbstractTowerEnergyCorrectionForTracks.h"
20 #include "StjeTrackListToStMuTrackFourVecList.h"
21 #include "StjeTowerEnergyListToStMuTrackFourVecList.h"
22 #include "StjMCParticleToStMuTrackFourVec.h"
23 #include "StJetFinder/StJetFinder.h"
24 #include "StSpinPool/StJetEvent/StJetEventTypes.h"
25 #include "StMuTrackFourVec.h"
26 #include "StMuTrackEmu.h"
27 #include "StMuTowerEmu.h"
28 #include "StMcTrackEmu.h"
29 #include "StEmcUtil/geometry/StEmcGeom.h"
30 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
31 #include "StEEmcUtil/database/StEEmcDb.h"
33 #include "StJetMaker2009.h"
39 for (
size_t iBranch = 0; iBranch < mJetBranches.size(); ++iBranch) {
41 jetbranch->event->Clear(option);
47 int StJetMaker2009::Init()
49 assert(!mFileName.IsNull());
51 mFile = TFile::Open(mFileName,
"recreate");
54 mTree =
new TTree(
"jet",
"jetTree");
56 for (
size_t iBranch = 0; iBranch < mJetBranches.size(); ++iBranch) {
57 StJetBranch* jetbranch = mJetBranches[iBranch];
58 jetbranch->jetfinder->Init();
59 mTree->Branch(jetbranch->name,
"StJetEvent",&jetbranch->event);
65 eemcDb->setThreshold(3);
67 return StMaker::Init();
73 for (
size_t iBranch = 0; iBranch < mJetBranches.size(); ++iBranch) {
78 jetbranch->event->mEventId = GetEventNumber();
79 jetbranch->event->mDatime = GetDateTime();
81 if (jetbranch->anapars->useTpc) {
89 int savedVertexIndex = tpc.currentVertexIndex();
94 int totNumVertices = tpc.numberOfVertices();
96 if(jetbranch->anapars->storeOnlyDefaultVertex && totNumVertices > 1) {
101 for (
int iVertex = 0; iVertex < totNumVertices; ++iVertex) {
102 tpc.setVertexIndex(iVertex);
108 if (vertex.ranking() <= 0)
continue;
112 StjTrackList trackList = tpc.getTrackList();
113 if (jetbranch->anapars->changeTracks) trackList = (*jetbranch->anapars->changeTracks)(trackList);
114 trackList = jetbranch->anapars->tpcCuts()(trackList);
117 StjTowerEnergyList bemcEnergyList;
119 if (jetbranch->anapars->useBemc) {
121 bemcEnergyList = bemc.getEnergyList();
122 if (jetbranch->anapars->changeTowers) (*jetbranch->anapars->changeTowers)(bemcEnergyList);
123 bemcEnergyList = jetbranch->anapars->bemcCuts()(bemcEnergyList);
127 StjTowerEnergyList eemcEnergyList;
129 if (jetbranch->anapars->useEemc) {
131 eemcEnergyList = eemc.getEnergyList();
132 if (jetbranch->anapars->changeTowers) (*jetbranch->anapars->changeTowers)(eemcEnergyList);
133 eemcEnergyList = jetbranch->anapars->eemcCuts()(eemcEnergyList);
137 StjTowerEnergyList energyList;
139 copy(bemcEnergyList.begin(),bemcEnergyList.end(),back_inserter(energyList));
140 copy(eemcEnergyList.begin(),eemcEnergyList.end(),back_inserter(energyList));
143 energyList = jetbranch->anapars->correctTowerEnergyForTracks()(energyList,trackList);
150 StProtoJet::FourVecList particles;
152 copy(tpc4pList.begin(),tpc4pList.end(),back_inserter(particles));
153 copy(energy4pList.begin(),energy4pList.end(),back_inserter(particles));
156 StJetFinder::JetList protojets;
157 jetbranch->jetfinder->findJets(protojets,particles);
160 protojets = jetbranch->anapars->jetCuts()(protojets);
163 StJetVertex* jetvertex = jetbranch->event->newVertex();
164 copyVertex(vertex,jetvertex);
167 for (StJetFinder::JetList::const_iterator iProtoJet = protojets.begin(); iProtoJet != protojets.end(); ++iProtoJet)
168 addJet(*iProtoJet,jetbranch->event,jetvertex);
171 for (StProtoJet::FourVecList::const_iterator i = particles.begin(); i != particles.end(); ++i)
179 StjTowerEnergyList bemcEnergyList;
181 if (jetbranch->anapars->useBemc) {
183 bemc.setVertex(0,0,0);
184 bemcEnergyList = bemc.getEnergyList();
185 if (jetbranch->anapars->changeTowers) (*jetbranch->anapars->changeTowers)(bemcEnergyList);
186 bemcEnergyList = jetbranch->anapars->bemcCuts()(bemcEnergyList);
190 StjTowerEnergyList eemcEnergyList_temp, eemcEnergyList;
192 if (jetbranch->anapars->useEemc) {
194 eemcEnergyList = eemc.getEnergyList();
195 if (jetbranch->anapars->changeTowers) (*jetbranch->anapars->changeTowers)(eemcEnergyList);
196 eemcEnergyList = jetbranch->anapars->eemcCuts()(eemcEnergyList);
201 StjTowerEnergyList energyList;
203 copy(bemcEnergyList.begin(),bemcEnergyList.end(),back_inserter(energyList));
204 copy(eemcEnergyList.begin(),eemcEnergyList.end(),back_inserter(energyList));
210 StProtoJet::FourVecList particles;
212 copy(energy4pList.begin(),energy4pList.end(),back_inserter(particles));
215 StJetFinder::JetList protojets;
216 jetbranch->jetfinder->findJets(protojets,particles);
219 protojets = jetbranch->anapars->jetCuts()(protojets);
222 StJetVertex* jetvertex = jetbranch->event->newVertex();
223 jetvertex->mPosition.SetXYZ(0,0,0);
226 for (StJetFinder::JetList::const_iterator iProtoJet = protojets.begin(); iProtoJet != protojets.end(); ++iProtoJet)
227 addJet(*iProtoJet,jetbranch->event,jetvertex);
230 for (StProtoJet::FourVecList::const_iterator i = particles.begin(); i != particles.end(); ++i)
235 tpc.setVertexIndex(savedVertexIndex);
239 if (jetbranch->anapars->useMonteCarlo) {
242 StjMCParticleList mcparticles = jetbranch->anapars->mcCuts()(mc.getMCParticleList());
243 StProtoJet::FourVecList particles;
247 StJetFinder::JetList protojets;
248 jetbranch->jetfinder->findJets(protojets,particles);
251 protojets = jetbranch->anapars->jetCuts()(protojets);
254 StJetVertex* jetvertex = jetbranch->event->newVertex();
255 copyVertex(mcvertex,jetvertex);
258 for (StJetFinder::JetList::const_iterator iProtoJet = protojets.begin(); iProtoJet != protojets.end(); ++iProtoJet)
259 addJet(*iProtoJet,jetbranch->event,jetvertex);
262 for (StProtoJet::FourVecList::const_iterator i = particles.begin(); i != particles.end(); ++i)
283 void StJetMaker2009::addBranch(
const char* name,
StAnaPars* anapars,
StJetPars* jetpars)
285 mJetBranches.push_back(
new StJetBranch(name,anapars,jetpars));
288 void StJetMaker2009::setJetFile(
const char* filename)
290 mFileName = filename;
295 TTree* StJetMaker2009::tree()
300 StJetEvent* StJetMaker2009::event(
const char* branchname)
302 TBranch* branch = mTree->GetBranch(branchname);
303 if (branch)
return *(
StJetEvent**)branch->GetAddress();
309 StJetCandidate* jet =
event->newJet(vertex->position(),TLorentzVector(protojet.px(),protojet.py(),protojet.pz(),protojet.e()), static_cast<float>(protojet.area()), static_cast<float>(protojet.areaError()));
311 jet->setVertex(vertex);
314 const StProtoJet::FourVecList& particles = protojet.list();
315 for (StProtoJet::FourVecList::const_iterator iParticle = particles.begin(); iParticle != particles.end(); ++iParticle) {
321 jet->addTrack(track)->setJet(jet);
327 jet->addTower(tower)->setJet(jet);
332 copyParticle(t,part);
333 jet->addParticle(part)->setJet(jet);
338 float sumTowerPt = jet->sumTowerPt();
339 float sumTrackPt = jet->sumTrackPt();
340 jet->mRt = sumTowerPt/(sumTowerPt+sumTrackPt);
345 jetvertex->mPosition = vertex.position();
346 jetvertex->mPosError = vertex.posError();
347 jetvertex->mVertexFinderId = vertex.vertexFinderId();
348 jetvertex->mRanking = vertex.ranking();
349 jetvertex->mNTracksUsed = vertex.nTracksUsed();
350 jetvertex->mNBTOFMatch = vertex.nBTOFMatch();
351 jetvertex->mNCTBMatch = vertex.nCTBMatch();
352 jetvertex->mNBEMCMatch = vertex.nBEMCMatch();
353 jetvertex->mNEEMCMatch = vertex.nEEMCMatch();
354 jetvertex->mNCrossCentralMembrane = vertex.nCrossCentralMembrane();
355 jetvertex->mSumTrackPt = vertex.sumTrackPt();
356 jetvertex->mMeanDip = vertex.meanDip();
357 jetvertex->mChiSquared = vertex.chiSquared();
358 jetvertex->mRefMultPos = vertex.refMultPos();
359 jetvertex->mRefMultNeg = vertex.refMultNeg();
360 jetvertex->mRefMultFtpcWest = vertex.refMultFtpcWest();
361 jetvertex->mRefMultFtpcEast = vertex.refMultFtpcEast();
366 track->mId = t->id();
367 track->mDetectorId = t->detectorId();
368 track->mFlag = t->flag();
369 track->mCharge = t->charge();
370 track->mNHits = t->nHits();
371 track->mNHitsFit = t->nHitsFit();
372 track->mNHitsPoss = t->nHitsPoss();
373 track->mNHitsDedx = t->nHitsDedx();
374 track->mDedx = t->dEdx();
375 track->mBeta = t->beta();
376 track->mFirstPoint = t->firstPoint();
377 track->mLastPoint = t->lastPoint();
378 track->mExitTowerId = t->exitTowerId();
379 track->mExitDetectorId = t->exitDetectorId();
380 track->mExitPoint.SetPtEtaPhi(t->bemcRadius(),t->etaext(),t->phiext());
381 track->mDca.SetXYZ(t->dcaX(),t->dcaY(),t->dcaZ());
382 track->mDcaD = t->dcaD();
383 track->mChi2 = t->chi2();
384 track->mChi2Prob = t->chi2prob();
385 TVector3 mom(t->px(),t->py(),t->pz());
386 track->mPt = mom.Pt();
387 track->mEta = mom.Eta();
388 track->mPhi = mom.Phi();
389 track->mNSigmaPion = t->nSigmaPion();
390 track->mNSigmaKaon = t->nSigmaKaon();
391 track->mNSigmaProton = t->nSigmaProton();
392 track->mNSigmaElectron = t->nSigmaElectron();
394 track->mBTofTrayId = t->btofTrayId();
395 track->mNSigmaTofPion = t->nSigmaTofPion();
396 track->mNSigmaTofKaon = t->nSigmaTofKaon();
397 track->mNSigmaTofProton = t->nSigmaTofProton();
398 track->mNSigmaTofElectron = t->nSigmaTofElectron();
400 track->mIdTruth = t->idTruth();
401 track->mQaTruth = t->qaTruth();
406 tower->mId = t->id();
407 tower->mDetectorId = t->detectorId();
408 tower->mAdc = t->adc();
409 tower->mPedestal = t->pedestal();
410 tower->mRms = t->rms();
411 tower->mStatus = t->status();
412 TVector3 mom(t->px(),t->py(),t->pz());
413 tower->mPt = mom.Pt();
414 tower->mEta = mom.Eta();
415 tower->mPhi = mom.Phi();
420 particle->mId = t->id();
421 particle->mPt = t->pt();
422 particle->mEta = t->eta();
423 particle->mPhi = t->phi();
424 particle->mM = t->m();
425 particle->mE = t->e();
426 particle->mPdg = t->pdg();
427 particle->mStatus = t->status();
428 particle->mFirstMother = t->firstMother();
429 particle->mLastMother = t->lastMother();
430 particle->mFirstDaughter = t->firstDaughter();
431 particle->mLastDaughter = t->lastDaughter();
virtual void Clear(Option_t *option="")
User defined functions.
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
void Clear(Option_t *option="")
User defined functions.