32 else ATH_MSG_DEBUG(
"The pileup residual calibrations will be applied simultaneously (default).");
39 "Sequential residual calibration can not be applied in doMuOnly or doNPVOnly cases.");
42 "It was requested to apply only the mu-based AND the NPV-based calibrations.");
45 "OffsetCorrection.DefaultMuRef not specified.");
48 "OffsetCorrection.DefaultNPVRef not specified.");
50 return StatusCode::SUCCESS;
55 ATH_MSG_DEBUG(
"Calibrating jet collection with 1D pile-up correction");
59 double mu = eventInfoDecor(0);
69 "Could not retrieve xAOD::EventShape::Density from xAOD::EventShape "<<
m_rhoKey.key() );
83 const double E_det = jetStartP4.e();
84 const double pT_det = jetStartP4.pt();
85 const double mass_det = jetStartP4.mass();
87 if ( E_det < mass_det ) {
88 ATH_MSG_ERROR(
"PileupAreaResidualCalibStep: jet has mass=" << mass_det <<
" MeV, which is greater than it's energy=" << E_det <<
" MeV! Aborting." );
89 return StatusCode::FAILURE;
96 double pT_offset = pT_det;
104 pT_offset =
m_doJetArea ? pT_det - rho*jetareaP4.pt() - offsetET : pT_det - offsetET;
107 pileup_SF = pT_offset >= 0 ? pT_offset / pT_det : 10./pT_det;
109 calibP4 = jetStartP4*pileup_SF;
114 pT_offset =
m_doJetArea ? pT_det - rho*jetareaP4.pt() - offsetET : pT_det - offsetET;
115 double muSF = pT_offset >= 0 ? pT_offset / pT_det : 10./pT_det;
116 calibP4 = jetStartP4*muSF;
120 double pT_afterMuCalib = calibP4.pt();
121 pT_offset = pT_afterMuCalib - offsetET;
122 double SF = pT_offset >= 0 ? pT_offset / pT_afterMuCalib : 10./pT_afterMuCalib;
123 calibP4 = calibP4*SF;
128 jet->setJetP4( calibP4 );
131 return StatusCode::SUCCESS;
136 double alpha = 0.0, beta = 0.0;
145 static const double toMeV= 1000.;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This header defines wrapper classes around SG::AuxElement::Accessor used internally in the Jet EDM.
#define CHECK_THEN_ERROR(checkcode, message)
Class JetContext Designed to read AOD information related to the event, N vertices,...
PileupAreaResidualCalibStep(const std::string &name="PileupAreaResidualCalibStep")
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_jetInScale
In and out scales.
Gaudi::Property< bool > m_doJetArea
Gaudi::Property< bool > m_doMuOnly
Properties.
SG::ReadHandleKey< xAOD::EventShape > m_rhoKey
Event properties.
Gaudi::Property< bool > m_doNPVOnly
Gaudi::Property< float > m_muSF
virtual StatusCode calibrate(xAOD::JetContainer &jetCont) const override
Apply calibration to a jet container.
ToolHandle< JetHelper::IVarTool > m_histTool_mu
Histograms with PU residual correction factors.
ToolHandle< JetHelper::IVarTool > m_histTool_NPV
Gaudi::Property< bool > m_doSequentialResidual
Gaudi::Property< float > m_mu_ref
Gaudi::Property< bool > m_isData
double getResidualOffset(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double mu, double NPV, bool MuOnly, bool NOnly) const
SG::ReadDecorHandleKey< xAOD::EventInfo > m_muKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvKey
Gaudi::Property< float > m_NPV_ref
Gaudi::Property< std::string > m_jetOutScale
Handle class for reading a decoration on an object.
bool isPresent() const
Is the referenced container present in SG?
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void getAttribute(const SG::AuxElement &p, TYPE &v) const
void setAttribute(SG::AuxElement &p, const TYPE &v) const
int countNPV(const VXCONT &vxCont)
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.