Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/track/src/G4Track.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.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 /track/src/G4Track.cc (Version 11.3.0) and /track/src/G4Track.cc (Version 10.5.p1)


  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 // G4Track class implementation                << 
 27 //                                                 26 //
 28 // Author: Katsuya Amako, KEK - 1996           <<  27 //
 29 // Revisions: Hisaya Kurashige, 1998-2011      <<  28 //
 30 // ------------------------------------------- <<  29 //---------------------------------------------------------------
                                                   >>  30 //
                                                   >>  31 //  G4Track.cc
                                                   >>  32 //
                                                   >>  33 //---------------------------------------------------------------
                                                   >>  34 //   Add copy constructor            Hisaya Feb. 07 01
                                                   >>  35 //   Fix GetVelocity                 Hisaya Feb. 17 01
                                                   >>  36 //   Modification for G4TouchableHandle             22 Oct. 2001  R.Chytracek//
                                                   >>  37 //   Fix GetVelocity (bug report #741)   Horton-Smith Apr 14 2005
                                                   >>  38 //   Remove massless check in  GetVelocity   02 Apr. 09 H.Kurashige
                                                   >>  39 //   Use G4VelocityTable                     17 AUg. 2011 H.Kurashige
 31                                                    40 
 32 #include "G4Track.hh"                              41 #include "G4Track.hh"
 33 #include "G4PhysicalConstants.hh"                  42 #include "G4PhysicalConstants.hh"
                                                   >>  43 #include "G4ParticleTable.hh"
                                                   >>  44 #include "G4VelocityTable.hh"
 34 #include "G4VAuxiliaryTrackInformation.hh"         45 #include "G4VAuxiliaryTrackInformation.hh"
                                                   >>  46 #include "G4PhysicsModelCatalog.hh"
 35                                                    47 
 36 #include <iostream>                                48 #include <iostream>
 37 #include <iomanip>                                 49 #include <iomanip>
 38                                                    50 
 39 // ------------------------------------------- << 
 40 G4Allocator<G4Track>*& aTrackAllocator()           51 G4Allocator<G4Track>*& aTrackAllocator()
 41 {                                                  52 {
 42   G4ThreadLocalStatic G4Allocator<G4Track>* _i <<  53     G4ThreadLocalStatic G4Allocator<G4Track>* _instance = nullptr;
 43   return _instance;                            <<  54     return _instance;
                                                   >>  55 }
                                                   >>  56 
                                                   >>  57 G4VelocityTable*& G4Track::velTable()
                                                   >>  58 {
                                                   >>  59     G4ThreadLocalStatic G4VelocityTable* _instance = nullptr;
                                                   >>  60     return _instance;
 44 }                                                  61 }
 45                                                    62 
 46 // ------------------------------------------- <<  63 ///////////////////////////////////////////////////////////
 47 G4Track::G4Track(G4DynamicParticle* apValueDyn     64 G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
 48                  G4double aValueTime,              65                  G4double aValueTime,
 49                  const G4ThreeVector& aValuePo     66                  const G4ThreeVector& aValuePosition)
 50   : fPosition(aValuePosition)                  <<  67 ///////////////////////////////////////////////////////////
 51   , fGlobalTime(aValueTime)                    <<  68   : fCurrentStepNumber(0),    fPosition(aValuePosition),
 52   , fVelocity(c_light)                         <<  69     fGlobalTime(aValueTime),  fLocalTime(0.),
 53 {                                              <<  70     fTrackLength(0.),
 54   fpDynamicParticle = (apValueDynamicParticle) <<  71     fParentID(0),             fTrackID(0),
 55                     ? apValueDynamicParticle : <<  72     fVelocity(c_light),
                                                   >>  73     fpDynamicParticle(apValueDynamicParticle),
                                                   >>  74     fTrackStatus(fAlive),
                                                   >>  75     fBelowThreshold(false),   fGoodForTracking(false),
                                                   >>  76     fStepLength(0.0),         fWeight(1.0),
                                                   >>  77     fpStep(nullptr),
                                                   >>  78     fVtxKineticEnergy(0.0),
                                                   >>  79     fpLVAtVertex(nullptr),          fpCreatorProcess(nullptr),
                                                   >>  80     fCreatorModelIndex(-1),
                                                   >>  81     fpUserInformation(nullptr),
                                                   >>  82     prev_mat(nullptr),  groupvel(nullptr),
                                                   >>  83     prev_velocity(0.0), prev_momentum(0.0),
                                                   >>  84     is_OpticalPhoton(false),
                                                   >>  85     useGivenVelocity(false),
                                                   >>  86     fpAuxiliaryTrackInformationMap(nullptr)
                                                   >>  87 {
                                                   >>  88   static G4ThreadLocal G4bool isFirstTime = true;
                                                   >>  89   static G4ThreadLocal G4ParticleDefinition* fOpticalPhoton = nullptr;
                                                   >>  90   if ( isFirstTime ) {
                                                   >>  91     isFirstTime = false;
                                                   >>  92     // set  fOpticalPhoton
                                                   >>  93     fOpticalPhoton = G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
                                                   >>  94   }
 56   // check if the particle type is Optical Pho     95   // check if the particle type is Optical Photon
 57   is_OpticalPhoton =                           <<  96   is_OpticalPhoton = (fpDynamicParticle->GetDefinition() == fOpticalPhoton);
 58     (fpDynamicParticle->GetDefinition()->GetPD <<  97 
                                                   >>  98   if (velTable() == nullptr ) velTable() = G4VelocityTable::GetVelocityTable();
                                                   >>  99 
                                                   >> 100   fVelocity = CalculateVelocity();
                                                   >> 101 
 59 }                                                 102 }
 60                                                   103 
 61 // ------------------------------------------- << 104 //////////////////
 62 G4Track::G4Track()                                105 G4Track::G4Track()
 63   : fVelocity(c_light)                         << 106 //////////////////
 64   , fpDynamicParticle(new G4DynamicParticle()) << 107   : fCurrentStepNumber(0),    
 65 {}                                             << 108     fGlobalTime(0),           fLocalTime(0.),
 66                                                << 109     fTrackLength(0.),
 67 // ------------------------------------------- << 110     fParentID(0),             fTrackID(0),
 68 G4Track::G4Track(const G4Track& right,G4bool c << 111     fVelocity(c_light),
 69   : fVelocity(c_light)                         << 112     fpDynamicParticle(nullptr),
                                                   >> 113     fTrackStatus(fAlive),
                                                   >> 114     fBelowThreshold(false),   fGoodForTracking(false),
                                                   >> 115     fStepLength(0.0),         fWeight(1.0),
                                                   >> 116     fpStep(nullptr),
                                                   >> 117     fVtxKineticEnergy(0.0),
                                                   >> 118     fpLVAtVertex(nullptr),          fpCreatorProcess(nullptr),
                                                   >> 119     fCreatorModelIndex(-1),
                                                   >> 120     fpUserInformation(nullptr),
                                                   >> 121     prev_mat(nullptr),  groupvel(nullptr),
                                                   >> 122     prev_velocity(0.0), prev_momentum(0.0),
                                                   >> 123     is_OpticalPhoton(false),
                                                   >> 124     useGivenVelocity(false),
                                                   >> 125     fpAuxiliaryTrackInformationMap(nullptr)
 70 {                                                 126 {
 71   fCopyTouchables = copyTouchables;            << 
 72   *this = right;                               << 
 73   fCopyTouchables = true;                      << 
 74 }                                                 127 }
 75                                                   128 
 76 // ------------------------------------------- << 129 //////////////////
 77 G4Track::~G4Track()                            << 130 G4Track::G4Track(const G4Track& right)
                                                   >> 131 //////////////////
                                                   >> 132   : fCurrentStepNumber(0),    
                                                   >> 133     fGlobalTime(0),           fLocalTime(0.),
                                                   >> 134     fTrackLength(0.),
                                                   >> 135     fParentID(0),             fTrackID(0),
                                                   >> 136     fVelocity(c_light),
                                                   >> 137     fpDynamicParticle(nullptr),
                                                   >> 138     fTrackStatus(fAlive),
                                                   >> 139     fBelowThreshold(false),   fGoodForTracking(false),
                                                   >> 140     fStepLength(0.0),         fWeight(1.0),
                                                   >> 141     fpStep(nullptr),
                                                   >> 142     fVtxKineticEnergy(0.0),
                                                   >> 143     fpLVAtVertex(nullptr),          fpCreatorProcess(nullptr),
                                                   >> 144     fCreatorModelIndex(-1),
                                                   >> 145     fpUserInformation(nullptr),
                                                   >> 146     prev_mat(nullptr),  groupvel(nullptr),
                                                   >> 147     prev_velocity(0.0), prev_momentum(0.0),
                                                   >> 148     is_OpticalPhoton(false),
                                                   >> 149     useGivenVelocity(false),
                                                   >> 150     fpAuxiliaryTrackInformationMap(nullptr)
 78 {                                                 151 {
 79   delete fpDynamicParticle;                    << 152   *this = right;
 80   delete fpUserInformation;                    << 
 81   ClearAuxiliaryTrackInformation();            << 
 82 }                                                 153 }
 83                                                   154 
 84 // ------------------------------------------- << 155 ///////////////////
 85 G4Track& G4Track::operator=(const G4Track& rig << 156 G4Track::~G4Track()
                                                   >> 157 ///////////////////
 86 {                                                 158 {
 87   if(this != &right)                           << 159    delete fpDynamicParticle;
 88   {                                            << 160    fpDynamicParticle = nullptr;
 89     fPosition    = right.fPosition;            << 161    delete fpUserInformation;
 90     fGlobalTime  = right.fGlobalTime;          << 162    fpUserInformation = nullptr;
 91     fLocalTime   = right.fLocalTime;           << 163    ClearAuxiliaryTrackInformation();
 92     fTrackLength = right.fTrackLength;         << 164 }
 93     fWeight      = right.fWeight;              << 165 
 94     fStepLength  = right.fStepLength;          << 166 //////////////////
 95                                                << 167 G4Track & G4Track::operator=(const G4Track &right)
 96     // additional fields required for geometri << 168 //////////////////
 97     if(fCopyTouchables) {                      << 169 {
 98       fpTouchable = right.fpTouchable;         << 170   if (this != &right) {
 99       fpNextTouchable = right.fpNextTouchable; << 171    fPosition = right.fPosition;
100       fpOriginTouchable = right.fpOriginToucha << 172    fGlobalTime = right.fGlobalTime;
101     }                                          << 173    fLocalTime = right.fLocalTime;
102                                                << 174    fTrackLength = right.fTrackLength;
103     // Track ID (and Parent ID) is not copied  << 175    fWeight = right.fWeight;
104     fTrackID  = 0;                             << 176    fStepLength = right.fStepLength;
105     fParentID = 0;                             << 177 
106                                                << 178    // Track ID (and Parent ID) is not copied and set to zero for new track
107     // CurrentStepNumber is set to be 0        << 179    fTrackID = 0;
108     fCurrentStepNumber = 0;                    << 180    fParentID =0;
109                                                << 181 
110     // Creator model ID                        << 182    // CurrentStepNumber is set to be 0
111     fCreatorModelID = right.fCreatorModelID;   << 183    fCurrentStepNumber = 0;
112                                                << 184 
113     // Parent resonance                        << 185    // velocity information 
114     fParentResonanceDef = right.fParentResonan << 186    fVelocity = right.fVelocity;
115     fParentResonanceID  = right.fParentResonan << 187 
                                                   >> 188    // dynamic particle information
                                                   >> 189    if (  fpDynamicParticle != nullptr ) delete fpDynamicParticle;
                                                   >> 190    fpDynamicParticle = new G4DynamicParticle(*(right.fpDynamicParticle));
                                                   >> 191  
                                                   >> 192    // track status and flags for tracking  
                                                   >> 193    fTrackStatus = right.fTrackStatus;
                                                   >> 194    fBelowThreshold = right.fBelowThreshold;
                                                   >> 195    fGoodForTracking = right.fGoodForTracking;
116                                                   196    
117     // velocity information                    << 197    // Step information (Step Length, Step Number, pointer to the Step,) 
118     fVelocity = right.fVelocity;               << 198    // are not copied
                                                   >> 199    fpStep = nullptr;
                                                   >> 200 
                                                   >> 201    // vertex information
                                                   >> 202    fVtxPosition = right.fVtxPosition;
                                                   >> 203    fpLVAtVertex = right.fpLVAtVertex;
                                                   >> 204    fVtxKineticEnergy = right.fVtxKineticEnergy;
                                                   >> 205    fVtxMomentumDirection = right.fVtxMomentumDirection;
                                                   >> 206 
                                                   >> 207    // CreatorProcess and UserInformation are not copied 
                                                   >> 208    fpCreatorProcess = nullptr;
                                                   >> 209    if ( fpUserInformation != nullptr ) delete fpUserInformation;
                                                   >> 210    fpUserInformation = nullptr;
                                                   >> 211 
                                                   >> 212    prev_mat = right.prev_mat;
                                                   >> 213    groupvel = right.groupvel;
                                                   >> 214    prev_velocity = right.prev_velocity;
                                                   >> 215    prev_momentum = right.prev_momentum;
119                                                   216 
120     // dynamic particle information            << 217    is_OpticalPhoton = right.is_OpticalPhoton;
121     delete fpDynamicParticle;                  << 218    useGivenVelocity = right.useGivenVelocity; 
122     fpDynamicParticle = new G4DynamicParticle( << 
123                                                << 
124     // track status and flags for tracking     << 
125     fTrackStatus     = right.fTrackStatus;     << 
126     fBelowThreshold  = right.fBelowThreshold;  << 
127     fGoodForTracking = right.fGoodForTracking; << 
128                                                << 
129     // Step information (Step Length, Step Num << 
130     // are not copied                          << 
131     fpStep = nullptr;                          << 
132                                                << 
133     // vertex information                      << 
134     fVtxPosition          = right.fVtxPosition << 
135     fpLVAtVertex          = right.fpLVAtVertex << 
136     fVtxKineticEnergy     = right.fVtxKineticE << 
137     fVtxMomentumDirection = right.fVtxMomentum << 
138                                                << 
139     // CreatorProcess and UserInformation are  << 
140     fpCreatorProcess = nullptr;                << 
141     delete fpUserInformation;                  << 
142     fpUserInformation = nullptr;               << 
143                                                << 
144     prev_mat      = right.prev_mat;            << 
145     groupvel      = right.groupvel;            << 
146     prev_velocity = right.prev_velocity;       << 
147     prev_momentum = right.prev_momentum;       << 
148                                                   219 
149     is_OpticalPhoton = right.is_OpticalPhoton; << 220    ClearAuxiliaryTrackInformation();
150     useGivenVelocity = right.useGivenVelocity; << 
151                                                   221 
152     ClearAuxiliaryTrackInformation();          << 
153   }                                               222   }
154   return *this;                                   223   return *this;
155 }                                                 224 }
156                                                   225 
157 // ------------------------------------------- << 226 ///////////////////
158 void G4Track::CopyTrackInfo(const G4Track& rig << 227 void G4Track::CopyTrackInfo(const G4Track& right)
                                                   >> 228 //////////////////
159 {                                                 229 {
160   fCopyTouchables = copyTouchables;            << 
161   *this = right;                                  230   *this = right;
162   fCopyTouchables = true;                      << 
163 }                                                 231 }
164                                                   232 
165 // ------------------------------------------- << 233 ///////////////////
                                                   >> 234 G4double G4Track::CalculateVelocity() const
                                                   >> 235 ///////////////////
                                                   >> 236 {
                                                   >> 237   if (useGivenVelocity) return fVelocity;    
                                                   >> 238 
                                                   >> 239   G4double velocity = c_light ;
                                                   >> 240   
                                                   >> 241   G4double mass = fpDynamicParticle->GetMass();
                                                   >> 242 
                                                   >> 243   // special case for photons
                                                   >> 244   if ( is_OpticalPhoton ) return CalculateVelocityForOpticalPhoton();
                                                   >> 245 
                                                   >> 246   // particles other than optical photon
                                                   >> 247   if (mass<DBL_MIN) {
                                                   >> 248     // Zero Mass
                                                   >> 249     velocity = c_light;
                                                   >> 250   } else {
                                                   >> 251     G4double T = (fpDynamicParticle->GetKineticEnergy())/mass;
                                                   >> 252     if (T > GetMaxTOfVelocityTable()) {
                                                   >> 253       velocity = c_light;
                                                   >> 254     } else if (T<DBL_MIN) {
                                                   >> 255       velocity =0.;
                                                   >> 256     } else if (T<GetMinTOfVelocityTable()) {
                                                   >> 257       velocity = c_light*std::sqrt(T*(T+2.))/(T+1.0);
                                                   >> 258     } else {  
                                                   >> 259       velocity = velTable()->Value(T);
                                                   >> 260     }
                                                   >> 261     
                                                   >> 262   }                                                                             
                                                   >> 263   return velocity ;
                                                   >> 264 }
                                                   >> 265 
                                                   >> 266 ///////////////////
166 G4double G4Track::CalculateVelocityForOpticalP    267 G4double G4Track::CalculateVelocityForOpticalPhoton() const
                                                   >> 268 ///////////////////
167 {                                                 269 {
168   G4double velocity = c_light;                 << 270     
                                                   >> 271   G4double velocity = c_light ;
                                                   >> 272   
169                                                   273 
170   G4Material* mat        = nullptr;            << 274   G4Material* mat = nullptr; 
171   G4bool update_groupvel = false;                 275   G4bool update_groupvel = false;
172   if(fpStep != nullptr)                        << 276   if ( fpStep !=0  ){
173   {                                            << 277     mat= this->GetMaterial();         //   Fix for repeated volumes
174     mat = this->GetMaterial();  //   Fix for r << 278   }else{
175   }                                            << 279     if (fpTouchable!=0){ 
176   else                                         << 280       mat=fpTouchable->GetVolume()->GetLogicalVolume()->GetMaterial();
177   {                                            << 
178     if(fpTouchable)                            << 
179     {                                          << 
180       mat = fpTouchable->GetVolume()->GetLogic << 
181     }                                             281     }
182   }                                               282   }
183   // check if previous step is in the same vol    283   // check if previous step is in the same volume
184   //  and get new GROUPVELOCITY table if neces << 284     //  and get new GROUPVELOCITY table if necessary 
185   if((mat != nullptr) && ((mat != prev_mat) || << 285   if ((mat != nullptr) && ((mat != prev_mat)||(groupvel==nullptr))) {
186   {                                            << 
187     groupvel = nullptr;                           286     groupvel = nullptr;
188     if(mat->GetMaterialPropertiesTable() != nu    287     if(mat->GetMaterialPropertiesTable() != nullptr)
189       groupvel = mat->GetMaterialPropertiesTab << 288       groupvel = mat->GetMaterialPropertiesTable()->GetProperty("GROUPVEL");
190     update_groupvel = true;                       289     update_groupvel = true;
191   }                                               290   }
192   prev_mat = mat;                                 291   prev_mat = mat;
193                                                << 292   
194   if(groupvel != nullptr)                      << 293   if  (groupvel != nullptr ) {
195   {                                            << 
196     // light velocity = c/(rindex+d(rindex)/d(    294     // light velocity = c/(rindex+d(rindex)/d(log(E_phot)))
197     // values stored in GROUPVEL material prop    295     // values stored in GROUPVEL material properties vector
198     velocity = prev_velocity;                  << 296     velocity =  prev_velocity;
199                                                << 297     
200     // check if momentum is same as in the pre    298     // check if momentum is same as in the previous step
201     //  and calculate group velocity if necess << 299     //  and calculate group velocity if necessary 
202     G4double current_momentum = fpDynamicParti    300     G4double current_momentum = fpDynamicParticle->GetTotalMomentum();
203     if(update_groupvel || (current_momentum != << 301     if( update_groupvel || (current_momentum != prev_momentum) ) {
204     {                                          << 302       velocity =
205       velocity      = groupvel->Value(current_ << 303   groupvel->Value(current_momentum);
206       prev_velocity = velocity;                   304       prev_velocity = velocity;
207       prev_momentum = current_momentum;           305       prev_momentum = current_momentum;
208     }                                             306     }
209   }                                            << 307   }   
                                                   >> 308   
                                                   >> 309   return velocity ;
                                                   >> 310 }
210                                                   311 
211   return velocity;                             << 312 ///////////////////
                                                   >> 313 void G4Track::SetVelocityTableProperties(G4double t_max, G4double t_min, G4int nbin)
                                                   >> 314 ///////////////////
                                                   >> 315 {
                                                   >> 316   G4VelocityTable::SetVelocityTableProperties(t_max, t_min, nbin);
                                                   >> 317   velTable() = G4VelocityTable::GetVelocityTable();
212 }                                                 318 }
213                                                   319 
214 // ------------------------------------------- << 320 ///////////////////
215 void G4Track::SetAuxiliaryTrackInformation(G4i << 321 G4double G4Track::GetMaxTOfVelocityTable()
216               G4VAuxiliaryTrackInformation* in << 322 ///////////////////
                                                   >> 323 { return G4VelocityTable::GetMaxTOfVelocityTable(); }
                                                   >> 324 
                                                   >> 325 ///////////////////
                                                   >> 326 G4double G4Track::GetMinTOfVelocityTable() 
                                                   >> 327 ///////////////////
                                                   >> 328 { return G4VelocityTable::GetMinTOfVelocityTable(); }
                                                   >> 329 
                                                   >> 330 ///////////////////
                                                   >> 331 G4int    G4Track::GetNbinOfVelocityTable() 
                                                   >> 332 ///////////////////
                                                   >> 333 { return G4VelocityTable::GetNbinOfVelocityTable(); }
                                                   >> 334 
                                                   >> 335 ///////////////////
                                                   >> 336 void G4Track::SetAuxiliaryTrackInformation(G4int idx, G4VAuxiliaryTrackInformation* info) const
                                                   >> 337 ///////////////////
217 {                                                 338 {
218   if(fpAuxiliaryTrackInformationMap == nullptr << 339   if(!fpAuxiliaryTrackInformationMap)
219   {                                            << 340   { fpAuxiliaryTrackInformationMap = new std::map<G4int,G4VAuxiliaryTrackInformation*>; }
220     fpAuxiliaryTrackInformationMap =           << 341   if(idx<0 || idx>=G4PhysicsModelCatalog::Entries())
221       new std::map<G4int, G4VAuxiliaryTrackInf << 
222   }                                            << 
223   if(G4PhysicsModelCatalog::GetModelIndex(id)  << 
224   {                                               342   {
225     G4ExceptionDescription ED;                    343     G4ExceptionDescription ED;
226     ED << "Process/model ID <" << id << "> is  << 344     ED << "Process/model index <" << idx << "> is invalid.";
227     G4Exception("G4VAuxiliaryTrackInformation: << 345     G4Exception("G4VAuxiliaryTrackInformation::G4VAuxiliaryTrackInformation()","TRACK0982",
228                 "TRACK0982", FatalException, E << 346     FatalException, ED);
229   }                                               347   }
230   (*fpAuxiliaryTrackInformationMap)[id] = info << 348   (*fpAuxiliaryTrackInformationMap)[idx] = info;
231 }                                                 349 }
232                                                   350 
233 // ------------------------------------------- << 351 ///////////////////
234 G4VAuxiliaryTrackInformation*                  << 352 G4VAuxiliaryTrackInformation* G4Track::GetAuxiliaryTrackInformation(G4int idx) const
235 G4Track::GetAuxiliaryTrackInformation(G4int id << 353 ///////////////////
236 {                                                 354 {
237   if(fpAuxiliaryTrackInformationMap == nullptr << 355   if(!fpAuxiliaryTrackInformationMap) return nullptr;
238     return nullptr;                            << 356   std::map<G4int,G4VAuxiliaryTrackInformation*>::iterator itr
239                                                << 357    = fpAuxiliaryTrackInformationMap->find(idx);
240   auto itr = fpAuxiliaryTrackInformationMap->f << 358   if(itr==fpAuxiliaryTrackInformationMap->end()) return nullptr;
241   if(itr == fpAuxiliaryTrackInformationMap->ce << 359   else return (*itr).second;
242     return nullptr;                            << 
243   return (*itr).second;                        << 
244 }                                                 360 }
245                                                   361 
246 // ------------------------------------------- << 362 ///////////////////
247 void G4Track::RemoveAuxiliaryTrackInformation( << 363 void G4Track::RemoveAuxiliaryTrackInformation(G4int idx)
                                                   >> 364 ///////////////////
248 {                                                 365 {
249   if(fpAuxiliaryTrackInformationMap != nullptr << 366   if(   fpAuxiliaryTrackInformationMap != nullptr
250      fpAuxiliaryTrackInformationMap->find(id)  << 367      && idx>=0 && idx<G4PhysicsModelCatalog::Entries()){
251   {                                            << 368     fpAuxiliaryTrackInformationMap->erase(idx);
252     fpAuxiliaryTrackInformationMap->erase(id); << 
253   }                                               369   }
254 }                                                 370 }
255                                                   371 
256 // ------------------------------------------- << 372 ///////////////////
257 void G4Track::RemoveAuxiliaryTrackInformation(    373 void G4Track::RemoveAuxiliaryTrackInformation(G4String& name)
                                                   >> 374 ///////////////////
258 {                                                 375 {
259   if(fpAuxiliaryTrackInformationMap != nullptr << 376   if(fpAuxiliaryTrackInformationMap != nullptr) {
260   {                                            << 377     G4int idx = G4PhysicsModelCatalog::GetIndex(name);
261     G4int id = G4PhysicsModelCatalog::GetModel << 378     RemoveAuxiliaryTrackInformation(idx);
262     RemoveAuxiliaryTrackInformation(id);       << 
263   }                                               379   }
264 }                                                 380 }
265                                                   381 
266 // ------------------------------------------- << 382 ///////////////////
267 void G4Track::ClearAuxiliaryTrackInformation()    383 void G4Track::ClearAuxiliaryTrackInformation()
                                                   >> 384 ///////////////////
268 {                                                 385 {
269   if(fpAuxiliaryTrackInformationMap == nullptr << 386   if( fpAuxiliaryTrackInformationMap == nullptr) return;
270     return;                                    << 387   for(std::map<G4int,G4VAuxiliaryTrackInformation*>::iterator itr=fpAuxiliaryTrackInformationMap->begin();
271   for(const auto& itr : *fpAuxiliaryTrackInfor << 388       itr!=fpAuxiliaryTrackInformationMap->end(); itr++)
272   {                                            << 389   { delete (*itr).second; }
273     delete itr.second;                         << 
274   }                                            << 
275   delete fpAuxiliaryTrackInformationMap;          390   delete fpAuxiliaryTrackInformationMap;
276   fpAuxiliaryTrackInformationMap = nullptr;       391   fpAuxiliaryTrackInformationMap = nullptr;
277 }                                                 392 }
                                                   >> 393 
                                                   >> 394 
278                                                   395