CMS 3D CMS Logo

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

#include <G4SimEvent.h>

Public Member Functions

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

Protected 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.

12  : hepMCEvent(nullptr),
13  weight_(0),
15  nparam_(0),
16  param_(0) {}

◆ ~G4SimEvent()

G4SimEvent::~G4SimEvent ( )
virtual

Definition at line 18 of file G4SimEvent.cc.

18  {
19  // per suggestion by Chris Jones, it's faster
20  // that delete back() and pop_back()
21  //
22  unsigned int i = 0;
23 
24  for (i = 0; i < g4tracks.size(); i++) {
25  delete g4tracks[i];
26  g4tracks[i] = nullptr;
27  }
28  g4tracks.clear();
29 
30  for (i = 0; i < g4vertices.size(); i++) {
31  delete g4vertices[i];
32  g4vertices[i] = nullptr;
33  }
34  g4vertices.clear();
35 }

References g4tracks, g4vertices, and mps_fire::i.

Member Function Documentation

◆ add() [1/2]

void G4SimEvent::add ( G4SimTrack t)
inline

Definition at line 33 of file G4SimEvent.h.

33 { g4tracks.push_back(t); }

References g4tracks, and OrderedSet::t.

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

◆ add() [2/2]

void G4SimEvent::add ( G4SimVertex v)
inline

Definition at line 34 of file G4SimEvent.h.

34 { g4vertices.push_back(v); }

References g4vertices, and findQualityFiles::v.

Referenced by counter.Counter::register().

◆ collisionPoint() [1/2]

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

Definition at line 28 of file G4SimEvent.h.

28 { return collisionPoint_; }

References collisionPoint_.

◆ collisionPoint() [2/2]

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

Definition at line 27 of file G4SimEvent.h.

27 { collisionPoint_ = v; }

References collisionPoint_, and findQualityFiles::v.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

◆ g4track()

const G4SimTrack& G4SimEvent::g4track ( int  i) const
inline

Definition at line 35 of file G4SimEvent.h.

35 { return *g4tracks[i - 1]; }

References g4tracks, and mps_fire::i.

◆ g4vertex()

const G4SimVertex& G4SimEvent::g4vertex ( int  i) const
inline

Definition at line 36 of file G4SimEvent.h.

36 { return *g4vertices[i - 1]; }

References g4vertices, and mps_fire::i.

◆ hepEvent() [1/2]

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

Definition at line 24 of file G4SimEvent.h.

24 { return hepMCEvent; }

References hepMCEvent.

◆ hepEvent() [2/2]

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

Definition at line 23 of file G4SimEvent.h.

23 { hepMCEvent = r; }

References hepMCEvent, and alignCSCRings::r.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

◆ load() [1/2]

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

Definition at line 37 of file G4SimEvent.cc.

37  {
38  for (unsigned int i = 0; i < g4tracks.size(); i++) {
39  G4SimTrack* trk = g4tracks[i];
40  int ip = trk->part();
42  trk->momentum().x() / GeV, trk->momentum().y() / GeV, trk->momentum().z() / GeV, trk->energy() / GeV);
43  int iv = trk->ivert();
44  int ig = trk->igenpart();
45  int id = trk->id();
46  math::XYZVectorD tkpos(trk->trackerSurfacePosition().x() / cm,
47  trk->trackerSurfacePosition().y() / cm,
48  trk->trackerSurfacePosition().z() / cm);
50  trk->trackerSurfaceMomentum().y() / GeV,
51  trk->trackerSurfaceMomentum().z() / GeV,
52  trk->trackerSurfaceMomentum().e() / GeV);
53  // ip = particle ID as PDG
54  // pp = 4-momentum
55  // iv = corresponding G4SimVertex index
56  // ig = corresponding GenParticle index
57  SimTrack t = SimTrack(ip, p, iv, ig, tkpos, tkmom);
58  t.setTrackId(id);
59  t.setEventId(EncodedEventId(0));
60  c.push_back(t);
61  }
62  std::stable_sort(c.begin(), c.end(), IdSort());
63 }

References HltBtagPostValidation_cff::c, G4SimTrack::energy(), g4tracks, GeV, mps_fire::i, G4SimTrack::id(), G4SimTrack::igenpart(), G4SimTrack::ivert(), G4SimTrack::momentum(), AlCaHLTBitMon_ParallelJobs::p, G4SimTrack::part(), mcMuonSeeds_cfi::SimTrack, OrderedSet::t, G4SimTrack::trackerSurfaceMomentum(), and G4SimTrack::trackerSurfacePosition().

Referenced by OscarProducer::produce().

◆ load() [2/2]

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

Definition at line 65 of file G4SimEvent.cc.

65  {
66  for (unsigned int i = 0; i < g4vertices.size(); i++) {
68  //
69  // starting 1_1_0_pre3, SimVertex stores in cm !!!
70  //
71  math::XYZVectorD v3(vtx->vertexPosition().x() / cm, vtx->vertexPosition().y() / cm, vtx->vertexPosition().z() / cm);
72  float t = vtx->vertexGlobalTime() / second;
73  int iv = vtx->parentIndex();
74  // vv = position
75  // t = global time
76  // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent)
77  SimVertex v = SimVertex(v3, t, iv, i);
78  v.setProcessType(vtx->processType());
79  v.setEventId(EncodedEventId(0));
80  c.push_back(v);
81  }
82 }

References HltBtagPostValidation_cff::c, g4vertices, mps_fire::i, edm::second(), mcMuonSeeds_cfi::SimVertex, OrderedSet::t, findQualityFiles::v, and badGlobalMuonTaggersAOD_cff::vtx.

