ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
FastCaloSimTool Class Reference

#include <FastCaloSimTool.h>

Inheritance diagram for FastCaloSimTool:
Collaboration diagram for FastCaloSimTool:

Public Member Functions

 FastCaloSimTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor. More...
 
 ~FastCaloSimTool ()
 
virtual StatusCode BeginOfAthenaEvent () override final
 Begin of an athena event - do any thing that needs to be done at the beginning of each athena event. More...
 
virtual StatusCode EndOfAthenaEvent () override final
 End of an athena event - do any thing that needs to be done at the end of each athena event. More...
 
StatusCode initializeFastSim () override
 Construct and setup the fast simulation model. More...
 

Protected Member Functions

virtual G4VFastSimulationModel * makeFastSimModel () override final
 Method to make the actual fast simulation model itself, which will be owned by the tool. More...
 
G4VFastSimulationModel * getFastSimModel ()
 Retrieve the current Fast Simulation Model. More...
 
G4Region * getRegion () const
 

Protected Attributes

Gaudi::Property< std::string > m_regionName {this, "RegionName", ""}
 The region to which this fast sim is assigned. More...
 
Gaudi::Property< bool > m_noRegions {this, "NoRegions", false}
 This Fast Simulation has no regions associated with it. More...
 

Private Member Functions

void setFastSimModel (G4VFastSimulationModel *)
 Set the current model. In hive, this gets assigned as the thread-local model. More...
 
void deleteFastSimModel ()
 Delete the current model. More...
 

Private Attributes

ServiceHandle< ISF::IFastCaloSimParamSvcm_FastCaloSimSvc {this, "ISF_FastCaloSimV2ParamSvc", "ISF_FastCaloSimV2ParamSvc"}
 
PublicToolHandle< IFastCaloSimCaloTransportationm_FastCaloSimCaloTransportation {this, "FastCaloSimCaloTransportation", "FastCaloSimCaloTransportation", ""}
 
PublicToolHandle< IFastCaloSimCaloExtrapolationm_FastCaloSimCaloExtrapolation {this, "FastCaloSimCaloExtrapolation", "FastCaloSimCaloExtrapolation", ""}
 
PublicToolHandle< IG4CaloTransportToolm_G4CaloTransportTool {this, "G4CaloTransportTool", "G4CaloTransportTool", ""}
 
PublicToolHandle< IPunchThroughSimWrapperm_PunchThroughSimWrapper {this, "PunchThroughSimWrapper", "PunchThroughSimWrapper", ""}
 
ServiceHandle< IAthRNGSvcm_rndmGenSvc {this, "RandomSvc", "AthRNGSvc", ""}
 
Gaudi::Property< std::string > m_randomEngineName {this, "RandomStream", ""}
 
Gaudi::Property< std::string > m_CaloCellContainerSDName {this, "CaloCellContainerSDName", "", "Name of the associated CaloCellContainerSD"}
 
Gaudi::Property< bool > m_doG4Transport {this, "doG4Transport", false, "Flag to enable G4 transportation"}
 
Gaudi::Property< bool > m_doPhotons {this, "doPhotons", true, "Flag to enable FCS simulation for photons"}
 Optional flags that allow to further limit the usage of fast simulation beyond the default configuration Note: For fast simulation jobs, default values should be used. More...
 
Gaudi::Property< bool > m_doElectrons {this, "doElectrons", true, "Flag to enable FCS simulation for electrons and positrons"}
 
Gaudi::Property< bool > m_doHadrons {this, "doHadrons", true, "Flag to enable FCS simulation for pions and other hadrons"}
 
Gaudi::Property< float > m_AbsEtaMin {this, "AbsEtaMin", 0, "Abs(Eta) lower bound for FastCaloSim"}
 
Gaudi::Property< float > m_AbsEtaMax {this, "AbsEtaMax", 10, "Abs(Eta) upper bound for FastCaloSim"}
 
Gaudi::Property< float > m_EkinMinPhotons {this, "EkinMinPhotons", 0, "Kinetic photon energy lower bound for FastCaloSim"}
 
Gaudi::Property< float > m_EkinMaxPhotons {this, "EkinMaxPhotons", std::numeric_limits<float>::max(), "Kinetic photon energy upper bound for FastCaloSim"}
 
Gaudi::Property< float > m_EkinMinElectrons {this, "EkinMinElectrons", 0, "Kinetic electron energy lower bound for FastCaloSim"}
 
Gaudi::Property< float > m_EkinMaxElectrons {this, "EkinMaxElectrons", std::numeric_limits<float>::max(), "Kinetic electron energy upper bound for FastCaloSim"}
 
