CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
void collisionPoint (const math::XYZTLorentzVectorD &v)
 
const math::XYZTLorentzVectorDcollisionPoint () const
 
 G4SimEvent ()
 
const G4SimTrackg4track (int i) const
 
const G4SimVertexg4vertex (int i) const
 
void hepEvent (const HepMC::GenEvent *r)
 
const HepMC::GenEvent * hepEvent () 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)
 
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_
 

Detailed Description

Definition at line 15 of file G4SimEvent.h.

Constructor & Destructor Documentation

G4SimEvent::G4SimEvent ( )

Definition at line 14 of file G4SimEvent.cc.

14  : hepMCEvent(0),
15  weight_(0),
17  nparam_(0),param_(0) {}
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:43
float weight_
Definition: G4SimEvent.h:41
const HepMC::GenEvent * hepMCEvent
Definition: G4SimEvent.h:40
std::vector< float > param_
Definition: G4SimEvent.h:44
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:42
G4SimEvent::~G4SimEvent ( )
virtual

Definition at line 19 of file G4SimEvent.cc.

References g4tracks, g4vertices, and i.

20 {
21 
22 /*
23  while ( !g4tracks.empty() )
24  {
25  delete g4tracks.back() ;
26  g4tracks.pop_back() ;
27  }
28  while ( !g4vertices.empty() )
29  {
30  delete g4vertices.back() ;
31  g4vertices.pop_back() ;
32  }
33 */
34 
35  // per suggestion by Chris Jones, it's faster
36  // that delete back() and pop_back()
37  //
38  unsigned int i = 0 ;
39 
40  for ( i=0; i<g4tracks.size(); i++ )
41  {
42  delete g4tracks[i] ;
43  g4tracks[i] = 0 ;
44  }
45  g4tracks.clear() ;
46 
47  for ( i=0; i<g4vertices.size(); i++ )
48  {
49  delete g4vertices[i] ;
50  g4vertices[i] = 0 ;
51  }
52  g4vertices.clear();
53 }
int i
Definition: DBlmapReader.cc:9
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:45
std::vector< G4SimVertex * > g4vertices
Definition: G4SimEvent.h:46

Member Function Documentation

void G4SimEvent::add ( G4SimTrack t)
inline

Definition at line 35 of file G4SimEvent.h.

References g4tracks.

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

35 { g4tracks.push_back(t); }
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:45
void G4SimEvent::add ( G4SimVertex v)
inline

Definition at line 36 of file G4SimEvent.h.

References g4vertices.

Referenced by counter.Counter::register().

36 { g4vertices.push_back(v); }
std::vector< G4SimVertex * > g4vertices
Definition: G4SimEvent.h:46
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().

29 { collisionPoint_ = v ; }
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:42
const math::XYZTLorentzVectorD& G4SimEvent::collisionPoint ( ) const
inline

Definition at line 30 of file G4SimEvent.h.

References collisionPoint_.

30 { return collisionPoint_; }
math::XYZTLorentzVectorD collisionPoint_
Definition: G4SimEvent.h:42
const G4SimTrack& G4SimEvent::g4track ( int  i) const
inline

Definition at line 37 of file G4SimEvent.h.

References g4tracks.

37 { return *g4tracks[i-1]; }
int i
Definition: DBlmapReader.cc:9
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:45
const G4SimVertex& G4SimEvent::g4vertex ( int  i) const
inline

Definition at line 38 of file G4SimEvent.h.

References g4vertices.

38 { return *g4vertices[i-1]; }
int i
Definition: DBlmapReader.cc:9
std::vector< G4SimVertex * > g4vertices
Definition: G4SimEvent.h:46
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().

25 { hepMCEvent = r; }
const HepMC::GenEvent * hepMCEvent
Definition: G4SimEvent.h:40
const HepMC::GenEvent* G4SimEvent::hepEvent ( ) const
inline

Definition at line 26 of file G4SimEvent.h.

References hepMCEvent.

26 { return hepMCEvent; }
const HepMC::GenEvent * hepMCEvent
Definition: G4SimEvent.h:40
void G4SimEvent::load ( edm::SimTrackContainer c) const

Definition at line 55 of file G4SimEvent.cc.

References G4SimTrack::energy(), g4tracks, GeV, i, G4SimTrack::id(), G4SimTrack::igenpart(), G4SimTrack::ivert(), G4SimTrack::momentum(), AlCaHLTBitMon_ParallelJobs::p, G4SimTrack::part(), edmStreamStallGrapher::t, G4SimTrack::trackerSurfaceMomentum(), and G4SimTrack::trackerSurfacePosition().

Referenced by OscarProducer::produce(), and OscarMTProducer::produce().

