#include <SimG4Core/Application/interface/G4SimEvent.h>
Public Member Functions | |
void | add (G4SimVertex *v) |
void | add (G4SimTrack *t) |
const math::XYZTLorentzVectorD & | collisionPoint () const |
void | collisionPoint (math::XYZTLorentzVectorD v) |
G4SimEvent () | |
const G4SimTrack & | g4track (int i) const |
const G4SimVertex & | g4vertex (int i) const |
const HepMC::GenEvent * | hepEvent () const |
void | hepEvent (const HepMC::GenEvent *r) |
void | load (edm::SimVertexContainer &c) const |
void | load (edm::SimTrackContainer &c) const |
unsigned int | nGenParts () const |
const int | nparam () const |
void | nparam (int n) |
unsigned int | nTracks () const |
unsigned int | nVertices () const |
const std::vector< float > & | param () const |
void | param (std::vector< float > p) |
const float | weight () const |
void | weight (float w) |
virtual | ~G4SimEvent () |
Protected Attributes | |
math::XYZTLorentzVectorD | collisionPoint_ |
std::vector< G4SimTrack * > | g4tracks |
std::vector< G4SimVertex * > | g4vertices |
const HepMC::GenEvent * | hepMCEvent |
int | nparam_ |
std::vector< float > | param_ |
float | weight_ |
Definition at line 15 of file G4SimEvent.h.
G4SimEvent::G4SimEvent | ( | ) |
Definition at line 15 of file G4SimEvent.cc.
00015 : hepMCEvent(0), 00016 weight_(0), 00017 collisionPoint_(math::XYZTLorentzVectorD(0.,0.,0.,0.)), 00018 nparam_(0),param_(0) {}
G4SimEvent::~G4SimEvent | ( | ) | [virtual] |
Definition at line 20 of file G4SimEvent.cc.
References g4tracks, g4vertices, and i.
00021 { 00022 00023 /* 00024 while ( !g4tracks.empty() ) 00025 { 00026 delete g4tracks.back() ; 00027 g4tracks.pop_back() ; 00028 } 00029 while ( !g4vertices.empty() ) 00030 { 00031 delete g4vertices.back() ; 00032 g4vertices.pop_back() ; 00033 } 00034 */ 00035 00036 // per suggestion by Chris Jones, it's faster 00037 // that delete back() and pop_back() 00038 // 00039 unsigned int i = 0 ; 00040 00041 for ( i=0; i<g4tracks.size(); i++ ) 00042 { 00043 delete g4tracks[i] ; 00044 g4tracks[i] = 0 ; 00045 } 00046 g4tracks.clear() ; 00047 00048 for ( i=0; i<g4vertices.size(); i++ ) 00049 { 00050 delete g4vertices[i] ; 00051 g4vertices[i] = 0 ; 00052 } 00053 g4vertices.clear(); 00054 }
void G4SimEvent::add | ( | G4SimVertex * | v | ) | [inline] |
Definition at line 36 of file G4SimEvent.h.
References g4vertices, and v.
00036 { g4vertices.push_back(v); }
void G4SimEvent::add | ( | G4SimTrack * | t | ) | [inline] |
Definition at line 35 of file G4SimEvent.h.
Referenced by SimTrackManager::getOrCreateVertex(), and SimTrackManager::reallyStoreTracks().
00035 { g4tracks.push_back(t); }
const math::XYZTLorentzVectorD& G4SimEvent::collisionPoint | ( | ) | const [inline] |
Definition at line 30 of file G4SimEvent.h.
References collisionPoint_.
00030 { return collisionPoint_; }
void G4SimEvent::collisionPoint | ( | math::XYZTLorentzVectorD | v | ) | [inline] |
Definition at line 29 of file G4SimEvent.h.
References collisionPoint_.
Referenced by RunManager::produce().
00029 { collisionPoint_ = v ; }
const G4SimTrack& G4SimEvent::g4track | ( | int | i | ) | const [inline] |
const G4SimVertex& G4SimEvent::g4vertex | ( | int | i | ) | const [inline] |
Definition at line 38 of file G4SimEvent.h.
References g4vertices.
00038 { return *g4vertices[i-1]; }
const HepMC::GenEvent* G4SimEvent::hepEvent | ( | ) | const [inline] |
void G4SimEvent::hepEvent | ( | const HepMC::GenEvent * | r | ) | [inline] |
Definition at line 25 of file G4SimEvent.h.
References hepMCEvent.
Referenced by RunManager::produce().
00025 { hepMCEvent = r; }
void G4SimEvent::load | ( | edm::SimVertexContainer & | c | ) | const |
Definition at line 89 of file G4SimEvent.cc.
References g4vertices, i, G4SimVertex::parentIndex(), edm::second(), CoreSimVertex::setEventId(), t, v, v3, G4SimVertex::vertexGlobalTime(), and G4SimVertex::vertexPosition().
00090 { 00091 for (unsigned int i=0; i<g4vertices.size(); i++) 00092 { 00093 G4SimVertex * vtx = g4vertices[i]; 00094 // 00095 // starting 1_1_0_pre3, SimVertex stores in cm !!! 00096 // 00097 math::XYZVectorD v3( vtx->vertexPosition().x()/cm, 00098 vtx->vertexPosition().y()/cm, 00099 vtx->vertexPosition().z()/cm ) ; 00100 float t = vtx->vertexGlobalTime()/second; 00101 int iv = vtx->parentIndex(); 00102 // vv = position 00103 // t = global time 00104 // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent) 00105 SimVertex v = SimVertex(v3,t,iv); 00106 v.setEventId(EncodedEventId(0)); 00107 c.push_back(v); 00108 } 00109 }
void G4SimEvent::load | ( | edm::SimTrackContainer & | c | ) | const |
Definition at line 56 of file G4SimEvent.cc.
References G4SimTrack::energy(), g4tracks, i, G4SimTrack::id(), G4SimTrack::igenpart(), G4SimTrack::ivert(), G4SimTrack::momentum(), p, G4SimTrack::part(), t, G4SimTrack::trackerSurfaceMomentum(), and G4SimTrack::trackerSurfacePosition().
Referenced by OscarProducer::produce().
00057 { 00058 for (unsigned int i=0; i<g4tracks.size(); i++) 00059 { 00060 G4SimTrack * trk = g4tracks[i]; 00061 int ip = trk->part(); 00062 math::XYZTLorentzVectorD p( trk->momentum().x()/GeV, 00063 trk->momentum().y()/GeV, 00064 trk->momentum().z()/GeV, 00065 trk->energy()/GeV ) ; 00066 int iv = trk->ivert(); 00067 int ig = trk->igenpart(); 00068 int id = trk->id(); 00069 math::XYZVectorD tkpos( trk->trackerSurfacePosition().x()/cm, 00070 trk->trackerSurfacePosition().y()/cm, 00071 trk->trackerSurfacePosition().z()/cm ) ; 00072 math::XYZTLorentzVectorD tkmom( trk->trackerSurfaceMomentum().x()/GeV, 00073 trk->trackerSurfaceMomentum().y()/GeV, 00074 trk->trackerSurfaceMomentum().z()/GeV, 00075 trk->trackerSurfaceMomentum().e()/GeV ) ; 00076 // ip = particle ID as PDG 00077 // pp = 4-momentum 00078 // iv = corresponding G4SimVertex index 00079 // ig = corresponding GenParticle index 00080 SimTrack t = SimTrack(ip,p,iv,ig,tkpos,tkmom); 00081 t.setTrackId(id); 00082 t.setEventId(EncodedEventId(0)); 00083 c.push_back(t); 00084 } 00085 std::stable_sort(c.begin(),c.end(),IdSort()); 00086 00087 }
unsigned int G4SimEvent::nGenParts | ( | ) | const [inline] |
Definition at line 24 of file G4SimEvent.h.
References hepMCEvent.
Referenced by RunManager::produce().
00024 { return hepMCEvent->particles_size(); }
const int G4SimEvent::nparam | ( | ) | const [inline] |
unsigned int G4SimEvent::nTracks | ( | ) | const [inline] |
Definition at line 22 of file G4SimEvent.h.
References g4tracks.
Referenced by RunManager::produce().
00022 { return g4tracks.size(); }
unsigned int G4SimEvent::nVertices | ( | ) | const [inline] |
Definition at line 23 of file G4SimEvent.h.
References g4vertices.
Referenced by RunManager::produce().
00023 { return g4vertices.size(); }
const std::vector<float>& G4SimEvent::param | ( | ) | const [inline] |
void G4SimEvent::param | ( | std::vector< float > | p | ) | [inline] |
const float G4SimEvent::weight | ( | ) | const [inline] |
void G4SimEvent::weight | ( | float | w | ) | [inline] |
Definition at line 27 of file G4SimEvent.h.
References weight_.
Referenced by RunManager::produce().
math::XYZTLorentzVectorD G4SimEvent::collisionPoint_ [protected] |
std::vector<G4SimTrack *> G4SimEvent::g4tracks [protected] |
Definition at line 45 of file G4SimEvent.h.
Referenced by add(), g4track(), load(), nTracks(), and ~G4SimEvent().
std::vector<G4SimVertex *> G4SimEvent::g4vertices [protected] |
Definition at line 46 of file G4SimEvent.h.
Referenced by add(), g4vertex(), load(), nVertices(), and ~G4SimEvent().
const HepMC::GenEvent* G4SimEvent::hepMCEvent [protected] |
int G4SimEvent::nparam_ [protected] |
std::vector<float> G4SimEvent::param_ [protected] |
float G4SimEvent::weight_ [protected] |