ATLAS Offline Software
Loading...
Searching...
No Matches
JetUncertaintiesTool.cxx File Reference
#include "JetUncertainties/JetUncertaintiesTool.h"
#include "JetUncertainties/Helpers.h"
#include "JetUncertainties/UncertaintyEnum.h"
#include "JetUncertainties/ConfigHelper.h"
#include "JetUncertainties/ResolutionHelper.h"
#include "JetUncertainties/CorrelationMatrix.h"
#include "JetUncertainties/UncertaintyHistogram.h"
#include "JetUncertainties/ValidityHistogram.h"
#include "JetUncertainties/UncertaintyComponent.h"
#include "JetUncertainties/UncertaintyGroup.h"
#include "JetUncertainties/UncertaintySet.h"
#include "JetUncertainties/PtUncertaintyComponent.h"
#include "JetUncertainties/PtEtaUncertaintyComponent.h"
#include "JetUncertainties/PtLogPtMassForTagSFUncertaintyComponent.h"
#include "JetUncertainties/PtAbsMassUncertaintyComponent.h"
#include "JetUncertainties/PtMassUncertaintyComponent.h"
#include "JetUncertainties/PtAbsMassEtaUncertaintyComponent.h"
#include "JetUncertainties/PtMassEtaUncertaintyComponent.h"
#include "JetUncertainties/ELogMassUncertaintyComponent.h"
#include "JetUncertainties/ELogMassEtaUncertaintyComponent.h"
#include "JetUncertainties/PileupUncertaintyComponent.h"
#include "JetUncertainties/FlavourUncertaintyComponent.h"
#include "JetUncertainties/PerJetFlavourUncertaintyComponent.h"
#include "JetUncertainties/PunchthroughUncertaintyComponent.h"
#include "JetUncertainties/ClosebyUncertaintyComponent.h"
#include "JetUncertainties/CombinedMassUncertaintyComponent.h"
#include "JetUncertainties/LargeRTopologyUncertaintyComponent.h"
#include "xAODTracking/VertexContainer.h"
#include "PATInterfaces/SystematicVariation.h"
#include "PATInterfaces/SystematicRegistry.h"
#include "TString.h"
#include "TFile.h"
#include "TDirectory.h"
#include "TROOT.h"
#include "TEnv.h"
#include "TH2D.h"
#include <unordered_set>

Go to the source code of this file.

Functions

bool checkScalesSingleVar (const std::set< CompScaleVar::TypeEnum > &varSet, const CompScaleVar::TypeEnum var)
bool JetUncertaintiesTool::getValidity ATLAS_NOT_THREAD_SAFE (size_t index, const xAOD::Jet &jet, const CompScaleVar::TypeEnum scaleVar) const
bool JetUncertaintiesTool::getValidUncertainty ATLAS_NOT_THREAD_SAFE (size_t index, double &unc, const xAOD::Jet &jet, const CompScaleVar::TypeEnum scaleVar) const
TH2D *JetUncertaintiesTool::getPtCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minPt, const double maxPt, const double valEta)
TH2D *JetUncertaintiesTool::getPtCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minPt, const double maxPt, const double valEta1, const double valEta2)
CP::CorrectionCode JetUncertaintiesTool::applyCorrection ATLAS_NOT_THREAD_SAFE (xAOD::Jet &jet) const
CP::CorrectionCode JetUncertaintiesTool::correctedCopy ATLAS_NOT_THREAD_SAFE (const xAOD::Jet &input, xAOD::Jet *&output) const
CP::CorrectionCode JetUncertaintiesTool::applyContainerCorrection ATLAS_NOT_THREAD_SAFE (xAOD::JetContainer &inputs) const
const xAOD::EventInfo *JetUncertaintiesTool::getDefaultEventInfo ATLAS_NOT_THREAD_SAFE () const

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/8]

const xAOD::EventInfo *JetUncertaintiesTool::getDefaultEventInfo ATLAS_NOT_THREAD_SAFE ( void ) const

Definition at line 2333 of file JetUncertaintiesTool.cxx.

