Skip to content
Snippets Groups Projects
Commit c8885215 authored by Tadej Novak's avatar Tadej Novak
Browse files

Merge branch 'auxdepr.MuonMomentumCorrections-20240516' into 'main'

MuonMomentumCorrections+InDetTrackSystematicsTools: Use Accessor, etc instead of auxdata().

See merge request atlas/athena!71418
parents c2b9658e 5f7cbb33
No related branches found
No related tags found
29 merge requests!78241Draft: FPGATrackSim: GenScan code refactor,!78236Draft: Switching Streams https://its.cern.ch/jira/browse/ATR-27417,!78056AFP monitoring: new synchronization and cleaning,!78041AFP monitoring: new synchronization and cleaning,!77990Updating TRT chip masks for L1TRT trigger simulation - ATR-28372,!77733Draft: add new HLT NN JVT, augmented with additional tracking information,!77731Draft: Updates to ZDC reconstruction,!77728Draft: updates to ZDC reconstruction,!77522Draft: sTGC Pad Trigger Emulator,!76725ZdcNtuple: Fix cppcheck warning.,!76611L1CaloFEXByteStream: Fix out-of-bounds array accesses.,!76475Punchthrough AF3 implementation in FastG4,!76474Punchthrough AF3 implementation in FastG4,!76343Draft: MooTrackBuilder: Recalibrate NSW hits in refine method,!75729New implementation of ZDC nonlinear FADC correction.,!75703Draft: Update to HI han config for HLT jets,!75184Draft: Update file heavyions_run.config,!74430Draft: Fixing upper bound for Delayed Jet Triggers,!73963Changing the path of the histograms to "Expert" area,!73875updating ID ART reference plots,!73874AtlasCLHEP_RandomGenerators: Fix cppcheck warnings.,!73449Add muon detectors to DarkJetPEBTLA partial event building,!73343Draft: [TrigEgamma] Add photon ringer chains on bootstrap mechanism,!72336Fixed TRT calibration crash,!72176Draft: Improving L1TopoOnline chain that now gets no-empty plots. Activating it by default,!72012Draft: Separate JiveXMLConfig.py into Config files,!71876Fix MET trigger name in MissingETMonitoring,!71820Draft: Adding new TLA End-Of-Fill (EOF) chains and removing obsolete DIPZ chains,!71418MuonMomentumCorrections+InDetTrackSystematicsTools: Use Accessor, etc instead of auxdata().
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "TestMCASTTool.h"
......@@ -8,6 +8,7 @@
#include "xAODMuon/MuonAuxContainer.h"
#include "xAODMuon/MuonContainer.h"
#include "AthContainers/ConstAccessor.h"
namespace CP {
......@@ -117,11 +118,15 @@ namespace CP {
std::string syst_name = (*sysItr).name();
m_SelCategoryRaw = mu->auxdata<int>("raw_MCaST_Category");
m_SelCategory = mu->auxdata<int>("MCaST_Category");
static const SG::ConstAccessor<int> raw_MCaST_CategoryAcc ("raw_MCaST_Category");
static const SG::ConstAccessor<int> MCaST_CategoryAcc ("MCaST_Category");
static const SG::ConstAccessor<float> InnerDetectorPtAcc ("InnerDetectorPt");
static const SG::ConstAccessor<float> MuonSpectrometerPtAcc ("MuonSpectrometerPt");
m_SelCategoryRaw = raw_MCaST_CategoryAcc (*mu);
m_SelCategory = MCaST_CategoryAcc (*mu);
m_Combined->SetCalibPt(mu->pt(), syst_name);
m_InnerDet->SetCalibPt(mu->auxdata<float>("InnerDetectorPt"), syst_name);
m_MSExtr->SetCalibPt(mu->auxdata<float>("MuonSpectrometerPt"), syst_name);
m_InnerDet->SetCalibPt(InnerDetectorPtAcc (*mu), syst_name);
m_MSExtr->SetCalibPt(MuonSpectrometerPtAcc (*mu), syst_name);
delete mu;
}
......
/*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
// System include(s):
......@@ -35,6 +35,7 @@
#include "xAODCore/tools/ReadStats.h"
#include "xAODEventInfo/EventInfo.h"
#include "xAODMuon/MuonContainer.h"
#include "AthContainers/ConstAccessor.h"
ANA_MSG_HEADER(msgMMC)
ANA_MSG_SOURCE(msgMMC, "MCASTTest")
......@@ -346,6 +347,8 @@ int main(int argc, char* argv[]) {
muon->muonType());
// either use the correctedCopy call or correct the muon object itself
static const SG::ConstAccessor<float> InnerDetectorPtAcc ("InnerDetectorPt");
static const SG::ConstAccessor<float> MuonSpectrometerPtAcc ("MuonSpectrometerPt");
if (useCorrectedCopy) {
// ::: Create a calibrated muon:
xAOD::Muon* mu = 0;
......@@ -354,8 +357,8 @@ int main(int argc, char* argv[]) {
continue;
}
CorrPtCB = mu->pt();
CorrPtID = mu->auxdata<float>("InnerDetectorPt");
CorrPtMS = mu->auxdata<float>("MuonSpectrometerPt");
CorrPtID = InnerDetectorPtAcc (*mu);
CorrPtMS = MuonSpectrometerPtAcc (*mu);
sysTreeMap[*sysListItr]->Fill();
......@@ -368,8 +371,8 @@ int main(int argc, char* argv[]) {
continue;
}
CorrPtCB = muon->pt();
CorrPtID = muon->auxdata<float>("InnerDetectorPt");
CorrPtMS = muon->auxdata<float>("MuonSpectrometerPt");
CorrPtID = InnerDetectorPtAcc (*muon);
CorrPtMS = MuonSpectrometerPtAcc (*muon);
ExpResoCB = corrTool->expectedResolution("CB", *muon, true);
ExpResoID = corrTool->expectedResolution("ID", *muon, true);
ExpResoMS = corrTool->expectedResolution("MS", *muon, true);
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetTrackSystematicsTools/InDetTrackTruthFilterTool.h"
......@@ -11,6 +11,7 @@
#include "xAODTruth/TruthParticleContainer.h"
#include "xAODTruth/TruthVertex.h"
#include "xAODTruth/TruthVertexContainer.h"
#include "AthContainers/ConstAccessor.h"
#include "PathResolver/PathResolver.h"
......@@ -282,12 +283,18 @@ namespace InDet {
}
if(m_doLRTSystematics) {
const ElementLink< xAOD::TruthParticleContainer > &truthParticleLink = track->auxdata< ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink");
static const SG::ConstAccessor<ElementLink< xAOD::TruthParticleContainer > >
truthParticleLinkAcc ("truthParticleLink");
const ElementLink< xAOD::TruthParticleContainer > &truthParticleLink =
truthParticleLinkAcc (*track);
if(truthParticleLink.isValid()) {
const xAOD::TruthParticle *truthParticle = *truthParticleLink;
double eta = truthParticle->eta();
const ElementLink< xAOD::TruthVertexContainer > &truthVertexLink = truthParticle->auxdata< ElementLink< xAOD::TruthVertexContainer > >("prodVtxLink");
static const SG::ConstAccessor<ElementLink< xAOD::TruthVertexContainer > >
prodVtxLinkAcc ("prodVtxLink");
const ElementLink< xAOD::TruthVertexContainer > &truthVertexLink =
prodVtxLinkAcc (*truthParticle);
if(truthVertexLink.isValid()) {
const xAOD::TruthVertex *truthVertex = *truthVertexLink;
double prodR = truthVertex->perp();
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetTrackSystematicsTools/InDetTrackTruthOriginTool.h"
......@@ -8,6 +8,7 @@
#include "xAODTruth/TruthParticleContainer.h"
#include "xAODTruth/TruthEventContainer.h"
#include "TruthUtils/MagicNumbers.h"
#include "AthContainers/ConstAccessor.h"
#include <math.h>
......@@ -42,12 +43,14 @@ namespace InDet {
// in practice, all tracks seem to have a truth link, but we need to also
// check whether it's valid
typedef ElementLink<xAOD::TruthParticleContainer> TruthLink;
if ( !track->isAvailable<TruthLink>("truthParticleLink") ) {
static const SG::ConstAccessor<TruthLink>
truthParticleLinkAcc ("truthParticleLink");
if ( !truthParticleLinkAcc.isAvailable(*track) ) {
return nullptr;
}
// retrieve the link and check its validity
const TruthLink &link = track->auxdata<TruthLink>("truthParticleLink");
const TruthLink &link = truthParticleLinkAcc(*track);
// a missing or invalid link implies truth particle has been dropped from
// the truth record at some stage - probably it was from pilup which by
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetTrackSystematicsTools/InclusiveTrackFilterTool.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "AthContainers/ConstAccessor.h"
namespace InDet {
......@@ -50,7 +51,8 @@ namespace InDet {
return false;
}
if (track->isAvailable<unsigned long>("patternRecoInfo") ) {
static const SG::ConstAccessor<unsigned long> patternRecoInfoAcc ("patternRecoInfo");
if (patternRecoInfoAcc.isAvailable(*track) ) {
const std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco = track->patternRecoInfo();
if(not patternReco.test(49)) {
ATH_MSG_DEBUG( "Applying LRT uncertainties to non-LRT track! Skipping" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment