Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id$
28 //
29 
30 #include "G4VReadOutGeometry.hh"
31 #include "G4Navigator.hh"
32 
33 
35  :ROworld(0),fincludeList(0),
36  fexcludeList(0),touchableHistory(0)
37 {
38  name = "unknown";
39  ROnavigator = new G4Navigator();
40 }
41 
43 {
44  fincludeList = 0;
45  fexcludeList = 0;
46  name = right.name;
47  ROworld = right.ROworld;
48  touchableHistory = 0;
49  ROnavigator = new G4Navigator();
50  // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
51  // VALUE, same for navigator and same for the World+Geom hierachy
52 }
53 
55  :ROworld(0),fincludeList(0),
56  fexcludeList(0),name(n),touchableHistory(0)
57 {
58  ROnavigator = new G4Navigator();
59 }
60 
62 {
63  //if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
64  if(fincludeList) delete fincludeList;
65  if(fexcludeList) delete fexcludeList;
67  if(ROnavigator) delete ROnavigator;
68 }
69 
71 {
72  delete fincludeList; fincludeList = 0;
73  delete fexcludeList; fexcludeList = 0;
74  name = right.name;
75  ROworld = right.ROworld;
77  delete ROnavigator; ROnavigator = new G4Navigator();
78  return *this;
79 }
80 
82 { return (this == (G4VReadOutGeometry *) &right); }
83 
85 { return (this != (G4VReadOutGeometry *) &right); }
86 
88 {
89  ROworld = Build();
91 }
92 
94 {
95  ROhist = 0;
96  G4bool incFlg = true;
97  G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
98  if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
99  { incFlg = false; }
100  else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
101  { incFlg = true; }
102  else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
103  { incFlg = false; }
104  else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
105  { incFlg = true; }
106  if(!incFlg) return false;
107 
108  if(ROworld)
109  { incFlg = FindROTouchable(currentStep); }
110  if(incFlg)
111  { ROhist = touchableHistory; }
112  return incFlg;
113 }
114 
116 {
117  // Update G4TouchableHistory object (touchableHistory)
118  // using the parallel readout world (ROworld)
119  // Return false in case the current Step is outside of the
120  // sensitive volume of the readout world.
121 
122  // At first invokation, creates the touchable history. Note
123  // that default value (false) of Locate method is used.
124  // ---------> But the default Value is TRUE <-------------------- J.A.
125  if(!touchableHistory)
126  {
129  currentStep->GetPreStepPoint()->GetPosition(),
130  currentStep->GetPreStepPoint()->GetMomentumDirection(),
132  }
133  else
134  {
136  currentStep->GetPreStepPoint()->GetPosition(),
137  currentStep->GetPreStepPoint()->GetMomentumDirection(),
139  true);
140  }
141  // Can the above be improved by the use of an isotropic safety
142  // in order to avoid LocateGlobalPointAndUpdateTouchable
143  // at each Step ?
144  // Should require that an RO geometry is notified at the
145  // starting of a track to avoid possible confusion looking
146  // at the safety value only.
147 
148  // checks if volume is sensitive:
149  G4VPhysicalVolume* currentVolume = touchableHistory->GetVolume();
150  // checks first if a physical volume exists here:
151  if ( currentVolume )
152  {
153  return currentVolume->GetLogicalVolume()->
154  GetSensitiveDetector() != 0;
155  }
156  // no sensitive volume found: returns false
157  return false;
158 }
159