3 #include "StjeDefaultJetTreeWriter.h"
5 #include <StMuDSTMaker/COMMON/StMuDst.h>
6 #include <StMuDSTMaker/COMMON/StMuEvent.h>
7 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
9 #include "StSpinPool/StJets/StJets.h"
10 #include "StSpinPool/StJets/StJet.h"
11 #include "StMuTrackFourVec.h"
13 #include "StMuTrackEmu.h"
14 #include "StMuTowerEmu.h"
15 #include "StMcTrackEmu.h"
17 #include <StJetFinder/StProtoJet.h>
20 #include <StFourPMaker.h>
21 #include <StBET4pMaker.h>
27 StjeDefaultJetTreeWriter::StjeDefaultJetTreeWriter(
StMuDstMaker& uDstMaker, std::string outFileName)
28 : _uDstMaker(uDstMaker)
29 , _OutFileName(outFileName)
36 StjeDefaultJetTreeWriter::~StjeDefaultJetTreeWriter()
41 void StjeDefaultJetTreeWriter::addJetFinder(
StFourPMaker* fourPMaker,
const vector<const AbstractFourVec*>* particleList, list<StProtoJet>* protoJetList,
const char* name,
StJets* stjets)
44 anaCtl._branchName = name;
45 anaCtl._fourPMaker = fourPMaker;
46 anaCtl._protoJetList = protoJetList;
47 anaCtl._jets = stjets;
49 _analyzerCtlList.push_back(anaCtl);
52 void StjeDefaultJetTreeWriter::Init()
54 _outFile =
new TFile(_OutFileName.c_str(),
"recreate");
55 _jetTree =
new TTree(
"jet",
"jetTree");
57 for(vector<AnalyzerCtl>::iterator it = _analyzerCtlList.begin(); it != _analyzerCtlList.end(); ++it) {
58 _jetTree->Branch((*it)._branchName.c_str(),
"StJets", &((*it)._jets));
61 _jetTree->BranchRef();
64 void StjeDefaultJetTreeWriter::Finish()
72 void StjeDefaultJetTreeWriter::fillJetTreeHeader(
int iAnalyzer)
74 StFourPMaker* fourPMaker = _analyzerCtlList[iAnalyzer]._fourPMaker;
75 StJets& jets = *_analyzerCtlList[iAnalyzer]._jets;
81 jets.seteventId(event->eventId());
82 jets.seteventNumber(event->eventNumber());
83 jets.setrunId(event->runId());
84 jets.setrunNumber(event->runNumber());
88 jets.setDylanPoints( bet4p->nDylanPoints() );
89 jets.setSumEmcE( bet4p->sumEmcEt() );
93 void StjeDefaultJetTreeWriter::fillJetTree(
int iAnalyzer,
int iVertex)
96 StFourPMaker* fourPMaker = _analyzerCtlList[iAnalyzer]._fourPMaker;
97 std::list<StProtoJet>* protoJetList = _analyzerCtlList[iAnalyzer]._protoJetList;
98 fillJetTreeForOneJetFindingAlgorithm(*_analyzerCtlList[iAnalyzer]._jets, protoJetList, fourPMaker);
101 void StjeDefaultJetTreeWriter::fillJetTreeForOneJetFindingAlgorithm(
StJets& jets, std::list<StProtoJet>* protoJetList,
StFourPMaker* fourPMaker)
103 for(list<StProtoJet>::iterator it = protoJetList->begin(); it != protoJetList->end(); ++it) {
110 StJet aJet(
StJet(pj.e(), pj.px(), pj.py(), pj.pz(), 0, 0));
112 TClonesArray* jets = stjets.
jets();
116 const StProtoJet::FourVecList &particleList = pj.list();
117 for(StProtoJet::FourVecList::const_iterator it2 = particleList.begin(); it2 != particleList.end(); ++it2) {
120 cout <<
"StJets::addProtoJet(). ERROR:\tcast to StMuTrackFourVecFailed. no action"<<endl;
123 int muTrackIndex = particle->getIndex();
124 if (muTrackIndex <0) {
125 cout <<
"Error, muTrackIndex<0. abort()"<<endl;
129 StDetectorId detectorId;
130 int mDetId = particle->detectorId();
131 if (mDetId==kTpcIdentifier)
133 else if (mDetId==kBarrelEmcTowerIdentifier)
134 detectorId = kBarrelEmcTowerId;
135 else if (mDetId==kEndcapEmcTowerIdentifier)
136 detectorId = kEndcapEmcTowerId;
138 detectorId = kUnknownId;
144 t2j.SetPxPyPzE(particle->px(), particle->py(), particle->pz(), particle->e() );
145 t2j.setTrackId(
track->id() );
146 t2j.setFlag(
track->flag() );
147 t2j.setCharge(
track->charge() );
148 t2j.setNhits(
track->nHits() );
149 t2j.setNhitsPoss(
track->nHitsPoss() );
150 t2j.setNhitsDedx(
track->nHitsDedx() );
151 t2j.setNhitsFit(
track->nHitsFit() );
152 t2j.setNsigmaPion(
track->nSigmaPion() );
153 t2j.setNsigmaElectron(
track->nSigmaElectron() );
154 t2j.setNsigmaKaon(
track->nSigmaKaon() );
155 t2j.setNsigmaProton(
track->nSigmaProton() );
156 t2j.setTdca (
track->Tdca() );
157 t2j.setTdcaz (
track->dcaZ() );
158 t2j.setTdcaxy (
track->dcaD() );
159 t2j.setetaext (
track->etaext() );
160 t2j.setphiext (
track->phiext() );
161 t2j.setdEdx (
track->dEdx() );
163 stjets.addTrackToIndex(t2j);
171 t2j.SetPxPyPzE(particle->px(), particle->py(), particle->pz(), particle->e());
172 t2j.setTowerId(tower->id());
173 t2j.setDetectorId(tower->detectorId());
174 t2j.setAdc(tower->adc());
175 t2j.setPedestal(tower->pedestal());
176 t2j.setRms(tower->rms());
177 t2j.setStatus(tower->status());
179 stjets.addTowerToIndex(t2j);
187 t2j.SetPtEtaPhiE(mctrack->pt(),mctrack->eta(),mctrack->phi(),mctrack->e());
188 t2j.setId(mctrack->id());
189 t2j.setPdg(mctrack->pdg());
190 t2j.setStatus(mctrack->status());
192 stjets.addTrackToIndex(t2j);
196 if (mDetId==kTpcIdentifier) {
200 else if (mDetId==kBarrelEmcTowerIdentifier) {
204 else if (mDetId==kEndcapEmcTowerIdentifier) {
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
int nTracks
The number of tracks in this jet.
void setBemcCorrupt(bool v)
Set the BEMC corrupt flag. true –> event is corrupt, no jet finding was performed.
TClonesArray * jets()
Access to the jets in this event.
float zVertex
position of vertex used to reconstruct jet
int nBtowers
The number of Barrel towers in this jet.
float etowEtSum
The summed Et from Endcap towers.
TClonesArray * tracks()
The track/tower to jet indices TClonesArray: this contains all the 4momenta contained in jets for jet...
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
int nEtowers
The number of Endcap towers in this jet.
float tpcEtSum
The summed Et from tracks.
float btowEtSum
The summed Et from Barrel towers.