ATLAS Offline Software
FastSimulationBase.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 G4ATLASTOOLS_FASTSIMULATIONBASE_H
6 #define G4ATLASTOOLS_FASTSIMULATIONBASE_H
7 
8 // Base classes
11 
12 // Members
13 #include "G4Types.hh"
14 #include "G4VFastSimulationModel.hh"
15 #ifdef G4MULTITHREADED
16 # include "tbb/concurrent_unordered_map.h"
17 #endif
18 
19 // STL library
20 #include <string>
21 #include <vector>
22 #include <thread>
23 
26 class FastSimulationBase : public extends<AthAlgTool, IFastSimulation> {
27  public:
28  FastSimulationBase(const std::string& type, const std::string& name,
29  const IInterface *parent);
30  virtual ~FastSimulationBase();
31 
38  StatusCode initializeFastSim() override;
39 
41  virtual StatusCode BeginOfAthenaEvent() override { return StatusCode::SUCCESS; }
42 
44  virtual StatusCode EndOfAthenaEvent() override { return StatusCode::SUCCESS; }
45 
46  protected:
50  G4VFastSimulationModel* getFastSimModel();
51 
53  Gaudi::Property<std::vector<std::string> > m_regionNames{this, "RegionNames", {}};
55  Gaudi::Property<bool> m_noRegions{this, "NoRegions", false};
56 
57  private:
58 
60  void setFastSimModel(G4VFastSimulationModel*);
61 
63  void deleteFastSimModel();
64 
65 #ifdef G4MULTITHREADED
66  typedef tbb::concurrent_unordered_map < std::thread::id,
68  G4VFastSimulationModel*,
69  std::hash<std::thread::id> > FastSimModelThreadMap_t;
71  FastSimModelThreadMap_t m_fastsimmodelThreadMap;
72 #else
73  G4VFastSimulationModel* m_FastSimModel{};
75 #endif
76 };
77 
78 #endif
FastSimulationBase
Definition: FastSimulationBase.h:26
FastSimulationBase::deleteFastSimModel
void deleteFastSimModel()
Delete the current model.
Definition: FastSimulationBase.cxx:99
FastSimulationBase::m_FastSimModel
G4VFastSimulationModel * m_FastSimModel
The Fast Simulation Model to which this thing corresponds.
Definition: FastSimulationBase.h:74
IFastSimulation.h
FastSimulationBase::~FastSimulationBase
virtual ~FastSimulationBase()
Definition: FastSimulationBase.cxx:16
FastSimulationBase::m_noRegions
Gaudi::Property< bool > m_noRegions
This Fast Simulation has no regions associated with it.
Definition: FastSimulationBase.h:55
FastSimulationBase::setFastSimModel
void setFastSimModel(G4VFastSimulationModel *)
Set the current model. In hive, this gets assigned as the thread-local model.
Definition: FastSimulationBase.cxx:87
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
FastSimulationBase::FastSimulationBase
FastSimulationBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FastSimulationBase.cxx:11
FastSimulationBase::BeginOfAthenaEvent
virtual StatusCode BeginOfAthenaEvent() override
Begin of an athena event - do anything that needs to be done at the beginning of each athena event.
Definition: FastSimulationBase.h:41
test_pyathena.parent
parent
Definition: test_pyathena.py:15
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
FastSimulationBase::m_regionNames
Gaudi::Property< std::vector< std::string > > m_regionNames
All the regions to which this fast sim is assigned.
Definition: FastSimulationBase.h:53
FastSimulationBase::getFastSimModel
G4VFastSimulationModel * getFastSimModel()
Retrieve the current Fast Simulation Model.
Definition: FastSimulationBase.cxx:73
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FastSimulationBase::initializeFastSim
StatusCode initializeFastSim() override
Construct and setup the fast simulation model.
Definition: FastSimulationBase.cxx:23
FastSimulationBase::EndOfAthenaEvent
virtual StatusCode EndOfAthenaEvent() override
End of an athena event - do any tidying up required at the end of each athena event.
Definition: FastSimulationBase.h:44