ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
top::JetCleaningSelector Class Reference

Event selection using the official jet cleaning tool. More...

#include <JetCleaningSelector.h>

Inheritance diagram for top::JetCleaningSelector:
Collaboration diagram for top::JetCleaningSelector:

Public Member Functions

 JetCleaningSelector (const std::string &level, std::shared_ptr< top::TopConfig > config)
 Setup the jet group's cleaning tool. More...
 
bool apply (const top::Event &event) const override
 Only accept the event if the tool says all the jets are okay. More...
 
std::string name () const override
 Print the name of the tool and level. More...
 
virtual bool applyParticleLevel (const top::ParticleLevelEvent &) const
 This does stuff based on the information in a particle level event. More...
 

Private Member Functions

bool checkBadBatman (const top::Event &event) const
 A helper function to check if the event passes BadBatman cleaning in a specified range (from config) of RunNUmbers. More...
 

Private Attributes

ToolHandle< IJetSelectorm_jetCleaningToolLooseBad
 The jet cleaning tools. More...
 
ToolHandle< IJetSelectorm_jetCleaningToolTightBad
 
ToolHandle< ECUtils::IEventCleaningToolm_jetEventCleaningToolLooseBad
 The jet event cleaning tools. More...
 
ToolHandle< ECUtils::IEventCleaningToolm_jetEventCleaningToolTightBad
 
std::string m_level
 The level to configure to, so we can print it in the name. More...
 
bool m_useLooseBad
 
bool m_useEventLevelJetCleaningTool
 
std::shared_ptr< top::TopConfigm_config
 

Detailed Description

Event selection using the official jet cleaning tool.

Hurray! The jet cleaning tool is one one of the few that exists in xAOD format already)

Call the jet cleaning tool and reject the event if any of the jets that passed the event selection are marked as bad. Probably should check that this is okay after overlap removal.

Definition at line 28 of file JetCleaningSelector.h.

Constructor & Destructor Documentation

◆ JetCleaningSelector()

top::JetCleaningSelector::JetCleaningSelector ( const std::string &  level,
std::shared_ptr< top::TopConfig config 
)
explicit

Setup the jet group's cleaning tool.

The cutlevel is specified in the constructor as a little bit of text.

Parameters
levelHow harsh you want the cleaning to be. For example MediumBad.

Definition at line 13 of file JetCleaningSelector.cxx.

13  :
14  m_level(level),
15  m_useLooseBad(true),
16  m_config(config) {
17  if (!m_config->isTruthDxAOD()) {
18  m_jetCleaningToolLooseBad = ToolHandle<IJetSelector>("JetCleaningToolLooseBad");
19  m_jetCleaningToolTightBad = ToolHandle<IJetSelector>("JetCleaningToolTightBad");
20  m_jetEventCleaningToolLooseBad = ToolHandle<ECUtils::IEventCleaningTool>("JetEventCleaningToolLooseBad");
21  m_jetEventCleaningToolTightBad = ToolHandle<ECUtils::IEventCleaningTool>("JetEventCleaningToolTightBad");
22 
23  if (m_level != "LooseBad" && m_level != "TightBad") {
24  ATH_MSG_ERROR("JetCleaningSelector level not recognised - " << m_level << "\n"
25  << "Should be LooseBad or TightBad");
26  throw std::runtime_error ("JetCleaningSelector: Cannot continue");
27  }
28 
29  if (m_level == "LooseBad") m_useLooseBad = true;
30  if (m_level == "TightBad") m_useLooseBad = false;
31 
32 
33  m_useEventLevelJetCleaningTool = m_config->useEventLevelJetCleaningTool();
34 
35  // Checking configuration for particle-flow jets:
36  if (m_config->useParticleFlowJets()) {
38  "JetCleaningSelector: This cleaning configuration is not available for particle-flow jets. The only available configuration is\n JETCLEAN LooseBad");
39  }
40 
41  // We can't yet use jet cleaning or event cleaning tools for particle-flow jets
42  if (!m_config->useParticleFlowJets()) {
45  m_jetEventCleaningToolLooseBad.retrieve(), "Failed to retrieve JetEventCleaningToolLooseBad");
46  else top::check(m_jetEventCleaningToolTightBad.retrieve(), "Failed to retrieve JetEventCleaningToolTightBad");
47 
48  } else {
50  m_jetCleaningToolLooseBad.retrieve(), "Failed to retrieve JetCleaningToolLooseBad");
51  else top::check(m_jetCleaningToolTightBad.retrieve(), "Failed to retrieve JetCleaningToolTightBad");
52  }
53  } // end (!m_config->useParticleFlowJets())
54  }
55  }