56 {
57  for (unsigned int i=0; i<g4tracks.size(); i++)
58  {
59  G4SimTrack * trk = g4tracks[i];
60  int ip = trk->part();
62  trk->momentum().y()/GeV,
63  trk->momentum().z()/GeV,
64  trk->energy()/GeV ) ;
65  int iv = trk->ivert();
66  int ig = trk->igenpart();
67  int id = trk->id();
68  math::XYZVectorD tkpos( trk->trackerSurfacePosition().x()/cm,
69  trk->trackerSurfacePosition().y()/cm,
70  trk->trackerSurfacePosition().z()/cm ) ;
72  trk->trackerSurfaceMomentum().y()/GeV,
73  trk->trackerSurfaceMomentum().z()/GeV,
74  trk->trackerSurfaceMomentum().e()/GeV ) ;
75  // ip = particle ID as PDG
76  // pp = 4-momentum
77  // iv = corresponding G4SimVertex index
78  // ig = corresponding GenParticle index
79  SimTrack t = SimTrack(ip,p,iv,ig,tkpos,tkmom);
80  t.setTrackId(id);
81  t.setEventId(EncodedEventId(0));
82  c.push_back(t);
83  }
84  std::stable_sort(c.begin(),c.end(),IdSort());
85 
86 }
const double energy() const
Definition: G4SimTrack.h:35
int i
Definition: DBlmapReader.cc:9
const double GeV
Definition: MathUtil.h:16
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
const math::XYZVectorD & trackerSurfacePosition() const
Definition: G4SimTrack.h:41
const int part() const
Definition: G4SimTrack.h:33
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:45
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
int const ivert() const
Definition: G4SimTrack.h:36
int const igenpart() const
Definition: G4SimTrack.h:37
const int id() const
Definition: G4SimTrack.h:32
const math::XYZTLorentzVectorD & trackerSurfaceMomentum() const
Definition: G4SimTrack.h:42
const math::XYZVectorD & momentum() const
Definition: G4SimTrack.h:34
void G4SimEvent::load ( edm::SimVertexContainer c) const

Definition at line 88 of file G4SimEvent.cc.

References g4vertices, i, G4SimVertex::parentIndex(), G4SimVertex::processType(), edm::second(), CoreSimVertex::setEventId(), SimVertex::setProcessType(), edmStreamStallGrapher::t, findQualityFiles::v, G4SimVertex::vertexGlobalTime(), and G4SimVertex::vertexPosition().

89 {
90  for (unsigned int i=0; i<g4vertices.size(); i++)
91  {
92  G4SimVertex * vtx = g4vertices[i];
93  //
94  // starting 1_1_0_pre3, SimVertex stores in cm !!!
95  //
96  math::XYZVectorD v3( vtx->vertexPosition().x()/cm,
97  vtx->vertexPosition().y()/cm,
98  vtx->vertexPosition().z()/cm ) ;
99  float t = vtx->vertexGlobalTime()/second;
100  int iv = vtx->parentIndex();
101  // vv = position
102  // t = global time
103  // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent)
104  SimVertex v = SimVertex(v3,t,iv,i);
105  v.setProcessType(vtx->processType());
107  c.push_back(v);
108  }
109 }
int i
Definition: DBlmapReader.cc:9
const unsigned int processType() const
Definition: G4SimVertex.h:19
void setProcessType(unsigned int ty)
Definition: SimVertex.h:39
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:46
const math::XYZVectorD & vertexPosition() const
index of the parent (-1 if no parent)
Definition: G4SimVertex.h:16
const int parentIndex() const
Definition: G4SimVertex.h:18
const double vertexGlobalTime() const
Definition: G4SimVertex.h:17
void setEventId(EncodedEventId e)
Definition: CoreSimVertex.h:28
unsigned int G4SimEvent::nGenParts ( ) const
inline

Definition at line 24 of file G4SimEvent.h.

References hepMCEvent.

Referenced by RunManager::produce().

24 { return hepMCEvent->particles_size(); }
const HepMC::GenEvent * hepMCEvent
Definition: G4SimEvent.h:40
void G4SimEvent::nparam ( int  n)
inline

Definition at line 31 of file G4SimEvent.h.

References n, and nparam_.

31 { nparam_ = n; }
int nparam_
Definition: G4SimEvent.h:43
const int G4SimEvent::nparam ( ) const
inline

Definition at line 32 of file G4SimEvent.h.

References nparam_.

32 { return nparam_; }
int nparam_
Definition: G4SimEvent.h:43
unsigned int G4SimEvent::nTracks ( ) const
inline

Definition at line 22 of file G4SimEvent.h.

References g4tracks.

Referenced by RunManager::produce().

22 { return g4tracks.size(); }
std::vector< G4SimTrack * > g4tracks
Definition: G4SimEvent.h:45
unsigned int G4SimEvent::nVertices ( ) const
inline

Definition at line 23 of file G4SimEvent.h.

References g4vertices.

Referenced by RunManager::produce().

23 { return g4vertices.size(); }
std::vector< G4SimVertex * > g4vertices
Definition: G4SimEvent.h:46
void G4SimEvent::param ( const std::vector< float > &  p)
inline

Definition at line 33 of file G4SimEvent.h.

References AlCaHLTBitMon_ParallelJobs::p, and param_.

33 { param_ = p; }
std::vector< float > param_
Definition: G4SimEvent.h:44
const std::vector<float>& G4SimEvent::param ( ) const
inline

Definition at line 34 of file G4SimEvent.h.

References param_.

34 { return param_; }
std::vector< float > param_
Definition: G4SimEvent.h:44
void G4SimEvent::weight ( float  w)
inline
const float G4SimEvent::weight ( void  ) const
inline

Member Data Documentation

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().