GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions
GGSMultiSensitiveDetector Class Reference

A multiple sensitive detector. More...

#include <GGSMultiSensitiveDetector.h>

Inheritance diagram for GGSMultiSensitiveDetector:
Inheritance graph
[legend]
Collaboration diagram for GGSMultiSensitiveDetector:
Collaboration graph
[legend]

Public Member Functions

 GGSMultiSensitiveDetector (G4String name)
 Constructor.
 
 ~GGSMultiSensitiveDetector ()
 Destructor.
 
void AddSensitiveDetector (G4VSensitiveDetector *sd)
 Adds a new sensitive detector to the multidetector. More...
 
G4VSensitiveDetector * GetSensitiveDetector (const G4String &sdName)
 Retrieves a detector. More...
 
const std::vector
< G4VSensitiveDetector * > & 
GetListOfSensitiveDetectors ()
 Retrieves a list of sensitive detectors collected into this object. More...
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 Empty method. More...
 
void clear ()
 Calls clear for all the detectors in the multidetector.
 
void Activate (G4bool activeFlag)
 Enables or disables the multidetector. More...
 
void SetROgeometry (G4VReadOutGeometry *value)
 Calls SetROgeometry for all the detectors in the multidetector.
 
void SetFilter (G4VSDFilter *value)
 Calls SetFilter for all the detectors in the multidetector.
 

Detailed Description

A multiple sensitive detector.

This class groups many sensitive detectors so that assigning it to a logical volume is equivalent to assign multiple sensitive detectors. This class inherits from G4VSensitiveDetector; it is mandatory to register it to the G4SDManager singleton by calling G4SDManager::AddNewDetector and to assign it to the logical volume. Also the sd it contains must be registered into the G4SDManager. A typical code pattern:

GGSMultiSensitiveDetector *multiSD = new GGSMultiSensitiveDetector(name); // Create the multi SD G4SDManager::GetSDMpointer()->AddNewDetector(multiSD); // Register it logVol->SetSensitiveDetector(multiSD); // Assign to logical volume

MySD1 *sd1 = new MySD1(sd1Name); // Create sd1 G4SDManager::GetSDMpointer()->AddNewDetector(sd1); // Register it multiSD->AddSensitiveDetector(sd1); // Assign to multiSD

MySD2 *sd2 = new MySD2(sd2Name); // Create sd2 G4SDManager::GetSDMpointer()->AddNewDetector(sd2); // Register it multiSD->AddSensitiveDetector(sd2); // Assign to multiSD

Definition at line 39 of file GGSMultiSensitiveDetector.h.

Member Function Documentation

void GGSMultiSensitiveDetector::Activate ( G4bool  activeFlag)

Enables or disables the multidetector.

It will call Activate(activeFlag) for all the detectors.

Parameters
activeFlagFlag for activation/deactivation
void GGSMultiSensitiveDetector::AddSensitiveDetector ( G4VSensitiveDetector *  sd)

Adds a new sensitive detector to the multidetector.

Parameters
sdThe detector to add.

Definition at line 22 of file GGSMultiSensitiveDetector.cpp.

22 { _sdVector.push_back(sd); }
const std::vector<G4VSensitiveDetector *>& GGSMultiSensitiveDetector::GetListOfSensitiveDetectors ( )
inline

Retrieves a list of sensitive detectors collected into this object.

Returns
A vector of pointers to the sensitive detectors.

Definition at line 64 of file GGSMultiSensitiveDetector.h.

64 { return _sdVector; }
G4VSensitiveDetector * GGSMultiSensitiveDetector::GetSensitiveDetector ( const G4String &  sdName)

Retrieves a detector.

Parameters
sdNameThe name of the desired detector.
Returns
Pointer to the detector (NULL if the detector is not present).

Definition at line 26 of file GGSMultiSensitiveDetector.cpp.

26  {
27  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
28  if (_sdVector[iDet]->GetName() == sdName)
29  return _sdVector[iDet];
30  }
31  return NULL;
32 }
G4bool GGSMultiSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)

Empty method.

This method is called by the non-virtual Hits method. It simply dispatches the Hits call to the single sensitive detectors.

Returns
The logical AND of the return values of the Hits methods

Definition at line 36 of file GGSMultiSensitiveDetector.cpp.

36  {
37  bool retValue = true;
38  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
39  bool result = _sdVector[iDet]->Hit(aStep);
40  retValue = result && retValue;
41  }
42  return retValue;
43 }

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