Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MultiSensitiveDetector Class Reference

#include <G4MultiSensitiveDetector.hh>

Inheritance diagram for G4MultiSensitiveDetector:

Public Types

using sds_t = std::vector<G4VSensitiveDetector*>
using sdsConstIter = sds_t::const_iterator

Public Member Functions

 ~G4MultiSensitiveDetector () override=default
 G4MultiSensitiveDetector (const G4MultiSensitiveDetector &rhs)=default
G4MultiSensitiveDetectoroperator= (const G4MultiSensitiveDetector &rhs)=default
void Initialize (G4HCofThisEvent *) override
void EndOfEvent (G4HCofThisEvent *) override
void clear () override
void DrawAll () override
void PrintAll () override
G4VSensitiveDetectorClone () const override
G4VSensitiveDetectorGetSD (const int i) const
sds_t::size_type GetSize () const
sdsConstIter GetBegin () const
sdsConstIter GetEnd () const
void ClearSDs ()
void AddSD (G4VSensitiveDetector *sd)
 G4VSensitiveDetector (const G4String &name)
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (const G4String &name)
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
virtual ~G4VSensitiveDetector ()=default
G4bool operator== (const G4VSensitiveDetector &right) const
G4bool operator!= (const G4VSensitiveDetector &right) const
G4bool Hit (G4Step *aStep)
void SetROgeometry (G4VReadOutGeometry *value)
void SetFilter (G4VSDFilter *value)
G4int GetNumberOfCollections () const
const G4StringGetCollectionName (G4int id) const
void SetVerboseLevel (G4int vl)
void Activate (G4bool activeFlag)
G4bool isActive () const
const G4StringGetName () const
const G4StringGetPathName () const
const G4StringGetFullPathName () const
G4VReadOutGeometryGetROgeometry () const
G4VSDFilterGetFilter () const

Protected Member Functions

G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist) override
G4int GetCollectionID (G4int i) final

Additional Inherited Members

Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
G4String SensitiveDetectorName
G4String thePathName
G4String fullPathName
G4int verboseLevel {0}
G4bool active {true}
G4VReadOutGeometryROgeometry {nullptr}
G4VSDFilterfilter {nullptr}

Detailed Description

Definition at line 45 of file G4MultiSensitiveDetector.hh.

Member Typedef Documentation

◆ sds_t

Definition at line 48 of file G4MultiSensitiveDetector.hh.

◆ sdsConstIter

using G4MultiSensitiveDetector::sdsConstIter = sds_t::const_iterator

Definition at line 49 of file G4MultiSensitiveDetector.hh.

Constructor & Destructor Documentation

◆ ~G4MultiSensitiveDetector()

G4MultiSensitiveDetector::~G4MultiSensitiveDetector ( )
overridedefault

◆ G4MultiSensitiveDetector()

G4MultiSensitiveDetector::G4MultiSensitiveDetector ( const G4MultiSensitiveDetector & rhs)
default

Member Function Documentation

◆ AddSD()

void G4MultiSensitiveDetector::AddSD ( G4VSensitiveDetector * sd)
inline

Definition at line 79 of file G4MultiSensitiveDetector.hh.

79{ fSensitiveDetectors.push_back(sd); }

◆ clear()

void G4MultiSensitiveDetector::clear ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 48 of file G4MultiSensitiveDetector.cc.

49{
50 for (auto sd : fSensitiveDetectors)
51 sd->clear();
52}

◆ ClearSDs()

void G4MultiSensitiveDetector::ClearSDs ( )
inline

Definition at line 78 of file G4MultiSensitiveDetector.hh.

78{ fSensitiveDetectors.clear(); }

◆ Clone()

G4VSensitiveDetector * G4MultiSensitiveDetector::Clone ( ) const
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 88 of file G4MultiSensitiveDetector.cc.

89{
90 auto newInst = new G4MultiSensitiveDetector(this->GetName());
91 for (auto sd : fSensitiveDetectors)
92 newInst->AddSD(sd->Clone());
93 return newInst;
94}
G4MultiSensitiveDetector(const G4MultiSensitiveDetector &rhs)=default
const G4String & GetName() const

