Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -50,7 +50,7 @@
virtual parent_class* Clone() const { return 0;}
#define G4IT_ADD_CLONE(parent_class, kid_class) \
virtual parent_class* Clone() const {\
parent_class* Clone() const override {\
return new kid_class(*this);\
}
@@ -79,16 +79,15 @@ template<class OBJECT>
template < typename T>
struct type_wrapper
{
typedef T type;
using type = T;
};
#endif
template<class LIST>
struct _ListRef
{
typedef type_wrapper<LIST> traits_type;
typedef type_wrapper<G4ManyFastLists_iterator<typename LIST::object>>
mli_traits_type;
using traits_type = type_wrapper<LIST>;
using mli_traits_type = type_wrapper<G4ManyFastLists_iterator<typename LIST::object>>;
//#ifdef WIN32
// friend typename traits_type::type;
@@ -124,14 +123,14 @@ template<class LIST>
template<class OBJECT>
class G4FastListNode
{
typedef type_wrapper<OBJECT> ObjectW;
typedef G4FastList<typename ObjectW::type> LIST;
using ObjectW = type_wrapper<OBJECT>;
using LIST = G4FastList<typename ObjectW::type>;
// typedef type_wrapper<LIST> > ListW;
typedef type_wrapper<G4FastList<OBJECT> > ListW;
using ListW = type_wrapper<G4FastList<OBJECT>>;
// typedef type_wrapper<G4ManyFastLists<typename ObjectW::type> > ManyListsW;
typedef type_wrapper<G4ManyFastLists<OBJECT> > ManyListsW;
using ManyListsW = type_wrapper<G4ManyFastLists<OBJECT>>;
// typedef type_wrapper<G4ManyFastLists_iterator<typename ObjectW::type> > ManyListsIteratorW;
typedef type_wrapper<G4ManyFastLists_iterator<OBJECT> > ManyListsIteratorW;
using ManyListsIteratorW = type_wrapper<G4ManyFastLists_iterator<OBJECT>>;
//#ifdef WIN32
// friend typename ListW::type;
@@ -182,7 +181,7 @@ template<class OBJECT>
//protected:
/** Default constructor */
G4FastListNode(OBJECT* track = 0);
G4FastListNode(OBJECT* track = nullptr);
void SetNext(G4FastListNode<OBJECT>* node)
{
@@ -241,7 +240,7 @@ template<class OBJECT>
eVeryLow
};
typedef G4FastList<OBJECT> list;
using list = G4FastList<OBJECT>;
Watcher()
{
@@ -250,8 +249,8 @@ template<class OBJECT>
virtual ~Watcher()
{
typename std::set<G4FastList<OBJECT>*>::iterator it = fWatching.begin();
typename std::set<G4FastList<OBJECT>*>::iterator end = fWatching.end();
auto it = fWatching.begin();
auto end = fWatching.end();
for(;it!=end;it++)
{
(*it)->RemoveWatcher(this);
@@ -285,7 +284,7 @@ template<class OBJECT>
void StopWatching(G4FastList<OBJECT>* fastList, bool removeWatcher = true)
{
typename std::set<G4FastList<OBJECT>*>::iterator it = fWatching.find(fastList);
auto it = fWatching.find(fastList);
if(it == fWatching.end()) return; //TODO: exception?
fWatching.erase(it);
if(removeWatcher) fastList->RemoveWatcher(this);
@@ -302,8 +301,8 @@ template<class OBJECT>
class TWatcher : public Watcher
{
public:
TWatcher() : Watcher(){;}
virtual ~TWatcher(){}
TWatcher() : Watcher(){}
virtual ~TWatcher()= default;
virtual G4String GetWatcherName()
{
return typeid(WATCHER_TYPE).name();
@@ -311,16 +310,16 @@ template<class OBJECT>
};
protected:
typedef std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>> WatcherSet;
using WatcherSet = std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>>;
WatcherSet fWatchers;
G4FastListNode<G4FastList<OBJECT> >* fpNodeInManyLists;
public:
typedef OBJECT object;
typedef G4FastList_iterator<OBJECT> iterator;
typedef G4FastList_const_iterator<OBJECT> const_iterator;
typedef G4FastListNode<OBJECT> node;
using object = OBJECT;
using iterator = G4FastList_iterator<OBJECT>;
using const_iterator = G4FastList_const_iterator<OBJECT>;
using node = G4FastListNode<OBJECT>;
G4FastList();
~G4FastList();
@@ -342,7 +341,7 @@ template<class OBJECT>
void RemoveWatcher(Watcher* watcher)
{
typename WatcherSet::iterator it = fWatchers.find(watcher);
auto it = fWatchers.find(watcher);
if(it == fWatchers.end()) return; //TODO: exception?
fWatchers.erase(it);
}
@@ -351,7 +350,7 @@ template<class OBJECT>
{
// if (fNbObjects != 0) return fpFinish->GetObject();
if (fNbObjects != 0) return fBoundary.GetPrevious()->GetObject();
else return 0;
return 0;
}
inline G4int size() const
@@ -457,8 +456,8 @@ template<typename OBJECT>
struct G4FastList_iterator
{
// friend class G4FastList<OBJECT>;
typedef G4FastList_iterator<OBJECT> _Self;
typedef G4FastListNode<OBJECT> _Node;
using _Self = G4FastList_iterator<OBJECT>;
using _Node = G4FastListNode<OBJECT>;
G4FastList_iterator() = default;
@@ -544,8 +543,8 @@ template<typename OBJECT>
struct G4FastList_const_iterator
{
// friend class G4FastList<OBJECT>;
typedef G4FastList_const_iterator<OBJECT> _Self;
typedef G4FastListNode<OBJECT> _Node;
using _Self = G4FastList_const_iterator<OBJECT>;
using _Node = G4FastListNode<OBJECT>;
G4FastList_const_iterator() = default;
@@ -571,7 +570,7 @@ template<typename OBJECT>
const OBJECT*
operator*() const
{
if(fpNode == 0) return 0;
if(fpNode == nullptr) return nullptr;
return fpNode->GetObject();
}
@@ -625,4 +624,4 @@ template<typename OBJECT>
const _Node* fpNode = nullptr;
};
#include "G4FastList.icc"
#include "G4FastList.icc"
@@ -41,7 +41,7 @@ template<class OBJECT>
OBJECT*
G4FastList_iterator<OBJECT>::operator*()
{
if (fpNode == 0) return 0;
if (fpNode == nullptr) return nullptr;
return fpNode->GetObject();
}
@@ -49,7 +49,7 @@ template<class OBJECT>
OBJECT*
G4FastList_iterator<OBJECT>::operator->()
{
if (fpNode == 0) return 0;
if (fpNode == nullptr) return nullptr;
return fpNode->GetObject();
}
@@ -74,7 +74,7 @@ template<class OBJECT>
template<class OBJECT>
G4FastListNode<OBJECT>::G4FastListNode(OBJECT* track) :
fpObject(track), fpPrevious(0), fpNext(0)
fpObject(track), fpPrevious(nullptr), fpNext(nullptr)
{
fAttachedToList = false;
}
@@ -93,7 +93,7 @@ template<class OBJECT>
{
if(fpObject)
{
fpObject->SetListNode(0);
fpObject->SetListNode(nullptr);
}
}
@@ -108,7 +108,7 @@ template<class OBJECT>
fBoundary.SetPrevious(&fBoundary);
fBoundary.SetNext(&fBoundary);
fBoundary.fAttachedToList = true;
fpNodeInManyLists = 0;
fpNodeInManyLists = nullptr;
}
// should not be used
@@ -145,13 +145,13 @@ template<class OBJECT>
OBJECT* __obj = __stackedTrack->GetObject();
delete __stackedTrack;
__stackedTrack = 0;
__stackedTrack = nullptr;
if (__obj)
{
//////////////
DeleteObject(__obj);
__obj = 0;
__obj = nullptr;
//////////////
}
__stackedTrack = __nextStackedTrack;
@@ -159,8 +159,8 @@ template<class OBJECT>
}
fNbObjects = 0;
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
auto it = fWatchers.begin();
auto _end = fWatchers.end();
for (; it != _end; it++)
{
@@ -171,7 +171,7 @@ template<class OBJECT>
if (fpNodeInManyLists)
{
delete fpNodeInManyLists;
fpNodeInManyLists = 0;
fpNodeInManyLists = nullptr;
}
}
@@ -233,7 +233,7 @@ template<class OBJECT>
{
G4FastListNode<OBJECT>* __node = GetNode(__obj);
if (__node != 0)
if (__node != nullptr)
{
// Suggestion move the node to this list
if (__node->fAttachedToList)
@@ -325,8 +325,8 @@ template<class OBJECT>
if(fWatchers.empty() == false)
{
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
auto it = fWatchers.begin();
auto _end = fWatchers.end();
for (; it != _end; it++)
{
@@ -350,8 +350,8 @@ template<class OBJECT>
{
__next_node->fpPrevious = __prev_node;
}
fpNext = 0;
fpPrevious = 0;
fpNext = nullptr;
fpPrevious = nullptr;
}
template<class OBJECT>
@@ -361,8 +361,8 @@ template<class OBJECT>
fNbObjects--;
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
auto it = fWatchers.begin();
auto _end = fWatchers.end();
for (; it != _end; it++)
{
@@ -455,7 +455,7 @@ template<class OBJECT>
G4FastListNode<OBJECT>* __next_node = EraseListNode(__obj);
//////////////////
DeleteObject(__obj);
__obj = 0;
__obj = nullptr;
//////////////////
iterator __next(__next_node);
return __next;
@@ -526,8 +526,8 @@ template<class OBJECT>
if(__destination->fWatchers.empty()==false)
{
typename WatcherSet::iterator it = __destination->fWatchers.begin();
typename WatcherSet::iterator _end = __destination->fWatchers.end();
auto it = __destination->fWatchers.begin();
auto _end = __destination->fWatchers.end();
// G4cout << "G4FastList<OBJECT>::transferTo --- Watcher size = "
// << __destination->fWatchers.size()
@@ -555,8 +555,8 @@ template<class OBJECT>
{
if(__destination->fWatchers.empty()==false)
{
typename WatcherSet::iterator it = __destination->fWatchers.begin();
typename WatcherSet::iterator _end = __destination->fWatchers.end();
auto it = __destination->fWatchers.begin();
auto _end = __destination->fWatchers.end();
for (; it != _end; it++)
{
@@ -594,14 +594,14 @@ template<class OBJECT>
{
G4FastListNode<OBJECT>* __node = GetNode(__obj);
// TODO : complete the exception
if (__node == 0)
if (__node == nullptr)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The object ";
exceptionDescription << " was not connected to any trackList ";
G4Exception("G4FastList<OBJECT>::Unflag", "G4FastList003",
FatalErrorInArgument, exceptionDescription);
return 0;
return nullptr;
}
return __node;
}
@@ -635,8 +635,8 @@ template<class OBJECT>
G4FastList<OBJECT>*
G4FastList<OBJECT>::GetList(G4FastListNode<OBJECT>* __node)
{
if (__node == 0) return 0;
if (__node->fListRef == nullptr) return 0;
if (__node == nullptr) return nullptr;
if (__node->fListRef == nullptr) return nullptr;
return __node->fListRef->fpList;
}
@@ -73,7 +73,7 @@ G4IT* GetIT(const G4Track* track);
G4IT* GetIT(const G4Track& track);
template<class OBJECT> class G4FastListNode;
typedef G4FastListNode<G4Track> G4TrackListNode;
using G4TrackListNode = G4FastListNode<G4Track>;
/**
* G4IT is a interface which allows the inheriting object
@@ -89,12 +89,12 @@ class G4IT : public virtual G4VUserTrackInformation
public:
G4IT();
G4IT(G4Track*);
virtual ~G4IT();
~G4IT() override;
// inline void *operator new(size_t);
// inline void operator delete(void *aIT);
virtual void Print() const
void Print() const override
{
;
}
@@ -95,12 +95,12 @@ public:
private:
const G4ITBox & operator=(const G4ITBox &right);
G4int fNbIT;
G4IT * fpFirstIT;
G4IT * fpLastIT;
G4int fNbIT{0};
G4IT * fpFirstIT{nullptr};
G4IT * fpLastIT{nullptr};
G4ITBox* fpPreviousBox;
G4ITBox* fpNextBox;
G4ITBox* fpPreviousBox{nullptr};
G4ITBox* fpNextBox{nullptr};
};
inline G4bool G4ITBox::Empty() const
@@ -99,7 +99,7 @@ void G4ITMANAGER::Push(G4Track* track)
}
else
{
G4KDTree* aTree = new G4KDTree();
auto aTree = new G4KDTree();
fTree.insert(std::make_pair(key, aTree));
node = aTree->Insert(aIT);
}
@@ -116,10 +116,8 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const G4ThreeVector& position,
{
return it->second->Nearest(position);
}
else
{
return nullptr;
}
return nullptr;
}
TEMPLATE
@@ -147,28 +145,22 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const T* point0, G4int key)
}
return output;
}
else
{
return nullptr;
}
return nullptr;
}
else
auto it = fTree.find(key);
if(it != fTree.end())
{
auto it = fTree.find(key);
if(it != fTree.end())
{
G4KDTreeResultHandle output(it->second->Nearest(*point0));
if(!output)
{
return nullptr;
}
return output;
}
else
G4KDTreeResultHandle output(it->second->Nearest(*point0));
if(!output)
{
return nullptr;
}
return output;
}
return nullptr;
}
TEMPLATE
@@ -186,10 +178,8 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearestInRange(
{
return it->second->NearestInRange(position, R);
}
else
{
return nullptr;
}
return nullptr;
}
TEMPLATE
@@ -202,21 +192,15 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearestInRange(const T* point0, G4int key,
auto it = fTree.find(key);
if(it != fTree.end())
return it->second->NearestInRange(node0, R);
else
{
return nullptr;
}
}
else
{
auto it = fTree.find(key);
if(it != fTree.end())
return it->second->NearestInRange(*point0, R);
else
{
return nullptr;
}
return nullptr;
}
auto it = fTree.find(key);
if(it != fTree.end())
return it->second->NearestInRange(*point0, R);
return nullptr;
}
//#define DEBUG_MEM
@@ -258,44 +242,43 @@ void G4ITMANAGER::UpdatePositionMap()
continue;
}
else
{
auto currentTree = new G4KDTree();
fTree[key] = currentTree;
auto currentTree = new G4KDTree();
fTree[key] = currentTree;
#if defined(DEBUG_MEM)
mem_second = MemoryUsage();
mem_diff = mem_second - mem_first;
G4cout << "\t || MEM || G4ITMANAGER::UpdatePositionMap || "
"after creating tree, diff is : "
<< mem_diff << G4endl;
mem_second = MemoryUsage();
mem_diff = mem_second - mem_first;
G4cout << "\t || MEM || G4ITMANAGER::UpdatePositionMap || "
"after creating tree, diff is : "
<< mem_diff << G4endl;
#endif
G4TrackList* trackList = listUnion->GetMainList();
G4TrackList::iterator __it = trackList->begin();
G4TrackList::iterator __end = trackList->end();
G4TrackList* trackList = listUnion->GetMainList();
G4TrackList::iterator __it = trackList->begin();
G4TrackList::iterator __end = trackList->end();
for(; __it != __end; __it++)
{
G4IT* currentIT = GetIT(*__it);
G4KDNode_Base* currentNode = currentTree->Insert(currentIT);
currentIT->SetNode(currentNode);
#if defined(DEBUG_MEM)
mem_second = MemoryUsage();
mem_diff = mem_second - mem_first;
G4cout << "\t || MEM || G4ITMANAGER::UpdatePositionMap || "
"after currentIT->SetNode(currentNode), diff is : "
<< mem_diff << G4endl;
#endif
}
for(; __it != __end; __it++)
{
G4IT* currentIT = GetIT(*__it);
G4KDNode_Base* currentNode = currentTree->Insert(currentIT);
currentIT->SetNode(currentNode);
#if defined(DEBUG_MEM)
mem_second = MemoryUsage();
mem_diff = mem_second - mem_first;
G4cout << "\t || MEM || G4ITMANAGER::UpdatePositionMap || "
"In else{...}, diff is : "
"after currentIT->SetNode(currentNode), diff is : "
<< mem_diff << G4endl;
#endif
}
#if defined(DEBUG_MEM)
mem_second = MemoryUsage();
mem_diff = mem_second - mem_first;
G4cout << "\t || MEM || G4ITMANAGER::UpdatePositionMap || "
"In else{...}, diff is : "
<< mem_diff << G4endl;
#endif
}
}
@@ -83,5 +83,5 @@ protected:
};
std::vector<ModelInfo> fModelInfoList;
G4bool fIsInitialized;
G4bool fIsInitialized{false};
};
@@ -55,7 +55,7 @@
#include "G4ThreeVector.hh"
#include "G4ITNavigator.hh"
#include "G4TouchableHistoryHandle.hh"
#include "G4TouchableHandle.hh"
#include "G4NavigationHistory.hh"
#include "G4TrackState.hh"
@@ -82,9 +82,8 @@ template<>
class G4TrackState<G4ITMultiNavigator> : public G4TrackState<G4ITNavigator>
{
public:
~G4TrackState()
{
}
~G4TrackState() override
= default;
G4TrackState()
{
@@ -103,7 +102,7 @@ template<>
fLimitTruth[num] = false;
fLimitedStep[num] = kUndefLimited;
fCurrentStepSize[num] = fNewSafety[num] = -1.0;
fLocatedVolume[num] = 0;
fLocatedVolume[num] = nullptr;
}
fNoLimitingStep = -1; // How many geometries limited the step
@@ -151,13 +150,13 @@ public:
G4ITMultiNavigator();
// Constructor - initialisers and setup.
~G4ITMultiNavigator();
~G4ITMultiNavigator() override;
// Destructor. No actions.
G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pDirection,
const G4double pCurrentProposedStepLength,
G4double &pNewSafety);
G4double &pNewSafety) override;
// Return the distance to the next boundary of any geometry
G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety, // for this geom
@@ -173,7 +172,7 @@ public:
G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
const G4ThreeVector &direction,
const G4TouchableHistory &h);
const G4TouchableHistory &h) override;
// Reset the geometrical hierarchy for all geometries.
// Use the touchable history for the first (mass) geometry.
// Return the volume in the first (mass) geometry.
@@ -182,37 +181,37 @@ public:
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
const G4ThreeVector* direction =
0,
nullptr,
const G4bool pRelativeSearch =
true,
const G4bool ignoreDirection =
true);
true) override;
// Locate in all geometries.
// Return the volume in the first (mass) geometry
// Maintain vector of other volumes, to be returned separately
//
// Important Note: In order to call this the geometry MUST be closed.
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
void LocateGlobalPointWithinVolume(const G4ThreeVector& position) override;
// Relocate in all geometries for point that has not changed volume
// (ie is within safety in all geometries or is distance less that
// along the direction of a computed step.
G4double ComputeSafety(const G4ThreeVector &globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = false);
const G4bool keepState = false) override;
// Calculate the isotropic distance to the nearest boundary
// in any geometry from the specified point in the global coordinate
// system. The geometry must be closed.
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
G4TouchableHandle CreateTouchableHistoryHandle() const override;
// Returns a reference counted handle to a touchable history.
virtual G4ThreeVector GetLocalExitNormal(G4bool* obtained);// const
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point,
G4bool* obtained);// const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point,
G4bool* obtained);// const
G4ThreeVector GetLocalExitNormal(G4bool* obtained) override;// const
G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point,
G4bool* obtained) override;// const
G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point,
G4bool* obtained) override;// const
// Return Exit Surface Normal and validity too.
// Can only be called if the Navigator's last Step either
// - has just crossed a volume geometrical boundary and relocated, or
@@ -235,10 +234,10 @@ public:// without description
protected: // with description
void ResetState();
void ResetState() override;
// Utility method to reset the navigator state machine.
void SetupHierarchy();
void SetupHierarchy() override;
// Renavigate & reset hierarchy described by current history
// o Reset volumes
// o Recompute transforms and/or solids of replicated/parameterised
@@ -251,7 +250,7 @@ protected: // with description
private:
G4int fNoActiveNavigators;
G4VPhysicalVolume* fLastMassWorld;
G4VPhysicalVolume* fLastMassWorld{nullptr};
G4ITNavigator* fpNavigator[fMaxNav];// G4ITNavigator** fpNavigator;
@@ -1,573 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
/// \brief { Class description:
///
/// G4ITNavigator is a duplicate version of G4Navigator started from Geant4.9.5
/// initially written by Paul Kent and colleagues.
/// The only difference resides in the way the information is saved and managed
///
/// A class for use by the tracking management, able to obtain/calculate
/// dynamic tracking time information such as the distance to the next volume,
/// or to find the physical volume containing a given point in the world
/// reference system. The navigator maintains a transformation history and
/// other information to optimise the tracking time performance.}
//
// Contact : Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
// WARNING : This class is released as a prototype.
// It might strongly evolve or even disapear in the next releases.
//
// History:
// - Created. Paul Kent, Jul 95/96
// - Zero step protections J.A. / G.C., Nov 2004
// - Added check mode G. Cosmo, Mar 2004
// - Made Navigator Abstract G. Cosmo, Nov 2003
// - G4ITNavigator created M.K., Nov 2012
// *********************************************************************
#ifndef G4ITNavigator_HH
#define G4ITNavigator_HH
#include "geomdefs.hh"
#include "G4ThreeVector.hh"
#include "G4AffineTransform.hh"
#include "G4RotationMatrix.hh"
#include "G4LogicalVolume.hh" // Used in inline methods
#include "G4GRSVolume.hh" // " "
#include "G4GRSSolid.hh" // " "
#include "G4TouchableHandle.hh" // " "
#include "G4TouchableHistoryHandle.hh"
#include "G4NavigationHistory.hh"
#include "G4NormalNavigation.hh"
#include "G4VoxelNavigation.hh"
#include "G4ParameterisedNavigation.hh"
#include "G4ReplicaNavigation.hh"
#include "G4RegularNavigation.hh"
#include <iostream>
class G4VPhysicalVolume;
struct G4ITNavigatorState_Lock
{
virtual ~G4ITNavigatorState_Lock(){;}
protected:
G4ITNavigatorState_Lock(){;}
G4ITNavigatorState_Lock(const G4ITNavigatorState_Lock&){;}
};
#include "G4Navigator.hh"
class G4ITNavigator : public G4Navigator
{
public: // with description
friend std::ostream& operator << (std::ostream &os, const G4ITNavigator &n);
G4ITNavigator();
// Constructor - initialisers and setup.
virtual ~G4ITNavigator();
// Destructor. No actions.
// !>
G4ITNavigatorState_Lock* GetNavigatorState();
void SetNavigatorState(G4ITNavigatorState_Lock*);
void NewNavigatorState();
G4VPhysicalVolume* NewNavigatorStateAndLocate(const G4ThreeVector &p,
const G4ThreeVector &direction);
void CheckNavigatorState() const;
// <!
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pDirection,
const G4double pCurrentProposedStepLength,
G4double &pNewSafety);
// Calculate the distance to the next boundary intersected
// along the specified NORMALISED vector direction and
// from the specified point in the global coordinate
// system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume
// must have been called with the same global point prior to this call.
// The isotropic distance to the nearest boundary is also
// calculated (usually an underestimate). The current
// proposed Step length is used to avoid intersection
// calculations: if it can be determined that the nearest
// boundary is >pCurrentProposedStepLength away, kInfinity
// is returned together with the computed isotropic safety
// distance. Geometry must be closed.
G4double CheckNextStep(const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pDirection,
const G4double pCurrentProposedStepLength,
G4double &pNewSafety);
// Same as above, but do not disturb the state of the Navigator.
virtual
G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
const G4ThreeVector &direction,
const G4TouchableHistory &h);
// Resets the geometrical hierarchy and search for the volumes deepest
// in the hierarchy containing the point in the global coordinate space.
// The direction is used to check if a volume is entered.
// The search begin is the geometrical hierarchy at the location of the
// last located point, or the endpoint of the previous Step if
// SetGeometricallyLimitedStep() has been called immediately before.
//
// Important Note: In order to call this the geometry MUST be closed.
virtual
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
const G4ThreeVector* direction=0,
const G4bool pRelativeSearch=true,
const G4bool ignoreDirection=true);
// Search the geometrical hierarchy for the volumes deepest in the hierarchy
// containing the point in the global coordinate space. Two main cases are:
// i) If pRelativeSearch=false it makes use of no previous/state
// information. Returns the physical volume containing the point,
// with all previous mothers correctly set up.
// ii) If pRelativeSearch is set to true, the search begin is the
// geometrical hierarchy at the location of the last located point,
// or the endpoint of the previous Step if SetGeometricallyLimitedStep()
// has been called immediately before.
// The direction is used (to check if a volume is entered) if either
// - the argument ignoreDirection is false, or
// - the Navigator has determined that it is on an edge shared by two or
// more volumes. (This is state information.)
//
// Important Note: In order to call this the geometry MUST be closed.
virtual
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
// Notify the Navigator that a track has moved to the new Global point
// 'position', that is known to be within the current safety.
// No check is performed to ensure that it is within the volume.
// This method can be called instead of LocateGlobalPointAndSetup ONLY if
// the caller is certain that the new global point (position) is inside the
// same volume as the previous position. Usually this can be guaranteed
// only if the point is within safety.
inline void LocateGlobalPointAndUpdateTouchableHandle(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4TouchableHandle& oldTouchableToUpdate,
const G4bool RelativeSearch = true);
// First, search the geometrical hierarchy like the above method
// LocateGlobalPointAndSetup(). Then use the volume found and its
// navigation history to update the touchable.
inline void LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch = true);
// First, search the geometrical hierarchy like the above method
// LocateGlobalPointAndSetup(). Then use the volume found and its
// navigation history to update the touchable.
inline void LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch = true);
// Same as the method above but missing direction.
inline void SetGeometricallyLimitedStep();
// Inform the navigator that the previous Step calculated
// by the geometry was taken in its entirety.
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = false);
// Calculate the isotropic distance to the nearest boundary from the
// specified point in the global coordinate system.
// The globalpoint utilised must be within the current volume.
// The value returned is usually an underestimate.
// The proposed maximum length is used to avoid volume safety
// calculations. The geometry must be closed.
inline G4VPhysicalVolume* GetWorldVolume() const;
// Return the current world (`topmost') volume.
inline void SetWorldVolume(G4VPhysicalVolume* pWorld);
// Set the world (`topmost') volume. This must be positioned at
// origin (0,0,0) and unrotated.
inline G4GRSVolume* CreateGRSVolume() const;
inline G4GRSSolid* CreateGRSSolid() const;
inline G4TouchableHistory* CreateTouchableHistory() const;
inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
// `Touchable' creation methods: caller has deletion responsibility.
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
// Returns a reference counted handle to a touchable history.
virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector& point,
G4bool* valid);
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point,
G4bool* valid);
// Return Exit Surface Normal and validity too.
// Can only be called if the Navigator's last Step has crossed a
// volume geometrical boundary.
// It returns the Normal to the surface pointing out of the volume that
// was left behind and/or into the volume that was entered.
// Convention:
// The *local* normal is in the coordinate system of the *final* volume.
// Restriction:
// Normals are not available for replica volumes (returns valid= false)
// These methods takes full care about how to calculate this normal,
// but if the surfaces are not convex it will return valid=false.
inline G4int GetVerboseLevel() const;
inline void SetVerboseLevel(G4int level);
// Get/Set Verbose(ness) level.
// [if level>0 && G4VERBOSE, printout can occur]
inline G4bool IsActive() const;
// Verify if the navigator is active.
inline void Activate(G4bool flag);
// Activate/inactivate the navigator.
inline G4bool EnteredDaughterVolume() const;
// The purpose of this function is to inform the caller if the track is
// entering a daughter volume while exiting from the current volume.
// This method returns
// - True only in case 1) above, that is when the Step has caused
// the track to arrive at a boundary of a daughter.
// - False in cases 2), 3) and 4), i.e. in all other cases.
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
// was not called when it should have been called.
inline G4bool ExitedMotherVolume() const;
// Verify if the step has exited the mother volume.
inline void CheckMode(G4bool mode);
// Run navigation in "check-mode", therefore using additional
// verifications and more strict correctness conditions.
// Is effective only with G4VERBOSE set.
inline G4bool IsCheckModeActive() const;
inline void SetPushVerbosity(G4bool mode);
// Set/unset verbosity for pushed tracks (default is true).
void PrintState() const;
// Print the internal state of the Navigator (for debugging).
// The level of detail is according to the verbosity.
inline const G4AffineTransform& GetGlobalToLocalTransform() const;
inline const G4AffineTransform GetLocalToGlobalTransform() const;
// Obtain the transformations Global/Local (and inverse).
// Clients of these methods must copy the data if they need to keep it.
G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume* dVolume,
G4int dReplicaNo,
EVolume dVolumeType );
// Obtain mother to daughter transformation
inline void ResetStackAndState();
// Reset stack and minimum or navigator state machine necessary for reset
// as needed by LocalGlobalPointAndSetup.
// [Does not perform clears, resizes, or reset fLastLocatedPointLocal]
inline G4int SeverityOfZeroStepping( G4int* noZeroSteps ) const;
// Report on severity of error and number of zero steps,
// in case Navigator is stuck and is returning zero steps.
// Values: 1 (small problem), 5 (correcting),
// 9 (ready to abandon), 10 (abandoned)
void SetSavedState();
// ( fValidExitNormal, fExitNormal, fExiting, fEntering,
// fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero);
void RestoreSavedState();
// Copy aspects of the state, to enable a non-state changing
// call to ComputeStep
inline G4ThreeVector GetCurrentLocalCoordinate() const;
// Return the local coordinate of the point in the reference system
// of its containing volume that was found by LocalGlobalPointAndSetup.
// The local coordinate of the last located track.
inline G4ThreeVector NetTranslation() const;
inline G4RotationMatrix NetRotation() const;
// Compute+return the local->global translation/rotation of current volume.
inline void EnableBestSafety( G4bool value= false );
// Enable best-possible evaluation of isotropic safety
protected: // with description
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
// Return position vector in local coordinate system, given a position
// vector in world coordinate system.
inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const;
// Return the local direction of the specified vector in the reference
// system of the volume that was found by LocalGlobalPointAndSetup.
// The Local Coordinates of point in world coordinate system.
virtual void ResetState();
// Utility method to reset the navigator state machine.
inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
// Characterise `type' of volume - normal/replicated/parameterised.
inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const;
// Characterise daughter of logical volume.
inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const;
// Get regular structure ID of first daughter
virtual void SetupHierarchy();
// Renavigate & reset hierarchy described by current history
// o Reset volumes
// o Recompute transforms and/or solids of replicated/parameterised
// volumes.
private:
void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
G4double moveLenSq) const;
// Log and checks for steps larger than the tolerance
protected: // without description
G4double kCarTolerance;
// Geometrical tolerance for surface thickness of shapes.
private:
G4int fVerbose;
// Verbose(ness) level [if > 0, printout can occur].
G4bool fActive;
// States if the navigator is activated or not.
G4int fActionThreshold_NoZeroSteps;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps;
// After this many failed/zero steps, abandon track
protected:
// !>
//
// BEGIN State information
//
struct G4NavigatorState : public G4ITNavigatorState_Lock
{
G4NavigatorState();
G4NavigatorState(const G4NavigatorState&);
virtual ~G4NavigatorState(){;}
G4NavigatorState& operator=(const G4NavigatorState& );
void Reset();
G4NavigationHistory fHistory;
// Transformation and history of the current path
// through the geometrical hierarchy.
G4bool fEnteredDaughter;
// A memory of whether in this Step a daughter volume is entered
// (set in Compute & Locate).
// After Compute: it expects to enter a daughter
// After Locate: it has entered a daughter
G4bool fExitedMother;
// A similar memory whether the Step exited current "mother" volume
// completely, not entering daughter.
G4bool fWasLimitedByGeometry;
// Set true if last Step was limited by geometry.
G4ThreeVector fStepEndPoint;
// Endpoint of last ComputeStep
// can be used for optimisation (e.g. when computing safety).
G4ThreeVector fLastStepEndPointLocal;
// Position of the end-point of the last call to ComputeStep
// in last Local coordinates.
private:
friend class G4ITNavigator;
// The friend class would allow G4Navigator to access the private members
// of G4NavigatorState but not the classes inheriting from G4Navigator
G4bool fPushed;
// Push flags [if true, means a stuck particle has been pushed].
G4bool fLastTriedStepComputation;
// Whether ComputeStep was called since the last call to a Locate method
// Uses: - distinguish parts of state which differ before/after calls
// to ComputeStep or one of the Locate methods;
// - avoid two consecutive calls to compute-step (illegal).
G4bool fEntering,fExiting;
// Entering/Exiting volumes blocking/setup
// o If exiting
// volume ptr & replica number (set & used by Locate..())
// used for blocking on redescent of geometry
// o If entering
// volume ptr & replica number (set by ComputeStep(),used by
// Locate..()) of volume for `automatic' entry
G4VPhysicalVolume *fpBlockedPhysicalVolume;
G4int fBlockedReplicaNo;
G4ThreeVector fLastLocatedPointLocal;
// Position of the last located point relative to its containing volume.
G4bool fLocatedOutsideWorld;
// Whether the last call to Locate methods left the world
G4bool fValidExitNormal; // Set true if have leaving volume normal
G4ThreeVector fExitNormal; // Leaving volume normal, in the
// volume containing the exited
// volume's coordinate system
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
// own coordinate system
// Count zero steps - as one or two can occur due to changing momentum at
// a boundary or at an edge common between volumes
// - several are likely a problem in the geometry
// description or in the navigation
//
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4bool fLocatedOnEdge;
// Whether the Navigator has detected an edge
G4int fNumberZeroSteps;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4ThreeVector fPreviousSftOrigin;
G4double fPreviousSafety;
// Memory of last safety origin & value. Used in ComputeStep to ensure
// that origin of current Step is in the same volume as the point of the
// last relocation
};
G4NavigatorState* fpNavigatorState;
//
// END State information
//
private :
// Save key state information (NOT the navigation history stack)
//
G4NavigatorState fSaveState;
// <!
// Tracking Invariants
//
G4VPhysicalVolume *fTopPhysical;
// A link to the topmost physical volume in the detector.
// Must be positioned at the origin and unrotated.
// Utility information
//
G4bool fCheck;
// Check-mode flag [if true, more strict checks are performed].
G4bool fWarnPush;
// Push flag [for verbose].
// Helpers/Utility classes
//
G4NormalNavigation fnormalNav;
G4VoxelNavigation fvoxelNav;
G4ParameterisedNavigation fparamNav;
G4ReplicaNavigation freplicaNav;
G4RegularNavigation fregularNav;
};
#define CheckNavigatorStateIsValid() \
if(fpNavigatorState == 0) \
{ \
G4ExceptionDescription exceptionDescription; \
exceptionDescription << "The navigator state is NULL. "; \
exceptionDescription << "Either NewNavigatorStateAndLocate was not called "; \
exceptionDescription << "or the provided navigator state was already NULL."; \
G4Exception((G4String("G4Navigator")+G4String(__FUNCTION__)).c_str(),"NavigatorStateNotValid",FatalException,exceptionDescription); \
}
#include "G4ITNavigator.icc"
#endif
// NOTES:
//
// The following methods provide detailed information when a Step has
// arrived at a geometrical boundary. They distinguish between the different
// causes that can result in the track leaving its current volume.
//
// Four cases are possible:
//
// 1) The particle has reached a boundary of a daughter of the current volume:
// (this could cause the relocation to enter the daughter itself
// or a potential granddaughter or further descendant)
//
// 2) The particle has reached a boundary of the current
// volume, exiting into a mother (regardless the level
// at which it is located in the tree):
//
// 3) The particle has reached a boundary of the current
// volume, exiting into a volume which is not in its
// parental hierarchy:
//
// 4) The particle is not on a boundary between volumes:
// the function returns an exception, and the caller is
// reccomended to compare the G4touchables associated
// to the preStepPoint and postStepPoint to handle this case.
//
// G4bool EnteredDaughterVolume()
// G4bool IsExitNormalValid()
// G4ThreeVector GetLocalExitNormal()
//
// The expected usefulness of these methods is to allow the caller to
// determine how to compute the surface normal at the volume boundary. The two
// possibilities are to obtain the normal from:
//
// i) the solid associated with the volume of the initial point of the Step.
// This is valid for cases 2 and 3.
// (Note that the initial point is generally the PreStepPoint of a Step).
// or
//
// ii) the solid of the final point, ie of the volume after the relocation.
// This is valid for case 1.
// (Note that the final point is generally the PreStepPoint of a Step).
//
// This way the caller can always get a valid normal, pointing outside
// the solid for which it is computed, that can be used at his own
// discretion.
@@ -1,547 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// class G4ITNavigator Inline implementation
//
// ********************************************************************
// ********************************************************************
// GetCurrentLocalCoordinate
//
// Returns the local coordinate of the current track
// ********************************************************************
//
inline
G4ThreeVector G4ITNavigator::GetCurrentLocalCoordinate() const
{
CheckNavigatorStateIsValid();
return fpNavigatorState->fLastLocatedPointLocal;
}
// ********************************************************************
// ComputeLocalAxis
//
// Returns local direction of vector direction in world coord system
// ********************************************************************
//
inline
G4ThreeVector G4ITNavigator::ComputeLocalAxis(const G4ThreeVector& pVec) const
{
CheckNavigatorStateIsValid();
return (fpNavigatorState->fHistory.GetTopTransform().IsRotated())
? fpNavigatorState->fHistory.GetTopTransform().TransformAxis(pVec) : pVec ;
}
// ********************************************************************
// ComputeLocalPoint
//
// Returns local coordinates of a point in the world coord system
// ********************************************************************
//
inline
G4ThreeVector
G4ITNavigator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const
{
CheckNavigatorStateIsValid();
return ( fpNavigatorState->fHistory.GetTopTransform().TransformPoint(pGlobalPoint) ) ;
}
// ********************************************************************
// GetWorldVolume
//
// Returns the current world (`topmost') volume
// ********************************************************************
//
inline
G4VPhysicalVolume* G4ITNavigator::GetWorldVolume() const
{
return fTopPhysical;
}
// ********************************************************************
// SetWorldVolume
//
// Sets the world (`topmost') volume
// ********************************************************************
//
inline
void G4ITNavigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
{
if ( !(pWorld->GetTranslation()==G4ThreeVector(0,0,0)) )
{
G4Exception ("G4ITNavigator::SetWorldVolume()", "GeomNav0002",
FatalException, "Volume must be centered on the origin.");
}
const G4RotationMatrix* rm = pWorld->GetRotation();
if ( rm && (!rm->isIdentity()) )
{
G4Exception ("G4ITNavigator::SetWorldVolume()", "GeomNav0002",
FatalException, "Volume must not be rotated.");
}
fTopPhysical = pWorld;
}
// ********************************************************************
// SetGeometrycallyLimitedStep
//
// Informs the navigator that the previous Step calculated
// by the geometry was taken in its entirety
// ********************************************************************
//
inline
void G4ITNavigator::SetGeometricallyLimitedStep()
{
fWasLimitedByGeometry=true;
}
// ********************************************************************
// ResetStackAndState
//
// Resets stack and minimum of navigator state `machine'
// ********************************************************************
//
inline
void G4ITNavigator::ResetStackAndState()
{
G4cerr << "G4ITNavigator::ResetStackAndState not supported" << G4endl;
G4ExceptionDescription exceptionDescription;
exceptionDescription << "G4ITNavigator::ResetStackAndState not supported";
G4Exception((G4String("G4Navigator")+G4String(__FUNCTION__)).c_str(),"ITNavigator001,FatalException,exceptionDescription);
fpNavigatorState->fHistory.Reset();
ResetState();
// fpNavigatorState->Reset();
}
// ********************************************************************
// VolumeType
// ********************************************************************
//
inline
EVolume G4ITNavigator::VolumeType(const G4VPhysicalVolume *pVol) const
{
EVolume type;
EAxis axis;
G4int nReplicas;
G4double width,offset;
G4bool consuming;
if ( pVol->IsReplicated() )
{
pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
type = (consuming) ? kReplica : kParameterised;
}
else
{
type = kNormal;
}
return type;
}
// ********************************************************************
// CharacteriseDaughters
// ********************************************************************
//
inline
EVolume G4ITNavigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const
{
EVolume type;
EAxis axis;
G4int nReplicas;
G4double width,offset;
G4bool consuming;
G4VPhysicalVolume *pVol;
if ( pLog->GetNoDaughters()==1 )
{
pVol = pLog->GetDaughter(0);
if (pVol->IsReplicated())
{
pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
type = (consuming) ? kReplica : kParameterised;
}
else
{
type = kNormal;
}
}
else
{
type = kNormal;
}
return type;
}
// ********************************************************************
// GetDaughtersRegularStructureId
// ********************************************************************
//
inline
G4int G4ITNavigator::
GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
{
G4int regId = 0;
G4VPhysicalVolume *pVol;
if ( pLog->GetNoDaughters()==1 )
{
pVol = pLog->GetDaughter(0);
regId = pVol->GetRegularStructureId();
}
return regId;
}
// ********************************************************************
// GetGlobalToLocalTransform
//
// Returns local to global transformation.
// I.e. transformation that will take point or axis in world coord system
// and return one in the local coord system
// ********************************************************************
//
inline
const G4AffineTransform& G4ITNavigator::GetGlobalToLocalTransform() const
{
CheckNavigatorStateIsValid();
return fpNavigatorState->fHistory.GetTopTransform();
}
// ********************************************************************
// GetLocalToGlobalTransform
//
// Returns global to local transformation
// ********************************************************************
//
inline
const G4AffineTransform G4ITNavigator::GetLocalToGlobalTransform() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tempTransform;
tempTransform = fpNavigatorState->fHistory.GetTopTransform().Inverse();
return tempTransform;
}
// ********************************************************************
// NetTranslation
//
// Computes+returns the local->global translation of current volume
// ********************************************************************
//
inline
G4ThreeVector G4ITNavigator::NetTranslation() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return tf.NetTranslation();
}
// ********************************************************************
// NetRotation
//
// Computes+returns the local->global rotation of current volume
// ********************************************************************
//
inline
G4RotationMatrix G4ITNavigator::NetRotation() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return tf.NetRotation();
}
// ********************************************************************
// CreateGRSVolume
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSVolume* G4ITNavigator::CreateGRSVolume() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return new G4GRSVolume(fpNavigatorState->fHistory.GetTopVolume(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateGRSSolid
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSSolid* G4ITNavigator::CreateGRSSolid() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return new G4GRSSolid(fpNavigatorState->fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateTouchableHistory
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4TouchableHistory* G4ITNavigator::CreateTouchableHistory() const
{
CheckNavigatorStateIsValid();
return new G4TouchableHistory(fpNavigatorState->fHistory);
}
// ********************************************************************
// CreateTouchableHistory(history)
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4TouchableHistory*
G4ITNavigator::CreateTouchableHistory(const G4NavigationHistory* history) const
{
return new G4TouchableHistory(*history);
}
// ********************************************************************
// LocateGlobalPointAndUpdateTouchableHandle
// ********************************************************************
//
inline
void G4ITNavigator::LocateGlobalPointAndUpdateTouchableHandle(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4TouchableHandle& oldTouchableToUpdate,
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
// Will check navigatorState validity
if( fpNavigatorState->fEnteredDaughter || fpNavigatorState->fExitedMother )
{
oldTouchableToUpdate = CreateTouchableHistory();
if( pPhysVol == 0 )
{
// We want to ensure that the touchable is correct in this case.
// The method below should do this and recalculate a lot more ....
//
oldTouchableToUpdate->UpdateYourself( pPhysVol, &fpNavigatorState->fHistory );
}
}
return;
}
// ********************************************************************
// LocateGlobalPointAndUpdateTouchable
//
// Use direction
// ********************************************************************
//
inline
void G4ITNavigator::LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch);
// Will check navigatorState validity
touchableToUpdate->UpdateYourself( pPhysVol, &fpNavigatorState->fHistory );
}
// ********************************************************************
// LocateGlobalPointAndUpdateTouchable
// ********************************************************************
//
inline
void G4ITNavigator::LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);
// Will check navigatorState validity
touchableToUpdate->UpdateYourself( pPhysVol, &fpNavigatorState->fHistory );
}
// ********************************************************************
// GetVerboseLevel
// ********************************************************************
//
inline
G4int G4ITNavigator::GetVerboseLevel() const
{
return fVerbose;
}
// ********************************************************************
// SetVerboseLevel
// ********************************************************************
//
inline
void G4ITNavigator::SetVerboseLevel(G4int level)
{
fVerbose = level;
fnormalNav.SetVerboseLevel(level);
fvoxelNav.SetVerboseLevel(level);
fparamNav.SetVerboseLevel(level);
freplicaNav.SetVerboseLevel(level);
fregularNav.SetVerboseLevel(level);
}
// ********************************************************************
// IsActive
// ********************************************************************
//
inline
G4bool G4ITNavigator::IsActive() const
{
return fActive;
}
// ********************************************************************
// Activate
// ********************************************************************
//
inline
void G4ITNavigator::Activate(G4bool flag)
{
fActive = flag;
}
// ********************************************************************
// EnteredDaughterVolume
//
// To inform the caller if the track is entering a daughter volume
// ********************************************************************
//
inline
G4bool G4ITNavigator::EnteredDaughterVolume() const
{
CheckNavigatorStateIsValid();
return fpNavigatorState->fEnteredDaughter;
}
// ********************************************************************
// ExitedMotherVolume
// ********************************************************************
//
inline
G4bool G4ITNavigator::ExitedMotherVolume() const
{
CheckNavigatorStateIsValid();
return fpNavigatorState->fExitedMother;
}
// ********************************************************************
// CheckMode
// ********************************************************************
//
inline
void G4ITNavigator::CheckMode(G4bool mode)
{
fCheck = mode;
fnormalNav.CheckMode(mode);
fvoxelNav.CheckMode(mode);
fparamNav.CheckMode(mode);
freplicaNav.CheckMode(mode);
fregularNav.CheckMode(mode);
}
// ********************************************************************
// IsCheckModeActive
// ********************************************************************
//
inline
G4bool G4ITNavigator::IsCheckModeActive() const
{
return fCheck;
}
// ********************************************************************
// SetPushVerbosity
// ********************************************************************
//
inline
void G4ITNavigator::SetPushVerbosity(G4bool mode)
{
fWarnPush = mode;
}
// ********************************************************************
// SeverityOfZeroStepping
//
// Reports on severity of error in case Navigator is stuck
// and is returning zero steps
// ********************************************************************
//
inline
G4int G4ITNavigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const
{
CheckNavigatorStateIsValid();
G4int severity=0, noZeros= fpNavigatorState->fNumberZeroSteps;
if( noZeroSteps) *noZeroSteps = fpNavigatorState->fNumberZeroSteps;
if( noZeros >= fAbandonThreshold_NoZeroSteps )
{
severity = 10;
}
if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps )
{
severity = 5 * noZeros / fActionThreshold_NoZeroSteps;
}
else if( noZeros == fActionThreshold_NoZeroSteps )
{
severity = 5;
}
else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 )
{
severity = 9;
}
else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 )
{
severity = 5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps)
/ fActionThreshold_NoZeroSteps;
}
return severity;
}
// ********************************************************************
// EnableBestSafety
// ********************************************************************
//
inline void G4ITNavigator::EnableBestSafety( G4bool value )
{
fvoxelNav.EnableBestSafety( value );
}
@@ -63,10 +63,7 @@
#include "G4RotationMatrix.hh"
#include "G4LogicalVolume.hh" // Used in inline methods
#include "G4GRSVolume.hh" // " "
#include "G4GRSSolid.hh" // " "
#include "G4TouchableHandle.hh" // " "
#include "G4TouchableHistoryHandle.hh"
#include "G4NavigationHistory.hh"
#include "G4NormalNavigation.hh"
@@ -82,9 +79,9 @@ class G4VPhysicalVolume;
struct G4ITNavigatorState_Lock1
{
virtual ~G4ITNavigatorState_Lock1(){;}
virtual ~G4ITNavigatorState_Lock1()= default;
protected:
G4ITNavigatorState_Lock1(){;}
G4ITNavigatorState_Lock1(){}
};
class G4ITNavigator1
@@ -102,6 +99,9 @@ public:
virtual ~G4ITNavigator1();
// Destructor. No actions.
G4ITNavigator1(const G4ITNavigator1&) = delete;
G4ITNavigator1& operator=(const G4ITNavigator1&) = delete;
// !>
G4ITNavigatorState_Lock1* GetNavigatorState();
void SetNavigatorState(G4ITNavigatorState_Lock1*);
@@ -147,7 +147,7 @@ public:
virtual
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
const G4ThreeVector* direction=0,
const G4ThreeVector* direction=nullptr,
const G4bool pRelativeSearch=true,
const G4bool ignoreDirection=true);
// Search the geometrical hierarchy for the volumes deepest in the hierarchy
@@ -223,13 +223,11 @@ public:
// Set the world (`topmost') volume. This must be positioned at
// origin (0,0,0) and unrotated.
inline G4GRSVolume* CreateGRSVolume() const;
inline G4GRSSolid* CreateGRSSolid() const;
inline G4TouchableHistory* CreateTouchableHistory() const;
inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
// `Touchable' creation methods: caller has deletion responsibility.
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
virtual G4TouchableHandle CreateTouchableHistoryHandle() const;
// Returns a reference counted handle to a touchable history.
virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
@@ -354,10 +352,6 @@ public:
private:
G4ITNavigator1(const G4ITNavigator1&);
G4ITNavigator1& operator=(const G4ITNavigator1&);
// Private copy-constructor and assignment operator.
void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
G4double moveLenSq) const;
// Log and checks for steps larger than the tolerance
@@ -385,7 +379,7 @@ public:
// A similar memory whether the Step exited current "mother" volume
// completely, not entering daughter.
G4bool fWasLimitedByGeometry;
G4bool fWasLimitedByGeometry{false};
// Set true if last Step was limited by geometry.
G4ThreeVector fStepEndPoint;
@@ -395,7 +389,7 @@ public:
// Position of the end-point of the last call to ComputeStep
// in last Local coordinates.
G4int fVerbose;
G4int fVerbose{0};
// Verbose(ness) level [if > 0, printout can occur].
private:
@@ -472,7 +466,7 @@ public:
struct G4SaveNavigatorState : public G4ITNavigatorState_Lock1
{
G4SaveNavigatorState();
virtual ~G4SaveNavigatorState(){;}
~G4SaveNavigatorState() override= default;
G4ThreeVector sExitNormal;
G4bool sValidExitNormal;
G4bool sEntering, sExiting;
@@ -501,15 +495,15 @@ public:
// Tracking Invariants
//
G4VPhysicalVolume *fTopPhysical;
G4VPhysicalVolume *fTopPhysical{nullptr};
// A link to the topmost physical volume in the detector.
// Must be positioned at the origin and unrotated.
// Utility information
//
G4bool fCheck;
G4bool fCheck{false};
// Check-mode flag [if true, more strict checks are performed].
G4bool fPushed, fWarnPush;
G4bool fPushed{false}, fWarnPush{true};
// Push flags [if true, means a stuck particle has been pushed].
// Helpers/Utility classes
@@ -98,7 +98,7 @@ void G4ITNavigator1::SetWorldVolume(G4VPhysicalVolume* pWorld)
FatalException, "Volume must be centered on the origin.");
}
const G4RotationMatrix* rm = pWorld->GetRotation();
if ( rm && (!rm->isIdentity()) )
if ( (rm != nullptr) && (!rm->isIdentity()) )
{
G4Exception ("G4ITNavigator1::SetWorldVolume()", "GeomNav0002",
FatalException, "Volume must not be rotated.");
@@ -226,36 +226,6 @@ G4RotationMatrix G4ITNavigator1::NetRotation() const
return tf.NetRotation();
}
// ********************************************************************
// CreateGRSVolume
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSVolume* G4ITNavigator1::CreateGRSVolume() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSVolume(fHistory.GetTopVolume(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateGRSSolid
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSSolid* G4ITNavigator1::CreateGRSSolid() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateTouchableHistory
//
@@ -297,7 +267,7 @@ void G4ITNavigator1::LocateGlobalPointAndUpdateTouchableHandle(
if( fEnteredDaughter || fExitedMother )
{
oldTouchableToUpdate = CreateTouchableHistory();
if( pPhysVol == 0 )
if( pPhysVol == nullptr )
{
// We want to ensure that the touchable is correct in this case.
// The method below should do this and recalculate a lot more ....
@@ -337,7 +307,7 @@ void G4ITNavigator1::LocateGlobalPointAndUpdateTouchable(
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);
pPhysVol = LocateGlobalPointAndSetup( position, nullptr, RelativeSearch);
touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
}
@@ -454,7 +424,7 @@ inline
G4int G4ITNavigator1::SeverityOfZeroStepping( G4int* noZeroSteps ) const
{
G4int severity=0, noZeros= fNumberZeroSteps;
if( noZeroSteps) *noZeroSteps = fNumberZeroSteps;
if( noZeroSteps != nullptr) *noZeroSteps = fNumberZeroSteps;
if( noZeros >= fAbandonThreshold_NoZeroSteps )
{
@@ -63,10 +63,7 @@
#include "G4RotationMatrix.hh"
#include "G4LogicalVolume.hh" // Used in inline methods
#include "G4GRSVolume.hh" // " "
#include "G4GRSSolid.hh" // " "
#include "G4TouchableHandle.hh" // " "
#include "G4TouchableHistoryHandle.hh"
#include "G4NavigationHistory.hh"
#include "G4NormalNavigation.hh"
@@ -83,19 +80,9 @@ class G4VPhysicalVolume;
struct G4ITNavigatorState_Lock2
{
virtual ~G4ITNavigatorState_Lock2()
{
;
}
virtual ~G4ITNavigatorState_Lock2() = default;
protected:
G4ITNavigatorState_Lock2()
{
;
}
G4ITNavigatorState_Lock2(const G4ITNavigatorState_Lock2&)
{
;
}
G4ITNavigatorState_Lock2() = default;
};
class G4ITNavigator2
@@ -114,6 +101,9 @@ public:
virtual ~G4ITNavigator2();
// Destructor. No actions.
G4ITNavigator2(const G4ITNavigator2&) = delete;
G4ITNavigator2& operator=(const G4ITNavigator2&) = delete;
// !>
G4ITNavigatorState_Lock2* GetNavigatorState();
void SetNavigatorState(G4ITNavigatorState_Lock2*);
@@ -166,7 +156,7 @@ public:
virtual
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
const G4ThreeVector* direction=0,
const G4ThreeVector* direction=nullptr,
const G4bool pRelativeSearch=true,
const G4bool ignoreDirection=true);
// Search the geometrical hierarchy for the volumes deepest in the hierarchy
@@ -246,7 +236,7 @@ public:
const G4ThreeVector &pDirection,
const G4double CurrentProposedStepLength,
G4double *prDistance,
G4double *prNewSafety=0) const;
G4double *prNewSafety=nullptr) const;
// Trial method for checking potential displacement for MS
// Check new Globalpoint, to see whether it is in current volume
// (mother) and not in potential entering daughter.
@@ -263,13 +253,11 @@ public:
// Set the world (`topmost') volume. This must be positioned at
// origin (0,0,0) and unrotated.
inline G4GRSVolume* CreateGRSVolume() const;
inline G4GRSSolid* CreateGRSSolid() const;
inline G4TouchableHistory* CreateTouchableHistory() const;
inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
// `Touchable' creation methods: caller has deletion responsibility.
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
virtual G4TouchableHandle CreateTouchableHistoryHandle() const;
// Returns a reference counted handle to a touchable history.
virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
@@ -395,10 +383,6 @@ protected:// with description
private:
G4ITNavigator2(const G4ITNavigator2&);
G4ITNavigator2& operator=(const G4ITNavigator2&);
// Private copy-constructor and assignment operator.
void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
G4double moveLenSq) const;
// Log and checks for steps larger than the tolerance
@@ -408,7 +392,7 @@ protected:// without description
G4double kCarTolerance;
// Geometrical tolerance for surface thickness of shapes.
G4int fVerbose;
G4int fVerbose{0};
// Verbose(ness) level [if > 0, printout can occur].
private:
@@ -432,7 +416,7 @@ public:
{
G4NavigatorState();
G4NavigatorState(const G4NavigatorState&);
virtual ~G4NavigatorState()
~G4NavigatorState() override
{ ;}
G4NavigatorState& operator=(const G4NavigatorState& );
@@ -576,16 +560,16 @@ public:
// Tracking Invariants
//
G4VPhysicalVolume *fTopPhysical;
G4VPhysicalVolume *fTopPhysical{nullptr};
// A link to the topmost physical volume in the detector.
// Must be positioned at the origin and unrotated.
// Utility information
//
G4bool fCheck;
G4bool fCheck{false};
// Check-mode flag [if true, more strict checks are performed].
G4bool fWarnPush;
G4bool fWarnPush{true};
// Push flag [for verbose].
// Helpers/Utility classes
@@ -101,13 +101,13 @@ void G4ITNavigator2::SetWorldVolume(G4VPhysicalVolume* pWorld)
FatalException, "Volume must be centered on the origin.");
}
const G4RotationMatrix* rm = pWorld->GetRotation();
if ( rm && (!rm->isIdentity()) )
if ( (rm != nullptr) && (!rm->isIdentity()) )
{
G4Exception ("G4ITNavigator2::SetWorldVolume()", "GeomNav0002",
FatalException, "Volume must not be rotated.");
}
fTopPhysical = pWorld;
if(fpNavigatorState)
if(fpNavigatorState != nullptr)
fpNavigatorState->fHistory.SetFirstEntry(pWorld);
}
@@ -159,21 +159,19 @@ EVolume G4ITNavigator2::CharacteriseDaughters(const G4LogicalVolume *pLog) const
inline std::shared_ptr<G4ITNavigatorState_Lock2> G4ITNavigator2::GetSnapshotOfState()
{
if(fpNavigatorState)
if(fpNavigatorState != nullptr)
{
std::shared_ptr<G4ITNavigatorState_Lock2>
snapShot(new G4NavigatorState(*fpNavigatorState));
return snapShot;
}
else
{
return std::shared_ptr<G4ITNavigatorState_Lock2>(0);
}
return std::shared_ptr<G4ITNavigatorState_Lock2>(nullptr);
}
inline void G4ITNavigator2::ResetFromSnapshot(std::shared_ptr<G4ITNavigatorState_Lock2> snapShot)
{
if(fpNavigatorState && snapShot)
if((fpNavigatorState != nullptr) && snapShot)
{
*fpNavigatorState = *((G4NavigatorState*) snapShot.get());
}
@@ -256,38 +254,6 @@ G4RotationMatrix G4ITNavigator2::NetRotation() const
return tf.NetRotation();
}
// ********************************************************************
// CreateGRSVolume
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSVolume* G4ITNavigator2::CreateGRSVolume() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return new G4GRSVolume(fpNavigatorState->fHistory.GetTopVolume(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateGRSSolid
//
// `Touchable' creation method: caller has deletion responsibility
// ********************************************************************
//
inline
G4GRSSolid* G4ITNavigator2::CreateGRSSolid() const
{
CheckNavigatorStateIsValid();
G4AffineTransform tf(fpNavigatorState->fHistory.GetTopTransform().Inverse());
return new G4GRSSolid(fpNavigatorState->fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
tf.NetRotation(),
tf.NetTranslation());
}
// ********************************************************************
// CreateTouchableHistory
//
@@ -331,7 +297,7 @@ void G4ITNavigator2::LocateGlobalPointAndUpdateTouchableHandle(
if( fpNavigatorState->fEnteredDaughter || fpNavigatorState->fExitedMother )
{
oldTouchableToUpdate = CreateTouchableHistory();
if( pPhysVol == 0 )
if( pPhysVol == nullptr )
{
// We want to ensure that the touchable is correct in this case.
// The method below should do this and recalculate a lot more ....
@@ -372,7 +338,7 @@ void G4ITNavigator2::LocateGlobalPointAndUpdateTouchable(
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);
pPhysVol = LocateGlobalPointAndSetup( position, nullptr, RelativeSearch);
// Will check navigatorState validity
touchableToUpdate->UpdateYourself( pPhysVol, &fpNavigatorState->fHistory );
}
@@ -493,7 +459,7 @@ G4int G4ITNavigator2::SeverityOfZeroStepping( G4int* noZeroSteps ) const
{
CheckNavigatorStateIsValid();
G4int severity=0, noZeros= fpNavigatorState->fNumberZeroSteps;
if( noZeroSteps) *noZeroSteps = fpNavigatorState->fNumberZeroSteps;
if( noZeroSteps != nullptr) *noZeroSteps = fpNavigatorState->fNumberZeroSteps;
if( noZeros >= fAbandonThreshold_NoZeroSteps )
{
@@ -54,9 +54,8 @@
class G4ITTransportationManager;
class G4ITNavigator;
#include "G4TouchableHandle.hh"
#include "G4FieldTrack.hh"
#include "G4ITMultiNavigator.hh"
#include "G4TouchableHandle.hh"
#include "G4TrackState.hh"
class G4PropagatorInField;
@@ -100,9 +99,9 @@ protected:
// State after calling 'ComputeStep' (others member variables will be affected)
G4FieldTrack fEndState; // Point, velocity, ... at proposed step end
G4bool fFieldExertedForce; // In current proposed step
G4bool fFieldExertedForce{false}; // In current proposed step
G4bool fRelocatedPoint; // Signals that point was or is being moved
G4bool fRelocatedPoint{true}; // Signals that point was or is being moved
// from the position of the last location
// or the endpoint resulting from ComputeStep
// -- invalidates fEndState
@@ -113,17 +112,15 @@ protected:
G4double fNewSafetyComputed[ G4ITNavigator::fMaxNav ]; // Safeties for last ComputeSafety
// State for Step numbers
G4int fLastStepNo, fCurrentStepNo;
G4int fLastStepNo{-1}, fCurrentStepNo{-1};
public:
virtual ~G4TrackState(){}
~G4TrackState() override= default;
G4TrackState() :
G4TrackStateBase(),
fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.),
fFieldExertedForce(false),
fRelocatedPoint(true),
fLastStepNo(-1), fCurrentStepNo(-1) {
fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.)
{
G4ThreeVector Big3Vector( kInfinity, kInfinity, kInfinity );
fLastLocatedPosition= Big3Vector;
@@ -145,7 +142,7 @@ public:
fLimitTruth[num] = false;
fLimitedStep[num] = kUndefLimited;
fCurrentStepSize[num] = -1.0;
fLocatedVolume[num] = 0;
fLocatedVolume[num] = nullptr;
fPreSafetyValues[num]= -1.0;
fCurrentPreStepSafety[num] = -1.0;
fNewSafetyComputed[num]= -1.0;
@@ -190,7 +187,7 @@ public: // with description
void PrepareNewTrack( const G4ThreeVector& position,
const G4ThreeVector& direction,
G4VPhysicalVolume* massStartVol=0);
G4VPhysicalVolume* massStartVol=nullptr);
//
// Check and cache set of active navigators.
@@ -281,7 +278,7 @@ protected: // without description
protected:
G4ITPathFinder(); // Singleton
~G4ITPathFinder();
~G4ITPathFinder() override;
inline G4ITNavigator* GetNavigator(G4int n) const;
@@ -299,7 +296,7 @@ private:
G4ITNavigator* fpNavigator[G4ITNavigator::fMaxNav];
G4int fVerboseLevel; // For debuging purposes
G4int fVerboseLevel{0}; // For debuging purposes
G4ITTransportationManager* fpTransportManager; // Cache for frequent use
// G4PropagatorInField* fpFieldPropagator;
@@ -316,7 +313,7 @@ private:
inline G4VPhysicalVolume* G4ITPathFinder::GetLocatedVolume( G4int navId ) const
{
G4VPhysicalVolume* vol=0;
G4VPhysicalVolume* vol=nullptr;
if( (navId < G4ITNavigator::fMaxNav) && (navId >=0) ) { vol= fpTrackState->fLocatedVolume[navId]; }
return vol;
}
@@ -41,7 +41,7 @@
#include "G4Track.hh"
#include <set>
typedef G4shared_ptr< std::vector<G4Track*> > G4TrackVectorHandle;
using G4TrackVectorHandle = G4shared_ptr< std::vector<G4Track*> >;
#ifndef compTrackPerID__
#define compTrackPerID__
@@ -58,15 +58,15 @@ class G4Track;
class G4ITReactionSet;
class G4ITReactionPerTrack;
class G4ITReaction;
typedef G4shared_ptr<G4ITReaction> G4ITReactionPtr;
typedef G4shared_ptr<G4ITReactionPerTrack> G4ITReactionPerTrackPtr;
using G4ITReactionPtr = G4shared_ptr<G4ITReaction>;
using G4ITReactionPerTrackPtr = G4shared_ptr<G4ITReactionPerTrack>;
typedef std::list<G4ITReactionPtr> G4ITReactionList;
typedef std::map<G4Track*,
using G4ITReactionList = std::list<G4ITReactionPtr>;
using G4ITReactionPerTrackMap = std::map<G4Track*,
G4ITReactionPerTrackPtr,
compTrackPerID> G4ITReactionPerTrackMap;
typedef std::list<std::pair<G4ITReactionPerTrackPtr,
G4ITReactionList::iterator> > G4ReactionPerTrackIt;
compTrackPerID>;
using G4ReactionPerTrackIt = std::list<std::pair<G4ITReactionPerTrackPtr,
G4ITReactionList::iterator> >;
struct compReactionPerTime
{
@@ -74,8 +74,8 @@ struct compReactionPerTime
G4ITReactionPtr lhs) const;
};
typedef std::multiset<G4ITReactionPtr, compReactionPerTime> G4ITReactionPerTime;
typedef std::multiset<G4ITReactionPtr, compReactionPerTime>::iterator G4ITReactionPerTimeIt;
using G4ITReactionPerTime = std::multiset<G4ITReactionPtr, compReactionPerTime>;
using G4ITReactionPerTimeIt = std::multiset<G4ITReactionPtr, compReactionPerTime>::iterator;
class G4ITReaction : public G4enable_shared_from_this<G4ITReaction>
{
@@ -105,7 +105,7 @@ public:
void AddIterator(G4ITReactionPerTrackPtr reactionPerTrack,
G4ITReactionList::iterator it)
{
fReactionPerTrack.push_back(std::make_pair(reactionPerTrack, it));
fReactionPerTrack.emplace_back(reactionPerTrack, it);
}
void AddIterator(G4ITReactionPerTimeIt it)
@@ -227,20 +227,18 @@ public:
{
return true;
}
else
reactionPerTrack = it_track->second;
auto list = reactionPerTrack->GetReactionList();
//for(auto it_list = list.begin(); it_list != list.end(); ++it_list)
for(const auto& it_list:list)
{
reactionPerTrack = it_track->second;
auto list = reactionPerTrack->GetReactionList();
//for(auto it_list = list.begin(); it_list != list.end(); ++it_list)
for(const auto& it_list:list)
if ((*it_list).GetReactant(trackA)->GetTrackID() == trackB->GetTrackID())
{
if ((*it_list).GetReactant(trackA)->GetTrackID() == trackB->GetTrackID())
{
return false;
}
return false;
}
return true;
}
return true;
}
void AddReactions(G4double time, G4Track* trackA, G4TrackVectorHandle reactants)
@@ -282,12 +280,9 @@ public:
void RemoveReactionPerTrack(G4ITReactionPerTrackPtr reactionPerTrack)
{
for(auto it =
reactionPerTrack->GetListOfIterators().begin() ;
it != reactionPerTrack->GetListOfIterators().end() ;
++it)
for(auto & it : reactionPerTrack->GetListOfIterators())
{
fReactionPerTrack.erase(*it);
fReactionPerTrack.erase(it);
}
reactionPerTrack->GetListOfIterators().clear();
reactionPerTrack->GetReactionList().clear();
@@ -67,8 +67,8 @@ public:
// To be used by reaction processes
void Initialize(const G4Track&,
const G4Track&,
G4VParticleChange* particleChangeA = 0,
G4VParticleChange* particleChangeB = 0);
G4VParticleChange* particleChangeA = nullptr,
G4VParticleChange* particleChangeB = nullptr);
void AddSecondary(G4Track* aSecondary);
inline void KillParents(G4bool);
@@ -108,16 +108,16 @@ protected:
// "equal" means that the objects have the same pointer.
protected:
std::map<const G4Track*, G4VParticleChange*> fParticleChange;
std::vector<G4Track*>* fSecondaries;
G4int fNumberOfSecondaries;
G4bool fKillParents;
G4bool fParticleChangeIsSet;
std::vector<G4Track*>* fSecondaries{nullptr};
G4int fNumberOfSecondaries{0};
G4bool fKillParents{false};
G4bool fParticleChangeIsSet{false};
};
inline G4Track* G4ITReactionChange::GetSecondary(G4int anIndex) const
{
if (fSecondaries) return (*fSecondaries)[anIndex];
else return 0;
if (fSecondaries != nullptr) return (*fSecondaries)[anIndex];
return nullptr;
}
inline G4int G4ITReactionChange::GetNumberOfSecondaries() const
@@ -56,7 +56,7 @@ class G4ITSafetyHelper : public G4TrackStateDependent<G4ITSafetyHelper>
public:
// with description
G4ITSafetyHelper();
~G4ITSafetyHelper();
~G4ITSafetyHelper() override;
//
// Constructor and destructor
@@ -110,11 +110,11 @@ private:
G4ITNavigator* fpMassNavigator;
G4int fMassNavigatorId;
G4bool fUseParallelGeometries;
G4bool fUseParallelGeometries{false};
// Flag whether to use PathFinder or single (mass) Navigator directly
G4bool fFirstCall;
G4bool fFirstCall{true};
// Flag of first call
G4int fVerbose;
G4int fVerbose{0};
// Whether to print warning in case of move outside safety
public:
@@ -123,16 +123,15 @@ public:
{
friend class G4ITSafetyHelper;
G4ThreeVector fLastSafetyPosition;
G4double fLastSafety;
G4double fLastSafety{0.0};
public:
State() :
fLastSafetyPosition(0.0,0.0,0.0),
fLastSafety(0.0)
fLastSafetyPosition(0.0,0.0,0.0)
{}
virtual ~State()
{}
= default;
};
// const G4double fRecomputeFactor;
@@ -58,16 +58,15 @@
#include "G4TrackVector.hh" // Include from 'track'
#include "G4TrackStatus.hh" // Include from 'track'
#include "G4StepStatus.hh" // Include from 'track'
//#include "G4UserSteppingAction.hh" // Include from 'tracking'
//#include "G4UserTrackingAction.hh" // Include from 'tracking'
#include "G4Step.hh" // Include from 'track'
#include "G4StepPoint.hh" // Include from 'track'
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4ITStepProcessorState_Lock.hh"
#include "G4ITLeadingTracks.hh"
#include <vector>
class G4ITNavigator;
class G4ParticleDefinition;
class G4ITTrackingManager;
@@ -77,9 +76,9 @@ class G4ITTransportation;
class G4VITProcess;
class G4VITSteppingVerbose;
class G4ITTrackHolder;
typedef class std::vector<int, std::allocator<int> > G4SelectedAtRestDoItVector;
typedef class std::vector<int, std::allocator<int> > G4SelectedAlongStepDoItVector;
typedef class std::vector<int, std::allocator<int> > G4SelectedPostStepDoItVector;
using G4SelectedAtRestDoItVector = std::vector<int, std::allocator<int>>;
using G4SelectedAlongStepDoItVector = std::vector<int, std::allocator<int>>;
using G4SelectedPostStepDoItVector = std::vector<int, std::allocator<int>>;
//________________________________________________
//
@@ -118,7 +117,7 @@ class G4ITStepProcessorState : public G4ITStepProcessorState_Lock
{
public:
G4ITStepProcessorState();
virtual ~G4ITStepProcessorState();
~G4ITStepProcessorState() override;
G4ITStepProcessorState(const G4ITStepProcessorState&);
G4ITStepProcessorState& operator=(const G4ITStepProcessorState&);
@@ -459,25 +458,25 @@ inline void G4ITStepProcessor::CleanProcessor()
fTimeStep = DBL_MAX;
fPhysIntLength = DBL_MAX;
fpState = 0;
fpTrack = 0;
fpTrackingInfo = 0;
fpITrack = 0;
fpStep = 0;
fpPreStepPoint = 0;
fpPostStepPoint = 0;
fpState = nullptr;
fpTrack = nullptr;
fpTrackingInfo = nullptr;
fpITrack = nullptr;
fpStep = nullptr;
fpPreStepPoint = nullptr;
fpPostStepPoint = nullptr;
fpParticleChange = 0;
fpParticleChange = nullptr;
fpCurrentVolume = 0;
fpCurrentVolume = nullptr;
// fpSensitive = 0;
fpSecondary = 0;
fpSecondary = nullptr;
fpTransportation = 0;
fpTransportation = nullptr;
fpCurrentProcess= 0;
fpProcessInfo = 0;
fpCurrentProcess= nullptr;
fpProcessInfo = nullptr;
fAtRestDoItProcTriggered = INT_MAX;
fPostStepDoItProcTriggered = INT_MAX;
@@ -40,7 +40,7 @@ class G4ITStepProcessorState_Lock
friend class G4TrackingInformation;
protected:
inline virtual ~G4ITStepProcessorState_Lock()
{;}
= default;
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITSTEPPROCESSORSTATE_LOCK_HH_ */
@@ -45,37 +45,37 @@ class G4ITSteppingVerbose : public G4VITSteppingVerbose
{
public:
G4ITSteppingVerbose();
~G4ITSteppingVerbose();
~G4ITSteppingVerbose() override;
// methods to be invoked in the SteppingManager
void NewStep();
void StepInfoForLeadingTrack();
void NewStep() override;
void StepInfoForLeadingTrack() override;
void AtRestDoItInvoked();
void AtRestDoItOneByOne();
void AtRestDoItInvoked() override;
void AtRestDoItOneByOne() override;
void AlongStepDoItAllDone();
void AlongStepDoItOneByOne();
void AlongStepDoItAllDone() override;
void AlongStepDoItOneByOne() override;
void PostStepDoItAllDone();
void PostStepDoItOneByOne();
void PostStepDoItAllDone() override;
void PostStepDoItOneByOne() override;
void StepInfo();
void TrackingStarted(G4Track*);
void TrackingEnded(G4Track*);
void StepInfo() override;
void TrackingStarted(G4Track*) override;
void TrackingEnded(G4Track*) override;
void DoItStarted();
void PreStepVerbose(G4Track* track);
void PostStepVerbose(G4Track* track);
void DoItStarted() override;
void PreStepVerbose(G4Track* track) override;
void PostStepVerbose(G4Track* track) override;
void DPSLStarted();
void DPSLUserLimit();
void DPSLPostStep();
void DPSLAlongStep();
void DPSLStarted() override;
void DPSLUserLimit() override;
void DPSLPostStep() override;
void DPSLAlongStep() override;
// void DPSLAlongStepDoItOneByOne();
// void DPSLPostStepDoItOneByOne();
void VerboseTrack();
void VerboseParticleChange();
void VerboseTrack() override;
void VerboseParticleChange() override;
void ShowStep() const;
//
@@ -51,7 +51,7 @@ public:
PriorityList();
PriorityList(G4TrackManyList& allMainList);
PriorityList(const PriorityList& right);
virtual ~PriorityList();
~PriorityList() override;
virtual void NotifyDeletingList(G4TrackList* __list);
@@ -103,9 +103,9 @@ public:
return fpWaitingList;
break;
case Undefined:
return 0;
return nullptr;
}
return 0;
return nullptr;
}
int GetNTracks();
@@ -135,9 +135,9 @@ class G4ITTrackHolder : public G4VITTrackHolder
public:
//----- typedefs -----
typedef int Key; //TODO
typedef std::map<Key, PriorityList*> MapOfPriorityLists;
typedef std::map<double, std::map<Key, G4TrackList*> > MapOfDelayedLists;
using Key = int; //TODO
using MapOfPriorityLists = std::map<Key, PriorityList*>;
using MapOfDelayedLists = std::map<double, std::map<Key, G4TrackList*> >;
//----- Access singletons + constructors/destructors-----
@@ -145,8 +145,8 @@ public:
static G4ITTrackHolder* MasterInstance();
G4ITTrackHolder();
virtual
~G4ITTrackHolder();
~G4ITTrackHolder() override;
//----- Time of the next set of tracks -----
inline double GetNextTime()
@@ -156,7 +156,7 @@ public:
}
//----- Add new tracks to the list -----
virtual void Push(G4Track*);
void Push(G4Track*) override;
static void PushToMaster(G4Track*);
//----- Operations between lists -----
@@ -208,7 +208,7 @@ public:
return fDelayedList;
}
virtual size_t GetNTracks();
size_t GetNTracks() override;
// ----- Check track lists are NOT empty -----
// comment: checking NOT empty faster than checking IS empty
@@ -60,7 +60,7 @@ protected:
int fVerboseLevel;
public:
G4ITTrackingInteractivity(G4VITSteppingVerbose* verbose = 0);
G4ITTrackingInteractivity(G4VITSteppingVerbose* verbose = nullptr);
virtual ~G4ITTrackingInteractivity()
{
@@ -78,20 +78,20 @@ public:
G4ITTransportation(const G4String& aName = "ITTransportation",
G4int verbosityLevel = 0);
virtual ~G4ITTransportation();
~G4ITTransportation() override;
G4ITTransportation(const G4ITTransportation&);
G4IT_ADD_CLONE(G4VITProcess, G4ITTransportation)
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&) override;
virtual void ComputeStep(const G4Track&,
const G4Step&,
const double timeStep,
double& spaceStep);
virtual void StartTracking(G4Track* aTrack);
void StartTracking(G4Track* aTrack) override;
// Give to the track a pointer to the transportation state
G4bool IsStepLimitedByGeometry()
@@ -103,33 +103,33 @@ public:
public:
// without description
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*)
G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*) override
{
return -1.0;
}
// No operation in AtRestDoIt.
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&)
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override
{
return 0;
return nullptr;
}
// No operation in AtRestDoIt.
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
G4double, // previousStepSize
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection);
G4GPILSelection* selection) override;
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track&, // track
G4double PostStepGetPhysicalInteractionLength(const G4Track&, // track
G4double, // previousStepSize
G4ForceCondition* pForceCond);
G4ForceCondition* pForceCond) override;
virtual G4VParticleChange* AlongStepDoIt(const G4Track& track,
const G4Step& stepData);
G4VParticleChange* AlongStepDoIt(const G4Track& track,
const G4Step& stepData) override;
virtual G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step&) override;
//________________________________________________________
// inline virtual G4double GetTransportationTime() ;
@@ -176,8 +176,8 @@ protected:
{
public:
G4ITTransportationState();
virtual ~G4ITTransportationState();
virtual G4String GetType()
~G4ITTransportationState() override;
G4String GetType() override
{
return "G4ITTransportationState";
}
@@ -230,19 +230,19 @@ protected:
//
G4double fThreshold_Warning_Energy; // Warn above this energy
G4double fThreshold_Important_Energy; // Hesitate above this
G4int fThresholdTrials; // for this no of trials
G4int fThresholdTrials{10}; // for this no of trials
// Above 'important' energy a 'looping' particle in field will
// *NOT* be abandoned, except after fThresholdTrials attempts.
G4double fUnimportant_Energy;
// Below this energy, no verbosity for looping particles is issued
// Statistics for tracks abandoned
G4double fSumEnergyKilled;
G4double fMaxEnergyKilled;
G4double fSumEnergyKilled{0.0};
G4double fMaxEnergyKilled{0.0};
// Whether to avoid calling G4Navigator for short step ( < safety)
// If using it, the safety estimate for endpoint will likely be smaller.
G4bool fShortStepOptimisation;
G4bool fShortStepOptimisation{false};
G4ITSafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
@@ -109,7 +109,7 @@ inline G4double G4ITTransportation::GetSumEnergyKilled() const
inline void G4ITTransportation::ResetKilledStatistics(G4int report)
{
if( report ) {
if( report != 0 ) {
G4cout << " G4ITTransportation: Statistics for looping particles " << G4endl;
G4cout << " Sum of energy of loopers killed: " << fSumEnergyKilled << G4endl;
G4cout << " Max energy of loopers killed: " << fMaxEnergyKilled << G4endl;
@@ -90,7 +90,7 @@ inline
std::vector<G4ITNavigator*>::iterator
G4ITTransportationManager::GetActiveNavigatorsIterator()
{
std::vector<G4ITNavigator*>::iterator iterator
auto iterator
= std::vector<G4ITNavigator*>::iterator(fActiveNavigators.begin());
return iterator;
}
@@ -115,7 +115,7 @@ inline
std::vector<G4VPhysicalVolume*>::iterator
G4ITTransportationManager::GetWorldsIterator()
{
std::vector<G4VPhysicalVolume*>::iterator iterator
auto iterator
= std::vector<G4VPhysicalVolume*>::iterator(fWorlds.begin());
return iterator;
}
@@ -67,8 +67,8 @@ public :
static size_t size();
G4ITType(const int d_ = 0) : fValue(d_) {;}
G4ITType(const G4ITType & d_) : fValue(d_.fValue){;}
G4ITType(const int d_ = 0) : fValue(d_) {}
G4ITType(const G4ITType & d_) = default;
G4ITType & operator=(const G4ITType & rhs);
inline G4ITType & operator=(const int & rhs) { fValue = rhs; return *this;}
inline operator int & () { return fValue; }
@@ -117,16 +117,16 @@ static const G4ITType ITType()\
{\
return fType;\
}\
const G4ITType GetITType() const\
const G4ITType GetITType() const override\
{\
return fType;\
}\
virtual G4bool equal(const G4IT &right) const \
G4bool equal(const G4IT &right) const override\
{\
const T& right_mol = (const T&)right ;\
return (this->operator==(right_mol));\
}\
virtual G4bool diff(const G4IT &right) const\
G4bool diff(const G4IT &right) const override\
{\
const T& right_mol = (const T&)right ;\
return (this->operator<(right_mol));\
@@ -112,8 +112,8 @@ protected:
* fSide == 1 : It is the right of the parent node
*/
G4KDTree* fTree;
G4KDNode_Base *fLeft, *fRight, *fParent;
G4KDTree* fTree{nullptr};
G4KDNode_Base *fLeft{nullptr}, *fRight{nullptr}, *fParent{nullptr};
/* Left : fLeft->fPosition[axis] < this->fPosition[axis]
* Right : fRight->fPosition[axis] > this->fPosition[axis]
* Root node : fParent = 0
@@ -136,7 +136,7 @@ template<typename PointT>
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNode(G4KDTree*, PointT* /*point*/, G4KDNode_Base* /*parent*/);
virtual ~G4KDNode();
~G4KDNode() override;
void *operator new(std::size_t);
void operator delete(void *);
@@ -146,19 +146,19 @@ template<typename PointT>
return fPoint;
}
virtual G4double operator[](std::size_t i) const
G4double operator[](std::size_t i) const override
{
if(fPoint == nullptr) abort();
return (*fPoint)[(G4int)i];
}
virtual void InactiveNode()
void InactiveNode() override
{
fValid = false;
G4KDNode_Base::InactiveNode();
}
virtual G4bool IsValid() const
G4bool IsValid() const override
{
return fValid;
}
@@ -212,7 +212,7 @@ template<typename PointCopyT>
fValid = true;
}
virtual ~G4KDNodeCopy(){}
~G4KDNodeCopy() override= default;
void *operator new(std::size_t)
{
@@ -230,18 +230,18 @@ template<typename PointCopyT>
return fPoint;
}
virtual double operator[](std::size_t i) const
double operator[](std::size_t i) const override
{
return fPoint[i];
}
virtual void InactiveNode()
void InactiveNode() override
{
fValid = false;
G4KDNode_Base::InactiveNode();
}
virtual bool IsValid() const
bool IsValid() const override
{
return fValid;
}
@@ -51,6 +51,10 @@ template<typename PointT>
fValid = false;
}
template<typename PointT>
G4KDNode<PointT>::~G4KDNode() {} // NOLINT Intel ICC has ODR link failures if this is =default
// It also cannot be inline, which includes it being inside the class body!
// Assignement should not be used
template<typename PointT>
G4KDNode<PointT>& G4KDNode<PointT>::operator=(const G4KDNode<PointT>& right)
@@ -66,15 +70,10 @@ template<typename PointT>
return *this;
}
template<typename PointT>
G4KDNode<PointT>::~G4KDNode()
{
}
template<typename Position>
G4KDNode_Base* G4KDNode_Base::FindParent(const Position& x0)
{
G4KDNode_Base* aParent = 0;
G4KDNode_Base* aParent = nullptr;
G4KDNode_Base* next = this;
G4int split = -1;
while(next)
@@ -68,7 +68,7 @@
template<typename PointT>
G4KDNode_Base* G4KDTree::InsertMap(PointT* point)
{
G4KDNode<PointT>* node = new G4KDNode<PointT>(this, point, 0);
auto node = new G4KDNode<PointT>(this, point, 0);
this->__InsertMap(node);
return node;
}
@@ -76,10 +76,10 @@ template<typename PointT>
template<typename PointT>
G4KDNode_Base* G4KDTree::Insert(PointT* pos)
{
G4KDNode_Base* node = 0;
G4KDNode_Base* node = nullptr;
if (!fRoot)
{
fRoot = new G4KDNode<PointT>(this, pos, 0);
fRoot = new G4KDNode<PointT>(this, pos, nullptr);
node = fRoot;
fNbNodes = 0;
fNbNodes++;
@@ -94,7 +94,7 @@ template<typename PointT>
}
}
if (fRect == 0)
if (fRect == nullptr)
{
fRect = new HyperRect(fDim);
fRect->SetMinMax(*pos, *pos);
@@ -110,7 +110,7 @@ template<typename PointT>
template<typename PointT>
G4KDNode_Base* G4KDTree::Insert(const PointT& pos)
{
G4KDNode_Base* node = 0;
G4KDNode_Base* node = nullptr;
if (!fRoot)
{
fRoot = new G4KDNodeCopy<PointT>(this, pos, 0);
@@ -128,7 +128,7 @@ template<typename PointT>
}
}
if (fRect == 0)
if (fRect == nullptr)
{
fRect = new HyperRect(fDim);
fRect->SetMinMax(pos, pos);
@@ -206,8 +206,8 @@ template<typename Position>
{
G4int dir = node->GetAxis();
G4double dummy(0.), dist_sq(-1.);
G4KDNode_Base* nearer_subtree(0), *farther_subtree(0);
G4double *nearer_hyperrect_coord(0), *farther_hyperrect_coord(0);
G4KDNode_Base* nearer_subtree(nullptr), *farther_subtree(nullptr);
G4double *nearer_hyperrect_coord(nullptr), *farther_hyperrect_coord(nullptr);
/* Decide whether to go left or right in the tree */
dummy = pos[dir] - (*node)[dir];
@@ -283,13 +283,13 @@ template<typename Position>
{
// G4cout << "Nearest(pos)" << G4endl ;
if (!fRect) return 0;
if (!fRect) return nullptr;
G4KDNode_Base *result(0);
G4KDNode_Base *result(nullptr);
G4double dist_sq = DBL_MAX;
/* Duplicate the bounding hyperrectangle, we will work on the copy */
HyperRect* newrect = new HyperRect(*fRect);
auto newrect = new HyperRect(*fRect);
/* Our first estimate is the root node */
/* Search for the nearest neighbour recursively */
@@ -306,10 +306,8 @@ template<typename Position>
rset->Rewind();
return rset;
}
else
{
return 0;
}
return nullptr;
}
//__________________________________________________________________
@@ -419,7 +417,7 @@ template<typename Position>
G4KDTreeResultHandle rset = new G4KDTreeResult(this);
if ((ret = __NearestInRange(fRoot, pos, range_sq, range, *(rset()), 0)) == -1)
{
rset = 0;
rset = nullptr;
return rset;
}
rset->Sort();
@@ -56,8 +56,8 @@ class G4KDNode_Base;
struct ResNode;
class G4KDTreeResult;
typedef G4ReferenceCountedHandle<G4KDTreeResult> G4KDTreeResultHandle;
typedef G4ReferenceCountedHandle<ResNode> ResNodeHandle;
using G4KDTreeResultHandle = G4ReferenceCountedHandle<G4KDTreeResult>;
using ResNodeHandle = G4ReferenceCountedHandle<ResNode>;
/**
* G4KDTreeResult enables to go through the nearest entities found
@@ -126,7 +126,7 @@ extern G4DLLIMPORT G4Allocator<G4KDTreeResult>*& aKDTreeAllocator();
inline void * G4KDTreeResult::operator new(size_t)
{
if (!aKDTreeAllocator()) aKDTreeAllocator() = new G4Allocator<G4KDTreeResult>;
if (aKDTreeAllocator() == nullptr) aKDTreeAllocator() = new G4Allocator<G4KDTreeResult>;
return (void *) aKDTreeAllocator()->MallocSingle();
}
@@ -138,7 +138,7 @@ inline void G4KDTreeResult::operator delete(void * object)
template<typename PointT>
PointT* G4KDTreeResult::GetItem() const
{
G4KDNode<PointT>* node = (G4KDNode<PointT>*) (GetNode());
auto node = (G4KDNode<PointT>*) (GetNode());
return node->GetPoint();
}
@@ -45,23 +45,23 @@ template<class OBJECT>
class G4ManyFastLists : public G4FastList<OBJECT>::Watcher
{
protected:
typedef G4FastList<G4FastList<OBJECT> > ManyLists;
using ManyLists = G4FastList<G4FastList<OBJECT>>;
ManyLists fAssociatedLists;
// TODO use "marked list" insted of vector
typedef std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>> WatcherSet;
using WatcherSet = std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>>;
WatcherSet* fMainListWatchers;
public:
typedef G4ManyFastLists_iterator<OBJECT> iterator;
using iterator = G4ManyFastLists_iterator<OBJECT>;
G4ManyFastLists() : G4FastList<OBJECT>::Watcher(),
fAssociatedLists(), fMainListWatchers(0)
fAssociatedLists(), fMainListWatchers(nullptr)
{
}
virtual ~G4ManyFastLists() = default;
~G4ManyFastLists() override = default;
virtual void NotifyDeletingList(G4FastList<OBJECT>* __list)
{
@@ -90,15 +90,15 @@ template<class OBJECT>
inline void Add(G4FastList<OBJECT>* __list)
{
if (__list == 0) return;
if (__list == nullptr) return;
fAssociatedLists.push_back(__list); // TODO use the table doubling tech
//__list->AddWatcher(this);
this->Watch(__list);
if(fMainListWatchers == 0) return;
if(fMainListWatchers == nullptr) return;
typename WatcherSet::iterator it_watcher = fMainListWatchers->begin();
typename WatcherSet::iterator end_watcher = fMainListWatchers->end();
auto it_watcher = fMainListWatchers->begin();
auto end_watcher = fMainListWatchers->end();
// G4cout << "G4ManyFastLists::Add -- N watchers ="
// << fMainListWatchers->size()
@@ -148,13 +148,13 @@ template<class OBJECT>
inline void Remove(G4FastList<OBJECT>* __list)
{
if (__list == 0) return;
if (__list == nullptr) return;
fAssociatedLists.pop(__list); // TODO use the table doubling tech
__list->RemoveWatcher(this);
this->StopWatching(__list);
typename WatcherSet::iterator it = fMainListWatchers->begin();
typename WatcherSet::iterator _end = fMainListWatchers->end();
auto it = fMainListWatchers->begin();
auto _end = fMainListWatchers->end();
for(;it != _end ;++it)
{
@@ -203,7 +203,7 @@ template<class OBJECT>
typename ManyLists::node* __node = __it.GetNode();
if(__node)
{
__node->GetObject()->SetListNode(0);
__node->GetObject()->SetListNode(nullptr);
delete __node;
}
// delete (*__it);
@@ -231,10 +231,10 @@ template<class OBJECT>
template<class OBJECT>
struct G4ManyFastLists_iterator
{
typedef G4FastList<G4FastList<OBJECT> > ManyLists;
using ManyLists = G4FastList<G4FastList<OBJECT>>;
typedef G4ManyFastLists_iterator _Self;
typedef G4FastListNode<OBJECT> _Node;
using _Self = G4ManyFastLists_iterator;
using _Node = G4FastListNode<OBJECT>;
G4FastList_iterator<OBJECT> fIterator;
typename ManyLists::iterator fCurrentListIt;
@@ -319,8 +319,8 @@ template<class OBJECT>
fIterator--;
while (((*fCurrentListIt)->empty() || fIterator.GetNode() == 0
|| fIterator.GetNode()->GetObject() == 0)
while (((*fCurrentListIt)->empty() || fIterator.GetNode() == nullptr
|| fIterator.GetNode()->GetObject() == nullptr)
&& fCurrentListIt != fLists->begin())
{
fIterator = (*fCurrentListIt)->begin();
@@ -329,7 +329,7 @@ template<class OBJECT>
fIterator--;
}
if (fIterator.GetNode() == 0 && fCurrentListIt == fLists->begin())
if (fIterator.GetNode() == nullptr && fCurrentListIt == fLists->begin())
{
fIterator = G4FastList_iterator<OBJECT>();
return *this;
@@ -58,11 +58,10 @@ namespace G4MemStat
{
friend std::ostream & operator<<(std::ostream &os, const MemStat& p);
double vmz;
double mem;
double vmz{0};
double mem{0};
MemStat() : vmz(0), mem(0)
{;}
MemStat()= default;
MemStat(const MemStat& right)
{
vmz = right.vmz;
@@ -81,9 +81,9 @@ class G4OctreeFinder: public G4VFinder
private:
static G4ThreadLocal G4OctreeFinder* fInstance;
G4OctreeFinder();
int fVerbose;
G4bool fIsOctreeUsed;
G4bool fIsOctreeBuit;
int fVerbose{0};
G4bool fIsOctreeUsed{false};
G4bool fIsOctreeBuit{false};
Extractor<CONTAINER> fExtractor;
TreeMap fTreeMap;
OctreeHandle fTree;
@@ -44,10 +44,6 @@ G4OctreeFinder<T,CONTAINER> * G4OctreeFinder<T,CONTAINER>::Instance()
template<class T,typename CONTAINER>
G4OctreeFinder<T,CONTAINER>::G4OctreeFinder()
: G4VFinder()
, fVerbose(0)
, fIsOctreeUsed(false)
, fIsOctreeBuit(false)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -141,7 +137,7 @@ void G4OctreeFinder<T,CONTAINER>::FindNearestInRange(const G4Track& track,
result,
G4bool isSorted) const
{
typename TreeMap::const_iterator it = fTreeMap.find(key);
auto it = fTreeMap.find(key);
if (it == fTreeMap.end())
{
return;
@@ -151,33 +147,32 @@ void G4OctreeFinder<T,CONTAINER>::FindNearestInRange(const G4Track& track,
{
return;
}
else
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
track.GetPosition(), R, tempResult);
G4int nBin = 10;
//G4IRTUtils::GetRCutOff(1000 * CLHEP::ns) = 0.00050251
//G4IRTUtils::GetRCutOff(0.1 * CLHEP::ns) = 6.4606e-06
G4double value(6.4606e-06);
G4double binOfR(std::pow(0.00050251 / value,
1. / static_cast<G4double>(nBin - 1)));
if( R <= 0.00050251 )
{
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
track.GetPosition(), R, tempResult);
G4int nBin = 10;
//G4IRTUtils::GetRCutOff(1000 * CLHEP::ns) = 0.00050251
//G4IRTUtils::GetRCutOff(0.1 * CLHEP::ns) = 6.4606e-06
G4double value(6.4606e-06);
G4double binOfR(std::pow(0.00050251 / value,
1. / static_cast<G4double>(nBin - 1)));
if( R <= 0.00050251 )
if(tempResult.size() < 10 && R < 0.00050251)
{
if(tempResult.size() < 10 && R < 0.00050251)
{
R *= binOfR;
R *= binOfR;
#ifdef DEBUG
G4cout<<"recurring up R : "<< R<<" tempResult.size() : "<<tempResult.size()<<G4endl;
G4cout<<"recurring up R : "<< R<<" tempResult.size() : "<<tempResult.size()<<G4endl;
#endif
FindNearestInRange(track, key, R, tempResult, isSorted);
}
FindNearestInRange(track, key, R, tempResult, isSorted);
}
}
if(isSorted)
{
std::sort(tempResult.begin(),tempResult.end(),fExtractor.compareInterval);
@@ -195,7 +190,7 @@ void G4OctreeFinder<T,CONTAINER>::FindNearest(const G4Track& track,
result,
G4bool isSorted) const
{
typename TreeMap::const_iterator it = fTreeMap.find(key);
auto it = fTreeMap.find(key);
if (it == fTreeMap.end())
{
return;
@@ -205,12 +200,11 @@ void G4OctreeFinder<T,CONTAINER>::FindNearest(const G4Track& track,
{
return;
}
else
{
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
track.GetPosition(), R, tempResult);
}
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
track.GetPosition(), R, tempResult);
if(isSorted)
{
std::sort(tempResult.begin(),tempResult.end(),fExtractor.compareInterval);
@@ -239,32 +233,30 @@ void G4OctreeFinder<T,CONTAINER>::FindNearestInRange(const G4ThreeVector& positi
{
return;
}
else
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
position, R, tempResult);
G4int nBin = 10;
//G4IRTUtils::GetRCutOff(1000 * CLHEP::ns) = 0.00050251
//G4IRTUtils::GetRCutOff(0.1 * CLHEP::ns) = 6.4606e-06
G4double value(6.4606e-06);
G4double binOfR(std::pow(0.00050251 / value,
1. / static_cast<G4double>(nBin - 1)));
if( R <= 0.00050251 )
{
it->second->template radiusNeighbors
<std::vector<std::pair<typename CONTAINER::iterator,G4double>>& >(
position, R, tempResult);
G4int nBin = 10;
//G4IRTUtils::GetRCutOff(1000 * CLHEP::ns) = 0.00050251
//G4IRTUtils::GetRCutOff(0.1 * CLHEP::ns) = 6.4606e-06
G4double value(6.4606e-06);
G4double binOfR(std::pow(0.00050251 / value,
1. / static_cast<G4double>(nBin - 1)));
if( R <= 0.00050251 )
if(tempResult.size() < 10 && R < 0.00050251)
{
if(tempResult.size() < 10 && R < 0.00050251)
{
R *= binOfR;
R *= binOfR;
#ifdef DEBUG
G4cout<<"recurring up R : "<< R<<" tempResult.size() : "<<tempResult.size()<<G4endl;
G4cout<<"recurring up R : "<< R<<" tempResult.size() : "<<tempResult.size()<<G4endl;
#endif
FindNearestInRange(position, key, R, tempResult, isSorted);
}
FindNearestInRange(position, key, R, tempResult, isSorted);
}
}
if(isSorted)
{
std::sort(tempResult.begin(),tempResult.end(),fExtractor.compareInterval);
@@ -334,38 +326,36 @@ const std::map<G4int,CONTAINER*>& listMap)
{
continue;
}
//#define DEBUG
#ifdef DEBUG
G4cout << "** " << "Create new tree for : " << key << G4endl;
#endif
if(!Mollist->empty())
{
fTreeMap[key].reset(new Octree(Mollist->begin(),Mollist->end(),fExtractor));
}
else
{
//#define DEBUG
#ifdef DEBUG
G4cout << "** " << "Create new tree for : " << key << G4endl;
#endif
if(!Mollist->empty())
{
fTreeMap[key].reset(new Octree(Mollist->begin(),Mollist->end(),fExtractor));
}
else
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "should not create new tree for : " << key;
G4Exception("G4OCtreeFinder"
"::BuildReactionMap()", "BuildReactionMap02",
FatalException, exceptionDescription);
}
G4ExceptionDescription exceptionDescription;
exceptionDescription << "should not create new tree for : " << key;
G4Exception("G4OCtreeFinder"
"::BuildReactionMap()", "BuildReactionMap02",
FatalException, exceptionDescription);
}
#ifdef DEBUG
auto __it = Mollist->begin();
auto __end = Mollist->end();
auto __it = Mollist->begin();
auto __end = Mollist->end();
for (; __it != __end; __it++)
{
G4cout<< "molecule : "<<(*__it)->GetPosition()<< G4endl;
}
for (; __it != __end; __it++)
{
G4cout<< "molecule : "<<(*__it)->GetPosition()<< G4endl;
}
#endif
#undef DEBUG
}
}
fIsOctreeBuit = true;
}
@@ -90,27 +90,30 @@ class G4Scheduler :
public G4VStateDependent
{
protected:
virtual ~G4Scheduler();
~G4Scheduler() override;
public:
G4Scheduler(const G4Scheduler&) = delete;
G4Scheduler& operator=(const G4Scheduler&) = delete;
static G4Scheduler* Instance();
/** DeleteInstance should be used instead
* of the destructor
*/
static void DeleteInstance();
virtual G4bool Notify(G4ApplicationState requestedState);
G4bool Notify(G4ApplicationState requestedState) override;
virtual void RegisterModel(G4VITStepModel*, G4double);
void RegisterModel(G4VITStepModel*, G4double) override;
void Initialize();
void Initialize() override;
void ForceReinitialization();
inline G4bool IsInitialized();
inline G4bool IsRunning(){return fRunning;}
void Reset();
void Process();
inline G4bool IsRunning() override{return fRunning;}
void Reset() override;
void Process() override;
void ClearList();
inline void SetGun(G4ITGun*);
inline void SetGun(G4ITGun*) override;
inline G4ITGun* GetGun();
inline void Stop();
@@ -122,33 +125,33 @@ public:
// is called in case one would like to access some track information
void EndTracking();
void SetEndTime(const G4double);
void SetEndTime(const G4double) override;
/* Two tracks below the time tolerance are supposed to be
* in the same time slice
*/
inline void SetTimeTolerance(G4double);
inline G4double GetTimeTolerance() const;
inline void SetTimeTolerance(G4double) override;
inline G4double GetTimeTolerance() const override;
inline void SetMaxZeroTimeAllowed(G4int);
inline G4int GetMaxZeroTimeAllowed() const;
inline void SetMaxZeroTimeAllowed(G4int) override;
inline G4int GetMaxZeroTimeAllowed() const override;
inline G4ITModelHandler* GetModelHandler();
inline G4ITModelHandler* GetModelHandler() override;
inline void SetTimeSteps(std::map<G4double, G4double>*);
inline void AddTimeStep(G4double, G4double);
inline void SetDefaultTimeStep(G4double);
G4double GetLimitingTimeStep() const;
inline G4int GetNbSteps() const;
inline void SetMaxNbSteps(G4int);
inline G4int GetMaxNbSteps() const;
inline G4double GetStartTime() const;
inline G4double GetEndTime() const;
virtual inline G4double GetTimeStep() const;
inline G4double GetPreviousTimeStep() const;
inline G4double GetGlobalTime() const;
inline void SetUserAction(G4UserTimeStepAction*);
inline G4UserTimeStepAction* GetUserTimeStepAction() const;
inline void SetTimeSteps(std::map<G4double, G4double>*) override;
inline void AddTimeStep(G4double, G4double) override;
inline void SetDefaultTimeStep(G4double) override;
G4double GetLimitingTimeStep() const override;
inline G4int GetNbSteps() const override;
inline void SetMaxNbSteps(G4int) override;
inline G4int GetMaxNbSteps() const override;
inline G4double GetStartTime() const override;
inline G4double GetEndTime() const override;
inline G4double GetTimeStep() const override;
inline G4double GetPreviousTimeStep() const override;
inline G4double GetGlobalTime() const override;
inline void SetUserAction(G4UserTimeStepAction*) override;
inline G4UserTimeStepAction* GetUserTimeStepAction() const override;
// To use with transportation only, no reactions
inline void UseDefaultTimeSteps(G4bool);
@@ -161,14 +164,14 @@ public:
* 3 : (2) + step info for individual tracks
* 4 : (2) + trackList processing info + pushed and killed track info
*/
inline void SetVerbose(G4int);
inline void SetVerbose(G4int) override;
inline G4int GetVerbose() const;
inline void WhyDoYouStop();
void SetInteractivity(G4ITTrackingInteractivity*);
inline G4ITTrackingInteractivity* GetInteractivity();
void SetInteractivity(G4ITTrackingInteractivity*) override;
inline G4ITTrackingInteractivity* GetInteractivity() override;
virtual size_t GetNTracks();
@@ -215,8 +218,6 @@ protected:
private:
G4Scheduler();
void Create();
G4Scheduler(const G4Scheduler&);
G4Scheduler& operator=(const G4Scheduler&);
G4SchedulerMessenger* fpMessenger;
@@ -317,7 +318,7 @@ void G4Scheduler::SetTimeSteps(std::map<G4double, G4double>* steps)
inline void G4Scheduler::AddTimeStep(G4double startingTime, G4double timeStep)
{
if (fpUserTimeSteps == 0)
if (fpUserTimeSteps == nullptr)
{
fpUserTimeSteps = new std::map<G4double, G4double>();
fUsePreDefinedTimeSteps = true;
@@ -450,7 +451,7 @@ inline void G4Scheduler::UseDefaultTimeSteps(G4bool flag)
inline G4bool G4Scheduler::AreDefaultTimeStepsUsed()
{
return (fUseDefaultTimeSteps == false && fUsePreDefinedTimeSteps == false);
return (!fUseDefaultTimeSteps && !fUsePreDefinedTimeSteps);
}
inline void G4Scheduler::ResetScavenger(bool value)
@@ -66,9 +66,9 @@ class G4SchedulerMessenger : public G4UImessenger
{
public:
explicit G4SchedulerMessenger(G4Scheduler* runMgr);
~G4SchedulerMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
G4String GetCurrentValue(G4UIcommand* command);
~G4SchedulerMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValues) override;
G4String GetCurrentValue(G4UIcommand* command) override;
private:
G4Scheduler* fScheduler;
@@ -52,9 +52,9 @@
#include "G4Track.hh"
#include "G4IT.hh"
typedef G4FastListNode<G4Track> G4TrackListNode;
typedef G4FastList<G4Track> G4TrackList;
typedef G4ManyFastLists<G4Track> G4TrackManyList;
using G4TrackListNode = G4FastListNode<G4Track>;
using G4TrackList = G4FastList<G4Track>;
using G4TrackManyList = G4ManyFastLists<G4Track>;
//! SPECIFIC TO TRACKS
template<>
@@ -57,7 +57,7 @@ protected:
static int Create();
G4VTrackStateID() {}
virtual ~G4VTrackStateID() {}
virtual ~G4VTrackStateID() = default;
};
//------------------------------------------------------------------------------
@@ -72,7 +72,7 @@ private:
static const int fID;
G4TrackStateID() {}
~G4TrackStateID() {}
~G4TrackStateID() override = default;
};
template<class T>
@@ -83,14 +83,14 @@ const int G4TrackStateID<T>::fID (G4VTrackStateID::Create());
class G4VTrackState
{
public:
G4VTrackState() {}
virtual ~G4VTrackState() {}
G4VTrackState() = default;
virtual ~G4VTrackState() = default;
virtual int GetID() = 0;
};
//------------------------------------------------------------------------------
typedef G4shared_ptr<G4VTrackState> G4VTrackStateHandle;
using G4VTrackStateHandle = std::shared_ptr<G4VTrackState>;
//------------------------------------------------------------------------------
//!
@@ -101,9 +101,9 @@ template<class T>
class G4TrackStateBase : public G4VTrackState
{
public:
virtual ~G4TrackStateBase() {}
~G4TrackStateBase() override = default;
virtual int GetID() {
int GetID() override {
return G4TrackStateID<T>::GetID();
}
@@ -126,7 +126,7 @@ class G4TrackState : public G4TrackStateBase<T>
friend class G4TrackStateDependent<T>; //!
public:
virtual ~G4TrackState() {}
virtual ~G4TrackState() = default;
static int ID() {
return G4TrackStateID<T>::GetID();
@@ -152,7 +152,7 @@ public:
G4VTrackStateHandle GetTrackState(void* adress) const
{
std::map<void*, G4VTrackStateHandle>::const_iterator it =
auto it =
fMultipleTrackStates.find(adress);
if (it == fMultipleTrackStates.end())
{
@@ -164,7 +164,7 @@ public:
template<class T>
G4VTrackStateHandle GetTrackState(T* adress) const
{
std::map<void*, G4VTrackStateHandle>::const_iterator it =
auto it =
fMultipleTrackStates.find((void*)adress);
if (it == fMultipleTrackStates.end())
{
@@ -181,7 +181,7 @@ public:
template<typename T>
G4VTrackStateHandle GetTrackState() const
{
std::map<int, G4VTrackStateHandle>::const_iterator it =
auto it =
fTrackStates.find(G4TrackStateID<T>::GetID());
if (it == fTrackStates.end())
{
@@ -196,8 +196,8 @@ public:
class G4VTrackStateDependent
{
public:
G4VTrackStateDependent() {}
virtual ~G4VTrackStateDependent() {}
G4VTrackStateDependent() = default;
virtual ~G4VTrackStateDependent() = default;
virtual void NewTrackState() = 0;
virtual void LoadTrackState(G4TrackStateManager&) = 0;
@@ -235,18 +235,18 @@ template<class T>
class G4TrackStateDependent : public G4VTrackStateDependent
{
public:
typedef T ClassType;
typedef G4TrackState<T> StateType;
typedef G4shared_ptr<StateType> StateTypeHandle;
using ClassType = T;
using StateType = G4TrackState<T>;
using StateTypeHandle = std::shared_ptr<StateType>;
virtual ~G4TrackStateDependent() {}
~G4TrackStateDependent() override = default;
virtual void SetTrackState(G4shared_ptr<StateType> state)
{
fpTrackState = state;
}
virtual G4VTrackStateHandle PopTrackState()
G4VTrackStateHandle PopTrackState() override
{
G4VTrackStateHandle output =
G4dynamic_pointer_cast<G4VTrackState>(fpTrackState);
@@ -254,7 +254,7 @@ public:
return output;
}
virtual G4VTrackStateHandle GetTrackState() const
G4VTrackStateHandle GetTrackState() const override
{
G4VTrackStateHandle output =
G4dynamic_pointer_cast<G4VTrackState>(fpTrackState);
@@ -266,7 +266,7 @@ public:
return fpTrackState;
}
virtual void LoadTrackState(G4TrackStateManager& manager)
void LoadTrackState(G4TrackStateManager& manager) override
{
fpTrackState =
ConvertToConcreteTrackState<ClassType>(manager.GetTrackState(this));
@@ -277,12 +277,12 @@ public:
}
}
virtual void SaveTrackState(G4TrackStateManager& manager)
void SaveTrackState(G4TrackStateManager& manager) override
{
manager.SetTrackState(this, ConvertToAbstractTrackState(fpTrackState));
}
virtual void NewTrackState()
void NewTrackState() override
{
fpTrackState = StateTypeHandle(new StateType());
}
@@ -292,7 +292,7 @@ public:
return StateTypeHandle(new StateType());
}
virtual void ResetTrackState()
void ResetTrackState() override
{
fpTrackState.reset();
}
@@ -58,10 +58,10 @@
class G4ITStepProcessor;
typedef std::vector<G4int> G4SelectedAtRestDoItVector;
typedef std::vector<G4int> G4SelectedAlongStepDoItVector;
typedef std::vector<G4int> G4SelectedPostStepDoItVector;
typedef std::vector<G4int> G4SelectedPostStepAtTimeDoItVector;
using G4SelectedAtRestDoItVector = std::vector<G4int>;
using G4SelectedAlongStepDoItVector = std::vector<G4int>;
using G4SelectedPostStepDoItVector = std::vector<G4int>;
using G4SelectedPostStepAtTimeDoItVector = std::vector<G4int>;
class G4Trajectory_Lock;
class G4Track;
@@ -167,7 +167,7 @@ protected:
//-------------
friend class G4ITStepProcessor;
//_______________________________________________________
G4bool fStepLeader;
G4bool fStepLeader{false};
//_______________________________________________________
G4Trajectory_Lock* fpTrajectory_Lock;
@@ -191,7 +191,7 @@ protected:
std::vector<G4shared_ptr<G4ProcessState_Lock> > fProcessState;
//_______________________________________________________
G4ITStepProcessorState_Lock* fpStepProcessorState;
G4ITStepProcessorState_Lock* fpStepProcessorState{nullptr};
//_______________________________________________________
/** Copy constructor
@@ -57,18 +57,16 @@ class G4VDNAMesh
{
return x < rhs.x;
}
else if(y != rhs.y)
if(y != rhs.y)
{
return y < rhs.y;
}
else if(z != rhs.z)
if(z != rhs.z)
{
return z < rhs.z;
}
else
{
return false;
}
return false;
}
friend std::ostream& operator<<(std::ostream& s, const Index& rhs);
G4int x = 0;
@@ -41,8 +41,8 @@
class G4VDNAMolecularGeometry
{
public:
G4VDNAMolecularGeometry(){};
virtual ~G4VDNAMolecularGeometry(){};
G4VDNAMolecularGeometry()= default;
virtual ~G4VDNAMolecularGeometry()= default;
virtual void FindNearbyMolecules(const G4LogicalVolume*,
const G4ThreeVector&,
@@ -46,44 +46,46 @@ public:
G4VITDiscreteProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITDiscreteProcess(G4VITDiscreteProcess &);
virtual ~G4VITDiscreteProcess();
~G4VITDiscreteProcess() override;
G4VITDiscreteProcess & operator=(const G4VITDiscreteProcess &right) = delete;
public:
// with description
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4ForceCondition* condition) override;
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
G4GPILSelection*) override
{
return -1.0;
}
;
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*)
G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*) override
{
return -1.0;
}
;
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&)
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override
{
return 0;
return nullptr;
}
;
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&) override
{
return 0;
return nullptr;
}
;
@@ -98,7 +100,6 @@ protected:
private:
// hide default constructor and assignment operator as private
G4VITDiscreteProcess();
G4VITDiscreteProcess & operator=(const G4VITDiscreteProcess &right);
};
@@ -102,7 +102,7 @@ public:
// Constructors & destructors
G4VITProcess(const G4String& name, G4ProcessType type = fNotDefined);
virtual ~G4VITProcess();
~G4VITProcess() override;
G4VITProcess(const G4VITProcess& other);
G4VITProcess& operator=(const G4VITProcess& other);
@@ -135,9 +135,9 @@ public:
//__________________________________
// Initialize and Save process info
virtual void StartTracking(G4Track*);
void StartTracking(G4Track*) override;
virtual void BuildPhysicsTable(const G4ParticleDefinition&)
void BuildPhysicsTable(const G4ParticleDefinition&) override
{
}
@@ -146,7 +146,7 @@ public:
/** WARNING : Redefine the method of G4VProcess
* reset (determine the value of)NumberOfInteractionLengthLeft
*/
virtual void ResetNumberOfInteractionLengthLeft();
void ResetNumberOfInteractionLengthLeft() override;
inline G4bool ProposesTimeStep() const;
@@ -166,7 +166,7 @@ protected:
{
public:
G4ProcessState();
virtual ~G4ProcessState();
~G4ProcessState() override;
virtual G4String GetType()
{
@@ -198,11 +198,10 @@ protected:
G4ProcessState()
{
}
virtual ~G4ProcessStateBase()
{
}
~G4ProcessStateBase() override
= default;
virtual G4String GetType()
G4String GetType() override
{
return typeid(T).name();
}
@@ -284,7 +283,7 @@ inline G4bool G4VITProcess::ProposesTimeStep() const
inline const size_t& G4VITProcess::GetMaxProcessIndex()
{
if (!fNbProcess) fNbProcess = new size_t(0);
if (fNbProcess == nullptr) fNbProcess = new size_t(0);
return *fNbProcess;
}
@@ -68,41 +68,41 @@ public:
G4VITRestProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITRestProcess(const G4VITRestProcess&);
virtual ~G4VITRestProcess();
~G4VITRestProcess() override;
public:
// with description
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition);
G4double AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition) override;
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override;
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
G4GPILSelection*) override
{
return -1.0;
}
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track&,
G4double PostStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4ForceCondition*)
G4ForceCondition*) override
{
return -1.0;
}
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&)
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override
{
return 0;
return nullptr;
}
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&) override
{
return 0;
return nullptr;
}
protected:
@@ -68,7 +68,7 @@ class G4VITSteppingVerbose : G4UImessenger
{
public:
G4VITSteppingVerbose();
virtual ~G4VITSteppingVerbose();
~G4VITSteppingVerbose() override;
public:
@@ -116,10 +116,10 @@ public:
//____________________________________________________________________________
virtual void SetNewValue(G4UIcommand * command,
G4String newValue);
void SetNewValue(G4UIcommand * command,
G4String newValue) override;
virtual G4String GetCurrentValue(G4UIcommand * command);
G4String GetCurrentValue(G4UIcommand * command) override;
//____________________________________________________________________________
@@ -179,9 +179,9 @@ protected:
G4int fVerboseLevel;
typedef std::vector<G4int> G4SelectedAtRestDoItVector;
typedef std::vector<G4int> G4SelectedAlongStepDoItVector;
typedef std::vector<G4int> G4SelectedPostStepDoItVector;
using G4SelectedAtRestDoItVector = std::vector<G4int>;
using G4SelectedAlongStepDoItVector = std::vector<G4int>;
using G4SelectedPostStepDoItVector = std::vector<G4int>;
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector;
@@ -57,7 +57,7 @@
#include "G4memory.hh"
//typedef G4ReferenceCountedHandle< std::vector<G4Track*> > G4TrackVectorHandle;
typedef G4shared_ptr< std::vector<G4Track*> > G4TrackVectorHandle;
using G4TrackVectorHandle = std::shared_ptr<std::vector<G4Track *>>;
/**
* Before stepping all tracks G4Scheduler calls all the G4VITModel
@@ -64,7 +64,7 @@ public:
virtual G4bool IsRunning(){ return false; }
virtual G4ITModelHandler* GetModelHandler(){ return 0; }
virtual G4ITModelHandler* GetModelHandler(){ return nullptr; }
virtual void RegisterModel(G4VITStepModel*, double){;}
@@ -92,10 +92,10 @@ public:
virtual G4double GetGlobalTime() const {return -1;}
virtual void SetUserAction(G4UserTimeStepAction*) {;}
virtual G4UserTimeStepAction* GetUserTimeStepAction() const {return 0;}
virtual G4UserTimeStepAction* GetUserTimeStepAction() const {return nullptr;}
virtual void SetInteractivity(G4ITTrackingInteractivity*){;}
virtual G4ITTrackingInteractivity* GetInteractivity() {return 0;}
virtual G4ITTrackingInteractivity* GetInteractivity() {return nullptr;}
};
#endif /* G4ITTIMESTEPPER_HH_ */