Member Function Documentation

◆ apply()

bool top::JetCleaningSelector::apply ( const top::Event event) const
overridevirtual

Only accept the event if the tool says all the jets are okay.

Returns
True to accept the event, false otherwise.

Implements top::EventSelectorBase.

Definition at line 57 of file JetCleaningSelector.cxx.

57  {
58  if (m_config->isTruthDxAOD()) return true;
59 
60  if (m_config->useParticleFlowJets()) {
61  top::check(event.m_info->isAvailable<char>(
62  "DFCommonJets_eventClean_LooseBad"),
63  "JetCleaningSelector: DFCommonJets_eventClean_LooseBad not available in EventInfo. Needed for particle-flow jets cleaning");
64  bool result = event.m_info->auxdataConst<char>("DFCommonJets_eventClean_LooseBad");
65 
66  if (result && m_config->useBadBatmanCleaning()) {
67  // passed the standard cleaning
68  // finally, check if the BadBatman cleaning should be applied
70  }
71  return result;
72  }
73 
74  // There are two jet cleaning tools and we have a request to test the event level one
75  // These should be very close/ equivalent as we already handle the OR and JVT elsewhere
77  // If we are to use the event object, we can just do acceptEvent
78 
79  if (m_useLooseBad) return m_jetEventCleaningToolLooseBad->acceptEvent(&event.m_jets);
80  else return m_jetEventCleaningToolTightBad->acceptEvent(&event.m_jets);
81  }
82  // This is the default/standard method for jet cleaning
83  else {
84  for (const auto* const jetPtr : event.m_jets) {
85  if (m_useLooseBad) {
86  if (m_jetCleaningToolLooseBad->keep(*jetPtr) == 0) {
87  return false;
88  }
89  } else {
90  if (m_jetCleaningToolTightBad->keep(*jetPtr) == 0) {
91  return false;
92  }
93  }
94  }
95  }
96 
97  // passed the standard cleaning
98  // finally, check if the BadBatman cleaning should be applied
99  if (m_config->useBadBatmanCleaning()) {
101  }
102 
103  return true;
104  }

◆ applyParticleLevel()

virtual bool top::EventSelectorBase::applyParticleLevel ( const top::ParticleLevelEvent ) const
inlinevirtualinherited

This does stuff based on the information in a particle level event.

The idea is that you implement this to return either true or false, based on the information held within the top::ParticleLevelEvent. If this function returns true, then the event is kept, otherwise it is removed. The function has a default implementation (which returns true) because it is expected that many EventSelector objects do not operate on ParticleLevelEvent objects.

Parameters
top::ParticleLevelEventthe current particle level event.
trueif the event should be kept (i.e. it passed the selector criteria), false otherwise.

Reimplemented in top::JetNGhostSelector, top::PrintEventSelector, top::PseudoTopRecoRun, top::NElectronNMuonTightSelector, top::NElectronNMuonSelector, top::NFwdElectronSelector, top::HTSelector, top::OSLeptonTightSelector, top::MLLSelector, top::MWTSelector, top::NElectronTightSelector, top::NFwdElectronTightSelector, top::NMuonTightSelector, top::OSLeptonSelector, top::METMWTSelector, top::METSelector, top::MLLWindow, top::NElectronSelector, top::NJetSelector, top::NMuonSelector, top::NPhotonSelector, top::NSoftMuonSelector, top::NTauSelector, top::SSLeptonTightSelector, top::SSLeptonSelector, top::ParticleLevelSelector, top::RecoLevelSelector, top::NVarRCJetSelector, top::NLargeJetSelector, and top::NRCJetSelector.

Definition at line 73 of file EventSelectorBase.h.

73 {return true;}

◆ checkBadBatman()

bool top::JetCleaningSelector::checkBadBatman ( const top::Event event) const
private

A helper function to check if the event passes BadBatman cleaning in a specified range (from config) of RunNUmbers.

Returns
true if event passes

Definition at line 110 of file JetCleaningSelector.cxx.

