From 1692dfb6592e0145b6bfc76506650b6f9e4a2b68 Mon Sep 17 00:00:00 2001 From: John Chapman <John.Chapman@cern.ch> Date: Wed, 15 May 2024 17:09:51 +0200 Subject: [PATCH] ISF_Fatras: fix status values for secondaries produced by ISF_Fatras --- .../src/ProcessSamplingTool.cxx | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx index 9a9a2bd3b88a..d293dc8ad5c8 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx @@ -11,7 +11,7 @@ #include "ISF_Event/ISFParticle.h" #include "ISF_Event/ISFTruthIncident.h" #include "ISF_Interfaces/ITruthSvc.h" -#include "TruthUtils/MagicNumbers.h" +#include "TruthUtils/HepMCHelpers.h" // iFatras #include "ISF_FatrasInterfaces/IHadronicInteractionProcessor.h" #include "ISF_FatrasInterfaces/IPhysicsValidationTool.h" @@ -258,27 +258,28 @@ ISF::ISFParticleVector iFatras::ProcessSamplingTool::interact(const ISF::ISFPar // double cTh = 1.-fmin/(1.-fr)/fr; // first implementation: ctH=1 - + const int status = 1 + HepMC::SIM_STATUS_THRESHOLD; + const int id = HepMC::UNDEFINED_ID; // This will be set if the child particle is saved to the GenEvent ISF::ISFParticle* child1 = new ISF::ISFParticle( position, - fr*momentum, - 0., - 0., - 22, - 1 + HepMC::SIM_STATUS_THRESHOLD, - eCell.time, - *parent, - 0 // FIXME hard-coded id + fr*momentum, + 0., + 0., + MC::PHOTON, + status, + eCell.time, + *parent, + id ); ISF::ISFParticle* child2 = new ISF::ISFParticle( position, - (1-fr)*momentum, - 0., - 0., - 22, - 1 + HepMC::SIM_STATUS_THRESHOLD, - eCell.time, - *parent, - 0 // FIXME hard-coded id + (1-fr)*momentum, + 0., + 0., + MC::PHOTON, + status, + eCell.time, + *parent, + id ); childVector.push_back(child1); @@ -323,7 +324,8 @@ ISF::ISFParticleVector iFatras::ProcessSamplingTool::interact(const ISF::ISFPar ISF::fKillsPrimary ); m_truthRecordSvc->registerTruthIncident( truth); - //Make sure the conversion products get a chance to have correct truth info before pushing into the particle broker + // Make sure the conversion products get a chance to have correct truth info before pushing into the particle broker + // FIXME Check this doesn't cause problems in the TruthSvc for (unsigned int i=0; i<childVector.size(); i++) { if (!childVector[i]->getTruthBinding()) { childVector[i]->setTruthBinding(new ISF::TruthBinding(*parent->getTruthBinding())); @@ -393,8 +395,13 @@ ISF::ISFParticleVector iFatras::ProcessSamplingTool::interact(const ISF::ISFPar parent->nextGeoID(), // inherits from the parent ISF::fKillsPrimary ); m_truthRecordSvc->registerTruthIncident( truth); + // At this point we need to update the properties of the + // ISFParticles produced in the interaction + truth.updateParentAfterIncidentProperties(); + truth.updateChildParticleProperties(); //Make sure the conversion products get a chance to have correct truth info before pushing into the particle broker + // FIXME check this doesn't cause problems later for (unsigned int i=0; i<childVector.size(); i++) { if (!childVector[i]->getTruthBinding()) { childVector[i]->setTruthBinding(new ISF::TruthBinding(*parent->getTruthBinding())); -- GitLab