00001
00002 #include "StPythiaFourPMaker.h"
00003
00004 #include "StMuTrackFourVec.h"
00005
00006 #include "StjMCMuDst.h"
00007
00008 #include "StjMCParticleList.h"
00009 #include "StjMCParticleListCut.h"
00010 #include "StjMCParticleCut.h"
00011 #include "StjMCParticleCutEta.h"
00012 #include "StjMCParticleCutStatus.h"
00013 #include "StjMCParticleToStMuTrackFourVec.h"
00014
00015 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
00016
00017 #include <TLorentzVector.h>
00018
00019 #include <iostream>
00020
00021 using namespace std;
00022
00023 ClassImp(StPythiaFourPMaker)
00024
00025 Int_t StPythiaFourPMaker::Init()
00026 {
00027 _mc = new StjMCMuDst(this);
00028 _cut = new StjMCParticleListCut();
00029 _cut->addCut(new StjMCParticleCutEta(-5.0, 5.0));
00030 return kStOK;
00031 }
00032
00033 void StPythiaFourPMaker::Clear(Option_t* opt)
00034 {
00035 for (size_t iNode = 0; iNode < _vertexNodes.size(); ++iNode) {
00036 VertexNode& node = _vertexNodes[iNode];
00037 if (node.vertex) {
00038 delete node.vertex;
00039 node.vertex = 0;
00040 }
00041 FourList& tracks = node.tracks;
00042 for (FourList::iterator it = tracks.begin(); it != tracks.end(); ++it) {
00043 delete *it;
00044 *it = 0;
00045 }
00046 tracks.clear();
00047 }
00048 _vertexNodes.clear();
00049 }
00050
00051 Int_t StPythiaFourPMaker::Make()
00052 {
00053 const TVector3& v = _mc->getMCVertex().position();
00054 StMuPrimaryVertex* pv = new StMuPrimaryVertex;
00055 pv->setPosition(StThreeVectorF(v.x(),v.y(),v.z()));
00056 _vertexNodes.push_back(VertexNode());
00057 _vertexNodes[0].vertex = pv;
00058 StjMCParticleList theList = (*_cut)(_mc->getMCParticleList());
00059 FourList& tracks = _vertexNodes[0].tracks;
00060 transform(theList.begin(),theList.end(),back_inserter(tracks),StjMCParticleToStMuTrackFourVec());
00061
00062 return kStOK;
00063 }