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

#include <G4MultiFunctionalDetector.hh>

+ Inheritance diagram for G4MultiFunctionalDetector:

Public Member Functions

 G4MultiFunctionalDetector (G4String)
 
 ~G4MultiFunctionalDetector () override
 
G4bool RegisterPrimitive (G4VPrimitiveScorer *)
 
G4bool RemovePrimitive (G4VPrimitiveScorer *)
 
G4int GetNumberOfPrimitives () const
 
G4VPrimitiveScorerGetPrimitive (G4int id) const
 
void Initialize (G4HCofThisEvent *) override
 
void EndOfEvent (G4HCofThisEvent *) override
 
void clear () override
 
void DrawAll () override
 
void PrintAll () override
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (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
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Protected Member Functions

G4bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 

Protected Attributes

std::vector< G4VPrimitiveScorer * > primitives
 
- 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 47 of file G4MultiFunctionalDetector.hh.

Constructor & Destructor Documentation

◆ G4MultiFunctionalDetector()

G4MultiFunctionalDetector::G4MultiFunctionalDetector ( G4String name)

Definition at line 38 of file G4MultiFunctionalDetector.cc.

39{
40 ;
41}
G4VSensitiveDetector(G4String name)

◆ ~G4MultiFunctionalDetector()

G4MultiFunctionalDetector::~G4MultiFunctionalDetector ( )
override

Definition at line 43 of file G4MultiFunctionalDetector.cc.

44{
45 for (auto pr : primitives)
46 delete pr;
47 primitives.clear();
48}
std::vector< G4VPrimitiveScorer * > primitives

Member Function Documentation

◆ clear()

void G4MultiFunctionalDetector::clear ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 110 of file G4MultiFunctionalDetector.cc.

111{
112 for (auto pr : primitives) {
113 pr->clear();
114 }
115}

◆ DrawAll()

void G4MultiFunctionalDetector::DrawAll ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 117 of file G4MultiFunctionalDetector.cc.

118{
119 for (auto pr : primitives) {
120 pr->DrawAll();
121 }
122}

◆ EndOfEvent()

void G4MultiFunctionalDetector::EndOfEvent ( G4HCofThisEvent * HC)
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 103 of file G4MultiFunctionalDetector.cc.

104{
105 for (auto pr : primitives) {
106 pr->EndOfEvent(HC);
107 }
108}

◆ GetNumberOfPrimitives()

G4int G4MultiFunctionalDetector::GetNumberOfPrimitives ( ) const
inline

Definition at line 57 of file G4MultiFunctionalDetector.hh.

57{ return G4int(primitives.size()); }
int G4int
Definition G4Types.hh:85

Referenced by G4VScoringMesh::GetPrimitiveScorer(), and G4VScoringMesh::List().

◆ GetPrimitive()

G4VPrimitiveScorer * G4MultiFunctionalDetector::GetPrimitive ( G4int id) const
inline

Definition at line 59 of file G4MultiFunctionalDetector.hh.

59{ return primitives[id]; }

Referenced by G4VScoringMesh::GetPrimitiveScorer(), and G4VScoringMesh::List().

◆ Initialize()

void G4MultiFunctionalDetector::Initialize ( G4HCofThisEvent * HC)
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 96 of file G4MultiFunctionalDetector.cc.

97{
98 for (auto pr : primitives) {
99 pr->Initialize(HC);
100 }
101}

◆ PrintAll()

void G4MultiFunctionalDetector::PrintAll ( )
overridevirtual

Reimplemented from G4VSensitiveDetector.

Definition at line 124 of file G4MultiFunctionalDetector.cc.

125{
126 for (auto pr : primitives) {
127 pr->PrintAll();
128 }
129}

◆ ProcessHits()

G4bool G4MultiFunctionalDetector::ProcessHits ( G4Step * aStep,
G4TouchableHistory * aTH )
overrideprotectedvirtual

Implements G4VSensitiveDetector.

Definition at line 50 of file G4MultiFunctionalDetector.cc.

51{
52 if (aStep->GetStepLength() > 0. || aStep->GetTotalEnergyDeposit() > 0.) {
53 for (auto pr : primitives) {
54 pr->HitPrimitive(aStep, aTH);
55 }
56 }
57 return true;
58}
G4double GetStepLength() const
G4double GetTotalEnergyDeposit() const

◆ RegisterPrimitive()

G4bool G4MultiFunctionalDetector::RegisterPrimitive ( G4VPrimitiveScorer * aPS)

Definition at line 60 of file G4MultiFunctionalDetector.cc.

61{
62 for (auto pr : primitives) {
63 if (pr == aPS) {
65 ED << "Primitive <" << aPS->GetName() << "> is already defined in <" << SensitiveDetectorName
66 << ">." << G4endl << "Method RegisterPrimitive() is ignored." << G4endl;
67 G4Exception("G4MultiFunctionalDetector::RegisterPrimitive", "Det0101", JustWarning, ED);
68 return false;
69 }
70 }
71 primitives.push_back(aPS);
74 if (G4SDManager::GetSDMpointer()->FindSensitiveDetector(SensitiveDetectorName, false) != nullptr)
75 {
76 // This G4MultiFunctionalDetector has already been registered to
77 // G4SDManager. Make sure this new primitive is registered as well.
79 }
80 return true;
81}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67
static G4SDManager * GetSDMpointer()
void AddNewCollection(G4String SDname, G4String DCname)
void SetMultiFunctionalDetector(G4MultiFunctionalDetector *d)
G4String GetName() const
G4CollectionNameVector collectionName

Referenced by G4VScoringMesh::SetPrimitiveScorer().

◆ RemovePrimitive()

G4bool G4MultiFunctionalDetector::RemovePrimitive ( G4VPrimitiveScorer * aPS)

Definition at line 83 of file G4MultiFunctionalDetector.cc.

84{
85 auto pr = std::find(primitives.begin(), primitives.end(), aPS);
86 if (pr != primitives.end()) {
87 primitives.erase(pr);
88 aPS->SetMultiFunctionalDetector(nullptr);
89 return true;
90 }
91 G4cerr << "Primitive <" << aPS->GetName() << "> is not defined in <" << SensitiveDetectorName
92 << ">." << G4endl << "Method RemovePrimitive() is ignored." << G4endl;
93 return false;
94}
G4GLOB_DLL std::ostream G4cerr

Member Data Documentation

◆ primitives


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