Skip to content
Snippets Groups Projects
Commit 39ef053c authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'cherry-pick-a6cba8cfed4-master' into 'master'

Sweeping !40932 from 21.2 to master.
add flag for 1D/2D muon isolation SFs and setting the default to 1D

See merge request atlas/athena!41240
parents 26008d70 c22a9307
No related branches found
No related tags found
No related merge requests found
......@@ -224,11 +224,20 @@ namespace CP {
CorrectionCode GetBinningParameter(const xAOD::Muon & mu, float & value) const override;
virtual ~dRJetAxisHandler() = default;
//this method must be called only before any object creation, since it sets the static variable s_close_jet_decor, that is used only to initialize the m_acc member variable, and for nothing else; using it after object creation will not change the behaviour of the class
static void set_close_jet_decorator(const std::string& decor_name);
//this method must be called only before any object creation, since it sets the static variable s_use_2D_sf, that is used only to initialize the m_use_2D_sf member variable, and for nothing else; using it after object creation will not change the behaviour of the class
static void set_use_2D_sf(const bool);
private:
static std::string m_close_jet_decor;
//this static variable is safe because it is only used during object creation (to set the value of m_acc) and avoiding it would require a significant rewrite
static std::string s_close_jet_decor;
//this static variable is safe because it is only used during object creation (to set the value of m_use_2D_sf) and avoiding it would require a significant rewrite
static bool s_use_2D_sf;
SG::AuxElement::ConstAccessor<float> m_acc;
bool m_use_2D_sf;
};
class UndefinedAxisHandler: public AxisHandler {
public:
......
......@@ -142,6 +142,8 @@ namespace CP {
/// float AuxElement the information of the separation
/// to the closest jet is stored
std::string close_by_jet_decoration() const;
/// option to set if we want to use 1D or 2D isolation SFs
bool use_2D_iso_corrections() const;
private:
......@@ -179,6 +181,7 @@ namespace CP {
float m_lowpt_threshold;
/// Name of the decoration to catch up the close by jets
std::string m_iso_jet_dR;
bool m_use2DIsoCorr;
CP::SystematicSet m_affectingSys;
/// It turned out that the code spends a large time in the look up of
/// the systematics. This map tries to mitigate this issue.
......
......@@ -46,6 +46,7 @@ namespace CP {
if (ref_tool.measurement() == CP::MuonEfficiencyType::Iso){
dRJetAxisHandler::set_close_jet_decorator(ref_tool.close_by_jet_decoration());
dRJetAxisHandler::set_use_2D_sf(ref_tool.use_2D_iso_corrections());
}
// open the file
std::unique_ptr<TFile> f (TFile::Open(file.c_str(), "READ"));
......
......@@ -67,23 +67,33 @@ namespace CP {
return CorrectionCode::Ok;
}
void dRJetAxisHandler::set_close_jet_decorator(const std::string& decor_name){
m_close_jet_decor = decor_name;
s_close_jet_decor = decor_name;
}
std::string dRJetAxisHandler::m_close_jet_decor = "dRJet";
void dRJetAxisHandler::set_use_2D_sf(const bool in)
{
s_use_2D_sf=in;
}
std::string dRJetAxisHandler::s_close_jet_decor = "dRJet";
bool dRJetAxisHandler::s_use_2D_sf = false;
dRJetAxisHandler::dRJetAxisHandler():
m_acc(m_close_jet_decor){}
m_acc(s_close_jet_decor),
m_use_2D_sf(s_use_2D_sf){}
CorrectionCode dRJetAxisHandler::GetBinningParameter(const xAOD::Muon & mu, float & value) const {
static std::atomic<unsigned int> warned = {0};
static const SG::AuxElement::ConstAccessor<float> acc_dR_deriv("DFCommonJetDr");
if (acc_dR_deriv.isAvailable(mu)){
if(!m_use_2D_sf) value = -2.;
else if (acc_dR_deriv.isAvailable(mu)){
value = acc_dR_deriv(mu);
}else if( m_acc.isAvailable(mu) ) {
// decoration available in DxAOD
value = m_acc(mu);
if (warned < 5){
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The DFCommonJetDr jet decoration is not available in the derivaiton will fall back to %s",m_close_jet_decor.c_str());
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The DFCommonJetDr jet decoration is not available in the derivation will fall back to %s",s_close_jet_decor.c_str());
++warned;
}
} else {
......@@ -91,7 +101,7 @@ namespace CP {
value = -2.;
// We want these warnings to be printed few times per job, so that they're visible, then stop before log file's size blows up
if (warned<5){
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The %s decoration has not been found for the Muon. Isolation scale-factors are now also binned in #Delta R(jet,#mu)", m_close_jet_decor.c_str());
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "The %s decoration has not been found for the Muon. Isolation scale-factors are now also binned in #Delta R(jet,#mu)", s_close_jet_decor.c_str());
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "using the closest calibrated AntiKt4EMTopo jet with p_{T}>20~GeV and surving the standard OR criteria.");
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "You should decorate your muon appropiately before passing to the tool, and use dRJet = -1 in case there is no jet in an event.");
Warning("MuonEfficiencyCorrections::dRJetAxisHandler()", "For the time being the inclusive scale-factor is going to be returned.");
......
......@@ -31,9 +31,10 @@ namespace CP {
m_efficiency_decoration_name_data(),
m_efficiency_decoration_name_mc(),
m_sf_decoration_name(),
m_calibration_version("200513_Precision_r21"),
m_calibration_version("210222_Precision_r21"),
m_lowpt_threshold(15.e3),
m_iso_jet_dR("dRJet"),
m_use2DIsoCorr(false),
m_affectingSys(),
m_filtered_sys_sets(),
m_init(false),
......@@ -70,10 +71,14 @@ namespace CP {
/// Name of the decorator carrying the information the distance to the
/// next what ever jet (AntiKt4EMTopo,....)
declareProperty("CloseJetDRDecorator", m_iso_jet_dR);
declareProperty("Use2DIsoCorrections", m_use2DIsoCorr);
}
std::string MuonEfficiencyScaleFactors::close_by_jet_decoration() const{
return m_iso_jet_dR;
}
bool MuonEfficiencyScaleFactors::use_2D_iso_corrections() const{
return m_use2DIsoCorr;
}
float MuonEfficiencyScaleFactors::lowPtTransition() const{
return m_lowpt_threshold;
}
......
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