Skip to content
Snippets Groups Projects
Commit 8a23271e authored by James Beacham's avatar James Beacham
Browse files

Merge branch 'athena-21.0-ATLASSIM-3900' into '21.0'

Add protection against extrapolation failures returning NaN in FastCaloSimSvcV2 (ATLASSIM-3900)

See merge request atlas/athena!15631

Former-commit-id: 77fcd8ecc6ffabc17eb7888221bf12fd1f3aa1be
parents 0b52d4be 8f93d38a
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,10 @@ FCSReturnCode TFCSHistoLateralShapeParametrization::simulate_hit(Hit &hit, TFCSS
const double center_r=0.5*( extrapol->r(cs, CaloSubPos::SUBPOS_ENT) + extrapol->r(cs, CaloSubPos::SUBPOS_EXT) );
const double center_z=0.5*( extrapol->z(cs, CaloSubPos::SUBPOS_ENT) + extrapol->z(cs, CaloSubPos::SUBPOS_EXT) );
if (TMath::IsNaN(center_r) or TMath::IsNaN(center_z) or TMath::IsNaN(center_eta) or TMath::IsNaN(center_phi)) { //Check if extrapolation fails
return FCSFatal;
}
float alpha, r, rnd1, rnd2;
rnd1 = CLHEP::RandFlat::shoot(simulstate.randomEngine());
rnd2 = CLHEP::RandFlat::shoot(simulstate.randomEngine());
......
......@@ -193,7 +193,7 @@ StatusCode ISF::FastCaloSimSvcV2::simulate(const ISF::ISFParticle& isfp)
ATH_MSG_VERBOSE("NEW PARTICLE! FastCaloSimSvcV2 called with ISFParticle: " << isfp);
Amg::Vector3D particle_position = isfp.position();
Amg::Vector3D particle_direction(isfp.momentum().x(),isfp.momentum().y(),isfp.momentum().z());
//int barcode=isfp.barcode(); // isfp barcode, eta and phi: in case we need them
// float eta_isfp = particle_position.eta();
......@@ -212,7 +212,9 @@ StatusCode ISF::FastCaloSimSvcV2::simulate(const ISF::ISFParticle& isfp)
m_FastCaloSimCaloExtrapolation->extrapolate(extrapol,&truth);
TFCSSimulationState simulstate(m_randomEngine);
ATH_MSG_DEBUG(" particle: " << isfp.pdgCode() << " Ekin: " << isfp.ekin() << " eta: " << particle_position.eta());
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());
m_param->setLevel(MSG::DEBUG);
FCSReturnCode status = m_param->simulate(simulstate, &truth, &extrapol);
if (status != FCSSuccess) {
return StatusCode::FAILURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment