Geant4-11
G4VReadOutGeometry.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28
29#include "G4VReadOutGeometry.hh"
30#include "G4Navigator.hh"
31
33 : ROworld(nullptr)
34 , fincludeList(nullptr)
35 , fexcludeList(nullptr)
36 , touchableHistory(nullptr)
37{
38 name = "unknown";
41 ed
42 << "The concept and the functionality of Readout Geometry has been merged\n"
43 << "into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
44 << "not breaking the commonly-used interface in the sensitive detector "
45 "class.\n"
46 << "But this functionality of G4VReadOutGeometry class is no longer "
47 "tested\n"
48 << "and thus may not be working well. We strongly recommend our customers "
49 "to\n"
50 << "migrate to Parallel World scheme.";
51 G4Exception("G4VReadOutGeometry", "DIGIHIT1001", JustWarning, ed);
52}
53
55{
56 fincludeList = nullptr;
57 fexcludeList = nullptr;
58 name = right.name;
59 ROworld = right.ROworld;
60 touchableHistory = nullptr;
62 // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
63 // VALUE, same for navigator and same for the World+Geom hierachy
64}
65
67 : ROworld(nullptr)
68 , fincludeList(nullptr)
69 , fexcludeList(nullptr)
70 , name(n)
71 , touchableHistory(nullptr)
72{
75 ed
76 << "The concept and the functionality of Readout Geometry has been merged\n"
77 << "into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
78 << "not breaking the commonly-used interface in the sensitive detector "
79 "class.\n"
80 << "But this functionality of G4VReadOutGeometry class is no longer "
81 "tested\n"
82 << "and thus may not be working well. We strongly recommend our customers "
83 "to\n"
84 << "migrate to Parallel World scheme.";
85 G4Exception("G4VReadOutGeometry", "DIGIHIT1001", JustWarning, ed);
86}
87
89{
90 // if(ROworld) delete ROworld; //should we do ? will it delete the goem tree
91 // also ?
92 if(fincludeList)
93 delete fincludeList;
94 if(fexcludeList)
95 delete fexcludeList;
97 delete touchableHistory;
98 if(ROnavigator)
99 delete ROnavigator;
100}
101
103 const G4VReadOutGeometry& right)
104{
105 if(this == &right)
106 return *this;
107 delete fincludeList;
108 fincludeList = nullptr;
109 delete fexcludeList;
110 fexcludeList = nullptr;
111 name = right.name;
112 ROworld = right.ROworld;
113 delete touchableHistory;
114 touchableHistory = nullptr;
115 delete ROnavigator;
116 ROnavigator = new G4Navigator();
117 return *this;
118}
119
121{
122 return (this == (G4VReadOutGeometry*) &right);
123}
124
126{
127 return (this != (G4VReadOutGeometry*) &right);
128}
129
131{
132 ROworld = Build();
134}
135
137 G4TouchableHistory*& ROhist)
138{
139 ROhist = nullptr;
140 G4bool incFlg = true;
141 auto PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
142 if((fexcludeList) && (fexcludeList->CheckPV(PV)))
143 {
144 incFlg = false;
145 }
146 else if((fincludeList) && (fincludeList->CheckPV(PV)))
147 {
148 incFlg = true;
149 }
150 else if((fexcludeList) && (fexcludeList->CheckLV(PV->GetLogicalVolume())))
151 {
152 incFlg = false;
153 }
154 else if((fincludeList) && (fincludeList->CheckLV(PV->GetLogicalVolume())))
155 {
156 incFlg = true;
157 }
158 if(!incFlg)
159 return false;
160
161 if(ROworld)
162 {
163 incFlg = FindROTouchable(currentStep);
164 }
165 if(incFlg)
166 {
167 ROhist = touchableHistory;
168 }
169 return incFlg;
170}
171
173{
174 // Update G4TouchableHistory object (touchableHistory)
175 // using the parallel readout world (ROworld)
176 // Return false in case the current Step is outside of the
177 // sensitive volume of the readout world.
178
179 // At first invokation, creates the touchable history. Note
180 // that default value (false) of Locate method is used.
181 // ---------> But the default Value is TRUE <-------------------- J.A.
183 {
186 currentStep->GetPreStepPoint()->GetPosition(),
188 }
189 else
190 {
192 currentStep->GetPreStepPoint()->GetPosition(),
194 true);
195 }
196 // Can the above be improved by the use of an isotropic safety
197 // in order to avoid LocateGlobalPointAndUpdateTouchable
198 // at each Step ?
199 // Should require that an RO geometry is notified at the
200 // starting of a track to avoid possible confusion looking
201 // at the safety value only.
202
203 // checks if volume is sensitive:
204 auto currentVolume = touchableHistory->GetVolume();
205 // checks first if a physical volume exists here:
206 if(currentVolume)
207 {
208 return currentVolume->GetLogicalVolume()->GetSensitiveDetector() != 0;
209 }
210 // no sensitive volume found: returns false
211 return false;
212}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
bool G4bool
Definition: G4Types.hh:86
G4VSensitiveDetector * GetSensitiveDetector() const
void LocateGlobalPointAndUpdateTouchable(const G4ThreeVector &position, const G4ThreeVector &direction, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4bool CheckLV(const G4LogicalVolume *lvp) const
G4bool CheckPV(const G4VPhysicalVolume *pvp) const
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4VPhysicalVolume * GetPhysicalVolume() const
Definition: G4Step.hh:62
G4StepPoint * GetPreStepPoint() const
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4LogicalVolume * GetLogicalVolume() const
G4VPhysicalVolume * ROworld
G4SensitiveVolumeList * fincludeList
G4Navigator * ROnavigator
G4bool operator==(const G4VReadOutGeometry &right) const
virtual G4bool CheckROVolume(G4Step *, G4TouchableHistory *&)
G4bool operator!=(const G4VReadOutGeometry &right) const
G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right)
virtual G4bool FindROTouchable(G4Step *)
G4TouchableHistory * touchableHistory
virtual G4VPhysicalVolume * Build()=0
G4SensitiveVolumeList * fexcludeList
const char * name(G4int ptype)