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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 6.2.p1)


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