Gaudi::Property< bool > m_doPunchThrough {this, "doPunchThrough", true, "Run punchthrough simulation for particle entering Calo-MS boundary"}
 
G4VFastSimulationModel * m_FastSimModel {}
 The Fast Simulation Model to which this thing corresponds. More...
 

Detailed Description

Definition at line 26 of file FastCaloSimTool.h.

Constructor & Destructor Documentation

◆ FastCaloSimTool()

FastCaloSimTool::FastCaloSimTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Default constructor.

Definition at line 11 of file FastCaloSimTool.cxx.

13 {
14 }

◆ ~FastCaloSimTool()

FastCaloSimTool::~FastCaloSimTool ( )
inline

Definition at line 31 of file FastCaloSimTool.h.

31 {}

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode FastCaloSimTool::BeginOfAthenaEvent ( )
finaloverridevirtual

Begin of an athena event - do any thing that needs to be done at the beginning of each athena event.

Reimplemented from FastSimulationBase.

Definition at line 16 of file FastCaloSimTool.cxx.

16  {
17  // Get current event context
18  const EventContext& ctx = Gaudi::Hive::currentContext();
19 
20  if( !getFastSimModel() ){
21  ATH_MSG_ERROR ("BeginOfAthenaEvent: FastSimModel was never created!");
22  return StatusCode::FAILURE;
23  }
24  else{
25  FastCaloSim *localFastSimModel = dynamic_cast<FastCaloSim*>(getFastSimModel());
26  if(!localFastSimModel){
27  ATH_MSG_ERROR ("BeginOfAthenaEvent: Failed to cast m_FastSimModel into G4VFastSimulationModel.");
28  return StatusCode::FAILURE;
29  }
30  localFastSimModel->StartOfAthenaEvent(ctx);
31  }
32 
33  return StatusCode::SUCCESS;
34 }

◆ deleteFastSimModel()

void FastSimulationBase::deleteFastSimModel ( )
privateinherited

Delete the current model.

Definition at line 78 of file FastSimulationBase.cxx.

79 {
80 #ifdef G4MULTITHREADED
81  for(auto& threadMapPair : m_fastsimmodelThreadMap)
82  {
83  auto fastSimModel = threadMapPair.second;
84  if (fastSimModel)
85  delete fastSimModel;
86  }
87  m_fastsimmodelThreadMap.clear();
88 #else
89  if(m_FastSimModel)
90  {
91  delete m_FastSimModel;
92  m_FastSimModel = 0;
93  }
94 #endif
95 }

◆ EndOfAthenaEvent()

StatusCode FastCaloSimTool::EndOfAthenaEvent ( )
finaloverridevirtual

End of an athena event - do any thing that needs to be done at the end of each athena event.

Reimplemented from FastSimulationBase.

Definition at line 36 of file FastCaloSimTool.cxx.

36  {
37 
38  // Get current event context
39  const EventContext& ctx = Gaudi::Hive::currentContext();
40 
41  if( !getFastSimModel() ){
42  ATH_MSG_ERROR ("EndOfAthenaEvent: FastSimModel was never created!");
43  return StatusCode::FAILURE;
44  }
45  else{
46  FastCaloSim *localFastSimModel = dynamic_cast<FastCaloSim*>(getFastSimModel());
47  if(!localFastSimModel){
48  ATH_MSG_ERROR ("EndOfAthenaEvent: Failed to cast m_FastSimModel into G4VFastSimulationModel.");
49  return StatusCode::FAILURE;
50  }
51  localFastSimModel->EndOfAthenaEvent(ctx);
52  }
53 
54  return StatusCode::SUCCESS;
55 }

◆ getFastSimModel()

G4VFastSimulationModel * FastSimulationBase::getFastSimModel ( )
protectedinherited

Retrieve the current Fast Simulation Model.

In MT, this means the thread-local Fast Simulation Model. Otherwise, it is simply the single Fast Simulation Model.

Definition at line 52 of file FastSimulationBase.cxx.

53 {
54 #ifdef G4MULTITHREADED
55  // Get current thread-ID
56  const auto tid = std::this_thread::get_id();
57  // Retrieve it from the FastSimModel map
58  auto fastsimmodelPair = m_fastsimmodelThreadMap.find(tid);
59  if(fastsimmodelPair == m_fastsimmodelThreadMap.end()) return nullptr;
60  return fastsimmodelPair->second;
61 #else
62  return m_FastSimModel;
63 #endif
64 }

◆ getRegion()

G4Region * FastSimulationBase::getRegion ( ) const
protectedinherited

