ATLAS Offline Software
GhostTrackSystematicsMaker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 // Filename: GhostTrackSystematicsMaker.h
6 // Description:
7 // Author: Fabian Wilk
8 // Created: Mon Oct 24 16:54:17 2016
9 
10 
11 #ifndef _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_
12 #define _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_
13 
14 #include <list>
15 #include <set>
16 #include <string>
17 #include <vector>
18 #include <utility>
19 
20 // Framework include(s):
21 #include "AsgTools/AsgTool.h"
22 #include "AsgTools/ToolHandle.h"
23 
25 
26 #include "xAODJet/JetContainer.h"
27 
28 
29 // Forward Declarations.
30 namespace InDet {
31  class InDetTrackSystematicsTool;
32  class InDetTrackSmearingTool;
33  class InDetTrackBiasingTool;
34  class InDetTrackTruthFilterTool;
35  class InDetTrackTruthOriginTool;
36  class JetTrackFilterTool;
37 }
38 
39 namespace top {
40  class TopConfig;
41 }
42 
43 namespace top {
44  /*
45  * @brief Tool for making systematics that affect ghost-associated tracks of
46  * jets available.
47  *
48  * Ghost-associated tracks are available on jets through the
49  * getAssociatedObjects function which retrieves a
50  *
51  * std::vector<const xAOD::IParticle*>
52  *
53  * container that is decorated onto each jet object.
54  *
55  * This tool, produces one copy of this container for each of the affecting
56  * and requested systematics. Some systematics change only the number of
57  * tracks (efficiency-style systematics) while other only smear (some) of
58  * the track particle properties.
59  *
60  * The requested systematics are retrieved from top::TopConfig, filtered to
61  * only contain those affecting the ghost tracks, and propagated back to
62  * the top::TopConfig instance so that they become available to any tool
63  * which wishes to query
64  *
65  * - the affecting systematics,
66  * - the decoration name used for the varied ghost track container
67  *
68  * Generally, a tool should use the function
69  *
70  * top::TopConfig::systMapJetGhostTrack()
71  *
72  * to retrieve the mapping from the hash value of a systematic to the
73  * CP::SystematicSet of that variation for all (configured and requested)
74  * systematics that affect the ghost tracks (this map includes the nominal
75  * systematic). The decoration name can then be retrieved using
76  *
77  * top::TopConfig::decoKeyJetGhostTrack(std::size_t hash)
78  */
80  public:
81  explicit GhostTrackSystematicsMaker(const std::string& name);
83 
87 
89  StatusCode execute(bool);
90 
91  /*
92  * @brief Retrieve the specified (requested) systematics list.*
93  *
94  * Unless systematics have been requested through the
95  * specifiedSystematics setter function, this will be an empty list.
96  */
97  inline virtual const std::list<CP::SystematicSet>& specifiedSystematics() const;
98 
99  /*
100  * @brief Retrieve the recommended systematics list.
101  *
102  * This will return a meaningless (probably empty) list unless the
103  * setter function specifiedSystematics has been called or the tool has
104  * been initialized (which call specifiedSystematics using the data
105  * obtained from top::TopConfig).
106  */
107  inline const std::list<CP::SystematicSet>& recommendedSystematics() const;
108 
114  virtual void specifiedSystematics(const std::set<std::string>& specifiedSystematics);
115  protected:
117  const CP::SystematicSet& syst) const;
118 
121  const CP::SystematicSet& syst) const;
122 
125  const CP::SystematicSet& syst) const;
126 
129  const CP::SystematicSet& syst) const;
130 
133  const CP::SystematicSet& syst) const;
134  private:
136  private:
137  std::shared_ptr<top::TopConfig> m_config;
139  std::vector<std::uint32_t> m_runPeriods;
140 
141  std::list<CP::SystematicSet> m_specifiedSystematics;
142  std::list<CP::SystematicSet> m_recommendedSystematics;
143 
145 
146 
147 
148  struct {
149  void makeUnique() {
150  static auto exec = [](std::vector<CP::SystematicSet>& data) {
151  std::sort(data.begin(), data.end());
152  data.erase(std::unique(data.begin(), data.end()),
153  data.end());
154  };
155 
156  exec(smearing);
157  exec(truthFilter);
158  exec(bias);
160  }
161 
162  void removeNonSpecified(const std::list<CP::SystematicSet>& specified) {
163  auto fnCmp = [&specified](CP::SystematicSet& s) {
164  return std::find(specified.begin(),
165  specified.end(),
166  s) == specified.end();
167  };
168 
169  // commented out variables are unused. experts please check and remove
170  auto exec = [/*&specified,*/ &fnCmp](std::vector<CP::SystematicSet>& data) {
171  data.erase(std::remove_if(data.begin(), data.end(), fnCmp),
172  data.end());
173  };
174 
175  exec(smearing);
176  exec(truthFilter);
177  exec(bias);
179  }
180 
181  std::size_t numSystematics() const {
182  return smearing.size() + truthFilter.size() + bias.size() + jetTrackFilter.size();
183  }
184 
185  std::vector<CP::SystematicSet> smearing, truthFilter, bias, jetTrackFilter;
187 
188  struct {
189  ToolHandle<InDet::InDetTrackSmearingTool> smearing;
190  ToolHandle<InDet::InDetTrackTruthOriginTool> truthOrigin;
191  ToolHandle<InDet::InDetTrackTruthFilterTool> truthFilter;
192  ToolHandle<InDet::JetTrackFilterTool> jetTrackFilter;
193 
194  std::vector<ToolHandle<InDet::InDetTrackBiasingTool> > bias;
196  };
197 
198  /* inline virtual */ const std::list<CP::SystematicSet>& GhostTrackSystematicsMaker::specifiedSystematics() const {
199  return m_specifiedSystematics;
200  }
201 
202  /* inline */ const std::list<CP::SystematicSet>& GhostTrackSystematicsMaker::recommendedSystematics() const {
204  }
205 }
206 
207 #endif /* _TOP_GHOSTTRACKSYSTEMATICSMAKER_H_ */
top::GhostTrackSystematicsMaker::applyBiasingSystematic
StatusCode applyBiasingSystematic(xAOD::JetContainer *nominal, InDet::InDetTrackBiasingTool *tool, const CP::SystematicSet &syst) const
Definition: GhostTrackSystematicsMaker.cxx:261
top::GhostTrackSystematicsMaker::m_recommendedSystematics
std::list< CP::SystematicSet > m_recommendedSystematics
Definition: GhostTrackSystematicsMaker.h:142
top::GhostTrackSystematicsMaker
Definition: GhostTrackSystematicsMaker.h:79
top::GhostTrackSystematicsMaker::smearing
std::vector< CP::SystematicSet > smearing
Definition: GhostTrackSystematicsMaker.h:185
top::GhostTrackSystematicsMaker::m_jetEtaCut
double m_jetEtaCut
Definition: GhostTrackSystematicsMaker.h:138
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
top::GhostTrackSystematicsMaker::GhostTrackSystematicsMaker
GhostTrackSystematicsMaker(const GhostTrackSystematicsMaker &rhs)=delete
top::GhostTrackSystematicsMaker::bias
std::vector< ToolHandle< InDet::InDetTrackBiasingTool > > bias
Definition: GhostTrackSystematicsMaker.h:194
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::GhostTrackSystematicsMaker::m_specifiedSystematics
std::list< CP::SystematicSet > m_specifiedSystematics
Definition: GhostTrackSystematicsMaker.h:141
top::GhostTrackSystematicsMaker::GhostTrackSystematicsMaker
GhostTrackSystematicsMaker(GhostTrackSystematicsMaker &&rhs)=delete
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
top::GhostTrackSystematicsMaker::specifiedSystematics
virtual const std::list< CP::SystematicSet > & specifiedSystematics() const
Definition: GhostTrackSystematicsMaker.h:198
top::GhostTrackSystematicsMaker::truthFilter
std::vector< CP::SystematicSet > truthFilter
Definition: GhostTrackSystematicsMaker.h:185
top::GhostTrackSystematicsMaker::jetTrackFilter
ToolHandle< InDet::JetTrackFilterTool > jetTrackFilter
Definition: GhostTrackSystematicsMaker.h:192
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
top::GhostTrackSystematicsMaker::jetTrackFilter
std::vector< CP::SystematicSet > jetTrackFilter
Definition: GhostTrackSystematicsMaker.h:185
top::GhostTrackSystematicsMaker::execute
StatusCode execute(bool)
Definition: GhostTrackSystematicsMaker.cxx:318
top::GhostTrackSystematicsMaker::applyNoOpSystematic
StatusCode applyNoOpSystematic(xAOD::JetContainer *nominal, const CP::SystematicSet &syst) const
Definition: GhostTrackSystematicsMaker.cxx:96
InDet::InDetTrackSmearingTool
Definition: InDetTrackSmearingTool.h:32
top::GhostTrackSystematicsMaker::GhostTrackSystematicsMaker
GhostTrackSystematicsMaker(const std::string &name)
Definition: GhostTrackSystematicsMaker.cxx:31
top::GhostTrackSystematicsMaker::m_tools
struct top::GhostTrackSystematicsMaker::@220 m_tools
top::GhostTrackSystematicsMaker::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: GhostTrackSystematicsMaker.h:137
top::GhostTrackSystematicsMaker::applyJetTrackFilterSystematic
StatusCode applyJetTrackFilterSystematic(xAOD::JetContainer *nominal, InDet::JetTrackFilterTool *tool, const CP::SystematicSet &syst) const
Definition: GhostTrackSystematicsMaker.cxx:168
top::GhostTrackSystematicsMaker::truthOrigin
ToolHandle< InDet::InDetTrackTruthOriginTool > truthOrigin
Definition: GhostTrackSystematicsMaker.h:190
top::GhostTrackSystematicsMaker::applySmearingSystematic
StatusCode applySmearingSystematic(xAOD::JetContainer *nominal, InDet::InDetTrackSmearingTool *tool, const CP::SystematicSet &syst) const
Definition: GhostTrackSystematicsMaker.cxx:204
top::GhostTrackSystematicsMaker::truthFilter
ToolHandle< InDet::InDetTrackTruthFilterTool > truthFilter
Definition: GhostTrackSystematicsMaker.h:191
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArG4FSStartPointFilter.exec
exec
Definition: LArG4FSStartPointFilter.py:103
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
InDet::InDetTrackBiasingTool
Definition: InDetTrackBiasingTool.h:36
top::GhostTrackSystematicsMaker::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: GhostTrackSystematicsMaker.cxx:47
top::GhostTrackSystematicsMaker::m_systs
struct top::GhostTrackSystematicsMaker::@219 m_systs
top::GhostTrackSystematicsMaker::bias
std::vector< CP::SystematicSet > bias
Definition: GhostTrackSystematicsMaker.h:185
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
InDet::JetTrackFilterTool
Definition: JetTrackFilterTool.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
top::GhostTrackSystematicsMaker::m_jetPtCut
double m_jetPtCut
Definition: GhostTrackSystematicsMaker.h:138
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
InDet::InDetTrackTruthFilterTool
Definition: InDetTrackTruthFilterTool.h:36
top::GhostTrackSystematicsMaker::m_runPeriods
std::vector< std::uint32_t > m_runPeriods
Definition: GhostTrackSystematicsMaker.h:139
JetContainer.h
top::GhostTrackSystematicsMaker::smearing
ToolHandle< InDet::InDetTrackSmearingTool > smearing
Definition: GhostTrackSystematicsMaker.h:189
top::GhostTrackSystematicsMaker::operator=
GhostTrackSystematicsMaker & operator=(const GhostTrackSystematicsMaker &rhs)=delete
top::GhostTrackSystematicsMaker::~GhostTrackSystematicsMaker
virtual ~GhostTrackSystematicsMaker()
Definition: GhostTrackSystematicsMaker.cxx:44
ToolHandle.h
top::GhostTrackSystematicsMaker::recommendedSystematics
const std::list< CP::SystematicSet > & recommendedSystematics() const
Definition: GhostTrackSystematicsMaker.h:202
top::GhostTrackSystematicsMaker::retrieveGhostTrackCPTool
StatusCode retrieveGhostTrackCPTool()
Definition: GhostTrackSystematicsMaker.cxx:497
AsgTool.h
top::GhostTrackSystematicsMaker::m_nominalSystematicSet
CP::SystematicSet m_nominalSystematicSet
Definition: GhostTrackSystematicsMaker.h:144
top::GhostTrackSystematicsMaker::applyTruthFilterSystematic
StatusCode applyTruthFilterSystematic(xAOD::JetContainer *nominal, InDet::InDetTrackTruthFilterTool *tool, const CP::SystematicSet &syst) const
Definition: GhostTrackSystematicsMaker.cxx:132