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

NEEDS DOCUMENTATION. More...

#include <LArFastShowerTool.h>

Inheritance diagram for LArFastShowerTool:
Collaboration diagram for LArFastShowerTool:

Public Member Functions

 LArFastShowerTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor. More...
 
virtual ~LArFastShowerTool ()
 Default destructor. More...
 
StatusCode initialize () override final
 
StatusCode EndOfAthenaEvent () override final
 End of an athena event - do any tidying up required at the end of each athena event. More...
 
StatusCode initializeFastSim () override
 Construct and setup the fast simulation model. More...
 
virtual StatusCode BeginOfAthenaEvent () override
 Begin of an athena event - do anything that needs to be done at the beginning of each athena event. 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...
 

Protected Attributes

Gaudi::Property< std::vector< std::string > > m_regionNames {this, "RegionNames", {}}
 All the regions 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

std::string m_fastSimDedicatedSD
 Shower library sensitive detector for this shower. More...
 
ServiceHandle< ILArG4ShowerLibSvcm_showerLibSvc
 Pointer to the shower library service. More...
 
FastShowerConfigStruct m_configuration
 
G4VFastSimulationModel * m_FastSimModel {}
 The Fast Simulation Model to which this thing corresponds. More...
 

Detailed Description

NEEDS DOCUMENTATION.

Definition at line 20 of file LArFastShowerTool.h.

Constructor & Destructor Documentation

◆ LArFastShowerTool()

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

Default constructor.

Definition at line 12 of file LArFastShowerTool.cxx.

