ATLAS Offline Software
Loading...
Searching...
No Matches
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
10ZDC_G4CalibSDTool::ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)
11 : SensitiveDetectorBase(type, name, 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
42G4VSensitiveDetector* ZDC_G4CalibSDTool::makeSD() const
43{
44 ATH_MSG_DEBUG( "Initializing ZDC_G4CalibSD" );
45
46 ZDC_G4CalibSD *theCalibSD = new ZDC_G4CalibSD(name(), m_outputCollectionNames[0], m_doPid);
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Keeps track of which types of volumes use which VEscapedEnergyProcessing objects.
static EscapedEnergyRegistry * GetInstance()
void AddAndAdoptProcessing(const G4String &name, std::unique_ptr< VEscapedEnergyProcessing > process)
Gaudi::Property< std::vector< std::string > > m_outputCollectionNames
Names of all output collections written out by this SD.
SensitiveDetectorBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
G4VSensitiveDetector * getSD()
Retrieve the current SD.
G4VSensitiveDetector * makeSD() const override final
ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode Gather() override final
End of an athena event.