ATLAS Offline Software
JetCleaningTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef JETSELECTORTOOLS_JETCLEANINGTOOL_H
6 #define JETSELECTORTOOLS_JETCLEANINGTOOL_H
7 
16 // Stdlib includes
17 #include <string>
18 #include <vector>
19 #include <unordered_map>
20 
21 // Base classes
22 #include "AsgTools/AsgTool.h"
28 
29 
30 // The xAOD jet type
31 #include "xAODJet/Jet.h"
32 
33 // Return object
34 #include "PATCore/AcceptInfo.h"
35 #include "PATCore/AcceptData.h"
36 
37 namespace JCT { class HotCell; }
38 
39 class JetCleaningTool : public asg::AsgTool, virtual public IJetDecorator, virtual public IJetSelector
40 {
41 
43 
44 public:
47  {
55  };
56 
58  JetCleaningTool(const std::string &name = "JetCleaningTool");
59 
61  JetCleaningTool(const CleaningLevel alevel, const bool doUgly = false);
62 
64  JetCleaningTool(const std::string &name, const CleaningLevel alevel, const bool doUgly = false);
65 
67  virtual ~JetCleaningTool();
68 
70  virtual StatusCode initialize() override;
71 
73  {
74  return m_accept;
75  }
76 
78  asg::AcceptData accept( const int isJetClean, const int fmaxIndex ) const;
79 
81  asg::AcceptData accept( const int isJetClean,
82  const double sumpttrk, //in MeV, same as sumpttrk
83  const double fmax,
84  const double eta,
85  const double pt,
86  const int fmaxIndex ) const;
87 
89  asg::AcceptData accept( const double emf,
90  const double hecf,
91  const double larq,
92  const double hecq,
93  const double sumpttrk, //in MeV, same as sumpttrk
94  const double eta, //emscale Eta
95  const double pt, //in MeV, same as sumpttrk
96  const double fmax,
97  const double negE , //in MeV
98  const double AverageLArQF,
99  const int fMaxIndex ) const;
100 
102  asg::AcceptData accept( const xAOD::Jet& jet) const;
103 
104  int keep(const xAOD::Jet& jet) const final
105  { return static_cast<bool>(accept(jet)); }
106 
107  virtual StatusCode decorate(const xAOD::JetContainer &jets) const override;
108 
110  bool containsHotCells( const xAOD::Jet& jet, const unsigned int runNumber) const;
111 
113  CleaningLevel getCutLevel( const std::string& ) const;
114  std::string getCutName( const CleaningLevel ) const;
115 
116  private:
117 
119  Gaudi::Property<std::string> m_cutName{this, "CutLevel", "" };
121  Gaudi::Property<bool> m_doUgly{this, "DoUgly", false};
122  Gaudi::Property<bool> m_useDecorations{this, "UseDecorations", true};
123  Gaudi::Property<bool> m_useLooseDecorForTightCut{this, "UseLooseDecorForTightCut", false};
124  SG::ConstAccessor<char> m_acc_jetClean{"DFCommonJets_jetClean_LooseBad"};
125 
126  //
127  Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", "SG key for input jet container"};
128  SG::WriteDecorHandleKey<xAOD::JetContainer> m_jetCleanKey{this, "JetCleaningName", "isClean", "SG key for output jet cleaning decoration"};
130 
132  Gaudi::Property<std::string> m_hotCellsFile{this, "HotCellsFile", ""};
133  std::unordered_map<unsigned int, std::vector<std::unique_ptr<JCT::HotCell>>> m_hotCellsMap;
135 
136  void missingVariable(const std::string& varName) const;
137 
138 }; // End: class definition
139 
140 
141 
142 #endif
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
JetCleaningTool::m_jetCleanKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetCleanKey
Definition: JetCleaningTool.h:128
Jet.h
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
JetCleaningTool::m_useLooseDecorForTightCut
Gaudi::Property< bool > m_useLooseDecorForTightCut
Definition: JetCleaningTool.h:123
JetCleaningTool::TightBad
@ TightBad
Definition: JetCleaningTool.h:53
JetCleaningTool::accept
asg::AcceptData accept(const int isJetClean, const int fmaxIndex) const
The DFCommonJets decoration accept method.
Definition: JetCleaningTool.cxx:145
JetCleaningTool::m_hotCellsFile
Gaudi::Property< std::string > m_hotCellsFile
Hot cells caching.
Definition: JetCleaningTool.h:132
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
JetCleaningTool::initialize
virtual StatusCode initialize() override
Initialize method.
Definition: JetCleaningTool.cxx:116
JetCleaningTool::VeryLooseBadLLP
@ VeryLooseBadLLP
Definition: JetCleaningTool.h:49
JetCleaningTool
Class for selecting jets that pass cleaning cuts.
Definition: JetCleaningTool.h:40
JetCleaningTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetCleaningTool.cxx:374
test_pyathena.pt
pt
Definition: test_pyathena.py:11
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetCleaningTool::LooseBad
@ LooseBad
Definition: JetCleaningTool.h:50
JetCleaningTool::LooseBadTrigger
@ LooseBadTrigger
Definition: JetCleaningTool.h:52
JetCleaningTool::JetCleaningTool
JetCleaningTool(const std::string &name="JetCleaningTool")
Standard constructor.
Definition: JetCleaningTool.cxx:89
SG::ConstAccessor< char >
JetCleaningTool::UnknownCut
@ UnknownCut
Definition: JetCleaningTool.h:54
IJetSelector.h
JetCleaningTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetCleaningTool.h:127
IJetDecorator.h
JetCleaningTool::m_doUgly
Gaudi::Property< bool > m_doUgly
Definition: JetCleaningTool.h:121
JetCleaningTool::CleaningLevel
CleaningLevel
Levels of cut.
Definition: JetCleaningTool.h:47
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
JetCleaningTool::~JetCleaningTool
virtual ~JetCleaningTool()
Standard destructor.
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetCleaningTool::m_cutName
Gaudi::Property< std::string > m_cutName
Name of the cut.
Definition: JetCleaningTool.h:119
asg::AcceptInfo
Definition: AcceptInfo.h:28
PixelAthClusterMonAlgCfg.varName
string varName
end cluster ToT and charge
Definition: PixelAthClusterMonAlgCfg.py:125
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JCT
Definition: PhysicsAnalysis/JetMissingEtID/JetSelectorTools/JetSelectorTools/Helpers.h:22
JetCleaningTool::m_accept
asg::AcceptInfo m_accept
Definition: JetCleaningTool.h:129
JetCleaningTool::LooseBadLLP
@ LooseBadLLP
Definition: JetCleaningTool.h:51
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AcceptData.h
JetCleaningTool::m_acc_jetClean
SG::ConstAccessor< char > m_acc_jetClean
Definition: JetCleaningTool.h:124
JetCleaningTool::containsHotCells
bool containsHotCells(const xAOD::Jet &jet, const unsigned int runNumber) const
Hot cell checks.
Definition: JetCleaningTool.cxx:389
JetCleaningTool::keep
int keep(const xAOD::Jet &jet) const final
Method to select.
Definition: JetCleaningTool.h:104
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IJetSelector
IJetSelector is a dual-use tool interface for a tool that selects a jet.
Definition: IJetSelector.h:19
WriteDecorHandleKey.h
AcceptInfo.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
JetCleaningTool::m_cutLevel
CleaningLevel m_cutLevel
Definition: JetCleaningTool.h:120
JetCleaningTool::getCutLevel
CleaningLevel getCutLevel(const std::string &) const
Helpers for cut names.
Definition: JetCleaningTool.cxx:405
JetCleaningTool::readHotCells
StatusCode readHotCells()
Hot cells reading helper.
Definition: JetCleaningTool.cxx:430
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetCleaningTool::m_hotCellsMap
std::unordered_map< unsigned int, std::vector< std::unique_ptr< JCT::HotCell > > > m_hotCellsMap
Definition: JetCleaningTool.h:133
JetCleaningTool::missingVariable
void missingVariable(const std::string &varName) const
Definition: JetCleaningTool.cxx:292
AsgTool.h
asg::AcceptData
Definition: AcceptData.h:30
JetCleaningTool::getCutName
std::string getCutName(const CleaningLevel) const
Definition: JetCleaningTool.cxx:417
JetCleaningTool::m_useDecorations
Gaudi::Property< bool > m_useDecorations
Definition: JetCleaningTool.h:122
JetCleaningTool::SuperLooseBadLLP
@ SuperLooseBadLLP
Definition: JetCleaningTool.h:48
JetCleaningTool::getAcceptInfo
const asg::AcceptInfo & getAcceptInfo() const
Definition: JetCleaningTool.h:72