Definition at line 22 of file FastSimulationBase.cxx.

23 {
24  if (m_regionName.value().empty()) {
25  return nullptr;
26  }
27  return G4RegionStore::GetInstance()->GetRegion(m_regionName.value());
28 }

◆ initializeFastSim()

StatusCode FastSimulationBase::initializeFastSim ( )
overrideinherited

Construct and setup the fast simulation model.

This method invokes the makeFastSimModel of the derived concrete tool type and assigns the configured regions. Errors are reported if regions are missing. In multi-threading jobs, this method is called once per worker thread.

Definition at line 32 of file FastSimulationBase.cxx.

32  {
33  ATH_MSG_VERBOSE( name() << "::initializeFastSim()" );
34 
35  // Make sure Fast Simulation Model isn't already registered
36  if(getFastSimModel()){
37  ATH_MSG_ERROR("Trying to create a Fast Simulation Model which already exists!");
38  return StatusCode::FAILURE;
39  }
40 
41  // Make the FastSimModel stored by this tool
42  auto* fastsimmodel = makeFastSimModel();
43  setFastSimModel(fastsimmodel);
44 
45  // Set the verbosity information on this thing - this will have to go into the makeFastSimModel methods...
46  //if(msgLvl(MSG::VERBOSE)) m_FastSimModel->SetVerboseLevel(10);
47  //else if(msgLvl(MSG::DEBUG)) m_FastSimModel->SetVerboseLevel(5);
48 
49  return StatusCode::SUCCESS;
50 }

◆ makeFastSimModel()

G4VFastSimulationModel * FastCaloSimTool::makeFastSimModel ( )
finaloverrideprotectedvirtual

Method to make the actual fast simulation model itself, which will be owned by the tool.

Must be implemented in all concrete base classes.

Definition at line 58 of file FastCaloSimTool.cxx.

◆ setFastSimModel()

void FastSimulationBase::setFastSimModel ( G4VFastSimulationModel *  fastsimmodel)
privateinherited

Set the current model. In hive, this gets assigned as the thread-local model.

Definition at line 66 of file FastSimulationBase.cxx.

67 {
68 #ifdef G4MULTITHREADED
69  // Make sure one isn't already assigned
70  const auto tid = std::this_thread::get_id();
71  ATH_MSG_DEBUG("Creating and registering FastSimModel " << fastsimmodel << " in thread " << tid);
72  m_fastsimmodelThreadMap.insert( std::make_pair(tid, fastsimmodel) );
73 #else
74  m_FastSimModel = fastsimmodel;
75 #endif
76 }

Member Data Documentation

◆ m_AbsEtaMax

Gaudi::Property<float> FastCaloSimTool::m_AbsEtaMax {this, "AbsEtaMax", 10, "Abs(Eta) upper bound for FastCaloSim"}
private

Definition at line 72 of file FastCaloSimTool.h.

◆ m_AbsEtaMin

Gaudi::Property<float> FastCaloSimTool::m_AbsEtaMin {this, "AbsEtaMin", 0, "Abs(Eta) lower bound for FastCaloSim"}
private

Definition at line 71 of file FastCaloSimTool.h.

◆ m_CaloCellContainerSDName

Gaudi::Property<std::string> FastCaloSimTool::m_CaloCellContainerSDName {this, "CaloCellContainerSDName", "", "Name of the associated CaloCellContainerSD"}
private

Definition at line 62 of file FastCaloSimTool.h.

◆ m_doElectrons

Gaudi::Property<bool> FastCaloSimTool::m_doElectrons {this, "doElectrons", true, "Flag to enable FCS simulation for electrons and positrons"}
private

Definition at line 69 of file FastCaloSimTool.h.

◆ m_doG4Transport

Gaudi::Property<bool> FastCaloSimTool::m_doG4Transport {this, "doG4Transport", false, "Flag to enable G4 transportation"}
private

Definition at line 64 of file FastCaloSimTool.h.

◆ m_doHadrons

Gaudi::Property<bool> FastCaloSimTool::m_doHadrons {this, "doHadrons", true, "Flag to enable FCS simulation for pions and other hadrons"}
private

Definition at line 70 of file FastCaloSimTool.h.

◆ m_doPhotons

Gaudi::Property<bool> FastCaloSimTool::m_doPhotons {this, "doPhotons", true, "Flag to enable FCS simulation for photons"}
private

Optional flags that allow to further limit the usage of fast simulation beyond the default configuration Note: For fast simulation jobs, default values should be used.

They are only useful in special cases where you want to further limit the usage of fast sim, e.g. if we want to replace certain parts of full simulation

