ATLAS Offline Software
Loading...
Searching...
No Matches
CutFlowSvc.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// Header file for class CutFlowSvc
6// Authors:
7// Tadej Novak <tadej@cern.ch>
8// Joao Firmino da Costa <joao.costa@cern.ch> and David Cote <david.cote@cern.ch>
9
11#ifndef EVENT_BOOKKEEPER_TOOLS__CUT_FLOW_SVC_H
12#define EVENT_BOOKKEEPER_TOOLS__CUT_FLOW_SVC_H
13
14// Not dual use at the moment
15#ifndef XAOD_STANDALONE
16
21
22// STL includes
23#include <mutex>
24#include <string>
25#include <unordered_map>
26
27// FrameWork includes
28#include <GaudiKernel/ISvcLocator.h>
29#include <GaudiKernel/IIncidentListener.h>
30#include <GaudiKernel/ServiceHandle.h>
31
32// Athena includes
37
38// EDM includes
41
42
44 public extends<AthService,
45 ICutFlowSvc,
46 IIncidentListener>
47{
48
49public:
51 CutFlowSvc(const std::string& name, ISvcLocator* pSvcLocator );
52
54
55 virtual StatusCode initialize() override final;
57
58
60 virtual void handle(const Incident& incident) override final;
61
62public:
63
67 virtual CutIdentifier registerFilter(const std::string& name,
68 const std::string& description,
69 bool nominalOnly) override final;
70
74 virtual CutIdentifier registerTopFilter ATLAS_NOT_THREAD_SAFE (const std::string& name,
75 const std::string& description,
76 unsigned int logic,
77 const std::string& outputStream,
78 bool nominalOnly) override final;
79
83 virtual CutIdentifier registerCut(const std::string& name,
84 const std::string& description,
85 CutIdentifier parentCutID,
86 bool nominalOnly) override final;
87
89 virtual void setFilterDescription(CutIdentifier cutID,
90 const std::string& descr) override final;
91
94 virtual void addEvent(CutIdentifier cutID,
95 const std::vector<float>& weights) override final;
96
99 virtual void addEvent(CutIdentifier cutID,
100 double weight) override final;
101
103 virtual uint64_t getNAcceptedEvents(const CutIdentifier cutID) const override final;
104
107
109 StatusCode setNumberOfWeightVariations(size_t count);
110
111
112private:
115 void addEvent(CutIdentifier cutID,
116 size_t index,
117 double weight);
118
121 StatusCode determineCycleNumberFromInput(const std::string& collName);
122
124 StatusCode createContainers(size_t count);
125
128 size_t index) const;
129
131 Gaudi::Property<bool> m_configured{this, "Configured", true, "configuration check"};
132
134 ServiceHandle<StoreGateSvc> m_inMetaDataStore{this, "InputMetaDataStore", "StoreGateSvc/InputMetaDataStore", ""};
135
137 Gaudi::Property<std::string> m_completeCollName{this, "OutputCollName", "CutBookkeepers", ""};
138
141
143 Gaudi::Property<int> m_skimmingCycle{this, "SkimmingCycle", 0, "Skimming cycle of current job"};
144
146 Gaudi::Property<std::string> m_inputStream{this, "InputStream", "N/A", "The name of the input file stream"};
147
149 mutable std::recursive_mutex m_addEventMutex;
150
152 std::unordered_set<CutIdentifier> m_nominalOnlyCuts;
153};
154
155#endif // dual use
156
157#endif // EVENT_BOOKKEEPER_TOOLS__CUT_FLOW_SVC_H
uint32_t CutIdentifier
InstanceIdentifier is a unique identifer used for every AthFilterAlgorithm instance.
Definition ICutFlowSvc.h:26
Define macros for attributes used to control the static checker.
const CutBookkeepersLocalCache & getCutBookkeepers() const
Get CutBookkeepers cache.
virtual void setFilterDescription(CutIdentifier cutID, const std::string &descr) override final
Set the description of an existing CutBookkeeper.
CutBookkeepersLocalCache m_containers
Local CutBookkeeperContainers.
Definition CutFlowSvc.h:140
Gaudi::Property< std::string > m_completeCollName
The name of the completed, i.e., fully processed, CutBookkeeperContainer.
Definition CutFlowSvc.h:137
ServiceHandle< StoreGateSvc > m_inMetaDataStore
The input meta-data store.
Definition CutFlowSvc.h:134
std::recursive_mutex m_addEventMutex
Mutex to protect adding an event.
Definition CutFlowSvc.h:149
virtual uint64_t getNAcceptedEvents(const CutIdentifier cutID) const override final
Get number of accepted events for a cut.
StatusCode setNumberOfWeightVariations(size_t count)
Set number of weight variations.
StatusCode determineCycleNumberFromInput(const std::string &collName)
Helper function to determine the processing cycle number from the input meta-data store.
StatusCode createContainers(size_t count)
Helper function to create an empty containers (and its aux store)
virtual CutIdentifier registerTopFilter ATLAS_NOT_THREAD_SAFE(const std::string &name, const std::string &description, unsigned int logic, const std::string &outputStream, bool nominalOnly) override final
Tells CutFlowSvc that a filter is used directly by an outputStream with a given logical context.
Gaudi::Property< bool > m_configured
CutFlow service should be explicitly configured.
Definition CutFlowSvc.h:131
virtual void handle(const Incident &incident) override final
Incident service handle listening for BeginInputFile, EndInputFile and MetaDataStop.
virtual void addEvent(CutIdentifier cutID, const std::vector< float > &weights) override final
Tells CutFlowSvc to update the weighted event counter of a CutIdentifier cutID, using CutIdentifier r...
virtual CutIdentifier registerCut(const std::string &name, const std::string &description, CutIdentifier parentCutID, bool nominalOnly) override final
Register cut as child of a filter in the CutFlowSvc and returns the CutID of the corresponding EventB...
virtual CutIdentifier registerFilter(const std::string &name, const std::string &description, bool nominalOnly) override final
Register filter in the CutFlowSvc and returns the CutID of the corresponding CutBookkeeper.
virtual StatusCode initialize() override final
Gaudi Service Implementation.
Gaudi::Property< int > m_skimmingCycle
The current skimming cycle, i.e., how many processing stages we already had.
Definition CutFlowSvc.h:143
xAOD::CutBookkeeper * getCutBookkeeper(const CutIdentifier cutID, size_t index) const
Get a CutBookkeeper given a CutID.
std::unordered_set< CutIdentifier > m_nominalOnlyCuts
List of nominal-only filters.
Definition CutFlowSvc.h:152
Gaudi::Property< std::string > m_inputStream
The name of the currently used input file stream.
Definition CutFlowSvc.h:146
CutFlowSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Definition index.py:1
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
Helper in-memory structure.