ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloG4Sim
CaloG4Sim
EscapedEnergyRegistry.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 CALOG4SIM_ESCAPEDENERGYREGISTRY_H
6
#define CALOG4SIM_ESCAPEDENERGYREGISTRY_H
7
8
#include "
CaloG4Sim/VEscapedEnergyProcessing.h
"
9
#include "
CxxUtils/checker_macros.h
"
10
#include "globals.hh"
11
12
#include <map>
13
#include <memory>
14
15
#include <thread>
16
#include "G4Types.hh"
17
#ifdef G4MULTITHREADED
18
# include "tbb/concurrent_unordered_map.h"
19
#endif
20
namespace
CaloG4
21
{
50
51
class
EscapedEnergyRegistry
52
{
53
public
:
54
55
static
EscapedEnergyRegistry
*
GetInstance
();
56
57
~EscapedEnergyRegistry
() =
default
;
58
59
// Add a VEscapedEnergyProcessing object to the registry. The
60
// name include "Adopt" because we assume responsibility for
61
// deleting the pointer.
62
void
AddAndAdoptProcessing
(
const
G4String& name, std::unique_ptr<VEscapedEnergyProcessing>
process
);
63
64
// Given a volume name,
65
VEscapedEnergyProcessing
*
GetProcessing
(
const
G4String& volumeName )
const
;
66
67
protected
:
68
69
// Constructor protected according to singleton pattern.
70
EscapedEnergyRegistry
() =
default
;
71
72
private
:
73
74
typedef
std::map< const G4String, std::unique_ptr<VEscapedEnergyProcessing> >
m_processingMap_t
;
75
typedef
m_processingMap_t::iterator
m_processingMap_ptr_t
;
76
typedef
m_processingMap_t::const_iterator
m_processingMap_const_ptr_t
;
77
m_processingMap_t
m_processingMap
;
78
#ifdef G4MULTITHREADED
79
// Thread-to-EscapeEnergyRegistry concurrent map type
80
using
EERThreadMap_t = tbb::concurrent_unordered_map< std::thread::id, EscapedEnergyRegistry*, std::hash<std::thread::id> >;
81
// Concurrent map of EERs, one for each thread
82
static
EERThreadMap_t m_EERThreadMap
ATLAS_THREAD_SAFE
;
83
// @brief Search inside m_EERThreadMap the element with the current threadID
84
// and return it or return a null pointer if the element is not found
85
static
EscapedEnergyRegistry
* getEER();
86
// @brief Insert the current EER in m_EERThreadMap and
87
// associate it with the current threadID
88
static
EscapedEnergyRegistry
* setEER();
89
#endif
90
};
91
92
}
// namespace CaloG4
93
94
#endif
// CaloG4_EscapedEnergyRegistry_H
VEscapedEnergyProcessing.h
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
CaloG4::EscapedEnergyRegistry::GetProcessing
VEscapedEnergyProcessing * GetProcessing(const G4String &volumeName) const
CaloG4::EscapedEnergyRegistry::GetInstance
static EscapedEnergyRegistry * GetInstance()
CaloG4::EscapedEnergyRegistry::m_processingMap_ptr_t
m_processingMap_t::iterator m_processingMap_ptr_t
Definition
EscapedEnergyRegistry.h:75
CaloG4::EscapedEnergyRegistry::EscapedEnergyRegistry
EscapedEnergyRegistry()=default
CaloG4::EscapedEnergyRegistry::AddAndAdoptProcessing
void AddAndAdoptProcessing(const G4String &name, std::unique_ptr< VEscapedEnergyProcessing > process)
CaloG4::EscapedEnergyRegistry::m_processingMap_t
std::map< const G4String, std::unique_ptr< VEscapedEnergyProcessing > > m_processingMap_t
Definition
EscapedEnergyRegistry.h:74
CaloG4::EscapedEnergyRegistry::m_processingMap
m_processingMap_t m_processingMap
Definition
EscapedEnergyRegistry.h:77
CaloG4::EscapedEnergyRegistry::~EscapedEnergyRegistry
~EscapedEnergyRegistry()=default
CaloG4::EscapedEnergyRegistry::m_processingMap_const_ptr_t
m_processingMap_t::const_iterator m_processingMap_const_ptr_t
Definition
EscapedEnergyRegistry.h:76
CaloG4::VEscapedEnergyProcessing
Virtual interface for escaped energy processor classes.
Definition
VEscapedEnergyProcessing.h:43
process
const std::string process
Definition
fbtTestBasics.cxx:76
CaloG4
Definition
EscapedEnergyRegistry.h:21
Generated on
for ATLAS Offline Software by
1.17.0