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"
9
10//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
11
12ZDC_G4CalibSDTool::ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)
13 : SensitiveDetectorBase(type, name, parent)
14{
15 declareProperty("deadSD",m_deadSD = false);
16 declareProperty("doPid",m_doPid = false);
17}
18
19//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
20
22{
25 return StatusCode::SUCCESS;
26}
27
29{
30 ATH_MSG_VERBOSE( "ZDC_G4CalibSDTool::Gather()" );
31 auto* hitCollection = hitCollections.Find<ZDC_CalibrationHitContainerBuilder>(m_outputCollectionNames[0]);
32 if (!hitCollection) {
33 return StatusCode::FAILURE;
34 }
35 hitCollection->Finalize();
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_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Keeps track of which types of volumes use which VEscapedEnergyProcessing objects.
static EscapedEnergyRegistry * GetInstance()
void AddAndAdoptProcessing(const G4String &name, std::unique_ptr< VEscapedEnergyProcessing > process)
Small wrapper around hit collection map to facilitate accessing the hit collection.
StatusCode Record(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx)
Record the hit collection hitCollectionName to the StoreGate sgKey.
T * Find(std::string const &hitCollectionName)
Get the hit collection for a given SDs.
std::pair< StorageIterator, bool > Emplace(std::string const &hitCollectionName, CollectionArgs &&... args)
Insert a container in the map with in-place construction.
virtual StatusCode Gather() override
End of an athena event.
virtual StatusCode SetupEvent() override
Beginning of an athena event.
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 * makeSD() const override final
ZDC_G4CalibSDTool(const std::string &type, const std::string &name, const IInterface *parent)