ATLAS Offline Software
Loading...
Searching...
No Matches
SensitiveDetectorBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4ATLASTOOLS_SENSITIVEDETECTORBASE_H
6#define G4ATLASTOOLS_SENSITIVEDETECTORBASE_H
7
8// Base classes
11
12// Members
13#include "G4VSensitiveDetector.hh"
14#include "G4Types.hh"
15#include <GaudiKernel/StatusCode.h>
16
17// STL library
18#include <string>
19#include <vector>
20
21// Forward declarations
22class G4LogicalVolume;
23class G4VSensitiveDetector;
24
25
38class SensitiveDetectorBase : public extends<AthAlgTool, ISensitiveDetector>
39{
40
41 public:
42
44 SensitiveDetectorBase(const std::string& type, const std::string& name,
45 const IInterface *parent);
47 virtual ~SensitiveDetectorBase() = default;
48
54 StatusCode initializeSD() override;
55
57
59 virtual StatusCode SetupEvent(HitCollectionMap&) override {
60 return StatusCode::SUCCESS;
61 }
62
64
66 virtual StatusCode Gather(HitCollectionMap&) override {
67 return StatusCode::SUCCESS;
68 };
69
70 protected:
71
73
74 StatusCode assignSD(std::unique_ptr<G4VSensitiveDetector> sd,
75 const std::vector<std::string>& volumes) const;
76
78 Gaudi::Property<std::vector<std::string> > m_volumeNames{this, "LogicalVolumeNames", {}};
80 Gaudi::Property<std::vector<std::string> > m_outputCollectionNames{this, "OutputCollectionNames", {}};
81
83 Gaudi::Property<bool> m_noVolumes{this, "NoVolumes", false};
84
86 void SetSensitiveDetector(G4LogicalVolume*, G4VSensitiveDetector*) const;
87
88 private:
90
92 static bool matchStrings(const char *first, const char * second);
93
94}; // class SensitiveDetectorBase
95
96#endif
Small wrapper around hit collection map to facilitate accessing the hit collection.
StatusCode assignSD(std::unique_ptr< G4VSensitiveDetector > sd, const std::vector< std::string > &volumes) const
Assign SD to a list of volumes.
virtual StatusCode SetupEvent(HitCollectionMap &) override
Beginning of an athena event.
Gaudi::Property< std::vector< std::string > > m_volumeNames
All the volumes to which this SD is assigned.
StatusCode initializeSD() override
Setup an SD in the current thread.
virtual ~SensitiveDetectorBase()=default
Empty virtual destructor.
Gaudi::Property< bool > m_noVolumes
This SensitiveDetector has no volumes associated with it.
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.
static bool matchStrings(const char *first, const char *second)
Match two strings with wildcard support.
void SetSensitiveDetector(G4LogicalVolume *, G4VSensitiveDetector *) const
Method stolen from G4VUserDetectorConstruction in G4 10.2.
virtual StatusCode Gather(HitCollectionMap &) override
End of an athena event.