ATLAS Offline Software
LArFastShowerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArFastShowerTool.h"
9 #include "LArFastShower.h"
10 #include "G4SDManager.hh"
11 
12 LArFastShowerTool::LArFastShowerTool(const std::string& type, const std::string& name,
13  const IInterface *parent)
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");
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("SensitiveDetector" , m_fastSimDedicatedSD , "Fast sim dedicated SD for this setup");
47  declareProperty("ShowerLibSvc" , m_showerLibSvc, "Handle on the shower library service");
49 
50 }
51 
53 {
54  ATH_MSG_VERBOSE( name() << "::initialize()" );
55  CHECK( m_showerLibSvc.retrieve() );
57 }
58 
59 G4VFastSimulationModel* LArFastShowerTool::makeFastSimModel()
60 {
61  ATH_MSG_DEBUG( "Initializing Fast Sim Model" );
62  IFastSimDedicatedSD* fastSD = dynamic_cast<IFastSimDedicatedSD*>(
63  G4SDManager::GetSDMpointer()->FindSensitiveDetector(m_fastSimDedicatedSD, false) );
64  if (fastSD){
65  ATH_MSG_INFO( "SD " << m_fastSimDedicatedSD << " already created." );
66  } else if ("BarrelFastSimDedicatedSD" == m_fastSimDedicatedSD){
67  fastSD = new BarrelFastSimDedicatedSD( &*detStore() );
68  } else if ("EndcapFastSimDedicatedSD" == m_fastSimDedicatedSD){
69  fastSD = new EndcapFastSimDedicatedSD( &*detStore() );
70  } else if ("FCALFastSimDedicatedSD" == m_fastSimDedicatedSD){
71  fastSD = new FCALFastSimDedicatedSD( &*detStore() );
72  } else {
73  ATH_MSG_FATAL( "Fast sim SD type " << m_fastSimDedicatedSD << " not found!" );
74  throw std::runtime_error("Bad SD name");
75  }
76  G4SDManager::GetSDMpointer()->AddNewDetector(fastSD);
77 
78  // Create a fresh Fast Sim Model
79  return new LArFastShower(name(), m_configuration, fastSD);
80 }
81 
83 {
84  // SD is taken care of by the SD tools
85  return StatusCode::SUCCESS;
86 }
LArFastShowerTool.h
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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
EndcapFastSimDedicatedSD.h
FastShowerConfigStruct::m_absCrackEta1
double m_absCrackEta1
Definition: FastShowerConfigStruct.h:34
LArFastShowerTool::m_configuration
FastShowerConfigStruct m_configuration
Definition: LArFastShowerTool.h:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArFastShowerTool::EndOfAthenaEvent
StatusCode EndOfAthenaEvent() override final
End of an athena event - do any tidying up required at the end of each athena event.
Definition: LArFastShowerTool.cxx:82
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
Definition: FastSimulationBase.h:26
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
FastShowerConfigStruct::m_Neut_MaxEneShowerLib
double m_Neut_MaxEneShowerLib
upper energy limit for neutron frozen showers
Definition: FastShowerConfigStruct.h:23
LArFastShowerTool::makeFastSimModel
virtual G4VFastSimulationModel * makeFastSimModel() override final
Method to make the actual fast simulation model itself, which will be owned by the tool.
Definition: LArFastShowerTool.cxx:59
FastShowerConfigStruct::m_Neut_MinEneShowerLib
double m_Neut_MinEneShowerLib
lower energy limit for neutron frozen showers
Definition: FastShowerConfigStruct.h:22
FastShowerConfigStruct::m_absHighEta
double m_absHighEta
Definition: FastShowerConfigStruct.h:32
BarrelFastSimDedicatedSD.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArFastShowerTool::initialize
StatusCode initialize() override final
Definition: LArFastShowerTool.cxx:52
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:195
LArFastShower.h
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
FastShowerConfigStruct::m_g_FlagShowerLib
bool m_g_FlagShowerLib
switch for photon frozen showers
Definition: FastShowerConfigStruct.h:17
FCALFastSimDedicatedSD.h
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
LArFastShowerTool::LArFastShowerTool
LArFastShowerTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition: LArFastShowerTool.cxx:12
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
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
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
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
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30