ATLAS Offline Software
TauWPDecorator.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 TAURECTOOLS_TAUWPDECORATOR_H
6 #define TAURECTOOLS_TAUWPDECORATOR_H
7 
11 #include "xAODTau/TauDefs.h"
15 
16 #include <utility>
17 #include <memory>
18 #include <vector>
19 #include <map>
20 
21 class TH2;
22 
37  public:
38 
40 
41 
42  TauWPDecorator(const std::string& name="TauWPDecorator");
43 
46 
48  virtual StatusCode initialize() override;
49 
51  virtual StatusCode execute(xAOD::TauJet& tau) const override;
52 
53  private:
54 
59  StatusCode retrieveHistos(int nProng);
60 
65  StatusCode storeLimits(int nProng);
66 
75  double transformScore(double score, double cutLow, double effLow, double cutHigh, double effHigh) const;
76 
77  Gaudi::Property<bool> m_useAbsEta{this, "UseAbsEta", false, "Whether we are flatterning electron veto WP"};
78  Gaudi::Property<bool> m_defineWPs{this, "DefineWPs", false, "Whether to decorate the WPs"};
79  Gaudi::Property<std::string> m_scoreName{this, "ScoreName", "", "Name of the original score"};
80  Gaudi::Property<std::string> m_scoreNameTrans{this, "NewScoreName", "", "Name of the transformed score"};
81  Gaudi::Property<std::string> m_file0p{this, "flatteningFile0Prong", "", "Calibration file name of 0-prong taus"};
82  Gaudi::Property<std::string> m_file1p{this, "flatteningFile1Prong", "", "Calibration file name of 1-prong taus"};
83  Gaudi::Property<std::string> m_file2p{this, "flatteningFile2Prong", "", "Calibration file name of 2-prong taus"};
84  Gaudi::Property<std::string> m_file3p{this, "flatteningFile3Prong", "", "Calibration file name of 3-prong taus"};
85  Gaudi::Property<std::vector<int>> m_EDMWPs{this, "CutEnumVals", {}, "Vector of WPs in the EDM"};
86  Gaudi::Property<std::vector<float>> m_EDMWPEffs0p{this, "SigEff0P", {}, "Efficiency of each WP in EDM for 0-prong taus"};
87  Gaudi::Property<std::vector<float>> m_EDMWPEffs1p{this, "SigEff1P", {}, "Efficiency of each WP in EDM for 1-prong taus"};
88  Gaudi::Property<std::vector<float>> m_EDMWPEffs2p{this, "SigEff2P", {}, "Efficiency of each WP in EDM for 2-prong taus"};
89  Gaudi::Property<std::vector<float>> m_EDMWPEffs3p{this, "SigEff3P", {}, "Efficiency of each WP in EDM for 3-prong taus"};
90  Gaudi::Property<std::vector<std::string>> m_decorWPs{this, "DecorWPNames", {}, "Name of WPs"};
91  Gaudi::Property<std::vector<float>> m_decorWPEffs0p{this, "DecorWPCutEffs0P", {}, "Efficiency of each WP to be docorated for 0-prong taus"};
92  Gaudi::Property<std::vector<float>> m_decorWPEffs1p{this, "DecorWPCutEffs1P", {}, "Efficiency of each WP to be docorated for 1-prong taus"};
93  Gaudi::Property<std::vector<float>> m_decorWPEffs2p{this, "DecorWPCutEffs2P", {}, "Efficiency of each WP to be docorated for 2-prong taus"};
94  Gaudi::Property<std::vector<float>> m_decorWPEffs3p{this, "DecorWPCutEffs3P", {}, "Efficiency of each WP to be docorated for 3-prong taus"};
95  // for WPs not implemented in the EDM (i.e. not encoded in IsTauFlag)
96  // use Accessors unless necessary
97  std::vector<SG::AuxElement::Accessor<char>> m_charDecors;
98  // when data handles are required (currently in tau trigger offline monitoring), need to use Write(Read)DecorHandleKeys
99  // redundant with above accessors, will be improved in the future but has implications for DAOD workflow
100  Gaudi::Property<std::string> m_tauContainerName{this, "TauContainerName", "", "Name of TauJetContainer, must be set when using "};
101  SG::WriteDecorHandleKeyArray<xAOD::TauJetContainer> m_decorHandleKeys {this, "DecorHandleKeys",{},"Name of WPs to be decorated"};
102 
104  "averageInteractionsPerCrossingKey",
105  "EventInfo.averageInteractionsPerCrossing",
106  "Decoration for Average Interaction Per Crossing"};
107 
108  typedef std::pair<double, std::shared_ptr<TH2> > m_pair_t;
109 
110  std::shared_ptr<std::vector<m_pair_t>> m_hists0p;
111  std::shared_ptr<std::vector<m_pair_t>> m_hists1p;
112  std::shared_ptr<std::vector<m_pair_t>> m_hists2p;
113  std::shared_ptr<std::vector<m_pair_t>> m_hists3p;
114 
115  std::map<int, double> m_xMin;
116  std::map<int, double> m_yMin;
117  std::map<int, double> m_xMax;
118  std::map<int, double> m_yMax;
119 };
120 
121 #endif // TAURECTOOLS_TAUWPDECORATOR_H
WriteDecorHandleKeyArray.h
TauWPDecorator
Implementation of tool to decorate flattened BDT score and working points.
Definition: TauWPDecorator.h:36
PropertyWrapper.h
TauWPDecorator::m_charDecors
std::vector< SG::AuxElement::Accessor< char > > m_charDecors
Definition: TauWPDecorator.h:97
TauWPDecorator::m_yMax
std::map< int, double > m_yMax
Map of n-prong and the maximum value of y variables.
Definition: TauWPDecorator.h:118
TauWPDecorator::m_EDMWPEffs2p
Gaudi::Property< std::vector< float > > m_EDMWPEffs2p
Definition: TauWPDecorator.h:88
TauWPDecorator::m_decorHandleKeys
SG::WriteDecorHandleKeyArray< xAOD::TauJetContainer > m_decorHandleKeys
Definition: TauWPDecorator.h:101
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
TauWPDecorator::m_decorWPs
Gaudi::Property< std::vector< std::string > > m_decorWPs
Definition: TauWPDecorator.h:90
TauWPDecorator::m_EDMWPEffs3p
Gaudi::Property< std::vector< float > > m_EDMWPEffs3p
Definition: TauWPDecorator.h:89
TauRecToolBase.h
TauRecToolBase
The base class for all tau tools.
Definition: TauRecToolBase.h:21
TauWPDecorator::m_xMax
std::map< int, double > m_xMax
Map of n-prong and the maximum value of x variables.
Definition: TauWPDecorator.h:117
TauWPDecorator::~TauWPDecorator
~TauWPDecorator()
Destructor.
Definition: TauWPDecorator.cxx:21
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
TauWPDecorator::transformScore
double transformScore(double score, double cutLow, double effLow, double cutHigh, double effHigh) const
Obtain the flattened score.
Definition: TauWPDecorator.cxx:125
TauWPDecorator::initialize
virtual StatusCode initialize() override
Initialization of this tool.
Definition: TauWPDecorator.cxx:132
TauWPDecorator::m_decorWPEffs0p
Gaudi::Property< std::vector< float > > m_decorWPEffs0p
Definition: TauWPDecorator.h:91
TauWPDecorator::m_EDMWPEffs0p
Gaudi::Property< std::vector< float > > m_EDMWPEffs0p
Definition: TauWPDecorator.h:86
TauWPDecorator::m_hists1p
std::shared_ptr< std::vector< m_pair_t > > m_hists1p
Efficiency and corresponding score distributions of 1-prong taus.
Definition: TauWPDecorator.h:111
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
TauWPDecorator::m_EDMWPs
Gaudi::Property< std::vector< int > > m_EDMWPs
Definition: TauWPDecorator.h:85
TauWPDecorator::m_decorWPEffs1p
Gaudi::Property< std::vector< float > > m_decorWPEffs1p
Definition: TauWPDecorator.h:92
TauWPDecorator::m_aveIntPerXKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_aveIntPerXKey
Definition: TauWPDecorator.h:103
TauDefs.h
TauWPDecorator::m_scoreName
Gaudi::Property< std::string > m_scoreName
Definition: TauWPDecorator.h:79
TauWPDecorator::TauWPDecorator
TauWPDecorator(const std::string &name="TauWPDecorator")
Constructor.
Definition: TauWPDecorator.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauWPDecorator::m_hists0p
std::shared_ptr< std::vector< m_pair_t > > m_hists0p
Efficiency and corresponding score distributions of 0-prong taus.
Definition: TauWPDecorator.h:110
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
TauWPDecorator::m_xMin
std::map< int, double > m_xMin
Map of n-prong and the minimum value of x variables.
Definition: TauWPDecorator.h:115
TauWPDecorator::storeLimits
StatusCode storeLimits(int nProng)
Obtain the limit of the dependent variables.
Definition: TauWPDecorator.cxx:79
TauWPDecorator::m_EDMWPEffs1p
Gaudi::Property< std::vector< float > > m_EDMWPEffs1p
Definition: TauWPDecorator.h:87
TauWPDecorator::m_hists2p
std::shared_ptr< std::vector< m_pair_t > > m_hists2p
Efficiency and corresponding score distributions of 2-prong taus.
Definition: TauWPDecorator.h:112
TauWPDecorator::m_file3p
Gaudi::Property< std::string > m_file3p
Definition: TauWPDecorator.h:84
TauJetContainer.h
TauWPDecorator::m_file2p
Gaudi::Property< std::string > m_file2p
Definition: TauWPDecorator.h:83
TauWPDecorator::m_file0p
Gaudi::Property< std::string > m_file0p
Definition: TauWPDecorator.h:81
TauWPDecorator::m_file1p
Gaudi::Property< std::string > m_file1p
Definition: TauWPDecorator.h:82
TauWPDecorator::execute
virtual StatusCode execute(xAOD::TauJet &tau) const override
Executation of this tool.
Definition: TauWPDecorator.cxx:183
TauWPDecorator::m_yMin
std::map< int, double > m_yMin
Map of n-prong and the minimum value of y variables.
Definition: TauWPDecorator.h:116
TauWPDecorator::m_useAbsEta
Gaudi::Property< bool > m_useAbsEta
Definition: TauWPDecorator.h:77
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TauWPDecorator::m_tauContainerName
Gaudi::Property< std::string > m_tauContainerName
Definition: TauWPDecorator.h:100
ITauToolBase
The base class for all tau tools.
Definition: ITauToolBase.h:30
EventInfo.h
xAOD::score
@ score
Definition: TrackingPrimitives.h:514
TauWPDecorator::m_scoreNameTrans
Gaudi::Property< std::string > m_scoreNameTrans
Definition: TauWPDecorator.h:80
TauWPDecorator::m_decorWPEffs3p
Gaudi::Property< std::vector< float > > m_decorWPEffs3p
Definition: TauWPDecorator.h:94
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
TauWPDecorator::m_defineWPs
Gaudi::Property< bool > m_defineWPs
Definition: TauWPDecorator.h:78
TauWPDecorator::m_hists3p
std::shared_ptr< std::vector< m_pair_t > > m_hists3p
Efficiency and corresponding score distributions of 3-prong taus.
Definition: TauWPDecorator.h:113
TauWPDecorator::retrieveHistos
StatusCode retrieveHistos(int nProng)
Retrieve the histograms containing BDT/RNN score distributions as a function of dependent variables.
Definition: TauWPDecorator.cxx:25
TauWPDecorator::m_decorWPEffs2p
Gaudi::Property< std::vector< float > > m_decorWPEffs2p
Definition: TauWPDecorator.h:93
TauWPDecorator::m_pair_t
std::pair< double, std::shared_ptr< TH2 > > m_pair_t
Definition: TauWPDecorator.h:108