GGS(GenericGEANT4Simulation)Software  2.6.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSMultiSensitiveDetector.cpp
Go to the documentation of this file.
1 /*
2  * GGSMultiSensitiveDetector.cpp
3  *
4  * Created on: 02 Aug 2013
5  * Author: Nicola Mori
6  */
7 
11 
12 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
13 
15  G4VSensitiveDetector(name) {
16 }
17 
18 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
19 
21 }
22 
23 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
24 
25 void GGSMultiSensitiveDetector::AddSensitiveDetector(G4VSensitiveDetector *sd) {
26  _sdVector.push_back(sd);
27 }
28 
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
30 
31 G4VSensitiveDetector *GGSMultiSensitiveDetector::GetSensitiveDetector(const G4String &sdName) {
32  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
33  if (_sdVector[iDet]->GetName() == sdName)
34  return _sdVector[iDet];
35  }
36  return NULL;
37 }
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40 
41 G4bool GGSMultiSensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
42  bool retValue = true;
43  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
44  bool result = _sdVector[iDet]->Hit(aStep);
45  retValue = result && retValue;
46  }
47  return retValue;
48 }
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
53  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
54  _sdVector[iDet]->clear();
55  }
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
60 void GGSMultiSensitiveDetector::SetROgeometry(G4VReadOutGeometry *value) {
61  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
62  _sdVector[iDet]->SetROgeometry(value);
63  }
64  G4VSensitiveDetector::SetROgeometry(value);
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68 
69 void GGSMultiSensitiveDetector::SetFilter(G4VSDFilter *value) {
70  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
71  _sdVector[iDet]->SetFilter(value);
72  }
73  G4VSensitiveDetector::SetFilter(value);
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GGSMultiSensitiveDetector(G4String name)
Constructor.
void clear()
Calls clear for all the detectors in the multidetector.
void SetFilter(G4VSDFilter *value)
Calls SetFilter for all the detectors in the multidetector.
G4VSensitiveDetector * GetSensitiveDetector(const G4String &sdName)
Retrieves a detector.
void SetROgeometry(G4VReadOutGeometry *value)
Calls SetROgeometry for all the detectors in the multidetector.
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
Empty method.
void AddSensitiveDetector(G4VSensitiveDetector *sd)
Adds a new sensitive detector to the multidetector.