GGS(GenericGEANT4Simulation)Software  2.7.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 
14 GGSMultiSensitiveDetector::GGSMultiSensitiveDetector(G4String name) : G4VSensitiveDetector(name) {}
15 
16 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
17 
19 
20 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
21 
22 void GGSMultiSensitiveDetector::AddSensitiveDetector(G4VSensitiveDetector *sd) { _sdVector.push_back(sd); }
23 
24 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
25 
26 G4VSensitiveDetector *GGSMultiSensitiveDetector::GetSensitiveDetector(const G4String &sdName) {
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 }
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 
36 G4bool GGSMultiSensitiveDetector::ProcessHits(G4Step *aStep, G4TouchableHistory *) {
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 }
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
48  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
49  _sdVector[iDet]->clear();
50  }
51 }
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 
55 void GGSMultiSensitiveDetector::SetROgeometry(G4VReadOutGeometry *value) {
56  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
57  _sdVector[iDet]->SetROgeometry(value);
58  }
59  G4VSensitiveDetector::SetROgeometry(value);
60 }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63 
64 void GGSMultiSensitiveDetector::SetFilter(G4VSDFilter *value) {
65  for (unsigned int iDet = 0; iDet < _sdVector.size(); iDet++) {
66  _sdVector[iDet]->SetFilter(value);
67  }
68  G4VSensitiveDetector::SetFilter(value);
69 }
70 
71 //....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.