15  m_fastSimDedicatedSD (""), // Empty by default.
16  m_showerLibSvc("LArG4ShowerLibSvc", name)
17 {
18  declareProperty("EFlagToShowerLib", m_configuration.m_e_FlagShowerLib = true, "Switch for e+/- frozen showers");
19  declareProperty("EMinEneShowerLib", m_configuration.m_e_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for e+/- frozen showers");
20  declareProperty("EMaxEneShowerLib", m_configuration.m_e_MaxEneShowerLib = 1.0*CLHEP::GeV, "Maximum energy for e+/- frozen showers");
21 
22  declareProperty("GFlagToShowerLib", m_configuration.m_g_FlagShowerLib = true, "Switch for photon frozen showers");
23  declareProperty("GMinEneShowerLib", m_configuration.m_g_MinEneShowerLib = 0.*CLHEP::GeV, "Minimum energy for photon frozen showers");
24  declareProperty("GMaxEneShowerLib", m_configuration.m_g_MaxEneShowerLib = 0.010*CLHEP::GeV, "Maximum energy for photon frozen showers");
25 
26  declareProperty("NeutFlagToShowerLib", m_configuration.m_Neut_FlagShowerLib = true, "Switch for neutron frozen showers");
27  declareProperty("NeutMinEneShowerLib", m_configuration.m_Neut_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for neutron frozen showers");
28  declareProperty("NeutMaxEneShowerLib", m_configuration.m_Neut_MaxEneShowerLib = 0.1*CLHEP::GeV, "Maximum energy for neutron frozen showers");
29 
30  declareProperty("PionFlagToShowerLib", m_configuration.m_Pion_FlagShowerLib = true, "Switch for neutron frozen showers");
31  declareProperty("PionMinEneShowerLib", m_configuration.m_Pion_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for neutron frozen showers");
32  declareProperty("PionMaxEneShowerLib", m_configuration.m_Pion_MaxEneShowerLib = 2.0*CLHEP::GeV, "Maximum energy for neutron frozen showers");
33 
34  declareProperty("ContainLow", m_configuration.m_containLow = true, "Switch for containment at low eta");
35  declareProperty("AbsLowEta", m_configuration.m_absLowEta, "");
36  declareProperty("ContainHigh", m_configuration.m_containHigh = true, "Switch for containment at high eta");
37  declareProperty("AbsHighEta", m_configuration.m_absHighEta, "");
38  declareProperty("ContainCrack", m_configuration.m_containCrack = true, "Switch for containment in the crack region");
39  declareProperty("AbsCrackEta1", m_configuration.m_absCrackEta1, "");
40  declareProperty("AbsCrackEta2", m_configuration.m_absCrackEta2, "");
41 
42  declareProperty("GeneratedStartingPointsFile", m_configuration.m_generated_starting_points_file = "",
43  "Name of file for generated SPs. Do not touch until you want to produce a new library");
44  declareProperty("GeneratedStartingPointsRatio", m_configuration.m_generated_starting_points_ratio = 0.02, "Ratio of SPs that goes to output");
45  declareProperty("DetectorTag", m_configuration.m_detector_tag, "Which detector is this?");
46  declareProperty("ApplyRRWeights", m_configuration.m_applyRRWeights, "Should the weights set by NRR/PRR be applied to Frozen Shower Energy deposits?");
47  declareProperty("SensitiveDetector" , m_fastSimDedicatedSD , "Fast sim dedicated SD for this setup");
48  declareProperty("ShowerLibSvc" , m_showerLibSvc, "Handle on the shower library service");
50 
51 }

◆ ~LArFastShowerTool()

virtual LArFastShowerTool::~LArFastShowerTool ( )
inlinevirtual

Default destructor.

Definition at line 26 of file LArFastShowerTool.h.

Member Function Documentation

◆ BeginOfAthenaEvent()

virtual StatusCode FastSimulationBase::BeginOfAthenaEvent ( )
inlineoverridevirtualinherited

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

Reimplemented in FastCaloSimTool.

Definition at line 41 of file FastSimulationBase.h.

41 { return StatusCode::SUCCESS; }

◆ deleteFastSimModel()

void FastSimulationBase::deleteFastSimModel ( )
privateinherited

Delete the current model.

Definition at line 99 of file FastSimulationBase.cxx.

100 {
101 #ifdef G4MULTITHREADED
102  for(auto& threadMapPair : m_fastsimmodelThreadMap)
103  {
104  auto fastSimModel = threadMapPair.second;
105  if (fastSimModel)
106  delete fastSimModel;
107  }
108  m_fastsimmodelThreadMap.clear();
109 #else
110  if(m_FastSimModel)
111  {
112  delete m_FastSimModel;
113  m_FastSimModel = 0;
114  }
115 #endif
116 }

◆ EndOfAthenaEvent()

StatusCode LArFastShowerTool::EndOfAthenaEvent ( )
finaloverridevirtual

End of an athena event - do any tidying up required at the end of each athena event.

Reimplemented from FastSimulationBase.

Definition at line 83 of file LArFastShowerTool.cxx.

84 {
85  // SD is taken care of by the SD tools
86  return StatusCode::SUCCESS;
87 }

◆ 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 73 of file FastSimulationBase.cxx.

74 {
75 #ifdef G4MULTITHREADED
76  // Get current thread-ID
77  const auto tid = std::this_thread::get_id();
78  // Retrieve it from the FastSimModel map
79  auto fastsimmodelPair = m_fastsimmodelThreadMap.find(tid);
80  if(fastsimmodelPair == m_fastsimmodelThreadMap.end()) return nullptr;
81  return fastsimmodelPair->second;
82 #else
83  return m_FastSimModel;
84 #endif
85 }

◆ initialize()

StatusCode LArFastShowerTool::initialize ( )
finaloverride

Definition at line 53 of file LArFastShowerTool.cxx.

54 {
55  ATH_MSG_VERBOSE( name() << "::initialize()" );
56  CHECK( m_showerLibSvc.retrieve() );
58 }

◆ 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 23 of file FastSimulationBase.cxx.

23  {
24  ATH_MSG_VERBOSE( name() << "::initializeFastSim()" );
25 
26  // Make sure Fast Simulation Model isn't already registered
27  if(getFastSimModel()){
28  ATH_MSG_ERROR("Trying to create a Fast Simulation Model which already exists!");
29  return StatusCode::FAILURE;
30  }
31 
32  // Make the FastSimModel stored by this tool
33  auto* fastsimmodel = makeFastSimModel();
34  setFastSimModel(fastsimmodel);
35 
36  // Set the verbosity information on this thing - this will have to go into the makeFastSimModel methods...
37  //if(msgLvl(MSG::VERBOSE)) m_FastSimModel->SetVerboseLevel(10);
38  //else if(msgLvl(MSG::DEBUG)) m_FastSimModel->SetVerboseLevel(5);
39 
40  // Go through the regions and hook the fast simulation up
41  G4RegionStore* regionStore = G4RegionStore::GetInstance();
42  bool missedOne = false;
43  for (const auto& myreg : m_regionNames.value()){
44  int found=0; // Regions with more than one name...
45  for (auto* areg : *regionStore){
46  if (myreg.data()==areg->GetName()){
47  ++found;
48  G4FastSimulationManager* theFastSimulationManager = areg->GetFastSimulationManager();
49 
50  // Build a new fast sim manager if necessary
51  if ( theFastSimulationManager == 0 ) theFastSimulationManager = new G4FastSimulationManager(areg);
52  theFastSimulationManager->AddFastSimulationModel(getFastSimModel());
53  theFastSimulationManager->ActivateFastSimulationModel(getFastSimModel()->GetName());
54  }
55  } // Loop over regions
56  if (0==found){
57  ATH_MSG_ERROR( "Region " << myreg << " not found." );
58  missedOne=true;
59  } else {
60  ATH_MSG_VERBOSE( found << " copies of region " << myreg << " found; fast simulation " << name() << " assigned." );
61  }
62  } // Loop over regions I want
63 
64  // Crash out if we have failed to assign a volume - this is bad news!
65  if (missedOne && !m_noRegions){
66  ATH_MSG_ERROR( "Failed to assign at least one volume to Fast Simulation Model " << name() );
67  return StatusCode::FAILURE;
68  }
69 
70  return StatusCode::SUCCESS;
71 }

◆ makeFastSimModel()

G4VFastSimulationModel * LArFastShowerTool::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 60 of file LArFastShowerTool.cxx.

61 {
62  ATH_MSG_DEBUG( "Initializing Fast Sim Model" );
63  IFastSimDedicatedSD* fastSD = dynamic_cast<IFastSimDedicatedSD*>(
64  G4SDManager::GetSDMpointer()->FindSensitiveDetector(m_fastSimDedicatedSD, false) );
65  if (fastSD) {
66  ATH_MSG_DEBUG( "SD " << m_fastSimDedicatedSD << " already created." );
67  } else if ("BarrelFastSimDedicatedSD" == m_fastSimDedicatedSD){
68  fastSD = new BarrelFastSimDedicatedSD( &*detStore(), msgLevel(MSG::DEBUG) );
69  } else if ("EndcapFastSimDedicatedSD" == m_fastSimDedicatedSD){
70  fastSD = new EndcapFastSimDedicatedSD( &*detStore(), msgLevel(MSG::DEBUG) );
71  } else if ("FCALFastSimDedicatedSD" == m_fastSimDedicatedSD){
72  fastSD = new FCALFastSimDedicatedSD( &*detStore(), msgLevel(MSG::DEBUG) );
73  } else {
74  ATH_MSG_FATAL( "Fast sim SD type " << m_fastSimDedicatedSD << " not found!" );
75  throw std::runtime_error("Bad SD name");
76  }
77  G4SDManager::GetSDMpointer()->AddNewDetector(fastSD);
78 
79  // Create a fresh Fast Sim Model
80  return new LArFastShower(name(), m_configuration, fastSD);
81 }

◆ setFastSimModel()

void FastSimulationBase::setFastSimModel ( G4VFastSimulationModel *  fastsimmodel)
privateinherited

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

Definition at line 87 of file FastSimulationBase.cxx.

88 {
89 #ifdef G4MULTITHREADED
90  // Make sure one isn't already assigned
91  const auto tid = std::this_thread::get_id();
92  ATH_MSG_DEBUG("Creating and registering FastSimModel " << fastsimmodel << " in thread " << tid);
93  m_fastsimmodelThreadMap.insert( std::make_pair(tid, fastsimmodel) );
94 #else
95  m_FastSimModel = fastsimmodel;
96 #endif
97 }

Member Data Documentation

◆ m_configuration

FastShowerConfigStruct LArFastShowerTool::m_configuration
private

Definition at line 41 of file LArFastShowerTool.h.

◆ m_fastSimDedicatedSD

std::string LArFastShowerTool::m_fastSimDedicatedSD
private

Shower library sensitive detector for this shower.

Definition at line 39 of file LArFastShowerTool.h.

◆ m_FastSimModel

G4VFastSimulationModel* FastSimulationBase::m_FastSimModel {}
privateinherited

The Fast Simulation Model to which this thing corresponds.

Definition at line 74 of file FastSimulationBase.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 55 of file FastSimulationBase.h.

◆ m_regionNames

Gaudi::Property<std::vector<std::string> > FastSimulationBase::m_regionNames {this, "RegionNames", {}}
protectedinherited

All the regions to which this fast sim is assigned.

Definition at line 53 of file FastSimulationBase.h.

◆ m_showerLibSvc

ServiceHandle<ILArG4ShowerLibSvc> LArFastShowerTool::m_showerLibSvc
private

Pointer to the shower library service.

Definition at line 40 of file LArFastShowerTool.h.


The documentation for this class was generated from the following files:
FastShowerConfigStruct::m_g_MaxEneShowerLib
double m_g_MaxEneShowerLib
lower energy limit for photon frozen showers
Definition: FastShowerConfigStruct.h:18
FastShowerConfigStruct::m_absLowEta
double m_absLowEta
Definition: FastShowerConfigStruct.h:30
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FastShowerConfigStruct::m_absCrackEta1
double m_absCrackEta1
Definition: FastShowerConfigStruct.h:34
LArFastShowerTool::m_configuration
FastShowerConfigStruct m_configuration
Definition: LArFastShowerTool.h:41
FastShowerConfigStruct::m_detector_tag
int m_detector_tag
name for the detector tag for the ShowerLibSvc
Definition: FastShowerConfigStruct.h:38
EndcapFastSimDedicatedSD
NEEDS DOCUMENTATION.
Definition: EndcapFastSimDedicatedSD.h:24
initialize
void initialize()
Definition: run_EoverP.cxx:894
FastShowerConfigStruct::m_Pion_FlagShowerLib
bool m_Pion_FlagShowerLib
switch for pion frozen showers
Definition: FastShowerConfigStruct.h:25
FastSimulationBase::m_FastSimModel
G4VFastSimulationModel * m_FastSimModel
The Fast Simulation Model to which this thing corresponds.
Definition: FastSimulationBase.h:74
IFastSimDedicatedSD
This is the interface for the fast simulation dedicated sensitive detector.
Definition: IFastSimDedicatedSD.h:13
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
FCALFastSimDedicatedSD
NEEDS DOCUMENTATION.
Definition: FCALFastSimDedicatedSD.h:22
FastSimulationBase::m_noRegions
Gaudi::Property< bool > m_noRegions
This Fast Simulation has no regions associated with it.
Definition: FastSimulationBase.h:55
FastShowerConfigStruct::m_applyRRWeights
bool m_applyRRWeights
Definition: FastShowerConfigStruct.h:41
FastShowerConfigStruct::m_Neut_MaxEneShowerLib
double m_Neut_MaxEneShowerLib
upper energy limit for neutron frozen showers
Definition: FastShowerConfigStruct.h:23
FastShowerConfigStruct::m_Neut_MinEneShowerLib
double m_Neut_MinEneShowerLib
lower energy limit for neutron frozen showers
Definition: FastShowerConfigStruct.h:22
FastSimulationBase::setFastSimModel
void setFastSimModel(G4VFastSimulationModel *)
Set the current model. In hive, this gets assigned as the thread-local model.
Definition: FastSimulationBase.cxx:87
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FastShowerConfigStruct::m_absHighEta
double m_absHighEta
Definition: FastShowerConfigStruct.h:32
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:11
FastShowerConfigStruct::m_absCrackEta2
double m_absCrackEta2
Definition: FastShowerConfigStruct.h:35
FastShowerConfigStruct::m_showerLibSvcName
std::string m_showerLibSvcName
Definition: FastShowerConfigStruct.h:40
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
LArFastShower
NEEDS DOCUMENTATION.
Definition: LArFastShower.h:31
FastShowerConfigStruct::m_g_MinEneShowerLib
double m_g_MinEneShowerLib
upper energy limit for photon frozen showers
Definition: FastShowerConfigStruct.h:19
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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
FastShowerConfigStruct::m_generated_starting_points_ratio
float m_generated_starting_points_ratio
switch for shower starting point record
Definition: FastShowerConfigStruct.h:37
FastShowerConfigStruct::m_Neut_FlagShowerLib
bool m_Neut_FlagShowerLib
switch for neutron frozen showers
Definition: FastShowerConfigStruct.h:21
FastShowerConfigStruct::m_Pion_MinEneShowerLib
double m_Pion_MinEneShowerLib
lower energy limit for pion frozen showers
Definition: FastShowerConfigStruct.h:26
FastSimulationBase::getFastSimModel
G4VFastSimulationModel * getFastSimModel()
Retrieve the current Fast Simulation Model.
Definition: FastSimulationBase.cxx:73
FastShowerConfigStruct::m_g_FlagShowerLib
bool m_g_FlagShowerLib
switch for photon frozen showers
Definition: FastShowerConfigStruct.h:17
FastShowerConfigStruct::m_generated_starting_points_file
std::string m_generated_starting_points_file
switch for shower starting point record
Definition: FastShowerConfigStruct.h:36
LArFastShowerTool::m_fastSimDedicatedSD
std::string m_fastSimDedicatedSD
Shower library sensitive detector for this shower.
Definition: LArFastShowerTool.h:39
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
FastShowerConfigStruct::m_e_FlagShowerLib
bool m_e_FlagShowerLib
switch for electron frozen showers
Definition: FastShowerConfigStruct.h:13
BarrelFastSimDedicatedSD
NEEDS DOCUMENTATION.
Definition: BarrelFastSimDedicatedSD.h:26
FastShowerConfigStruct::m_e_MaxEneShowerLib
double m_e_MaxEneShowerLib
upper energy limit for electron frozen showers
Definition: FastShowerConfigStruct.h:15
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArFastShowerTool::m_showerLibSvc
ServiceHandle< ILArG4ShowerLibSvc > m_showerLibSvc
Pointer to the shower library service.
Definition: LArFastShowerTool.h:40
DEBUG
#define DEBUG
Definition: page_access.h:11
FastShowerConfigStruct::m_containLow
bool m_containLow
switch for containment check at low eta
Definition: FastShowerConfigStruct.h:29
FastShowerConfigStruct::m_containCrack
bool m_containCrack
switch for containment check in crack region
Definition: FastShowerConfigStruct.h:33
FastShowerConfigStruct::m_e_MinEneShowerLib
double m_e_MinEneShowerLib
lower energy limit for electron frozen showers
Definition: FastShowerConfigStruct.h:14
FastShowerConfigStruct::m_containHigh
bool m_containHigh
switch for containment check at high eta
Definition: FastShowerConfigStruct.h:31
FastShowerConfigStruct::m_Pion_MaxEneShowerLib
double m_Pion_MaxEneShowerLib
upper energy limit for pion frozen showers
Definition: FastShowerConfigStruct.h:27