11 std::cout <<
"Examples are only defined in the analysis release." << std::endl;
60using namespace asg::msgUserCode;
62int main(
int argc,
char* argv[]) {std::cout << __PRETTY_FUNCTION__ << std::endl;
68 StatusCode::enableFailure();
73 TString
fileName = gSystem->Getenv(
"ASG_TEST_FILE_MC");
74 std::string
jetType =
"AntiKt4EMTopo";
76 bool calibjets =
true;
78 for (
int i=0;
i<
argc; ++
i) {
79 if (std::string(argv[i]) ==
"-filen" && i+1<argc) {
81 }
else if (std::string(argv[i]) ==
"-jetcoll" && i+1<argc) {
83 }
else if (std::string(argv[i]) ==
"-nocalib") {
85 }
else if (std::string(argv[i]) ==
"-evtmax" && i+1<argc) {
86 evtmax =
atoi(argv[i+1]);
87 }
else if (std::string(argv[i]) ==
"-debug") {
93 std::unique_ptr< TFile >
ifile( TFile::Open( fileName,
"READ" ) );
94 assert(
ifile.get() );
111 jetCalibrationTool.setName(
"jetCalibTool");
113 ANA_CHECK( jetCalibrationTool.
setProperty(
"ConfigFile",
"JES_MC15cRecommendation_May2016_rel21.config") );
119 metSystTool.
setTypeAndName(
"met::METSystematicsTool/metSystTool");
130 for(
size_t ievent = 0; ievent < std::min(
size_t(
event->getEntries()), evtmax); ++ievent){
131 if(ievent % 10 == 0) std::cout <<
"event number: " << ievent << std::endl;
138 std::string coreMetKey =
"MET_Core_" +
jetType;
140 if(
debug) std::cout <<
"Using core MET " << coreMet << std::endl;
162 if(jetCalibrationTool->applyCalibration(*calibJets).isFailure())
166 if(
debug) std::cout <<
"Failed to set the original object links" << std::endl;
173 std::string metAssocKey =
"METAssoc_" +
jetType;
183 isys != recSysList.
end();
187 if(
debug) std::cout <<
"Doing systematic : " << (*isys).name() << std::endl;
192 newMetContainer->setStore(newMetAuxContainer);
200 for(
const auto& el : *electrons) {
201 if(
el->pt()>20e3 &&
el->eta()<2.47) metElectrons.push_back(el);
203 ANA_CHECK( metMaker->rebuildMET(
"RefEle",
206 metElectrons.asDataVector(),
212 for(
const auto& ph : *photons) {
213 if(ph->pt()>20e3 && ph->eta()<2.47) metPhotons.push_back(ph);
215 ANA_CHECK( metMaker->rebuildMET(
"RefPhoton",
218 metPhotons.asDataVector(),
224 for(
const auto& tau : *
taus) {
225 if(tau->pt()>20e3 && tau->eta()<2.5) metTaus.push_back(tau);
227 ANA_CHECK( metMaker->rebuildMET(
"RefTau",
230 metTaus.asDataVector(),
236 for(
const auto& mu : *muons) {
237 if(
mu->pt()>20e3 &&
mu->eta()<2.4) metMuons.push_back(mu);
242 metMuons.asDataVector(),
249 ANA_CHECK( metMaker->rebuildJetMET(
"RefJet",
265 ANA_CHECK( metSystTool->applySystematicVariation(iSysSet) );
269 if(
debug) std::cout <<
"Soft cluster met term met " << softClusMet->
met() << std::endl;
271 ANA_CHECK( metSystTool->applyCorrection(*softClusMet, metHelper) );
274 if(
debug) std::cout <<
"Soft track met term met " << softTrkMet->
met() << std::endl;
276 ANA_CHECK( metSystTool->applyCorrection(*softTrkMet, metHelper) );
289 const std::vector<float>& jetweights = jetMet->
auxdataConst<std::vector<float> >(
"ConstitObjectWeights");
290 const std::vector<ElementLink<xAOD::IParticleContainer> >& constitjets = jetMet->
auxdataConst<std::vector<ElementLink<xAOD::IParticleContainer> > >(
"ConstitObjectLinks");
291 for(
size_t iconstit=0; iconstit < jetweights.size(); ++iconstit) {
293 const float jetweight = jetweights[iconstit];
294 std::cout <<
"RefJet jet " << constjet->
index() <<
", weight " << jetweight <<
", pt: " << constjet->
pt() << std::endl;
299#ifdef XAOD_STANDALONE
302 assert(
event->fill());
307#ifndef XAOD_STANDALONE
static void enableFailure() noexcept
This module implements the central registry for handling systematic uncertainties with CP tools.
const SystematicSet & recommendedSystematics() const
returns: the recommended set of systematics
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Class to wrap a set of SystematicVariations.
const_iterator end() const
description: const iterator to the end of the set
std::set< SystematicVariation >::const_iterator const_iterator
const_iterator begin() const
description: const iterator to the beginning of the set
DataVector adapter that acts like it holds const pointers.
void record(const T *p, const std::string &key)
XAOD_AUXDATA_DEPRECATED Accessor< T, ALLOC >::const_reference_type auxdataConst(const std::string &name) const
Fetch an aux data variable, as a const reference.
size_t index() const
Return the index of this element within its container.
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
virtual double pt() const
The transverse momentum ( ) of the particle.
float met() const
Returns .
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
A relatively simple transient store for objects created in analysis.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
StatusCode buildMETSum(const std::string &totalName, xAOD::MissingETContainer *metCont)
void addGhostMuonsToJets(const xAOD::MuonContainer &muons, xAOD::JetContainer &jets)
@ Photon
The object is a photon.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
@ Tau
The object is a tau (jet)
Jet_v1 Jet
Definition of the current "jet version".
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
MissingET_v1 MissingET
Version control by type defintion.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
MissingETContainer_v1 MissingETContainer
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
MissingETAuxContainer_v1 MissingETAuxContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
@ Track
Indicator for MET contribution from reconstructed charged particle tracks.