217 for (
size_t l = 0;
l < types.size();
l++) {
218 if (types[
l] !=
"data" ||
m_systematics[isystematic].
name().
find(
"TrigSystUncertainty") == std::string::npos) {
223 Error(
m_appName,
"Could not retrieve trigger efficiency. Paramaters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s,\n Type = %s ",
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str(), types[
l].c_str());
226 if (eff < 0 || eff > 1) {
227 Warning(
m_appName,
"Retrieved trigger efficiency %.3f is outside of expected range from 0 to 1. Paramaters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s",
eff,
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str());
230 if (binNumber < 0 || binNumber > 238) {
231 Warning(
m_appName,
"Retrieved bin number %.i is outside of expected range from 0 to 238. Paramaters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s", binNumber,
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str());
239 double triggerSF = 0.;
242 Error(
m_appName,
"Could not retrieve trigger scale factors. Parameters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s",
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str());
245 if (triggerSF < 0.2 || triggerSF > 1.2) {
250 Error(
"MuonTriggerSFRootCoreTest",
"Could not extract threshold for trigger %s",
m_trigger.c_str());
253 bool displayWarning =
false;
256 if ((**mu_itr).pt() >=
threshold and std::abs((**mu_itr).eta()) < 2.5) displayWarning =
true;
259 if (displayWarning) {
260 Warning(
m_appName,
"Retrieved trigger scale factor %.3f is outside of expected range from 0.2 to 1.2. Parameters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s", triggerSF,
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str());
264 double tmpEffData = 1.;
265 double tmpEffMC = 1.;
266 for (
auto muon: *muons) {
269 double scaleFactor = 0.;
271 Error(
"MuonTriggerSFRootCoreTest",
"Could not extract data trigger efficiency for %s which is %f. Parameters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s \n muon pt: %f \n eta: %f \n phi: %f",
m_trigger.c_str(), scaleFactor,
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str(),
muon->pt(),
muon->eta(),
muon->phi());
275 Error(
"MuonTriggerSFRootCoreTest",
"Could not extract MC trigger efficiency for %s",
m_trigger.c_str());
279 Error(
"MuonTriggerSFRootCoreTest",
"Could not extract MC trigger efficiency for %s",
m_trigger.c_str());
282 if (scaleFactor < 0.2 || scaleFactor > 1.2 ) {
285 Error(
"MuonTriggerSFRootCoreTest",
"Could not extract threshold for trigger %s",
m_trigger.c_str());
289 Warning(
m_appName,
"Retrieved single muon trigger scale factor %.3f is outside of expected range from 0.2 to 1.2. Parameters:\n Event number = %i,\n Quality = %s,\n Binning = %s,\n Systematic = %s \n muon pt: %f \n eta: %f \n phi: %f", scaleFactor,
static_cast<int>(ei->
eventNumber()), qualities[iquality].c_str(), binnings[ibin].c_str(),
m_systematics[isystematic].name().c_str(),
muon->pt(),
muon->eta(),
muon->phi());
291 tmpEffData *= 1.-effData;
292 tmpEffMC *= 1.-effMC;
294 auto sfSingleCalc = (1. - tmpEffData)/(1. - tmpEffMC);
295 if ( triggerSF > 0.2 && (sfSingleCalc - triggerSF) / triggerSF > 0.02) {