CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
G4SimEvent Class Reference

#include <G4SimEvent.h>

Public Member Functions

void add (G4SimTrack *t)
 
void add (G4SimVertex *v)
 
void clear ()
 
void collisionPoint (const math::XYZTLorentzVectorD &v)
 
const math::XYZTLorentzVectorDcollisionPoint () const
 
 G4SimEvent ()
 
void hepEvent (const HepMC::GenEvent *r)
 
const HepMC::GenEventhepEvent () const
 
void load (edm::SimTrackContainer &c) const
 
void load (edm::SimVertexContainer &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)
 
float weight () const
 
virtual ~G4SimEvent ()
 

Private Attributes

math::XYZTLorentzVectorD collisionPoint_
 
std::vector< G4SimTrack * > g4tracks_
 
std::vector< G4SimVertex * > g4vertices_
 
const HepMC::GenEventhepMCEvent_
 
int nparam_
 
std::vector< float > param_
 
float weight_
 

Detailed Description

Definition at line 14 of file G4SimEvent.h.

Constructor & Destructor Documentation

◆ G4SimEvent()

G4SimEvent::G4SimEvent ( )

Definition at line 11 of file G4SimEvent.cc.

References g4tracks_, and g4vertices_.

12  : hepMCEvent_(nullptr),
13  weight_(0),
15  nparam_(0),
16  param_(0) {
17  g4vertices_.reserve(2000);
18  g4tracks_.reserve(4000);
19 }
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
int nparam_
Definition: G4SimEvent.h:41
std::vector< G4SimTrack * > g4tracks_
Definition: G4SimEvent.h:43
float weight_
Definition: G4SimEvent.h:39
const HepMC::GenEvent * hepMCEvent_
Definition: G4SimEvent.h:38
std::vector< float > param_
Definition: G4SimEvent.h:42
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:40
std::vector< G4SimVertex * > g4vertices_
Definition: G4SimEvent.h:44

◆ ~G4SimEvent()

G4SimEvent::~G4SimEvent ( )
virtual

Definition at line 21 of file G4SimEvent.cc.

References clear().

21 { clear(); }
void clear()
Definition: G4SimEvent.cc:23

Member Function Documentation

◆ add() [1/2]

void G4SimEvent::add ( G4SimTrack t)
inline

Definition at line 33 of file G4SimEvent.h.

References g4tracks_, and submitPVValidationJobs::t.

Referenced by SimTrackManager::getOrCreateVertex(), SimTrackManager::reallyStoreTracks(), and counter.Counter::register().

33 { g4tracks_.push_back(t); }
std::vector< G4SimTrack * > g4tracks_
Definition: G4SimEvent.h:43

◆ add() [2/2]

void G4SimEvent::add ( G4SimVertex v)
inline

Definition at line 34 of file G4SimEvent.h.

References g4vertices_, and findQualityFiles::v.

Referenced by counter.Counter::register().

34 { g4vertices_.push_back(v); }
std::vector< G4SimVertex * > g4vertices_
Definition: G4SimEvent.h:44

◆ clear()

void G4SimEvent::clear ( void  )

Definition at line 23 of file G4SimEvent.cc.

References g4tracks_, and g4vertices_.

Referenced by RunManagerMTWorker::produce(), and ~G4SimEvent().

23  {
24  // per suggestion by Chris Jones, it's faster
25  // that delete back() and pop_back()
26  for (auto& ptr : g4tracks_) {
27  delete ptr;
28  }
29  g4tracks_.clear();
30  for (auto& ptr : g4vertices_) {
31  delete ptr;
32  }
33  g4vertices_.clear();
34 }
std::vector< G4SimTrack * > g4tracks_
Definition: G4SimEvent.h:43
std::vector< G4SimVertex * > g4vertices_
Definition: G4SimEvent.h:44

◆ collisionPoint() [1/2]

void G4SimEvent::collisionPoint ( const math::XYZTLorentzVectorD v)
inline

Definition at line 27 of file G4SimEvent.h.

References collisionPoint_, and findQualityFiles::v.

Referenced by RunManagerMTWorker::produce().

