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() );
64 m_doPunchThrough = not m_punchThroughTool.empty();
65 if (m_doPunchThrough) {
72 ATH_CHECK(m_FastCaloSimCaloExtrapolation.retrieve());
77 return StatusCode::SUCCESS;
85 m_theContainerPtr = m_theContainer.get();
86 ATH_CHECK(evtStore()->record(std::move(m_theContainer), m_caloCellsOutputName));
88 const EventContext& ctx = Gaudi::Hive::currentContext();
89 return this->commonSetup(ctx);
97 m_theContainerPtr = m_theContainer.get();
98 return this->commonSetup(ctx);
106 rngWrapper->
setSeed( m_randomEngineName, ctx );
108 for (
const ToolHandle<ICaloCellMakerTool>&
tool : m_caloCellMakerToolsSetup)
110 std::string chronoName=this->
name()+
"_"+
tool.name();
111 if (m_chrono) m_chrono->chronoStart(chronoName);
114 m_chrono->chronoStop(chronoName);
121 return StatusCode::FAILURE;
125 return StatusCode::SUCCESS;
134 if ( m_theContainer ) {
139 return StatusCode::SUCCESS;
141 return StatusCode::FAILURE;
147 const EventContext& ctx = Gaudi::Hive::currentContext();
150 for (
const ToolHandle<ICaloCellMakerTool>&
tool : m_caloCellMakerToolsRelease)
157 return StatusCode::SUCCESS;
165 ATH_MSG_VERBOSE(
"NEW PARTICLE! FastCaloSimV2Tool called with ISFParticle: " << isfp);
173 if(isfp.
ekin() < 10) {
174 ATH_MSG_VERBOSE(
"Skipping particle with Ekin: " << isfp.
ekin() <<
" MeV. Below the 10 MeV threshold.");
175 return StatusCode::SUCCESS;
179 truth.SetPtEtaPhiM(particle_direction.perp(), particle_direction.eta(), particle_direction.phi(), isfp.
mass());
188 ATH_MSG_VERBOSE(
"Found anti-proton/neutron, setting Ekin offset in TFCSTruthState.");
192 m_FastCaloSimCaloExtrapolation->extrapolate(
extrapol, &truth);
194 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());
197 if(
extrapol.IDCaloBoundary_eta() != -999){
198 CLHEP::HepRandomEngine *rndmEngine = rngWrapper->
getEngine(ctx);
209 for(
const auto& iter : simulstate.
cells()) {
210 CaloCell* theCell = (
CaloCell*)m_theContainerPtr->findCell(iter.first->calo_hash());
215 if (m_doPunchThrough) {
218 const ISF::ISFParticleVector *someSecondaries = m_punchThroughTool->computePunchThroughParticles(isfp, simulstate, rndmEngine);
220 if (someSecondaries && !someSecondaries->empty()) {
228 m_truthRecordSvc->registerTruthIncident( truth,
true );
233 for (
auto *secondary : *someSecondaries) {
234 if (secondary->getTruthBinding()) {
235 secondaries.push_back(secondary);
238 ATH_MSG_WARNING(
"Secondary particle created by PunchThroughTool not written out to truth.\n Parent (" << isfp <<
")\n Secondary (" << *secondary <<
")");
242 delete someSecondaries;
247 else ATH_MSG_DEBUG(
"Skipping simulation as extrapolation to ID-Calo boundary failed.");
250 return StatusCode::SUCCESS;