ATLAS Offline Software
ZDC_G4CalibSDTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "ZDC_G4CalibSDTool.h"
5 #include "ZDC_G4CalibSD.h"
7 
8 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
9 
10 ZDC_G4CalibSDTool::ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)
12 {
13  declareProperty("deadSD",m_deadSD = false);
14  declareProperty("doPid",m_doPid = false);
15 }
16 
17 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
18 
20 {
21  ATH_MSG_VERBOSE( "ZDC_G4CalibSDTool::Gather()" );
22  if(!getSD())
23  {
24  ATH_MSG_ERROR ("Gather: ZDC_G4CalibSD never created!");
25  return StatusCode::FAILURE;
26  }
27  else
28  {
29  ZDC_G4CalibSD *localSD = dynamic_cast<ZDC_G4CalibSD*>(getSD());
30  if(!localSD)
31  {
32  ATH_MSG_ERROR ("Gather: Failed to cast m_SD into ZDC_G4CalibSD.");
33  return StatusCode::FAILURE;
34  }
35  localSD->EndOfAthenaEvent();
36  }
37  return StatusCode::SUCCESS;
38 }
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
42 G4VSensitiveDetector* ZDC_G4CalibSDTool::makeSD() const
43 {
44  ATH_MSG_DEBUG( "Initializing ZDC_G4CalibSD" );
45 
47 
48  //Create ZDC_EscapedEnergyProcessing if desired
49  if (m_deadSD){
50  ATH_MSG_DEBUG("Creating EscapedEnergyProcessing and adding to registry");
51  // Initialize the escaped energy processing for ZDC volumes.
52  std::unique_ptr<CaloG4::VEscapedEnergyProcessing> eep(new ZDC_EscapedEnergyProcessing(theCalibSD));
53 
55  registry->AddAndAdoptProcessing( "ZDC::", std::move(eep) );
56  }
57 
58  return theCalibSD;
59 }
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
EscapedEnergyRegistry.h
SensitiveDetectorBase
Common base class for tools that create and manage Geant4 sensitive detectors.
Definition: SensitiveDetectorBase.h:42
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SensitiveDetectorBase::getSD
G4VSensitiveDetector * getSD()
Retrieve the current SD.
Definition: SensitiveDetectorBase.cxx:123
ZDC_G4CalibSD
Definition: ZDC_G4CalibSD.h:24
CaloG4::EscapedEnergyRegistry
Keeps track of which types of volumes use which VEscapedEnergyProcessing objects.
Definition: EscapedEnergyRegistry.h:52
ZDC_G4CalibSDTool::ZDC_G4CalibSDTool
ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ZDC_G4CalibSDTool.cxx:10
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ZDC_G4CalibSDTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ZDC_G4CalibSD::EndOfAthenaEvent
void EndOfAthenaEvent()
Definition: ZDC_G4CalibSD.cxx:125
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloG4::EscapedEnergyRegistry::GetInstance
static EscapedEnergyRegistry * GetInstance()
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ZDC_G4CalibSDTool::Gather
StatusCode Gather() override final
End of an athena event.
Definition: ZDC_G4CalibSDTool.cxx:19
ZDC_EscapedEnergyProcessing
Definition: ZDC_EscapedEnergyProcessing.h:33
SensitiveDetectorBase::m_outputCollectionNames
Gaudi::Property< std::vector< std::string > > m_outputCollectionNames
Names of all output collections written out by this SD.
Definition: SensitiveDetectorBase.h:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ZDC_G4CalibSD.h
ZDC_G4CalibSDTool::m_deadSD
bool m_deadSD
Definition: ZDC_G4CalibSDTool.h:34
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ZDC_G4CalibSDTool::makeSD
G4VSensitiveDetector * makeSD() const override final
Definition: ZDC_G4CalibSDTool.cxx:42
ZDC_G4CalibSDTool::m_doPid
bool m_doPid
Definition: ZDC_G4CalibSDTool.h:35