22 double mass = particle.mass();
23 double energy = std::sqrt( mom.mag2() + mass*mass);
24 HepMC::FourVector fourMomentum( mom.x(), mom.y(), mom.z(), energy);
53 if ( !particle) particle = &
m_parent;
57 m_position =
new HepMC::FourVector( pos.x(), pos.y(), pos.z(), time );
176 auto* truthBinding = particle.getTruthBinding();
177 HepMC::GenParticlePtr currentGenParticle = truthBinding ? truthBinding->getCurrentGenParticle() :
nullptr;
180 if (currentGenParticle) {
181 return currentGenParticle;
190 auto* truthBinding = particle.getTruthBinding();
194 truthBinding->setCurrentGenParticle(newGenParticle);
196 auto parentTruthBinding = parent ? parent->getTruthBinding() :
nullptr;
197 auto primaryGenParticle = parentTruthBinding ? parentTruthBinding->getPrimaryGenParticle() :
nullptr;
198 auto generationZeroGenParticle = newGenParticle;
199 truthBinding =
new TruthBinding( newGenParticle, primaryGenParticle, generationZeroGenParticle );
200 particle.setTruthBinding(truthBinding);
207 return newGenParticle;
216 auto parentAfterIncidentGenParticle = (parentAfterIncidentTruthBinding) ? parentAfterIncidentTruthBinding->
getCurrentGenParticle() :
nullptr;
221 if (parentAfterIncidentGenParticle) { eventIndex = parentAfterIncidentGenParticle->parent_event()->event_number(); }
222 else if (parentBeforeIncidentHMPL) { eventIndex = parentBeforeIncidentHMPL->
eventIndex(); }
225 if (parentBeforeIncidentHMPL) {
226 delete parentBeforeIncidentHMPL;
228 if (!parentAfterIncidentGenParticle) {
232 parentAfterIncidentHMPL =
new HepMcParticleLink(parentAfterIncidentGenParticle, eventIndex, idxFlag);
234 m_parent.setId(parentAfterIncidentID);
235 m_parent.setParticleLink(parentAfterIncidentHMPL);
241 for (
unsigned short i=0; i<numSec; i++) {
245 if (!childTruthBinding) {
248 auto parentTruthBinding =
m_parent.getTruthBinding();
249 if (parentTruthBinding) {
254 childTruthBinding =
new TruthBinding(
nullptr,
nullptr,
nullptr );
263 if (childGenParticle) { eventIndex = childGenParticle->parent_event()->event_number(); }
264 else if (oldChildHMPL) { eventIndex = oldChildHMPL->
eventIndex(); }
270 if (!childGenParticle) {
276 child->
setId(childID);
static HepMC::GenParticlePtr ParticleHelper_convert(const ISF::ISFParticle &particle)
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.
constexpr int UNDEFINED_ID
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...
bool suggest_barcode(T &p, int i)
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
GenParticle * GenParticlePtr
KillPrimary
Basically only a boolean, which helps making the code more readable.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.