ATLAS Offline Software
Loading...
Searching...
No Matches
FlavourUncertaintyComponent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#include "TFile.h"
9#include "TList.h"
10#include "TKey.h"
11
12namespace jet
13{
14
16// //
17// Constructor/destructor/initialization //
18// //
20
44
46 const TString& jetType,
47 const TString& analysisRootFileName,
48 const TString& defaultAnalysisRootFileName,
49 const TString& path,
50 const TString& calibArea,
51 const bool absEtaGluonFraction,
52 const TString& analysisHistPattern,
53 const TString& NjetAccessorName
54 )
55 : UncertaintyComponent(component,component.flavourType == FlavourComp::Composition ? 2 : 1)
56 , m_flavourType(component.flavourType)
57 , m_jetType(jetType)
58 , m_analysisFileName(analysisRootFileName)
59 , m_analysisHistPattern(analysisHistPattern)
60 , m_defAnaFileName(defaultAnalysisRootFileName)
61 , m_path(path)
62 , m_calibArea(calibArea)
63 , m_absEta(CompParametrization::isAbsEta(component.parametrization))
64 , m_absEtaGluonFraction(absEtaGluonFraction)
65 , m_secondUncName(component.uncNames.size()>1 ? component.uncNames.at(1) : "")
66 , m_largeRJetTruthLabelName(component.LargeRJetTruthLabelName)
67 , m_largeRJetTruthLabels(component.LargeRJetTruthLabels)
68 , m_secondUncHist(nullptr)
71 , m_BjetAccessor("IsBjet")
72 , m_NjetAccessor(NjetAccessorName.Data())
76{
77 ATH_MSG_DEBUG("Created FlavourUncertaintyComponent named" << m_uncHistName.Data());
78
79 // Ensure that the flavour type and ref values are sensible
81 ATH_MSG_FATAL("Flavour type is UNKNOWN: " << m_uncHistName.Data());
82}
83
85 : UncertaintyComponent(toCopy)
87 , m_jetType(toCopy.m_jetType)
91 , m_path(toCopy.m_path)
92 , m_calibArea(toCopy.m_calibArea)
93 , m_absEta(toCopy.m_absEta)
98 , m_secondUncHist(nullptr)
99 , m_respType(toCopy.m_respType)
106{
107 ATH_MSG_DEBUG(Form("Creating copy of FlavourUncertaintyComponent named %s",m_uncHistName.Data()));
108
109 if (toCopy.m_secondUncHist)
111
112 for (size_t iHist = 0; iHist < toCopy.m_gluonFractionHists.size(); ++iHist)
113 if (toCopy.m_gluonFractionHists.at(iHist))
114 m_gluonFractionHists.push_back(new UncertaintyHistogram(*toCopy.m_gluonFractionHists.at(iHist)));
115
116 for (size_t iHist = 0; iHist < toCopy.m_gluonFractionErrorHists.size(); ++iHist)
117 if (toCopy.m_gluonFractionErrorHists.at(iHist))
119}
120
125
138
139
140
142{
143 // Call the base class first
144 if (UncertaintyComponent::initialize(histFile).isFailure())
145 return StatusCode::FAILURE;
146
147 // Ensure that the number of histograms matches what is expected for Flavour components
149 {
150 if (m_secondUncName != "")
151 {
152 ATH_MSG_ERROR("Expected one histogram for FlavourResponse: " << getName().Data());
153 return StatusCode::FAILURE;
154 }
155 }
157 {
158 ATH_MSG_ERROR("Expected two histograms for FlavourComposition: " << getName().Data());
159 return StatusCode::FAILURE;
160 }
162 {
163 ATH_MSG_ERROR("Expected one histogram for bJES uncertainty: " << getName().Data());
164 return StatusCode::FAILURE;
165 }
166
167 // Get the flavour response types if applicable
169 {
170 if ( m_uncHistName.Contains("glu",TString::kIgnoreCase) && (m_secondUncName.Contains("light",TString::kIgnoreCase) || m_secondUncName.Contains("quark",TString::kIgnoreCase)) )
171 {
174 }
175 else if ( (m_uncHistName.Contains("light",TString::kIgnoreCase) || m_uncHistName.Contains("quark",TString::kIgnoreCase)) && m_secondUncName.Contains("glu",TString::kIgnoreCase) )
176 {
179 }
180 else
181 {
182 // Unexpected inputs
183 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());
184 return StatusCode::FAILURE;
185 }
186
187 }
188
189 // Create the second histogram if applicable
191 {
193 if (!m_secondUncHist)
194 {
195 ATH_MSG_ERROR("Failed to create second uncertainty histogram for component: " << getName().Data());
196 return StatusCode::FAILURE;
197 }
198 if (m_secondUncHist->initialize(histFile).isFailure()) return StatusCode::FAILURE;
199 }
200
201 // Now read the analysis input histograms if this is not a bJES component
203 {
205 if (!analysisFile || analysisFile->IsZombie())
206 {
207 ATH_MSG_ERROR("Cannot open analysis histogram file: " << m_analysisFileName.Data());
208 return StatusCode::FAILURE;
209 }
210
211 // Retrieve the gluon fraction(s) and gluon fraction uncertainty(ies)
212 // May be a single histogram (default) or specified by nJet bins
213 // Store all of the key names for now, retrieval will happen later
214 std::vector<TString> gluonFractionKeys;
215 std::vector<TString> gluonFractionErrorKeys;
216 getGluonKeys(analysisFile,gluonFractionKeys,gluonFractionErrorKeys);
217
218
219 // Ensure we found histograms...
220 if (gluonFractionKeys.empty() || gluonFractionErrorKeys.empty())
221 {
222 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()));
223 return StatusCode::FAILURE;
224 }
225
226 // Determine the max nJet value
227 int nJetsMax = -1;
228 for (size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
229 {
230 int nJets = -1;
231 if (getNjetFromKey(gluonFractionKeys.at(iKey),nJets).isFailure())
232 return StatusCode::FAILURE;
233 if (nJets > nJetsMax && nJets < 1000)
234 nJetsMax = nJets;
235 }
236
237 // If there is only one histogram and it's not an nJets histogram, this is trivial
238 if (nJetsMax < 0 && gluonFractionKeys.size() == 1 && gluonFractionErrorKeys.size() == 1)
239 {
240 m_gluonFractionHists.push_back(new UncertaintyHistogram(gluonFractionKeys.at(0),m_interpolate));
241 m_gluonFractionErrorHists.push_back(new UncertaintyHistogram(gluonFractionErrorKeys.at(0),m_interpolate));
242 }
243 // If there is more than one histogram and they are not nJets histograms, this is a problem
244 else if (nJetsMax < 0 && gluonFractionKeys.size() > 1)
245 {
246 ATH_MSG_ERROR(Form("Found %zu gluon fraction histograms, but they do not appear to be binned by nJets:",gluonFractionKeys.size()));
247 for (size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
248 ATH_MSG_ERROR(Form("\tKey %zu: %s",iKey,gluonFractionKeys.at(iKey).Data()));
249 return StatusCode::FAILURE;
250 }
251 else
252 {
253 // Fill the actual vectors now, in proper order
254 for (int nJets = 0; nJets <= nJetsMax; ++nJets)
255 {
256 m_gluonFractionHists.push_back(nullptr);
257 m_gluonFractionErrorHists.push_back(nullptr);
258 }
259 if (readNjetsHistograms(m_gluonFractionHists,gluonFractionKeys).isFailure())
260 return StatusCode::FAILURE;
261 if (readNjetsHistograms(m_gluonFractionErrorHists,gluonFractionErrorKeys).isFailure())
262 return StatusCode::FAILURE;
263
264 // Ensure that every non-NULL gluon fraction has a non-NULL gluon fraction error
265 // (Note that not all indices must be filled, as maybe an analyis is only 4 and 5 jets)
266 for (size_t iJet = 0; iJet < m_gluonFractionHists.size(); ++iJet)
267 {
268 if (m_gluonFractionHists.at(iJet) && !m_gluonFractionErrorHists.at(iJet))
269 {
270 ATH_MSG_ERROR(Form("nJets = %zu was specified for the gluon fraction, but not the error",iJet));
271 return StatusCode::FAILURE;
272 }
273 else if (!m_gluonFractionHists.at(iJet) && m_gluonFractionErrorHists.at(iJet))
274 {
275 ATH_MSG_ERROR(Form("nJets = %zu was specified for the error, but not the gluon fraction",iJet));
276 return StatusCode::FAILURE;
277 }
278 }
279 }
280
281 // Initialize the non-NULL histograms
282 for (size_t iHist = 0; iHist < m_gluonFractionHists.size(); ++iHist)
283 {
284 if (m_gluonFractionHists.at(iHist) && m_gluonFractionHists.at(iHist)->initialize(analysisFile).isFailure())
285 return StatusCode::FAILURE;
286 if (m_gluonFractionErrorHists.at(iHist) && m_gluonFractionErrorHists.at(iHist)->initialize(analysisFile).isFailure())
287 return StatusCode::FAILURE;
288 }
289
290 // We're finally done reading that file...
291 analysisFile->Close();
292
293
294 // If nJets treatment is specified, and a default analysis file is specified, use this to fill the zero-bin
295 // The zero-bin is used whenever a multiplicity that is not explicitly specified is requested
296 if (m_defAnaFileName != "" && m_gluonFractionHists.size() > 1 && m_gluonFractionHists.at(0) == nullptr)
297 {
298 // Open the default file
300 if (!defAnaFile || defAnaFile->IsZombie())
301 {
302 ATH_MSG_ERROR("Cannot open default analysis histogram file: " << m_defAnaFileName.Data());
303 return StatusCode::FAILURE;
304 }
305
306 // Retrieve the gluon fraction(s) and gluon fraction uncertainty(ies)
307 // May be a single histogram (default) or specified by nJet bins
308 // Store all of the key names for now, retrieval will happen later
309 std::vector<TString> gluonFractionDefaultKeys;
310 std::vector<TString> gluonFractionErrorDefaultKeys;
311 getGluonKeys(defAnaFile,gluonFractionDefaultKeys,gluonFractionErrorDefaultKeys);
312
313 // Ensure that there is exactly one histogram (not another nJets file, not missing)
314 if (gluonFractionDefaultKeys.size() != 1 || gluonFractionErrorDefaultKeys.size() != 1)
315 {
316 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()));
317 return StatusCode::FAILURE;
318 }
319
320 // Fill the empty zero-bin histograms
321 m_gluonFractionHists.at(0) = new UncertaintyHistogram(gluonFractionDefaultKeys.at(0),m_interpolate);
322 m_gluonFractionErrorHists.at(0) = new UncertaintyHistogram(gluonFractionErrorDefaultKeys.at(0),m_interpolate);
323
324 // Now initialize them
325 if (m_gluonFractionHists.at(0)->initialize(defAnaFile).isFailure())
326 return StatusCode::FAILURE;
327 if (m_gluonFractionErrorHists.at(0)->initialize(defAnaFile).isFailure())
328 return StatusCode::FAILURE;
329
330 // We're done reading that file now too
331 defAnaFile->Close();
332 }
333
334 }
335
336 return StatusCode::SUCCESS;
337}
338
340// //
341// Validity and uncertainty retrieval //
342// //
344
346{
347 // Currently only one validity histogram exists
348 // Might need to expand in the future
349
350 return !m_validHist ? true : getValidBool(m_validHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()));
351
352// // Valid only if all histogram(s) are valid
353// // Histograms to consider varies by flavour type
354// // Start with the standard histograms
355// for (size_t iHisto = 0; iHisto < m_histos.size(); ++iHisto)
356// if (!m_histos.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()))
357// return false;
358//
359// // Now do analysis histograms
360// for (size_t iHisto = 0; iHisto < m_gluonFractionHists.size(); ++iHisto)
361// if (!m_gluonFractionHists.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()) ||
362// !m_gluonFractionErrorHists.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()) )
363// return false;
364//
365// return true;
366}
367
369{
370 // First, check if we even want to apply the uncertainty (large-R specific break-out)
371 // Check if we are supposed to only use given truth labels
372 if (!m_largeRJetTruthLabels.empty())
373 {
374 // If we are asking to check truth labels, then retrieve the truth jet label from the jet
375 if (!m_largeRJetTruthLabelAccessor.isAvailable(jet))
376 {
377 // Unable to retrieve truth label, but we were told to look for it, error
378 ATH_MSG_ERROR("Unable to retrieve LargeRJetTruthLabel: " + m_largeRJetTruthLabelName + " from the jet. Please use JetTruthLabeling before calling this function.");
379 return JESUNC_ERROR_CODE;
380 }
381 // Ok, the label exists, now check what it is
383 if (largeRJetTruthLabel == LargeRJetTruthLabel::UNKNOWN)
384 {
385 // This is an error - the label exists but it is unrecognized
386 ATH_MSG_ERROR("UNKNOWN LargeRJetTruthLabel on the jet. Please use JetTruthLabeling before calling this function or check the jet for irregularities.");
387 return JESUNC_ERROR_CODE;
388 }
389 // Not unknown, now check if it is one of the labels we want to apply this uncertainty for
390 bool relevantLabel = false;
392 {
393 if (aLabel == largeRJetTruthLabel)
394 relevantLabel = true;
395 }
396
397 // If we don't want to apply an uncertainty to jets with this label, then return 0 here (no uncertainty)
398 if (!relevantLabel)
399 return 0;
400 // Otherwise, continue as usual
401 }
402
403
404 // Now, we do want t o apply the uncertainty, so do it
405 double unc = JESUNC_ERROR_CODE;
411 unc = getBJESUncertainty(jet,eInfo);
412 else
413 {
414 ATH_MSG_ERROR("Unknown flavour type for " << getName().Data());
415 return unc;
416 }
417
418 return unc;
419}
420
422{
423 // Assumption:
424 // dR(q) = JES uncertainty (measured in gamma/Z+jet)
425 // dR(g) = JES uncertainty (+) additional gluon response component
426 // component to be added to JES uncertainty:
427 // fg*dR(gluon response modelling uncertainty)
428 // where gluon response modelling uncertainty is taken as difference between gluon response in Pythia and Herwig++
429
430 // Check if this is a b-jet
431 if (isBjet(jet))
432 return 0;
433
434 // Get the number of jets
435 int nJets = 0;
436 if (m_gluonFractionHists.size() > 1)
437 {
438 if (m_NjetAccessor.isAvailable(eInfo))
439 nJets = m_NjetAccessor(eInfo);
440 else
441 {
442 ATH_MSG_ERROR("Specified Njets treatment, but did not decorate EventInfo object");
443 return JESUNC_ERROR_CODE;
444 }
445 }
446
447 if (checkNjetsInput(nJets).isFailure())
448 return JESUNC_ERROR_CODE;
449
450 const double pT = jet.pt()*m_energyScale;
451 const double eta = m_absEta ? fabs(jet.eta()) : jet.eta();
452
453 // return the uncertainty
454 return getGluonResponseDifference(pT,eta) * getGluonFraction(pT,eta,nJets);
455}
456
458{
459 // Returns the flavor composition uncertainty using the formula:
460 //
461 // Uncertainty = df * | Rq - Rg | / ( fg * Rg + (1 - fg) * Rq )
462 // with
463 // Rs = fg * Rg + (1 - fg) * Rq as heavy q uncertainties accounted separately
464 // df = error on fg
465 // fg = fraction of gluons
466 // Rq = light quark response
467 // Rg = gluon response
468
469 // Check if this is a b-jet
470 if (isBjet(jet))
471 return 0;
472
473 // Get the number of jets
474 int nJets = 0;
475 if (m_gluonFractionHists.size() > 1)
476 {
477 if (m_NjetAccessor.isAvailable(eInfo))
478 nJets = m_NjetAccessor(eInfo);
479 else
480 {
481 ATH_MSG_ERROR("Specified Njets treatment, but did not decorate EventInfo object");
482 return JESUNC_ERROR_CODE;
483 }
484 }
485
486
487 if (checkNjetsInput(nJets).isFailure())
488 return JESUNC_ERROR_CODE;
489
490 const double pT = jet.pt()*m_energyScale;
491 const double eta = m_absEta ? fabs(jet.eta()) : jet.eta();
492
493 //calculating the sample response:
494 //fg*Rg + (1-fg)*Rq
495 const double gluonFrac = getGluonFraction(pT,eta,nJets);
496 const double Rg = getGluonResponseBaseline(pT,eta);
497 const double Rq = getQuarkResponseBaseline(pT,eta);
498
499 const double Rsample = gluonFrac * Rg + (1-gluonFrac) * Rq;
500
501 //this should never happen (it means the Rg == Rq == 0), but checking anyway
502 if (Rsample==0)
503 {
504 ATH_MSG_ERROR(Form("R(sample) = 0 for pT=%.1f, eta=%.2f",pT,eta));
505 return JESUNC_ERROR_CODE;
506 }
507
508 //calculating the uncertainty
509 const double gluonFracError = getGluonFractionError(pT,eta,nJets);
510 //coverity[divide_by_zero]
511 const double flavorCompUnc = gluonFracError*fabs(Rq-Rg)/Rsample;
512
513 return flavorCompUnc;
514
515}
516
518{
519 // Ensure this is a b-jet
520 if (!isBjet(jet))
521 return 0;
522 return m_uncHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta());
523}
524
525
527// //
528// Wrapper functions for special flavour hists //
529// //
531
532double FlavourUncertaintyComponent::getGluonFraction(const double pT, const double eta, const int nJets) const
533{
534 // nJets value checking is done in checkNjetsInput
535 return m_gluonFractionHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta);
536}
537
538double FlavourUncertaintyComponent::getGluonFractionError(const double pT, const double eta, const int nJets) const
539{
540 // nJets value checking is done in checkNjetsInput
541 return m_gluonFractionErrorHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta);
542}
543
544double FlavourUncertaintyComponent::getGluonResponseDifference(const double pT, const double eta) const
545{
547 {
548 ATH_MSG_ERROR("This method is only useable for FlavourResponse uncertainties, not " << getName().Data());
549 return JESUNC_ERROR_CODE;
550 }
551 return m_uncHist->getValue(pT,eta);
552}
553
554double FlavourUncertaintyComponent::getGluonResponseBaseline(const double pT, const double eta) const
555{
557 {
558 ATH_MSG_ERROR("This method is only useable for FlavourComposition uncertainties, not " << getName().Data());
559 return JESUNC_ERROR_CODE;
560 }
561
563 return m_uncHist->getValue(pT,eta);
565 return m_secondUncHist->getValue(pT,eta);
566 ATH_MSG_ERROR("Unexpected flavour response parametrization: " << getName().Data());
567 return JESUNC_ERROR_CODE;
568}
569
570double FlavourUncertaintyComponent::getQuarkResponseBaseline(const double pT, const double eta) const
571{
573 {
574 ATH_MSG_ERROR("This method is only useable for FlavourComposition uncertainties, not " << getName().Data());
575 return JESUNC_ERROR_CODE;
576 }
578 return m_uncHist->getValue(pT,eta);
580 return m_secondUncHist->getValue(pT,eta);
581 ATH_MSG_ERROR("Unexpected flavour response parametrization: " << getName().Data());
582 return JESUNC_ERROR_CODE;
583}
584
585
587// //
588// Private helper functions //
589// //
591
592StatusCode FlavourUncertaintyComponent::readNjetsHistograms(std::vector<UncertaintyHistogram*>& hists, const std::vector<TString>& histKeys)
593{
594 for (size_t iKey = 0; iKey < histKeys.size(); ++iKey)
595 {
596 const TString& histName = histKeys.at(iKey);
597 int nJets = -1;
598 if (getNjetFromKey(histName,nJets).isFailure())
599 return StatusCode::FAILURE;
600 if (nJets < 0 || nJets >= static_cast<int>(hists.size()))
601 {
602 ATH_MSG_ERROR(Form("Unexpected gluon fraction nJet %d of index %zu: %s",nJets,iKey,histName.Data()));
603 return StatusCode::FAILURE;
604 }
605 if (hists[nJets])
606 {
607 ATH_MSG_ERROR(Form("A histo for nJets of %d was already found, blocking double-creation of %s",nJets,histName.Data()));
608 return StatusCode::FAILURE;
609 }
610 hists[nJets] = new UncertaintyHistogram(histName,m_interpolate);
611 }
612 return StatusCode::SUCCESS;
613}
614
615StatusCode FlavourUncertaintyComponent::getNjetFromKey(const TString& key, int& nJets) const
616{
617 std::vector<TString> tokens = utils::vectorize<TString>(key,"_");
618 if (tokens.size() > 2 && tokens.at(tokens.size()-1).Contains("nJet",TString::kIgnoreCase))
619 {
620 TString nJetStr = tokens.at(tokens.size()-1).ReplaceAll("nJet","");
621 nJetStr = nJetStr.ReplaceAll("njet","");
622 nJetStr = nJetStr.ReplaceAll("Njet","");
623 if (!utils::getTypeObjFromString<int>(nJetStr,nJets))
624 {
625 ATH_MSG_ERROR("Found nJets histogram, but failed to parse the index: " << key.Data());
626 return StatusCode::FAILURE;
627 }
628 }
629 return StatusCode::SUCCESS;
630}
631
633{
634 // nJets = 0 is the inclusive composition
635 // nJets = # is the composition for # jets
636 // nJets < 0 uses default if available
637 // nJets > MAX uses default if available
638 // nJets = #, but # is NULL uses default if available
639
640 // Case of no histograms is checked in initialization, no need to repeat here
641 // Initialization also ensures gluonFractionHists and gluonFractionErrorHists are consistent
642
643 // Check if we need to use the default histogram
644 if (nJets < 0 || nJets >= static_cast<int>(m_gluonFractionHists.size()) || m_gluonFractionHists.at(nJets) == nullptr)
645 {
646 // Check if we can fall back on the default bin (does it exist?)
647 if (m_gluonFractionHists.at(0) == nullptr)
648 {
649 ATH_MSG_ERROR("nJets of " << nJets << " is invalid, and default does not exist to fall back on, for " << getName().Data());
650 return StatusCode::FAILURE;
651 }
652 // Fall back on the default bin
653 nJets = 0;
654 }
655 // Otherwise, the specified nJets value is fine and doesn't need to be touched
656
657
658 return StatusCode::SUCCESS;
659}
660
662{
663 // If not specified, assume it's not a b-jet
664 if (!m_BjetAccessor.isAvailable(jet)) return false;
665
666 // If it's available, return the value (now a char, so check non-equality with 0)
667 return m_BjetAccessor(jet) != 0;
668}
669
670
671void FlavourUncertaintyComponent::getGluonKeys(TFile* analysisFile, std::vector<TString>& gluonFractionKeys, std::vector<TString>& gluonFractionErrorKeys) const
672{
673 TList* keys = analysisFile->GetListOfKeys();
674 TIter nextkey(keys);
675 if (m_analysisHistPattern != "")
676 {
677 ATH_MSG_DEBUG("Ignoring histograms which don't contain pattern " << m_analysisHistPattern.Data());
678 }
679 while (TKey* key = dynamic_cast<TKey*>(nextkey()))
680 {
681 const TString keyName = key->GetName();
682 //Ignoring histograms which doesn't contain user-defined pattern
683 if (m_analysisHistPattern != "" && !keyName.Contains(m_analysisHistPattern)) continue;
684 if (keyName.Contains(m_jetType) && !keyName.Contains("valid"))
685 {
686 if (keyName.Contains("gluonFractionError"))
687 gluonFractionErrorKeys.push_back(keyName);
688 else if (keyName.Contains("gluonFraction"))
689 gluonFractionKeys.push_back(keyName);
690 }
691 }
692}
693
694
695
696} // end jet namespace
697
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
@ Data
Definition BaseObject.h:11
SG::AuxElement::Accessor< int > m_largeRJetTruthLabelAccessor
SG::AuxElement::Accessor< char > m_BjetAccessor
SG::AuxElement::Accessor< int > m_NjetAccessor
std::vector< UncertaintyHistogram * > m_gluonFractionErrorHists
double getGluonFractionError(const double pT, const double eta, const int nJets) const
StatusCode getNjetFromKey(const TString &key, int &nJets) const
double getBJESUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual FlavourUncertaintyComponent * clone() const
virtual StatusCode initialize(TFile *histFile)
double getGluonFraction(const double pT, const double eta, const int nJets) const
double getGluonResponseBaseline(const double pT, const double eta) const
std::vector< UncertaintyHistogram * > m_gluonFractionHists
std::vector< LargeRJetTruthLabel::TypeEnum > m_largeRJetTruthLabels
void getGluonKeys(TFile *analysisFile, std::vector< TString > &gluonFractionKeys, std::vector< TString > &gluonFractionErrorKeys) const
double getQuarkResponseBaseline(const double pT, const double eta) const
FlavourUncertaintyComponent(const ComponentHelper &component, const TString &jetType, const TString &analysisRootFileName, const TString &defaultAnalysisRootFileName, const TString &path, const TString &calibArea, const bool absEtaGluonFraction, const TString &analysisHistPattern="", const TString &NjetAccessorName="Njet")
StatusCode readNjetsHistograms(std::vector< UncertaintyHistogram * > &hists, const std::vector< TString > &histKeys)
double getFlavourResponseUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getGluonResponseDifference(const double pT, const double eta) const
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
bool isBjet(const xAOD::Jet &jet) const
double getFlavourCompositionUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
const Interpolate::TypeEnum m_interpolate
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
virtual TString getName() const
virtual bool getValidBool(const double validity) const
UncertaintyHistogram * m_validHist
virtual StatusCode initialize(TFile *histFile)
UncertaintyHistogram * m_uncHist
TypeEnum intToEnum(const int type)
bool getTypeObjFromString(const std::string &str, T &obj)
TFile * readRootFile(const TString &fileName, const TString &path="", const TString &calibArea="")
bool vectorize(const TString &str, const TString &sep, std::vector< T > &result)
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.