ATLAS Offline Software
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 
33 namespace 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
DerivationFramework::CfAthAlgTool::m_mctn
NameIdMap_t m_mctn
Definition: CfAthAlgTool.h:73
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
DerivationFramework::CfAthAlgTool::m_cutFlowSvc
ServiceHandle< ICutFlowSvc > m_cutFlowSvc
Definition: CfAthAlgTool.h:66
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
CutIdentifier
uint32_t CutIdentifier
InstanceIdentifier is a unique identifer used for every AthFilterAlgorithm instance.
Definition: ICutFlowSvc.h:22
DerivationFramework::CfAthAlgTool::m_bidisset
bool m_bidisset
Definition: CfAthAlgTool.h:77
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DerivationFramework::CfAthAlgTool::m_ctbasename
std::string m_ctbasename
Definition: CfAthAlgTool.h:69
ICutFlowSvc.h
DerivationFramework::CfAthAlgTool::NameIdMap_t
std::map< std::string, CutIdentifier > NameIdMap_t
Definition: CfAthAlgTool.h:72
AthAlgTool
Definition: AthAlgTool.h:26
checker_macros.h
Define macros for attributes used to control the static checker.
DerivationFramework::CfAthAlgTool::m_bid
CutIdentifier m_bid
Definition: CfAthAlgTool.h:76
DerivationFramework::CfAthAlgTool
Definition: CfAthAlgTool.h:35
ServiceHandle< ICutFlowSvc >