31 #include "CaloDetDescr/CaloDetDescrElement.h"
37 #include "CLHEP/Units/SystemOfUnits.h"
56 ATH_CHECK( m_caloCellMakerToolsSetup.retrieve() );
57 ATH_MSG_DEBUG(
"Successfully retrieve CaloCellMakerTools: " << m_caloCellMakerToolsSetup );
58 ATH_CHECK( m_caloCellMakerToolsRelease.retrieve() );
66 m_doPunchThrough = not m_punchThroughTool.empty();
67 if (m_doPunchThrough) {
74 ATH_CHECK(m_FastCaloSimCaloExtrapolation.retrieve());
79 return StatusCode::SUCCESS;
87 m_theContainerPtr = m_theContainer.get();
88 ATH_CHECK(evtStore()->record(std::move(m_theContainer), m_caloCellsOutputName));
90 const EventContext& ctx = Gaudi::Hive::currentContext();
91 return this->commonSetup(ctx);
99 m_theContainerPtr = m_theContainer.get();
100 return this->commonSetup(ctx);
108 rngWrapper->
setSeed( m_randomEngineName, ctx );
110 for (
const ToolHandle<ICaloCellMakerTool>&
tool : m_caloCellMakerToolsSetup)
112 std::string chronoName=this->
name()+
"_"+
tool.name();
113 if (m_chrono) m_chrono->chronoStart(chronoName);
116 m_chrono->chronoStop(chronoName);
123 return StatusCode::FAILURE;
127 return StatusCode::SUCCESS;
136 if ( m_theContainer ) {
141 return StatusCode::SUCCESS;
143 return StatusCode::FAILURE;
149 const EventContext& ctx = Gaudi::Hive::currentContext();
152 for (
const ToolHandle<ICaloCellMakerTool>&
tool : m_caloCellMakerToolsRelease)
159 return StatusCode::SUCCESS;
167 ATH_MSG_VERBOSE(
"NEW PARTICLE! FastCaloSimV2Tool called with ISFParticle: " << isfp);
175 if(isfp.
ekin() < 10) {
176 ATH_MSG_VERBOSE(
"Skipping particle with Ekin: " << isfp.
ekin() <<
" MeV. Below the 10 MeV threshold.");
177 return StatusCode::SUCCESS;
181 truth.SetPtEtaPhiM(particle_direction.perp(), particle_direction.eta(), particle_direction.phi(), isfp.
mass());
190 ATH_MSG_VERBOSE(
"Found anti-proton/neutron, setting Ekin offset in TFCSTruthState.");
194 m_FastCaloSimCaloExtrapolation->extrapolate(
extrapol, &truth);
196 ATH_MSG_DEBUG(
" particle: " << isfp.
pdgCode() <<
" Ekin: " << isfp.
ekin() <<
" position eta: " << particle_position.eta() <<
" direction eta: " << particle_direction.eta() <<
" position phi: " << particle_position.phi() <<
" direction phi: " << particle_direction.phi());
199 if(
extrapol.IDCaloBoundary_eta() != -999){
200 CLHEP::HepRandomEngine *rndmEngine = rngWrapper->
getEngine(ctx);
204 simulstate.
setAuxInfo<
int>(
"EventNr"_FCShash, ctx.evt() );
214 for(
const auto&
iter : simulstate.
cells()) {
220 if (m_doPunchThrough) {
223 const ISF::ISFParticleVector *someSecondaries = m_punchThroughTool->computePunchThroughParticles(isfp, simulstate, rndmEngine);
225 if (someSecondaries && !someSecondaries->empty()) {
233 m_truthRecordSvc->registerTruthIncident( truth,
true );
238 for (
auto *secondary : *someSecondaries) {
239 if (secondary->getTruthBinding()) {
240 secondaries.push_back(secondary);
243 ATH_MSG_WARNING(
"Secondary particle created by PunchThroughTool not written out to truth.\n Parent (" << isfp <<
")\n Secondary (" << *secondary <<
")");
247 delete someSecondaries;
252 else ATH_MSG_DEBUG(
"Skipping simulation as extrapolation to ID-Calo boundary failed.");
255 return StatusCode::SUCCESS;