Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // 28 29 #include "G4VReadOutGeometry.hh" 30 31 #include "G4Navigator.hh" 32 33 G4VReadOutGeometry::G4VReadOutGeometry() 34 : ROworld(nullptr), fincludeList(nullptr), f 35 { 36 name = "unknown"; 37 ROnavigator = new G4Navigator(); 38 G4ExceptionDescription ed; 39 ed << "The concept and the functionality of 40 << "into Parallel World. This G4VReadOutG 41 << "not breaking the commonly-used interf 42 "class.\n" 43 << "But this functionality of G4VReadOutG 44 "tested\n" 45 << "and thus may not be working well. We 46 "to\n" 47 << "migrate to Parallel World scheme."; 48 G4Exception("G4VReadOutGeometry", "DIGIHIT10 49 } 50 51 G4VReadOutGeometry::G4VReadOutGeometry(const G 52 { 53 fincludeList = nullptr; 54 fexcludeList = nullptr; 55 name = right.name; 56 ROworld = right.ROworld; 57 touchableHistory = nullptr; 58 ROnavigator = new G4Navigator(); 59 // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: ne 60 // VALUE, same for navigator and same for th 61 } 62 63 G4VReadOutGeometry::G4VReadOutGeometry(const G 64 : ROworld(nullptr), 65 fincludeList(nullptr), 66 fexcludeList(nullptr), 67 name(n), 68 touchableHistory(nullptr) 69 { 70 ROnavigator = new G4Navigator(); 71 G4ExceptionDescription ed; 72 ed << "The concept and the functionality of 73 << "into Parallel World. This G4VReadOutG 74 << "not breaking the commonly-used interf 75 "class.\n" 76 << "But this functionality of G4VReadOutG 77 "tested\n" 78 << "and thus may not be working well. We 79 "to\n" 80 << "migrate to Parallel World scheme."; 81 G4Exception("G4VReadOutGeometry", "DIGIHIT10 82 } 83 84 G4VReadOutGeometry::~G4VReadOutGeometry() 85 { 86 // if(ROworld) delete ROworld; //should we d 87 // also ? 88 delete fincludeList; 89 delete fexcludeList; 90 delete touchableHistory; 91 delete ROnavigator; 92 } 93 94 G4VReadOutGeometry& G4VReadOutGeometry::operat 95 { 96 if (this == &right) return *this; 97 delete fincludeList; 98 fincludeList = nullptr; 99 delete fexcludeList; 100 fexcludeList = nullptr; 101 name = right.name; 102 ROworld = right.ROworld; 103 delete touchableHistory; 104 touchableHistory = nullptr; 105 delete ROnavigator; 106 ROnavigator = new G4Navigator(); 107 return *this; 108 } 109 110 G4bool G4VReadOutGeometry::operator==(const G4 111 { 112 return (this == (G4VReadOutGeometry*)&right) 113 } 114 115 G4bool G4VReadOutGeometry::operator!=(const G4 116 { 117 return (this != (G4VReadOutGeometry*)&right) 118 } 119 120 void G4VReadOutGeometry::BuildROGeometry() 121 { 122 ROworld = Build(); 123 ROnavigator->SetWorldVolume(ROworld); 124 } 125 126 G4bool G4VReadOutGeometry::CheckROVolume(G4Ste 127 { 128 ROhist = nullptr; 129 G4bool incFlg = true; 130 auto PV = currentStep->GetPreStepPoint()->Ge 131 if (((fexcludeList) != nullptr) && (fexclude 132 incFlg = false; 133 } 134 else if (((fincludeList) != nullptr) && (fin 135 incFlg = true; 136 } 137 else if (((fexcludeList) != nullptr) && (fex 138 incFlg = false; 139 } 140 else if (((fincludeList) != nullptr) && (fin 141 incFlg = true; 142 } 143 if (! incFlg) return false; 144 145 if (ROworld != nullptr) { 146 incFlg = FindROTouchable(currentStep); 147 } 148 if (incFlg) { 149 ROhist = touchableHistory; 150 } 151 return incFlg; 152 } 153 154 G4bool G4VReadOutGeometry::FindROTouchable(G4S 155 { 156 // Update G4TouchableHistory object (touchab 157 // using the parallel readout world (ROworld 158 // Return false in case the current Step is 159 // sensitive volume of the readout world. 160 161 // At first invokation, creates the touchabl 162 // that default value (false) of Locate meth 163 // ---------> But the default Value is TRUE 164 if (touchableHistory == nullptr) { 165 touchableHistory = new G4TouchableHistory( 166 ROnavigator->LocateGlobalPointAndUpdateTou 167 currentStep->GetPreStepPoint()->GetMomen 168 } 169 else { 170 ROnavigator->LocateGlobalPointAndUpdateTou 171 currentStep->GetPreStepPoint()->GetMomen 172 } 173 // Can the above be improved by the use of a 174 // in order to avoid LocateGlobalPointAndUpd 175 // at each Step ? 176 // Should require that an RO geometry is not 177 // starting of a track to avoid possible con 178 // at the safety value only. 179 180 // checks if volume is sensitive: 181 auto currentVolume = touchableHistory->GetVo 182 // checks first if a physical volume exists 183 if (currentVolume != nullptr) { 184 return currentVolume->GetLogicalVolume()-> 185 } 186 // no sensitive volume found: returns false 187 return false; 188 } 189