#include <G4SimEvent.h>
Public Member Functions | |
void | add (G4SimTrack *t) |
void | add (G4SimVertex *v) |
void | collisionPoint (const math::XYZTLorentzVectorD &v) |
const math::XYZTLorentzVectorD & | collisionPoint () const |
G4SimEvent () | |
const G4SimTrack & | g4track (int i) const |
const G4SimVertex & | g4vertex (int i) const |
void | hepEvent (const HepMC::GenEvent *r) |
const HepMC::GenEvent * | hepEvent () const |
void | load (edm::SimVertexContainer &c) const |
void | load (edm::SimTrackContainer &c) const |
unsigned int | nGenParts () const |
void | nparam (int n) |
const int | nparam () const |
unsigned int | nTracks () const |
unsigned int | nVertices () const |
void | param (const std::vector< float > &p) |
const std::vector< float > & | param () const |
void | weight (float w) |
const float | weight () const |
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 14 of file G4SimEvent.cc.
: hepMCEvent(0), weight_(0), collisionPoint_(math::XYZTLorentzVectorD(0.,0.,0.,0.)), nparam_(0),param_(0) {}
G4SimEvent::~G4SimEvent | ( | ) | [virtual] |
Definition at line 19 of file G4SimEvent.cc.
References g4tracks, g4vertices, and i.
{ /* while ( !g4tracks.empty() ) { delete g4tracks.back() ; g4tracks.pop_back() ; } while ( !g4vertices.empty() ) { delete g4vertices.back() ; g4vertices.pop_back() ; } */ // per suggestion by Chris Jones, it's faster // that delete back() and pop_back() // unsigned int i = 0 ; for ( i=0; i<g4tracks.size(); i++ ) { delete g4tracks[i] ; g4tracks[i] = 0 ; } g4tracks.clear() ; for ( i=0; i<g4vertices.size(); i++ ) { delete g4vertices[i] ; g4vertices[i] = 0 ; } g4vertices.clear(); }
void G4SimEvent::add | ( | G4SimTrack * | t | ) | [inline] |
Definition at line 35 of file G4SimEvent.h.
References g4tracks.
Referenced by SimTrackManager::getOrCreateVertex(), and SimTrackManager::reallyStoreTracks().
{ g4tracks.push_back(t); }
void G4SimEvent::add | ( | G4SimVertex * | v | ) | [inline] |
void G4SimEvent::collisionPoint | ( | const math::XYZTLorentzVectorD & | v | ) | [inline] |
Definition at line 29 of file G4SimEvent.h.
References collisionPoint_, and findQualityFiles::v.
Referenced by RunManager::produce().
{ collisionPoint_ = v ; }
const math::XYZTLorentzVectorD& G4SimEvent::collisionPoint | ( | ) | const [inline] |
const G4SimTrack& G4SimEvent::g4track | ( | int | i | ) | const [inline] |
const G4SimVertex& G4SimEvent::g4vertex | ( | int | i | ) | const [inline] |
void G4SimEvent::hepEvent | ( | const HepMC::GenEvent * | r | ) | [inline] |
Definition at line 25 of file G4SimEvent.h.
References hepMCEvent, and alignCSCRings::r.
Referenced by RunManager::produce().
{ hepMCEvent = r; }
const HepMC::GenEvent* G4SimEvent::hepEvent | ( | ) | const [inline] |
void G4SimEvent::load | ( | edm::SimVertexContainer & | c | ) | const |
Definition at line 88 of file G4SimEvent.cc.
References g4vertices, i, G4SimVertex::parentIndex(), edm::second(), CoreSimVertex::setEventId(), lumiQTWidget::t, findQualityFiles::v, G4SimVertex::vertexGlobalTime(), and G4SimVertex::vertexPosition().
{ for (unsigned int i=0; i<g4vertices.size(); i++) { G4SimVertex * vtx = g4vertices[i]; // // starting 1_1_0_pre3, SimVertex stores in cm !!! // math::XYZVectorD v3( vtx->vertexPosition().x()/cm, vtx->vertexPosition().y()/cm, vtx->vertexPosition().z()/cm ) ; float t = vtx->vertexGlobalTime()/second; int iv = vtx->parentIndex(); // vv = position // t = global time // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent) SimVertex v = SimVertex(v3,t,iv,i); v.setEventId(EncodedEventId(0)); c.push_back(v); } }
void G4SimEvent::load | ( | edm::SimTrackContainer & | c | ) | const |
Definition at line 55 of file G4SimEvent.cc.
References G4SimTrack::energy(), g4tracks, i, G4SimTrack::id(), G4SimTrack::igenpart(), G4SimTrack::ivert(), G4SimTrack::momentum(), AlCaHLTBitMon_ParallelJobs::p, G4SimTrack::part(), lumiQTWidget::t, G4SimTrack::trackerSurfaceMomentum(), and G4SimTrack::trackerSurfacePosition().
Referenced by OscarProducer::produce().
{ for (unsigned int i=0; i<g4tracks.size(); i++) { G4SimTrack * trk = g4tracks[i]; int ip = trk->part(); math::XYZTLorentzVectorD p( trk->momentum().x()/GeV, trk->momentum().y()/GeV, trk->momentum().z()/GeV, trk->energy()/GeV ) ; int iv = trk->ivert(); int ig = trk->igenpart(); int id = trk->id(); math::XYZVectorD tkpos( trk->trackerSurfacePosition().x()/cm, trk->trackerSurfacePosition().y()/cm, trk->trackerSurfacePosition().z()/cm ) ; math::XYZTLorentzVectorD tkmom( trk->trackerSurfaceMomentum().x()/GeV, trk->trackerSurfaceMomentum().y()/GeV, trk->trackerSurfaceMomentum().z()/GeV, trk->trackerSurfaceMomentum().e()/GeV ) ; // ip = particle ID as PDG // pp = 4-momentum // iv = corresponding G4SimVertex index // ig = corresponding GenParticle index SimTrack t = SimTrack(ip,p,iv,ig,tkpos,tkmom); t.setTrackId(id); t.setEventId(EncodedEventId(0)); c.push_back(t); } std::stable_sort(c.begin(),c.end(),IdSort()); }
unsigned int G4SimEvent::nGenParts | ( | ) | const [inline] |
Definition at line 24 of file G4SimEvent.h.
References hepMCEvent.
Referenced by RunManager::produce().
{ return hepMCEvent->particles_size(); }
void G4SimEvent::nparam | ( | int | n | ) | [inline] |
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().
{ return g4tracks.size(); }
unsigned int G4SimEvent::nVertices | ( | ) | const [inline] |
Definition at line 23 of file G4SimEvent.h.
References g4vertices.
Referenced by RunManager::produce().
{ return g4vertices.size(); }
void G4SimEvent::param | ( | const std::vector< float > & | p | ) | [inline] |
Definition at line 33 of file G4SimEvent.h.
References AlCaHLTBitMon_ParallelJobs::p, and param_.
const std::vector<float>& G4SimEvent::param | ( | ) | const [inline] |
const float G4SimEvent::weight | ( | void | ) | const [inline] |
void G4SimEvent::weight | ( | float | w | ) | [inline] |
Definition at line 27 of file G4SimEvent.h.
Referenced by RunManager::produce().
math::XYZTLorentzVectorD G4SimEvent::collisionPoint_ [protected] |
Definition at line 42 of file G4SimEvent.h.
Referenced by collisionPoint().
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] |
Definition at line 40 of file G4SimEvent.h.
Referenced by hepEvent(), and nGenParts().
int G4SimEvent::nparam_ [protected] |
Definition at line 43 of file G4SimEvent.h.
Referenced by nparam().
std::vector<float> G4SimEvent::param_ [protected] |
Definition at line 44 of file G4SimEvent.h.
Referenced by param().
float G4SimEvent::weight_ [protected] |
Definition at line 41 of file G4SimEvent.h.
Referenced by weight().