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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 /processes/electromagnetic/dna/management/src/G4IT.cc (Version 11.3.0) and /processes/electromagnetic/dna/management/src/G4IT.cc (Version 9.6.p3)


  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 // $Id: G4IT.cc 65022 2012-11-12 16:43:12Z gcosmo $
 26 //                                                 27 //
 27 // Author: Mathieu Karamitros (kara (AT) cenbg     28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
 28 //                                                 29 //
 29 // History:                                        30 // History:
 30 // -----------                                     31 // -----------
 31 // 10 Oct 2011 M.Karamitros created                32 // 10 Oct 2011 M.Karamitros created
 32 //                                                 33 //
 33 // -------------------------------------------     34 // -------------------------------------------------------------------
 34                                                    35 
 35 #include "G4IT.hh"                                 36 #include "G4IT.hh"
 36 #include "G4KDTree.hh"                             37 #include "G4KDTree.hh"
 37 #include "G4ITBox.hh"                              38 #include "G4ITBox.hh"
 38 #include "G4Track.hh"                              39 #include "G4Track.hh"
 39 #include "G4TrackList.hh"                      << 
 40 #include "G4TrackingInformation.hh"            << 
 41                                                    40 
 42 using namespace std;                               41 using namespace std;
 43                                                    42 
 44 //-------------------------------------------- <<  43 G4Allocator<G4IT> aITAllocator;
 45 //                                             <<  44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >>  45 ///
 46 // Static functions                                46 // Static functions
 47 //                                             <<  47 ///
 48 G4IT* GetIT(const G4Track* track)                  48 G4IT* GetIT(const G4Track* track)
 49 {                                                  49 {
 50   return (dynamic_cast<G4IT*>(track->GetUserIn <<  50     return (dynamic_cast<G4IT*>(track->GetUserInformation()));
 51 }                                                  51 }
 52                                                    52 
 53 G4IT* GetIT(const G4Track& track)                  53 G4IT* GetIT(const G4Track& track)
 54 {                                                  54 {
 55   return (dynamic_cast<G4IT*>(track.GetUserInf <<  55     return (dynamic_cast<G4IT*>(track.GetUserInformation()));
 56 }                                              << 
 57                                                << 
 58 template<>                                     << 
 59 G4KDNode<G4IT>::~G4KDNode(){                   << 
 60   fPoint->SetNode(nullptr);                    << 
 61 }                                                  56 }
 62                                                <<  57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 63 //-------------------------------------------- <<  58 ///
 64 //                                             << 
 65 // Constructors / Destructors                      59 // Constructors / Destructors
 66 //                                             <<  60 ///
 67 G4IT::G4IT() :                                 <<  61 G4IT::G4IT() : G4VUserTrackInformation("G4IT"),
 68     G4VUserTrackInformation("G4IT"),           <<  62     fpTrack (0),
 69     fpTrack(nullptr),                          <<  63     fpPreviousIT(0), fpNextIT(0),
 70     fpPreviousIT(nullptr),                     <<  64     fTrackingInformation()
 71     fpNextIT(nullptr),                         <<  65 //    fpTrackingInformation(new G4TrackingInformation())
 72     fpTrackingInformation(new G4TrackingInform <<  66 {
 73 {                                              <<  67     fpITBox=0;
 74   fpITBox = nullptr;                           <<  68     fpKDNode = 0 ;
 75   fpKDNode = nullptr;                          <<  69     fpTrackNode = 0;
 76   fpTrackNode = nullptr;                       <<  70     fParentID_A = 0;
 77   fParentID_A = 0;                             <<  71     fParentID_B = 0;
 78   fParentID_B = 0;                             << 
 79 }                                                  72 }
 80                                                    73 
 81 // Use only by inheriting classes                  74 // Use only by inheriting classes
 82 G4IT::G4IT(const G4IT& /*right*/) :            <<  75 G4IT::G4IT(const G4IT& /*right*/) : G4VUserTrackInformation("G4IT"),
 83     G4VUserTrackInformation("G4IT"),           <<  76     fpTrack (0),
 84     fpTrack(nullptr),                          <<  77     fpPreviousIT(0), fpNextIT(0),
 85     fpPreviousIT(nullptr),                     <<  78     fTrackingInformation()
 86     fpNextIT(nullptr),                         <<  79 //    fpTrackingInformation(new G4TrackingInformation())
 87     fpTrackingInformation(new G4TrackingInform <<  80 {
 88 {                                              <<  81     fpITBox=0;
 89   fpITBox = nullptr;                           <<  82     fpKDNode = 0 ;
 90   fpKDNode = nullptr;                          <<  83     fpTrackNode = 0;
 91   fpTrackNode = nullptr;                       <<  84     fParentID_A = 0;
 92   fParentID_A = 0;                             <<  85     fParentID_B = 0;
 93   fParentID_B = 0;                             << 
 94 }                                                  86 }
 95                                                    87 
 96 // Should not be used                              88 // Should not be used
 97 G4IT& G4IT::operator=(const G4IT& right)           89 G4IT& G4IT::operator=(const G4IT& right)
 98 {                                                  90 {
 99   G4ExceptionDescription exceptionDescription; <<  91     G4ExceptionDescription exceptionDescription;
100   exceptionDescription                         <<  92     exceptionDescription << "The assignment operator of G4IT should not be used, this feature is not supported."
101       << "The assignment operator of G4IT shou <<  93                          << "If really needed, please contact the developers.";
102           "this feature is not supported."     <<  94     G4Exception("G4IT::operator=(const G4IT& right)","G4IT001",FatalException,exceptionDescription);
103       << "If really needed, please contact the <<  95 
104   G4Exception("G4IT::operator=(const G4IT& rig <<  96     if(this == &right) return *this;
105               "G4IT001",                       <<  97 
106               FatalException,                  <<  98     fpTrack = 0;
107               exceptionDescription);           <<  99     fpITBox = 0;
108                                                << 100     fpPreviousIT = 0;
109   if (this == &right) return *this;            << 101     fpNextIT = 0;
110                                                << 102     fpKDNode = 0 ;
111   fpTrack = nullptr;                           << 103     fParentID_A = 0;
112   fpITBox = nullptr;                           << 104     fParentID_B = 0;
113   fpPreviousIT = nullptr;                      << 105 //    fpTrackingInformation = 0;
114   fpNextIT = nullptr;                          << 106     fpTrackNode = 0;
115   fpKDNode = nullptr;                          << 107 
116   fParentID_A = 0;                             << 108     return *this;
117   fParentID_B = 0;                             << 109 }
118   fpTrackingInformation = nullptr;             << 110 
119   fpTrackNode = nullptr;                       << 111 G4IT::G4IT(G4Track * aTrack) : G4VUserTrackInformation("G4IT"),
120                                                << 112     fpPreviousIT(0), fpNextIT(0),
121   return *this;                                << 113     fTrackingInformation()
122 }                                              << 114 //    fpTrackingInformation(new G4TrackingInformation())
123                                                << 115 {
124 G4IT::G4IT(G4Track * aTrack) :                 << 116     fpITBox = 0;
125     G4VUserTrackInformation("G4IT"),           << 117     fpTrack = aTrack;
126     fpPreviousIT(nullptr),                     << 118     fpKDNode = 0 ;
127     fpNextIT(nullptr),                         << 119     fpTrackNode = 0;
128     fpTrackingInformation(new G4TrackingInform << 120     fParentID_A = 0;
129 {                                              << 121     fParentID_B = 0;
130   fpITBox = nullptr;                           << 122     RecordCurrentPositionNTime();
131   fpTrack = aTrack;                            << 
132   fpKDNode = nullptr;                          << 
133   fpTrackNode = nullptr;                       << 
134   fParentID_A = 0;                             << 
135   fParentID_B = 0;                             << 
136   RecordCurrentPositionNTime();                << 
137 }                                                 123 }
138                                                   124 
139 void G4IT::TakeOutBox()                           125 void G4IT::TakeOutBox()
140 {                                                 126 {
141   if(fpITBox != nullptr)                       << 127     if(fpITBox)
142   {                                            << 128     {
143     fpITBox->Extract(this);                    << 129         fpITBox->Extract(this);
144     fpITBox = nullptr;                         << 130     }
145   }                                            << 131 
146                                                << 132     if(fpKDNode)
147   if(fpTrackNode != nullptr)                   << 133     {
148   {                                            << 134         InactiveNode(fpKDNode);
149     delete fpTrackNode;                        << 135         fpKDNode = 0;
150     fpTrackNode = nullptr;                     << 136     }
151   }                                            << 
152                                                << 
153   if(fpKDNode != nullptr)                      << 
154   {                                            << 
155     InactiveNode(fpKDNode);                    << 
156     fpKDNode = nullptr;                        << 
157   }                                            << 
158 }                                                 137 }
159                                                   138 
160 G4IT::~G4IT()                                     139 G4IT::~G4IT()
161 {                                                 140 {
162   TakeOutBox();                                << 141     TakeOutBox();
163                                                << 
164   if(fpTrackingInformation != nullptr)         << 
165   {                                            << 
166     delete fpTrackingInformation;              << 
167     fpTrackingInformation = nullptr;           << 
168   }                                            << 
169                                                   142 
170 // Note :                                      << 143 //    if(fpTrackingInformation)
171 // G4ITTrackingManager will delete fTrackNode. << 144 //    {
172 // fKDNode will be deleted when the KDTree is  << 145 //        delete fpTrackingInformation;
                                                   >> 146 //        fpTrackingInformation = 0;
                                                   >> 147 //    }
                                                   >> 148 
                                                   >> 149     // Note :
                                                   >> 150     // G4ITTrackingManager will delete fTrackNode.
                                                   >> 151     // fKDNode will be deleted when the KDTree is rebuilt
173 }                                                 152 }
174                                                << 153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
175 //-------------------------------------------- << 
176 ///                                               154 ///
177 // Methods                                        155 // Methods
178 ///                                               156 ///
179                                                << 
180 G4bool G4IT::operator<(const G4IT& right) cons << 
181 {                                              << 
182   if (GetITType() == right.GetITType())        << 
183   {                                            << 
184     return (this->diff(right));                << 
185   }                                            << 
186                                                << 
187   return (GetITType() < right.GetITType());    << 
188                                                << 
189 }                                              << 
190                                                << 
191 G4bool G4IT::operator==(const G4IT& right) con << 
192 {                                              << 
193   if (GetITType() == right.GetITType())        << 
194   {                                            << 
195     return this->equal(right);                 << 
196   }                                            << 
197   return false;                                << 
198 }                                              << 
199                                                << 
200 G4bool G4IT::operator!=(const G4IT& right) con << 
201 {                                              << 
202   return !(this->operator==(right));           << 
203 }                                              << 
204                                                << 
205 double G4IT::operator[](int i) const           << 
206 {                                              << 
207   return fpTrack->GetPosition()[i];            << 
208 }                                              << 
209                                                << 
210 //-------------------------------------------- << 
211                                                << 
212 const G4ThreeVector& G4IT::GetPosition() const << 
213 {                                              << 
214   if (fpTrack != nullptr) return GetTrack()->G << 
215   return *(new G4ThreeVector());               << 
216 }                                              << 
217                                                << 
218 void G4IT::RecordCurrentPositionNTime()           157 void G4IT::RecordCurrentPositionNTime()
219 {                                                 158 {
220   if (fpTrack != nullptr)                      << 159     if(fpTrack)
221   {                                            << 160     {
222     fpTrackingInformation->RecordCurrentPositi << 161         fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
223   }                                            << 162     }
224 }                                                 163 }
225                                                   164 
226 G4double G4IT::GetPreStepGlobalTime() const    << 165 G4bool G4IT::operator<(const G4IT& right) const
227 {                                                 166 {
228   return fpTrackingInformation->GetPreStepGlob << 167     if(GetITType() == right.GetITType() )
                                                   >> 168     {
                                                   >> 169         return  (this->diff(right)) ;
                                                   >> 170     }
                                                   >> 171     else
                                                   >> 172     {
                                                   >> 173         return (GetITType() < right.GetITType());
                                                   >> 174     }
                                                   >> 175     return false;
229 }                                                 176 }
230                                                   177 
231 G4double G4IT::GetPreStepLocalTime() const     << 178 G4bool G4IT::operator==(const G4IT& right) const
232 {                                                 179 {
233   return fpTrackingInformation->GetPreStepLoca << 180     if(GetITType() == right.GetITType() )
                                                   >> 181     {
                                                   >> 182         return this->equal(right);
                                                   >> 183     }
                                                   >> 184     return false;
234 }                                                 185 }
235                                                   186 
236 const G4ThreeVector& G4IT::GetPreStepPosition( << 187 G4bool G4IT::operator!=(const G4IT& right) const
237 {                                                 188 {
238   return fpTrackingInformation->GetPreStepPosi << 189     return !(this->operator==(right));
239 }                                                 190 }
240                                                << 
241                                                   191