ATLAS Offline Software
EventSelection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef EVENTSELECTION_H_
6 #define EVENTSELECTION_H_
7 
11 
12 #include <string>
13 #include <vector>
14 #include <memory>
15 
16 class TH1D;
17 class TFile;
18 
19 namespace EL {
20  class Worker;
21 }
22 
23 namespace top {
24  class Event;
25  class TopConfig;
26  class ParticleLevelEvent;
27 }
28 
29 namespace top {
37  class EventSelection final {
38  public:
49  EventSelection(const std::string& name, const std::vector<std::string>& cutNames, TFile* outputFile,
50  const std::vector<std::unique_ptr<top::ToolLoaderBase> >& toolLoaders,
51  const std::shared_ptr<top::TopConfig>& config, EL::Worker* wk);
52 
56  virtual ~EventSelection() {}
57 
62 
66  EventSelection() = delete;
67 
71  EventSelection(const EventSelection&) = delete;
72 
77 
81  virtual void countInitial(const float mcEventWeight, const float pileupWeight) const;
85  virtual void countGRL(const float mcEventWeight, const float pileupWeight) const;
89  virtual void countGoodCalo(const float mcEventWeight, const float pileupWeight) const;
93  virtual void countPrimaryVertex(const float mcEventWeight, const float pileupWeight) const;
94 
110  virtual bool apply(const top::Event& event) const;
111 
127  virtual bool applyParticleLevel(const top::ParticleLevelEvent& plEvent) const;
128 
135  virtual void finalise() const;
136 
142  const std::string name() const;
143 
149  std::vector<std::string> GetFakesMMConfigs() const;
150 
157  bool ToBeSaved() const {return m_toBeSaved;};
158  private:
162  virtual void printCuts();
163 
165  std::vector<std::unique_ptr<EventSelectorBase> > m_allCuts;
166 
168  mutable TH1D* m_cutflow;
170 
174 
178 
182 
186 
190 
195  std::string m_name;
196 
198  mutable bool m_isMC;
199 
201  std::shared_ptr<TopConfig> m_config;
202 
206  void initialiseTopScaleFactorRetriever(const std::shared_ptr<TopConfig>& config);
207 
208  // Nominal hash value
209  std::size_t m_nominalHashValue;
210 
211  // Does this selection contain initial and GRL?
212  // If so, what are their positions in the cut flow?
217  unsigned int m_positionInitial;
218  unsigned int m_positionGRL;
219  unsigned int m_positionGoodCalo;
221 
222  // If true, event will be saved if it passes this selection
223  // If false, event will only be saved if it passes another selection
224  // If an event is saved, the flags of all selections (those passed and those not passed) are saved
226  };
227 }
228 
229 #endif
top::EventSelection::m_toBeSaved
bool m_toBeSaved
Definition: EventSelection.h:225
top::EventSelection::m_config
std::shared_ptr< TopConfig > m_config
Definition: EventSelection.h:201
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::EventSelection::m_cutflowParticleLevel
TH1D * m_cutflowParticleLevel
The particle level cutflow histogram filled by the tool.
Definition: EventSelection.h:188
top::EventSelection::m_containsGRL
bool m_containsGRL
Definition: EventSelection.h:214
top::EventSelection::ToBeSaved
bool ToBeSaved() const
Tells if the event should be saved if it passes this selection.
Definition: EventSelection.h:157
top::EventSelection::m_cutflowMCWeights
TH1D * m_cutflowMCWeights
Cutflow counting MC weights instead of events.
Definition: EventSelection.h:172
top::EventSelection::m_cutflowMCWeights_Loose
TH1D * m_cutflowMCWeights_Loose
Definition: EventSelection.h:173
top::EventSelection::printCuts
virtual void printCuts()
Print a cutflow showing the number of events passing each cut.
Definition: EventSelection.cxx:523
top::EventSelection::applyParticleLevel
virtual bool applyParticleLevel(const top::ParticleLevelEvent &plEvent) const
Apply the selection for each particle level event.
Definition: EventSelection.cxx:367
top::EventSelection::m_cutflowMCPUWeights
TH1D * m_cutflowMCPUWeights
Cutflow counting MC*Pileup weights instead of events.
Definition: EventSelection.h:180
Event
Definition: trigbs_orderedMerge.cxx:42
top::EventSelection::m_cutflowParticleLevelMCWeights
TH1D * m_cutflowParticleLevelMCWeights
Definition: EventSelection.h:189
TH1D
Definition: rootspy.cxx:342
top::EventSelection::m_cutflowScaleFactors
TH1D * m_cutflowScaleFactors
Cutflow counting ScaleFactors instead of events.
Definition: EventSelection.h:184
top::EventSelection::m_containsInitial
bool m_containsInitial
Definition: EventSelection.h:213
top::EventSelection::m_positionGRL
unsigned int m_positionGRL
Definition: EventSelection.h:218
top::EventSelection::finalise
virtual void finalise() const
Print some yield information.
Definition: EventSelection.cxx:402
top::EventSelection::~EventSelection
virtual ~EventSelection()
Does not do anything.
Definition: EventSelection.h:56
top::EventSelection::m_positionPrimaryVertex
unsigned int m_positionPrimaryVertex
Definition: EventSelection.h:220
top::EventSelection
Perform the event selection on a top::Event object.
Definition: EventSelection.h:37
top::EventSelection::m_cutflowPUWeights_Loose
TH1D * m_cutflowPUWeights_Loose
Definition: EventSelection.h:177
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
top::EventSelection::m_nominalHashValue
std::size_t m_nominalHashValue
Definition: EventSelection.h:209
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
top::EventSelection::countGoodCalo
virtual void countGoodCalo(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing Good Calo.
Definition: EventSelection.cxx:267
top::EventSelection::apply
virtual bool apply(const top::Event &event) const
Apply the selection for each event.
Definition: EventSelection.cxx:301
EL::Worker
Definition: Worker.h:25
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::EventSelection::countPrimaryVertex
virtual void countPrimaryVertex(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing Primary Vertex.
Definition: EventSelection.cxx:284
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::EventSelection::m_cutflow_Loose
TH1D * m_cutflow_Loose
Definition: EventSelection.h:169
top::EventSelection::m_cutflow
TH1D * m_cutflow
The cutflow histogram filled by the tool.
Definition: EventSelection.h:168
top::ScaleFactorRetriever
Definition: ScaleFactorRetriever.h:216
top::EventSelection::countGRL
virtual void countGRL(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing GRL.
Definition: EventSelection.cxx:250
top::EventSelection::countInitial
virtual void countInitial(const float mcEventWeight, const float pileupWeight) const
Count the number of initial events.
Definition: EventSelection.cxx:233
top::EventSelection::m_positionInitial
unsigned int m_positionInitial
Definition: EventSelection.h:217
top::EventSelection::name
const std::string name() const
Tells you the name of this event selection.
Definition: EventSelection.cxx:506
top::EventSelection::operator=
EventSelection & operator=(const EventSelection &)=delete
Assignment is not allowed.
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
top::EventSelection::m_containsGoodCalo
bool m_containsGoodCalo
Definition: EventSelection.h:215
top::EventSelection::m_positionGoodCalo
unsigned int m_positionGoodCalo
Definition: EventSelection.h:219
EventSelectorBase.h
top::EventSelection::EventSelection
EventSelection(const EventSelection &)=delete
Copy is not allowed.
top::EventSelection::m_containsPrimaryVertex
bool m_containsPrimaryVertex
Definition: EventSelection.h:216
top::EventSelection::initialiseTopScaleFactorRetriever
void initialiseTopScaleFactorRetriever(const std::shared_ptr< TopConfig > &config)
Function to setup the tool in one place.
Definition: EventSelection.cxx:221
top::EventSelection::EventSelection
EventSelection()=delete
Default constructor is not allowed.
top::EventSelection::m_isMC
bool m_isMC
To turn on/off confusing messages about mc weights when running on data.
Definition: EventSelection.h:198
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
ToolLoaderBase.h
top::EventSelection::m_allCuts
std::vector< std::unique_ptr< EventSelectorBase > > m_allCuts
Vector of all the tools that will be used in the analysis.
Definition: EventSelection.h:165
top::EventSelection::m_sfRetriever
ScaleFactorRetriever * m_sfRetriever
Scale factors.
Definition: EventSelection.h:204
top::EventSelection::GetFakesMMConfigs
std::vector< std::string > GetFakesMMConfigs() const
Gives you the lists of the Fakes MM configurations associated to this selection.
Definition: EventSelection.cxx:510
top::EventSelection::m_cutflowMCPUWeights_Loose
TH1D * m_cutflowMCPUWeights_Loose
Definition: EventSelection.h:181
ScaleFactorRetriever.h
top::EventSelection::m_cutflowPUWeights
TH1D * m_cutflowPUWeights
Cutflow counting PileUp weights instead of events.
Definition: EventSelection.h:176
top::EventSelection::m_name
std::string m_name
Name of this selection (you can have multiple selections run in the same job.
Definition: EventSelection.h:195
top::EventSelection::m_cutflowScaleFactors_Loose
TH1D * m_cutflowScaleFactors_Loose
Definition: EventSelection.h:185