Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply trigger SF, save weights for corresponding shifts in the SF #21

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

ktht
Copy link
Member

@ktht ktht commented Aug 1, 2022

Resolves #17. Tested 2lss+1tau and 1l+1tau.

The trigger SF depend on the reconstructed lepton and taus but their number is not guaranteed to pass the nominal cut, which could result in "undefined" behavior. In order to avoid computing bogus SF, I've placed the trigger SF computation under these if blocks:

if(event.fakeableLeptons().size() == numNominalLeptons)
{
evtWeightRecorder.record_leptonTriggerEff(dataToMCcorrectionInterface);
}
if(dataToMCcorrectionInterface_trigger)
{
dataToMCcorrectionInterface_trigger->setHadTaus(event.fakeableHadTaus());
dataToMCcorrectionInterface_trigger->setLeptons(event.fakeableLeptons());
if(event.fakeableLeptons().size() == numNominalLeptons &&
event.fakeableHadTaus().size() == numNominalHadTaus )
{
evtWeightRecorder.record_tauTriggerEff(dataToMCcorrectionInterface_trigger);
}
}

In other words, the trigger SF are calculated only if the number of fakeable leptons and taus matches their nominal number.

@ktht
Copy link
Member Author

ktht commented Aug 1, 2022

Forgot to mention (and implement) one more detail: the pT thresholds documented in JSON API are a bit misleading because the binning for the trigger efficiencies varies between different types of triggers. For instance, for ditau trigger it's 40 GeV while for lepton+tau cross-trigger it's 25 GeV:

const std::map<std::string, double> Data_to_MC_CorrectionInterface_trigger_Base::tau_trigger_ptThresholds_ = {
{ "ditau", 40. },
{ "etau", 25. },
{ "mutau", 25. },
{ "ditauvbf", 20. },
};

The actual binning in the JSON file starts slightly below these thresholds. The documentation claims that the pT binning is universal and starts from 20 GeV, which is incorrect. If the input tau has a pT less than the threshold, then the code returns 0 for the SF:
const double pt_threshold = tau_trigger_ptThresholds_.at(trigger_type);
return pt >= pt_threshold ? sf_trigger_->evaluate({ pt, dm, trigger_type, wp, data_type, sys }) : 0.;

I think the ideal solution would be that the SF of zero is returned by correctionlib itself if any of the input parameters have a value smaller than the starting edge of the first bin. Catching these errors can be expensive when it's done frequently. We can voice this concern on a different timescale, though.

@ktht ktht merged commit 50f9844 into main Aug 1, 2022
@ktht ktht deleted the tauTriggerSF branch September 13, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply tau trigger SF
1 participant