diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx index 607c2e9c5a7be8adab7fe3d3f92c8b00fd34b3e3..ffa904c3e334db1707c11aa33d36b2cb53736b0b 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx @@ -24,6 +24,18 @@ /* Particle data */ #include "HepPDT/ParticleDataTable.hh" +/* Preprocessor macro to use + -- DEBUG if CONDITION is True + -- WARNING if CONDITION is False + */ +#define ATH_MSG_COND(MSG, CONDITION) \ +do { \ + if (CONDITION) { \ + ATH_MSG_DEBUG(MSG); \ + } else { \ + ATH_MSG_WARNING(MSG); \ + } \ +} while (0) FastCaloSimCaloExtrapolation::FastCaloSimCaloExtrapolation(const std::string& t, const std::string& n, const IInterface* p) @@ -165,10 +177,8 @@ bool FastCaloSimCaloExtrapolation::getCaloSurface(TFCSExtrapolationState& result result.set_CaloSurface_z(surface_hitPos[Amg::z]); double pT=(*it).trackParms->momentum().perp(); - if(std::abs(result.CaloSurface_eta())>4.9 || pT<500 || (std::abs(result.CaloSurface_eta())>4 && pT<1000)) - ATH_MSG_DEBUG("only entrance to calo entrance layer found, no surface : eta="<<result.CaloSurface_eta()<<" phi="<<result.CaloSurface_phi()<<" r="<<result.CaloSurface_r()<<" z="<<result.CaloSurface_z()<<" pT="<<pT); - else - ATH_MSG_WARNING("only entrance to calo entrance layer found, no surface : eta="<<result.CaloSurface_eta()<<" phi="<<result.CaloSurface_phi()<<" r="<<result.CaloSurface_r()<<" z="<<result.CaloSurface_z()<<" pT="<<pT); + + ATH_MSG_COND("only entrance to calo entrance layer found, no surface : eta="<<result.CaloSurface_eta()<<" phi="<<result.CaloSurface_phi()<<" r="<<result.CaloSurface_r()<<" z="<<result.CaloSurface_z()<<" pT="<<pT, std::abs(result.CaloSurface_eta())>4.9 || pT<500 || (std::abs(result.CaloSurface_eta())>4 && pT<1000)); } //sample else ATH_MSG_DEBUG("entrance to calo surface : sample="<<result.CaloSurface_sample()<<" eta="<<result.CaloSurface_eta()<<" phi="<<result.CaloSurface_phi()<<" r="<<result.CaloSurface_r()<<" z="<<result.CaloSurface_z()<<" deta="<<min_calo_surf_dist); @@ -317,11 +327,12 @@ std::unique_ptr<std::vector<Trk::HitInfo>> FastCaloSimCaloExtrapolation::caloHit } -void FastCaloSimCaloExtrapolation::extrapolateToID(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector) const{ - +void FastCaloSimCaloExtrapolation::extrapolateToID(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector, const TFCSTruthState* truth) const{ ATH_MSG_DEBUG("Start extrapolateToID()"); + //pT threshold of truth particles over which extrapolation failures will be printed as warnings + const float transverseMomWarningLimit = 500; //initialize values result.set_IDCaloBoundary_eta(-999.); @@ -372,15 +383,14 @@ void FastCaloSimCaloExtrapolation::extrapolateToID(TFCSExtrapolationState& resul } //end of loop over surfaces - if(result.IDCaloBoundary_eta() == -999) ATH_MSG_DEBUG("Failed extrapolation to ID-Calo boundary!"); - + if(result.IDCaloBoundary_eta() == -999) ATH_MSG_COND("[ExtrapolateToID] Failed extrapolation to ID-Calo boundary. \n[ExtrapolateToID] Particle with truth vertex at (" << truth->vertex().X() <<","<<truth->vertex().Y()<<","<<truth->vertex().Z()<<")"<<" with"<<" PdgId="<<truth->pdgid()<<" pT="<<truth->Pt()<<" eta="<<truth->Eta()<<" phi="<<truth->Phi()<<" E="<<truth->E()<<" Ekin_off="<<truth->Ekin_off(), truth->Pt() < transverseMomWarningLimit); + ATH_MSG_DEBUG("[ExtrapolateToID] End extrapolateToID()"); } void FastCaloSimCaloExtrapolation::extrapolate(TFCSExtrapolationState& result, const TFCSTruthState* truth) const{ - - + ATH_MSG_DEBUG("Start FastCaloSimCaloExtrapolation::extrapolate"); auto hitVector = caloHits(truth); @@ -390,10 +400,10 @@ void FastCaloSimCaloExtrapolation::extrapolate(TFCSExtrapolationState& result, c getCaloSurface(result, hitVector.get()); ATH_MSG_DEBUG("FastCaloSimCaloExtrapolation::extrapolate:*** Do extrapolation to ID-calo boundary ***"); - extrapolateToID(result, hitVector.get()); + extrapolateToID(result, hitVector.get(), truth); ATH_MSG_DEBUG("FastCaloSimCaloExtrapolation::extrapolate:*** Do extrapolation ***"); - extrapolateToLayers(result, hitVector.get()); + extrapolateToLayers(result, hitVector.get(), truth); ATH_MSG_DEBUG("FastCaloSimCaloExtrapolation::extrapolate: Truth extrapolation done"); @@ -408,10 +418,13 @@ void FastCaloSimCaloExtrapolation::extrapolate(TFCSExtrapolationState& result, c } -void FastCaloSimCaloExtrapolation::extrapolateToLayers(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector) const +void FastCaloSimCaloExtrapolation::extrapolateToLayers(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector, const TFCSTruthState* truth) const { ATH_MSG_DEBUG("[extrapolateToLayers] Start extrapolate"); + //pT threshold of truth particles over which extrapolation failures will be printed as warnings + const float transverseMomWarningLimit = 500; + ////////////////////////////////////// // Start calo extrapolation ////////////////////////////////////// @@ -473,7 +486,8 @@ void FastCaloSimCaloExtrapolation::extrapolateToLayers(TFCSExtrapolationState& r } //for sample } //inside calo - else ATH_MSG_WARNING( "[extrapolateToLayers] Ups. Not inside calo. result.IDCaloBoundary_eta()="<<result.IDCaloBoundary_eta()); + else ATH_MSG_COND("[extrapolateToLayers] Ups. Not inside calo. result.IDCaloBoundary_eta()="<<result.IDCaloBoundary_eta()<< "\n[extrapolateToLayers] Particle with truth vertex at (" << truth->vertex().X() <<","<<truth->vertex().Y()<<","<<truth->vertex().Z()<<")"<<" with"<<" PdgId="<<truth->pdgid()<<" pT="<<truth->Pt()<<" eta="<<truth->Eta()<<" phi="<<truth->Phi()<<" E="<<truth->E()<<" Ekin_off="<<truth->Ekin_off(), truth->Pt() < transverseMomWarningLimit); + ATH_MSG_DEBUG("[extrapolateToLayers] End extrapolateToLayers()"); } diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h index 3f884aca152be5ca761e31a1932ae8057a07b603..8dff48904faa277706b892ef6cb1ae11fb6f9170 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.h @@ -73,9 +73,9 @@ protected: ///Finds best extrapolation extPos from the hitVector for a cylinder defined by radius cylR and half-length cylZ as well as corresponding momentum direction bool extrapolateToCylinder(std::vector<Trk::HitInfo>* hitVector, float cylR, float cylZ, Amg::Vector3D& extPos, Amg::Vector3D& momDir) const; ///Extrapolates to ID using three uniquely defined cylinder surfaces - void extrapolateToID(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector) const; + void extrapolateToID(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector, const TFCSTruthState* truth) const; ///Extrapolates to all other layers of the calorimeter - void extrapolateToLayers(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector) const; + void extrapolateToLayers(TFCSExtrapolationState& result, std::vector<Trk::HitInfo>* hitVector, const TFCSTruthState* truth) const; /*Extrapolator helper methods*/