27 { collisionPoint_ = v; }
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:40

◆ collisionPoint() [2/2]

const math::XYZTLorentzVectorD& G4SimEvent::collisionPoint ( ) const
inline

Definition at line 28 of file G4SimEvent.h.

References collisionPoint_.

28 { return collisionPoint_; }
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:40

◆ hepEvent() [1/2]

void G4SimEvent::hepEvent ( const HepMC::GenEvent r)
inline

Definition at line 23 of file G4SimEvent.h.

References hepMCEvent_, and alignCSCRings::r.

Referenced by RunManagerMTWorker::produce().

23 { hepMCEvent_ = r; }
const HepMC::GenEvent * hepMCEvent_
Definition: G4SimEvent.h:38

◆ hepEvent() [2/2]

const HepMC::GenEvent* G4SimEvent::hepEvent ( ) const
inline

Definition at line 24 of file G4SimEvent.h.

References hepMCEvent_.

24 { return hepMCEvent_; }
const HepMC::GenEvent * hepMCEvent_
Definition: G4SimEvent.h:38

◆ load() [1/2]

void G4SimEvent::load ( edm::SimTrackContainer c) const

Definition at line 36 of file G4SimEvent.cc.

References c, g4tracks_, gpuVertexFinder::iv, AlCaHLTBitMon_ParallelJobs::p, mcMuonSeeds_cfi::SimTrack, and submitPVValidationJobs::t.

Referenced by OscarMTProducer::produce().

36  {
37  for (auto& trk : g4tracks_) {
38  int ip = trk->part();
40  trk->momentum().x() / GeV, trk->momentum().y() / GeV, trk->momentum().z() / GeV, trk->energy() / GeV);
41  int iv = trk->ivert();
42  int ig = trk->igenpart();
43  int id = trk->id();
44  math::XYZVectorD tkpos(trk->trackerSurfacePosition().x() / cm,
45  trk->trackerSurfacePosition().y() / cm,
46  trk->trackerSurfacePosition().z() / cm);
47  math::XYZTLorentzVectorD tkmom(trk->trackerSurfaceMomentum().x() / GeV,
48  trk->trackerSurfaceMomentum().y() / GeV,
49  trk->trackerSurfaceMomentum().z() / GeV,
50  trk->trackerSurfaceMomentum().e() / GeV);
51  // ip = particle ID as PDG
52  // pp = 4-momentum
53  // iv = corresponding G4SimVertex index
54  // ig = corresponding GenParticle index
55  SimTrack t = SimTrack(ip, p, iv, ig, tkpos, tkmom);
56  t.setTrackId(id);
57  t.setEventId(EncodedEventId(0));
58  if (trk->crossedBoundary())
59  t.setCrossedBoundaryVars(
60  trk->crossedBoundary(), trk->getIDAtBoundary(), trk->getPositionAtBoundary(), trk->getMomentumAtBoundary());
61  c.push_back(t);
62  }
63  std::stable_sort(c.begin(), c.end(), IdSort());
64 }
int32_t *__restrict__ iv
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
std::vector< G4SimTrack * > g4tracks_
Definition: G4SimEvent.h:43
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8

◆ load() [2/2]

void G4SimEvent::load ( edm::SimVertexContainer c) const

Definition at line 66 of file G4SimEvent.cc.

References c, g4vertices_, mps_fire::i, gpuVertexFinder::iv, edm::second(), mcMuonSeeds_cfi::SimVertex, submitPVValidationJobs::t, findQualityFiles::v, and extraflags_cff::vtx.

66  {
67  for (unsigned int i = 0; i < g4vertices_.size(); ++i) {
69  //
70  // starting 1_1_0_pre3, SimVertex stores in cm !!!
71  //
72  math::XYZVectorD v3(vtx->vertexPosition().x() / cm, vtx->vertexPosition().y() / cm, vtx->vertexPosition().z() / cm);
73  float t = vtx->vertexGlobalTime() / second;
74  int iv = vtx->parentIndex();
75  // vv = position
76  // t = global time
77  // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent)
78  SimVertex v = SimVertex(v3, t, iv, i);
79  v.setProcessType(vtx->processType());
80  v.setEventId(EncodedEventId(0));
81  c.push_back(v);
82  }
83 }
int32_t *__restrict__ iv
U second(std::pair< T, U > const &p)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
std::vector< G4SimVertex * > g4vertices_
Definition: G4SimEvent.h:44

