ATLAS Offline Software
CustomGetterUtils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
24 
25 
26 // EDM includes
27 #include "xAODJet/JetFwd.h"
29 #include "xAODBase/IParticle.h"
32 
33 #include <functional>
34 #include <string>
35 #include <set>
36 
37 #ifndef CUSTOM_GETTER_UTILS_H
38 #define CUSTOM_GETTER_UTILS_H
39 
40 namespace FlavorTagDiscriminants {
41 
42  namespace getter_utils {
43 
44  // -------------------------------------------------------
45  // type aliases
46  template <typename T>
47  using Constituents = std::vector<const T*>;
48 
49  template <typename T>
50  using SequenceGetterFunc = std::function<std::vector<double>(const xAOD::Jet&, const Constituents<T>&)>;
51  // -------------------------------------------------------
52 
53  std::function<std::pair<std::string, double>(const xAOD::Jet&)>
54  namedCustomJetGetter(const std::string&);
55 
56  template <typename T>
57  std::pair<SequenceGetterFunc<T>, std::set<std::string>>
58  buildCustomSeqGetter(const std::string& name, const std::string& prefix);
59 
69  template <typename T>
70  class SeqGetter {
71  public:
73  using InputSequence = std::function<std::pair<std::string, std::vector<double>>(
74  const xAOD::Jet&,
75  const Const&)>;
76 
77  SeqGetter(std::vector<InputVariableConfig> inputs, const FTagOptions& options);
78 
79  std::pair<std::vector<float>, std::vector<int64_t>> getFeats(const xAOD::Jet& jet, const Const& constituents) const;
80  std::map<std::string, std::vector<double>> getDL2Feats(const xAOD::Jet& jet, const Const& constituents) const;
81 
82  std::set<std::string> getDependencies() const;
83  std::set<std::string> getUsedRemap() const;
84 
85  private:
86  std::pair<InputSequence, std::set<std::string>> getNamedCustomSeqGetter(
87  const std::string& name,
88  const std::string& prefix);
89  std::pair<InputSequence, std::set<std::string>> seqFromConsituents(
90  const InputVariableConfig& cfg,
91  const FTagOptions& options);
92  std::vector<InputSequence> m_sequence_getters;
93  std::set<std::string> m_deps;
94  std::set<std::string> m_used_remap;
95  };
96  }
97 }
98 
99 #endif
FlavorTagDiscriminants::getter_utils::SeqGetter::getFeats
std::pair< std::vector< float >, std::vector< int64_t > > getFeats(const xAOD::Jet &jet, const Const &constituents) const
Definition: CustomGetterUtils.cxx:414
FlavorTagDiscriminants::getter_utils::SeqGetter::getDL2Feats
std::map< std::string, std::vector< double > > getDL2Feats(const xAOD::Jet &jet, const Const &constituents) const
Definition: CustomGetterUtils.cxx:441
IParticle.h
FlavorTagDiscriminants
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition: AssociationEnums.h:11
FlavorTagDiscriminants::getter_utils::SeqGetter::m_sequence_getters
std::vector< InputSequence > m_sequence_getters
Definition: CustomGetterUtils.h:92
FlavorTagDiscriminants::getter_utils::SequenceGetterFunc
std::function< std::vector< double >(const xAOD::Jet &, const Constituents< T > &)> SequenceGetterFunc
Definition: CustomGetterUtils.h:50
FlavorTagDiscriminants::getter_utils::SeqGetter
Template class to extract features from sequence of constituents.
Definition: CustomGetterUtils.h:70
FlavorTagDiscriminants::getter_utils::buildCustomSeqGetter
std::pair< SequenceGetterFunc< T >, std::set< std::string > > buildCustomSeqGetter(const std::string &name, const std::string &prefix)
Definition: CustomGetterUtils.cxx:329
FlavorTagDiscriminants::getter_utils::SeqGetter::seqFromConsituents
std::pair< InputSequence, std::set< std::string > > seqFromConsituents(const InputVariableConfig &cfg, const FTagOptions &options)
Definition: CustomGetterUtils.cxx:363
FlavorTagDiscriminants::getter_utils::SeqGetter::m_deps
std::set< std::string > m_deps
Definition: CustomGetterUtils.h:93
FlavorTagDiscriminants::getter_utils::SeqGetter< xAOD::IParticle >::InputSequence
std::function< std::pair< std::string, std::vector< double > >(const xAOD::Jet &, const Const &)> InputSequence
Definition: CustomGetterUtils.h:75
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
FlavorTagDiscriminants::getter_utils::namedCustomJetGetter
std::function< std::pair< std::string, double >const xAOD::Jet &)> namedCustomJetGetter(const std::string &)
Definition: CustomGetterUtils.cxx:318
FlavorTagDiscriminants::getter_utils::SeqGetter::m_used_remap
std::set< std::string > m_used_remap
Definition: CustomGetterUtils.h:94
FlavorTagDiscriminants::getter_utils::SeqGetter::getDependencies
std::set< std::string > getDependencies() const
Definition: CustomGetterUtils.cxx:452
FlavorTagDiscriminants::getter_utils::SeqGetter< xAOD::IParticle >::Const
Constituents< xAOD::IParticle > Const
Definition: CustomGetterUtils.h:72
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
DataPrepUtilities.h
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
FlavorTagDiscriminants::getter_utils::Constituents
std::vector< const T * > Constituents
Definition: CustomGetterUtils.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
JetFwd.h
FlavorTagDiscriminants::FTagOptions
Definition: DataPrepUtilities.h:45
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
TrackParticleFwd.h
FlavorTagDiscriminants::getter_utils::SeqGetter::getUsedRemap
std::set< std::string > getUsedRemap() const
Definition: CustomGetterUtils.cxx:456
FlavorTagDiscriminants::InputVariableConfig
Definition: ConstituentsLoader.h:53
FlavorTagDiscriminants::getter_utils::SeqGetter::SeqGetter
SeqGetter(std::vector< InputVariableConfig > inputs, const FTagOptions &options)
Definition: CustomGetterUtils.cxx:389
AuxElement.h
Base class for elements of a container that can have aux data.
FlavorTagDiscriminants::getter_utils::SeqGetter::getNamedCustomSeqGetter
std::pair< InputSequence, std::set< std::string > > getNamedCustomSeqGetter(const std::string &name, const std::string &prefix)
Definition: CustomGetterUtils.cxx:351