22 double mass = particle.mass();
23 double energy = std::sqrt( mom.mag2() + mass*mass);
50 if ( !particle) particle = &
m_parent;
173 auto* truthBinding = particle.getTruthBinding();
174 HepMC::GenParticlePtr currentGenParticle = truthBinding ? truthBinding->getCurrentGenParticle() :
nullptr;
177 if (currentGenParticle) {
178 return currentGenParticle;
187 auto* truthBinding = particle.getTruthBinding();
191 truthBinding->setCurrentGenParticle(newGenParticle);
193 auto parentTruthBinding = parent ? parent->getTruthBinding() :
nullptr;
194 auto primaryGenParticle = parentTruthBinding ? parentTruthBinding->getPrimaryGenParticle() :
nullptr;
195 auto generationZeroGenParticle = newGenParticle;
196 truthBinding =
new TruthBinding( newGenParticle, primaryGenParticle, generationZeroGenParticle );
197 particle.setTruthBinding(truthBinding);
204 return newGenParticle;
213 auto parentAfterIncidentGenParticle = (parentAfterIncidentTruthBinding) ? parentAfterIncidentTruthBinding->
getCurrentGenParticle() :
nullptr;
218 if (parentAfterIncidentGenParticle) { eventIndex = parentAfterIncidentGenParticle->parent_event()->event_number(); }
219 else if (parentBeforeIncidentHMPL) { eventIndex = parentBeforeIncidentHMPL->
eventIndex(); }
222 if (parentBeforeIncidentHMPL) {
223 delete parentBeforeIncidentHMPL;
225 if (!parentAfterIncidentGenParticle) {
229 parentAfterIncidentHMPL =
new HepMcParticleLink(parentAfterIncidentGenParticle, eventIndex, idxFlag);
231 m_parent.setId(parentAfterIncidentID);
232 m_parent.setParticleLink(parentAfterIncidentHMPL);
238 for (
unsigned short i=0; i<numSec; i++) {
242 if (!childTruthBinding) {
245 auto parentTruthBinding =
m_parent.getTruthBinding();
246 if (parentTruthBinding) {
251 childTruthBinding =
new TruthBinding(
nullptr,
nullptr,
nullptr );
260 if (childGenParticle) { eventIndex = childGenParticle->parent_event()->event_number(); }
261 else if (oldChildHMPL) { eventIndex = oldChildHMPL->
eventIndex(); }
267 if (!childGenParticle) {
273 child->
setId(childID);
static HepMC::GenParticlePtr ParticleHelper_convert(const ISF::ISFParticle &particle)
size_t size() const
Number of registered mappings.
a link optimized in size for a GenParticle in a McEventCollection
index_type eventIndex() const
Return the event number of the referenced GenEvent.
The generic ISF particle definition,.
const TruthBinding * getTruthBinding() const
pointer to the simulation truth - optional, can be 0
const HepMcParticleLink * getParticleLink() const
HepMcParticleLink accessors.
void setBarcode(int bc)
set a new barcode
void setId(int id)
set a new unique ID
void setParticleLink(const HepMcParticleLink *partLink)
void setTruthBinding(TruthBinding *truth)
void updateChildParticleProperties()
Update the id and particleLink properties of the child particles (to be called after registerTruthInc...
double parentP2() const override final
Return p^2 of the parent particle.
int physicsProcessCategory() const override final
Return category of the physics process represented by the truth incident (eg hadronic,...
virtual ~ISFTruthIncident()
const HepMC::FourVector * m_position
HepMC::GenParticlePtr parentParticleAfterIncident(int newBC) override final
Return the parent particle after the TruthIncident vertex (and give it a new barcode).
double childPt2(unsigned short index) const override final
Return pT^2 of the i-th child particle.
HepMC::GenParticlePtr childParticle(unsigned short index, int bc) override final
Return the i-th child as a HepMC particle type and assign the given Barcode to the simulator particle...
int parentStatus() override final
ISF::ISFParticle & m_parent
const ISFParticleVector & m_children
int physicsProcessCode() const override final
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
bool parentSurvivesIncident() const override final
Return a boolean whether or not the parent particle survives the incident.
double childP2(unsigned short index) const override final
Return p^2 of the i-th child particle.
double parentEkin() const override final
Return Ekin of the parent particle.
HepMC::GenParticlePtr parentParticle() override final
Return the parent particle as a HepMC particle type (usually only called for particles that will ente...
const ISF::KillPrimary m_killsPrimary
double parentPt2() const override final
Return pT^2 of the parent particle.
void updateParentAfterIncidentProperties()
Update the id and particleLink properties of the parentAfterIncident (to be called after registerTrut...
int childPdgCode(unsigned short index) const override final
Return the PDG Code of the i-th child particle.
int parentPdgCode() const override final
Return the PDG Code of the parent particle.
int parentBarcode() override final
Return the barcode of the parent particle.
HepMC::GenParticlePtr updateHepMCTruthParticle(ISF::ISFParticle &particle, ISF::ISFParticle *parent=nullptr) const
convert ISFParticle to GenParticle and attach to ISFParticle's TruthBinding
int childBarcode(unsigned short) const override final
Return the barcode of the i-th child particle (if defined as part of the TruthIncident) otherwise ret...
HepMC::GenParticlePtr getHepMCTruthParticle(ISF::ISFParticle &particle) const
return attached truth particle
const HepMC::FourVector & position() const override final
Return HepMC position of the truth vertex.
int parentUniqueID() override final
Return the unique ID of the parent particle.
double childEkin(unsigned short index) const override final
Return Ekin of the i-th child particle.
unsigned short numberOfChildren() const
Return total number of child particles.
AtlasDetDescr::AtlasRegion geoID()
Return the SimGeoID corresponding to the vertex of the truth incident.
ITruthIncident(AtlasDetDescr::AtlasRegion geoID, unsigned short numChildren)
HepMC::GenParticlePtr getCurrentGenParticle()
pointer to the particle in the simulation truth
TruthBinding * childTruthBinding(HepMC::GenParticlePtr childP)
Create a TruthBinding for a child particle.
const std::string process
Eigen::Matrix< double, 3, 1 > Vector3D
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
HepMC3::FourVector FourVector
constexpr int UNDEFINED_ID
GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
HepMC3::GenParticlePtr GenParticlePtr
KillPrimary
Basically only a boolean, which helps making the code more readable.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.