110  {
111  // we apply this only to Data
112  if (m_config->isMC()) {
113  return true;
114  }
115  // first check if the RunNUmber are within the specified range
116  const unsigned int runNumber = event.m_info->runNumber();
117 
118  if ((m_config->badBatmanCleaningMin() >= runNumber) || (m_config->badBatmanCleaningMax() <= runNumber)) {
119  // is outside of the specified range
120  return true;
121  }
122 
123  top::check(event.m_info->isAvailable<char>(
124  "DFCommonJets_isBadBatman"),
125  "JetCleaningSelector: DFCommonJets_isBadBatman not available in EventInfo. Needed for BadBatman cleaning");
126  const bool result = event.m_info->auxdataConst<char>("DFCommonJets_isBadBatman");
127  // we need to return negation of the flag as it is true for problematic events
128  return !result;
129  }

◆ name()

std::string top::JetCleaningSelector::name ( ) const
overridevirtual

Print the name of the tool and level.

Returns
The name of the tool and the level that it has been configured at.

Implements top::EventSelectorBase.

Definition at line 106 of file JetCleaningSelector.cxx.

106  {
107  return "JETCLEAN " + m_level;
108  }

Member Data Documentation

◆ m_config

std::shared_ptr<top::TopConfig> top::JetCleaningSelector::m_config
private

Definition at line 76 of file JetCleaningSelector.h.

◆ m_jetCleaningToolLooseBad

ToolHandle<IJetSelector> top::JetCleaningSelector::m_jetCleaningToolLooseBad
private

The jet cleaning tools.

Definition at line 64 of file JetCleaningSelector.h.

◆ m_jetCleaningToolTightBad

ToolHandle<IJetSelector> top::JetCleaningSelector::m_jetCleaningToolTightBad
private

Definition at line 65 of file JetCleaningSelector.h.

◆ m_jetEventCleaningToolLooseBad

ToolHandle<ECUtils::IEventCleaningTool> top::JetCleaningSelector::m_jetEventCleaningToolLooseBad
private

The jet event cleaning tools.

Definition at line 68 of file JetCleaningSelector.h.

◆ m_jetEventCleaningToolTightBad

ToolHandle<ECUtils::IEventCleaningTool> top::JetCleaningSelector::m_jetEventCleaningToolTightBad
private

Definition at line 69 of file JetCleaningSelector.h.

◆ m_level

std::string top::JetCleaningSelector::m_level
private

The level to configure to, so we can print it in the name.

Definition at line 72 of file JetCleaningSelector.h.

◆ m_useEventLevelJetCleaningTool

bool top::JetCleaningSelector::m_useEventLevelJetCleaningTool
private

Definition at line 74 of file JetCleaningSelector.h.

◆ m_useLooseBad

bool top::JetCleaningSelector::m_useLooseBad
private

Definition at line 73 of file JetCleaningSelector.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
top::JetCleaningSelector::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: JetCleaningSelector.h:76
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
top::JetCleaningSelector::m_jetCleaningToolLooseBad
ToolHandle< IJetSelector > m_jetCleaningToolLooseBad
The jet cleaning tools.
Definition: JetCleaningSelector.h:64
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::JetCleaningSelector::m_useEventLevelJetCleaningTool
bool m_useEventLevelJetCleaningTool
Definition: JetCleaningSelector.h:74
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
top::JetCleaningSelector::m_jetEventCleaningToolLooseBad
ToolHandle< ECUtils::IEventCleaningTool > m_jetEventCleaningToolLooseBad
The jet event cleaning tools.
Definition: JetCleaningSelector.h:68
top::JetCleaningSelector::m_jetEventCleaningToolTightBad
ToolHandle< ECUtils::IEventCleaningTool > m_jetEventCleaningToolTightBad
Definition: JetCleaningSelector.h:69
top::JetCleaningSelector::m_jetCleaningToolTightBad
ToolHandle< IJetSelector > m_jetCleaningToolTightBad
Definition: JetCleaningSelector.h:65
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
top::JetCleaningSelector::checkBadBatman
bool checkBadBatman(const top::Event &event) const
A helper function to check if the event passes BadBatman cleaning in a specified range (from config) ...
Definition: JetCleaningSelector.cxx:110
top::JetCleaningSelector::m_useLooseBad
bool m_useLooseBad
Definition: JetCleaningSelector.h:73
top::JetCleaningSelector::m_level
std::string m_level
The level to configure to, so we can print it in the name.
Definition: JetCleaningSelector.h:72