ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VReadOutGeometry.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VReadOutGeometry.cc
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 
32 
34  :ROworld(nullptr),fincludeList(nullptr),
35  fexcludeList(nullptr),touchableHistory(nullptr)
36 {
37  name = "unknown";
38  ROnavigator = new G4Navigator();
40  ed<<"The concept and the functionality of Readout Geometry has been merged\n"
41  <<"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
42  <<"not breaking the commonly-used interface in the sensitive detector class.\n"
43  <<"But this functionality of G4VReadOutGeometry class is no longer tested\n"
44  <<"and thus may not be working well. We strongly recommend our customers to\n"
45  <<"migrate to Parallel World scheme.";
46  G4Exception("G4VReadOutGeometry","DIGIHIT1001",JustWarning,ed);
47 }
48 
50 {
51  fincludeList = nullptr;
52  fexcludeList = nullptr;
53  name = right.name;
54  ROworld = right.ROworld;
55  touchableHistory = nullptr;
56  ROnavigator = new G4Navigator();
57  // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
58  // VALUE, same for navigator and same for the World+Geom hierachy
59 }
60 
62  :ROworld(nullptr),fincludeList(nullptr),
63  fexcludeList(nullptr),name(n),touchableHistory(nullptr)
64 {
65  ROnavigator = new G4Navigator();
67  ed<<"The concept and the functionality of Readout Geometry has been merged\n"
68  <<"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
69  <<"not breaking the commonly-used interface in the sensitive detector class.\n"
70  <<"But this functionality of G4VReadOutGeometry class is no longer tested\n"
71  <<"and thus may not be working well. We strongly recommend our customers to\n"
72  <<"migrate to Parallel World scheme.";
73  G4Exception("G4VReadOutGeometry","DIGIHIT1001",JustWarning,ed);
74 }
75 
77 {
78  //if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
79  if(fincludeList) delete fincludeList;
80  if(fexcludeList) delete fexcludeList;
82  if(ROnavigator) delete ROnavigator;
83 }
84 
86 {
87  if ( this == &right ) return *this;
88  delete fincludeList; fincludeList = nullptr;
89  delete fexcludeList; fexcludeList = nullptr;
90  name = right.name;
91  ROworld = right.ROworld;
92  delete touchableHistory; touchableHistory = nullptr;
93  delete ROnavigator; ROnavigator = new G4Navigator();
94  return *this;
95 }
96 
98 { return (this == (G4VReadOutGeometry *) &right); }
99 
101 { return (this != (G4VReadOutGeometry *) &right); }
102 
104 {
105  ROworld = Build();
107 }
108 
110 {
111  ROhist = nullptr;
112  G4bool incFlg = true;
113  G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
114  if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
115  { incFlg = false; }
116  else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
117  { incFlg = true; }
118  else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
119  { incFlg = false; }
120  else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
121  { incFlg = true; }
122  if(!incFlg) return false;
123 
124  if(ROworld)
125  { incFlg = FindROTouchable(currentStep); }
126  if(incFlg)
127  { ROhist = touchableHistory; }
128  return incFlg;
129 }
130 
132 {
133  // Update G4TouchableHistory object (touchableHistory)
134  // using the parallel readout world (ROworld)
135  // Return false in case the current Step is outside of the
136  // sensitive volume of the readout world.
137 
138  // At first invokation, creates the touchable history. Note
139  // that default value (false) of Locate method is used.
140  // ---------> But the default Value is TRUE <-------------------- J.A.
141  if(!touchableHistory)
142  {
145  currentStep->GetPreStepPoint()->GetPosition(),
146  currentStep->GetPreStepPoint()->GetMomentumDirection(),
148  }
149  else
150  {
152  currentStep->GetPreStepPoint()->GetPosition(),
153  currentStep->GetPreStepPoint()->GetMomentumDirection(),
155  true);
156  }
157  // Can the above be improved by the use of an isotropic safety
158  // in order to avoid LocateGlobalPointAndUpdateTouchable
159  // at each Step ?
160  // Should require that an RO geometry is notified at the
161  // starting of a track to avoid possible confusion looking
162  // at the safety value only.
163 
164  // checks if volume is sensitive:
165  G4VPhysicalVolume* currentVolume = touchableHistory->GetVolume();
166  // checks first if a physical volume exists here:
167  if ( currentVolume )
168  {
169  return currentVolume->GetLogicalVolume()->
170  GetSensitiveDetector() != 0;
171  }
172  // no sensitive volume found: returns false
173  return false;
174 }
175