Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Allow missing jet systematics in T1 MET recorrections
Browse files Browse the repository at this point in the history
Normally, jet correctors are supposed to throw exceptions when a
systematic variation is evaluated but no inputs for it have been
provided. This causes problems since currently JER systematics should
not be propagated into MET. Instead, allow JetMETUpdate to tolerate
missing JEC/JER variations in correctors when evaluating T1 MET.
  • Loading branch information
andrey-popov committed Aug 3, 2016
1 parent d673db2 commit da86372
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/mensura/extensions/JetCorrectorService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class JetCorrectorService: public Service
*/
double EvalJECUnc(double const corrPt, double const eta) const;

/// Reports if requested systematic variation can be computed
bool IsSystEnabled(SystType syst) const;

/// A short-cut for method Eval
double operator()(Jet const &jet, double rho, SystType syst = SystType::None,
SystService::VarDirection direction = SystService::VarDirection::Undefined) const;
Expand Down
19 changes: 19 additions & 0 deletions modules/extensions/src/JetCorrectorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@ void JetCorrectorService::SetJECUncertainty(std::string const &jecUncFile_,
}


bool JetCorrectorService::IsSystEnabled(SystType syst) const
{
switch (syst)
{
case SystType::JEC:
return not jecUncProviders.empty();

case SystType::JER:
return bool(jerSFProvider);

case SystType::None:
return true;

default:
return false;
}
}


void JetCorrectorService::SetJER(std::string const &jerSFFile_, std::string const &jerMCFile_,
unsigned long seed /*= 0*/)
{
Expand Down
27 changes: 23 additions & 4 deletions modules/extensions/src/JetMETUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,19 @@ bool JetMETUpdate::ProcessEvent()
srcJet.RawP4() * jetCorrForMETOrigL1->Eval(srcJet, rho);

if (jetCorrForMETOrigFull)
metShift +=
srcJet.RawP4() * jetCorrForMETOrigFull->Eval(srcJet, rho, systType, systDirection);
{
// Sometimes some of jet systematic variations are not propagated into MET. Do not
//attempt to evaluate them if they are have not been specified in the corresponding
//jet corrector object
double corrFactor;

if (jetCorrForMETOrigFull->IsSystEnabled(systType))
corrFactor = jetCorrForMETOrigFull->Eval(srcJet, rho, systType, systDirection);
else
corrFactor = jetCorrForMETOrigFull->Eval(srcJet, rho);

metShift += srcJet.RawP4() * corrFactor;
}


// Apply new T1 corrections
Expand All @@ -177,8 +188,16 @@ bool JetMETUpdate::ProcessEvent()
srcJet.RawP4() * jetCorrForMETL1->Eval(srcJet, rho);

if (jetCorrForMETFull)
metShift -=
srcJet.RawP4() * jetCorrForMETFull->Eval(srcJet, rho, systType, systDirection);
{
double corrFactor;

if (jetCorrForMETFull->IsSystEnabled(systType))
corrFactor = jetCorrForMETFull->Eval(srcJet, rho, systType, systDirection);
else
corrFactor = jetCorrForMETFull->Eval(srcJet, rho);

metShift -= srcJet.RawP4() * corrFactor;
}
}


Expand Down

0 comments on commit da86372

Please sign in to comment.