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 2328 of file JetUncertaintiesTool.cxx.

2329{
2330 // NPV decorator(s)
2331 static const SG::AuxElement::ConstAccessor<float> accNPV("NPV");
2332 static const SG::AuxElement::Decorator<float> decNPV("NPV");
2333
2334 // Retrieve the EventInfo object
2335 static const std::string eiName = "EventInfo";
2336 const xAOD::EventInfo* ei = nullptr;
2337 if (evtStore()->retrieve(ei, eiName).isFailure())
2338 {
2339 ATH_MSG_ERROR("Failed to retrieve default EventInfo object");
2340 return nullptr;
2341 }
2342
2343 // Check if NPV already exists on const EventInfo object, return if so
2344 if (accNPV.isAvailable(*ei)) {
2345 return ei;
2346 }
2347
2348 // NPV doesn't already exist, so calculate it
2349 const xAOD::VertexContainer* vertices = nullptr;
2350 if (evtStore()->retrieve(vertices,"PrimaryVertices").isFailure())
2351 {
2352 ATH_MSG_ERROR("Failed to retrieve default NPV value from PrimaryVertices");
2353 return nullptr;
2354 }
2355
2356 unsigned NPV = 0;
2358 for (itr = vertices->begin(); itr != vertices->end(); ++itr)
2359 if ( (*itr)->nTrackParticles() > 1)
2360 NPV++;
2361
2362 // Add NPV to the EventInfo object as a decoration.
2363 decNPV(*ei) = NPV;
2364
2365 // Return the decorated object.
2366 return ei;
2367}
#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 2038 of file JetUncertaintiesTool.cxx.

2039{
2040 return getPtCorrelationMatrix(numBins,minPt,maxPt,valEta,valEta);
2041}

◆ 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 2043 of file JetUncertaintiesTool.cxx.

2044{
2045 if (!m_isInit)
2046 {
2047 ATH_MSG_FATAL("Tool must be initialized before calling getCorrelationMatrix");
2048 return nullptr;
2049 }
2050
2051 std::cout << "Creating with max values " << valEta1 << " " << valEta2 << std::endl;
2052 CorrelationMatrix corrMat(Form("%s_varpt_eta%.2f_eta%.2f",m_name.c_str(),valEta1,valEta2),numBins,minPt*m_energyScale,maxPt*m_energyScale,valEta1,valEta2);
2053 if (corrMat.initializeForPt(*this).isFailure())
2054 return nullptr;
2055 return new TH2D(*corrMat.getMatrix());
2056}
#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 2270 of file JetUncertaintiesTool.cxx.

2271{
2272 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2273 if (!eInfo) return CP::CorrectionCode::Error;
2274 return correctedCopy(input,output,*eInfo);
2275}
@ 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 1666 of file JetUncertaintiesTool.cxx.

1667{
1668 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
1669 if (!eInfo) return false;
1670 return getValidity(index,jet,*eInfo,scaleVar);
1671}
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 1770 of file JetUncertaintiesTool.cxx.

1771{
1772 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
1773 if (!eInfo) return false;
1774 return getValidUncertainty(index,unc,jet,*eInfo,scaleVar);
1775}

◆ ATLAS_NOT_THREAD_SAFE() [7/8]

Definition at line 2084 of file JetUncertaintiesTool.cxx.

2085{
2086 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2087 if (!eInfo) return CP::CorrectionCode::Error;
2088 return applyCorrection(jet,*eInfo);
2089}

◆ ATLAS_NOT_THREAD_SAFE() [8/8]

Definition at line 2291 of file JetUncertaintiesTool.cxx.

2292{
2293 const xAOD::EventInfo* eInfo = getDefaultEventInfo();
2294 if (!eInfo) return CP::CorrectionCode::Error;
2295 return applyContainerCorrection(inputs,*eInfo);
2296}

◆ checkScalesSingleVar()

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

Definition at line 1571 of file JetUncertaintiesTool.cxx.

1572{
1573 return varSet.size() == 1 && *(varSet.begin()) == var;
1574}