7#ifndef PROMPT_DECORATEPROMPTLEPTONRNN_H
8#define PROMPT_DECORATEPROMPTLEPTONRNN_H
30#include "GaudiKernel/ToolHandle.h"
42#include "TMVA/Reader.h"
43#include "TStopwatch.h"
46#include <unordered_map>
69 virtual StatusCode
execute()
override;
70 virtual StatusCode
finalize()
override;
86 std::vector<decoratorFloatH_t>& floatDecors,
87 std::vector<decoratorShortH_t>& shortDecors
94 std::vector<decoratorFloatH_t>& floatDecors,
95 std::vector<decoratorShortH_t>& shortDecors
128 std::vector<decoratorFloatH_t>& floatDecors,
129 std::vector<decoratorShortH_t>& shortDecors
149 this,
"LeptonContainerName",
"",
150 "Container's name of the lepton that you want to decorate. Also need to set ElectronContainerKey or MuonContainerKey accordingly"
153 Gaudi::Property<std::string>
m_configFileVersion {
this,
"ConfigFileVersion",
"",
"BDT weight file version"};
154 Gaudi::Property<std::string>
m_configPathOverride {
this,
"ConfigPathOverride",
"",
"Path of the local BDT weight file you want to study/test"};
155 Gaudi::Property<std::string>
m_inputVarDecoratePrefix {
this,
"InputVarDecoratePrefix",
"",
"Prefix of the variables that will be decorated into the lepton"};
156 Gaudi::Property<std::string>
m_BDTName {
this,
"BDTName",
"",
"BDT name"};
157 Gaudi::Property<std::string>
m_methodTitleMVA {
this,
"MethodTitleMVA",
"BDT",
"Help to config the path of the BDT xml file"};
159 Gaudi::Property<std::vector<std::string>>
m_accessorRNNVars {
this,
"accessorRNNVars", {},
"Name of the RNN accessor of the lepton"};
160 Gaudi::Property<std::vector<std::string>>
m_stringIntVars {
this,
"stringIntVars", {},
"Vector of the BDT int variables' names and they will be decorated into lepton if not in the veto list"};
161 Gaudi::Property<std::vector<std::string>>
m_stringFloatVars {
this,
"stringFloatVars", {},
"Vector of the BDT float variables' names and they will be decorated into lepton if not in the veto list"};
162 Gaudi::Property<std::vector<std::string>>
m_extraDecoratorFloatVars {
this,
"extraDecoratorFloatVars", {},
"Extra float variables' names you want to compute and decorate into the lepton"};
163 Gaudi::Property<std::vector<std::string>>
m_extraDecoratorShortVars {
this,
"extraDecoratorShortVars", {},
"Extra short variables' names you want to compute and decorate into the lepton"};
164 Gaudi::Property<std::vector<std::string>>
m_vetoDecoratorFloatVars {
this,
"vetoDecoratorFloatVars", {},
"Vector of the float variables' names you do not want to save"};
165 Gaudi::Property<std::vector<std::string>>
m_vetoDecoratorShortVars {
this,
"vetoDecoratorShortVars", {},
"Vector of the short variables' names you do not want to save"};
166 Gaudi::Property<std::vector<double>>
m_leptonPtBinsVector {
this,
"leptonPtBinsVector", {},
"pT bin edges that are used for MVABin calculation"};
168 Gaudi::Property<bool>
m_printTime {
this,
"PrintTime",
false,
"Whether to print current time"};
170 Gaudi::Property<std::string>
m_vertexLinkName {
this,
"VertexLinkName",
"",
"ElementLink name of the secondary vertices"};
172 Gaudi::Property<double>
m_vertexMinThetaBarrElec {
this,
"VertexMinThetaBarrElec", 0.002,
"Vertex theta between lepton and the direction of sv-pv cut for barrel electrons"};
173 Gaudi::Property<double>
m_vertexMinThetaEcapElec {
this,
"VertexMinThetaEcapElec", 0.001,
"Vertex theta between lepton and the direction of sv-pv cut for central electrons"};
174 Gaudi::Property<double>
m_vertexBarrEcapAbsEtaAt {
this,
"VertexBarrEcapAbsEtaAt", 1.37,
"Relate to the vertex cut above, define the barrel and central electrons by abs(eta)"};
175 Gaudi::Property<double>
m_elecMinCalErelConeSize {
this,
"ElecMinCalErelConeSize", 0.15,
"Cut of the cluster for calculating the core energy of the lepton"};
176 Gaudi::Property<double>
m_maxLepTrackJetDR {
this,
"maxLepTrackJetDR", 0.4,
"Maximum distance between lepton and track jet for track jet matching"};
180 this,
"TrackJetContainerName",
"",
"Track Jet container name"
183 this,
"PrimaryVertexContainerName",
"",
"Primary vertex container name"
186 this,
"ClusterContainerName",
"",
187 "Container name of the Clusters which are used to calculate the input variables for the PromptLeptonImproved"
191 this,
"ElectronContainerKey",
"Electrons",
192 "Container's name of the electrons that you want to decorate"
195 this,
"MuonContainerKey",
"Muons",
196 "Container's name of the muons that you want to decorate"
205 std::unique_ptr<Prompt::VarHolder>
m_vars;
224 {
this,
"FloatDecorHandleKeys", {} };
226 {
this,
"ShortDecorHandleKeys", {} };
Helper class to provide constant type-safe access to aux data.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
DecorMap_t m_shortDecorMap
SG::WriteDecorHandle< xAOD::IParticleContainer, short > decoratorShortH_t
std::pair< double, const xAOD::Jet * > findTrackJet(const T &part, const xAOD::JetContainer &jets)
Gaudi::Property< double > m_maxLepTrackJetDR
Gaudi::Property< std::string > m_configFileVersion
virtual StatusCode execute() override
Gaudi::Property< double > m_vertexMinThetaEcapElec
StatusCode initializeDecorators()
Gaudi::Property< std::vector< double > > m_leptonPtBinsVector
Gaudi::Property< std::vector< std::string > > m_vetoDecoratorShortVars
Gaudi::Property< std::string > m_leptonsName
virtual StatusCode initialize() override
Gaudi::Property< double > m_elecMinCalErelConeSize
void getMutualVariables(const xAOD::IParticle &particle, const xAOD::Jet &track_jet, const xAOD::TrackParticle *track, Prompt::VarHolder &vars) const
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexKey
Gaudi::Property< double > m_vertexBarrEcapAbsEtaAt
Gaudi::Property< bool > m_printTime
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_shortDecorHandleKeys
std::vector< Prompt::Def::Var > m_floatVars
void initializeConstAccessors()
Gaudi::Property< std::vector< std::string > > m_stringFloatVars
Gaudi::Property< std::string > m_vertexLinkName
SG::WriteDecorHandle< xAOD::IParticleContainer, float > decoratorFloatH_t
std::unordered_map< Def::Var, size_t > DecorMap_t
SG::ConstAccessor< std::vector< ElementLink< xAOD::VertexContainer > > > AccessVertex
Gaudi::Property< double > m_vertexMinThetaBarrElec
std::vector< Prompt::Def::Var > m_allVars
Gaudi::Property< std::vector< std::string > > m_extraDecoratorShortVars
DecorMap_t m_floatDecorMap
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_floatDecorHandleKeys
floatAccessorMap m_accessRNNMap
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainerKey
double getVertexCosThetaWithLepDir(const xAOD::IParticle &lepton, const xAOD::Vertex *secondaryVertex, const xAOD::Vertex *primaryVertex) const
Gaudi::Property< std::string > m_BDTName
void fillVarDefault(Prompt::VarHolder &vars) const
std::unique_ptr< TH1D > m_leptonPtBinHist
Gaudi::Property< std::string > m_methodTitleMVA
Gaudi::Property< std::string > m_inputVarDecoratePrefix
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
void decorateElec(const xAOD::Electron &electron, const xAOD::JetContainer &trackJets, const xAOD::CaloClusterContainer &clusters, const xAOD::Vertex *primaryVertex, std::vector< decoratorFloatH_t > &floatDecors, std::vector< decoratorShortH_t > &shortDecors)
DecoratePromptLeptonImproved(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< Float_t > m_varTMVA
void getMuonAnpVariables(const xAOD::Muon &muon, Prompt::VarHolder &vars, const xAOD::Vertex *primaryVertex) const
Gaudi::Property< std::vector< std::string > > m_extraDecoratorFloatVars
std::map< Prompt::Def::Var, AccessFloat > floatAccessorMap
void getElectronAnpVariables(const xAOD::Electron &elec, const xAOD::CaloClusterContainer &clusters, Prompt::VarHolder &vars, const xAOD::Vertex *primaryVertex)
void addVarsToTMVA(Prompt::VarHolder &vars)
Gaudi::Property< std::vector< std::string > > m_accessorRNNVars
double getVertexLongitudinalNormDist(const xAOD::IParticle &lepton, const xAOD::Vertex *secondaryVertex, const xAOD::Vertex *primaryVertex) const
Prompt::Def::Var m_BDTVarKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
void decorateAuxLepton(const xAOD::IParticle &particle, Prompt::VarHolder &vars, std::vector< decoratorFloatH_t > &floatDecors, std::vector< decoratorShortH_t > &shortDecors) const
Gaudi::Property< double > m_vertexMinChiSquaredProb
std::unique_ptr< Prompt::VarHolder > m_vars
Gaudi::Property< std::vector< std::string > > m_vetoDecoratorFloatVars
bool initializeTMVAReader()
std::unique_ptr< TMVA::Reader > m_TMVAReader
virtual StatusCode finalize() override
std::vector< Prompt::Def::Var > m_intVars
std::optional< AccessVertex > m_accessDeepSecondaryVertex
Gaudi::Property< std::string > m_configPathOverride
SG::ConstAccessor< float > AccessFloat
Gaudi::Property< std::vector< std::string > > m_stringIntVars
float accessIsolation(const SG::ConstAccessor< float > &isoAccessor, const xAOD::IParticle &particle) const
SG::ReadHandleKey< xAOD::JetContainer > m_trackJetsKey
void decorateMuon(const xAOD::Muon &muon, const xAOD::JetContainer &trackJets, const xAOD::Vertex *primaryVertex, std::vector< decoratorFloatH_t > &floatDecors, std::vector< decoratorShortH_t > &shortDecors)
Helper class to provide constant type-safe access to aux data.
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
Class providing the definition of the 4-vector interface.
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
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.
Muon_v1 Muon
Reference the current persistent version:
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Electron_v1 Electron
Definition of the current "egamma version".