◆ nGenParts()

unsigned int G4SimEvent::nGenParts ( ) const
inline

Definition at line 22 of file G4SimEvent.h.

References hepMCEvent_.

Referenced by RunManagerMTWorker::produce().

22 { return hepMCEvent_->particles_size(); }
const HepMC::GenEvent * hepMCEvent_
Definition: G4SimEvent.h:38

◆ nparam() [1/2]

void G4SimEvent::nparam ( int  n)
inline

Definition at line 29 of file G4SimEvent.h.

References dqmiodumpmetadata::n, and nparam_.

◆ nparam() [2/2]

const int G4SimEvent::nparam ( ) const
inline

Definition at line 30 of file G4SimEvent.h.

References nparam_.

30 { return nparam_; }
int nparam_
Definition: G4SimEvent.h:41

◆ nTracks()

unsigned int G4SimEvent::nTracks ( ) const
inline

Definition at line 20 of file G4SimEvent.h.

References g4tracks_.

20 { return g4tracks_.size(); }
std::vector< G4SimTrack * > g4tracks_
Definition: G4SimEvent.h:43

◆ nVertices()

unsigned int G4SimEvent::nVertices ( ) const
inline

Definition at line 21 of file G4SimEvent.h.

References g4vertices_.

21 { return g4vertices_.size(); }
std::vector< G4SimVertex * > g4vertices_
Definition: G4SimEvent.h:44

◆ param() [1/2]

void G4SimEvent::param ( const std::vector< float > &  p)
inline

Definition at line 31 of file G4SimEvent.h.

References AlCaHLTBitMon_ParallelJobs::p, and param_.

31 { param_ = p; }
std::vector< float > param_
Definition: G4SimEvent.h:42

◆ param() [2/2]

const std::vector<float>& G4SimEvent::param ( ) const
inline

Definition at line 32 of file G4SimEvent.h.

References param_.

32 { return param_; }
std::vector< float > param_
Definition: G4SimEvent.h:42

◆ weight() [1/2]

void G4SimEvent::weight ( float  w)
inline

Definition at line 25 of file G4SimEvent.h.

References w(), and weight_.

Referenced by RunManagerMTWorker::produce().

25 { weight_ = w; }
T w() const
float weight_
Definition: G4SimEvent.h:39

◆ weight() [2/2]

float G4SimEvent::weight ( ) const
inline

Definition at line 26 of file G4SimEvent.h.

References weight_.

26 { return weight_; }
float weight_
Definition: G4SimEvent.h:39

Member Data Documentation

◆ collisionPoint_

math::XYZTLorentzVectorD G4SimEvent::collisionPoint_
private

Definition at line 40 of file G4SimEvent.h.

Referenced by collisionPoint().

◆ g4tracks_

std::vector<G4SimTrack*> G4SimEvent::g4tracks_
private

Definition at line 43 of file G4SimEvent.h.

Referenced by add(), clear(), G4SimEvent(), load(), and nTracks().

◆ g4vertices_

std::vector<G4SimVertex*> G4SimEvent::g4vertices_
private

Definition at line 44 of file G4SimEvent.h.

Referenced by add(), clear(), G4SimEvent(), load(), and nVertices().

◆ hepMCEvent_

const HepMC::GenEvent* G4SimEvent::hepMCEvent_
private

Definition at line 38 of file G4SimEvent.h.

Referenced by hepEvent(), and nGenParts().

◆ nparam_

int G4SimEvent::nparam_
private

Definition at line 41 of file G4SimEvent.h.

Referenced by nparam().

◆ param_

std::vector<float> G4SimEvent::param_
private

Definition at line 42 of file G4SimEvent.h.

Referenced by param().

◆ weight_

float G4SimEvent::weight_
private

Definition at line 39 of file G4SimEvent.h.

Referenced by weight().