ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPhysValMonitoringTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef INDETPHYSVALMONITORING_INDETPHYSVALMONITORINGTOOL_H
6#define INDETPHYSVALMONITORING_INDETPHYSVALMONITORINGTOOL_H
13
14//local include
17
18//#include "PATCore/IAsgSelectionTool.h"
21
24
26
28
29//#gaudi includes
30#include "GaudiKernel/ToolHandle.h"
31//EDM includes
37
38//Athena
46//STL includes
47#include <string>
48#include <vector>
49#include <iostream>
50#include <fstream>
51
52//fwd declaration
54class InDetRttPlots;
55struct InDetRttPlotConfig;
56namespace IDPVM{
58}
59
60
65public:
67 InDetPhysValMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent);
73 virtual StatusCode initialize();
74 virtual StatusCode bookHistograms();
75 virtual StatusCode fillHistograms();
76 virtual StatusCode procHistograms();
78private:
79
82 // Private utility methods
83 void fillTrackCutFlow(const asg::AcceptData& accept);
84 static void fillCutFlow(const asg::AcceptData& accept, std::vector<std::string> & names, std::vector<int> & cutFlow);
85 // Get truth particles into a vector, possibly using the pileup from the event
86 const std::vector<const xAOD::TruthParticle *> getTruthParticles(const EventContext& ctx) const;
87 std::pair<const std::vector<const xAOD::TruthVertex*>, const std::vector<const xAOD::TruthVertex*>> getTruthVertices(const EventContext& ctx) const;
88
91
93 int getIndexByEta(const xAOD::TruthParticle& truth) const;
94
95 //
97 // Do Jet/TIDE plots (Tracking In Dense Environment)
98 StatusCode fillHistogramsTrackingInDenseEnvironment(const EventContext& ctx,
100 const std::vector<const xAOD::TruthParticle*>& truthParticles,
101 const xAOD::TrackParticleContainer& tracks,
102 const xAOD::Vertex* primaryvertex,
103 float beamSpotWeight);
104
105 // accessors/decorators
112
113 // decorate track particle for ntuple writing
114 void decorateTrackParticle(const xAOD::TrackParticle & track, const asg::AcceptData & passed) const;
115
116 // decorate truth particle for ntuple writing
118
119 // safely check the "hasTruthFilled" decoration on a truth particle
120 bool hasTruthFilled(const xAOD::TruthParticle & truth) const;
121
122 // safely check the "selectedByPileupSwitch" decoration on a truth particle
123 bool isSelectedByPileupSwitch(const xAOD::TruthParticle & truth) const;
124
125 // set the "selectedByPileupSwitch" decoration for all particles in the passed vector
126 void markSelectedByPileupSwitch(const std::vector<const xAOD::TruthParticle*> & truthParticles) const;
127
128
129 // Jet Selection for CTIDE
130 bool passJetCuts(const xAOD::Jet& jet) const;
131
134 {this,"TrackParticleContainerName", "InDetTrackParticles"};
135
138 {this, "TruthParticleContainerName", "TruthParticles", ""};
139
142 {this,"VertexContainerName", "PrimaryVertices", ""};
143
146 {this,"TruthVertexContainerName", "TruthVertices",""};
147
150 {this,"EventInfoContainerName", "EventInfo", ""};
151
153 {this, "TruthEvents", "TruthEvents","Name of the truth events container probably either TruthEvent or TruthEvents"};
154
156 {this, "TruthPileupEvents", "TruthPileupEvents","Name of the truth pileup events container probably TruthPileupEvent(s)"};
157
159 {this, "JetContainerName", "AntiKt4LCTopoJets" , ""};
160
161
162 // needed to indicate data dependencies
163 std::vector<SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> > m_floatTrkDecor;
164 std::vector<SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> > m_intTrkDecor;
165 std::vector<SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> > m_floatTruthDecor;
166 std::vector<SG::ReadDecorHandleKey<xAOD::TruthParticleContainer> > m_intTruthDecor;
167 std::vector<SG::ReadDecorHandleKey<xAOD::JetContainer> > m_intJetDecor;
168 std::vector<SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> > m_linkTrkDecor;
169
171 std::unique_ptr< InDetRttPlots > m_monPlots;
172
174 BooleanProperty m_useTrackSelection {this, "useTrackSelection", false, "plot only tracks accepted by selection tool"};
175 BooleanProperty m_doTruthOriginPlots {this, "doTruthOriginPlots", false, "do plots split by track truth origin"};
176 BooleanProperty m_doDuplicatePlots {this, "doDuplicatePlots", false, "Fill duplicate=multi-track per particle plots"};
177 BooleanProperty m_doPerAuthorPlots {this, "doPerAuthorPlots", false, "do plots split by track author"};
178 BooleanProperty m_doTrackInJetPlots {this, "FillTrackInJetPlots", true, "Fill plots for tracks in jets"};
179 BooleanProperty m_doHitLevelPlots {this, "doHitLevelPlots", false, "Fill hit efficiency and residual plots"};
180 BooleanProperty m_doBjetPlots {this, "FillTrackInBJetPlots", false, "Fill plots for tracks in truth-b-tagged jets"};
181 BooleanProperty m_fillTruthToRecoNtuple {this, "FillTruthToRecoNtuple", false, "Fill an ntuple with truth and matching reco info for more detailed stuidies"};
182 BooleanProperty m_useVertexTruthMatchTool {this, "useVertexTruthMatchTool", false, "Use the vertex truth matching tool"};
183 BooleanProperty m_onlyFillMatched {this, "onlyFillTruthMatched", false, "Only fill truth-to-reco (eff, reso, matched hit) plots"};
184 BooleanProperty m_doTRTExtensionPlots {this, "doTRTExtensionPlots", true, "do TRT extension plots"};
185 BooleanProperty m_useGRL {this, "useGRL", false, "Apply GRL selection or not when running on data"};
186 BooleanProperty m_doIDTIDEPlots{this, "doIDTIDEPlots", false, "do ID TIDE derivation plots"};
187 BooleanProperty m_fillTechnicalEfficiency{this, "fillTechnicalEfficiency", false, "Fill the technical efficiency plot. Requires additional sihit information in input file"};
188 BooleanProperty m_doPRW{this,"doPRW",false,"apply pileup reweight"};
189
190 FloatProperty m_maxTrkJetDR{this,"maxTrkJetDR",0.4,"the maximum dR to jets to allow for track-in-jet plots"};
191 StringProperty m_dirName {this, "DirName", "SquirrelPlots/", "Top level directory to write histograms into"};
192 StringProperty m_folder {this, "SubFolder", "", "Subfolder to add for plots if desired. Used when working with multiple IDPVM tool instances."};
193 StringProperty m_pileupSwitch {this, "PileupSwitch", "HardScatter", "Pileup truth strategy to use. May be \"All\", \"HardScatter\", or \"PileUp\""};
194 StringProperty m_setCSVName {this, "setCSVName", "", "convert AOD to a scv file"};
195 FloatProperty m_lowProb{this,"LowProb",0.5,"Truth match prob. cutoff for efficiency (lower bound) and fake (upper bound) classification."};
196 FloatProperty m_highProb{this,"HighProb",0.8,"Truth match prob. cutoff - currently unused"};
197 DoubleArrayProperty m_etaBins{this, "EtaBins", {}};
198 IntegerArrayProperty m_minHits{this, "MinNumberClusters", {}};
199
200 FloatProperty m_jetAbsEtaMin{this, "JetAbsEtaMin", 0.f, "Minimum Eta value for jet selection"};
201 FloatProperty m_jetAbsEtaMax{this, "JetAbsEtaMax", 2.5f, "Maximum Eta value for jet selection"};
202 FloatProperty m_jetPtMin{this, "JetPtMin", 100.0f, "Minimum Jet pT for jet selection in GeV"};
203 FloatProperty m_jetPtMax{this, "JetPtMax", 5000.0f, "Maximum Jet pT for jet selection in GeV"};
204
205 BooleanProperty m_isITk{this, "isITk", false, "Whether config is set for ITk, to enable/disable some plots"};
206
207 ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelectionTool{this, "TrackSelectionTool", "InDet::InDetTrackSelectionTool/TrackSelectionTool", "Track selection tool to use"};
208 ToolHandle<IInDetVertexTruthMatchTool> m_vtxValidTool{this, "VertexTruthMatchTool", "InDetVertexTruthMatchTool/VtxTruthMatchTool", "Vertex truth matching tool to use"};
209 ToolHandle<IAthSelectionTool> m_truthSelectionTool{this, "TruthSelectionTool","AthTruthSelectionTool", "Truth selection tool (for efficiencies and resolutions)"};
210 ToolHandle<InDet::IInDetTrackTruthOriginTool> m_trackTruthOriginTool{this, "trackTruthOriginTool", "InDet::InDetTrackTruthOriginTool","truth track origin tool"};
211 ToolHandle<InDet::IInDetHardScatterSelectionTool> m_hardScatterSelectionTool{this, "hardScatterSelectionTool", "InDet::InDetHardScatterSelectionTool","tool to select the hard scatter reco vertex"};
212 ToolHandle<IGoodRunsListSelectionTool> m_grlTool{this, "GoodRunsListSelectionTool", "GoodRunsListSelectionTool/GoodRunsListSelectionTool", "GRL selection tool"};
213
215
216 mutable std::mutex m_mutex;
217 mutable CutFlow m_truthCutFlow ATLAS_THREAD_SAFE; // Guarded by m_mutex
218 std::vector<int> m_prospectsMatched;
220 std::ofstream m_datfile;
221 std::vector<std::string> m_trackCutflowNames;
222 std::vector<int> m_trackCutflow;
223
225};
226#endif
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
header file for interface of selection tools in this package
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the TRT subdetector.
Define macros for attributes used to control the static checker.
bool passJetCuts(const xAOD::Jet &jet) const
ToolHandle< InDet::IInDetHardScatterSelectionTool > m_hardScatterSelectionTool
SG::AuxElement::Decorator< bool > m_dec_passedTrackSelection
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerName
Primary vertex container's name.
std::pair< const std::vector< const xAOD::TruthVertex * >, const std::vector< const xAOD::TruthVertex * > > getTruthVertices(const EventContext &ctx) const
const std::vector< const xAOD::TruthParticle * > getTruthParticles(const EventContext &ctx) const
SG::AuxElement::Accessor< bool > m_acc_hasTruthFilled
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name.
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
std::unique_ptr< InDetRttPlots > m_monPlots
histograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
SG::ReadDecorHandleKey< xAOD::EventInfo > m_weight_pileup_key
bool isSelectedByPileupSwitch(const xAOD::TruthParticle &truth) const
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_truthPileUpEventName
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkParticleName
TrackParticle container's name.
static void fillCutFlow(const asg::AcceptData &accept, std::vector< std::string > &names, std::vector< int > &cutFlow)
InDetPhysValMonitoringTool()
prevent default construction
SG::AuxElement::Accessor< bool > m_acc_selectedByPileupSwitch
SG::AuxElement::Decorator< bool > m_dec_selectedByPileupSwitch
std::vector< SG::ReadDecorHandleKey< xAOD::JetContainer > > m_intJetDecor
int getIndexByEta(const xAOD::TruthParticle &truth) const
Utility function for evaluation of technical efficiency.
InDetPhysValMonitoringTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters.
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelectionTool
SG::AuxElement::Decorator< bool > m_dec_hasTruthFilled
ToolHandle< InDet::IInDetTrackTruthOriginTool > m_trackTruthOriginTool
BooleanProperty m_useTrackSelection
Properties to fine-tune the tool behaviour.
void fillTrackCutFlow(const asg::AcceptData &accept)
SG::ReadHandleKey< xAOD::TruthVertexContainer > m_truthVertexContainerName
Truth vertex container's name.
std::vector< SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > > m_floatTrkDecor
ToolHandle< IInDetVertexTruthMatchTool > m_vtxValidTool
void decorateTrackParticle(const xAOD::TrackParticle &track, const asg::AcceptData &passed) const
void decorateTruthParticle(const xAOD::TruthParticle &truth, const IAthSelectionTool::CutResult &passed) const
std::vector< SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > > m_floatTruthDecor
std::vector< SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > > m_intTruthDecor
InDetRttPlotConfig getFilledPlotConfig() const
Generate an Rtt config struct based on the user-passed properties.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoContainerName
EventInfo container name.
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventName
ToolHandle< IGoodRunsListSelectionTool > m_grlTool
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerName
bool hasTruthFilled(const xAOD::TruthParticle &truth) const
void markSelectedByPileupSwitch(const std::vector< const xAOD::TruthParticle * > &truthParticles) const
virtual ~InDetPhysValMonitoringTool()
Destructor.
const Trk::TrackParameters * getUnbiasedTrackParameters(const Trk::TrackParameters *trkParameters, const Trk::MeasurementBase *measurement)
std::vector< SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > > m_linkTrkDecor
ToolHandle< IAthSelectionTool > m_truthSelectionTool
StatusCode fillHistogramsTrackingInDenseEnvironment(const EventContext &ctx, IDPVM::CachedGetAssocTruth &getAsTruth, const std::vector< const xAOD::TruthParticle * > &truthParticles, const xAOD::TrackParticleContainer &tracks, const xAOD::Vertex *primaryvertex, float beamSpotWeight)
std::vector< SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > > m_intTrkDecor
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
std::vector< std::string > m_trackCutflowNames
SG::AuxElement::Decorator< bool > m_dec_passedTruthSelection
class holding all plots for Inner Detector RTT Validation and implementing fill methods
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
This class is the pure abstract base class for all fittable tracking measurements.
Class to retrieve associated truth from a track, implementing a cached response.
ParametersBase< TrackParametersDim, Charged > TrackParameters
Jet_v1 Jet
Definition of the current "jet version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
helper struct - steer the configuration from the parent tool's side