CMS 3D CMS Logo

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

#include <TmpSimEvent.h>

Public Member Functions

void addTrack (TmpSimTrack *t)
 
void addVertex (TmpSimVertex *v)
 
void clear ()
 
void collisionPoint (const math::XYZTLorentzVectorD &v)
 
const math::XYZTLorentzVectorDcollisionPoint () const
 
const HepMC::GenEventhepEvent () const
 
void load (edm::SimTrackContainer &) const
 
void load (edm::SimVertexContainer &) 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 setHepEvent (const HepMC::GenEvent *r)
 
void setWeight (float w)
 
 TmpSimEvent ()
 
float weight () const
 
 ~TmpSimEvent ()
 

Private Attributes

math::XYZTLorentzVectorD collisionPoint_ {math::XYZTLorentzVectorD(0., 0., 0., 0.)}
 
std::vector< TmpSimTrack * > g4tracks_
 
std::vector< TmpSimVertex * > g4vertices_
 
const HepMC::GenEventhepMCEvent_ {nullptr}
 
int nparam_ {0}
 
std::vector< float > param_
 
float weight_ {0.f}
 

Detailed Description

Definition at line 14 of file TmpSimEvent.h.

Constructor & Destructor Documentation

◆ TmpSimEvent()

TmpSimEvent::TmpSimEvent ( )

Definition at line 11 of file TmpSimEvent.cc.

References g4tracks_, and g4vertices_.

11  {
12  g4vertices_.reserve(2000);
13  g4tracks_.reserve(4000);
14 }
std::vector< TmpSimTrack * > g4tracks_
Definition: TmpSimEvent.h:46
std::vector< TmpSimVertex * > g4vertices_
Definition: TmpSimEvent.h:47

◆ ~TmpSimEvent()

TmpSimEvent::~TmpSimEvent ( )

Definition at line 16 of file TmpSimEvent.cc.

References clear().

16 { clear(); }
void clear()
Definition: TmpSimEvent.cc:18

Member Function Documentation

◆ addTrack()

void TmpSimEvent::addTrack ( TmpSimTrack t)
inline

Definition at line 33 of file TmpSimEvent.h.

References g4tracks_, and submitPVValidationJobs::t.

Referenced by SimTrackManager::reallyStoreTracks().

33 { g4tracks_.push_back(t); }
std::vector< TmpSimTrack * > g4tracks_
Definition: TmpSimEvent.h:46

◆ addVertex()

void TmpSimEvent::addVertex ( TmpSimVertex v)
inline

Definition at line 34 of file TmpSimEvent.h.

References g4vertices_, and findQualityFiles::v.

Referenced by SimTrackManager::getOrCreateVertex().

34 { g4vertices_.push_back(v); }
std::vector< TmpSimVertex * > g4vertices_
Definition: TmpSimEvent.h:47

◆ clear()

void TmpSimEvent::clear ( void  )

Definition at line 18 of file TmpSimEvent.cc.

References g4tracks_, and g4vertices_.

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

18  {
19  for (auto& ptr : g4tracks_) {
20  delete ptr;
21  }
22  g4tracks_.clear();
23  for (auto& ptr : g4vertices_) {
24  delete ptr;
25  }
26  g4vertices_.clear();
27 }
std::vector< TmpSimTrack * > g4tracks_
Definition: TmpSimEvent.h:46
std::vector< TmpSimVertex * > g4vertices_
Definition: TmpSimEvent.h:47

◆ collisionPoint() [1/2]

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

Definition at line 27 of file TmpSimEvent.h.

References collisionPoint_, and findQualityFiles::v.

Referenced by RunManagerMTWorker::produce().

27 { collisionPoint_ = v; }
math::XYZTLorentzVectorD collisionPoint_
Definition: TmpSimEvent.h:43

◆ collisionPoint() [2/2]

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

Definition at line 28 of file TmpSimEvent.h.

References collisionPoint_.

28 { return collisionPoint_; }
math::XYZTLorentzVectorD collisionPoint_
Definition: TmpSimEvent.h:43

◆ hepEvent()

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

Definition at line 24 of file TmpSimEvent.h.

References hepMCEvent_.

24 { return hepMCEvent_; }
const HepMC::GenEvent * hepMCEvent_
Definition: TmpSimEvent.h:41

◆ load() [1/2]

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

Definition at line 29 of file TmpSimEvent.cc.

References DummyCfis::c, g4tracks_, invgev, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, AlCaHLTBitMon_ParallelJobs::p, mcMuonSeeds_cfi::SimTrack, and submitPVValidationJobs::t.

Referenced by OscarMTProducer::produce().

29  {
30  const double invgev = 1.0 / CLHEP::GeV;
31  for (auto& trk : g4tracks_) {
32  int ip = trk->part();
33  const math::XYZVectorD& mom = trk->momentum();
34  math::XYZTLorentzVectorD p(mom.x() * invgev, mom.y() * invgev, mom.z() * invgev, trk->energy() * invgev);
35  int iv = trk->ivert();
36  int ig = trk->igenpart();
37  int id = trk->id();
38  // ip = particle ID as PDG
39  // pp = 4-momentum in GeV
40  // iv = corresponding TmpSimVertex index
41  // ig = corresponding GenParticle index
42  SimTrack t = SimTrack(ip, p, iv, ig, trk->trackerSurfacePosition(), trk->trackerSurfaceMomentum());
43  t.setTrackId(id);
44  t.setEventId(EncodedEventId(0));
45  t.setCrossedBoundaryVars(
46  trk->crossedBoundary(), trk->getIDAtBoundary(), trk->getPositionAtBoundary(), trk->getMomentumAtBoundary());
47  c.push_back(t);
48  }
49  std::stable_sort(c.begin(), c.end(), IdSort());
50 }
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
std::vector< TmpSimTrack * > g4tracks_
Definition: TmpSimEvent.h:46
static const float invgev
Definition: TimingSD.cc:32
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8