Definition at line 68 of file FastCaloSimTool.h.

◆ m_doPunchThrough

Gaudi::Property<bool> FastCaloSimTool::m_doPunchThrough {this, "doPunchThrough", true, "Run punchthrough simulation for particle entering Calo-MS boundary"}
private

Definition at line 77 of file FastCaloSimTool.h.

◆ m_EkinMaxElectrons

Gaudi::Property<float> FastCaloSimTool::m_EkinMaxElectrons {this, "EkinMaxElectrons", std::numeric_limits<float>::max(), "Kinetic electron energy upper bound for FastCaloSim"}
private

Definition at line 76 of file FastCaloSimTool.h.

◆ m_EkinMaxPhotons

Gaudi::Property<float> FastCaloSimTool::m_EkinMaxPhotons {this, "EkinMaxPhotons", std::numeric_limits<float>::max(), "Kinetic photon energy upper bound for FastCaloSim"}
private

Definition at line 74 of file FastCaloSimTool.h.

◆ m_EkinMinElectrons

Gaudi::Property<float> FastCaloSimTool::m_EkinMinElectrons {this, "EkinMinElectrons", 0, "Kinetic electron energy lower bound for FastCaloSim"}
private

Definition at line 75 of file FastCaloSimTool.h.

◆ m_EkinMinPhotons

Gaudi::Property<float> FastCaloSimTool::m_EkinMinPhotons {this, "EkinMinPhotons", 0, "Kinetic photon energy lower bound for FastCaloSim"}
private

Definition at line 73 of file FastCaloSimTool.h.

◆ m_FastCaloSimCaloExtrapolation

PublicToolHandle<IFastCaloSimCaloExtrapolation> FastCaloSimTool::m_FastCaloSimCaloExtrapolation {this, "FastCaloSimCaloExtrapolation", "FastCaloSimCaloExtrapolation", ""}
private

Definition at line 51 of file FastCaloSimTool.h.

◆ m_FastCaloSimCaloTransportation

PublicToolHandle<IFastCaloSimCaloTransportation> FastCaloSimTool::m_FastCaloSimCaloTransportation {this, "FastCaloSimCaloTransportation", "FastCaloSimCaloTransportation", ""}
private

Definition at line 49 of file FastCaloSimTool.h.

◆ m_FastCaloSimSvc

ServiceHandle<ISF::IFastCaloSimParamSvc> FastCaloSimTool::m_FastCaloSimSvc {this, "ISF_FastCaloSimV2ParamSvc", "ISF_FastCaloSimV2ParamSvc"}
private

Definition at line 47 of file FastCaloSimTool.h.

◆ m_FastSimModel

G4VFastSimulationModel* FastSimulationBase::m_FastSimModel {}
privateinherited

The Fast Simulation Model to which this thing corresponds.

Definition at line 78 of file FastSimulationBase.h.

◆ m_G4CaloTransportTool

PublicToolHandle<IG4CaloTransportTool> FastCaloSimTool::m_G4CaloTransportTool {this, "G4CaloTransportTool", "G4CaloTransportTool", ""}
private

Definition at line 53 of file FastCaloSimTool.h.

◆ m_noRegions

Gaudi::Property<bool> FastSimulationBase::m_noRegions {this, "NoRegions", false}
protectedinherited

This Fast Simulation has no regions associated with it.

Definition at line 59 of file FastSimulationBase.h.

◆ m_PunchThroughSimWrapper

PublicToolHandle<IPunchThroughSimWrapper> FastCaloSimTool::m_PunchThroughSimWrapper {this, "PunchThroughSimWrapper", "PunchThroughSimWrapper", ""}
private

Definition at line 55 of file FastCaloSimTool.h.

◆ m_randomEngineName

Gaudi::Property<std::string> FastCaloSimTool::m_randomEngineName {this, "RandomStream", ""}
private

Definition at line 60 of file FastCaloSimTool.h.

◆ m_regionName

Gaudi::Property<std::string> FastSimulationBase::m_regionName {this, "RegionName", ""}
protectedinherited

The region to which this fast sim is assigned.

Definition at line 57 of file FastSimulationBase.h.

◆ m_rndmGenSvc

ServiceHandle<IAthRNGSvc> FastCaloSimTool::m_rndmGenSvc {this, "RandomSvc", "AthRNGSvc", ""}
private

Definition at line 58 of file FastCaloSimTool.h.


