StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPythiaFourPMaker.cxx
1 // $Id: StPythiaFourPMaker.cxx,v 1.19 2011/01/27 20:43:12 pibero Exp $
2 #include "StPythiaFourPMaker.h"
3 
4 #include "StMuTrackFourVec.h"
5 
6 #include "StjMCMuDst.h"
7 
8 #include "StjMCParticleList.h"
9 #include "StjMCParticleListCut.h"
10 #include "StjMCParticleCut.h"
11 #include "StjMCParticleCutEta.h"
12 #include "StjMCParticleCutStatus.h"
13 #include "StjMCParticleToStMuTrackFourVec.h"
14 
15 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
16 
17 #include <TLorentzVector.h>
18 
19 #include <iostream>
20 
21 using namespace std;
22 
23 ClassImp(StPythiaFourPMaker)
24 
25 Int_t StPythiaFourPMaker::Init()
26 {
27  _mc = new StjMCMuDst(this);
28  _cut = new StjMCParticleListCut();
29  _cut->addCut(new StjMCParticleCutEta(-5.0, 5.0));
30  return kStOK;
31 }
32 
33 void StPythiaFourPMaker::Clear(Option_t* opt)
34 {
35  for (size_t iNode = 0; iNode < _vertexNodes.size(); ++iNode) {
36  VertexNode& node = _vertexNodes[iNode];
37  if (node.vertex) {
38  delete node.vertex;
39  node.vertex = 0;
40  }
41  FourList& tracks = node.tracks;
42  for (FourList::iterator it = tracks.begin(); it != tracks.end(); ++it) {
43  delete *it;
44  *it = 0;
45  }
46  tracks.clear();
47  }
48  _vertexNodes.clear();
49 }
50 
52 {
53  const TVector3& v = _mc->getMCVertex().position();
55  pv->setPosition(StThreeVectorF(v.x(),v.y(),v.z()));
56  _vertexNodes.push_back(VertexNode());
57  _vertexNodes[0].vertex = pv;
58  StjMCParticleList theList = (*_cut)(_mc->getMCParticleList());
59  FourList& tracks = _vertexNodes[0].tracks;
60  transform(theList.begin(),theList.end(),back_inserter(tracks),StjMCParticleToStMuTrackFourVec());
61 
62  return kStOK;
63 }
void Clear(Option_t *opt)
User defined functions.
Definition: Stypes.h:40