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"
24 #include "StSpinPool/StJetEvent/StJetEventTypes.h"
25 #include "StEmcUtil/geometry/StEmcGeom.h"
26 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
27 #include "StEEmcUtil/database/StEEmcDb.h"
28 #include "StJetMaker2012.h"
29 #include "StJetSkimEventMaker.h"
30 #include "StUEMaker2009.h"
36 for (
size_t iBranch = 0; iBranch < mUeBranches.size(); ++iBranch) {
38 uebranch->event->Clear(option);
44 int StUEMaker2009::Init()
46 assert(!mFileName.IsNull());
48 mFile = TFile::Open(mFileName,
"recreate");
51 mTree =
new TTree(
"ue",
"ueTree");
53 for (
size_t iBranch = 0; iBranch < mUeBranches.size(); ++iBranch) {
54 StUeBranch* uebranch = mUeBranches[iBranch];
56 mTree->Branch(uebranch->name +
"_" + uebranch->jetname,
"StUeEvent",&uebranch->event);
60 mJetMaker =
dynamic_cast<StJetMaker2012*
>( GetMakerInheritsFrom(
"StJetMaker2012") );
61 mSkimMaker =
dynamic_cast<StJetSkimEventMaker*
>( GetMakerInheritsFrom(
"StJetSkimEventMaker") );
64 return StMaker::Init();
69 for (
size_t iBranch = 0; iBranch < mUeBranches.size(); ++iBranch){
71 StJetEvent * jetEvent = mJetMaker->event(uebranch->jetname);
76 uebranch->event->mEventId = GetEventNumber();
77 uebranch->event->mDatime = GetDateTime();
78 uebranch->event->mLeadingJetpt = leadingjet->pt();
80 if(uebranch->anapars->useTpc){
90 for (
int iVertex = 0; iVertex < tpc.numberOfVertices(); ++iVertex) {
91 tpc.setVertexIndex(iVertex);
97 if (vertex.ranking() <= 0)
continue;
98 if(leadingjet->pt() == 0)
continue;
99 if(leadingjet->vertex()->position().Z() != vertex.position().Z())
continue;
104 StjTrackList trackList = tpc.getTrackList();
105 if (uebranch->anapars->changeTracks) trackList = (*uebranch->anapars->changeTracks)(trackList);
106 trackList = uebranch->anapars->tpcCuts()(trackList);
107 trackList = uebranch->anapars->trackRegion()(trackList,leadingjet,uebranch->name);
108 addTracks(trackList,uebranch->event);
110 StjTowerEnergyList bemcEnergyList;
111 if (uebranch->anapars->useBemc) {
113 if (uebranch->anapars->changeTowers) (*uebranch->anapars->changeTowers)(bemcEnergyList);
114 bemcEnergyList = uebranch->anapars->bemcCuts()(bemc.getEnergyList());
116 StjTowerEnergyList energyList;
118 energyList = uebranch->anapars->correctTowerEnergyForTracks()(bemcEnergyList,trackList);
119 energyList = uebranch->anapars->towerRegion()(energyList,leadingjet,uebranch->name);
120 addTowers(energyList,uebranch->event);
122 StJetVertex* uevertex = uebranch->event->newVertex();
123 copyVertex(vertex, uevertex);
127 if (uebranch->anapars->useMonteCarlo) {
130 StjMCParticleList mcparticles = uebranch->anapars->mcCuts()(mc.getMCParticleList());
131 mcparticles = uebranch->anapars->particleRegion()(mcparticles,leadingjet,uebranch->name);
132 addParticles(mcparticles,uebranch->event);
133 StJetVertex* uevertex = uebranch->event->newVertex();
134 copyVertex(mcvertex, uevertex);
150 void StUEMaker2009::addBranch(
const char* name,
StAnaPars* anapars,
const char* jetname)
152 mUeBranches.push_back(
new StUeBranch(name,anapars,jetname));
156 void StUEMaker2009::setUeFile(
const char* filename)
158 mFileName = filename;
161 StUeEvent* StUEMaker2009::event(
const char* branchname)
163 TBranch* branch = mTree->GetBranch(branchname);
164 if (branch)
return *(
StUeEvent**)branch->GetAddress();
173 for (
int iJet = 0; iJet < vertex->numberOfJets(); ++iJet){
175 if(leadingjet->pt() < jets->pt()){
186 jetvertex->mPosition = vertex.position();
187 jetvertex->mPosError = vertex.posError();
188 jetvertex->mVertexFinderId = vertex.vertexFinderId();
189 jetvertex->mRanking = vertex.ranking();
190 jetvertex->mNTracksUsed = vertex.nTracksUsed();
191 jetvertex->mNBTOFMatch = vertex.nBTOFMatch();
192 jetvertex->mNCTBMatch = vertex.nCTBMatch();
193 jetvertex->mNBEMCMatch = vertex.nBEMCMatch();
194 jetvertex->mNEEMCMatch = vertex.nEEMCMatch();
195 jetvertex->mNCrossCentralMembrane = vertex.nCrossCentralMembrane();
196 jetvertex->mSumTrackPt = vertex.sumTrackPt();
197 jetvertex->mMeanDip = vertex.meanDip();
198 jetvertex->mChiSquared = vertex.chiSquared();
199 jetvertex->mRefMultPos = vertex.refMultPos();
200 jetvertex->mRefMultNeg = vertex.refMultNeg();
201 jetvertex->mRefMultFtpcWest = vertex.refMultFtpcWest();
202 jetvertex->mRefMultFtpcEast = vertex.refMultFtpcEast();
208 track->mDetectorId = t.detectorId;
209 track->mFlag = t.flag;
210 track->mCharge = t.charge;
211 track->mNHits = t.nHits;
212 track->mNHitsFit = t.nHitsFit;
213 track->mNHitsPoss = t.nHitsPoss;
214 track->mNHitsDedx = t.nHitsDedx;
215 track->mDedx = t.dEdx;
216 track->mBeta = t.beta;
217 track->mFirstPoint = t.firstPoint;
218 track->mLastPoint = t.lastPoint;
219 track->mExitTowerId = t.exitTowerId;
220 track->mExitDetectorId = t.exitDetectorId;
221 track->mDca.SetXYZ(t.dcaX,t.dcaY,t.dcaZ);
222 track->mDcaD = t.dcaD;
223 track->mChi2 = t.chi2;
224 track->mChi2Prob = t.chi2prob;
228 track->mNSigmaPion = t.nSigmaPion;
229 track->mNSigmaKaon = t.nSigmaKaon;
230 track->mNSigmaProton = t.nSigmaProton;
231 track->mNSigmaElectron = t.nSigmaElectron;
233 track->mBTofTrayId = t.btofTrayId;
234 track->mNSigmaTofPion = t.nSigmaTofPion;
235 track->mNSigmaTofKaon = t.nSigmaTofKaon;
236 track->mNSigmaTofProton = t.nSigmaTofProton;
237 track->mNSigmaTofElectron = t.nSigmaTofElectron;
239 track->mIdTruth = t.idTruth;
240 track->mQaTruth = t.qaTruth;
245 tower->mId = t.towerId;
246 tower->mDetectorId = t.detectorId;
248 tower->mPedestal = t.pedestal;
250 tower->mStatus = t.status;
251 tower->mEta = t.towerEta;
252 tower->mPhi = t.towerPhi;
254 Float_t energy = t.energy;
255 tower->mPt = energy/TMath::CosH(t.towerEta);
260 particle->mId = t.mcparticleId;
261 particle->mPt = t.pt;
262 particle->mEta = t.eta;
263 particle->mPhi = t.phi;
266 particle->mPdg = t.pdg;
267 particle->mStatus = t.status;
268 particle->mFirstMother = t.firstMotherId;
269 particle->mLastMother = t.lastMotherId;
270 particle->mFirstDaughter = t.firstDaughterId;
271 particle->mLastDaughter = t.lastDaughterId;
274 void StUEMaker2009::addTracks(
const StjTrackList& trackList,
StUeEvent* event){
276 for (StjTrackList::const_iterator iTrack = trackList.begin(); iTrack != trackList.end(); ++iTrack) {
279 copyTrack(track, ueTrack);
284 void StUEMaker2009::addTowers(
const StjTowerEnergyList& towerList,
StUeEvent* event){
286 for (StjTowerEnergyList::const_iterator iTower = towerList.begin(); iTower != towerList.end(); ++iTower) {
290 copyTower(tower, ueTower);
294 void StUEMaker2009::addParticles(
const StjMCParticleList& mcParticleList,
StUeEvent* event){
296 for (StjMCParticleList::const_iterator iParticle = mcParticleList.begin(); iParticle != mcParticleList.end(); ++iParticle) {
300 copyParticle(mcparticle, ueParticle);
virtual void Clear(Option_t *option="")
User defined functions.
void Clear(Option_t *option="")
User defined functions.
virtual Int_t GetRunNumber() const
Returns the current RunNumber.