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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /digits_hits/detector/src/G4VReadOutGeometry.cc (Version 11.3.0) and /digits_hits/detector/src/G4VReadOutGeometry.cc (Version 8.3.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4VReadOutGeometry.cc,v 1.2 2006/06/29 18:06:05 gunter Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-03-patch-02 $
 27 //                                                 29 //
 28                                                    30 
 29 #include "G4VReadOutGeometry.hh"                   31 #include "G4VReadOutGeometry.hh"
 30                                                << 
 31 #include "G4Navigator.hh"                          32 #include "G4Navigator.hh"
 32                                                    33 
                                                   >>  34 
 33 G4VReadOutGeometry::G4VReadOutGeometry()           35 G4VReadOutGeometry::G4VReadOutGeometry()
 34   : ROworld(nullptr), fincludeList(nullptr), f <<  36   :ROworld(0),fincludeList(0),
                                                   >>  37    fexcludeList(0),touchableHistory(0)
 35 {                                                  38 {
 36   name = "unknown";                                39   name = "unknown";
 37   ROnavigator = new G4Navigator();                 40   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 }                                                  41 }
 50                                                    42 
 51 G4VReadOutGeometry::G4VReadOutGeometry(const G <<  43 G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry &right)
 52 {                                                  44 {
 53   fincludeList = nullptr;                      <<  45   fincludeList = right.fincludeList;
 54   fexcludeList = nullptr;                      <<  46   fexcludeList = right.fexcludeList;
 55   name = right.name;                               47   name = right.name;
 56   ROworld = right.ROworld;                         48   ROworld = right.ROworld;
 57   touchableHistory = nullptr;                  <<  49   touchableHistory = 0;
 58   ROnavigator = new G4Navigator();             << 
 59   // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: ne     50   // COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
 60   // VALUE, same for navigator and same for th <<  51   // VALUE, same foe navigator and same for the World+Geom hierachy ??
 61 }                                                  52 }
 62                                                    53 
 63 G4VReadOutGeometry::G4VReadOutGeometry(const G <<  54 G4VReadOutGeometry::G4VReadOutGeometry(G4String n) 
 64   : ROworld(nullptr),                          <<  55   :ROworld(0),fincludeList(0),
 65     fincludeList(nullptr),                     <<  56    fexcludeList(0),name(n),touchableHistory(0)
 66     fexcludeList(nullptr),                     << 
 67     name(n),                                   << 
 68     touchableHistory(nullptr)                  << 
 69 {                                                  57 {
 70   ROnavigator = new G4Navigator();                 58   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 }                                                  59 }
 83                                                    60 
 84 G4VReadOutGeometry::~G4VReadOutGeometry()          61 G4VReadOutGeometry::~G4VReadOutGeometry()
 85 {                                              <<  62 { 
 86   // if(ROworld) delete ROworld; //should we d <<  63   //if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
 87   // also ?                                    <<  64   if(fincludeList)     delete fincludeList;
 88   delete fincludeList;                         <<  65   if(fexcludeList)     delete fexcludeList;
 89   delete fexcludeList;                         <<  66   if(touchableHistory) delete touchableHistory;
 90   delete touchableHistory;                     <<  67   if(ROnavigator)      delete ROnavigator;
 91   delete ROnavigator;                          << 
 92 }                                                  68 }
 93                                                    69 
 94 G4VReadOutGeometry& G4VReadOutGeometry::operat <<  70 const G4VReadOutGeometry & G4VReadOutGeometry::operator=(const G4VReadOutGeometry &right)
 95 {                                              <<  71 {
 96   if (this == &right) return *this;            <<  72   fincludeList     = right.fincludeList;
 97   delete fincludeList;                         <<  73   fexcludeList     = right.fexcludeList;
 98   fincludeList = nullptr;                      <<  74   name             = right.name;
 99   delete fexcludeList;                         <<  75   ROworld          = right.ROworld;
100   fexcludeList = nullptr;                      <<  76   touchableHistory = 0;
101   name = right.name;                           << 
102   ROworld = right.ROworld;                     << 
103   delete touchableHistory;                     << 
104   touchableHistory = nullptr;                  << 
105   delete ROnavigator;                          << 
106   ROnavigator = new G4Navigator();             << 
107   return *this;                                    77   return *this;
108 }                                                  78 }
109                                                    79 
110 G4bool G4VReadOutGeometry::operator==(const G4 <<  80 G4int G4VReadOutGeometry::operator==(const G4VReadOutGeometry &right) const
111 {                                              <<  81 { return (this == (G4VReadOutGeometry *) &right); }
112   return (this == (G4VReadOutGeometry*)&right) << 
113 }                                              << 
114                                                    82 
115 G4bool G4VReadOutGeometry::operator!=(const G4 <<  83 G4int G4VReadOutGeometry::operator!=(const G4VReadOutGeometry &right) const
116 {                                              <<  84 { return (this != (G4VReadOutGeometry *) &right); }
117   return (this != (G4VReadOutGeometry*)&right) << 
118 }                                              << 
119                                                    85 
120 void G4VReadOutGeometry::BuildROGeometry()         86 void G4VReadOutGeometry::BuildROGeometry()
121 {                                                  87 {
122   ROworld = Build();                               88   ROworld = Build();
123   ROnavigator->SetWorldVolume(ROworld);            89   ROnavigator->SetWorldVolume(ROworld);
124 }                                                  90 }
125                                                    91 
126 G4bool G4VReadOutGeometry::CheckROVolume(G4Ste <<  92 G4bool G4VReadOutGeometry::CheckROVolume(G4Step*currentStep,G4TouchableHistory*& ROhist)
127 {                                                  93 {
128   ROhist = nullptr;                            <<  94   ROhist = 0;
129   G4bool incFlg = true;                            95   G4bool incFlg = true;
130   auto PV = currentStep->GetPreStepPoint()->Ge <<  96   G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
131   if (((fexcludeList) != nullptr) && (fexclude <<  97   if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
132     incFlg = false;                            <<  98     { incFlg = false; }
133   }                                            <<  99   else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
134   else if (((fincludeList) != nullptr) && (fin << 100     { incFlg = true; }
135     incFlg = true;                             << 101   else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
136   }                                            << 102     { incFlg = false; }
137   else if (((fexcludeList) != nullptr) && (fex << 103   else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
138     incFlg = false;                            << 104     { incFlg = true; }
139   }                                            << 105   if(!incFlg) return false;
140   else if (((fincludeList) != nullptr) && (fin << 106   
141     incFlg = true;                             << 107   if(ROworld)
142   }                                            << 108     { incFlg = FindROTouchable(currentStep); }
143   if (! incFlg) return false;                  << 109   if(incFlg)
144                                                << 110     { ROhist = touchableHistory; }
145   if (ROworld != nullptr) {                    << 
146     incFlg = FindROTouchable(currentStep);     << 
147   }                                            << 
148   if (incFlg) {                                << 
149     ROhist = touchableHistory;                 << 
150   }                                            << 
151   return incFlg;                                  111   return incFlg;
152 }                                                 112 }
153                                                   113 
154 G4bool G4VReadOutGeometry::FindROTouchable(G4S << 114 G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
155 {                                                 115 {
156   // Update G4TouchableHistory object (touchab    116   // Update G4TouchableHistory object (touchableHistory)
157   // using the parallel readout world (ROworld    117   // using the parallel readout world (ROworld)
158   // Return false in case the current Step is     118   // Return false in case the current Step is outside of the
159   // sensitive volume of the readout world.       119   // sensitive volume of the readout world.
160                                                   120 
161   // At first invokation, creates the touchabl    121   // At first invokation, creates the touchable history. Note
162   // that default value (false) of Locate meth    122   // that default value (false) of Locate method is used.
163   //  ---------> But the default Value is TRUE << 123   //  ---------> But the default Value is TRUE <-------------------- J.A. 
164   if (touchableHistory == nullptr) {           << 124   if(!touchableHistory)
165     touchableHistory = new G4TouchableHistory( << 125     {
166     ROnavigator->LocateGlobalPointAndUpdateTou << 126       touchableHistory = new G4TouchableHistory();
167       currentStep->GetPreStepPoint()->GetMomen << 127       ROnavigator->LocateGlobalPointAndUpdateTouchable(
168   }                                            << 128              currentStep->GetPreStepPoint()->GetPosition(),
169   else {                                       << 129              currentStep->GetPreStepPoint()->GetMomentumDirection(),
170     ROnavigator->LocateGlobalPointAndUpdateTou << 130              touchableHistory);
171       currentStep->GetPreStepPoint()->GetMomen << 131     }
172   }                                            << 132   else
                                                   >> 133     {
                                                   >> 134       ROnavigator->LocateGlobalPointAndUpdateTouchable(
                                                   >> 135              currentStep->GetPreStepPoint()->GetPosition(),
                                                   >> 136              currentStep->GetPreStepPoint()->GetMomentumDirection(),
                                                   >> 137              touchableHistory,
                                                   >> 138              true);
                                                   >> 139     }
173   // Can the above be improved by the use of a    140   // Can the above be improved by the use of an isotropic safety
174   // in order to avoid LocateGlobalPointAndUpd    141   // in order to avoid LocateGlobalPointAndUpdateTouchable
175   // at each Step ?                               142   // at each Step ?
176   // Should require that an RO geometry is not    143   // Should require that an RO geometry is notified at the
177   // starting of a track to avoid possible con    144   // starting of a track to avoid possible confusion looking
178   // at the safety value only.                    145   // at the safety value only.
179                                                << 146   
180   // checks if volume is sensitive:               147   // checks if volume is sensitive:
181   auto currentVolume = touchableHistory->GetVo << 148   G4VPhysicalVolume* currentVolume = touchableHistory->GetVolume();
182   // checks first if a physical volume exists     149   // checks first if a physical volume exists here:
183   if (currentVolume != nullptr) {              << 150   if ( currentVolume )
184     return currentVolume->GetLogicalVolume()-> << 151     {
185   }                                            << 152       return currentVolume->GetLogicalVolume()->
                                                   >> 153   GetSensitiveDetector() != 0;
                                                   >> 154     }
186   // no sensitive volume found: returns false     155   // no sensitive volume found: returns false
187   return false;                                   156   return false;
188 }                                                 157 }
                                                   >> 158 
189                                                   159