The documentation for this class was generated from the following files:
FastCaloSim
Definition: FastCaloSim.h:34
FastCaloSimTool::m_doHadrons
Gaudi::Property< bool > m_doHadrons
Definition: FastCaloSimTool.h:70
FastCaloSimTool::m_EkinMaxPhotons
Gaudi::Property< float > m_EkinMaxPhotons
Definition: FastCaloSimTool.h:74
FastCaloSim::StartOfAthenaEvent
void StartOfAthenaEvent(const EventContext &ctx)
Definition: FastCaloSim.cxx:85
FastCaloSimTool::m_doPunchThrough
Gaudi::Property< bool > m_doPunchThrough
Definition: FastCaloSimTool.h:77
FastCaloSimTool::m_EkinMinPhotons
Gaudi::Property< float > m_EkinMinPhotons
Definition: FastCaloSimTool.h:73
FastCaloSimTool::m_EkinMinElectrons
Gaudi::Property< float > m_EkinMinElectrons
Definition: FastCaloSimTool.h:75
FastSimulationBase::m_regionName
Gaudi::Property< std::string > m_regionName
The region to which this fast sim is assigned.
Definition: FastSimulationBase.h:57
FastSimulationBase::m_FastSimModel
G4VFastSimulationModel * m_FastSimModel
The Fast Simulation Model to which this thing corresponds.
Definition: FastSimulationBase.h:78
FastCaloSimTool::m_FastCaloSimSvc
ServiceHandle< ISF::IFastCaloSimParamSvc > m_FastCaloSimSvc
Definition: FastCaloSimTool.h:47
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
FastCaloSimTool::m_FastCaloSimCaloExtrapolation
PublicToolHandle< IFastCaloSimCaloExtrapolation > m_FastCaloSimCaloExtrapolation
Definition: FastCaloSimTool.h:51
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
FastCaloSimTool::m_G4CaloTransportTool
PublicToolHandle< IG4CaloTransportTool > m_G4CaloTransportTool
Definition: FastCaloSimTool.h:53
FastCaloSimTool::m_rndmGenSvc
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Definition: FastCaloSimTool.h:58
FastSimulationBase::setFastSimModel
void setFastSimModel(G4VFastSimulationModel *)
Set the current model. In hive, this gets assigned as the thread-local model.
Definition: FastSimulationBase.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FastCaloSimTool::m_PunchThroughSimWrapper
PublicToolHandle< IPunchThroughSimWrapper > m_PunchThroughSimWrapper
Definition: FastCaloSimTool.h:55
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FastSimulationBase::FastSimulationBase
FastSimulationBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FastSimulationBase.cxx:12
test_pyathena.parent
parent
Definition: test_pyathena.py:15
FastCaloSim::EndOfAthenaEvent
void EndOfAthenaEvent(const EventContext &ctx)
Definition: FastCaloSim.cxx:93
FastCaloSimTool::m_doG4Transport
Gaudi::Property< bool > m_doG4Transport
Definition: FastCaloSimTool.h:64
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FastCaloSimTool::m_doElectrons
Gaudi::Property< bool > m_doElectrons
Definition: FastCaloSimTool.h:69
FastSimulationBase::getFastSimModel
G4VFastSimulationModel * getFastSimModel()
Retrieve the current Fast Simulation Model.
Definition: FastSimulationBase.cxx:52
FastCaloSimTool::m_CaloCellContainerSDName
Gaudi::Property< std::string > m_CaloCellContainerSDName
Definition: FastCaloSimTool.h:62
FastCaloSimTool::m_randomEngineName
Gaudi::Property< std::string > m_randomEngineName
Definition: FastCaloSimTool.h:60
FastCaloSimTool::m_AbsEtaMax
Gaudi::Property< float > m_AbsEtaMax
Definition: FastCaloSimTool.h:72
FastSimulationBase::getRegion
G4Region * getRegion() const
Definition: FastSimulationBase.cxx:22
FastCaloSimTool::m_AbsEtaMin
Gaudi::Property< float > m_AbsEtaMin
Definition: FastCaloSimTool.h:71
ISF::FastCaloSim
@ FastCaloSim
Definition: SimulationFlavor.h:24
FastCaloSimTool::m_doPhotons
Gaudi::Property< bool > m_doPhotons
Optional flags that allow to further limit the usage of fast simulation beyond the default configurat...
Definition: FastCaloSimTool.h:68
FastCaloSimTool::m_FastCaloSimCaloTransportation
PublicToolHandle< IFastCaloSimCaloTransportation > m_FastCaloSimCaloTransportation
Definition: FastCaloSimTool.h:49
FastCaloSimTool::m_EkinMaxElectrons
Gaudi::Property< float > m_EkinMaxElectrons
Definition: FastCaloSimTool.h:76