ATLAS Offline Software
Loading...
Searching...
No Matches
CfAthAlgTool.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//============================================================================
6// CfAthAlgTool.h
7//============================================================================
8//
9// Author : Wolfgang Walkowiak <Wolfgang.Walkowiak@cern.ch.>
10// Changes:
11//
12// Wrapper around AthAlgTool to provide easy access to CutFlowSvc
13// and some utility methods for it.
14// Methods for accessing the CutFlowSvc are modelled after
15// AthFilterAlgorithm's implementation.
16//
17// This class inherits from AthAlgTool. It should be inherited from.
18//
19//============================================================================
20//
21#ifndef DERIVATIONFRAMEWORK_CfAthAlgTool_H
22#define DERIVATIONFRAMEWORK_CfAthAlgTool_H
23
24#include "GaudiKernel/ToolHandle.h"
25#include "GaudiKernel/ServiceHandle.h"
29
30#include <string>
31#include <map>
32
33namespace DerivationFramework {
34
36 public:
37 // constructor with parameters
38 CfAthAlgTool(const std::string& t, const std::string& n,
39 const IInterface* p);
40 // destructor
41 virtual ~CfAthAlgTool();
42
43 // Initialization method invoked by the framework.
44 virtual StatusCode sysInitialize() override;
45
46 // add event to a named counter -- returns counts after adding
47 virtual bool addEvent(const std::string &name, double weight=1.) const;
48
49 // add to a named counter -- returns counts after adding
50 // if counts > 1 : same weight is added multiple times
51 virtual bool addToCounter(const std::string &name, uint64_t counts=1,
52 double weight=1.) const;
53
54 protected:
55 // add a counter by name -- returns id if it already exists
56 CutIdentifier getCounter(const std::string &name) const;
57
58 // returns counter name by id
59 std::string getCounterNameById(CutIdentifier id) const;
60
61 // returns counter id by name
62 CutIdentifier getCounterIdByName(const std::string &name) const;
63
64 private:
65 // handle to the service holding tables of cut-flows for filtering algs.
67
68 // base name for counters
69 std::string m_ctbasename;
70
71 // map of counter names to counter ids
72 typedef std::map<std::string, CutIdentifier> NameIdMap_t;
74
75 // base counter
77 mutable bool m_bidisset;
78
79 }; // class
80} // namespace
81
82#endif // DERIVATIONFRAMEWORK_CfAthAlgTool_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.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
CfAthAlgTool(const std::string &t, const std::string &n, const IInterface *p)
CutIdentifier getCounterIdByName(const std::string &name) const
virtual StatusCode sysInitialize() override
Perform system initialization for an algorithm.
std::string getCounterNameById(CutIdentifier id) const
ServiceHandle< ICutFlowSvc > m_cutFlowSvc
std::map< std::string, CutIdentifier > NameIdMap_t
CutIdentifier getCounter(const std::string &name) const
virtual bool addEvent(const std::string &name, double weight=1.) const
virtual bool addToCounter(const std::string &name, uint64_t counts=1, double weight=1.) const
THE reconstruction tool.