11 #include "StMuMomentumShiftMaker.h"
12 #include "StMuDstMaker.h"
14 #include "StMuEvent.h"
15 #include "StMuTrack.h"
16 #include "StEvent/StRunInfo.h"
17 #ifndef __NO_STRANGE_MUDST__
18 #include "StStrangeMuDstMaker/StKinkMuDst.hh"
19 #include "StStrangeMuDstMaker/StV0MuDst.hh"
20 #include "StStrangeMuDstMaker/StXiMuDst.hh"
21 #include "StStrangeMuDstMaker/StStrangeEvMuDst.hh"
22 #include "StMessMgr.h"
32 StMuMomentumShiftMaker::StMuMomentumShiftMaker(
const char *outDir) :
StMaker(
"MomentumShiftMaker"), mMomentumScale(1), mWriteMuDst(1), mOutFile(0), mOutTree(0) {
37 track->mP *= mMomentumScale;
38 track->mPt = mMomentumScale*track->
pt();
40 track->mHelix.mP *= mMomentumScale;
41 track->mOuterHelix.mP *= mMomentumScale;
43 #ifndef __NO_STRANGE_MUDST__
44 void StMuMomentumShiftMaker::ScaleMomentum(
StKinkMuDst *kink) {
45 kink->mParentMomentum *= mMomentumScale;
46 kink->mParentPrimMomentum *= mMomentumScale;
47 kink->mDaughterMomentum *= mMomentumScale;
48 kink->mTransverseMomentum *= mMomentumScale;
51 void StMuMomentumShiftMaker::ScaleMomentum(
StV0MuDst *v0) {
52 v0->mMomPosX *= mMomentumScale;
53 v0->mMomPosY *= mMomentumScale;
54 v0->mMomPosZ *= mMomentumScale;
55 v0->mMomNegX *= mMomentumScale;
56 v0->mMomNegY *= mMomentumScale;
57 v0->mMomNegZ *= mMomentumScale;
60 void StMuMomentumShiftMaker::ScaleMomentum(
StXiMuDst *xi) {
61 xi->mMomPosX *= mMomentumScale;
62 xi->mMomPosY *= mMomentumScale;
63 xi->mMomPosZ *= mMomentumScale;
64 xi->mMomNegX *= mMomentumScale;
65 xi->mMomNegY *= mMomentumScale;
66 xi->mMomNegZ *= mMomentumScale;
67 xi->mMomBachelorX *= mMomentumScale;
68 xi->mMomBachelorY *= mMomentumScale;
69 xi->mMomBachelorZ *= mMomentumScale;
76 LOG_ERROR <<
"ERROR: cannot find MuDstMaker" << endm;
80 const Char_t *inBaseName= strrchr(mudstMaker->
chain()->GetFile()->GetName(),
'/');
81 if ( ! inBaseName ) inBaseName = (Char_t *) mudstMaker->
chain()->GetFile()->GetName();
82 else inBaseName = inBaseName+1;
84 if (mOutFile==0 || strstr(mOutFile->GetName(),inBaseName)==0) {
92 mOutFile=
new TFile(mOutDir+inBaseName,
"RECREATE");
93 if (!mOutFile->IsOpen()) {
94 LOG_ERROR <<
"ERROR in StMuMomentumShiftMaker::Make: cannot open output file: " << mOutDir+inBaseName << endm;
95 delete mOutFile; mOutFile = 0;
102 event->eventSummary().setMagneticField(event->eventSummary().magneticField());
103 event->runInfo().setMagneticField(mMomentumScale * event->runInfo().magneticField());
104 #ifndef __NO_STRANGE_MUDST__
106 strange_event->mMagneticField *= mMomentumScale;
109 mOutTree=mudstMaker->
chain()->GetTree()->CloneTree(0);
113 Int_t n_prim=mudst->numberOfPrimaryTracks();
114 for (Int_t i_prim=0; i_prim < n_prim; i_prim++) {
116 ScaleMomentum(track);
118 Int_t n_glob=mudst->numberOfGlobalTracks();
119 for (Int_t i_glob=0; i_glob < n_glob; i_glob++) {
121 ScaleMomentum(track);
123 Int_t n_other=mudst->numberOfOtherTracks();
124 for (Int_t i_other=0; i_other < n_other; i_other++) {
126 ScaleMomentum(track);
135 #ifndef __NO_STRANGE_MUDST__
137 Int_t n_kink=mudst->numberOfKinks();
138 for (Int_t i_kink=0; i_kink < n_kink; i_kink++) {
142 Int_t n_v0=mudst->numberOfV0s();
143 for (Int_t i_v0=0; i_v0 < n_v0; i_v0++) {
147 Int_t n_xi=mudst->numberOfXis();
148 for (Int_t i_xi=0; i_xi < n_xi; i_xi++) {
154 mOutTree->Fill(); THack::IsTreeWritable(mOutTree);
160 if (mWriteMuDst && mOutFile) {
static TObjArray * globalTracks()
returns pointer to the global tracks list
Double_t pt() const
Returns pT at point of dca to primary vertex.
static TClonesArray * v0s()
returns pointer to the v0 list
static TClonesArray * otherTracks()
returns pointer to the other tracks list (all tracks that are not flagged as primary of global) ...
static StStrangeEvMuDst * strangeEvent()
returns pointer to current StStrangeEvMuDst (class holding the event wise information, e.g. event number, run number)
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
static TClonesArray * xis()
returns pointer to the xi list
static TClonesArray * kinks()
returns pointer to the kink list