Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #ifndef XAOD_STANDALONE
15 #include <GaudiKernel/Incident.h>
16 #include <GaudiKernel/FileIncident.h>
17 #include <GaudiKernel/IIncidentSvc.h>
24 ISvcLocator* pSvcLocator ) :
25 base_class(
name, pSvcLocator)
27 assert( pSvcLocator );
39 return StatusCode::FAILURE;
48 incSvc->addListener(
this, IncidentType::BeginInputFile, 60);
49 incSvc->addListener(
this,
"MetaDataStop", 30);
59 return StatusCode::SUCCESS;
70 auto newCbk = std::make_unique<xAOD::CutBookkeeper>();
71 newCbk->setName(
name);
81 if (newCbk->isEqualTo(cbk)) {
83 <<
" and has CutID " << cbk->uniqueIdentifier() <<
"... Not adding!" );
85 return cbk->uniqueIdentifier();
90 ATH_MSG_DEBUG(
"Declaring a new filter with name '" <<
name <<
"' and CutID " << cutID );
91 container->push_back(std::move(newCbk));
110 <<
", logic=" << logic <<
", outputStream=" <<
outputStream <<
")");
116 if (cbk ==
nullptr) {
117 ATH_MSG_ERROR(
"Could not find CutBookkeeper with CutID " << cutID);
118 throw std::runtime_error(
"Could not find CutBookkeeper");
136 <<
"' and original CutID " << parentCutID);
140 if (parentCbk ==
nullptr) {
141 ATH_MSG_ERROR(
"Could not find parent CutBookkeeper with CutID " << parentCutID);
142 throw std::runtime_error(
"Could not find CutBookkeeper");
149 if (cbk ==
nullptr) {
150 ATH_MSG_ERROR(
"Could not find CutBookkeeper with CutID " << cutID);
151 throw std::runtime_error(
"Could not find CutBookkeeper");
163 const std::string&
descr )
169 if (cbk !=
nullptr) {
179 const std::vector<float>&
weights )
183 throw std::runtime_error(
"Inconsistent weights and variation sizes");
218 if (cbk ==
nullptr) {
219 ATH_MSG_ERROR(
"Could not find CutBookkeeper for CutID " << cutID <<
" and variation " <<
index);
220 throw std::runtime_error(
"Could not find CutBookkeeper");
235 if (inc.type() == IncidentType::BeginInputFile) {
237 std::string inputstream =
"";
247 ATH_MSG_DEBUG(
"No FileMetaData in input, trying EventStreamInfo");
249 std::vector<std::string>
vKeys;
253 if (
keys.size() == 1) {
254 std::string
key = *
keys.begin();
256 if (esi && !esi->getProcessingTags().empty()) {
263 if (inputstream.empty()) {
269 "Failed to parse stream name from metadata, using "
270 "property \"InputStream\"");
275 ATH_MSG_DEBUG(
"Input stream name: \"" << inputstream <<
'"');
279 const FileIncident* finc =
dynamic_cast<const FileIncident*
>(&inc);
281 ATH_MSG_FATAL(
"File " << finc->fileName() <<
" stream " << inputstream
282 <<
" does not match previous file "
290 if (inc.type() ==
"MetaDataStop") {
295 cbk->setNAcceptedEvents(0);
296 cbk->setSumOfEventWeights(0);
297 cbk->setSumOfEventWeightsSquared(0);
311 ATH_MSG_DEBUG(
"calling determineCycleNumberFromInput('" << collName
316 ATH_MSG_VERBOSE(
"Found xAOD::CutBookkeeperContainer in input MetaStore with name: " << collName);
323 int inCycle = cbk->cycle();
324 if (inCycle > maxCycle) maxCycle = inCycle;
329 ATH_MSG_DEBUG(
"done calling determineCycleNumberFromInput('" << collName
331 return StatusCode::SUCCESS;
340 return StatusCode::SUCCESS;
345 return StatusCode::FAILURE;
355 return StatusCode::SUCCESS;
360 if (
first->empty()) {
361 return StatusCode::SUCCESS;
363 for (
size_t i = 1;
i <
count; ++
i) {
372 return StatusCode::SUCCESS;
380 return StatusCode::SUCCESS;
400 if (cbk->uniqueIdentifier() == cutID) {
412 if (cbk ==
nullptr) {
ServiceHandle< StoreGateSvc > m_inMetaDataStore
The input meta-data store.
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...
StatusCode determineCycleNumberFromInput(const std::string &collName)
Helper function to determine the processing cycle number from the input meta-data store.
Gaudi::Property< bool > m_configured
CutFlow service should be explicitly configured.
void setDescription(const std::string &description)
Set the description of this CutBookkeeper.
const CutBookkeepersLocalCache & getCutBookkeepers() const
Get CutBookkeepers cache.
xAOD::CutBookkeeper * getCutBookkeeper(const CutIdentifier cutID, size_t index) const
Get a CutBookkeeper given a CutID.
const std::set< std::string > & getProcessingTags() const
Description of the class that is used to keep track of event counts.
StatusCode createContainers(size_t count)
Helper function to create an empty containers (and its aux store)
std::recursive_mutex m_addEventMutex
Mutex to protect adding an event.
CutBookkeepersLocalCache m_containers
Local CutBookkeeperContainers.
Gaudi::Property< std::string > m_inputStream
The name of the currently used input file stream.
void addChild(CutBookkeeper_v1 *childEB)
Add one child to this CutBookkeeper.
CutLogic
Enumeration of the logic of a cut.
#define ATH_MSG_VERBOSE(x)
This file contains the class definition for the EventStreamInfo class.
static void prepareContainers(CutBookkeepersLocalCache &target, size_t size, bool extend=false)
virtual StatusCode initialize() override final
Gaudi Service Implementation.
Helper in-memory structure.
void addNAcceptedEvents(uint64_t nEvents)
Add seen events to the number of accepted events that this CutBookkeeper has seen.
CutFlowSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual void setFilterDescription(CutIdentifier cutID, const std::string &descr) override final
Set the description of an existing CutBookkeeper.
::StatusCode StatusCode
StatusCode definition for legacy code.
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.
Gaudi::Property< std::string > m_completeCollName
The name of the completed, i.e., fully processed, CutBookkeeperContainer.
virtual uint64_t getNAcceptedEvents(const CutIdentifier cutID) const override final
Get number of accepted events for a cut.
Container that holds the Container of all CutBookkeepers.
uint32_t CutIdentifier
InstanceIdentifier is a unique identifer used for every AthFilterAlgorithm instance.
CutIdentifier CutFlowSvc::registerTopFilter ATLAS_NOT_THREAD_SAFE(const std::string &name, const std::string &description, unsigned int logic, const std::string &outputStream, bool nominalOnly)
xAOD::CutBookkeeperContainer * at(std::size_t n) const
uint64_t nAcceptedEvents() const
Get the number of accepted events that this CutBookkeeper has seen.
void addSumOfEventWeights(double nWeightedEvents)
Add more sum-of-event-weights that this CutBookkeeper has seen.
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void setCutLogic(CutLogic logic)
Set the cut logic of this CutBookkeeper, e.g., ACCEPT, REQUIRE, VETO.
virtual void handle(const Incident &incident) override final
Incident service handle listening for BeginInputFile, EndInputFile and MetaDataStop.
Gaudi::Property< int > m_skimmingCycle
The current skimming cycle, i.e., how many processing stages we already had.
StatusCode setNumberOfWeightVariations(size_t count)
Set number of weight variations.
This class provides the summary information stored for data written as a Event Stream.
#define ATH_MSG_WARNING(x)
void addSumOfEventWeightsSquared(double nWeightedEventsSquared)
Add more sum-of-(event-weights-squared) that this CutBookkeeper has seen.
void setTopFilter(bool isTopFilter)
Set the top-filter property of this CutBookkeeper.
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...
std::unordered_set< CutIdentifier > m_nominalOnlyCuts
List of nominal-only filters.
std::string description
glabal timer - how long have I taken so far?