Skip to content

Commit

Permalink
Fixing FTAG MCMC SFs (#1686)
Browse files Browse the repository at this point in the history
* Fixing FTAG MCMC SFs

* Add amc Herwig, fix capitalization, fix order

* Fixing Run3 FTAG MCMC SF behavior after looking at CDI files

* Fix to allow for PhH7EG_A14

---------

Co-authored-by: Michael Hank <[email protected]>
Co-authored-by: Michael Hank <[email protected]>
  • Loading branch information
3 people authored May 16, 2024
1 parent 455ab08 commit 03f2e09
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 31 deletions.
75 changes: 52 additions & 23 deletions Root/BJetEfficiencyCorrector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -233,29 +233,58 @@ EL::StatusCode BJetEfficiencyCorrector :: initialize ()
gridName=wk()->metaData()->castString(SH::MetaFields::sampleName);
sampleShowerType=HelperFunctions::getMCShowerType(gridName);
}

switch(sampleShowerType)
{
case HelperFunctions::Pythia8:
calibration="410470";
break;
case HelperFunctions::Herwig7:
calibration="410558";
break;
case HelperFunctions::Sherpa21:
calibration="426131";
break;
case HelperFunctions::Sherpa22:
calibration="410250";
break;
case HelperFunctions::Sherpa2210:
calibration="700122";
break;
case HelperFunctions::Unknown:
ANA_MSG_ERROR("Cannot determine MC shower type for sample " << gridName << ".");
return EL::StatusCode::FAILURE;
break;
}

if(m_isRun3){
switch(sampleShowerType)
{
case HelperFunctions::Pythia8:
calibration="601229";
break;
case HelperFunctions::Herwig7p2:
calibration="601414";
break;
case HelperFunctions::Sherpa2212:
calibration="700660";
break;
default:
ANA_MSG_ERROR("Cannot determine MC shower type for sample " << gridName << ".");
return EL::StatusCode::FAILURE;
break;
}
} else {

switch(sampleShowerType)
{
case HelperFunctions::Pythia8:
calibration="410470";
break;
case HelperFunctions::Herwig7p1:
calibration="411233";
break;
case HelperFunctions::Herwig7p2:
calibration="600666";
break;
case HelperFunctions::Sherpa221:
calibration="410250";
break;
case HelperFunctions::Sherpa2210:
calibration="700122";
break;
case HelperFunctions::Sherpa2212:
calibration="700660";
break;
case HelperFunctions::AmcPy8:
calibration="410464";
break;
case HelperFunctions::AmcH7:
calibration="412116";
break;
case HelperFunctions::Unknown:
ANA_MSG_ERROR("Cannot determine MC shower type for sample " << gridName << ".");
return EL::StatusCode::FAILURE;
break;
}
}
} else { makeMCIndexMap(m_EfficiencyCalibration); }
ANA_CHECK( m_BJetEffSFTool_handle.setProperty("EfficiencyBCalibrations" , calibration));
ANA_CHECK( m_BJetEffSFTool_handle.setProperty("EfficiencyCCalibrations" , calibration));
Expand Down
15 changes: 8 additions & 7 deletions Root/HelperFunctions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -527,21 +527,22 @@ HelperFunctions::ShowerType HelperFunctions::getMCShowerType(const std::string&
tmp_name.ReplaceAll("Py8EG","PYTHIA8EVTGEN");
tmp_name.ReplaceAll("Py8EvtGen","PYTHIA8EVTGEN");
tmp_name.ReplaceAll("Py8","Pythia8");
tmp_name.ReplaceAll("H7","HERWIG");
if(tmp_name.Contains("Pythia") && !tmp_name.Contains("Pythia8") && !tmp_name.Contains("EvtGen")) tmp_name.ReplaceAll("Pythia","PYTHIA8EVTGEN");
if(tmp_name.Contains("Pythia8") && !tmp_name.Contains("EvtGen")) tmp_name.ReplaceAll("Pythia8","PYTHIA8EVTGEN");
//capitalize the entire sample name
tmp_name.ToUpper();

//
// Determine shower type by looking for keywords in name
if(tmp_name.Contains("PYTHIA8EVTGEN")) return Pythia8;
else if(tmp_name.Contains("HERWIG")) return Herwig7;
else if(tmp_name.Contains("SHERPA_CT")) return Sherpa21;
if(tmp_name.Contains("AMCATNLOPY")) return AmcPy8;
else if(tmp_name.Contains("AMCATNLOH")) return AmcH7;
else if(tmp_name.Contains("PYTHIA8EVTGEN")) return Pythia8;
else if(tmp_name.Contains("HERWIG")) return Herwig7p1;
else if(tmp_name.Contains("PHH7EG")) return Herwig7p2;
else if(tmp_name.Contains("SHERPA_221_")) return Sherpa221;
else if(tmp_name.Contains("SH_221_")) return Sherpa221;
else if(tmp_name.Contains("SH_2210")) return Sherpa2210;
else if(tmp_name.Contains("SH_2211")) return Sherpa2210;
else if(tmp_name.Contains("SH_2212")) return Sherpa2210;
else if(tmp_name.Contains("SH_2214")) return Sherpa2210;
else if(tmp_name.Contains("SHERPA")) return Sherpa22;
else if(tmp_name.Contains("SH_2212")) return Sherpa2212;
else return Unknown;
}
3 changes: 3 additions & 0 deletions xAODAnaHelpers/BJetEfficiencyCorrector.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class BJetEfficiencyCorrector : public xAH::Algorithm
/// @brief Decorate tag weights even if we're not doing pseudocontinuous b-tagging
bool m_alwaysGetTagWeight = false;

/// @brief Flag to get Run3 MC-MC SFs
bool m_isRun3 = false;

// allowed operating points:
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTaggingCalibrationDataInterface#xAOD_interface
//For the fixed cut, valid options are: [ "FixedCutBEff_60", "FixedCutBEff_70", "FixedCutBEff_77", "FixedCutBEff_85" ]
Expand Down
2 changes: 1 addition & 1 deletion xAODAnaHelpers/HelperFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ namespace HelperFunctions {
}

/// @brief The different supported shower types
enum ShowerType {Unknown, Pythia8, Herwig7, Sherpa21, Sherpa22, Sherpa2210};
enum ShowerType {Unknown, Pythia8, Herwig7p1, Herwig7p2, Sherpa221, Sherpa2210, Sherpa2212, AmcPy8, AmcH7};

/**
@brief Determines the type of generator used for the shower from the sample name
Expand Down

0 comments on commit 03f2e09

Please sign in to comment.