◆ load() [2/2]

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

Definition at line 52 of file TmpSimEvent.cc.

References DummyCfis::c, ALCARECOEcalPhiSym_cff::float, g4vertices_, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, edm::second(), mcMuonSeeds_cfi::SimVertex, submitPVValidationJobs::t, findQualityFiles::v, and L1BJetProducer_cff::vtx.

52  {
53  const double invcm = 1.0 / CLHEP::cm;
54  // index of the vertex is needed to make SimVertex object
55  for (unsigned int i = 0; i < g4vertices_.size(); ++i) {
57  auto pos = vtx->vertexPosition();
58  math::XYZVectorD v3(pos.x() * invcm, pos.y() * invcm, pos.z() * invcm);
59  float t = (float)(vtx->vertexGlobalTime() / CLHEP::second);
60  int iv = vtx->parentIndex();
61  // v3 = position in cm
62  // t = global time in second
63  // iv = index of the parent in the SimEvent SimTrack container (-1 if no parent)
64  SimVertex v = SimVertex(v3, t, iv, i);
65  v.setProcessType((unsigned int)vtx->processType());
66  v.setEventId(EncodedEventId(0));
67  c.push_back(v);
68  }
69 }
std::vector< TmpSimVertex * > g4vertices_
Definition: TmpSimEvent.h:47
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

◆ nGenParts()

unsigned int TmpSimEvent::nGenParts ( ) const
inline

Definition at line 22 of file TmpSimEvent.h.

References hepMCEvent_.

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

◆ nparam() [1/2]

void TmpSimEvent::nparam ( int  n)
inline

Definition at line 29 of file TmpSimEvent.h.

References create_idmaps::n, and nparam_.

◆ nparam() [2/2]

const int TmpSimEvent::nparam ( ) const
inline

Definition at line 30 of file TmpSimEvent.h.

References nparam_.

30 { return nparam_; }

◆ nTracks()

unsigned int TmpSimEvent::nTracks ( ) const
inline

Definition at line 20 of file TmpSimEvent.h.

References g4tracks_.

Referenced by RunManagerMTWorker::produce().

20 { return g4tracks_.size(); }
std::vector< TmpSimTrack * > g4tracks_
Definition: TmpSimEvent.h:46

◆ nVertices()

unsigned int TmpSimEvent::nVertices ( ) const
inline

Definition at line 21 of file TmpSimEvent.h.

References g4vertices_.

21 { return g4vertices_.size(); }
std::vector< TmpSimVertex * > g4vertices_
Definition: TmpSimEvent.h:47

◆ param() [1/2]

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

Definition at line 31 of file TmpSimEvent.h.

References AlCaHLTBitMon_ParallelJobs::p, and param_.

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

◆ param() [2/2]

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

Definition at line 32 of file TmpSimEvent.h.

References param_.

32 { return param_; }
std::vector< float > param_
Definition: TmpSimEvent.h:45

◆ setHepEvent()

void TmpSimEvent::setHepEvent ( const HepMC::GenEvent r)
inline

Definition at line 23 of file TmpSimEvent.h.

References hepMCEvent_, and alignCSCRings::r.

Referenced by RunManagerMTWorker::produce().

23 { hepMCEvent_ = r; }
const HepMC::GenEvent * hepMCEvent_
Definition: TmpSimEvent.h:41

◆ setWeight()

void TmpSimEvent::setWeight ( float  w)
inline

Definition at line 25 of file TmpSimEvent.h.

References w(), and weight_.

Referenced by RunManagerMTWorker::produce().

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

◆ weight()

float TmpSimEvent::weight ( ) const
inline

Definition at line 26 of file TmpSimEvent.h.

References weight_.

Referenced by RunManagerMTWorker::produce().

26 { return weight_; }
float weight_
Definition: TmpSimEvent.h:42

Member Data Documentation

◆ collisionPoint_

math::XYZTLorentzVectorD TmpSimEvent::collisionPoint_ {math::XYZTLorentzVectorD(0., 0., 0., 0.)}
private

Definition at line 43 of file TmpSimEvent.h.

Referenced by collisionPoint().

◆ g4tracks_

std::vector<TmpSimTrack*> TmpSimEvent::g4tracks_
private

Definition at line 46 of file TmpSimEvent.h.

Referenced by addTrack(), clear(), load(), nTracks(), and TmpSimEvent().

◆ g4vertices_

std::vector<TmpSimVertex*> TmpSimEvent::g4vertices_
private

Definition at line 47 of file TmpSimEvent.h.

Referenced by addVertex(), clear(), load(), nVertices(), and TmpSimEvent().

◆ hepMCEvent_

const HepMC::GenEvent* TmpSimEvent::hepMCEvent_ {nullptr}
private

Definition at line 41 of file TmpSimEvent.h.

Referenced by hepEvent(), nGenParts(), and setHepEvent().

◆ nparam_

int TmpSimEvent::nparam_ {0}
private

Definition at line 44 of file TmpSimEvent.h.

Referenced by nparam().

◆ param_

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

Definition at line 45 of file TmpSimEvent.h.

Referenced by param().

◆ weight_

float TmpSimEvent::weight_ {0.f}
private

Definition at line 42 of file TmpSimEvent.h.

Referenced by setWeight(), and weight().