2334{
2335 // NPV decorator(s)
2336 static const SG::AuxElement::ConstAccessor<float> accNPV("NPV");
2337 static const SG::AuxElement::Decorator<float> decNPV("NPV");
2338
2339 // Retrieve the EventInfo object
2340 static const std::string eiName = "EventInfo";
2341 const xAOD::EventInfo* ei = nullptr;
2342 if (evtStore()->retrieve(ei, eiName).isFailure())
2343 {
2344 ATH_MSG_ERROR("Failed to retrieve default EventInfo object");
2345 return nullptr;
2346 }
2347
2348 // Check if NPV already exists on const EventInfo object, return if so
2349 if (accNPV.isAvailable(*ei)) {
2350 return ei;
2351 }
2352
2353 // NPV doesn't already exist, so calculate it
2354 const xAOD::VertexContainer* vertices = nullptr;
2355 if (evtStore()->retrieve(vertices,"PrimaryVertices").isFailure())
2356 {
2357 ATH_MSG_ERROR("Failed to retrieve default NPV value from PrimaryVertices");
2358 return nullptr;
2359 }
2360
2361 unsigned NPV = 0;
2363 for (itr = vertices->begin(); itr != vertices->end(); ++itr)
2364 if ( (*itr)->nTrackParticles() > 1)
2365 NPV++;
2366
2367 // Add NPV to the EventInfo object as a decoration.
2368 decNPV(*ei) = NPV;
2369
2370 // Return the decorated object.
2371 return ei;
2372}
#define ATH_MSG_ERROR(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".

◆ ATLAS_NOT_THREAD_SAFE() [2/8]

TH2D *JetUncertaintiesTool::getEtaCorrelationMatrix ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minPt,
const double maxPt,
const double valEta )

Definition at line 2043 of file JetUncertaintiesTool.cxx.

2044{
2045 return getPtCorrelationMatrix(numBins,minPt,maxPt,valEta,valEta);
2046}

◆ ATLAS_NOT_THREAD_SAFE() [3/8]

TH2D *JetUncertaintiesTool::getEtaCorrelationMatrix ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minPt,
const double maxPt,
const double valEta1,
const double valEta2 )

Definition at line 2048 of file JetUncertaintiesTool.cxx.

2049{
2050 if (!m_isInit)
2051 {
2052 ATH_MSG_FATAL("Tool must be initialized before calling getCorrelationMatrix");
2053 return nullptr;
2054 }
2055
2056 std::cout << "Creating with max values " << valEta1 << " " << valEta2 << std::endl;
2057 CorrelationMatrix corrMat(Form("%s_varpt_eta%.2f_eta%.2f",m_name.c_str(),valEta1,valEta2),numBins,minPt*m_energyScale,maxPt*m_energyScale,valEta1,valEta2);
2058 if (corrMat.initializeForPt(*this).isFailure())
2059 return nullptr;
2060 return new TH2D(*corrMat.getMatrix());
2061}
#define ATH_MSG_FATAL(x)
std::string m_name
The primary name part of this expression.

◆ ATLAS_NOT_THREAD_SAFE() [4/8]

CP::CorrectionCode JetUncertaintiesTool::correctedCopy ATLAS_NOT_THREAD_SAFE ( const xAOD::Jet & input,
xAOD::Jet *& output ) const

Definition at line 2275 of file JetUncertaintiesTool.cxx.

2276{
2277 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2278 if (!eInfo) return CP::CorrectionCode::Error;
2279 return correctedCopy(input,output,*eInfo);
2280}
@ Error
Some error happened during the object correction.

◆ ATLAS_NOT_THREAD_SAFE() [5/8]

double JetUncertaintiesTool::getUncertainty ATLAS_NOT_THREAD_SAFE ( size_t index,
const xAOD::Jet & jet,
const CompScaleVar::TypeEnum scaleVar ) const

Definition at line 1671 of file JetUncertaintiesTool.cxx.

1672{
1673 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
1674 if (!eInfo) return false;
1675 return getValidity(index,jet,*eInfo,scaleVar);
1676}
Definition index.py:1

◆ ATLAS_NOT_THREAD_SAFE() [6/8]

bool JetUncertaintiesTool::getValidUncertainty ATLAS_NOT_THREAD_SAFE ( size_t index,
double & unc,
const xAOD::Jet & jet,
const CompScaleVar::TypeEnum scaleVar ) const

Definition at line 1775 of file JetUncertaintiesTool.cxx.

1776{
1777 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
1778 if (!eInfo) return false;
1779 return getValidUncertainty(index,unc,jet,*eInfo,scaleVar);
1780}

◆ ATLAS_NOT_THREAD_SAFE() [7/8]

Definition at line 2089 of file JetUncertaintiesTool.cxx.

2090{
2091 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2092 if (!eInfo) return CP::CorrectionCode::Error;
2093 return applyCorrection(jet,*eInfo);
2094}

◆ ATLAS_NOT_THREAD_SAFE() [8/8]

Definition at line 2296 of file JetUncertaintiesTool.cxx.

2297{
2298 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2299 if (!eInfo) return CP::CorrectionCode::Error;
2300 return applyContainerCorrection(inputs,*eInfo);
2301}

◆ checkScalesSingleVar()

bool checkScalesSingleVar ( const std::set< CompScaleVar::TypeEnum > & varSet,
const CompScaleVar::TypeEnum var )

Definition at line 1576 of file JetUncertaintiesTool.cxx.

1577{
1578 return varSet.size() == 1 && *(varSet.begin()) == var;
1579}