3 #include "TLorentzVector.h"
5 #include "StChargedPionHelpers.h"
7 #include "StChargedPionBaseEv.h"
8 #include "StChargedPionEvent.h"
9 #include "StChargedPionJet.h"
10 #include "StChargedPionMcEvent.h"
11 #include "StChargedPionTrack.h"
12 #include "StChargedPionVertex.h"
14 #include "StSpinPool/StJetSkimEvent/StJetSkimEvent.h"
15 #include "StSpinPool/StJets/StJets.h"
16 #include "StSpinPool/StJets/StJet.h"
18 #include "StMuDSTMaker/COMMON/StMuDst.h"
19 #include "StMuDSTMaker/COMMON/StMuTrack.h"
20 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
21 #include "StSpinPool/StMCAsymMaker/StPythiaEvent.h"
27 void StChargedPionHelpers::
29 ev->setRunId(skimEvent->runId());
30 ev->setEventId(skimEvent->eventId());
31 ev->setBbcTimeBin(skimEvent->bbcTimeBin());
32 const char *baseName = strrchr(skimEvent->mudstFileName().GetString().Data(),
'/');
33 baseName = baseName + 1;
34 ev->setMuDstName( baseName );
38 data->setBx7(skimEvent->bx7());
40 data->setSpinBit(skimEvent->spin4usingBx48());
41 data->setPolValid(skimEvent->isValid());
42 data->setPolLong(skimEvent->isPolLong());
43 data->setPolTrans(skimEvent->isPolTrans());
44 data->setBxingMasked(skimEvent->isMaskedUsingBx48());
45 data->setBxingOffset(skimEvent->offsetBx48minusBX7());
47 for(
int i=0; i<skimEvent->trigHeaders()->GetEntriesFast(); i++) {
49 data->setPrescale(h->trigId, h->prescale);
52 for(
int i=0; i<skimEvent->triggers()->GetEntriesFast(); i++) {
54 if(t->didFire() > 0) data->addTrigger(t->trigId());
55 if(t->shouldFire() > 0) data->addSimuTrigger(t->trigId());
58 m = &(t->towersAboveThreshold(0));
59 for(map<int,int>::const_iterator it=m->begin(); it!=m->end(); it++) {
60 data->addHighTower(it->first, it->second);
64 m = &(t->triggerPatchesAboveThreshold(0));
65 for(map<int,int>::const_iterator it=m->begin(); it!=m->end(); it++) {
66 data->addTriggerPatch(it->first, it->second);
70 m = &(t->jetPatchesAboveThreshold(0));
71 for(map<int,int>::const_iterator it=m->begin(); it!=m->end(); it++) {
72 data->addJetPatch(it->first, it->second);
78 if(skimEvent->eBbc() > 0 && skimEvent->wBbc() > 0) {
79 if(ev->runId() > 6000000 && ev->runId() < 7000000) {
80 ev->addSimuTrigger(96011);
82 else if(ev->runId() > 7000000 && ev->runId() < 8000000) {
83 ev->addSimuTrigger(117001);
88 for(
int i=0; i<skimEvent->vertices()->GetEntriesFast(); i++) {
90 v.SetX( skv->position()[0] );
91 v.SetY( skv->position()[1] );
92 v.SetZ( skv->position()[2] );
93 v.setRanking( skv->ranking() );
98 void StChargedPionHelpers::
100 *
static_cast<TLorentzVector*
>(jet) = *static_cast<TLorentzVector*>(oldJet);
102 jet->setCharge(oldJet->
charge);
103 jet->setNTpcTracks(oldJet->
nTracks);
104 jet->setNBarrelTowers(oldJet->
nBtowers);
105 jet->setNEndcapTowers(oldJet->
nEtowers);
109 jet->setVertexZ(oldJet->
zVertex);
111 for(
unsigned i=0; i<oldJet->geomTriggers().size(); i++) {
112 jet->addTrigger(oldJet->geomTriggers()[i]);
119 for(
unsigned i=0; i<particles.size(); i++ )
121 particle.SetPt ( particles[i]->Pt() );
122 particle.SetEta( particles[i]->Eta() );
123 particle.SetPhi( particles[i]->Phi() );
124 particle.SetE( particles[i]->E() );
126 if ( (myTower = dynamic_cast<TowerToJetIndex *>(particles[i])) )
128 particle.setIndex( myTower->towerId() );
129 particle.setDetectorId( StDetectorId(myTower->detectorId()) );
130 particle.setCharge( 0 );
132 else if ( (myTrack = dynamic_cast<TrackToJetIndex *>(particles[i])) )
134 particle.setIndex( myTrack->trackIndex() );
135 particle.setDetectorId( myTrack->detectorId() );
136 particle.setCharge( myTrack->charge());
137 particle.setNHits( myTrack->nHits() );
138 particle.setNHitsFit( myTrack->nHitsFit() );
139 particle.setNHitsPoss( myTrack->nHitsPoss() );
140 particle.setNHitsDEdx( myTrack->nHitsDedx() );
141 particle.setNSigmaPion( myTrack->nSigmaPion() );
143 dca.setY(
float(myTrack->Tdcaxy()) );
144 dca.setZ(
float(myTrack->Tdcaz()) );
145 particle.setGlobalDca( dca );
147 jet->addParticle(&particle);
151 void StChargedPionHelpers::
156 TClonesArray *oldJets = jets->
jets();
157 for(
int i=0; i<oldJets->GetEntriesFast(); i++) {
158 StJet *oldJet =
static_cast<StJet*
>(oldJets->At(i));
159 translateJet(oldJet, jets->particles(i), &myjet);
160 if(v) myjet.setVertexZ(v->z());
166 void StChargedPionHelpers::
171 TClonesArray *oldJets = jets->
jets();
172 for(
int i=0; i<oldJets->GetEntriesFast(); i++) {
173 StJet *oldJet =
static_cast<StJet*
>(oldJets->At(i));
174 translateJet(oldJet, jets->particles(i), &myjet);
175 if(v) myjet.setVertexZ(v->z());
176 ev->mcJets().push_back(myjet);
181 void StChargedPionHelpers::
186 ev->parton1() = StChargedPionLorentzVector(pythia->particle(0)->Px(),
187 pythia->particle(0)->Py(),
188 pythia->particle(0)->Pz(),
189 pythia->particle(0)->Energy());
190 ev->parton2() = StChargedPionLorentzVector(pythia->particle(1)->Px(),
191 pythia->particle(1)->Py(),
192 pythia->particle(1)->Pz(),
193 pythia->particle(1)->Energy());
194 ev->parton3() = StChargedPionLorentzVector(pythia->particle(2)->Px(),
195 pythia->particle(2)->Py(),
196 pythia->particle(2)->Pz(),
197 pythia->particle(2)->Energy());
198 ev->parton4() = StChargedPionLorentzVector(pythia->particle(3)->Px(),
199 pythia->particle(3)->Py(),
200 pythia->particle(3)->Pz(),
201 pythia->particle(3)->Energy());
202 ev->setProcessId(pythia->processId());
203 ev->setX1(pythia->x1());
206 void StChargedPionHelpers::
208 ev->mcVertex() = StChargedPion3Vector(mini->mcVertexX(),
212 TClonesArray* mcTracks = mini->tracks(MC);
213 TClonesArray* matchedPairs = mini->tracks(MATCHED);
214 TClonesArray* mergedPairs = mini->tracks(MERGED);
215 TClonesArray* splitPairs = mini->tracks(SPLIT);
216 TClonesArray* contamPairs = mini->tracks(CONTAM);
217 TClonesArray* ghostPairs = mini->tracks(GHOST);
221 for(
int i=0; i<mcTracks->GetEntriesFast(); i++) {
223 if(t->ptMc() > 1.7) ev->mcTracks().push_back(*t);
234 for(
int i=0; i<matchedPairs->GetEntriesFast(); i++) {
236 if(p->ptPr() > 2.0) {
237 ev->matchedPairs().push_back(*p);
241 for(
int i=0; i<mergedPairs->GetEntriesFast(); i++) {
243 if(p->ptPr() > 2.0) {
244 ev->mergedPairs().push_back(*p);
248 for(
int i=0; i<splitPairs->GetEntriesFast(); i++) {
250 if(p->ptPr() > 2.0) {
251 ev->splitPairs().push_back(*p);
255 for(
int i=0; i<contamPairs->GetEntriesFast(); i++) {
257 if(p->ptPr() > 2.0) {
258 ev->contamPairs().push_back(*p);
262 for(
int i=0; i<ghostPairs->GetEntriesFast(); i++) {
264 if(p->ptPr() > 2.0) {
265 ev->ghostPairs().push_back(*p);
270 void StChargedPionHelpers::
272 translateMuDst(static_cast<StChargedPionBaseEv*>(ev));
274 ev->setBx7(
StMuDst::event()->l0Trigger().bunchCrossingId7bit(ev->runId()) );
278 if(ev->runId() > 7000000)
282 void StChargedPionHelpers::
284 translateMuDst(static_cast<StChargedPionBaseEv*>(ev));
287 void StChargedPionHelpers::
292 ev->setBbcTimeBin(
StMuDst::event()->bbcTriggerDetector().onlineTimeDifference() );
296 unsigned int nVertices = StMuDst::numberOfPrimaryVertices();
297 for(
unsigned int i=0; i<nVertices; ++i){
300 vertex.SetX( muVert->position().x() );
301 vertex.SetY( muVert->position().y() );
302 vertex.SetZ( muVert->position().z() );
303 vertex.setRanking( muVert->ranking() );
304 ev->addVertex(&vertex);
308 for(
unsigned int vertex_index=0; vertex_index<nVertices; vertex_index++){
313 int nentries = StMuDst::numberOfPrimaryTracks();
314 assert(nentries==primaryTracks->GetEntries());
315 for(
int i=0; i<nentries; i++){
320 switch(track->bad()){
338 if(track->
pt() < 2.)
continue;
339 if(TMath::Abs(track->
eta()) > 2.1)
continue;
342 translateTrack(track, &cpTrack);
343 cpTrack.setB(
StMuDst::event()->eventSummary().magneticField()*kilogauss);
346 ev->addTrack(&cpTrack);
351 void StChargedPionHelpers::
354 cp->setFlag(mu->
flag());
358 cp->setNHits(mu->
nHits());
367 cp->setDedx(mu->
dEdx());
369 cp->setChi2(mu->
chi2());
372 cp->setPtEtaPhi(mu->
pt(),mu->
eta(),mu->
phi());
374 cp->setCharge(mu->
charge());
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
Double_t chi2prob() const
Returns probability of fit.
Int_t vertexIndex() const
Returns index of associated primary vertex.
Double_t pt() const
Returns pT at point of dca to primary vertex.
short id() const
Returns the track id(or key), is unique for a track node, i.e. global and primary tracks have the sam...
UShort_t nHitsDedx() const
Return number of hits used for dEdx.
Double_t chi2() const
Returns chi2 of fit.
int nTracks
The number of tracks in this jet.
Top level class for the MiniMcTree, containing event-wise information and the McTrack, and all TrackPair collections.
TClonesArray * jets()
Access to the jets in this event.
float zVertex
position of vertex used to reconstruct jet
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
UShort_t nHitsFit() const
Return total number of hits used in fit.
int nBtowers
The number of Barrel towers in this jet.
short flag() const
Returns flag, (see StEvent manual for type information)
Short_t charge() const
Returns charge.
float etowEtSum
The summed Et from Endcap towers.
Double_t nSigmaPion() const
Returns Craig's distance to the calculated dE/dx band for pions in units of sigma.
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
void setL2Result(const void *address, bool emulated=false)
address to dijet result
Double_t nSigmaElectron() const
Returns Craig's distance to the calculated dE/dx band for electrons in units of sigma.
UShort_t nHitsPoss() const
Return number of possible hits on track.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
UShort_t nHits() const
Bingchu.
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
Double_t dEdx() const
Returns measured dE/dx value.
Double_t phi() const
Returns phi at point of dca to primary vertex.
Double_t nSigmaProton() const
Returns Craig's distance to the calculated dE/dx band for protons in units of sigma.
int nEtowers
The number of Endcap towers in this jet.
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
float tpcEtSum
The summed Et from tracks.
Double_t nSigmaKaon() const
Returns Craig's distance to the calculated dE/dx band for kaons in units of sigma.
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
float btowEtSum
The summed Et from Barrel towers.
int charge
The summed coulomb charge of the tracks in this jet.