◆ nGenParts()

unsigned int G4SimEvent::nGenParts ( ) const
inline

Definition at line 22 of file G4SimEvent.h.

22 { return hepMCEvent->particles_size(); }

References hepMCEvent.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

◆ nparam() [1/2]

const int G4SimEvent::nparam ( ) const
inline

Definition at line 30 of file G4SimEvent.h.

30 { return nparam_; }

References nparam_.

◆ nparam() [2/2]

void G4SimEvent::nparam ( int  n)
inline

Definition at line 29 of file G4SimEvent.h.

29 { nparam_ = n; }

References dqmiodumpmetadata::n, and nparam_.

◆ nTracks()

unsigned int G4SimEvent::nTracks ( ) const
inline

Definition at line 20 of file G4SimEvent.h.

20 { return g4tracks.size(); }

References g4tracks.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

◆ nVertices()

unsigned int G4SimEvent::nVertices ( ) const
inline

Definition at line 21 of file G4SimEvent.h.

21 { return g4vertices.size(); }

References g4vertices.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

◆ param() [1/2]

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

Definition at line 32 of file G4SimEvent.h.

32 { return param_; }

References param_.

◆ param() [2/2]

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

Definition at line 31 of file G4SimEvent.h.

31 { param_ = p; }

References AlCaHLTBitMon_ParallelJobs::p, and param_.

◆ weight() [1/2]

float G4SimEvent::weight ( ) const
inline

Definition at line 26 of file G4SimEvent.h.

26 { return weight_; }

References weight_.

◆ weight() [2/2]

void G4SimEvent::weight ( float  w)
inline

Definition at line 25 of file G4SimEvent.h.

25 { weight_ = w; }

References w, and weight_.

Referenced by RunManagerMTWorker::produce(), and RunManager::produce().

Member Data Documentation

◆ collisionPoint_

math::XYZTLorentzVectorD G4SimEvent::collisionPoint_
protected

Definition at line 41 of file G4SimEvent.h.

Referenced by collisionPoint().

◆ g4tracks

std::vector<G4SimTrack*> G4SimEvent::g4tracks
protected

Definition at line 44 of file G4SimEvent.h.

Referenced by add(), g4track(), load(), nTracks(), and ~G4SimEvent().

◆ g4vertices

std::vector<G4SimVertex*> G4SimEvent::g4vertices
protected

Definition at line 45 of file G4SimEvent.h.

Referenced by add(), g4vertex(), load(), nVertices(), and ~G4SimEvent().

◆ hepMCEvent

const HepMC::GenEvent* G4SimEvent::hepMCEvent
protected

Definition at line 39 of file G4SimEvent.h.

Referenced by hepEvent(), and nGenParts().

◆ nparam_

int G4SimEvent::nparam_
protected

Definition at line 42 of file G4SimEvent.h.

Referenced by nparam().

◆ param_

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

Definition at line 43 of file G4SimEvent.h.

Referenced by param().

◆ weight_

float G4SimEvent::weight_
protected

Definition at line 40 of file G4SimEvent.h.

Referenced by weight().

mcMuonSeeds_cfi.SimTrack
SimTrack
Definition: mcMuonSeeds_cfi.py:10
G4SimEvent::g4tracks
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:44
mps_fire.i
i
Definition: mps_fire.py:355
G4SimVertex
Definition: G4SimVertex.h:9
SimVertex
Definition: SimVertex.h:5
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
G4SimTrack::ivert
int ivert() const
Definition: G4SimTrack.h:61
G4SimEvent::weight_
float weight_
Definition: G4SimEvent.h:40
G4SimEvent::hepMCEvent
const HepMC::GenEvent * hepMCEvent
Definition: G4SimEvent.h:39
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
math::XYZTLorentzVectorD
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
mcMuonSeeds_cfi.SimVertex
SimVertex
Definition: mcMuonSeeds_cfi.py:11
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
findQualityFiles.v
v
Definition: findQualityFiles.py:179
G4SimEvent::param_
std::vector< float > param_
Definition: G4SimEvent.h:43
G4SimTrack
Definition: G4SimTrack.h:9
EncodedEventId
Definition: EncodedEventId.h:11
G4SimTrack::momentum
const math::XYZVectorD & momentum() const
Definition: G4SimTrack.h:59
G4SimEvent::nparam_
int nparam_
Definition: G4SimEvent.h:42
w
const double w
Definition: UKUtility.cc:23
G4SimTrack::energy
double energy() const
Definition: G4SimTrack.h:60
OrderedSet.t
t
Definition: OrderedSet.py:90
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
G4SimEvent::collisionPoint_
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:41
G4SimTrack::igenpart
int igenpart() const
Definition: G4SimTrack.h:62
GeV
const double GeV
Definition: MathUtil.h:16
G4SimEvent::g4vertices
std::vector< G4SimVertex * > g4vertices
Definition: G4SimEvent.h:45
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
G4SimTrack::part
int part() const
Definition: G4SimTrack.h:58
alignCSCRings.r
r
Definition: alignCSCRings.py:93
G4SimTrack::trackerSurfaceMomentum
const math::XYZTLorentzVectorD & trackerSurfaceMomentum() const
Definition: G4SimTrack.h:67
SimTrack
Definition: SimTrack.h:6
G4SimTrack::trackerSurfacePosition
const math::XYZVectorD & trackerSurfacePosition() const
Definition: G4SimTrack.h:66
G4SimTrack::id
int id() const
Definition: G4SimTrack.h:57
IdSort
Definition: G4SimEvent.cc:6