Manages GenParticles and Secondaries from interactions. More...
#include <ParticleManager.h>
Public Member Functions | |
unsigned | addEndVertex (const Particle *particle) |
Necessary to add an end vertex to a particle. More... | |
void | addSecondaries (const math::XYZTLorentzVector &vertexPosition, int motherSimTrackId, std::vector< std::unique_ptr< Particle > > &secondaries, const SimplifiedGeometry *layer=nullptr) |
Adds secondaries that are produced by any of the interactions (or particle decay) to the buffer. More... | |
const SimTrack | getSimTrack (unsigned i) |
Returns a given SimTrack. Needed for interfacing the code with the old calorimetry. More... | |
const SimVertex | getSimVertex (unsigned i) |
Returns the position of a given SimVertex. Needed for interfacing the code with the old calorimetry. More... | |
std::unique_ptr< Particle > | nextParticle (const RandomEngineAndDistribution &random) |
Returns the next particle that has to be propagated (secondary or genParticle). More... | |
ParticleManager (const HepMC::GenEvent &genEvent, const HepPDT::ParticleDataTable &particleDataTable, double beamPipeRadius, double deltaRchargedMother, const ParticleFilter &particleFilter, std::vector< SimTrack > &simTracks, std::vector< SimVertex > &simVertices, bool fixLongLivedBug) | |
Constructor. More... | |
~ParticleManager () | |
Default destructor. More... | |
Private Member Functions | |
unsigned | addSimTrack (const Particle *particle) |
Add a simTrack (simTrack contains some basic info about the particle, e.g. pdgId). More... | |
unsigned | addSimVertex (const math::XYZTLorentzVector &position, int motherIndex) |
Add a simVertex (simVertex contains information about the track it was produced). More... | |
void | exoticRelativesChecker (const HepMC::GenVertex *originVertex, int &hasExoticAssociation, int ngendepth) |
std::unique_ptr< Particle > | nextGenParticle () |
Returns next particle from the GenEvent that has to be propagated. More... | |
Private Attributes | |
const double | beamPipeRadius2_ |
(Radius of the beampipe)^2 More... | |
const double | deltaRchargedMother_ |
For FastSim (cheat) tracking: cut on the angle between a charged mother and charged daughter. More... | |
bool | fixLongLivedBug_ |
const HepMC::GenEvent *const | genEvent_ |
The GenEvent. More... | |
const HepMC::GenEvent::particle_const_iterator | genParticleEnd_ |
The last particle of the GenEvent. More... | |
int | genParticleIndex_ |
Index of particle in the GenEvent (if it is a GenParticle) More... | |
HepMC::GenEvent::particle_const_iterator | genParticleIterator_ |
Iterator to keep track on which GenParticles where already considered. More... | |
double | lengthUnitConversionFactor2_ |
Convert pythia unis to cm^2 (FastSim standard) More... | |
double | lengthUnitConversionFactor_ |
Convert pythia unis to cm (FastSim standard) More... | |
double | momentumUnitConversionFactor_ |
Convert pythia units to GeV (FastSim standard) More... | |
std::vector< std::unique_ptr< Particle > > | particleBuffer_ |
The vector of all secondaries that are not yet propagated in the event. More... | |
const HepPDT::ParticleDataTable *const | particleDataTable_ |
Necessary to get information like lifetime and charge of a particle if unknown. More... | |
const ParticleFilter *const | particleFilter_ |
(Kinematic) cuts on the particles that have to be propagated. More... | |
std::vector< SimTrack > * | simTracks_ |
The generated SimTrack of this event. More... | |
std::vector< SimVertex > * | simVertices_ |
The generated SimVertices of this event. More... | |
double | timeUnitConversionFactor_ |
Convert pythia unis to ns (FastSim standard) More... | |
Manages GenParticles and Secondaries from interactions.
Manages which particle has to be propagated next, this includes GenParticles and secondaries from the interactions. Furthermore, checks if all necessary information is included with the GenParticles (charge, lifetime), otherwise reads information from HepPDT::ParticleDataTable. Also handles secondaries, including closestChargedDaughter algorithm which is used for FastSim (cheat) tracking: a charged daughter can continue the track of a charged mother, see addSecondaries(...).
Definition at line 39 of file ParticleManager.h.
fastsim::ParticleManager::ParticleManager | ( | const HepMC::GenEvent & | genEvent, |
const HepPDT::ParticleDataTable & | particleDataTable, | ||
double | beamPipeRadius, | ||
double | deltaRchargedMother, | ||
const ParticleFilter & | particleFilter, | ||
std::vector< SimTrack > & | simTracks, | ||
std::vector< SimVertex > & | simVertices, | ||
bool | fixLongLivedBug | ||
) |
Constructor.
genEvent | Get the GenEvent. |
particleDataTable | Get information about particles, e.g. charge, lifetime. |
beamPipeRadius | Radius of the beampipe. |
deltaRchargedMother | For FastSim (cheat) tracking: cut on the angle between a charged mother and charged daughter. |
particleFilter | Selects which particles have to be propagated. |
simTracks | The SimTracks. |
simVertices | The SimVertices. |
Definition at line 17 of file ParticleManager.cc.
References addSimVertex(), genEvent_, lengthUnitConversionFactor_, position, and timeUnitConversionFactor_.
fastsim::ParticleManager::~ParticleManager | ( | ) |
unsigned fastsim::ParticleManager::addEndVertex | ( | const Particle * | particle | ) |
Necessary to add an end vertex to a particle.
Needed if particle is no longer propagated for some reason (e.g. remaining energy below threshold) and no secondaries where produced at that point.
Definition at line 200 of file ParticleManager.cc.
References addSimVertex(), fastsim::Particle::position(), and fastsim::Particle::simTrackIndex().
void fastsim::ParticleManager::addSecondaries | ( | const math::XYZTLorentzVector & | vertexPosition, |
int | motherSimTrackId, | ||
std::vector< std::unique_ptr< Particle > > & | secondaries, | ||
const SimplifiedGeometry * | layer = nullptr |
||
) |
Adds secondaries that are produced by any of the interactions (or particle decay) to the buffer.
Also checks which charged daughter is closest to a charged mother (in deltaR) and assigns the same SimTrack ID.
vertexPosition | The origin vertex (interaction or particle decay took place here). |
motherSimTrackId | SimTrack ID of the mother particle, necessary for FastSim (cheat) tracking. |
secondaries | All secondaries that where produced in a single particle decay or interaction. |
Definition at line 133 of file ParticleManager.cc.
References fastsim::ParticleFilter::acceptsVtx(), addSimVertex(), deltaRchargedMother_, training_settings::idx, fastsim::SimplifiedGeometry::index(), fastsim::SimplifiedGeometry::isForward(), eostools::move(), particleBuffer_, and particleFilter_.
Referenced by FastSimProducer::createFSimTrack().
|
private |
Add a simTrack (simTrack contains some basic info about the particle, e.g. pdgId).
Add a simTrack for a given particle and assign an index for that track. This might also be the index of the track of the mother particle (FastSim cheat tracking).
particle | Particle that produces that simTrack. |
Definition at line 218 of file ParticleManager.cc.
References fastsim::Particle::genParticleIndex(), fastsim::Particle::momentum(), fastsim::Particle::pdgId(), simTracks_, and fastsim::Particle::simVertexIndex().
Referenced by nextParticle().
|
private |
Add a simVertex (simVertex contains information about the track it was produced).
Add a origin vertex for any particle.
position | Position of the vertex. |
motherIndex | Index of the parent's simTrack. |
Definition at line 205 of file ParticleManager.cc.
References simVertices_.
Referenced by addEndVertex(), addSecondaries(), nextGenParticle(), and ParticleManager().
|
private |
Definition at line 318 of file ParticleManager.cc.
References funct::abs(), fixLongLivedBug_, GenParticle::GenParticle, and isExotic().
Referenced by nextGenParticle().
|
inline |
Returns a given SimTrack. Needed for interfacing the code with the old calorimetry.
Definition at line 92 of file ParticleManager.h.
References objects.autophobj::motherIndex, and position.
Referenced by FastSimProducer::createFSimTrack().
|
inline |
Returns the position of a given SimVertex. Needed for interfacing the code with the old calorimetry.
Definition at line 89 of file ParticleManager.h.
Referenced by FastSimProducer::createFSimTrack().
|
private |
Returns next particle from the GenEvent that has to be propagated.
Tries to get some basic information about the status of the particle from the GenEvent and does some first rejection cuts based on them.
Definition at line 229 of file ParticleManager.cc.
References funct::abs(), addSimVertex(), beamPipeRadius2_, exoticRelativesChecker(), fixLongLivedBug_, GenParticle::GenParticle, genParticleEnd_, genParticleIndex_, genParticleIterator_, isExotic(), lengthUnitConversionFactor2_, lengthUnitConversionFactor_, momentumUnitConversionFactor_, simVertices_, fastsim::Constants::speedOfLight, and timeUnitConversionFactor_.
Referenced by nextParticle().
std::unique_ptr< fastsim::Particle > fastsim::ParticleManager::nextParticle | ( | const RandomEngineAndDistribution & | random | ) |
Returns the next particle that has to be propagated (secondary or genParticle).
Main method of this class. At first consideres particles from the buffer (secondaries) if there are none, then the next GenParticle is considered. Only returns particles that pass the (kinetic) cuts of the ParticleFilter. Furthermore, uses the ParticleDataTable to ensure all necessary information about the particle is stored (lifetime, charge).
Definition at line 65 of file ParticleManager.cc.
References fastsim::ParticleFilter::accepts(), addSimTrack(), MillePedeFileConverter_cfg::e, RandomEngineAndDistribution::flatShoot(), cmsBatch::log, eostools::move(), nextGenParticle(), particleBuffer_, particleDataTable_, particleFilter_, source_particleGun_cfi::ParticleID, and ApeEstimator_cff::width.
|
private |
(Radius of the beampipe)^2
Definition at line 137 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
For FastSim (cheat) tracking: cut on the angle between a charged mother and charged daughter.
Definition at line 138 of file ParticleManager.h.
Referenced by addSecondaries().
|
private |
Definition at line 147 of file ParticleManager.h.
Referenced by exoticRelativesChecker(), and nextGenParticle().
|
private |
|
private |
The last particle of the GenEvent.
Definition at line 134 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
Index of particle in the GenEvent (if it is a GenParticle)
Definition at line 135 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
Iterator to keep track on which GenParticles where already considered.
Definition at line 133 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
Convert pythia unis to cm^2 (FastSim standard)
Definition at line 144 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
Convert pythia unis to cm (FastSim standard)
Definition at line 143 of file ParticleManager.h.
Referenced by nextGenParticle(), and ParticleManager().
|
private |
Convert pythia units to GeV (FastSim standard)
Definition at line 142 of file ParticleManager.h.
Referenced by nextGenParticle().
|
private |
The vector of all secondaries that are not yet propagated in the event.
Definition at line 146 of file ParticleManager.h.
Referenced by addSecondaries(), and nextParticle().
|
private |
Necessary to get information like lifetime and charge of a particle if unknown.
Definition at line 136 of file ParticleManager.h.
Referenced by nextParticle().
|
private |
(Kinematic) cuts on the particles that have to be propagated.
Definition at line 139 of file ParticleManager.h.
Referenced by addSecondaries(), and nextParticle().
|
private |
The generated SimTrack of this event.
Definition at line 140 of file ParticleManager.h.
Referenced by addSimTrack().
|
private |
The generated SimVertices of this event.
Definition at line 141 of file ParticleManager.h.
Referenced by addSimVertex(), and nextGenParticle().
|
private |
Convert pythia unis to ns (FastSim standard)
Definition at line 145 of file ParticleManager.h.
Referenced by nextGenParticle(), and ParticleManager().