ATLAS Offline Software
InDetTrackTruthFilterTool.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*
3  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef INDETTRACKSYSTEMATICSTOOLS_INDETTRACKTRUTHFILTERTOOL_H
7 #define INDETTRACKSYSTEMATICSTOOLS_INDETTRACKTRUTHFILTERTOOL_H
8 
10 #include "AsgTools/AsgTool.h"
11 #include "AsgTools/ToolHandle.h"
15 
17 #include <string>
18 
19 class TH2;
20 class TRandom3;
21 class TFile;
22 
23 namespace InDet {
24 
25  class IInDetTrackTruthOriginTool;
26 
31 
33  : public virtual IInDetTrackTruthFilterTool
34  , public virtual InDetTrackSystematicsTool
35  // , public asg::AsgTool
36  {
37 
38  // create constructor for Athena
41 
42  public:
43  // create constructor for standalone Root
44  InDetTrackTruthFilterTool( const std::string& name );
45  virtual ~InDetTrackTruthFilterTool();
46 
47  // static const InterfaceID& interfaceID();
48  virtual StatusCode initialize() override;
49  virtual void prepare() override {};
50 
51  // right now this returns a bool; if we want to implement the ASG selection tool interface then this will need to change to a TAccept
52 
53  // "standard" accept method - if appropriate systematic is activated, will call mu-dependent version (below) using mu value from EventInfo, otherwise will use truth info
54  virtual bool accept(const xAOD::TrackParticle* track) const override;
55 
56  // This is a version of the accept method that takes a value of mu (i.e. mean interactions per crossing) in order to calculate a probability that a givent track at that mu is a fake,
57  // and so should be considered for being dropped for the fake systematic variation - this version does not rely on truth information
58  virtual bool accept(const xAOD::TrackParticle* track, float mu) const override;
59 
61  virtual bool isAffectedBySystematic( const CP::SystematicVariation& ) const override;
63  virtual CP::SystematicSet affectingSystematics() const override;
65  virtual CP::SystematicSet recommendedSystematics() const override;
67  virtual StatusCode applySystematicVariation( const CP::SystematicSet& ) override;
68 
69  private:
70 
71  StatusCode initTrkEffSystHistogram(float scale, TH2 *&histogram, std::string rootFileName, std::string histogramName) const;
72  float getFractionDropped(float fDefault, const TH2 *histogram, float x, float y, bool xAxisIspT = true) const;
73  float pseudoFakeProbability(const xAOD::TrackParticle* track, float mu) const;
74  bool dropPseudoFake(float prob) const;
75 
76  int m_seed = 0;
77  std::unique_ptr<TRandom3> m_rnd;
78 
79  float m_fPrim = 1.;
80  float m_fSec = 1.;
81  float m_fFakeLoose = 0.10;
82  float m_fFakeTight = 1.00; // this method breaks down for uncertainties > 1.00 (as was present in previous iterations)
83  float m_fPU = 1.;
84  float m_fFrag = 1.;
85  float m_fFromC = 1.;
86  float m_fFromB = 1.;
87  float m_trkEffSystScale = 1.;
88  bool m_doLRTSystematics = false;
89 
90  TH2 *m_fPrimHistogram = nullptr;
91  TH2 *m_fSecHistogram = nullptr;
92  //TH2 *m_fFakeHistogram = nullptr;
93  TH2 *m_fPUHistogram = nullptr;
94  TH2 *m_fFragHistogram = nullptr;
95  TH2 *m_fFromCHistogram = nullptr;
96  TH2 *m_fFromBHistogram = nullptr;
97 
98 
111 
112  // allow the user to configure which calibration files to use if desired
113  std::string m_calibFileNomEff;
114  std::string m_calibFileLRTEff;
115 
116  ToolHandle< IInDetTrackTruthOriginTool > m_trackOriginTool;
117 
118 
119 }; // class InDetTrackTruthFilterTool
120 
121 } // namespace InDet
122 
123 #endif
InDet::InDetTrackSystematicsTool
Definition: InDetTrackSystematicsTool.h:22
InDet::InDetTrackTruthFilterTool::m_trkEffHistLoosePP0
TH2 * m_trkEffHistLoosePP0
Definition: InDetTrackTruthFilterTool.h:101
InDet::InDetTrackTruthFilterTool::m_trkEffSystScale
float m_trkEffSystScale
Definition: InDetTrackTruthFilterTool.h:87
InDet::InDetTrackTruthFilterTool::m_fSec
float m_fSec
Definition: InDetTrackTruthFilterTool.h:80
InDet::InDetTrackTruthFilterTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
returns: list of recommended systematics to use with this tool
Definition: InDetTrackTruthFilterTool.cxx:438
InDet::InDetTrackTruthFilterTool::m_trkEffHistLooseIBL
TH2 * m_trkEffHistLooseIBL
Definition: InDetTrackTruthFilterTool.h:100
InDet::InDetTrackTruthFilterTool::m_fFakeLoose
float m_fFakeLoose
Definition: InDetTrackTruthFilterTool.h:81
InDet::InDetTrackTruthFilterTool::m_trkEffHistLRTIBL
TH2 * m_trkEffHistLRTIBL
Definition: InDetTrackTruthFilterTool.h:108
InDet::InDetTrackTruthFilterTool::m_trkEffHistLoosePhysModel
TH2 * m_trkEffHistLoosePhysModel
Definition: InDetTrackTruthFilterTool.h:102
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::InDetTrackTruthFilterTool::initTrkEffSystHistogram
StatusCode initTrkEffSystHistogram(float scale, TH2 *&histogram, std::string rootFileName, std::string histogramName) const
Definition: InDetTrackTruthFilterTool.cxx:327
InDet::InDetTrackTruthFilterTool::m_fSecHistogram
TH2 * m_fSecHistogram
Definition: InDetTrackTruthFilterTool.h:91
InDet::InDetTrackTruthFilterTool::m_trackOriginTool
ToolHandle< IInDetTrackTruthOriginTool > m_trackOriginTool
Definition: InDetTrackTruthFilterTool.h:116
InDet::InDetTrackTruthFilterTool::prepare
virtual void prepare() override
Definition: InDetTrackTruthFilterTool.h:49
InDet::InDetTrackTruthFilterTool::m_calibFileLRTEff
std::string m_calibFileLRTEff
Definition: InDetTrackTruthFilterTool.h:114
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
InDet::InDetTrackTruthFilterTool::m_fFromCHistogram
TH2 * m_fFromCHistogram
Definition: InDetTrackTruthFilterTool.h:95
InDet::InDetTrackTruthFilterTool::m_fFrag
float m_fFrag
Definition: InDetTrackTruthFilterTool.h:84
InDet::IInDetTrackTruthFilterTool
Definition: IInDetTrackTruthFilterTool.h:26
IInDetTrackTruthFilterTool.h
InDet::InDetTrackTruthFilterTool::m_trkEffHistTightPP0
TH2 * m_trkEffHistTightPP0
Definition: InDetTrackTruthFilterTool.h:105
InDet::InDetTrackTruthFilterTool::m_seed
int m_seed
Definition: InDetTrackTruthFilterTool.h:76
InDet::InDetTrackTruthFilterTool::m_trkEffHistLRTGlobal
TH2 * m_trkEffHistLRTGlobal
Definition: InDetTrackTruthFilterTool.h:107
InDet::InDetTrackTruthFilterTool::getFractionDropped
float getFractionDropped(float fDefault, const TH2 *histogram, float x, float y, bool xAxisIspT=true) const
Definition: InDetTrackTruthFilterTool.cxx:346
CP::SystematicVariation
Definition: SystematicVariation.h:47
InDet::InDetTrackTruthFilterTool::accept
virtual bool accept(const xAOD::TrackParticle *track) const override
Definition: InDetTrackTruthFilterTool.cxx:201
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
covarianceTool.prob
prob
Definition: covarianceTool.py:678
x
#define x
InDet::InDetTrackTruthFilterTool::m_fPrim
float m_fPrim
Definition: InDetTrackTruthFilterTool.h:79
InDet::InDetTrackTruthFilterTool::m_trkEffHistTightGlobal
TH2 * m_trkEffHistTightGlobal
Definition: InDetTrackTruthFilterTool.h:103
InDet::InDetTrackTruthFilterTool::m_calibFileNomEff
std::string m_calibFileNomEff
Definition: InDetTrackTruthFilterTool.h:113
InDet::InDetTrackTruthFilterTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
returns: list of systematics this tool can be affected by
Definition: InDetTrackTruthFilterTool.cxx:433
InDet::InDetTrackTruthFilterTool::m_fPUHistogram
TH2 * m_fPUHistogram
Definition: InDetTrackTruthFilterTool.h:93
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::InDetTrackTruthFilterTool::initialize
virtual StatusCode initialize() override
Definition: InDetTrackTruthFilterTool.cxx:71
InDet::InDetTrackTruthFilterTool::m_fFromC
float m_fFromC
Definition: InDetTrackTruthFilterTool.h:85
InDet::InDetTrackTruthFilterTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &) const override
returns: whether the tool is affected by the systematic
Definition: InDetTrackTruthFilterTool.cxx:428
TH2
Definition: rootspy.cxx:373
InDet::InDetTrackTruthFilterTool::m_fFromB
float m_fFromB
Definition: InDetTrackTruthFilterTool.h:86
InDet::InDetTrackTruthFilterTool::m_trkEffHistTightPhysModel
TH2 * m_trkEffHistTightPhysModel
Definition: InDetTrackTruthFilterTool.h:106
InDet::InDetTrackTruthFilterTool::m_fFakeTight
float m_fFakeTight
Definition: InDetTrackTruthFilterTool.h:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
InDet::InDetTrackTruthFilterTool::m_trkEffHistLooseGlobal
TH2 * m_trkEffHistLooseGlobal
Definition: InDetTrackTruthFilterTool.h:99
InDet::InDetTrackTruthFilterTool::m_doLRTSystematics
bool m_doLRTSystematics
Definition: InDetTrackTruthFilterTool.h:88
InDetTrackSystematicsTool.h
InDet::InDetTrackTruthFilterTool
Definition: InDetTrackTruthFilterTool.h:36
InDet::InDetTrackTruthFilterTool::m_fFromBHistogram
TH2 * m_fFromBHistogram
Definition: InDetTrackTruthFilterTool.h:96
InDet::InDetTrackTruthFilterTool::m_trkEffHistLRTPP0
TH2 * m_trkEffHistLRTPP0
Definition: InDetTrackTruthFilterTool.h:109
InDet::InDetTrackTruthFilterTool::dropPseudoFake
bool dropPseudoFake(float prob) const
Definition: InDetTrackTruthFilterTool.cxx:414
TrackParticle.h
y
#define y
InDet::InDetTrackTruthFilterTool::m_rnd
std::unique_ptr< TRandom3 > m_rnd
Definition: InDetTrackTruthFilterTool.h:77
InDet::InDetTrackTruthFilterTool::m_trkEffHistLRTPhysModel
TH2 * m_trkEffHistLRTPhysModel
Definition: InDetTrackTruthFilterTool.h:110
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
InDet::InDetTrackTruthFilterTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &) override
configure the tool to apply a given list of systematic variations
Definition: InDetTrackTruthFilterTool.cxx:443
InDet::InDetTrackTruthFilterTool::m_fPU
float m_fPU
Definition: InDetTrackTruthFilterTool.h:83
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ToolHandle.h
AsgTool.h
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
InDet::InDetTrackTruthFilterTool::pseudoFakeProbability
float pseudoFakeProbability(const xAOD::TrackParticle *track, float mu) const
Definition: InDetTrackTruthFilterTool.cxx:374
InDet::InDetTrackTruthFilterTool::m_fPrimHistogram
TH2 * m_fPrimHistogram
Definition: InDetTrackTruthFilterTool.h:90
SystematicVariation.h
InDet::InDetTrackTruthFilterTool::m_fFragHistogram
TH2 * m_fFragHistogram
Definition: InDetTrackTruthFilterTool.h:94
InDet::InDetTrackTruthFilterTool::m_trkEffHistTightIBL
TH2 * m_trkEffHistTightIBL
Definition: InDetTrackTruthFilterTool.h:104
histogram
std::string histogram
Definition: chains.cxx:52