ATLAS Offline Software
TrackSystematicsMaker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 // modified base on GhostTrackSystematicsMaker.h from Fabian Wilk
6 // Description:
7 // Author: Andrea Knue
8 // Created: June 2020
9 
10 
11 #ifndef _TOP_TRACKSYSTEMATICSMAKER_H_
12 #define _TOP_TRACKSYSTEMATICSMAKER_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 
27 
28 
29 // Forward Declarations.
30 namespace InDet {
31  class InDetTrackSystematicsTool;
32  class InDetTrackSmearingTool;
33  class InDetTrackBiasingTool;
34  class InDetTrackTruthFilterTool;
35  class InDetTrackTruthOriginTool;
36 }
37 
38 namespace top {
39  class TopConfig;
40 }
41 
42 namespace top {
43 
44  class TrackSystematicsMaker final: public asg::AsgTool {
45  public:
46  explicit TrackSystematicsMaker(const std::string& name);
47  virtual ~TrackSystematicsMaker();
48 
52 
54  StatusCode execute(bool);
55 
56  /*
57  * @brief Retrieve the specified (requested) systematics list.*
58  *
59  * Unless systematics have been requested through the
60  * specifiedSystematics setter function, this will be an empty list.
61  */
62  inline const std::list<CP::SystematicSet>& specifiedSystematics() const;
63 
64  /*
65  * @brief Retrieve the recommended systematics list.
66  *
67  * This will return a meaningless (probably empty) list unless the
68  * setter function specifiedSystematics has been called or the tool has
69  * been initialized (which call specifiedSystematics using the data
70  * obtained from top::TopConfig).
71  */
72  inline const std::list<CP::SystematicSet>& recommendedSystematics() const;
73 
79  virtual void specifiedSystematics(const std::set<std::string>& specifiedSystematics);
80 
81  protected:
82 
83 
85  const CP::SystematicSet& syst) const;
86 
88  const CP::SystematicSet& syst) const;
89 
91  const CP::SystematicSet& syst) const;
92 
93  private:
95  private:
96  std::shared_ptr<top::TopConfig> m_config;
97  std::vector<std::uint32_t> m_runPeriods;
98 
99  std::list<CP::SystematicSet> m_specifiedSystematics;
100  std::list<CP::SystematicSet> m_recommendedSystematics;
101 
103 
104 
105 
106  struct {
107  void makeUnique() {
108  static auto exec = [](std::vector<CP::SystematicSet>& data) {
109  std::sort(data.begin(), data.end());
110  data.erase(std::unique(data.begin(), data.end()),
111  data.end());
112  };
113 
114  exec(smearing);
115  exec(truthFilter);
116  exec(bias);
117  }
118 
119  void removeNonSpecified(const std::list<CP::SystematicSet>& specified) {
120  auto fnCmp = [&specified](CP::SystematicSet& s) {
121  return std::find(specified.begin(),
122  specified.end(),
123  s) == specified.end();
124  };
125 
126  // commented out variables are unused. experts please check and remove
127  auto exec = [/*&specified,*/ &fnCmp](std::vector<CP::SystematicSet>& data) {
128  data.erase(std::remove_if(data.begin(), data.end(), fnCmp),
129  data.end());
130  };
131 
132  exec(smearing);
133  exec(truthFilter);
134  exec(bias);
135  }
136 
137  std::size_t numSystematics() const {
138  return smearing.size() + truthFilter.size() + bias.size();
139  }
140 
141  std::vector<CP::SystematicSet> smearing, truthFilter, bias;
143 
144  ToolHandle<InDet::InDetTrackSmearingTool> m_smearingTool;
145  std::vector<ToolHandle<InDet::InDetTrackBiasingTool> > m_biasTool;
146  ToolHandle<InDet::InDetTrackTruthOriginTool> m_truthOriginTool;
147  ToolHandle<InDet::InDetTrackTruthFilterTool> m_truthFilterTool;
148 
149  };
150 
151 }
152 
153 #endif /* _TOP_TRACKSYSTEMATICSMAKER_H_ */
top::TrackSystematicsMaker::TrackSystematicsMaker
TrackSystematicsMaker(const TrackSystematicsMaker &rhs)=delete
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
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
top::TrackSystematicsMaker::m_recommendedSystematics
std::list< CP::SystematicSet > m_recommendedSystematics
Definition: TrackSystematicsMaker.h:100
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::TrackSystematicsMaker::m_systs
struct top::TrackSystematicsMaker::@221 m_systs
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
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::TrackSystematicsMaker::m_specifiedSystematics
std::list< CP::SystematicSet > m_specifiedSystematics
Definition: TrackSystematicsMaker.h:99
top::TrackSystematicsMaker::smearing
std::vector< CP::SystematicSet > smearing
Definition: TrackSystematicsMaker.h:141
top::TrackSystematicsMaker::TrackSystematicsMaker
TrackSystematicsMaker(TrackSystematicsMaker &&rhs)=delete
InDet::InDetTrackSmearingTool
Definition: InDetTrackSmearingTool.h:32
top::TrackSystematicsMaker::applySmearingSystematic
StatusCode applySmearingSystematic(InDet::InDetTrackSmearingTool *tool, const CP::SystematicSet &syst) const
Definition: TrackSystematicsMaker.cxx:146
top::TrackSystematicsMaker::m_biasTool
std::vector< ToolHandle< InDet::InDetTrackBiasingTool > > m_biasTool
Definition: TrackSystematicsMaker.h:145
top::TrackSystematicsMaker::truthFilter
std::vector< CP::SystematicSet > truthFilter
Definition: TrackSystematicsMaker.h:141
top::TrackSystematicsMaker::m_nominalSystematicSet
CP::SystematicSet m_nominalSystematicSet
Definition: TrackSystematicsMaker.h:102
top::TrackSystematicsMaker::m_truthOriginTool
ToolHandle< InDet::InDetTrackTruthOriginTool > m_truthOriginTool
Definition: TrackSystematicsMaker.h:146
top::TrackSystematicsMaker::applyTruthFilterSystematic
StatusCode applyTruthFilterSystematic(InDet::InDetTrackTruthFilterTool *tool, const CP::SystematicSet &syst) const
Definition: TrackSystematicsMaker.cxx:103
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
top::TrackSystematicsMaker::m_smearingTool
ToolHandle< InDet::InDetTrackSmearingTool > m_smearingTool
Definition: TrackSystematicsMaker.h:144
LArG4FSStartPointFilter.exec
exec
Definition: LArG4FSStartPointFilter.py:103
top::TrackSystematicsMaker::retrieveTrackCPTool
StatusCode retrieveTrackCPTool()
Definition: TrackSystematicsMaker.cxx:423
top::TrackSystematicsMaker::operator=
TrackSystematicsMaker & operator=(const TrackSystematicsMaker &rhs)=delete
InDet::InDetTrackBiasingTool
Definition: InDetTrackBiasingTool.h:36
top::TrackSystematicsMaker::recommendedSystematics
const std::list< CP::SystematicSet > & recommendedSystematics() const
Definition: TrackSystematicsMaker.cxx:483
top::TrackSystematicsMaker::bias
std::vector< CP::SystematicSet > bias
Definition: TrackSystematicsMaker.h:141
top::TrackSystematicsMaker::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: TrackSystematicsMaker.cxx:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
top::TrackSystematicsMaker::~TrackSystematicsMaker
virtual ~TrackSystematicsMaker()
Definition: TrackSystematicsMaker.cxx:47
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
top::TrackSystematicsMaker::applyBiasingSystematic
StatusCode applyBiasingSystematic(InDet::InDetTrackBiasingTool *tool, const CP::SystematicSet &syst) const
Definition: TrackSystematicsMaker.cxx:184
InDet::InDetTrackTruthFilterTool
Definition: InDetTrackTruthFilterTool.h:36
top::TrackSystematicsMaker
Definition: TrackSystematicsMaker.h:44
top::TrackSystematicsMaker::execute
StatusCode execute(bool)
Definition: TrackSystematicsMaker.cxx:221
top::TrackSystematicsMaker::m_truthFilterTool
ToolHandle< InDet::InDetTrackTruthFilterTool > m_truthFilterTool
Definition: TrackSystematicsMaker.h:147
top::TrackSystematicsMaker::specifiedSystematics
const std::list< CP::SystematicSet > & specifiedSystematics() const
Definition: TrackSystematicsMaker.cxx:479
ToolHandle.h
AsgTool.h
top::TrackSystematicsMaker::TrackSystematicsMaker
TrackSystematicsMaker(const std::string &name)
Definition: TrackSystematicsMaker.cxx:33
TrackParticleContainer.h
top::TrackSystematicsMaker::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: TrackSystematicsMaker.h:96
top::TrackSystematicsMaker::m_runPeriods
std::vector< std::uint32_t > m_runPeriods
Definition: TrackSystematicsMaker.h:97