23     , m_flavourType(FlavourComp::UNKNOWN)
 
   25     , m_analysisFileName(
"")
 
   26     , m_analysisHistPattern(
"")
 
   27     , m_defAnaFileName(
"")
 
   29     , m_absEtaGluonFraction(true)
 
   31     , m_largeRJetTruthLabelName(
"")
 
   32     , m_largeRJetTruthLabels()
 
   33     , m_secondUncHist(nullptr)
 
   34     , m_respType(FlavourResp_UNKNOWN)
 
   35     , m_secondRespType(FlavourResp_UNKNOWN)
 
   36     , m_BjetAccessor(
"IsBjet")
 
   37     , m_NjetAccessor(
"Njet")
 
   38     , m_largeRJetTruthLabelAccessor(m_largeRJetTruthLabelName)
 
   39     , m_gluonFractionHists()
 
   40     , m_gluonFractionErrorHists()
 
   47                                                             const TString& analysisRootFileName,
 
   48                                                             const TString& defaultAnalysisRootFileName,
 
   50                                                             const TString& calibArea,
 
   51                                                             const bool absEtaGluonFraction,
 
   52                                                             const TString& analysisHistPattern
 
   55     , m_flavourType(component.flavourType)
 
   57     , m_analysisFileName(analysisRootFileName)
 
   58     , m_analysisHistPattern(analysisHistPattern)
 
   59     , m_defAnaFileName(defaultAnalysisRootFileName)
 
   61     , m_calibArea(calibArea)
 
   63     , m_absEtaGluonFraction(absEtaGluonFraction)
 
   64     , m_secondUncName(component.uncNames.
size()>1 ? component.uncNames.at(1) : 
"")
 
   65     , m_largeRJetTruthLabelName(component.LargeRJetTruthLabelName)
 
   66     , m_largeRJetTruthLabels(component.LargeRJetTruthLabels)
 
   67     , m_secondUncHist(nullptr)
 
   68     , m_respType(FlavourResp_UNKNOWN)
 
   69     , m_secondRespType(FlavourResp_UNKNOWN)
 
   70     , m_BjetAccessor(
"IsBjet")
 
   71     , m_NjetAccessor(
"Njet")
 
   72     , m_largeRJetTruthLabelAccessor(m_largeRJetTruthLabelName)
 
   73     , m_gluonFractionHists()
 
   74     , m_gluonFractionErrorHists()
 
   85     , m_flavourType(toCopy.m_flavourType)
 
   86     , m_jetType(toCopy.m_jetType)
 
   87     , m_analysisFileName(toCopy.m_analysisFileName)
 
   88     , m_analysisHistPattern(toCopy.m_analysisHistPattern)
 
   89     , m_defAnaFileName(toCopy.m_defAnaFileName)
 
   91     , m_calibArea(toCopy.m_calibArea)
 
   92     , m_absEta(toCopy.m_absEta)
 
   93     , m_absEtaGluonFraction(toCopy.m_absEtaGluonFraction)
 
   94     , m_secondUncName(toCopy.m_secondUncName)
 
   95     , m_largeRJetTruthLabelName(toCopy.m_largeRJetTruthLabelName)
 
   96     , m_largeRJetTruthLabels(toCopy.m_largeRJetTruthLabels)
 
   97     , m_secondUncHist(nullptr)
 
   98     , m_respType(toCopy.m_respType)
 
   99     , m_secondRespType(toCopy.m_secondRespType)
 
  100     , m_BjetAccessor(toCopy.m_BjetAccessor)
 
  101     , m_NjetAccessor(toCopy.m_NjetAccessor)
 
  102     , m_largeRJetTruthLabelAccessor(toCopy.m_largeRJetTruthLabelAccessor)
 
  103     , m_gluonFractionHists()
 
  104     , m_gluonFractionErrorHists()
 
  144         return StatusCode::FAILURE;
 
  152             return StatusCode::FAILURE;
 
  158         return StatusCode::FAILURE;
 
  163         return StatusCode::FAILURE;
 
  182             ATH_MSG_ERROR(
"Component is FlavourComposition, but histogram names are unexpected (need to discriminate gluon vs quark response histograms): "  << 
m_uncHistName.Data() << 
" and " << 
m_secondUncName.Data());
 
  183             return StatusCode::FAILURE;
 
  194             ATH_MSG_ERROR(
"Failed to create second uncertainty histogram for component: " << 
getName().Data());
 
  195             return StatusCode::FAILURE;
 
  204         if (!analysisFile || analysisFile->IsZombie())
 
  207             return StatusCode::FAILURE;
 
  213         std::vector<TString> gluonFractionKeys;
 
  214         std::vector<TString> gluonFractionErrorKeys;
 
  215         getGluonKeys(analysisFile,gluonFractionKeys,gluonFractionErrorKeys);
 
  219         if (gluonFractionKeys.empty() || gluonFractionErrorKeys.empty())
 
  221             ATH_MSG_ERROR(Form(
"Failed to find gluon fraction histogram(s), found %zu nominal and %zu error hists in file %s",gluonFractionKeys.size(),gluonFractionErrorKeys.size(),
m_analysisFileName.Data()));
 
  222             return StatusCode::FAILURE;
 
  227         for (
size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
 
  231                 return StatusCode::FAILURE;
 
  232             if (nJets > nJetsMax)
 
  237         if (nJetsMax < 0 && gluonFractionKeys.size() == 1 && gluonFractionErrorKeys.size() == 1)
 
  243         else if (nJetsMax < 0 && gluonFractionKeys.size() > 1)
 
  245             ATH_MSG_ERROR(Form(
"Found %zu gluon fraction histograms, but they do not appear to be binned by nJets:",gluonFractionKeys.size()));
 
  246             for (
size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
 
  247                 ATH_MSG_ERROR(Form(
"\tKey %zu: %s",iKey,gluonFractionKeys.at(iKey).Data()));
 
  248             return StatusCode::FAILURE;
 
  253             for (
int nJets = 0; nJets <= nJetsMax; ++nJets)
 
  259                 return StatusCode::FAILURE;
 
  261                 return StatusCode::FAILURE;
 
  269                     ATH_MSG_ERROR(Form(
"nJets = %zu was specified for the gluon fraction, but not the error",iJet));
 
  270                     return StatusCode::FAILURE;
 
  274                     ATH_MSG_ERROR(Form(
"nJets = %zu was specified for the error, but not the gluon fraction",iJet));
 
  275                     return StatusCode::FAILURE;
 
  284                 return StatusCode::FAILURE;
 
  286                 return StatusCode::FAILURE;
 
  290         analysisFile->Close();
 
  299             if (!defAnaFile || defAnaFile->IsZombie())
 
  302                 return StatusCode::FAILURE;
 
  308             std::vector<TString> gluonFractionDefaultKeys;
 
  309             std::vector<TString> gluonFractionErrorDefaultKeys;
 
  310             getGluonKeys(defAnaFile,gluonFractionDefaultKeys,gluonFractionErrorDefaultKeys);
 
  313             if (gluonFractionDefaultKeys.size() != 1 || gluonFractionErrorDefaultKeys.size() != 1)
 
  315                 ATH_MSG_ERROR(Form(
"When using the default file to fill unspecified nJets histograms, exactly one gluon fraction and one gluon fraction uncertainty histogram are required.  Instead, we found %zu and %zu respectively in the file %s",gluonFractionDefaultKeys.size(),gluonFractionErrorDefaultKeys.size(),
m_defAnaFileName.Data()));
 
  316                 return StatusCode::FAILURE;
 
  325                 return StatusCode::FAILURE;
 
  327                 return StatusCode::FAILURE;
 
  335     return StatusCode::SUCCESS;
 
  385             ATH_MSG_ERROR(
"UNKNOWN LargeRJetTruthLabel on the jet.  Please use JetTruthLabeling before calling this function or check the jet for irregularities.");
 
  389         bool relevantLabel = 
false;
 
  392             if (aLabel == largeRJetTruthLabel)
 
  393                 relevantLabel = 
true;
 
  441             ATH_MSG_ERROR(
"Specified Njets treatment, but did not decorate EventInfo object");
 
  480             ATH_MSG_ERROR(
"Specified Njets treatment, but did not decorate EventInfo object");
 
  498     const double Rsample = gluonFrac * Rg + (1-gluonFrac) * Rq;
 
  509     const double flavorCompUnc  = gluonFracError*fabs(Rq-Rg)/Rsample;
 
  511     return flavorCompUnc;
 
  546         ATH_MSG_ERROR(
"This method is only useable for FlavourResponse uncertainties, not " << 
getName().Data());
 
  556         ATH_MSG_ERROR(
"This method is only useable for FlavourComposition uncertainties, not " << 
getName().Data());
 
  572         ATH_MSG_ERROR(
"This method is only useable for FlavourComposition uncertainties, not " << 
getName().Data());
 
  592     for (
size_t iKey = 0; iKey < histKeys.size(); ++iKey)
 
  594         const TString& 
histName = histKeys.at(iKey);
 
  597             return StatusCode::FAILURE;
 
  598         if (nJets < 0 || nJets >= 
static_cast<int>(
hists.size()))
 
  600             ATH_MSG_ERROR(Form(
"Unexpected gluon fraction nJet %d of index %zu: %s",nJets,iKey,
histName.Data()));
 
  601             return StatusCode::FAILURE;
 
  605             ATH_MSG_ERROR(Form(
"A histo for nJets of %d was already found, blocking double-creation of %s",nJets,
histName.Data()));
 
  606             return StatusCode::FAILURE;
 
  610     return StatusCode::SUCCESS;
 
  615     std::vector<TString> 
tokens = utils::vectorize<TString>(
key,
"_");
 
  616     if (
tokens.size() > 2 && 
tokens.at(
tokens.size()-1).Contains(
"nJet",TString::kIgnoreCase))
 
  618         TString nJetStr = 
tokens.at(
tokens.size()-1).ReplaceAll(
"nJet",
"");
 
  619         nJetStr = nJetStr.ReplaceAll(
"njet",
"");
 
  620         nJetStr = nJetStr.ReplaceAll(
"Njet",
"");
 
  621         if (!utils::getTypeObjFromString<int>(nJetStr,nJets))
 
  623             ATH_MSG_ERROR(
"Found nJets histogram, but failed to parse the index: " << 
key.Data());
 
  624             return StatusCode::FAILURE;
 
  627     return StatusCode::SUCCESS;
 
  647             ATH_MSG_ERROR(
"nJets of " << nJets << 
" is invalid, and default does not exist to fall back on, for " << 
getName().Data());
 
  648             return StatusCode::FAILURE;
 
  656     return StatusCode::SUCCESS;
 
  671     TList* 
keys = analysisFile->GetListOfKeys();
 
  677     while (TKey* 
key = 
dynamic_cast<TKey*
>(nextkey()))
 
  685             if (
keyName.Contains(
"gluonFractionError"))
 
  686                 gluonFractionErrorKeys.push_back(
keyName);
 
  687             else if (
keyName.Contains(
"gluonFraction"))
 
  688                 gluonFractionKeys.push_back(
keyName);