◆ DrawAll()

void G4MultiSensitiveDetector::DrawAll ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 54 of file G4MultiSensitiveDetector.cc.

55{
56 for (auto sd : fSensitiveDetectors)
57 sd->DrawAll();
58}

◆ EndOfEvent()

void G4MultiSensitiveDetector::EndOfEvent ( G4HCofThisEvent * )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 41 of file G4MultiSensitiveDetector.cc.

42{
43 // SDManager is resposnsible for calling this since the granular SDs
44 // are also registered
45 // for ( auto sd : fSensitiveDetectors ) sd->EndOfEvent(hcte);
46}

◆ G4VSensitiveDetector() [1/2]

Definition at line 56 of file G4VSensitiveDetector.cc.

34{
35 std::size_t sLast = name.rfind('/');
36 if (sLast == std::string::npos) { // detector name only
38 thePathName = "/";
39 }
40 else { // name conatin the directory path
42 SensitiveDetectorName.erase(0, sLast + 1);
44 thePathName.erase(sLast + 1);
45 if (thePathName[0] != '/') thePathName.insert(0, "/");
46 }
48}
const char * name(G4int ptype)

Referenced by AddSD(), Clone(), GetSD(), and operator=().

◆ G4VSensitiveDetector() [2/2]

◆ GetBegin()

sdsConstIter G4MultiSensitiveDetector::GetBegin ( ) const
inline

Definition at line 76 of file G4MultiSensitiveDetector.hh.

76{ return fSensitiveDetectors.begin(); }

◆ GetCollectionID()

G4int G4MultiSensitiveDetector::GetCollectionID ( G4int i)
finalprotectedvirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 74 of file G4MultiSensitiveDetector.cc.

75{
77 msg << GetName()
78 << " : This method cannot be called for an instance of type "
79 "G4MultiSensitiveDetector."
80 << " First retrieve a contained G4VSensitiveDetector with. i.e. GetSD "
81 "and then "
82 << " call this method.";
83 G4Exception("G4MultiSensitiveDetector::GetCollectionID", "Det0011", FatalException, msg);
84 return -1;
85}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription

◆ GetEnd()

sdsConstIter G4MultiSensitiveDetector::GetEnd ( ) const
inline

Definition at line 77 of file G4MultiSensitiveDetector.hh.

77{ return fSensitiveDetectors.end(); }

◆ GetSD()

G4VSensitiveDetector * G4MultiSensitiveDetector::GetSD ( const int i) const
inline

Definition at line 73 of file G4MultiSensitiveDetector.hh.

73{ return fSensitiveDetectors[i]; }

◆ GetSize()

sds_t::size_type G4MultiSensitiveDetector::GetSize ( ) const
inline

Definition at line 75 of file G4MultiSensitiveDetector.hh.

75{ return fSensitiveDetectors.size(); }

◆ Initialize()

void G4MultiSensitiveDetector::Initialize ( G4HCofThisEvent * )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 34 of file G4MultiSensitiveDetector.cc.

35{
36 // SDManager is resposnsible for calling this since the granular SDs
37 // are also registered
38 // for ( auto sd : fSensitiveDetectors ) sd->Initialize(hcte);
39}

◆ operator=()

G4MultiSensitiveDetector & G4MultiSensitiveDetector::operator= ( const G4MultiSensitiveDetector & rhs)
default

◆ PrintAll()

void G4MultiSensitiveDetector::PrintAll ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 60 of file G4MultiSensitiveDetector.cc.

61{
62 for (auto sd : fSensitiveDetectors)
63 sd->PrintAll();
64}

◆ ProcessHits()

G4bool G4MultiSensitiveDetector::ProcessHits ( G4Step * aStep,
G4TouchableHistory * ROhist )
overrideprotectedvirtual

Implements G4VSensitiveDetector.

Definition at line 66 of file G4MultiSensitiveDetector.cc.

67{
68 G4bool result = true;
69 for (auto sd : fSensitiveDetectors)
70 result &= sd->Hit(aStep);
71 return result;
72}
bool G4bool
Definition G4Types.hh:86

The documentation for this class was generated from the following files: