Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+3 -7
View File
@@ -1,9 +1,6 @@
#------------------------------------------------------------------------------
# Module : G4digits_hits
# Package: Geant4.src.G4digits_hits
#------------------------------------------------------------------------------
# - G4digits_hits category build
# Add allocation export symbol for the digits_hits category
# Add (private) allocation export symbol
add_definitions(-DG4DIGI_ALLOC_EXPORT)
geant4_global_library_target(NAME G4digits_hits
@@ -12,5 +9,4 @@ geant4_global_library_target(NAME G4digits_hits
digits/sources.cmake
hits/sources.cmake
scorer/sources.cmake
utils/sources.cmake
)
utils/sources.cmake)
+18 -12
View File
@@ -16,9 +16,15 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 21st, 2021 J. Madsen (digit_hits-V10-07-01)
- make G4digits_hits-format
April 1st, 2021 B. Morgan (digits_hits-V10-07-00)
- Migrate build to modular CMake API
May 29th, 2020, G. Cosmo (digits_hits-V10-06-02)
- Fixed cases of comparison between int and size_t in templated classes
and some cleanup.
and some cleanup.
May 2nd, 2020, J. Apostolakis (digits_hits-V10-06-01)
- Added two ComputeSolid method to G4VPrimitiveScorer, to consolidate code.
@@ -57,15 +63,15 @@ December 20th, 2018 G. Cosmo (digits_hits-V10-05-00)
October 30th, 2018 I. Hrivnacova (digits_hits-V10-04-11,12)
- Removed the dependence on analysis:
Introduced a new interface class, G4VScoreNtupleWriter, in
digits_hits/utils and moved the G4ScoreNtupleWriter, G4ScoreNtupleWriterMessenger
Introduced a new interface class, G4VScoreNtupleWriter, in
digits_hits/utils and moved the G4ScoreNtupleWriter, G4ScoreNtupleWriterMessenger
classes in a new extended example analysis/B3aScoreWriter.
October 27th, 2018 I. Hrivnacova (digits_hits-V10-04-10)
- Fixed utils/GNUmakefile: added analysis includes
October 26th, 2018 I. Hrivnacova (digits_hits-V10-04-08,09)
- Removed digiwdefs.hh (added in digits_hits-V10-04-06) - not used
- Removed digiwdefs.hh (added in digits_hits-V10-04-06) - not used
October 26th, 2018 J. Madsen (digits_hits-V10-04-07)
- Fix to Windows problems for G4ScoreNtupleWriter, it turns out that
@@ -118,7 +124,7 @@ May 2, 2017 J. Madsen (digits_hits-V10-03-01)
- Update to G4THitsMap to fix issue where G4Colour was
using G4THitsMap<G4StatDouble> and the allocation
was causing += to white instead of += to black
April 20, 2017 J. Madsen (digit_hits-V10-03-00)
- Files modified : hits/include/G4THitsMap.hh
- Extension of the G4THitsMap class + bug fix
@@ -154,9 +160,9 @@ April 20, 2017 J. Madsen (digit_hits-V10-03-00)
- defined begin(), end(), cbegin(), cend() so now
G4VTHitsMap can be used in range-based loops
- e.g. for(auto itr : hitMap) { ... }
Nov 15, 2016, A.Dotti (digits_hits-V10-02-09,-10)
- Fix bug #1908, remove implicit addition to manager of
- Fix bug #1908, remove implicit addition to manager of
SD passed via G4MultiSD proxy
Sep 8, 2016, G.Cosmo (digits_hits-V10-02-08)
@@ -198,7 +204,7 @@ Dec 7, 2015, M.Asai (digits_hits-V10-02-00)
Sept 4, 2015, A.Dotti (digits_hits-V10-01-01)
- Removing sporious cout
Aug 14, 2015, A.Dotti (digits_hits-V10-01-00)
- Adding new G4MultiSensitiveDetector functionality
@@ -222,7 +228,7 @@ May 16, 2014, A.Dotti (digits_hits-V10-00-03)
- Coverity fixes
Apr 27, 2014, M.Asai (digits_hits-V10-00-02)
- G4PSCylinderSurfaceCurrent.cc : remove unnecessary cout.
- G4PSCylinderSurfaceCurrent.cc : remove unnecessary cout.
Addressing to Bug Report #1610.
Mar 5, 2014, G.Cosmo (digits_hits-V10-00-01)
@@ -273,7 +279,7 @@ Mar 4, 2013, A. Dotti (digits_hits-V09-06-01)
- Fixing unused variables warnings
Feb 26, 2013, A.Dotti (digits_hits-V09-06-00)
- Adding of protoype cloning mechansim for SD (needed for multi-threaded)
- Adding of protoype cloning mechansim for SD (needed for multi-threaded)
Jun 14, 2012, G.Cosmo (digits_hits-V09-05-05)
- Explicitly use inclusion of headers for system of units and physical
@@ -308,7 +314,7 @@ Jul 07, 2011, G.Cosmo (digits_hits-V09-04-06)
not meant to be directly used.
May 20, 2011, B.Morgan (digits_hits-V09-04-05)
- CMakeLists.txt : Added G4DIGI_ALLOC_EXPORT compiler definition via
- CMakeLists.txt : Added G4DIGI_ALLOC_EXPORT compiler definition via
add_definitions so all submodules pick it up.
Mar 31, 2011, G.Cosmo (digits_hits-V09-04-04)
@@ -622,7 +628,7 @@ June 6, 98 M.Asai
- New sub-directories (detector, hits, digits) are introduced.
- All codes which used to be in include and src directories are
moved to the newly created sub-directories.
- GNUmakefile is completely changed to catch up the new directory
- GNUmakefile is completely changed to catch up the new directory
structure.
April 21, 98 M.Asai
+3
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 1, 2021 B. Morgan (det-V10-07-00)
- Migrate build to modular CMake API
Sep 12, 2020 B. Morgan (det-V10-06-02)
- Apply typo fixes from Gurkan Myczko (https://github.com/Geant4/geant4/pull/15)
@@ -32,7 +32,7 @@
// This class will be created for every cell standard
// scoring should be applied. It does the actual scoring.
// GetStandardCellScoreValues() delivers the struct
// G4CellScoreValues does calculations based on the
// G4CellScoreValues does calculations based on the
// sums of scores and delivers the results in
// G4CellScoreValues.
//
@@ -47,41 +47,37 @@
class G4Step;
class G4CellScoreComposer {
public: // with description
class G4CellScoreComposer
{
public: // with description
G4CellScoreComposer();
~G4CellScoreComposer();
void EstimatorCalculation(const G4Step &step);
// get values for estimators based on
// track length
void EstimatorCalculation(const G4Step& step);
// get values for estimators based on
// track length
void TrackEnters();
// to be called if a track enters the cell
// to be called if a track enters the cell
void NewTrackPopedUp();
// to be caled if the cell popultion is increased
// to be caled if the cell popultion is increased
void SetCollisionWeight(G4double weight);
// to be called for every collision
// in the cell with the weight of the colliding particle
// to be called for every collision
// in the cell with the weight of the colliding particle
void SetImportnace(G4double importance);
// informs G4CellScoreComposer about the importance of the cell
// informs G4CellScoreComposer about the importance of the cell
const G4CellScoreValues &GetStandardCellScoreValues() const;
// return scores in G4CellScoreValues
const G4CellScoreValues& GetStandardCellScoreValues() const;
// return scores in G4CellScoreValues
private:
private:
mutable G4CellScoreValues fSCScoreValues;
};
std::ostream& operator<<(std::ostream &out,
const G4CellScoreComposer &ps);
std::ostream& operator<<(std::ostream& out, const G4CellScoreComposer& ps);
#endif
@@ -30,8 +30,8 @@
//
// Class description:
// This struct holds sums of scores for standard scoring.
//
//
//
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
@@ -41,24 +41,25 @@
#include "globals.hh"
class G4CellScoreValues {
public:
G4CellScoreValues() :
fSumSL(0),
fSumSLW(0),
fSumSLW_v(0),
fSumSLWE(0),
fSumSLWE_v(0),
fSumTracksEntering(0),
fSumPopulation(0),
fSumCollisions(0),
fSumCollisionsWeight(0),
fNumberWeightedEnergy(0),
fFluxWeightedEnergy(0),
fAverageTrackWeight(0),
fImportance(0)
class G4CellScoreValues
{
public:
G4CellScoreValues()
: fSumSL(0)
, fSumSLW(0)
, fSumSLW_v(0)
, fSumSLWE(0)
, fSumSLWE_v(0)
, fSumTracksEntering(0)
, fSumPopulation(0)
, fSumCollisions(0)
, fSumCollisionsWeight(0)
, fNumberWeightedEnergy(0)
, fFluxWeightedEnergy(0)
, fAverageTrackWeight(0)
, fImportance(0)
{}
G4double fSumSL;
G4double fSumSLW;
G4double fSumSLW_v;
@@ -26,7 +26,7 @@
//
//
#ifndef G4CollectionNameVector_H
#ifndef G4CollectionNameVector_H
#define G4CollectionNameVector_H 1
#include "globals.hh"
@@ -34,12 +34,11 @@
class G4CollectionNameVector : public std::vector<G4String>
{
public:
G4CollectionNameVector() {;}
virtual ~G4CollectionNameVector() {;}
public:
G4CollectionNameVector() { ; }
virtual ~G4CollectionNameVector() { ; }
void insert(G4String str) { push_back(str); }
void insert(G4String str) { push_back(str); }
};
#endif
@@ -39,7 +39,7 @@ class G4VSensitiveDetector;
// This class is used by G4SDManager for book keeping the
// sensitive detector modules and hits collections. The order of
// hits collections stored in G4HCofThisEvent is same as the
// order of HClist.
// order of HClist.
// The order may vary from run to run, if the user adds/changes
// some of his/her sensitive detector modules.
// In case user wants to make G4Run object persistent, this
@@ -48,34 +48,33 @@ class G4VSensitiveDetector;
class G4HCtable
{
public:
G4HCtable();
~G4HCtable();
public:
G4HCtable();
~G4HCtable();
public:
G4int Registor(G4String SDname,G4String HCname);
G4int GetCollectionID(G4String HCname) const;
G4int GetCollectionID(G4VSensitiveDetector* aSD) const;
public:
G4int Registor(G4String SDname, G4String HCname);
G4int GetCollectionID(G4String HCname) const;
G4int GetCollectionID(G4VSensitiveDetector* aSD) const;
private:
std::vector<G4String> SDlist;
std::vector<G4String> HClist;
public:
inline G4int entries() const
{ return G4int(HClist.size()); }
inline G4String GetSDname(G4int i) const
{
if(i<0||i>entries()) return "***Not Defined***";
return SDlist[i];
}
inline G4String GetHCname(G4int i) const
{
if(i<0||i>entries()) return "***Not Defined***";
return HClist[i];
}
private:
std::vector<G4String> SDlist;
std::vector<G4String> HClist;
public:
inline G4int entries() const { return G4int(HClist.size()); }
inline G4String GetSDname(G4int i) const
{
if(i < 0 || i > entries())
return "***Not Defined***";
return SDlist[i];
}
inline G4String GetHCname(G4int i) const
{
if(i < 0 || i > entries())
return "***Not Defined***";
return HClist[i];
}
};
#endif
@@ -46,39 +46,34 @@ class G4VPrimitiveScorer;
class G4MultiFunctionalDetector : public G4VSensitiveDetector
{
public: // with description
G4MultiFunctionalDetector(G4String);
public: // with description
G4MultiFunctionalDetector(G4String);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
std::vector<G4VPrimitiveScorer*> primitives;
std::vector<G4VPrimitiveScorer*> primitives;
public: // with description
G4bool RegisterPrimitive(G4VPrimitiveScorer*);
G4bool RemovePrimitive(G4VPrimitiveScorer*);
inline G4int GetNumberOfPrimitives() const
{
return G4int(primitives.size());
}
G4VPrimitiveScorer* GetPrimitive(G4int id) const { return primitives[id]; }
public: // with description
G4bool RegisterPrimitive(G4VPrimitiveScorer*);
G4bool RemovePrimitive(G4VPrimitiveScorer*);
inline G4int GetNumberOfPrimitives() const
{ return G4int(primitives.size()); }
G4VPrimitiveScorer* GetPrimitive(G4int id) const
{ return primitives[id]; }
public:
virtual ~G4MultiFunctionalDetector();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual ~G4MultiFunctionalDetector();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
};
#endif
@@ -30,56 +30,64 @@
#include "G4VSensitiveDetector.hh"
#include <vector>
//class description:
//This class allows to assign multiple sensitive detectors to a single
//logical-volume.
//SDs are added to this proxy and an instance of the proxy is assigned
//to the logical volume. Calls to SD methods are forwarded to ALL
//user-defined SD that are added.
// class description:
// This class allows to assign multiple sensitive detectors to a single
// logical-volume.
// SDs are added to this proxy and an instance of the proxy is assigned
// to the logical volume. Calls to SD methods are forwarded to ALL
// user-defined SD that are added.
class G4MultiSensitiveDetector : public G4VSensitiveDetector
{
public:
G4MultiSensitiveDetector(G4String name );
//Second optional parameter allows to append to the SDname a random string
G4MultiSensitiveDetector(const G4MultiSensitiveDetector &rhs);
//Cosntructors. The name of the instance must be unique
virtual ~G4MultiSensitiveDetector();
public:
G4MultiSensitiveDetector(G4String name);
// Second optional parameter allows to append to the SDname a random string
G4MultiSensitiveDetector(const G4MultiSensitiveDetector& rhs);
// Cosntructors. The name of the instance must be unique
virtual ~G4MultiSensitiveDetector();
G4MultiSensitiveDetector& operator=(const G4MultiSensitiveDetector& rhs);
public:
//interface from G4VSensitiveDetector starts here.
//See G4VSensitiveDetector for documentation.
//All these methods forward the call to each of the SD
//attached to this proxy.
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
protected:
//The return value is an AND of the called SDs return values.
//This method will call the "Hit(G4Step*)" method of all
//added SDs. Note that the ROhist of this method is not used
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
//The following method does not have a meaning for this concrete class
virtual G4int GetCollectionID(G4int i) final;
public:
//Note, that cloning works only if all the contained SDs are also
//clonable.
virtual G4VSensitiveDetector* Clone() const;
public:
//===== Main interface of this special SD
using sds_t = std::vector<G4VSensitiveDetector*>;
using sdsConstIter = sds_t::const_iterator;
G4VSensitiveDetector* GetSD(const int i) const { return fSensitiveDetectors[i]; }
sds_t::size_type GetSize() const { return fSensitiveDetectors.size(); }
sdsConstIter GetBegin() const { return fSensitiveDetectors.begin(); }
sdsConstIter GetEnd() const { return fSensitiveDetectors.end(); }
void ClearSDs() { fSensitiveDetectors.clear(); }
void AddSD( G4VSensitiveDetector* sd) { fSensitiveDetectors.push_back(sd); }
private:
sds_t fSensitiveDetectors;
G4MultiSensitiveDetector& operator=(const G4MultiSensitiveDetector& rhs);
public:
// interface from G4VSensitiveDetector starts here.
// See G4VSensitiveDetector for documentation.
// All these methods forward the call to each of the SD
// attached to this proxy.
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
protected:
// The return value is an AND of the called SDs return values.
// This method will call the "Hit(G4Step*)" method of all
// added SDs. Note that the ROhist of this method is not used
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
// The following method does not have a meaning for this concrete class
virtual G4int GetCollectionID(G4int i) final;
public:
// Note, that cloning works only if all the contained SDs are also
// clonable.
virtual G4VSensitiveDetector* Clone() const;
public:
//===== Main interface of this special SD
using sds_t = std::vector<G4VSensitiveDetector*>;
using sdsConstIter = sds_t::const_iterator;
G4VSensitiveDetector* GetSD(const int i) const
{
return fSensitiveDetectors[i];
}
sds_t::size_type GetSize() const { return fSensitiveDetectors.size(); }
sdsConstIter GetBegin() const { return fSensitiveDetectors.begin(); }
sdsConstIter GetEnd() const { return fSensitiveDetectors.end(); }
void ClearSDs() { fSensitiveDetectors.clear(); }
void AddSD(G4VSensitiveDetector* sd) { fSensitiveDetectors.push_back(sd); }
private:
sds_t fSensitiveDetectors;
};
#endif //G4MULTISENSITIVEDETECTOR_H
#endif // G4MULTISENSITIVEDETECTOR_H
@@ -49,74 +49,69 @@ class G4SDmessenger;
// the singleton object.
//
class G4SDManager
class G4SDManager
{
public: // with description
static G4SDManager* GetSDMpointer();
// Returns the pointer to the singleton object.
public:
static G4SDManager* GetSDMpointerIfExist();
public: // with description
static G4SDManager* GetSDMpointer();
// Returns the pointer to the singleton object.
public:
static G4SDManager* GetSDMpointerIfExist();
protected:
G4SDManager();
protected:
G4SDManager();
public:
~G4SDManager();
public:
~G4SDManager();
public: // with description
void AddNewDetector(G4VSensitiveDetector*aSD);
// Registors the user's sensitive detector. This method must be invoked
// when the user construct his/her sensitive detector.
void Activate(G4String dName, G4bool activeFlag);
// Activate/inactivate the registered sensitive detector. For the inactivated
// detectors, hits collections will not be stored to the G4HCofThisEvent object.
G4int GetCollectionID(G4String colName);
G4int GetCollectionID(G4VHitsCollection * aHC);
// These two methods return the ID number of the sensitive detector.
public: // with description
void AddNewDetector(G4VSensitiveDetector* aSD);
// Registors the user's sensitive detector. This method must be invoked
// when the user construct his/her sensitive detector.
void Activate(G4String dName, G4bool activeFlag);
// Activate/inactivate the registered sensitive detector. For the inactivated
// detectors, hits collections will not be stored to the G4HCofThisEvent
// object.
G4int GetCollectionID(G4String colName);
G4int GetCollectionID(G4VHitsCollection* aHC);
// These two methods return the ID number of the sensitive detector.
public:
G4VSensitiveDetector* FindSensitiveDetector(G4String dName, G4bool warning = true);
G4HCofThisEvent* PrepareNewEvent();
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
void AddNewCollection(G4String SDname,G4String DCname);
public:
G4VSensitiveDetector* FindSensitiveDetector(G4String dName,
G4bool warning = true);
G4HCofThisEvent* PrepareNewEvent();
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
void AddNewCollection(G4String SDname, G4String DCname);
private:
static G4ThreadLocal G4SDManager* fSDManager;
G4SDStructure* treeTop;
G4int verboseLevel;
G4HCtable* HCtable;
G4SDmessenger* theMessenger;
private:
static G4ThreadLocal G4SDManager * fSDManager;
G4SDStructure * treeTop;
G4int verboseLevel;
G4HCtable* HCtable;
G4SDmessenger* theMessenger;
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
treeTop->SetVerboseLevel(vl);
}
inline G4SDStructure* GetTreeTop() const { return treeTop; }
inline void ListTree() const { treeTop->ListTree(); }
inline G4int GetCollectionCapacity() const { return HCtable->entries(); }
inline G4HCtable* GetHCtable() const { return HCtable; }
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
treeTop->SetVerboseLevel(vl);
}
inline G4SDStructure* GetTreeTop() const
{ return treeTop; }
inline void ListTree() const
{ treeTop->ListTree(); }
inline G4int GetCollectionCapacity() const
{ return HCtable->entries(); }
inline G4HCtable* GetHCtable() const
{ return HCtable; }
private:
//Disable copy constructor and assignment operator
G4SDManager( const G4SDManager& );
G4SDManager& operator=(const G4SDManager&);
private:
// Disable copy constructor and assignment operator
G4SDManager(const G4SDManager&);
G4SDManager& operator=(const G4SDManager&);
public:
void RegisterSDFilter(G4VSDFilter* filter);
void DeRegisterSDFilter(G4VSDFilter* filter);
private:
void DestroyFilters();
std::vector<G4VSDFilter*> FilterList;
public:
void RegisterSDFilter(G4VSDFilter* filter);
void DeRegisterSDFilter(G4VSDFilter* filter);
private:
void DestroyFilters();
std::vector<G4VSDFilter*> FilterList;
};
#endif
@@ -43,48 +43,48 @@ class G4HCofThisEvent;
// structure of the user's sensitive detector names.
//
class G4SDStructure
class G4SDStructure
{
public:
G4SDStructure(const G4String &aPath);
~G4SDStructure();
public:
G4SDStructure(const G4String& aPath);
~G4SDStructure();
G4bool operator==(const G4SDStructure &right) const;
G4bool operator==(const G4SDStructure& right) const;
void AddNewDetector(G4VSensitiveDetector*aSD, const G4String &treeStructure);
void Activate(const G4String &aName, G4bool sensitiveFlag);
void Initialize(G4HCofThisEvent*HCE);
void Terminate(G4HCofThisEvent*HCE);
G4VSensitiveDetector* FindSensitiveDetector(const G4String &aName, G4bool warning = true);
G4VSensitiveDetector* GetSD(const G4String &aName);
void ListTree();
void AddNewDetector(G4VSensitiveDetector* aSD, const G4String& treeStructure);
void Activate(const G4String& aName, G4bool sensitiveFlag);
void Initialize(G4HCofThisEvent* HCE);
void Terminate(G4HCofThisEvent* HCE);
G4VSensitiveDetector* FindSensitiveDetector(const G4String& aName,
G4bool warning = true);
G4VSensitiveDetector* GetSD(const G4String& aName);
void ListTree();
private:
G4SDStructure* FindSubDirectory(const G4String &subD);
G4String ExtractDirName(const G4String &aPath);
void RemoveSD(G4VSensitiveDetector*);
private:
G4SDStructure* FindSubDirectory(const G4String& subD);
G4String ExtractDirName(const G4String& aPath);
void RemoveSD(G4VSensitiveDetector*);
private:
std::vector<G4SDStructure*> structure;
std::vector<G4VSensitiveDetector*> detector;
G4String pathName;
G4String dirName;
G4int verboseLevel;
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
for(size_t i=0; i<structure.size(); i++)
{ structure[i]->SetVerboseLevel(vl); }
for(size_t j=0; j<detector.size(); j++)
{ detector[j]->SetVerboseLevel(vl); }
};
private:
std::vector<G4SDStructure*> structure;
std::vector<G4VSensitiveDetector*> detector;
G4String pathName;
G4String dirName;
G4int verboseLevel;
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
for(size_t i = 0; i < structure.size(); i++)
{
structure[i]->SetVerboseLevel(vl);
}
for(size_t j = 0; j < detector.size(); j++)
{
detector[j]->SetVerboseLevel(vl);
}
};
};
#endif
@@ -48,24 +48,20 @@ class G4UIcmdWithAnInteger;
// /hts/verbose
//
class G4SDmessenger: public G4UImessenger
class G4SDmessenger : public G4UImessenger
{
public:
G4SDmessenger(G4SDManager * SDManager);
~G4SDmessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4SDManager * fSDMan;
G4UIdirectory* hitsDir;
G4UIcmdWithoutParameter* listCmd;
G4UIcmdWithAString* activeCmd;
G4UIcmdWithAString* inactiveCmd;
G4UIcmdWithAnInteger* verboseCmd;
public:
G4SDmessenger(G4SDManager* SDManager);
~G4SDmessenger();
void SetNewValue(G4UIcommand* command, G4String newValues);
private:
G4SDManager* fSDMan;
G4UIdirectory* hitsDir;
G4UIcmdWithoutParameter* listCmd;
G4UIcmdWithAString* activeCmd;
G4UIcmdWithAString* inactiveCmd;
G4UIcmdWithAnInteger* verboseCmd;
};
#endif
@@ -51,48 +51,39 @@
// used by the veto list for individual logical/physical volumes.
//
class G4SensitiveVolumeList
class G4SensitiveVolumeList
{
public:
// Constructors
G4SensitiveVolumeList();
G4SensitiveVolumeList(const G4SensitiveVolumeList& right);
public:
//Constructors
G4SensitiveVolumeList();
G4SensitiveVolumeList(const G4SensitiveVolumeList &right);
// Destructor
~G4SensitiveVolumeList();
//Destructor
~G4SensitiveVolumeList();
// Assignment Operation
G4SensitiveVolumeList& operator=(const G4SensitiveVolumeList& right);
//Assignment Operation
G4SensitiveVolumeList & operator=(const G4SensitiveVolumeList &right
);
// Equality Operations
G4bool operator==(const G4SensitiveVolumeList& right) const;
G4bool operator!=(const G4SensitiveVolumeList& right) const;
//Equality Operations
G4bool operator==(const G4SensitiveVolumeList &right) const;
G4bool operator!=(const G4SensitiveVolumeList &right) const;
// Other Operations
G4bool CheckPV(const G4VPhysicalVolume* pvp) const;
G4bool CheckLV(const G4LogicalVolume* lvp) const;
// Get and Set Operations for Has Relationships
const std::vector<G4VPhysicalVolume*>& GetThePhysicalVolumeList() const;
void SetThePhysicalVolumeList(const std::vector<G4VPhysicalVolume*> value);
//Other Operations
G4bool CheckPV(const G4VPhysicalVolume *pvp) const;
G4bool CheckLV(const G4LogicalVolume *lvp) const;
const std::vector<G4LogicalVolume*>& GetTheLogicalVolumeList() const;
void SetTheLogicalVolumeList(const std::vector<G4LogicalVolume*> value);
//Get and Set Operations for Has Relationships
const std::vector<G4VPhysicalVolume*>& GetThePhysicalVolumeList() const;
void SetThePhysicalVolumeList(const std::vector<G4VPhysicalVolume*> value);
const std::vector<G4LogicalVolume*>& GetTheLogicalVolumeList() const;
void SetTheLogicalVolumeList(const std::vector<G4LogicalVolume*> value);
private:
//Data Members for Has Relationships
std::vector<G4VPhysicalVolume*> thePhysicalVolumeList;
std::vector<G4LogicalVolume*> theLogicalVolumeList;
private:
// Data Members for Has Relationships
std::vector<G4VPhysicalVolume*> thePhysicalVolumeList;
std::vector<G4LogicalVolume*> theLogicalVolumeList;
};
#endif
@@ -34,17 +34,28 @@
//
// ---------------- G4SensitiveVolumeList -----------------
// Get and Set Operations for Has Relationships
//Get and Set Operations for Has Relationships
inline const std::vector<G4VPhysicalVolume*>& G4SensitiveVolumeList::get_the_G4VPhysicalVolume_list() const { return the_G4VPhysicalVolume_list; }
inline void G4SensitiveVolumeList::set_the_G4VPhysicalVolume_list(const std::vector<G4VPhysicalVolume*> value) { the_G4VPhysicalVolume_list = value; }
inline const std::vector<G4LogicalVolume*>& G4SensitiveVolumeList::get_the_G4LogicalVolume() const { return the_G4LogicalVolume_list; }
inline void G4SensitiveVolumeList::set_the_G4LogicalVolume(const std::vector<G4LogicalVolume*> value) { the_G4LogicalVolume_list = value; }
inline const std::vector<G4VPhysicalVolume*>&
G4SensitiveVolumeList::get_the_G4VPhysicalVolume_list() const
{
return the_G4VPhysicalVolume_list;
}
inline void G4SensitiveVolumeList::set_the_G4VPhysicalVolume_list(
const std::vector<G4VPhysicalVolume*> value)
{
the_G4VPhysicalVolume_list = value;
}
inline const std::vector<G4LogicalVolume*>&
G4SensitiveVolumeList::get_the_G4LogicalVolume() const
{
return the_G4LogicalVolume_list;
}
inline void G4SensitiveVolumeList::set_the_G4LogicalVolume(
const std::vector<G4LogicalVolume*> value)
{
the_G4LogicalVolume_list = value;
}
@@ -44,46 +44,43 @@
template <typename T>
class G4TScoreHistFiller : public G4VScoreHistFiller
{
public:
G4TScoreHistFiller();
virtual ~G4TScoreHistFiller();
// methods
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0);
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
virtual void FillH3(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0);
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
virtual void FillP2(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0);
public:
G4TScoreHistFiller();
virtual ~G4TScoreHistFiller();
virtual G4bool CheckH1(G4int id);
virtual G4bool CheckH2(G4int id);
virtual G4bool CheckH3(G4int id);
virtual G4bool CheckP1(G4int id);
virtual G4bool CheckP2(G4int id);
// methods
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0);
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
virtual void FillH3(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight = 1.0);
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0);
virtual void FillP2(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight = 1.0);
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const
{ return fVerboseLevel; }
virtual G4bool CheckH1(G4int id);
virtual G4bool CheckH2(G4int id);
virtual G4bool CheckH3(G4int id);
virtual G4bool CheckP1(G4int id);
virtual G4bool CheckP2(G4int id);
protected:
// methods
virtual G4VScoreHistFiller* CreateInstance() const;
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const { return fVerboseLevel; }
private:
// methods
void CreateAnalysisManager();
protected:
// methods
virtual G4VScoreHistFiller* CreateInstance() const;
// data members
T* fAnalysisManager = nullptr;
G4int fVerboseLevel = 0;
G4bool fHasAnalysisManager = false;
G4bool fIsInitialized = false;
private:
// methods
void CreateAnalysisManager();
// data members
T* fAnalysisManager = nullptr;
G4int fVerboseLevel = 0;
G4bool fHasAnalysisManager = false;
G4bool fIsInitialized = false;
};
#include "G4TScoreHistFiller.icc"
@@ -35,22 +35,27 @@
template <typename T>
G4TScoreHistFiller<T>::G4TScoreHistFiller()
{;}
{
;
}
template <typename T>
G4TScoreHistFiller<T>::~G4TScoreHistFiller()
{
if( fHasAnalysisManager )
{ delete fAnalysisManager; }
if(fHasAnalysisManager)
{
delete fAnalysisManager;
}
}
template <typename T>
void G4TScoreHistFiller<T>::CreateAnalysisManager()
{
// create analysis manager
if( ! T::IsInstance() ) fHasAnalysisManager = true;
if(!T::IsInstance())
fHasAnalysisManager = true;
fAnalysisManager = T::Instance();
fAnalysisManager->SetVerboseLevel(fVerboseLevel);
}
@@ -65,9 +70,10 @@ G4VScoreHistFiller* G4TScoreHistFiller<T>::CreateInstance() const
template <typename T>
void G4TScoreHistFiller<T>::SetVerboseLevel(G4int value)
{
fVerboseLevel = value;
if( fAnalysisManager ) {
{
fVerboseLevel = value;
if(fAnalysisManager)
{
fAnalysisManager->SetVerboseLevel(value);
}
}
@@ -75,16 +81,19 @@ void G4TScoreHistFiller<T>::SetVerboseLevel(G4int value)
template <typename T>
void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
{
if( !fAnalysisManager )
{ CreateAnalysisManager(); }
if(!fAnalysisManager)
{
CreateAnalysisManager();
}
if( ! CheckH1(id) ) {
if(!CheckH1(id))
{
G4ExceptionDescription description;
description
<< " "
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH1",
"Digits_hits_utils_001", JustWarning, description);
description << " "
<< "Cannot fill histogram id=" << id
<< ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH1", "Digits_hits_utils_001",
JustWarning, description);
return;
}
@@ -92,7 +101,8 @@ void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
fAnalysisManager->FillH1(id, value, weight);
#ifdef G4VERBOSE
if( fVerboseLevel > 1 ) {
if(fVerboseLevel > 1)
{
G4cout << "--- done G4TScoreHistFiller<T>::FillH1 : id = " << id << G4endl;
}
#endif
@@ -100,18 +110,21 @@ void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
template <typename T>
void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight)
G4double weight)
{
if( !fAnalysisManager )
{ CreateAnalysisManager(); }
if(!fAnalysisManager)
{
CreateAnalysisManager();
}
if( ! CheckH2(id) ) {
if(!CheckH2(id))
{
G4ExceptionDescription description;
description
<< " "
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH2",
"Digits_hits_utils_001", JustWarning, description);
description << " "
<< "Cannot fill histogram id=" << id
<< ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH2", "Digits_hits_utils_001",
JustWarning, description);
return;
}
@@ -119,7 +132,8 @@ void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue,
fAnalysisManager->FillH2(id, xvalue, yvalue, weight);
#ifdef G4VERBOSE
if( fVerboseLevel > 1 ) {
if(fVerboseLevel > 1)
{
G4cout << "--- done G4TScoreHistFiller<T>::FillH2 : id = " << id << G4endl;
}
#endif
@@ -127,18 +141,21 @@ void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue,
template <typename T>
void G4TScoreHistFiller<T>::FillH3(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight)
G4double zvalue, G4double weight)
{
if( !fAnalysisManager )
{ CreateAnalysisManager(); }
if(!fAnalysisManager)
{
CreateAnalysisManager();
}
if( ! CheckH3(id) ) {
if(!CheckH3(id))
{
G4ExceptionDescription description;
description
<< " "
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH3",
"Digits_hits_utils_001", JustWarning, description);
description << " "
<< "Cannot fill histogram id=" << id
<< ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillH3", "Digits_hits_utils_001",
JustWarning, description);
return;
}
@@ -146,7 +163,8 @@ void G4TScoreHistFiller<T>::FillH3(G4int id, G4double xvalue, G4double yvalue,
fAnalysisManager->FillH3(id, xvalue, yvalue, zvalue, weight);
#ifdef G4VERBOSE
if( fVerboseLevel > 1 ) {
if(fVerboseLevel > 1)
{
G4cout << "--- done G4TScoreHistFiller<T>::FillH3 : id = " << id << G4endl;
}
#endif
@@ -154,18 +172,21 @@ void G4TScoreHistFiller<T>::FillH3(G4int id, G4double xvalue, G4double yvalue,
template <typename T>
void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue,
G4double weight)
G4double weight)
{
if( !fAnalysisManager )
{ CreateAnalysisManager(); }
if(!fAnalysisManager)
{
CreateAnalysisManager();
}
if( ! CheckP1(id) ) {
if(!CheckP1(id))
{
G4ExceptionDescription description;
description
<< " "
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillP1",
"Digits_hits_utils_001", JustWarning, description);
description << " "
<< "Cannot fill histogram id=" << id
<< ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillP1", "Digits_hits_utils_001",
JustWarning, description);
return;
}
@@ -173,7 +194,8 @@ void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue,
fAnalysisManager->FillP1(id, xvalue, yvalue, weight);
#ifdef G4VERBOSE
if( fVerboseLevel > 1 ) {
if(fVerboseLevel > 1)
{
G4cout << "--- done G4TScoreHistFiller<T>::FillP1 : id = " << id << G4endl;
}
#endif
@@ -181,18 +203,21 @@ void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue,
template <typename T>
void G4TScoreHistFiller<T>::FillP2(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight)
G4double zvalue, G4double weight)
{
if( !fAnalysisManager )
{ CreateAnalysisManager(); }
if(!fAnalysisManager)
{
CreateAnalysisManager();
}
if( ! CheckP2(id) ) {
if(!CheckP2(id))
{
G4ExceptionDescription description;
description
<< " "
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillP2",
"Digits_hits_utils_001", JustWarning, description);
description << " "
<< "Cannot fill histogram id=" << id
<< ". Histogram is not defined.";
G4Exception("G4TScoreHistFiller<T>::FillP2", "Digits_hits_utils_001",
JustWarning, description);
return;
}
@@ -200,7 +225,8 @@ void G4TScoreHistFiller<T>::FillP2(G4int id, G4double xvalue, G4double yvalue,
fAnalysisManager->FillP2(id, xvalue, yvalue, zvalue, weight);
#ifdef G4VERBOSE
if( fVerboseLevel > 1 ) {
if(fVerboseLevel > 1)
{
G4cout << "--- done G4TScoreHistFiller<T>::FillP2 : id = " << id << G4endl;
}
#endif
@@ -208,21 +234,30 @@ void G4TScoreHistFiller<T>::FillP2(G4int id, G4double xvalue, G4double yvalue,
template <typename T>
G4bool G4TScoreHistFiller<T>::CheckH1(G4int id)
{ return (fAnalysisManager->GetH1(id) != nullptr); }
{
return (fAnalysisManager->GetH1(id) != nullptr);
}
template <typename T>
G4bool G4TScoreHistFiller<T>::CheckH2(G4int id)
{ return (fAnalysisManager->GetH2(id) != nullptr); }
{
return (fAnalysisManager->GetH2(id) != nullptr);
}
template <typename T>
G4bool G4TScoreHistFiller<T>::CheckH3(G4int id)
{ return (fAnalysisManager->GetH3(id) != nullptr); }
{
return (fAnalysisManager->GetH3(id) != nullptr);
}
template <typename T>
G4bool G4TScoreHistFiller<T>::CheckP1(G4int id)
{ return (fAnalysisManager->GetP1(id) != nullptr); }
{
return (fAnalysisManager->GetP1(id) != nullptr);
}
template <typename T>
G4bool G4TScoreHistFiller<T>::CheckP2(G4int id)
{ return (fAnalysisManager->GetP2(id) != nullptr); }
{
return (fAnalysisManager->GetP2(id) != nullptr);
}
@@ -28,11 +28,11 @@
// Class G4TrackLogger
//
// Class description:
//
//
// This class loggs every track via it's id. It may tell if
// a track has been logged. The loggs are cleared when ever
// a track has been logged. The loggs are cleared when ever
// the object has been informed about a new event.
//
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
//
@@ -43,25 +43,25 @@
#include "globals.hh"
#include <set>
class G4TrackLogger {
public:
class G4TrackLogger
{
public:
G4TrackLogger();
~G4TrackLogger();
void SetEventID(G4int id);
// inform the object about the event number
// if the event number changes the loggs are cleared.
// inform the object about the event number
// if the event number changes the loggs are cleared.
G4bool FirstEnterance(G4int trid);
// returns true if the track is new to this event.
// returns true if the track is new to this event.
typedef std::set<G4int > TrackIDsSet;
// log for the track ids.
typedef std::set<G4int> TrackIDsSet;
// log for the track ids.
private:
private:
G4int fPreviousEventID;
TrackIDsSet fTrackIDsSet;
};
#endif
@@ -25,7 +25,7 @@
//
//
#ifndef G4VPrimitivePlotter_H
#ifndef G4VPrimitivePlotter_H
#define G4VPrimitivePlotter_H 1
#include "G4VPrimitiveScorer.hh"
@@ -33,25 +33,22 @@
class G4VPrimitivePlotter : public G4VPrimitiveScorer
{
public: // with description
G4VPrimitivePlotter(G4String name, G4int depth=0)
:G4VPrimitiveScorer(name,depth)
{;}
virtual ~G4VPrimitivePlotter()
{;}
public: // with description
G4VPrimitivePlotter(G4String name, G4int depth = 0)
: G4VPrimitiveScorer(name, depth)
{
;
}
virtual ~G4VPrimitivePlotter() { ; }
public:
void Plot(G4int copyNo,G4int histID)
{ hitIDMap[copyNo] = histID; }
public:
void Plot(G4int copyNo, G4int histID) { hitIDMap[copyNo] = histID; }
protected:
std::map<G4int,G4int> hitIDMap;
protected:
std::map<G4int, G4int> hitIDMap;
public:
G4int GetNumberOfHist() const
{ return hitIDMap.size(); }
public:
G4int GetNumberOfHist() const { return hitIDMap.size(); }
};
#endif
@@ -41,96 +41,101 @@ class G4TouchableHistory;
// This is the base class of the sensitive detector which owns
// only one hits collection.
// A concrete class object derived from this base class can be
// used either as a sensitive detector or to be registered to
// used either as a sensitive detector or to be registered to
// G4MultiFunctionalDetector to define multiple functionalities.
//
//
//
class G4VPrimitiveScorer
{
friend class G4MultiFunctionalDetector;
public: // with description
G4VPrimitiveScorer(G4String name, G4int depth=0);
virtual ~G4VPrimitiveScorer();
public: // with description
G4VPrimitiveScorer(G4String name, G4int depth = 0);
virtual ~G4VPrimitiveScorer();
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*)=0;
// This is the method must be implemented in each concrete class.
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*) = 0;
// This is the method must be implemented in each concrete class.
virtual G4int GetIndex(G4Step*);
// This is a function mapping from copy number(s) to an index of
// the hit collection. In the default implementation, just the
// copy number of the physical volume is taken.
virtual G4int GetIndex(G4Step*);
// This is a function mapping from copy number(s) to an index of
// the hit collection. In the default implementation, just the
// copy number of the physical volume is taken.
public: // with description
G4int GetCollectionID(G4int);
// This method returns the ID of its hitsCollection. This mehod
// gives valid value only after it is registered to G4MultiFunctionalDetector
// and the G4MultiFunctionalDetector is registered to G4SDManager.
public: // with description
G4int GetCollectionID(G4int);
// This method returns the ID of its hitsCollection. This mehod
// gives valid value only after it is registered to G4MultiFunctionalDetector
// and the G4MultiFunctionalDetector is registered to G4SDManager.
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
// These five methods are exactly identical to those in G4VSensitiveDetector.
// These methods are invoked by G4SDManager through G4MultiFunctionalDetector.
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
// These five methods are exactly identical to those in G4VSensitiveDetector.
// These methods are invoked by G4SDManager through G4MultiFunctionalDetector.
void SetUnit(const G4String& unit) { unitName = unit; }
const G4String& GetUnit() const { return unitName; }
G4double GetUnitValue() const { return unitValue; }
void SetUnit(const G4String& unit) { unitName = unit; }
const G4String& GetUnit() const { return unitName; }
G4double GetUnitValue() const { return unitValue; }
protected:
void CheckAndSetUnit(const G4String& unit,const G4String& category);
protected:
void CheckAndSetUnit(const G4String& unit, const G4String& category);
protected:
G4String primitiveName;
G4MultiFunctionalDetector* detector;
G4VSDFilter* filter;
G4int verboseLevel;
G4int indexDepth;
G4String unitName;
G4double unitValue;
protected:
G4String primitiveName;
G4MultiFunctionalDetector* detector;
G4VSDFilter* filter;
G4int verboseLevel;
G4int indexDepth;
G4String unitName;
G4double unitValue;
public: // with description
// Set/Get methods
inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d)
{ detector = d; }
inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const
{ return detector; }
inline G4String GetName() const
{ return primitiveName; }
inline void SetFilter(G4VSDFilter* f)
{ filter = f; }
inline G4VSDFilter* GetFilter() const
{ return filter; }
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; }
inline G4int GetVerboseLevel() const
{ return verboseLevel; }
public: // with description
// Set/Get methods
inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d)
{
detector = d;
}
inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const
{
return detector;
}
inline G4String GetName() const { return primitiveName; }
inline void SetFilter(G4VSDFilter* f) { filter = f; }
inline G4VSDFilter* GetFilter() const { return filter; }
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
inline G4int GetVerboseLevel() const { return verboseLevel; }
private:
inline G4bool HitPrimitive(G4Step*aStep,G4TouchableHistory*ROhis)
{
if(filter)
{ if(!(filter->Accept(aStep))) return false; }
return ProcessHits(aStep,ROhis);
}
private:
inline G4bool HitPrimitive(G4Step* aStep, G4TouchableHistory* ROhis)
{
if(filter)
{
if(!(filter->Accept(aStep)))
return false;
}
return ProcessHits(aStep, ROhis);
}
protected:
G4VSolid* ComputeSolid(G4Step* aStep, G4int replicaIdx );
// Get the solid at current depth, ensuring it's correct by
// calling a parameterisation is called if it's that volume type
G4VSolid* ComputeCurrentSolid(G4Step* aStep);
// Same as above -- using stored replica number
protected:
G4int fNi, fNj, fNk; // used for 3D scorers
public:
inline void SetNijk(G4int i,G4int j,G4int k)
{ fNi = i; fNj = j; fNk = k; }
protected:
G4VSolid* ComputeSolid(G4Step* aStep, G4int replicaIdx);
// Get the solid at current depth, ensuring it's correct by
// calling a parameterisation is called if it's that volume type
G4VSolid* ComputeCurrentSolid(G4Step* aStep);
// Same as above -- using stored replica number
protected:
G4int fNi, fNj, fNk; // used for 3D scorers
public:
inline void SetNijk(G4int i, G4int j, G4int k)
{
fNi = i;
fNj = j;
fNk = k;
}
};
#endif
@@ -36,58 +36,62 @@
class G4Navigator;
class G4VReadOutGeometry
class G4VReadOutGeometry
{
protected:
virtual G4VPhysicalVolume* Build() = 0; // must return the world of the ROGeometry;
protected:
virtual G4VPhysicalVolume*
Build() = 0; // must return the world of the ROGeometry;
public:
G4VReadOutGeometry();
G4VReadOutGeometry(G4String);
virtual ~G4VReadOutGeometry();
public:
G4VReadOutGeometry();
G4VReadOutGeometry(G4String);
virtual ~G4VReadOutGeometry();
G4bool operator==(const G4VReadOutGeometry &right) const;
G4bool operator!=(const G4VReadOutGeometry &right) const;
G4bool operator==(const G4VReadOutGeometry& right) const;
G4bool operator!=(const G4VReadOutGeometry& right) const;
// buildROGeomety must be invoked to Build (ie Build() method)
// the ROGeometry. It sets up in addition the needed
// the G4Navigator used to navigate inside this ROGeometry.
void BuildROGeometry();
virtual G4bool CheckROVolume(G4Step*,G4TouchableHistory*&);
// buildROGeomety must be invoked to Build (ie Build() method)
// the ROGeometry. It sets up in addition the needed
// the G4Navigator used to navigate inside this ROGeometry.
void BuildROGeometry();
virtual G4bool CheckROVolume(G4Step*, G4TouchableHistory*&);
protected:
G4VReadOutGeometry(const G4VReadOutGeometry &right);
G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right);
protected:
G4VReadOutGeometry(const G4VReadOutGeometry& right);
G4VReadOutGeometry& operator=(const G4VReadOutGeometry& right);
virtual G4bool FindROTouchable(G4Step*);
virtual G4bool FindROTouchable(G4Step*);
protected:
G4VPhysicalVolume* ROworld;
G4SensitiveVolumeList* fincludeList;
G4SensitiveVolumeList* fexcludeList;
G4String name;
protected:
G4VPhysicalVolume* ROworld;
G4SensitiveVolumeList* fincludeList;
G4SensitiveVolumeList* fexcludeList;
G4String name;
G4Navigator* ROnavigator;
G4TouchableHistory* touchableHistory;
G4Navigator* ROnavigator;
G4TouchableHistory* touchableHistory;
public:
inline const G4SensitiveVolumeList* GetIncludeList() const
{ return fincludeList; }
inline void SetIncludeList(G4SensitiveVolumeList* value)
{ fincludeList = value; }
inline const G4SensitiveVolumeList* GetExcludeList() const
{ return fexcludeList; }
inline void SetExcludeList(G4SensitiveVolumeList* value)
{ fexcludeList = value; }
inline G4String GetName() const
{ return name; }
inline void SetName(G4String value)
{ name = value; }
// ADDED:
inline G4VPhysicalVolume* GetROWorld() const
{ return ROworld;}
public:
inline const G4SensitiveVolumeList* GetIncludeList() const
{
return fincludeList;
}
inline void SetIncludeList(G4SensitiveVolumeList* value)
{
fincludeList = value;
}
inline const G4SensitiveVolumeList* GetExcludeList() const
{
return fexcludeList;
}
inline void SetExcludeList(G4SensitiveVolumeList* value)
{
fexcludeList = value;
}
inline G4String GetName() const { return name; }
inline void SetName(G4String value) { name = value; }
// ADDED:
inline G4VPhysicalVolume* GetROWorld() const { return ROworld; }
};
#endif
@@ -35,27 +35,24 @@ class G4Step;
// class description:
//
// This is the abstract base class of a filter to be associated with a
// sensitive detector or a primitive scorer.
// sensitive detector or a primitive scorer.
class G4VSDFilter
class G4VSDFilter
{
public: // with description
G4VSDFilter(G4String name);
public: // with description
G4VSDFilter(G4String name);
public:
virtual ~G4VSDFilter();
public:
virtual ~G4VSDFilter();
public: // with description
virtual G4bool Accept(const G4Step*) const = 0;
public: // with description
virtual G4bool Accept(const G4Step*) const = 0;
protected:
G4String filterName;
protected:
G4String filterName;
public:
inline G4String GetName() const
{ return filterName; }
public:
inline G4String GetName() const { return filterName; }
};
#endif
@@ -47,38 +47,36 @@
class G4VScoreHistFiller
{
public:
virtual ~G4VScoreHistFiller();
public:
virtual ~G4VScoreHistFiller();
// static method
static G4VScoreHistFiller* Instance();
// static method
static G4VScoreHistFiller* Instance();
// methods
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0) = 0;
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0) = 0;
virtual void FillH3(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0) = 0;
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0) = 0;
virtual void FillP2(G4int id,
G4double xvalue, G4double yvalue, G4double zvalue,
G4double weight = 1.0) = 0;
// methods
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0) = 0;
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0) = 0;
virtual void FillH3(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight = 1.0) = 0;
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
G4double weight = 1.0) = 0;
virtual void FillP2(G4int id, G4double xvalue, G4double yvalue,
G4double zvalue, G4double weight = 1.0) = 0;
virtual G4bool CheckH1(G4int id) = 0;
virtual G4bool CheckH2(G4int id) = 0;
virtual G4bool CheckH3(G4int id) = 0;
virtual G4bool CheckP1(G4int id) = 0;
virtual G4bool CheckP2(G4int id) = 0;
virtual G4bool CheckH1(G4int id) = 0;
virtual G4bool CheckH2(G4int id) = 0;
virtual G4bool CheckH3(G4int id) = 0;
virtual G4bool CheckP1(G4int id) = 0;
virtual G4bool CheckP2(G4int id) = 0;
protected:
G4VScoreHistFiller();
virtual G4VScoreHistFiller* CreateInstance() const = 0;
protected:
G4VScoreHistFiller();
virtual G4VScoreHistFiller* CreateInstance() const = 0;
// static data members
static G4VScoreHistFiller* fgMasterInstance;
static G4ThreadLocal G4VScoreHistFiller* fgInstance;
// static data members
static G4VScoreHistFiller* fgMasterInstance;
static G4ThreadLocal G4VScoreHistFiller* fgInstance;
};
#endif
@@ -46,118 +46,115 @@
// are made by the sensitive detector must be set to "collectionName" string
// vector.
class G4VSensitiveDetector
class G4VSensitiveDetector
{
public: // with description
G4VSensitiveDetector(G4String name);
G4VSensitiveDetector(const G4VSensitiveDetector& right);
// Constructors. The user's concrete class must use one of these constructors
// by the constructor initializer of the derived class. The name of
// the sensitive detector must be unique.
public: // with description
G4VSensitiveDetector(G4String name);
G4VSensitiveDetector(const G4VSensitiveDetector &right);
// Constructors. The user's concrete class must use one of these constructors
// by the constructor initializer of the derived class. The name of
// the sensitive detector must be unique.
public:
virtual ~G4VSensitiveDetector();
public:
virtual ~G4VSensitiveDetector();
G4VSensitiveDetector& operator=(const G4VSensitiveDetector& right);
G4VSensitiveDetector & operator=(const G4VSensitiveDetector &right);
G4bool operator==(const G4VSensitiveDetector& right) const;
G4bool operator!=(const G4VSensitiveDetector& right) const;
G4bool operator==(const G4VSensitiveDetector &right) const;
G4bool operator!=(const G4VSensitiveDetector &right) const;
public: // with description
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
// These two methods are invoked at the begining and at the end of each
// event. The hits collection(s) created by this sensitive detector must
// be set to the G4HCofThisEvent object at one of these two methods.
virtual void clear();
// This method is invoked if the event abortion is occured. Hits collections
// created but not beibg set to G4HCofThisEvent at the event should be
// deleted. Collection(s) which have already set to G4HCofThisEvent will be
// deleted automatically.
public: // with description
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
// These two methods are invoked at the begining and at the end of each
// event. The hits collection(s) created by this sensitive detector must
// be set to the G4HCofThisEvent object at one of these two methods.
virtual void clear();
// This method is invoked if the event abortion is occured. Hits collections
// created but not beibg set to G4HCofThisEvent at the event should be deleted.
// Collection(s) which have already set to G4HCofThisEvent will be deleted
// automatically.
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
protected: // with description
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist) = 0;
// The user MUST implement this method for generating hit(s) using the
// information of G4Step object. Note that the volume and the position
// information is kept in PreStepPoint of G4Step.
// Be aware that this method is a protected method and it sill be invoked
// by Hit() method of Base class after Readout geometry associated to the
// sensitive detector is handled.
// "ROhist" will be given only is a Readout geometry is defined to this
// sensitive detector. The G4TouchableHistory object of the tracking geometry
// is stored in the PreStepPoint object of G4Step.
virtual G4int GetCollectionID(G4int i);
// This is a utility method which returns the hits collection ID of the
// "i"-th collection. "i" is the order (starting with zero) of the collection
// whose name is stored to the collectionName protected vector.
G4CollectionNameVector collectionName;
// This protected name vector must be filled at the constructor of the user's
// concrete class for registering the name(s) of hits collection(s) being
// created by this particular sensitive detector.
protected: // with description
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) = 0;
// The user MUST implement this method for generating hit(s) using the
// information of G4Step object. Note that the volume and the position
// information is kept in PreStepPoint of G4Step.
// Be aware that this method is a protected method and it sill be invoked
// by Hit() method of Base class after Readout geometry associated to the
// sensitive detector is handled.
// "ROhist" will be given only is a Readout geometry is defined to this
// sensitive detector. The G4TouchableHistory object of the tracking geometry
// is stored in the PreStepPoint object of G4Step.
virtual G4int GetCollectionID(G4int i);
// This is a utility method which returns the hits collection ID of the
// "i"-th collection. "i" is the order (starting with zero) of the collection
// whose name is stored to the collectionName protected vector.
G4CollectionNameVector collectionName;
// This protected name vector must be filled at the constructor of the user's
// concrete class for registering the name(s) of hits collection(s) being
// created by this particular sensitive detector.
protected:
G4String SensitiveDetectorName; // detector name
G4String thePathName; // directory path
G4String fullPathName; // path + detector name
G4int verboseLevel;
G4bool active;
G4VReadOutGeometry* ROgeometry;
G4VSDFilter* filter;
protected:
G4String SensitiveDetectorName; // detector name
G4String thePathName; // directory path
G4String fullPathName; // path + detector name
G4int verboseLevel;
G4bool active;
G4VReadOutGeometry * ROgeometry;
G4VSDFilter* filter;
public: // with description
inline G4bool Hit(G4Step* aStep)
{
G4TouchableHistory* ROhis = 0;
if(!isActive())
return false;
if(filter)
{
if(!(filter->Accept(aStep)))
return false;
}
if(ROgeometry)
{
if(!(ROgeometry->CheckROVolume(aStep, ROhis)))
return false;
}
return ProcessHits(aStep, ROhis);
}
// This is the public method invoked by G4SteppingManager for generating
// hit(s). The actual user's implementation for generating hit(s) must be
// implemented in GenerateHits() virtual protected method. This method
// MUST NOT be overrided.
inline void SetROgeometry(G4VReadOutGeometry* value) { ROgeometry = value; }
// Register the Readout geometry.
inline void SetFilter(G4VSDFilter* value) { filter = value; }
// Register a filter
public: // with description
inline G4bool Hit(G4Step*aStep)
{
G4TouchableHistory* ROhis = 0;
if(!isActive()) return false;
if(filter)
{ if(!(filter->Accept(aStep))) return false; }
if(ROgeometry)
{ if(!(ROgeometry->CheckROVolume(aStep,ROhis))) return false; }
return ProcessHits(aStep,ROhis);
}
// This is the public method invoked by G4SteppingManager for generating
// hit(s). The actual user's implementation for generating hit(s) must be
// implemented in GenerateHits() virtual protected method. This method
// MUST NOT be overrided.
inline void SetROgeometry(G4VReadOutGeometry*value)
{ ROgeometry = value; }
// Register the Readout geometry.
inline void SetFilter(G4VSDFilter*value)
{ filter = value; }
// Register a filter
public:
inline G4int GetNumberOfCollections() const
{
return G4int(collectionName.size());
}
inline G4String GetCollectionName(G4int id) const
{
return collectionName[id];
}
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
inline void Activate(G4bool activeFlag) { active = activeFlag; }
inline G4bool isActive() const { return active; }
inline G4String GetName() const { return SensitiveDetectorName; }
inline G4String GetPathName() const { return thePathName; }
inline G4String GetFullPathName() const { return fullPathName; }
inline G4VReadOutGeometry* GetROgeometry() const { return ROgeometry; }
inline G4VSDFilter* GetFilter() const { return filter; }
public:
inline G4int GetNumberOfCollections() const
{ return G4int(collectionName.size()); }
inline G4String GetCollectionName(G4int id) const
{ return collectionName[id]; }
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; }
inline void Activate(G4bool activeFlag)
{ active = activeFlag; }
inline G4bool isActive() const
{ return active; }
inline G4String GetName() const
{ return SensitiveDetectorName; }
inline G4String GetPathName() const
{ return thePathName; }
inline G4String GetFullPathName() const
{ return fullPathName; }
inline G4VReadOutGeometry* GetROgeometry() const
{ return ROgeometry; }
inline G4VSDFilter* GetFilter() const
{ return filter; }
public:
virtual G4VSensitiveDetector* Clone() const;
public:
virtual G4VSensitiveDetector* Clone() const;
};
#endif
+7 -29
View File
@@ -1,13 +1,8 @@
#------------------------------------------------------------------------------
# Module : G4detector
# Package: Geant4.src.G4digits_hits.G4detector
#------------------------------------------------------------------------------
# - G4detector module build definition
#
# Define the Geant4 Module.
#
geant4_define_module(NAME G4detector
HEADERS
geant4_add_module(G4detector
PUBLIC_HEADERS
G4CellScoreComposer.hh
G4CellScoreValues.hh
G4CollectionNameVector.hh
@@ -42,25 +37,8 @@ geant4_define_module(NAME G4detector
G4VSDFilter.cc
G4VScoreHistFiller.cc
G4VSensitiveDetector.cc
G4MultiSensitiveDetector.cc
GRANULAR_DEPENDENCIES
G4geombias
G4geometrymng
G4globman
G4hits
G4intercoms
G4materials
G4navigation
G4partman
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4intercoms
G4materials
G4particles
G4track
)
G4MultiSensitiveDetector.cc)
# List any source specific properties here
geant4_module_link_libraries(G4detector
PUBLIC G4track G4hits G4geometrymng G4volumes G4intercoms G4globman
PRIVATE G4navigation)
@@ -35,79 +35,77 @@
#include "G4CellScoreComposer.hh"
#include "G4Step.hh"
G4CellScoreComposer::G4CellScoreComposer():
fSCScoreValues()
G4CellScoreComposer::G4CellScoreComposer()
: fSCScoreValues()
{}
G4CellScoreComposer::~G4CellScoreComposer()
{}
G4CellScoreComposer::~G4CellScoreComposer() {}
void G4CellScoreComposer::EstimatorCalculation(const G4Step &aStep){
G4StepPoint *p = aStep.GetPreStepPoint();
if (!p) {
G4Exception("G4CellScoreComposer::EstimatorCalculation","Det0191",FatalException," no pointer to pre PreStepPoint!");
void G4CellScoreComposer::EstimatorCalculation(const G4Step& aStep)
{
G4StepPoint* p = aStep.GetPreStepPoint();
if(!p)
{
G4Exception("G4CellScoreComposer::EstimatorCalculation", "Det0191",
FatalException, " no pointer to pre PreStepPoint!");
}
G4double sl = aStep.GetStepLength();
G4double slw = sl * p->GetWeight();
G4double sl = aStep.GetStepLength();
G4double slw = sl * p->GetWeight();
G4double slwe = slw * p->GetKineticEnergy();
G4double v = p->GetVelocity();
if (!(v>0.)) {
if(!(v > 0.))
{
v = 10e-9;
}
fSCScoreValues.fSumSL += sl;
fSCScoreValues.fSumSLW += slw;
fSCScoreValues.fSumSLW_v += slw / v;
fSCScoreValues.fSumSLWE += slwe;
fSCScoreValues.fSumSLWE += slwe;
fSCScoreValues.fSumSLWE_v += slwe / v;
}
void G4CellScoreComposer::TrackEnters(){
fSCScoreValues.fSumTracksEntering++;
}
void G4CellScoreComposer::NewTrackPopedUp(){
fSCScoreValues.fSumPopulation++;
}
void G4CellScoreComposer::TrackEnters() { fSCScoreValues.fSumTracksEntering++; }
void G4CellScoreComposer::NewTrackPopedUp() { fSCScoreValues.fSumPopulation++; }
void G4CellScoreComposer::SetCollisionWeight(G4double weight){
void G4CellScoreComposer::SetCollisionWeight(G4double weight)
{
fSCScoreValues.fSumCollisions++;
fSCScoreValues.fSumCollisionsWeight+=weight;
fSCScoreValues.fSumCollisionsWeight += weight;
}
const G4CellScoreValues& G4CellScoreComposer::GetStandardCellScoreValues() const
{
if(fSCScoreValues.fSumSLW > 0.)
{
// divide by SumSLW or SumSLW_v ?
fSCScoreValues.fNumberWeightedEnergy =
fSCScoreValues.fSumSLWE_v / fSCScoreValues.fSumSLW_v;
const G4CellScoreValues &G4CellScoreComposer::
GetStandardCellScoreValues() const {
if (fSCScoreValues.fSumSLW > 0.) {
//divide by SumSLW or SumSLW_v ?
fSCScoreValues.fNumberWeightedEnergy =
fSCScoreValues.fSumSLWE_v / fSCScoreValues.fSumSLW_v;
fSCScoreValues.fFluxWeightedEnergy =
fSCScoreValues.fFluxWeightedEnergy =
fSCScoreValues.fSumSLWE / fSCScoreValues.fSumSLW;
fSCScoreValues.fAverageTrackWeight =
fSCScoreValues.fAverageTrackWeight =
fSCScoreValues.fSumSLW / fSCScoreValues.fSumSL;
}
return fSCScoreValues;
}
void G4CellScoreComposer::SetImportnace(G4double importance){
void G4CellScoreComposer::SetImportnace(G4double importance)
{
fSCScoreValues.fImportance = importance;
}
std::ostream& operator<<(std::ostream &out,
const G4CellScoreComposer &ps) {
G4CellScoreValues scores = ps.GetStandardCellScoreValues();
std::ostream& operator<<(std::ostream& out, const G4CellScoreComposer& ps)
{
G4CellScoreValues scores = ps.GetStandardCellScoreValues();
out << "Tracks entering: " << scores.fSumTracksEntering << G4endl;
out << "Population: " << scores.fSumPopulation << G4endl;
out << "Collisions: " << scores.fSumCollisions << G4endl;
out << "Collisions*Wgt: " << scores.fSumCollisionsWeight << G4endl;
out << "NumWGTedEnergy: " << scores.fNumberWeightedEnergy << G4endl;
out << "FluxWGTedEnergy: " << scores.fFluxWeightedEnergy << G4endl;
out << "Aver.TrackWGT*I: " << scores.fAverageTrackWeight*
scores.fImportance << G4endl;
out << "Aver.TrackWGT*I: " << scores.fAverageTrackWeight * scores.fImportance
<< G4endl;
return out;
}
+31 -25
View File
@@ -29,14 +29,17 @@
#include "G4HCtable.hh"
#include "G4VSensitiveDetector.hh"
G4HCtable::G4HCtable() {;}
G4HCtable::G4HCtable() { ; }
G4HCtable::~G4HCtable() {;}
G4HCtable::~G4HCtable() { ; }
G4int G4HCtable::Registor(G4String SDname,G4String HCname)
G4int G4HCtable::Registor(G4String SDname, G4String HCname)
{
for(size_t i=0;i<HClist.size();i++)
{ if(HClist[i]==HCname && SDlist[i]==SDname) return -1; }
for(size_t i = 0; i < HClist.size(); i++)
{
if(HClist[i] == HCname && SDlist[i] == SDname)
return -1;
}
HClist.push_back(HCname);
SDlist.push_back(SDname);
return HClist.size();
@@ -45,27 +48,29 @@ G4int G4HCtable::Registor(G4String SDname,G4String HCname)
G4int G4HCtable::GetCollectionID(G4String HCname) const
{
G4int i = -1;
if(HCname.index("/")==std::string::npos) // HCname only
if(HCname.index("/") == std::string::npos) // HCname only
{
for(size_t j=0;j<HClist.size();j++)
for(size_t j = 0; j < HClist.size(); j++)
{
if(HClist[j]==HCname)
{
if(i>=0) return -2;
if(HClist[j] == HCname)
{
if(i >= 0)
return -2;
i = j;
}
}
}
else
{
for(size_t j=0;j<HClist.size();j++)
for(size_t j = 0; j < HClist.size(); j++)
{
G4String tgt = SDlist[j];
tgt += "/";
tgt += HClist[j];
if(tgt==HCname)
if(tgt == HCname)
{
if(i>=0) return -2;
if(i >= 0)
return -2;
i = j;
}
}
@@ -75,27 +80,28 @@ G4int G4HCtable::GetCollectionID(G4String HCname) const
G4int G4HCtable::GetCollectionID(G4VSensitiveDetector* aSD) const
{
if(aSD->GetNumberOfCollections()<1)
if(aSD->GetNumberOfCollections() < 1)
{
G4cerr << "Sensitive detector <" << aSD->GetName()
<< "> does not have a registered hits collection."
<< G4endl;
<< "> does not have a registered hits collection." << G4endl;
return -1;
}
if(aSD->GetNumberOfCollections()>1)
if(aSD->GetNumberOfCollections() > 1)
{
G4cerr << "Sensitive detector <" << aSD->GetName()
<< "> has more than one registered hits collections."
<< G4endl;
<< "> has more than one registered hits collections." << G4endl;
G4cerr << "Candidates are : ";
for(G4int j=0;j<aSD->GetNumberOfCollections();j++)
{ G4cerr << aSD->GetCollectionName(j) << " "; }
for(G4int j = 0; j < aSD->GetNumberOfCollections(); j++)
{
G4cerr << aSD->GetCollectionName(j) << " ";
}
G4cerr << G4endl;
return -1;
}
for(size_t k=0;k<SDlist.size();k++)
{ if(SDlist[k]==aSD->GetName()) return k; }
for(size_t k = 0; k < SDlist.size(); k++)
{
if(SDlist[k] == aSD->GetName())
return k;
}
return -1;
}
@@ -28,98 +28,118 @@
// G4MultiFunctionalDetector
//
// 2010-07-23 T.Aso Call PS if the step length or energy deposit is not zero.
//
//
//
#include "G4MultiFunctionalDetector.hh"
#include "G4SDManager.hh"
#include "G4VPrimitiveScorer.hh"
G4MultiFunctionalDetector::G4MultiFunctionalDetector(G4String name)
:G4VSensitiveDetector(name)
{;}
: G4VSensitiveDetector(name)
{
;
}
G4MultiFunctionalDetector::~G4MultiFunctionalDetector()
{
for(auto pr : primitives) delete pr;
for(auto pr : primitives)
delete pr;
primitives.clear();
}
G4bool G4MultiFunctionalDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* aTH)
G4bool G4MultiFunctionalDetector::ProcessHits(G4Step* aStep,
G4TouchableHistory* aTH)
{
if(aStep->GetStepLength()>0. || aStep->GetTotalEnergyDeposit()>0.){
if(aStep->GetStepLength() > 0. || aStep->GetTotalEnergyDeposit() > 0.)
{
for(auto pr : primitives)
{ pr->HitPrimitive(aStep,aTH); }
{
pr->HitPrimitive(aStep, aTH);
}
}
return true;
}
G4bool G4MultiFunctionalDetector::RegisterPrimitive(G4VPrimitiveScorer* aPS)
{
for(auto pr : primitives)
{
if(pr==aPS)
{
G4ExceptionDescription ED;
ED << "Primitive <" << aPS->GetName() << "> is already defined in <" << SensitiveDetectorName
<< ">." << G4endl << "Method RegisterPrimitive() is ignored." << G4endl;
G4Exception("G4MultiFunctionalDetector::RegisterPrimitive","Det0101",
JustWarning,ED);
return false;
}
}
primitives.push_back(aPS);
aPS->SetMultiFunctionalDetector(this);
collectionName.insert(aPS->GetName());
if(G4SDManager::GetSDMpointer()->FindSensitiveDetector(SensitiveDetectorName,false))
{
// This G4MultiFunctionalDetector has already been registered to G4SDManager.
// Make sure this new primitive is registered as well.
G4SDManager::GetSDMpointer()->AddNewCollection(SensitiveDetectorName,aPS->GetName());
}
return true;
for(auto pr : primitives)
{
if(pr == aPS)
{
G4ExceptionDescription ED;
ED << "Primitive <" << aPS->GetName() << "> is already defined in <"
<< SensitiveDetectorName << ">." << G4endl
<< "Method RegisterPrimitive() is ignored." << G4endl;
G4Exception("G4MultiFunctionalDetector::RegisterPrimitive", "Det0101",
JustWarning, ED);
return false;
}
}
primitives.push_back(aPS);
aPS->SetMultiFunctionalDetector(this);
collectionName.insert(aPS->GetName());
if(G4SDManager::GetSDMpointer()->FindSensitiveDetector(SensitiveDetectorName,
false))
{
// This G4MultiFunctionalDetector has already been registered to
// G4SDManager. Make sure this new primitive is registered as well.
G4SDManager::GetSDMpointer()->AddNewCollection(SensitiveDetectorName,
aPS->GetName());
}
return true;
}
G4bool G4MultiFunctionalDetector::RemovePrimitive(G4VPrimitiveScorer* aPS)
{
auto pr = std::find(primitives.begin(),primitives.end(),aPS);
if(pr!=primitives.end())
{
primitives.erase(pr);
aPS->SetMultiFunctionalDetector(nullptr);
return true;
}
G4cerr << "Primitive <" << aPS->GetName() << "> is not defined in <" << SensitiveDetectorName
<< ">." << G4endl << "Method RemovePrimitive() is ignored." << G4endl;
return false;
}
auto pr = std::find(primitives.begin(), primitives.end(), aPS);
if(pr != primitives.end())
{
primitives.erase(pr);
aPS->SetMultiFunctionalDetector(nullptr);
return true;
}
G4cerr << "Primitive <" << aPS->GetName() << "> is not defined in <"
<< SensitiveDetectorName << ">." << G4endl
<< "Method RemovePrimitive() is ignored." << G4endl;
return false;
}
void G4MultiFunctionalDetector::Initialize(G4HCofThisEvent* HC)
{
for(auto pr : primitives)
{ pr->Initialize(HC); }
for(auto pr : primitives)
{
pr->Initialize(HC);
}
}
void G4MultiFunctionalDetector::EndOfEvent(G4HCofThisEvent* HC)
{
for(auto pr : primitives)
{ pr->EndOfEvent(HC); }
for(auto pr : primitives)
{
pr->EndOfEvent(HC);
}
}
void G4MultiFunctionalDetector::clear()
{
for(auto pr : primitives)
{ pr->clear(); }
for(auto pr : primitives)
{
pr->clear();
}
}
void G4MultiFunctionalDetector::DrawAll()
{
for(auto pr : primitives)
{ pr->DrawAll(); }
for(auto pr : primitives)
{
pr->DrawAll();
}
}
void G4MultiFunctionalDetector::PrintAll()
{
for(auto pr : primitives)
{ pr->PrintAll(); }
for(auto pr : primitives)
{
pr->PrintAll();
}
}
@@ -31,105 +31,114 @@
//#define MSDDEBUG
#ifdef MSDDEBUG
#define DBG( msg ) G4cout<<msg<<G4endl
# define DBG(msg) G4cout << msg << G4endl
#else
#define DBG( msg )
# define DBG(msg)
#endif
#define VDBG( vl , msg ) if ( vl<=verboseLevel ) G4cout<<msg<<G4endl
#define VDBG(vl, msg) \
if(vl <= verboseLevel) \
G4cout << msg << G4endl
G4MultiSensitiveDetector::G4MultiSensitiveDetector(G4String name)
: G4VSensitiveDetector(name)
: G4VSensitiveDetector(name)
{
#ifdef MSDDEBUG
verboseLevel = 3;
verboseLevel = 3;
#endif
VDBG(1,"Creating G4MultiSenstiveDetector with name: "<<name);
VDBG(1, "Creating G4MultiSenstiveDetector with name: " << name);
}
G4MultiSensitiveDetector::~G4MultiSensitiveDetector()
{
VDBG(2,GetName()<<" : Destructing G4MultiSensitiveDetector");
ClearSDs();
VDBG(2, GetName() << " : Destructing G4MultiSensitiveDetector");
ClearSDs();
}
G4MultiSensitiveDetector::G4MultiSensitiveDetector(const G4MultiSensitiveDetector& rhs)
: G4VSensitiveDetector(rhs) ,
fSensitiveDetectors(rhs.fSensitiveDetectors)
G4MultiSensitiveDetector::G4MultiSensitiveDetector(
const G4MultiSensitiveDetector& rhs)
: G4VSensitiveDetector(rhs)
, fSensitiveDetectors(rhs.fSensitiveDetectors)
{
VDBG(3,GetName()<<" : Copy constructor called.");
VDBG(3, GetName() << " : Copy constructor called.");
}
G4MultiSensitiveDetector&
G4MultiSensitiveDetector::operator=(const G4MultiSensitiveDetector& rhs)
G4MultiSensitiveDetector& G4MultiSensitiveDetector::operator=(
const G4MultiSensitiveDetector& rhs)
{
if ( this != &rhs ) {
//G4VSensitiveDetector::operator=(static_cast<const G4VSensitiveDetector&>(rhs));
G4VSensitiveDetector::operator=(static_cast<const G4VSensitiveDetector&>(rhs));
fSensitiveDetectors = rhs.fSensitiveDetectors;
}
return *this;
if(this != &rhs)
{
// G4VSensitiveDetector::operator=(static_cast<const
// G4VSensitiveDetector&>(rhs));
G4VSensitiveDetector::operator=(
static_cast<const G4VSensitiveDetector&>(rhs));
fSensitiveDetectors = rhs.fSensitiveDetectors;
}
return *this;
}
void
G4MultiSensitiveDetector::Initialize(G4HCofThisEvent* )
void G4MultiSensitiveDetector::Initialize(G4HCofThisEvent*)
{
//SDManager is resposnsible for calling this since the granular SDs
// SDManager is resposnsible for calling this since the granular SDs
// are also registered
//for ( auto sd : fSensitiveDetectors ) sd->Initialize(hcte);
// for ( auto sd : fSensitiveDetectors ) sd->Initialize(hcte);
}
void
G4MultiSensitiveDetector::EndOfEvent(G4HCofThisEvent* )
void G4MultiSensitiveDetector::EndOfEvent(G4HCofThisEvent*)
{
//SDManager is resposnsible for calling this since the granular SDs
// are also registered
//for ( auto sd : fSensitiveDetectors ) sd->EndOfEvent(hcte);
// SDManager is resposnsible for calling this since the granular SDs
// are also registered
// for ( auto sd : fSensitiveDetectors ) sd->EndOfEvent(hcte);
}
void
G4MultiSensitiveDetector::clear()
void G4MultiSensitiveDetector::clear()
{
for ( auto sd : fSensitiveDetectors ) sd->clear();
for(auto sd : fSensitiveDetectors)
sd->clear();
}
void
G4MultiSensitiveDetector::DrawAll()
void G4MultiSensitiveDetector::DrawAll()
{
for ( auto sd : fSensitiveDetectors ) sd->DrawAll();
for(auto sd : fSensitiveDetectors)
sd->DrawAll();
}
void
G4MultiSensitiveDetector::PrintAll()
void G4MultiSensitiveDetector::PrintAll()
{
for ( auto sd : fSensitiveDetectors ) sd->PrintAll();
for(auto sd : fSensitiveDetectors)
sd->PrintAll();
}
G4bool
G4MultiSensitiveDetector::ProcessHits(G4Step*aStep,G4TouchableHistory*)
G4bool G4MultiSensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
VDBG(2,GetName()<<" : Called processHits: "<<aStep<<" with Edep: "<<aStep->GetTotalEnergyDeposit());
G4bool result = true;
for (auto sd : fSensitiveDetectors )
result &= sd->Hit(aStep);
return result;
VDBG(2, GetName() << " : Called processHits: " << aStep
<< " with Edep: " << aStep->GetTotalEnergyDeposit());
G4bool result = true;
for(auto sd : fSensitiveDetectors)
result &= sd->Hit(aStep);
return result;
}
G4int G4MultiSensitiveDetector::GetCollectionID(G4int)
{
G4ExceptionDescription msg;
msg << GetName()<<" : This method cannot be called for an instance of type G4MultiSensitiveDetector."
<< " First retrieve a contained G4VSensitiveDetector with. i.e. GetSD and then "
<< " call this method.";
G4Exception("G4MultiSensitiveDetector::GetCollectionID","Det0011",FatalException,msg);
return -1;
G4ExceptionDescription msg;
msg << GetName()
<< " : This method cannot be called for an instance of type "
"G4MultiSensitiveDetector."
<< " First retrieve a contained G4VSensitiveDetector with. i.e. GetSD "
"and then "
<< " call this method.";
G4Exception("G4MultiSensitiveDetector::GetCollectionID", "Det0011",
FatalException, msg);
return -1;
}
//This method requires all contained SD to be clonable
// This method requires all contained SD to be clonable
G4VSensitiveDetector* G4MultiSensitiveDetector::Clone() const
{
VDBG(2,GetName()<<"Cloning an instance of G4MultiSensitiveDetector");
G4MultiSensitiveDetector* newInst = new G4MultiSensitiveDetector(this->GetName());
for ( auto sd : fSensitiveDetectors )
newInst->AddSD( sd->Clone() );
return newInst;
VDBG(2, GetName() << "Cloning an instance of G4MultiSensitiveDetector");
G4MultiSensitiveDetector* newInst =
new G4MultiSensitiveDetector(this->GetName());
for(auto sd : fSensitiveDetectors)
newInst->AddSD(sd->Clone());
return newInst;
}
+50 -39
View File
@@ -33,7 +33,6 @@
#include "G4VSensitiveDetector.hh"
#include "G4ios.hh"
G4ThreadLocal G4SDManager* G4SDManager::fSDManager = nullptr;
G4SDManager* G4SDManager::GetSDMpointer()
@@ -45,15 +44,15 @@ G4SDManager* G4SDManager::GetSDMpointer()
return fSDManager;
}
G4SDManager* G4SDManager::GetSDMpointerIfExist()
{ return fSDManager; }
G4SDManager* G4SDManager::GetSDMpointerIfExist() { return fSDManager; }
G4SDManager::G4SDManager():verboseLevel(0)
G4SDManager::G4SDManager()
: verboseLevel(0)
{
G4String topName = "/";
treeTop = new G4SDStructure(topName);
theMessenger = new G4SDmessenger(this);
HCtable = new G4HCtable;
treeTop = new G4SDStructure(topName);
theMessenger = new G4SDmessenger(this);
HCtable = new G4HCtable;
}
G4SDManager::~G4SDManager()
@@ -63,45 +62,50 @@ G4SDManager::~G4SDManager()
delete treeTop;
DestroyFilters();
theMessenger = nullptr;
HCtable = nullptr;
treeTop = nullptr;
fSDManager = nullptr;
HCtable = nullptr;
treeTop = nullptr;
fSDManager = nullptr;
}
void G4SDManager::AddNewDetector(G4VSensitiveDetector*aSD)
void G4SDManager::AddNewDetector(G4VSensitiveDetector* aSD)
{
G4int numberOfCollections = aSD->GetNumberOfCollections();
G4String pathName = aSD->GetPathName();
if( pathName(0) != '/' ) pathName.prepend("/");
if( pathName(pathName.length()-1) != '/' ) pathName += "/";
treeTop->AddNewDetector(aSD,pathName);
if(numberOfCollections<1) return;
for(G4int i=0;i<numberOfCollections;i++)
G4String pathName = aSD->GetPathName();
if(pathName(0) != '/')
pathName.prepend("/");
if(pathName(pathName.length() - 1) != '/')
pathName += "/";
treeTop->AddNewDetector(aSD, pathName);
if(numberOfCollections < 1)
return;
for(G4int i = 0; i < numberOfCollections; i++)
{
G4String SDname = aSD->GetName();
G4String DCname = aSD->GetCollectionName(i);
AddNewCollection(SDname,DCname);
AddNewCollection(SDname, DCname);
}
if( verboseLevel > 0 )
if(verboseLevel > 0)
{
G4cout << "New sensitive detector <" << aSD->GetName()
<< "> is registered at " << pathName << G4endl;
<< "> is registered at " << pathName << G4endl;
}
}
void G4SDManager::AddNewCollection(G4String SDname,G4String DCname)
void G4SDManager::AddNewCollection(G4String SDname, G4String DCname)
{
G4int i = HCtable->Registor(SDname,DCname);
if(verboseLevel>0)
G4int i = HCtable->Registor(SDname, DCname);
if(verboseLevel > 0)
{
if(i<0) {
if(verboseLevel>1) G4cout << "G4SDManager::AddNewCollection : the collection <"
<< SDname << "/" << DCname << "> has already been reginstered." << G4endl;
if(i < 0)
{
if(verboseLevel > 1)
G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname
<< "/" << DCname << "> has already been reginstered." << G4endl;
}
else
{
G4cout << "G4SDManager::AddNewCollection : the collection <"
<< SDname << "/" << DCname << "> is registered at " << i << G4endl;
G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname
<< "/" << DCname << "> is registered at " << i << G4endl;
}
}
}
@@ -121,24 +125,31 @@ void G4SDManager::TerminateCurrentEvent(G4HCofThisEvent* HCE)
void G4SDManager::Activate(G4String dName, G4bool activeFlag)
{
G4String pathName = dName;
if( pathName(0) != '/' ) pathName.prepend("/");
treeTop->Activate(pathName,activeFlag);
if(pathName(0) != '/')
pathName.prepend("/");
treeTop->Activate(pathName, activeFlag);
}
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName, G4bool warning)
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName,
G4bool warning)
{
G4String pathName = dName;
if( pathName(0) != '/' ) pathName.prepend("/");
if(pathName(0) != '/')
pathName.prepend("/");
return treeTop->FindSensitiveDetector(pathName, warning);
}
G4int G4SDManager::GetCollectionID(G4String colName)
{
G4int id = HCtable->GetCollectionID(colName);
if(id==-1)
{ G4cout << "<" << colName << "> is not found." << G4endl; }
else if(id==-2)
{ G4cout << "<" << colName << "> is ambiguous." << G4endl; }
if(id == -1)
{
G4cout << "<" << colName << "> is not found." << G4endl;
}
else if(id == -2)
{
G4cout << "<" << colName << "> is ambiguous." << G4endl;
}
return id;
}
@@ -170,12 +181,12 @@ void G4SDManager::DeRegisterSDFilter(G4VSDFilter* filter)
void G4SDManager::DestroyFilters()
{
auto f = FilterList.begin();
while( f != FilterList.end() )
while(f != FilterList.end())
{
if(verboseLevel>0) G4cout << "### deleting " << (*f)->GetName() << " " << (*f) << G4endl;
if(verboseLevel > 0)
G4cout << "### deleting " << (*f)->GetName() << " " << (*f) << G4endl;
delete *f;
f = FilterList.begin();
}
FilterList.clear();
}
+102 -71
View File
@@ -30,125 +30,142 @@
#include "G4SDStructure.hh"
#include "G4ios.hh"
G4SDStructure::G4SDStructure(const G4String &aPath):verboseLevel(0)
G4SDStructure::G4SDStructure(const G4String& aPath)
: verboseLevel(0)
{
pathName = aPath;
dirName = aPath;
G4int i = dirName.length();
if( i > 1 )
dirName = aPath;
G4int i = dirName.length();
if(i > 1)
{
dirName.remove(i-1);
dirName.remove(i - 1);
G4int isl = dirName.last('/');
dirName.remove(0,isl+1);
dirName.remove(0, isl + 1);
dirName += "/";
}
}
G4SDStructure::~G4SDStructure()
{
for(auto st : structure) delete st;
for(auto st : structure)
delete st;
structure.clear();
for(auto dt : detector) delete dt;
for(auto dt : detector)
delete dt;
detector.clear();
}
G4bool G4SDStructure::operator==(const G4SDStructure &right) const
G4bool G4SDStructure::operator==(const G4SDStructure& right) const
{
return (this==&right);
return (this == &right);
}
void G4SDStructure::AddNewDetector(G4VSensitiveDetector*aSD,
const G4String &treeStructure)
void G4SDStructure::AddNewDetector(G4VSensitiveDetector* aSD,
const G4String& treeStructure)
{
G4String remainingPath = treeStructure;
remainingPath.remove(0,pathName.length());
if( ! remainingPath.isNull() )
remainingPath.remove(0, pathName.length());
if(!remainingPath.isNull())
{ // The detector should be kept in subdirectory.
// First, check if the subdirectoy exists.
G4String subD = ExtractDirName( remainingPath );
G4String subD = ExtractDirName(remainingPath);
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == nullptr )
{ // Subdirectory not found. Create a new directory.
if(tgtSDS == nullptr)
{ // Subdirectory not found. Create a new directory.
subD.prepend(pathName);
tgtSDS = new G4SDStructure(subD);
structure.push_back( tgtSDS );
structure.push_back(tgtSDS);
}
tgtSDS->AddNewDetector(aSD,treeStructure);
tgtSDS->AddNewDetector(aSD, treeStructure);
}
else
{ // The sensitive detector should be kept in this directory.
G4VSensitiveDetector* tgtSD = GetSD( aSD->GetName() );
{ // The sensitive detector should be kept in this directory.
G4VSensitiveDetector* tgtSD = GetSD(aSD->GetName());
if(!tgtSD)
{ detector.push_back( aSD ); }
else if( tgtSD != aSD )
{
detector.push_back(aSD);
}
else if(tgtSD != aSD)
{
#ifdef G4VERBOSE
G4ExceptionDescription ed;
ed << aSD->GetName() << " had already been stored in "
<< pathName << ". Object pointer is overwritten.\n";
ed << "It's users' responsibility to delete the old sensitive detector object.";
G4Exception("G4SDStructure::AddNewDetector()","DET1010",JustWarning,ed);
ed << aSD->GetName() << " had already been stored in " << pathName
<< ". Object pointer is overwritten.\n";
ed << "It's users' responsibility to delete the old sensitive detector "
"object.";
G4Exception("G4SDStructure::AddNewDetector()", "DET1010", JustWarning,
ed);
#endif
RemoveSD( tgtSD );
detector.push_back( aSD );
RemoveSD(tgtSD);
detector.push_back(aSD);
}
}
}
G4SDStructure* G4SDStructure::FindSubDirectory(const G4String &subD)
G4SDStructure* G4SDStructure::FindSubDirectory(const G4String& subD)
{
for(auto st : structure)
{ if( subD == st->dirName ) return st; }
{
if(subD == st->dirName)
return st;
}
return nullptr;
}
G4VSensitiveDetector* G4SDStructure::GetSD(const G4String &aSDName)
G4VSensitiveDetector* G4SDStructure::GetSD(const G4String& aSDName)
{
for(auto det : detector)
{ if(aSDName == det->GetName()) return det; }
{
if(aSDName == det->GetName())
return det;
}
return nullptr;
}
void G4SDStructure::RemoveSD(G4VSensitiveDetector* sd)
{
auto det = std::find(detector.begin(), detector.end(), sd);
if(det!=detector.end()) detector.erase(det);
if(det != detector.end())
detector.erase(det);
}
G4String G4SDStructure::ExtractDirName(const G4String &aName)
G4String G4SDStructure::ExtractDirName(const G4String& aName)
{
G4String subD = aName;
G4int i = aName.first('/');
if( i != G4int(std::string::npos) ) subD.remove(i+1);
G4int i = aName.first('/');
if(i != G4int(std::string::npos))
subD.remove(i + 1);
return subD;
}
void G4SDStructure::Activate(const G4String &aName, G4bool sensitiveFlag)
void G4SDStructure::Activate(const G4String& aName, G4bool sensitiveFlag)
{
G4String aPath = aName;
aPath.remove(0,pathName.length());
if( aPath.first('/') != std::string::npos )
aPath.remove(0, pathName.length());
if(aPath.first('/') != std::string::npos)
{ // Command is ordered for a subdirectory.
G4String subD = ExtractDirName(aPath);
G4String subD = ExtractDirName(aPath);
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == nullptr )
if(tgtSDS == nullptr)
{ // The subdirectory is not found
G4cout << subD << " is not found in " << pathName << G4endl;
}
else
{
tgtSDS->Activate(aName,sensitiveFlag);
{
tgtSDS->Activate(aName, sensitiveFlag);
}
}
else if( aPath.isNull() )
else if(aPath.isNull())
{ // Command is ordered for all detectors in this directory.
for(auto det : detector) det->Activate(sensitiveFlag);
for(auto st : structure) st->Activate(G4String("/"),sensitiveFlag);
for(auto det : detector)
det->Activate(sensitiveFlag);
for(auto st : structure)
st->Activate(G4String("/"), sensitiveFlag);
}
else
{ // Command is ordered to a particular detector.
G4VSensitiveDetector* tgtSD = GetSD(aPath);
if( tgtSD == nullptr )
if(tgtSD == nullptr)
{ // The detector is not found.
G4cout << aPath << " is not found in " << pathName << G4endl;
}
@@ -159,55 +176,66 @@ void G4SDStructure::Activate(const G4String &aName, G4bool sensitiveFlag)
}
}
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(const G4String &aName, G4bool warning)
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(
const G4String& aName, G4bool warning)
{
G4String aPath = aName;
aPath.remove(0,pathName.length());
if( aPath.first('/') != std::string::npos )
{ // SD exists in sub-directory
G4String subD = ExtractDirName(aPath);
aPath.remove(0, pathName.length());
if(aPath.first('/') != std::string::npos)
{ // SD exists in sub-directory
G4String subD = ExtractDirName(aPath);
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == nullptr )
if(tgtSDS == nullptr)
{ // The subdirectory is not found
if (warning)
if(warning)
G4cout << subD << " is not found in " << pathName << G4endl;
return nullptr;
}
else
{
return tgtSDS->FindSensitiveDetector(aName,warning);
return tgtSDS->FindSensitiveDetector(aName, warning);
}
}
else
{ // SD must exist in this directory
{ // SD must exist in this directory
G4VSensitiveDetector* tgtSD = GetSD(aPath);
if( tgtSD == nullptr )
if(tgtSD == nullptr)
{ // The detector is not found.
if (warning)
if(warning)
G4cout << aPath << " is not found in " << pathName << G4endl;
}
return tgtSD;
}
}
void G4SDStructure::Initialize(G4HCofThisEvent*HCE)
void G4SDStructure::Initialize(G4HCofThisEvent* HCE)
{
// Broadcast to subdirectories.
for(auto st : structure)
{ st->Initialize(HCE); }
{
st->Initialize(HCE);
}
// Initialize all detectors in this directory.
for(auto dt : detector)
{ if(dt->isActive()) dt->Initialize(HCE); }
{
if(dt->isActive())
dt->Initialize(HCE);
}
}
void G4SDStructure::Terminate(G4HCofThisEvent*HCE)
void G4SDStructure::Terminate(G4HCofThisEvent* HCE)
{
// Broadcast to subdirectories.
for(auto st : structure)
{ st->Terminate(HCE); }
{
st->Terminate(HCE);
}
// Terminate all detectors in this directory.
for(auto dt : detector)
{ if(dt->isActive()) dt->EndOfEvent(HCE); }
{
if(dt->isActive())
dt->EndOfEvent(HCE);
}
}
void G4SDStructure::ListTree()
@@ -216,13 +244,16 @@ void G4SDStructure::ListTree()
for(auto sd : detector)
{
G4cout << pathName << sd->GetName();
if( sd->isActive() )
{ G4cout << " *** Active "; }
if(sd->isActive())
{
G4cout << " *** Active ";
}
else
{ G4cout << " XXX Inactive "; }
{
G4cout << " XXX Inactive ";
}
G4cout << G4endl;
}
for(auto st : structure) st->ListTree();
for(auto st : structure)
st->ListTree();
}
@@ -34,27 +34,28 @@
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
G4SDmessenger::G4SDmessenger(G4SDManager* SDManager):fSDMan(SDManager)
G4SDmessenger::G4SDmessenger(G4SDManager* SDManager)
: fSDMan(SDManager)
{
hitsDir = new G4UIdirectory("/hits/");
hitsDir->SetGuidance("Sensitive detectors and Hits");
listCmd = new G4UIcmdWithoutParameter("/hits/list",this);
listCmd = new G4UIcmdWithoutParameter("/hits/list", this);
listCmd->SetGuidance("List sensitive detector tree.");
activeCmd = new G4UIcmdWithAString("/hits/activate",this);
activeCmd = new G4UIcmdWithAString("/hits/activate", this);
activeCmd->SetGuidance("Activate sensitive detector(s).");
activeCmd->SetParameterName("detector",true);
activeCmd->SetParameterName("detector", true);
activeCmd->SetDefaultValue("/");
inactiveCmd = new G4UIcmdWithAString("/hits/inactivate",this);
inactiveCmd = new G4UIcmdWithAString("/hits/inactivate", this);
inactiveCmd->SetGuidance("Inactivate sensitive detector(s).");
inactiveCmd->SetParameterName("detector",true);
inactiveCmd->SetParameterName("detector", true);
inactiveCmd->SetDefaultValue("/");
verboseCmd = new G4UIcmdWithAnInteger("/hits/verbose",this);
verboseCmd = new G4UIcmdWithAnInteger("/hits/verbose", this);
verboseCmd->SetGuidance("Set the Verbose level.");
verboseCmd->SetParameterName("level",false);
verboseCmd->SetParameterName("level", false);
}
G4SDmessenger::~G4SDmessenger()
@@ -66,17 +67,23 @@ G4SDmessenger::~G4SDmessenger()
delete hitsDir;
}
void G4SDmessenger::SetNewValue(G4UIcommand * command,G4String newVal)
void G4SDmessenger::SetNewValue(G4UIcommand* command, G4String newVal)
{
if( command==listCmd )
{ fSDMan->ListTree(); }
if( command==activeCmd )
{ fSDMan->Activate(newVal,1); }
if( command==inactiveCmd )
{ fSDMan->Activate(newVal,0); }
if( command==verboseCmd )
{ fSDMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal)); }
if(command == listCmd)
{
fSDMan->ListTree();
}
if(command == activeCmd)
{
fSDMan->Activate(newVal, 1);
}
if(command == inactiveCmd)
{
fSDMan->Activate(newVal, 0);
}
if(command == verboseCmd)
{
fSDMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
}
return;
}
@@ -35,60 +35,57 @@
#include "G4SensitiveVolumeList.hh"
//Constructors
G4SensitiveVolumeList::G4SensitiveVolumeList()
{
}
// Constructors
G4SensitiveVolumeList::G4SensitiveVolumeList() {}
G4SensitiveVolumeList::G4SensitiveVolumeList(const G4SensitiveVolumeList &right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
}
G4SensitiveVolumeList::G4SensitiveVolumeList(const G4SensitiveVolumeList& right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
}
// Destructor
G4SensitiveVolumeList::~G4SensitiveVolumeList() {}
//Destructor
G4SensitiveVolumeList::~G4SensitiveVolumeList()
{
}
// Assignment Operation
G4SensitiveVolumeList& G4SensitiveVolumeList::operator=(
const G4SensitiveVolumeList& right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
return *this;
}
// Equality Operations
G4bool G4SensitiveVolumeList::operator==(
const G4SensitiveVolumeList& right) const
{
return (this == (G4SensitiveVolumeList*) &right);
}
//Assignment Operation
G4SensitiveVolumeList & G4SensitiveVolumeList::operator=(const G4SensitiveVolumeList &right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
return *this;
}
//Equality Operations
G4bool G4SensitiveVolumeList::operator==(const G4SensitiveVolumeList &right) const
{
return (this == (G4SensitiveVolumeList *) &right);
}
G4bool G4SensitiveVolumeList::operator!=(const G4SensitiveVolumeList &right) const
{
return (this != (G4SensitiveVolumeList *) &right);
}
//Other Operations
G4bool G4SensitiveVolumeList::CheckPV(const G4VPhysicalVolume * pvp) const
{
for(auto pv : thePhysicalVolumeList)
{ if(pv==pvp) return true; }
return false;
}
G4bool G4SensitiveVolumeList::CheckLV(const G4LogicalVolume * lvp) const
{
for(auto lv : theLogicalVolumeList)
{ if(lv==lvp) return true; }
return false;
}
G4bool G4SensitiveVolumeList::operator!=(
const G4SensitiveVolumeList& right) const
{
return (this != (G4SensitiveVolumeList*) &right);
}
// Other Operations
G4bool G4SensitiveVolumeList::CheckPV(const G4VPhysicalVolume* pvp) const
{
for(auto pv : thePhysicalVolumeList)
{
if(pv == pvp)
return true;
}
return false;
}
G4bool G4SensitiveVolumeList::CheckLV(const G4LogicalVolume* lvp) const
{
for(auto lv : theLogicalVolumeList)
{
if(lv == lvp)
return true;
}
return false;
}
@@ -34,33 +34,37 @@
#include "G4TrackLogger.hh"
G4TrackLogger::G4TrackLogger() :
fPreviousEventID(-1)
G4TrackLogger::G4TrackLogger()
: fPreviousEventID(-1)
{}
G4TrackLogger::~G4TrackLogger(){}
G4TrackLogger::~G4TrackLogger() {}
void G4TrackLogger::SetEventID(G4int id){
if (id != fPreviousEventID) {
void G4TrackLogger::SetEventID(G4int id)
{
if(id != fPreviousEventID)
{
fTrackIDsSet.clear();
fPreviousEventID =id;
fPreviousEventID = id;
}
}
G4bool G4TrackLogger::FirstEnterance(G4int trid){
G4bool G4TrackLogger::FirstEnterance(G4int trid)
{
G4bool first = true;
G4int n = fTrackIDsSet.count(trid);
if (n==1) {
first=false;
G4int n = fTrackIDsSet.count(trid);
if(n == 1)
{
first = false;
}
else if(n==0) {
else if(n == 0)
{
fTrackIDsSet.insert(trid);
}
else if (n>1) {
G4cout << "Error G4TrackLogger::FirstEnterance: "
<< "more than one elm in set!" << G4endl;
else if(n > 1)
{
G4cout << "Error G4TrackLogger::FirstEnterance: "
<< "more than one elm in set!" << G4endl;
}
return first;
}
@@ -36,91 +36,102 @@
#include "G4VPVParameterisation.hh"
G4VPrimitiveScorer::G4VPrimitiveScorer(G4String name, G4int depth)
:primitiveName(name),detector(nullptr),filter(nullptr),verboseLevel(0),indexDepth(depth),
unitName("NoUnit"),unitValue(1.0),fNi(0),fNj(0),fNk(0)
{;}
: primitiveName(name)
, detector(nullptr)
, filter(nullptr)
, verboseLevel(0)
, indexDepth(depth)
, unitName("NoUnit")
, unitValue(1.0)
, fNi(0)
, fNj(0)
, fNk(0)
{
;
}
G4VPrimitiveScorer::~G4VPrimitiveScorer()
{;}
G4VPrimitiveScorer::~G4VPrimitiveScorer() { ; }
G4int G4VPrimitiveScorer::GetCollectionID(G4int)
{
if(detector)
return G4SDManager::GetSDMpointer()
->GetCollectionID(detector->GetName()+"/"+primitiveName);
return G4SDManager::GetSDMpointer()->GetCollectionID(detector->GetName() +
"/" + primitiveName);
else
return -1;
return -1;
}
void G4VPrimitiveScorer::Initialize(G4HCofThisEvent*)
{;}
void G4VPrimitiveScorer::Initialize(G4HCofThisEvent*) { ; }
void G4VPrimitiveScorer::EndOfEvent(G4HCofThisEvent*)
{;}
void G4VPrimitiveScorer::EndOfEvent(G4HCofThisEvent*) { ; }
void G4VPrimitiveScorer::clear()
{;}
void G4VPrimitiveScorer::clear() { ; }
void G4VPrimitiveScorer::DrawAll()
{;}
void G4VPrimitiveScorer::DrawAll() { ; }
void G4VPrimitiveScorer::PrintAll()
{;}
void G4VPrimitiveScorer::PrintAll() { ; }
G4int G4VPrimitiveScorer::GetIndex(G4Step* aStep)
{
G4StepPoint* preStep = aStep->GetPreStepPoint();
G4TouchableHistory* th = (G4TouchableHistory*)(preStep->GetTouchable());
G4StepPoint* preStep = aStep->GetPreStepPoint();
G4TouchableHistory* th = (G4TouchableHistory*) (preStep->GetTouchable());
return th->GetReplicaNumber(indexDepth);
}
void G4VPrimitiveScorer::CheckAndSetUnit(const G4String& unit,
const G4String& category){
if ( G4UnitDefinition::GetCategory(unit) == category){
unitName = unit;
unitValue = G4UnitDefinition::GetValueOf(unit);
} else {
G4String msg = "Invalid unit ["+unit+"] (Current unit is [" +GetUnit()+"] ) requested for " + GetName();
G4Exception("G4VPrimitiveScorer::CheckAndSetUnit","Det0151",JustWarning,msg);
}
const G4String& category)
{
if(G4UnitDefinition::GetCategory(unit) == category)
{
unitName = unit;
unitValue = G4UnitDefinition::GetValueOf(unit);
}
else
{
G4String msg = "Invalid unit [" + unit + "] (Current unit is [" +
GetUnit() + "] ) requested for " + GetName();
G4Exception("G4VPrimitiveScorer::CheckAndSetUnit", "Det0151", JustWarning,
msg);
}
}
G4VSolid* G4VPrimitiveScorer::ComputeSolid(G4Step* aStep, G4int replicaIdx )
G4VSolid* G4VPrimitiveScorer::ComputeSolid(G4Step* aStep, G4int replicaIdx)
{
G4VSolid* solid = nullptr;
G4StepPoint* preStep= aStep->GetPreStepPoint();
auto physVol = preStep->GetPhysicalVolume();
G4VSolid* solid = nullptr;
G4StepPoint* preStep = aStep->GetPreStepPoint();
auto physVol = preStep->GetPhysicalVolume();
G4VPVParameterisation* physParam = physVol->GetParameterisation();
if(physParam)
{ // for parameterized volume
if(replicaIdx<0)
{ // for parameterized volume
if(replicaIdx < 0)
{
G4ExceptionDescription desc;
desc << "Incorrect replica number --- GetReplicaNumber : " << replicaIdx << G4endl;
G4Exception("G4VPrimitiveScorer::ComputeSolid","DetPS0001",JustWarning,desc);
desc << "Incorrect replica number --- GetReplicaNumber : " << replicaIdx
<< G4endl;
G4Exception("G4VPrimitiveScorer::ComputeSolid", "DetPS0001", JustWarning,
desc);
// replicaIdx= 0; // You must ensure that it's in range !!!
}
solid = physParam->ComputeSolid(replicaIdx, physVol);
solid->ComputeDimensions(physParam,replicaIdx,physVol);
solid->ComputeDimensions(physParam, replicaIdx, physVol);
}
else
{ // for ordinary volume
{ // for ordinary volume
solid = physVol->GetLogicalVolume()->GetSolid();
}
return solid;
}
G4VSolid* G4VPrimitiveScorer::ComputeCurrentSolid(G4Step* aStep )
G4VSolid* G4VPrimitiveScorer::ComputeCurrentSolid(G4Step* aStep)
{
G4StepPoint* preStep= aStep->GetPreStepPoint();
G4StepPoint* preStep = aStep->GetPreStepPoint();
// The only difference: did not know the replica number
G4int replicaIdx = (static_cast<const G4TouchableHistory*>(preStep->GetTouchable()))
->GetReplicaNumber(indexDepth);
G4int replicaIdx =
(static_cast<const G4TouchableHistory*>(preStep->GetTouchable()))
->GetReplicaNumber(indexDepth);
return ComputeSolid(aStep, replicaIdx);
}
@@ -29,76 +29,103 @@
#include "G4VReadOutGeometry.hh"
#include "G4Navigator.hh"
G4VReadOutGeometry::G4VReadOutGeometry()
:ROworld(nullptr),fincludeList(nullptr),
fexcludeList(nullptr),touchableHistory(nullptr)
: ROworld(nullptr)
, fincludeList(nullptr)
, fexcludeList(nullptr)
, touchableHistory(nullptr)
{
name = "unknown";
name = "unknown";
ROnavigator = new G4Navigator();
G4ExceptionDescription ed;
ed<<"The concept and the functionality of Readout Geometry has been merged\n"
<<"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
<<"not breaking the commonly-used interface in the sensitive detector class.\n"
<<"But this functionality of G4VReadOutGeometry class is no longer tested\n"
<<"and thus may not be working well. We strongly recommend our customers to\n"
<<"migrate to Parallel World scheme.";
G4Exception("G4VReadOutGeometry","DIGIHIT1001",JustWarning,ed);
ed
<< "The concept and the functionality of Readout Geometry has been merged\n"
<< "into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
<< "not breaking the commonly-used interface in the sensitive detector "
"class.\n"
<< "But this functionality of G4VReadOutGeometry class is no longer "
"tested\n"
<< "and thus may not be working well. We strongly recommend our customers "
"to\n"
<< "migrate to Parallel World scheme.";
G4Exception("G4VReadOutGeometry", "DIGIHIT1001", JustWarning, ed);
}
G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry &right)
G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry& right)
{
fincludeList = nullptr;
fexcludeList = nullptr;
name = right.name;
ROworld = right.ROworld;
fincludeList = nullptr;
fexcludeList = nullptr;
name = right.name;
ROworld = right.ROworld;
touchableHistory = nullptr;
ROnavigator = new G4Navigator();
ROnavigator = new G4Navigator();
// COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
// VALUE, same for navigator and same for the World+Geom hierachy
}
G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
:ROworld(nullptr),fincludeList(nullptr),
fexcludeList(nullptr),name(n),touchableHistory(nullptr)
G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
: ROworld(nullptr)
, fincludeList(nullptr)
, fexcludeList(nullptr)
, name(n)
, touchableHistory(nullptr)
{
ROnavigator = new G4Navigator();
G4ExceptionDescription ed;
ed<<"The concept and the functionality of Readout Geometry has been merged\n"
<<"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
<<"not breaking the commonly-used interface in the sensitive detector class.\n"
<<"But this functionality of G4VReadOutGeometry class is no longer tested\n"
<<"and thus may not be working well. We strongly recommend our customers to\n"
<<"migrate to Parallel World scheme.";
G4Exception("G4VReadOutGeometry","DIGIHIT1001",JustWarning,ed);
ed
<< "The concept and the functionality of Readout Geometry has been merged\n"
<< "into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
<< "not breaking the commonly-used interface in the sensitive detector "
"class.\n"
<< "But this functionality of G4VReadOutGeometry class is no longer "
"tested\n"
<< "and thus may not be working well. We strongly recommend our customers "
"to\n"
<< "migrate to Parallel World scheme.";
G4Exception("G4VReadOutGeometry", "DIGIHIT1001", JustWarning, ed);
}
G4VReadOutGeometry::~G4VReadOutGeometry()
{
//if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
if(fincludeList) delete fincludeList;
if(fexcludeList) delete fexcludeList;
if(touchableHistory) delete touchableHistory;
if(ROnavigator) delete ROnavigator;
{
// if(ROworld) delete ROworld; //should we do ? will it delete the goem tree
// also ?
if(fincludeList)
delete fincludeList;
if(fexcludeList)
delete fexcludeList;
if(touchableHistory)
delete touchableHistory;
if(ROnavigator)
delete ROnavigator;
}
G4VReadOutGeometry & G4VReadOutGeometry::operator=(const G4VReadOutGeometry &right)
G4VReadOutGeometry& G4VReadOutGeometry::operator=(
const G4VReadOutGeometry& right)
{
if ( this == &right ) return *this;
delete fincludeList; fincludeList = nullptr;
delete fexcludeList; fexcludeList = nullptr;
name = right.name;
ROworld = right.ROworld;
delete touchableHistory; touchableHistory = nullptr;
delete ROnavigator; ROnavigator = new G4Navigator();
if(this == &right)
return *this;
delete fincludeList;
fincludeList = nullptr;
delete fexcludeList;
fexcludeList = nullptr;
name = right.name;
ROworld = right.ROworld;
delete touchableHistory;
touchableHistory = nullptr;
delete ROnavigator;
ROnavigator = new G4Navigator();
return *this;
}
G4bool G4VReadOutGeometry::operator==(const G4VReadOutGeometry &right) const
{ return (this == (G4VReadOutGeometry *) &right); }
G4bool G4VReadOutGeometry::operator==(const G4VReadOutGeometry& right) const
{
return (this == (G4VReadOutGeometry*) &right);
}
G4bool G4VReadOutGeometry::operator!=(const G4VReadOutGeometry &right) const
{ return (this != (G4VReadOutGeometry *) &right); }
G4bool G4VReadOutGeometry::operator!=(const G4VReadOutGeometry& right) const
{
return (this != (G4VReadOutGeometry*) &right);
}
void G4VReadOutGeometry::BuildROGeometry()
{
@@ -106,29 +133,43 @@ void G4VReadOutGeometry::BuildROGeometry()
ROnavigator->SetWorldVolume(ROworld);
}
G4bool G4VReadOutGeometry::CheckROVolume(G4Step*currentStep,G4TouchableHistory*& ROhist)
G4bool G4VReadOutGeometry::CheckROVolume(G4Step* currentStep,
G4TouchableHistory*& ROhist)
{
ROhist = nullptr;
ROhist = nullptr;
G4bool incFlg = true;
auto PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
{ incFlg = false; }
else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
{ incFlg = true; }
else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
{ incFlg = false; }
else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
{ incFlg = true; }
if(!incFlg) return false;
auto PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
if((fexcludeList) && (fexcludeList->CheckPV(PV)))
{
incFlg = false;
}
else if((fincludeList) && (fincludeList->CheckPV(PV)))
{
incFlg = true;
}
else if((fexcludeList) && (fexcludeList->CheckLV(PV->GetLogicalVolume())))
{
incFlg = false;
}
else if((fincludeList) && (fincludeList->CheckLV(PV->GetLogicalVolume())))
{
incFlg = true;
}
if(!incFlg)
return false;
if(ROworld)
{ incFlg = FindROTouchable(currentStep); }
{
incFlg = FindROTouchable(currentStep);
}
if(incFlg)
{ ROhist = touchableHistory; }
{
ROhist = touchableHistory;
}
return incFlg;
}
G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
G4bool G4VReadOutGeometry::FindROTouchable(G4Step* currentStep)
{
// Update G4TouchableHistory object (touchableHistory)
// using the parallel readout world (ROworld)
@@ -137,39 +178,35 @@ G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
// At first invokation, creates the touchable history. Note
// that default value (false) of Locate method is used.
// ---------> But the default Value is TRUE <-------------------- J.A.
// ---------> But the default Value is TRUE <-------------------- J.A.
if(!touchableHistory)
{
touchableHistory = new G4TouchableHistory();
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
currentStep->GetPreStepPoint()->GetMomentumDirection(),
touchableHistory);
}
{
touchableHistory = new G4TouchableHistory();
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
currentStep->GetPreStepPoint()->GetMomentumDirection(), touchableHistory);
}
else
{
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
currentStep->GetPreStepPoint()->GetMomentumDirection(),
touchableHistory,
true);
}
{
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
currentStep->GetPreStepPoint()->GetMomentumDirection(), touchableHistory,
true);
}
// Can the above be improved by the use of an isotropic safety
// in order to avoid LocateGlobalPointAndUpdateTouchable
// at each Step ?
// Should require that an RO geometry is notified at the
// starting of a track to avoid possible confusion looking
// at the safety value only.
// checks if volume is sensitive:
auto currentVolume = touchableHistory->GetVolume();
// checks first if a physical volume exists here:
if ( currentVolume )
{
return currentVolume->GetLogicalVolume()->
GetSensitiveDetector() != 0;
}
if(currentVolume)
{
return currentVolume->GetLogicalVolume()->GetSensitiveDetector() != 0;
}
// no sensitive volume found: returns false
return false;
}
@@ -30,7 +30,7 @@
#include "G4SDManager.hh"
G4VSDFilter::G4VSDFilter(G4String name)
:filterName(name)
: filterName(name)
{
G4SDManager::GetSDMpointer()->RegisterSDFilter(this);
}
@@ -39,4 +39,3 @@ G4VSDFilter::~G4VSDFilter()
{
G4SDManager::GetSDMpointer()->DeRegisterSDFilter(this);
}
@@ -37,54 +37,53 @@
#include "G4VScoreHistFiller.hh"
G4VScoreHistFiller* G4VScoreHistFiller::fgMasterInstance = nullptr;
G4ThreadLocal G4VScoreHistFiller* G4VScoreHistFiller::fgInstance = nullptr;
G4VScoreHistFiller* G4VScoreHistFiller::fgMasterInstance = nullptr;
G4ThreadLocal G4VScoreHistFiller* G4VScoreHistFiller::fgInstance = nullptr;
G4VScoreHistFiller* G4VScoreHistFiller::Instance()
{
// This function invokes creating the objects on workes,
// The master instance should be created by the user
// via the concrete class constructor
// This function invokes creating the objects on workes,
// The master instance should be created by the user
// via the concrete class constructor
G4bool isMaster = ! G4Threading::IsWorkerThread();
G4bool isMaster = !G4Threading::IsWorkerThread();
if ( ( ! isMaster ) && ( ! fgInstance ) ) {
if ( fgMasterInstance ) {
if((!isMaster) && (!fgInstance))
{
if(fgMasterInstance)
{
fgInstance = fgMasterInstance->CreateInstance();
}
}
return fgInstance;
}
}
G4VScoreHistFiller::G4VScoreHistFiller()
{
G4bool isMaster = ! G4Threading::IsWorkerThread();
G4bool isMaster = !G4Threading::IsWorkerThread();
if ( isMaster && fgMasterInstance ) {
if(isMaster && fgMasterInstance)
{
G4ExceptionDescription description;
description
<< " "
<< "G4VScoreHistFiller on master already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()",
"Analysis_F001", FatalException, description);
description << " "
<< "G4VScoreHistFiller on master already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()", "Analysis_F001",
FatalException, description);
}
if ( fgInstance ) {
if(fgInstance)
{
G4ExceptionDescription description;
description
<< " "
<< "G4VScoreHistFiller on worker already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()",
"Analysis_F001", FatalException, description);
description << " "
<< "G4VScoreHistFiller on worker already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()", "Analysis_F001",
FatalException, description);
}
if ( isMaster ) fgMasterInstance = this;
if(isMaster)
fgMasterInstance = this;
fgInstance = this;
}
G4VScoreHistFiller::~G4VScoreHistFiller()
{
fgInstance = 0;
}
G4VScoreHistFiller::~G4VScoreHistFiller() { fgInstance = 0; }
@@ -30,99 +30,92 @@
#include "G4SDManager.hh"
G4VSensitiveDetector::G4VSensitiveDetector(G4String name)
:verboseLevel(0),active(true),
ROgeometry(nullptr),filter(nullptr)
: verboseLevel(0)
, active(true)
, ROgeometry(nullptr)
, filter(nullptr)
{
size_t sLast = name.last('/');
if(sLast==std::string::npos)
{ // detector name only
if(sLast == std::string::npos)
{ // detector name only
SensitiveDetectorName = name;
thePathName = "/";
thePathName = "/";
}
else
{ // name conatin the directory path
{ // name conatin the directory path
SensitiveDetectorName = name;
SensitiveDetectorName.remove(0,sLast+1);
SensitiveDetectorName.remove(0, sLast + 1);
thePathName = name;
thePathName.remove(sLast+1,name.length()-sLast);
if(thePathName(0)!='/') thePathName.prepend("/");
thePathName.remove(sLast + 1, name.length() - sLast);
if(thePathName(0) != '/')
thePathName.prepend("/");
}
fullPathName = thePathName + SensitiveDetectorName;
}
G4VSensitiveDetector::G4VSensitiveDetector(const G4VSensitiveDetector &right)
G4VSensitiveDetector::G4VSensitiveDetector(const G4VSensitiveDetector& right)
{
SensitiveDetectorName = right.SensitiveDetectorName;
thePathName = right.thePathName;
fullPathName = right.fullPathName;
verboseLevel = right.verboseLevel;
active = right.active;
ROgeometry = right.ROgeometry;
filter = right.filter;
thePathName = right.thePathName;
fullPathName = right.fullPathName;
verboseLevel = right.verboseLevel;
active = right.active;
ROgeometry = right.ROgeometry;
filter = right.filter;
}
G4VSensitiveDetector::~G4VSensitiveDetector()
{
}
G4VSensitiveDetector::~G4VSensitiveDetector() {}
G4VSensitiveDetector* G4VSensitiveDetector::Clone() const
{
G4ExceptionDescription msg;
msg << "Derived class does not implement cloning,\n"
<< "but Clone method called.\n"
<< "Cannot continue;";
G4Exception("G4VSensitiveDetector::Clone","Det0010",FatalException,msg);
return nullptr;
G4ExceptionDescription msg;
msg << "Derived class does not implement cloning,\n"
<< "but Clone method called.\n"
<< "Cannot continue;";
G4Exception("G4VSensitiveDetector::Clone", "Det0010", FatalException, msg);
return nullptr;
}
G4VSensitiveDetector & G4VSensitiveDetector::operator=(const G4VSensitiveDetector &right)
G4VSensitiveDetector& G4VSensitiveDetector::operator=(
const G4VSensitiveDetector& right)
{
if (this == &right ) return *this;
if(this == &right)
return *this;
SensitiveDetectorName = right.SensitiveDetectorName;
thePathName = right.thePathName;
fullPathName = right.fullPathName;
verboseLevel = right.verboseLevel;
active = right.active;
ROgeometry = right.ROgeometry;
filter = right.filter;
thePathName = right.thePathName;
fullPathName = right.fullPathName;
verboseLevel = right.verboseLevel;
active = right.active;
ROgeometry = right.ROgeometry;
filter = right.filter;
return *this;
}
G4bool G4VSensitiveDetector::operator==(const G4VSensitiveDetector &right) const
G4bool G4VSensitiveDetector::operator==(const G4VSensitiveDetector& right) const
{
return (this==&right);
return (this == &right);
}
G4bool G4VSensitiveDetector::operator!=(const G4VSensitiveDetector &right) const
G4bool G4VSensitiveDetector::operator!=(const G4VSensitiveDetector& right) const
{
return (this!=&right);
return (this != &right);
}
G4int G4VSensitiveDetector::GetCollectionID(G4int i)
{
return G4SDManager::GetSDMpointer()->GetCollectionID(SensitiveDetectorName+"/"+collectionName[i]);
return G4SDManager::GetSDMpointer()->GetCollectionID(SensitiveDetectorName +
"/" + collectionName[i]);
}
//----- following methoods are abstract methods to be
//----- implemented in the concrete classes
void G4VSensitiveDetector::Initialize(G4HCofThisEvent*)
{
}
void G4VSensitiveDetector::Initialize(G4HCofThisEvent*) {}
void G4VSensitiveDetector::EndOfEvent(G4HCofThisEvent*)
{
}
void G4VSensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
void G4VSensitiveDetector::clear()
{
}
void G4VSensitiveDetector::clear() {}
void G4VSensitiveDetector::DrawAll()
{
}
void G4VSensitiveDetector::PrintAll()
{
}
void G4VSensitiveDetector::DrawAll() {}
void G4VSensitiveDetector::PrintAll() {}
@@ -46,70 +46,68 @@
// GetDC() and GetNumberOfCollections() for accessing to the stored digi
// collection(s).
class G4DCofThisEvent
class G4DCofThisEvent
{
public:
G4DCofThisEvent();
G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anDCoTE);
public:
G4DCofThisEvent();
G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
inline void* operator new(size_t);
inline void operator delete(void* anDCoTE);
void AddDigiCollection(G4int DCID,G4VDigiCollection * aDC);
void AddDigiCollection(G4int DCID, G4VDigiCollection* aDC);
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
private:
std::vector<G4VDigiCollection*> * DC;
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
public: // with description
inline G4VDigiCollection* GetDC(G4int i) const
{ return (*DC)[i]; }
// Returns a pointer to a digi collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for(auto dc : *DC) if(dc) n++;
return n;
}
// Returns the number of digi collections which are stored in this class
// object.
public:
inline size_t GetCapacity() const
{
return DC->size();
}
private:
std::vector<G4VDigiCollection*>* DC;
public: // with description
inline G4VDigiCollection* GetDC(G4int i) const { return (*DC)[i]; }
// Returns a pointer to a digi collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for(auto dc : *DC)
if(dc)
n++;
return n;
}
// Returns the number of digi collections which are stored in this class
// object.
public:
inline size_t GetCapacity() const { return DC->size(); }
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4DCofThisEvent::operator new(size_t)
{
if (!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
void* anDCoTH;
anDCoTH = (void*)anDCoTHAllocator.MallocSingle();
return anDCoTH;
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
void* anDCoTH;
anDCoTH = (void*) anDCoTHAllocator.MallocSingle();
return anDCoTH;
}
inline void G4DCofThisEvent::operator delete(void* anDCoTH)
{
if (!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*)anDCoTH);
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*) anDCoTH);
}
#endif
@@ -46,153 +46,183 @@
class G4DigiCollection : public G4VDigiCollection
{
public:
G4DigiCollection();
G4DigiCollection(G4String detName,G4String colNam);
virtual ~G4DigiCollection();
G4bool operator==(const G4DigiCollection &right) const;
public:
G4DigiCollection();
G4DigiCollection(G4String detName, G4String colNam);
virtual ~G4DigiCollection();
G4bool operator==(const G4DigiCollection& right) const;
protected:
void* theCollection;
protected:
void* theCollection;
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#endif
template <class T> class G4TDigiCollection : public G4DigiCollection
template <class T>
class G4TDigiCollection : public G4DigiCollection
{
public:
G4TDigiCollection();
public: // with description
G4TDigiCollection(G4String detName,G4String colNam);
// Constructor.
public:
virtual ~G4TDigiCollection();
G4bool operator==(const G4TDigiCollection &right) const;
inline void *operator new(size_t);
inline void operator delete(void* aDC);
public: // with description
virtual void DrawAllDigi();
virtual void PrintAllDigi();
// These two methods invokes Draw() and Print() methods of all of
// digit objects stored in this collection, respectively.
public:
G4TDigiCollection();
public: // with description
inline T* operator[](size_t i) const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
// Returns a pointer to a concrete digi object.
inline std::vector<T*>* GetVector() const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (std::vector<T*>*)theCollection;
}
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>*theDigiCollection
= (std::vector<T*>*)theCollection;
theDigiCollection->push_back(aHit);
return theDigiCollection->size();
}
// Insert a digi object. Total number of digi objects stored in this
// collection is returned.
inline size_t entries() const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>*theDigiCollection
= (std::vector<T*>*)theCollection;
return theDigiCollection->size();
}
// Returns the number of digi objcets stored in this collection.
public: // with description
G4TDigiCollection(G4String detName, G4String colNam);
// Constructor.
public:
virtual ~G4TDigiCollection();
G4bool operator==(const G4TDigiCollection& right) const;
public:
virtual G4VDigi* GetDigi(size_t i) const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
virtual size_t GetSize() const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return ((std::vector<T*>*)theCollection)->size();
}
inline void* operator new(size_t);
inline void operator delete(void* aDC);
public: // with description
virtual void DrawAllDigi();
virtual void PrintAllDigi();
// These two methods invokes Draw() and Print() methods of all of
// digit objects stored in this collection, respectively.
public: // with description
inline T* operator[](size_t i) const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
// Returns a pointer to a concrete digi object.
inline std::vector<T*>* GetVector() const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (std::vector<T*>*) theCollection;
}
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
theDigiCollection->push_back(aHit);
return theDigiCollection->size();
}
// Insert a digi object. Total number of digi objects stored in this
// collection is returned.
inline size_t entries() const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
return theDigiCollection->size();
}
// Returns the number of digi objcets stored in this collection.
public:
virtual G4VDigi* GetDigi(size_t i) const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
virtual size_t GetSize() const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return ((std::vector<T*>*) theCollection)->size();
}
};
template <class T> inline void* G4TDigiCollection<T>::operator new(size_t)
template <class T>
inline void* G4TDigiCollection<T>::operator new(size_t)
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection> &aDCAllocator = *aDCAllocator_G4MT_TLS_();
void* aDC;
aDC = (void*)aDCAllocator.MallocSingle();
return aDC;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
void* aDC;
aDC = (void*) aDCAllocator.MallocSingle();
return aDC;
}
template <class T> inline void G4TDigiCollection<T>::operator delete(void* aDC)
template <class T>
inline void G4TDigiCollection<T>::operator delete(void* aDC)
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection> &aDCAllocator = *aDCAllocator_G4MT_TLS_(); ;;;
aDCAllocator.FreeSingle((G4DigiCollection*)aDC);
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
;
;
;
aDCAllocator.FreeSingle((G4DigiCollection*) aDC);
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection()
template <class T>
G4TDigiCollection<T>::G4TDigiCollection()
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = new std::vector<T*>;
theCollection = (void*)theDigiCollection;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = new std::vector<T*>;
theCollection = (void*) theDigiCollection;
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
: G4DigiCollection(detName,colNam)
template <class T>
G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
: G4DigiCollection(detName, colNam)
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = new std::vector<T*>;
theCollection = (void*)theDigiCollection;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = new std::vector<T*>;
theCollection = (void*) theDigiCollection;
}
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
template <class T>
G4TDigiCollection<T>::~G4TDigiCollection()
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = (std::vector<T*>*)theCollection;
//theDigiCollection->clearAndDestroy();
for(size_t i=0;i<theDigiCollection->size();i++)
{ delete (*theDigiCollection)[i]; }
theDigiCollection->clear();
delete theDigiCollection;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
// theDigiCollection->clearAndDestroy();
for(size_t i = 0; i < theDigiCollection->size(); i++)
{
delete(*theDigiCollection)[i];
}
theDigiCollection->clear();
delete theDigiCollection;
}
template <class T> G4bool G4TDigiCollection<T>::operator==(const G4TDigiCollection<T> &right) const
template <class T>
G4bool G4TDigiCollection<T>::operator==(const G4TDigiCollection<T>& right) const
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (collectionName==right.collectionName);
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (collectionName == right.collectionName);
}
template <class T> void G4TDigiCollection<T>::DrawAllDigi()
template <class T>
void G4TDigiCollection<T>::DrawAllDigi()
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = (std::vector<T*>*)theCollection;
size_t n = theDigiCollection->size();
for(size_t i=0;i<n;i++)
{ (*theDigiCollection)[i]->Draw(); }
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
size_t n = theDigiCollection->size();
for(size_t i = 0; i < n; i++)
{
(*theDigiCollection)[i]->Draw();
}
}
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
template <class T>
void G4TDigiCollection<T>::PrintAllDigi()
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = (std::vector<T*>*)theCollection;
size_t n = theDigiCollection->size();
for(size_t i=0;i<n;i++)
{ (*theDigiCollection)[i]->Print(); }
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
size_t n = theDigiCollection->size();
for(size_t i = 0; i < n; i++)
{
(*theDigiCollection)[i]->Print();
}
}
#endif
+23 -28
View File
@@ -44,38 +44,33 @@ class G4AttValue;
// If a concrete digi class is used as a transient class, G4Allocator
// must be used.
class G4VDigi
class G4VDigi
{
public:
G4VDigi();
virtual ~G4VDigi();
public:
G4VDigi();
virtual ~G4VDigi();
G4bool operator==(const G4VDigi& right) const;
G4bool operator==(const G4VDigi &right) const;
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
virtual void Draw();
virtual void Print();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const { return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
};
#endif
@@ -41,37 +41,32 @@ class G4VDigi;
// class.
// Geant4 kernel will use this class methods.
class G4VDigiCollection
class G4VDigiCollection
{
public:
G4VDigiCollection();
G4VDigiCollection(G4String DMnam,G4String colNam);
virtual ~G4VDigiCollection();
G4bool operator==(const G4VDigiCollection &right) const;
public:
G4VDigiCollection();
G4VDigiCollection(G4String DMnam, G4String colNam);
virtual ~G4VDigiCollection();
G4bool operator==(const G4VDigiCollection& right) const;
virtual void DrawAllDigi();
virtual void PrintAllDigi();
virtual void DrawAllDigi();
virtual void PrintAllDigi();
protected:
protected:
// Collection name
G4String collectionName;
G4String DMname;
// Collection name
G4String collectionName;
G4String DMname;
public:
inline const G4String& GetName() const
{ return collectionName; }
inline const G4String& GetDMname() const
{ return DMname; }
public:
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(size_t) const { return 0; }
virtual size_t GetSize() const { return 0; }
public:
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetDMname() const { return DMname; }
public:
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(size_t) const { return 0; }
virtual size_t GetSize() const { return 0; }
};
#endif
+5 -15
View File
@@ -1,13 +1,8 @@
#------------------------------------------------------------------------------
# Module : G4digits
# Package: Geant4.src.G4digits_hits.G4digits
#------------------------------------------------------------------------------
# - G4digits module build definition
#
# Define the Geant4 Module.
#
geant4_define_module(NAME G4digits
HEADERS
geant4_add_module(G4digits
PUBLIC_HEADERS
G4DCofThisEvent.hh
G4TDigiCollection.hh
G4VDigi.hh
@@ -16,11 +11,6 @@ geant4_define_module(NAME G4digits
G4DCofThisEvent.cc
G4TDigiCollection.cc
G4VDigi.cc
G4VDigiCollection.cc
GRANULAR_DEPENDENCIES
G4globman
GLOBAL_DEPENDENCIES
G4global
)
G4VDigiCollection.cc)
# List any source specific properties here
geant4_module_link_libraries(G4digits PUBLIC G4globman)
@@ -31,59 +31,73 @@
G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4DCofThisEvent>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4DCofThisEvent>* _instance = nullptr;
return _instance;
}
G4DCofThisEvent::G4DCofThisEvent()
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
{
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
DC = new std::vector<G4VDigiCollection*>;
}
G4DCofThisEvent::G4DCofThisEvent(G4int cap)
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
{
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
DC = new std::vector<G4VDigiCollection*>;
for(G4int i=0;i<cap;i++)
for(G4int i = 0; i < cap; i++)
{
DC->push_back((G4VDigiCollection*)0);
DC->push_back((G4VDigiCollection*) 0);
}
}
G4DCofThisEvent::~G4DCofThisEvent()
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
//DC->clearAndDestroy();
for(size_t i=0;i<DC->size();i++)
{ delete (*DC)[i]; }
{
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
// DC->clearAndDestroy();
for(size_t i = 0; i < DC->size(); i++)
{
delete(*DC)[i];
}
DC->clear();
delete DC;
}
void G4DCofThisEvent::AddDigiCollection(G4int DCID,G4VDigiCollection * aDC)
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
if(DCID>=0 && DCID<G4int(DC->size()))
{ (*DC)[DCID] = aDC; }
void G4DCofThisEvent::AddDigiCollection(G4int DCID, G4VDigiCollection* aDC)
{
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
if(DCID >= 0 && DCID < G4int(DC->size()))
{
(*DC)[DCID] = aDC;
}
}
G4DCofThisEvent::G4DCofThisEvent(const G4DCofThisEvent& rhs)
{
if ( !anDCoTHAllocator_G4MT_TLS_() ) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
DC = new std::vector<G4VDigiCollection*>(rhs.DC->size());
for ( unsigned int i = 0 ; i < rhs.DC->size() ; ++i )
*(DC->at(i)) = *(rhs.DC->at(i));
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
DC = new std::vector<G4VDigiCollection*>(rhs.DC->size());
for(unsigned int i = 0; i < rhs.DC->size(); ++i)
*(DC->at(i)) = *(rhs.DC->at(i));
}
G4DCofThisEvent& G4DCofThisEvent::operator=(const G4DCofThisEvent& rhs)
{
if ( this == &rhs ) return *this;
if ( !anDCoTHAllocator_G4MT_TLS_() ) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
for ( std::vector<G4VDigiCollection*>::const_iterator it = DC->begin() ;
it != DC->end() ; ++it )
{
delete *it;
}
DC->resize(rhs.DC->size());
for ( unsigned int i = 0 ; i < rhs.DC->size() ; ++i )
*(DC->at(i)) = *(rhs.DC->at(i));
if(this == &rhs)
return *this;
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
for(std::vector<G4VDigiCollection*>::const_iterator it = DC->begin();
it != DC->end(); ++it)
{
delete *it;
}
DC->resize(rhs.DC->size());
for(unsigned int i = 0; i < rhs.DC->size(); ++i)
*(DC->at(i)) = *(rhs.DC->at(i));
return *this;
}
@@ -30,20 +30,37 @@
G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4DigiCollection>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4DigiCollection>* _instance = nullptr;
return _instance;
}
G4DigiCollection::G4DigiCollection() : theCollection((void*)0)
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
G4DigiCollection::G4DigiCollection()
: theCollection((void*) 0)
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
;
}
G4DigiCollection::G4DigiCollection(G4String detName,G4String colNam)
: G4VDigiCollection(detName,colNam), theCollection((void*)0)
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
G4DigiCollection::G4DigiCollection(G4String detName, G4String colNam)
: G4VDigiCollection(detName, colNam)
, theCollection((void*) 0)
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
;
}
G4DigiCollection::~G4DigiCollection()
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
G4bool G4DigiCollection::operator==(const G4DigiCollection &right) const
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ; return (collectionName==right.collectionName); }
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
;
}
G4bool G4DigiCollection::operator==(const G4DigiCollection& right) const
{
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (collectionName == right.collectionName);
}
+8 -11
View File
@@ -30,18 +30,15 @@
#include "G4VDigi.hh"
#include "globals.hh"
G4VDigi::G4VDigi()
{;}
G4VDigi::G4VDigi() { ; }
G4VDigi::~G4VDigi()
{;}
G4VDigi::~G4VDigi() { ; }
G4bool G4VDigi::operator==(const G4VDigi &right) const
{ return (this==&right); }
G4bool G4VDigi::operator==(const G4VDigi& right) const
{
return (this == &right);
}
void G4VDigi::Draw()
{;}
void G4VDigi::Print()
{;}
void G4VDigi::Draw() { ; }
void G4VDigi::Print() { ; }
@@ -33,27 +33,22 @@
G4VDigiCollection::G4VDigiCollection()
{
collectionName = "Unknown";
DMname = "Unknown";
DMname = "Unknown";
}
G4VDigiCollection::G4VDigiCollection(G4String DMnam,G4String colNam)
G4VDigiCollection::G4VDigiCollection(G4String DMnam, G4String colNam)
{
collectionName = colNam;
DMname = DMnam;
DMname = DMnam;
}
G4VDigiCollection::~G4VDigiCollection()
{ ; }
G4VDigiCollection::~G4VDigiCollection() { ; }
G4bool G4VDigiCollection::operator==(const G4VDigiCollection &right) const
{
return ((collectionName==right.collectionName)
&&(DMname==right.DMname));
G4bool G4VDigiCollection::operator==(const G4VDigiCollection& right) const
{
return ((collectionName == right.collectionName) && (DMname == right.DMname));
}
void G4VDigiCollection::DrawAllDigi()
{;}
void G4VDigiCollection::PrintAllDigi()
{;}
void G4VDigiCollection::DrawAllDigi() { ; }
void G4VDigiCollection::PrintAllDigi() { ; }
@@ -45,66 +45,82 @@
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
// collection(s).
class G4HCofThisEvent
class G4HCofThisEvent
{
public:
G4HCofThisEvent();
G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anHCoTE);
public:
G4HCofThisEvent();
G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
inline void* operator new(size_t);
inline void operator delete(void* anHCoTE);
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
void AddHitsCollection(G4int HCID, G4VHitsCollection* aHC);
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
private:
std::vector<G4VHitsCollection*> * HC;
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
public: // with description
inline G4VHitsCollection* GetHC(G4int i)
{ return (*HC)[i]; }
// Returns a pointer to a hits collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for(size_t i=0;i<HC->size();i++)
{
if((*HC)[i]) n++;
}
return n;
}
// Returns the number of hits collections which are stored in this class
// object.
public:
inline size_t GetCapacity()
{
return HC->size();
}
private:
std::vector<G4VHitsCollection*>* HC;
public: // with description
inline G4VHitsCollection* GetHC(G4int i) { return (*HC)[i]; }
// Returns a pointer to a hits collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for(size_t i = 0; i < HC->size(); i++)
{
if((*HC)[i])
n++;
}
return n;
}
// Returns the number of hits collections which are stored in this class
// object.
public:
inline size_t GetCapacity() { return HC->size(); }
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4HCofThisEvent::operator new(size_t)
{ ;;; if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ; G4Allocator<G4HCofThisEvent> &anHCoTHAllocator = *anHCoTHAllocator_G4MT_TLS_(); ;;;
{
;
;
;
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
*anHCoTHAllocator_G4MT_TLS_();
;
;
;
void* anHCoTH;
anHCoTH = (void*)anHCoTHAllocator.MallocSingle();
anHCoTH = (void*) anHCoTHAllocator.MallocSingle();
return anHCoTH;
}
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
{ ;;; if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ; G4Allocator<G4HCofThisEvent> &anHCoTHAllocator = *anHCoTHAllocator_G4MT_TLS_(); ;;;
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
{
;
;
;
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
*anHCoTHAllocator_G4MT_TLS_();
;
;
;
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*) anHCoTH);
}
#endif
@@ -47,149 +47,185 @@
class G4HitsCollection : public G4VHitsCollection
{
public:
G4HitsCollection();
G4HitsCollection(G4String detName,G4String colNam);
virtual ~G4HitsCollection();
G4bool operator==(const G4HitsCollection &right) const;
public:
G4HitsCollection();
G4HitsCollection(G4String detName, G4String colNam);
virtual ~G4HitsCollection();
G4bool operator==(const G4HitsCollection& right) const;
protected:
void* theCollection;
protected:
void* theCollection;
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#endif
template <class T> class G4THitsCollection : public G4HitsCollection
template <class T>
class G4THitsCollection : public G4HitsCollection
{
public:
G4THitsCollection();
public: // with description
G4THitsCollection(G4String detName,G4String colNam);
// constructor.
public:
virtual ~G4THitsCollection();
G4bool operator==(const G4THitsCollection<T> &right) const;
inline void *operator new(size_t);
inline void operator delete(void* anHC);
public: // with description
virtual void DrawAllHits();
virtual void PrintAllHits();
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this collection, respectively.
public:
G4THitsCollection();
public: // with description
inline T* operator[](size_t i) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
// Returns a pointer to a concrete hit object.
inline std::vector<T*>* GetVector() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (std::vector<T*>*)theCollection; }
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Insert a hit object. Total number of hit objects stored in this
// collection is returned.
inline size_t entries() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
// Returns the number of hit objects stored in this collection
public: // with description
G4THitsCollection(G4String detName, G4String colNam);
// constructor.
public:
virtual ~G4THitsCollection();
G4bool operator==(const G4THitsCollection<T>& right) const;
public:
virtual G4VHit* GetHit(size_t i) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
virtual size_t GetSize() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return ((std::vector<T*>*)theCollection)->size();
}
inline void* operator new(size_t);
inline void operator delete(void* anHC);
public: // with description
virtual void DrawAllHits();
virtual void PrintAllHits();
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this collection, respectively.
public: // with description
inline T* operator[](size_t i) const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
// Returns a pointer to a concrete hit object.
inline std::vector<T*>* GetVector() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (std::vector<T*>*) theCollection;
}
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Insert a hit object. Total number of hit objects stored in this
// collection is returned.
inline size_t entries() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
return theHitsCollection->size();
}
// Returns the number of hit objects stored in this collection
public:
virtual G4VHit* GetHit(size_t i) const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
virtual size_t GetSize() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return ((std::vector<T*>*) theCollection)->size();
}
};
template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
template <class T>
inline void* G4THitsCollection<T>::operator new(size_t)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection> &anHCAllocator = *anHCAllocator_G4MT_TLS_(); ;;;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
;
;
;
void* anHC;
anHC = (void*)anHCAllocator.MallocSingle();
anHC = (void*) anHCAllocator.MallocSingle();
return anHC;
}
template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
template <class T>
inline void G4THitsCollection<T>::operator delete(void* anHC)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection> &anHCAllocator = *anHCAllocator_G4MT_TLS_(); ;;;
anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
;
;
;
anHCAllocator.FreeSingle((G4HitsCollection*) anHC);
}
template <class T> G4THitsCollection<T>::G4THitsCollection()
template <class T>
G4THitsCollection<T>::G4THitsCollection()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = new std::vector<T*>;
theCollection = (void*)theHitsCollection;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = new std::vector<T*>;
theCollection = (void*) theHitsCollection;
}
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
template <class T>
G4THitsCollection<T>::G4THitsCollection(G4String detName, G4String colNam)
: G4HitsCollection(detName, colNam)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = new std::vector<T*>;
theCollection = (void*)theHitsCollection;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = new std::vector<T*>;
theCollection = (void*) theHitsCollection;
}
template <class T> G4THitsCollection<T>::~G4THitsCollection()
template <class T>
G4THitsCollection<T>::~G4THitsCollection()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
//theHitsCollection->clearAndDestroy();
for(size_t i=0;i<theHitsCollection->size();++i)
{ delete (*theHitsCollection)[i]; }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
// theHitsCollection->clearAndDestroy();
for(size_t i = 0; i < theHitsCollection->size(); ++i)
{
delete(*theHitsCollection)[i];
}
theHitsCollection->clear();
delete theHitsCollection;
}
template <class T> G4bool G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
template <class T>
G4bool G4THitsCollection<T>::operator==(const G4THitsCollection<T>& right) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName==right.collectionName);
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName == right.collectionName);
}
template <class T> void G4THitsCollection<T>::DrawAllHits()
template <class T>
void G4THitsCollection<T>::DrawAllHits()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;++i)
{ (*theHitsCollection)[i]->Draw(); }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
size_t n = theHitsCollection->size();
for(size_t i = 0; i < n; ++i)
{
(*theHitsCollection)[i]->Draw();
}
}
template <class T> void G4THitsCollection<T>::PrintAllHits()
template <class T>
void G4THitsCollection<T>::PrintAllHits()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;++i)
{ (*theHitsCollection)[i]->Print(); }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
size_t n = theHitsCollection->size();
for(size_t i = 0; i < n; ++i)
{
(*theHitsCollection)[i]->Print();
}
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+23 -27
View File
@@ -44,37 +44,33 @@ class G4AttValue;
// If a concrete hit class is used as a transient class, G4Allocator
// must be used.
class G4VHit
class G4VHit
{
public:
G4VHit();
virtual ~G4VHit();
public:
G4VHit();
virtual ~G4VHit();
G4bool operator==(const G4VHit& right) const;
G4bool operator==(const G4VHit &right) const;
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
virtual void Draw();
virtual void Print();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const { return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
};
#endif
@@ -41,43 +41,36 @@ class G4VHit;
// class.
// Geant4 kernel will use this class methods.
class G4VHitsCollection
class G4VHitsCollection
{
public:
G4VHitsCollection();
G4VHitsCollection(G4String detName,G4String colNam);
virtual ~G4VHitsCollection();
G4bool operator==(const G4VHitsCollection &right) const;
public:
G4VHitsCollection();
G4VHitsCollection(G4String detName, G4String colNam);
virtual ~G4VHitsCollection();
G4bool operator==(const G4VHitsCollection& right) const;
virtual void DrawAllHits();
virtual void PrintAllHits();
virtual void DrawAllHits();
virtual void PrintAllHits();
protected:
protected:
// Collection name
G4String collectionName;
G4String SDname;
// Collection ID
G4int colID;
// Collection name
G4String collectionName;
G4String SDname;
// Collection ID
G4int colID;
public:
inline const G4String& GetName() const
{ return collectionName; }
inline const G4String& GetSDname() const
{ return SDname; }
inline void SetColID(G4int i)
{ colID = i; }
inline G4int GetColID() const
{ return colID; }
public:
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; };
public:
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetSDname() const { return SDname; }
inline void SetColID(G4int i) { colID = i; }
inline G4int GetColID() const { return colID; }
public:
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; };
};
#endif
+5 -15
View File
@@ -1,13 +1,8 @@
#------------------------------------------------------------------------------
# Module : G4hits
# Package: Geant4.src.G4digits_hits.G4hits
#------------------------------------------------------------------------------
# - G4hits module build definition
#
# Define the Geant4 Module.
#
geant4_define_module(NAME G4hits
HEADERS
geant4_add_module(G4hits
PUBLIC_HEADERS
G4HCofThisEvent.hh
G4THitsCollection.hh
G4THitsMap.hh
@@ -18,11 +13,6 @@ geant4_define_module(NAME G4hits
G4HCofThisEvent.cc
G4THitsCollection.cc
G4VHit.cc
G4VHitsCollection.cc
GRANULAR_DEPENDENCIES
G4globman
GLOBAL_DEPENDENCIES
G4global
)
G4VHitsCollection.cc)
# List any source specific properties here
geant4_module_link_libraries(G4hits PUBLIC G4globman)
+40 -29
View File
@@ -30,63 +30,74 @@
G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4HCofThisEvent>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4HCofThisEvent>* _instance = nullptr;
return _instance;
}
G4HCofThisEvent::G4HCofThisEvent()
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
{
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
HC = new std::vector<G4VHitsCollection*>;
}
G4HCofThisEvent::G4HCofThisEvent(G4int cap)
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
{
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
HC = new std::vector<G4VHitsCollection*>;
for(G4int i=0;i<cap;i++)
for(G4int i = 0; i < cap; i++)
{
HC->push_back((G4VHitsCollection*)0);
HC->push_back((G4VHitsCollection*) 0);
}
}
G4HCofThisEvent::~G4HCofThisEvent()
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
//HC->clearAndDestroy();
for(size_t i=0;i<HC->size();i++)
{ delete (*HC)[i]; }
{
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
// HC->clearAndDestroy();
for(size_t i = 0; i < HC->size(); i++)
{
delete(*HC)[i];
}
HC->clear();
delete HC;
}
void G4HCofThisEvent::AddHitsCollection(G4int HCID,G4VHitsCollection * aHC)
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
if(HCID>=0 && HCID<G4int(HC->size()))
void G4HCofThisEvent::AddHitsCollection(G4int HCID, G4VHitsCollection* aHC)
{
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
if(HCID >= 0 && HCID < G4int(HC->size()))
{
aHC->SetColID(HCID);
(*HC)[HCID] = aHC;
}
}
G4HCofThisEvent::G4HCofThisEvent(const G4HCofThisEvent& rhs)
{
if ( !anHCoTHAllocator_G4MT_TLS_() ) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
HC = new std::vector<G4VHitsCollection*>(rhs.HC->size());
for ( unsigned int i = 0 ; i<rhs.HC->size() ; ++i)
*(HC->at(i)) = *(rhs.HC->at(i));
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
HC = new std::vector<G4VHitsCollection*>(rhs.HC->size());
for(unsigned int i = 0; i < rhs.HC->size(); ++i)
*(HC->at(i)) = *(rhs.HC->at(i));
}
G4HCofThisEvent& G4HCofThisEvent::operator=(const G4HCofThisEvent& rhs)
{
if ( this == &rhs ) return *this;
if ( !anHCoTHAllocator_G4MT_TLS_() ) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
for ( std::vector<G4VHitsCollection*>::const_iterator it = HC->begin() ;
it != HC->end() ; ++it )
{
delete *it;
}
HC->resize(rhs.HC->size());
for ( unsigned int i = 0 ; i<rhs.HC->size() ; ++i)
*(HC->at(i)) = *(rhs.HC->at(i));
if(this == &rhs)
return *this;
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
for(std::vector<G4VHitsCollection*>::const_iterator it = HC->begin();
it != HC->end(); ++it)
{
delete *it;
}
HC->resize(rhs.HC->size());
for(unsigned int i = 0; i < rhs.HC->size(); ++i)
*(HC->at(i)) = *(rhs.HC->at(i));
return *this;
}
@@ -30,20 +30,37 @@
G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4HitsCollection>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4HitsCollection>* _instance = nullptr;
return _instance;
}
G4HitsCollection::G4HitsCollection() : theCollection((void*)0)
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
G4HitsCollection::G4HitsCollection()
: theCollection((void*) 0)
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
;
}
G4HitsCollection::G4HitsCollection(G4String detName,G4String colNam)
: G4VHitsCollection(detName,colNam), theCollection((void*)0)
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
G4HitsCollection::G4HitsCollection(G4String detName, G4String colNam)
: G4VHitsCollection(detName, colNam)
, theCollection((void*) 0)
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
;
}
G4HitsCollection::~G4HitsCollection()
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
G4bool G4HitsCollection::operator==(const G4HitsCollection &right) const
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ; return (collectionName==right.collectionName); }
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
;
}
G4bool G4HitsCollection::operator==(const G4HitsCollection& right) const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName == right.collectionName);
}
+5 -11
View File
@@ -30,18 +30,12 @@
#include "G4VHit.hh"
#include "globals.hh"
G4VHit::G4VHit()
{;}
G4VHit::G4VHit() { ; }
G4VHit::~G4VHit()
{;}
G4VHit::~G4VHit() { ; }
G4bool G4VHit::operator==(const G4VHit &) const
{ return false; }
G4bool G4VHit::operator==(const G4VHit&) const { return false; }
void G4VHit::Draw()
{;}
void G4VHit::Print()
{;}
void G4VHit::Draw() { ; }
void G4VHit::Print() { ; }
@@ -33,29 +33,24 @@
G4VHitsCollection::G4VHitsCollection()
{
collectionName = "Unknown";
SDname = "Unknown";
colID = -1;
SDname = "Unknown";
colID = -1;
}
G4VHitsCollection::G4VHitsCollection(G4String detName,G4String colNam)
G4VHitsCollection::G4VHitsCollection(G4String detName, G4String colNam)
{
collectionName = colNam;
SDname = detName;
colID = -1;
SDname = detName;
colID = -1;
}
G4VHitsCollection::~G4VHitsCollection()
{ ; }
G4VHitsCollection::~G4VHitsCollection() { ; }
G4bool G4VHitsCollection::operator==(const G4VHitsCollection &right) const
{
return ((collectionName==right.collectionName)
&&(SDname==right.SDname));
G4bool G4VHitsCollection::operator==(const G4VHitsCollection& right) const
{
return ((collectionName == right.collectionName) && (SDname == right.SDname));
}
void G4VHitsCollection::DrawAllHits()
{;}
void G4VHitsCollection::PrintAllHits()
{;}
void G4VHitsCollection::DrawAllHits() { ; }
void G4VHitsCollection::PrintAllHits() { ; }
+4 -1
View File
@@ -16,6 +16,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 1, 2021 B. Morgan (detscorer-V10-07-00)
- Migrate build to modular CMake API
October 6, 2020 Makoto Asai (detscorer-V10-06-01)
- Migrate following scorers to use G4PrimitivePlotter to directly fill histograms.
G4PSCellFlux G4PSCylinderSurfaceCurrent G4PSCylinderSurfaceFlux G4PSDoseDeposit
@@ -37,7 +40,7 @@ July 11, 2007 M.Asai (detscorer-V09-00-00)
- Moved from digits_hits/utilis.
June 06, 2007 A.Howard (detutils-V08-03-02)
- Added modified G4PSPopulation removing event (circular) dependency
- Added modified G4PSPopulation removing event (circular) dependency
(file form T.Aso).
June 05, 2007 M.Asai (detutils-V08-03-01)
@@ -38,32 +38,30 @@
//
// Created: 2007-08-20 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCellCharge : public G4VPrimitiveScorer
{
public: // with description
G4PSCellCharge(G4String name, G4int depth=0);
G4PSCellCharge(G4String name, const G4String& unit, G4int depth=0);
virtual ~G4PSCellCharge();
public: // with description
G4PSCellCharge(G4String name, G4int depth = 0);
G4PSCellCharge(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSCellCharge();
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
};
#endif
@@ -37,28 +37,24 @@
//
// Created: 2007-08-20 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCellCharge3D : public G4PSCellCharge
{
public: // with description
G4PSCellCharge3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSCellCharge3D(G4String name, const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSCellCharge3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSCellCharge3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSCellCharge3D();
virtual ~G4PSCellCharge3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -37,10 +37,10 @@ class G4VSolid;
///////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring cell flux.
// The Cell Flux is defined by a sum of track length divided
// by the geometry volume, where all of the tracks in the geometry
// The Cell Flux is defined by a sum of track length divided
// by the geometry volume, where all of the tracks in the geometry
// are taken into account. e.g. the unit of Cell Flux is mm/mm3.
//
//
//
// If you want to score only tracks passing through the geometry volume,
// please use G4PSPassageCellFlux.
@@ -51,42 +51,39 @@ class G4VSolid;
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. cell flux * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCellFlux : public G4VPrimitivePlotter
{
public: // with description
G4PSCellFlux(G4String name, G4int depth=0);
G4PSCellFlux(G4String name, const G4String& unit, G4int depth=0);
virtual ~G4PSCellFlux();
public: // with description
G4PSCellFlux(G4String name, G4int depth = 0);
G4PSCellFlux(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSCellFlux();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
virtual G4double ComputeVolume(G4Step*, G4int idx);
virtual G4double ComputeVolume(G4Step*, G4int idx);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
};
#endif
@@ -44,26 +44,23 @@
//
// Created: 2007-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCellFlux3D : public G4PSCellFlux
{
public: // with description
G4PSCellFlux3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSCellFlux3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSCellFlux3D();
public: // with description
G4PSCellFlux3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSCellFlux3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSCellFlux3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -44,32 +44,30 @@
//
// Created: 2007-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
// 2011-03-24 Give Size and Segmentation for relicated volume in cylinder.
//
// 2011-03-24 Give Size and Segmentation for relicated volume in cylinder.
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCellFluxForCylinder3D : public G4PSCellFlux3D
{
public: // with description
G4PSCellFluxForCylinder3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSCellFluxForCylinder3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSCellFluxForCylinder3D();
public: // with description
G4PSCellFluxForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSCellFluxForCylinder3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
virtual ~G4PSCellFluxForCylinder3D();
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
private:
private:
// Order of segmentation (Z PHI R) in CylinderMesh
G4ThreeVector cylinderSize;
G4int nSegment[3];
G4ThreeVector cylinderSize;
G4int nSegment[3];
};
#endif
@@ -40,10 +40,10 @@
// This is a primitive scorer class for scoring Surface Current.
// Current version assumes only for G4Tubs shape, and the surface
// is defined at the inner plane of the tubs.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the inner surface of the tube.
// Surface is defined at the inner surface of the tube.
// Direction R R+dR
// 0 IN || OUT ->|<- | fCurrent_InOut
// 1 IN ->| | fCurrent_In
@@ -54,49 +54,45 @@
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. surface current * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCylinderSurfaceCurrent : public G4VPrimitivePlotter
{
public: // with description
G4PSCylinderSurfaceCurrent(G4String name ,G4int direction,
G4int depth=0);
G4PSCylinderSurfaceCurrent(G4String name ,G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSCylinderSurfaceCurrent();
public: // with description
G4PSCylinderSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceCurrent(G4String name, G4int direction,
const G4String& unit, G4int depth = 0);
virtual ~G4PSCylinderSurfaceCurrent();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided by Area.
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided by Area.
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Tubs*);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Tubs*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -39,7 +39,7 @@
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the -Z surface.
// Direction Rmin Rmax
// Direction Rmin Rmax
// 0 IN || OUT ->|<- | fCurrent_InOut
// 1 IN ->| | fCurrent_In
// 2 OUT |<- | fCurrent_Out
@@ -49,24 +49,22 @@
// 2010-07-22 Introduce Unit specification.
///////////////////////////////////////////////////////////////////////////////
class G4PSCylinderSurfaceCurrent3D : public G4PSCylinderSurfaceCurrent
{
public: // with description
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSCylinderSurfaceCurrent3D();
public: // with description
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSCylinderSurfaceCurrent3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -38,7 +38,7 @@
// This is a primitive scorer class for scoring Surface Flux.
// Current version assumes only for G4Tubs shape, and the surface
// is defined at the inner plane of the tube.
// The surface flux is given in the unit of area.
// The surface flux is given in the unit of area.
// e.g. sum of 1/cos(T)/mm2, where T is a incident angle of the
// track on the surface.
//
@@ -54,47 +54,45 @@
// 2010-07-22 Add weighted and divideByArea options
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. surface flux * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSCylinderSurfaceFlux : public G4VPrimitivePlotter
{
public: // with description
G4PSCylinderSurfaceFlux(G4String name,G4int direction, G4int depth=0);
G4PSCylinderSurfaceFlux(G4String name,G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSCylinderSurfaceFlux();
public: // with description
G4PSCylinderSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4int depth = 0);
virtual ~G4PSCylinderSurfaceFlux();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided by Area.
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided by Area.
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Tubs*);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Tubs*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -49,24 +49,22 @@
// 2010-07-22 Introduce Unit specification.
///////////////////////////////////////////////////////////////////////////////
class G4PSCylinderSurfaceFlux3D : public G4PSCylinderSurfaceFlux
{
public: // with description
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int di=2, G4int dj=1, G4int dk=0);
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int di=2, G4int dj=1, G4int dk=0);
virtual ~G4PSCylinderSurfaceFlux3D();
public: // with description
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int di = 2,
G4int dj = 1, G4int dk = 0);
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int di = 2, G4int dj = 1,
G4int dk = 0);
virtual ~G4PSCylinderSurfaceFlux3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -43,26 +43,24 @@
//////////////////
enum G4PSFluxFlag
//////////////////
{
fFlux_InOut,
// For both direction In / Out.
fFlux_In,
// IN : Direction which comes into the geometry
fFlux_Out
{
fFlux_InOut,
// For both direction In / Out.
fFlux_In,
// IN : Direction which comes into the geometry
fFlux_Out
};
/////////////////////
enum G4PSCurrentFlag
/////////////////////
{
fCurrent_InOut,
// For both direction In / Out.
fCurrent_In,
// IN : Direction which comes into the geometry
fCurrent_Out
// OUT : Direction which goes out fromthe geometry
{
fCurrent_InOut,
// For both direction In / Out.
fCurrent_In,
// IN : Direction which comes into the geometry
fCurrent_Out
// OUT : Direction which goes out fromthe geometry
};
#endif
@@ -40,33 +40,32 @@
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of dose deposit (x)
// vs. weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSDoseDeposit : public G4VPrimitivePlotter
{
public: // with description
G4PSDoseDeposit(G4String name, G4int depth=0);
G4PSDoseDeposit(G4String name, const G4String& unit, G4int depth=0);
virtual ~G4PSDoseDeposit();
public: // with description
G4PSDoseDeposit(G4String name, G4int depth = 0);
G4PSDoseDeposit(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSDoseDeposit();
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
virtual G4double ComputeVolume(G4Step*, G4int idx);
virtual G4double ComputeVolume(G4Step*, G4int idx);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
};
#endif
@@ -37,26 +37,24 @@
//
// Created: 2008-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSDoseDeposit3D : public G4PSDoseDeposit
{
public: // with description
G4PSDoseDeposit3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSDoseDeposit3D(G4String name, const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSDoseDeposit3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSDoseDeposit3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSDoseDeposit3D();
virtual ~G4PSDoseDeposit3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -37,32 +37,31 @@
//
// Created: 2008-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
// 2011-03-24 Give Size and Segmentation for relicated volume in cylinder.
//
// 2011-03-24 Give Size and Segmentation for relicated volume in cylinder.
//
///////////////////////////////////////////////////////////////////////////////
class G4PSDoseDepositForCylinder3D : public G4PSDoseDeposit3D
{
public: // with description
G4PSDoseDepositForCylinder3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSDoseDepositForCylinder3D(G4String name, const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSDoseDepositForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSDoseDepositForCylinder3D(G4String name, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSDoseDepositForCylinder3D();
virtual ~G4PSDoseDepositForCylinder3D();
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
private:
private:
// Order of segmentation (Z PHI R) in CylinderMesh
G4ThreeVector cylinderSize;
G4int nSegment[3];
G4ThreeVector cylinderSize;
G4int nSegment[3];
};
#endif
@@ -35,10 +35,10 @@
////////////////////////////////////////////////////////////////////////////////
// Description:
// This is a primitive scorer class for scoring energy deposit.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura
// 2010-07-22 Introduce Unit specification.
//
//
// 2020-09-03 Use G4VPrimitivePlotter and fill 1-D histo of energy deposit (x)
// vs. track weight (y) (Makoto Asai)
//
@@ -46,26 +46,25 @@
class G4PSEnergyDeposit : public G4VPrimitivePlotter
{
public: // with description
G4PSEnergyDeposit(G4String name, G4int depth=0); // default unit
G4PSEnergyDeposit(G4String name, const G4String& unit, G4int depth=0);
virtual ~G4PSEnergyDeposit();
public: // with description
G4PSEnergyDeposit(G4String name, G4int depth = 0); // default unit
G4PSEnergyDeposit(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSEnergyDeposit();
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
};
#endif
@@ -38,24 +38,21 @@
// 2010-07-22 Introduce Unit specification.
///////////////////////////////////////////////////////////////////////////////
class G4PSEnergyDeposit3D : public G4PSEnergyDeposit
{
public: // with description
G4PSEnergyDeposit3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSEnergyDeposit3D(G4String name, const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSEnergyDeposit3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSEnergyDeposit3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
virtual ~G4PSEnergyDeposit3D();
virtual ~G4PSEnergyDeposit3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -39,7 +39,7 @@
// This is a primitive scorer class for scoring Surface Current.
// Current version assumes only for G4Box shape, and the surface
// is defined at the -Z plane of the box.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the -Z surface.
@@ -55,48 +55,45 @@
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. Surface Current * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSFlatSurfaceCurrent : public G4VPrimitivePlotter
{
public: // with description
G4PSFlatSurfaceCurrent(G4String name ,G4int direction, G4int depth=0);
G4PSFlatSurfaceCurrent(G4String name ,G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSFlatSurfaceCurrent();
public: // with description
G4PSFlatSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceCurrent(G4String name, G4int direction, const G4String& unit,
G4int depth = 0);
virtual ~G4PSFlatSurfaceCurrent();
// Scoring options
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided By Area
// Scoring options
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided By Area
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Box*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Box*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -49,24 +49,21 @@
// 2010-07-22 Introduce Unit specification.
///////////////////////////////////////////////////////////////////////////////
class G4PSFlatSurfaceCurrent3D : public G4PSFlatSurfaceCurrent
{
public: // with description
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSFlatSurfaceCurrent3D();
public: // with description
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSFlatSurfaceCurrent3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -38,7 +38,7 @@
// This is a primitive scorer class for scoring Surface Flux.
// Current version assumes only for G4Box shape, and the surface
// is defined at the -Z plane of the box.
// The surface flux is given in the unit of area.
// The surface flux is given in the unit of area.
// e.g. sum of 1/cos(T)/mm2, where T is a incident angle of the
// track on the surface.
//
@@ -50,7 +50,7 @@
// 2 OUT |<- | fFlux_Out
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
//
//
// 18-Nov-2005 T.Aso, To use always positive value for anglefactor.
// Bug fix. Area definition.
// 29-Mar-2007 T.Aso, Bug fix for momentum direction at outgoing flux.
@@ -62,41 +62,40 @@
class G4PSFlatSurfaceFlux : public G4VPrimitivePlotter
{
public: // with description
G4PSFlatSurfaceFlux(G4String name,G4int direction, G4int depth=0);
G4PSFlatSurfaceFlux(G4String name,G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSFlatSurfaceFlux();
public: // with description
G4PSFlatSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4int depth = 0);
virtual ~G4PSFlatSurfaceFlux();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided by Area.
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided by Area.
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Box*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Box*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -51,24 +51,21 @@
//
///////////////////////////////////////////////////////////////////////////////
class G4PSFlatSurfaceFlux3D : public G4PSFlatSurfaceFlux
{
public: // with description
G4PSFlatSurfaceFlux3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSFlatSurfaceFlux3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSFlatSurfaceFlux3D();
public: // with description
G4PSFlatSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSFlatSurfaceFlux3D(G4String name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSFlatSurfaceFlux3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -42,44 +42,37 @@
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. track weight (y) (Makoto Asai)
//
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSMinKinEAtGeneration : public G4VPrimitivePlotter
{
public: // with description
G4PSMinKinEAtGeneration(G4String name, G4int depth=0);
G4PSMinKinEAtGeneration(G4String name, const G4String& unit,
G4int depth=0);
public: // with description
G4PSMinKinEAtGeneration(G4String name, G4int depth = 0);
G4PSMinKinEAtGeneration(G4String name, const G4String& unit, G4int depth = 0);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSMinKinEAtGeneration();
public:
virtual ~G4PSMinKinEAtGeneration();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
public:
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
public:
};
#endif
@@ -44,20 +44,19 @@
class G4PSMinKinEAtGeneration3D : public G4PSMinKinEAtGeneration
{
public: // with description
G4PSMinKinEAtGeneration3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSMinKinEAtGeneration3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSMinKinEAtGeneration3D();
public: // with description
G4PSMinKinEAtGeneration3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSMinKinEAtGeneration3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
virtual ~G4PSMinKinEAtGeneration3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -32,53 +32,46 @@
#include "G4VPrimitiveScorer.hh"
#include "G4THitsMap.hh"
//////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Number of Steps in the cell.
//
//
// Created: 2007-2-2 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSNofCollision : public G4VPrimitiveScorer
{
public: // with description
G4PSNofCollision(G4String name, G4int depth=0);
public: // with description
G4PSNofCollision(G4String name, G4int depth = 0);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSNofCollision();
public:
virtual ~G4PSNofCollision();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
public:
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
public:
};
#endif
@@ -34,30 +34,25 @@
//////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Number of Steps in the cell.
//
//
// Created: 2007-08-14 Tsukasa ASO
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSNofCollision3D : public G4PSNofCollision
{
public: // with description
G4PSNofCollision3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSNofCollision3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
public:
virtual ~G4PSNofCollision3D();
public:
virtual ~G4PSNofCollision3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -37,7 +37,7 @@
// (Description)
// This is a primitive scorer class for scoring Number of particles
// generated in the geometry.
//
//
// Created: 2005-11-18 Tsukasa ASO, Akinori Kimura.
// Modified: 2007-03-23 Tsukasa ASO, Introduce SetSecondary() method for
// specifying a particluar secondary. If the pointer
@@ -45,52 +45,46 @@
// But onece user sets it, it accepts only the particle.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic
// energy of the secondary in MeV (x) vs. track weight (y)
// energy of the secondary in MeV (x) vs. track weight (y)
// (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSNofSecondary : public G4VPrimitivePlotter
{
public: // with description
G4PSNofSecondary(G4String name, G4int depth=0);
public: // with description
G4PSNofSecondary(G4String name, G4int depth = 0);
// Scoring option
void SetParticle(const G4String& particleName);
// Scoring option
void SetParticle(const G4String& particleName);
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSNofSecondary();
public:
virtual ~G4PSNofSecondary();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4ParticleDefinition* particleDef;
G4bool weighted;
public:
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4ParticleDefinition* particleDef;
G4bool weighted;
public:
};
#endif
@@ -40,17 +40,15 @@
class G4PSNofSecondary3D : public G4PSNofSecondary
{
public: // with description
G4PSNofSecondary3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSNofSecondary3D();
public: // with description
G4PSNofSecondary3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSNofSecondary3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -35,53 +35,46 @@
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring Number of Steps in the cell.
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of step length
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of step length
// in mm vs. number of steps (not weighted) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSNofStep : public G4VPrimitivePlotter
{
public: // with description
G4PSNofStep(G4String name, G4int depth=0);
public: // with description
G4PSNofStep(G4String name, G4int depth = 0);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSNofStep();
public:
virtual ~G4PSNofStep();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
public:
void SetBoundaryFlag(G4bool flg=true)
{boundaryFlag = flg;}
public:
void SetBoundaryFlag(G4bool flg = true) { boundaryFlag = flg; }
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool boundaryFlag;
public:
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool boundaryFlag;
public:
};
#endif
@@ -39,20 +39,17 @@
//
///////////////////////////////////////////////////////////////////////////////
class G4PSNofStep3D : public G4PSNofStep
{
public: // with description
G4PSNofStep3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSNofStep3D();
public: // with description
G4PSNofStep3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSNofStep3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -35,7 +35,7 @@
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring current.
// The number of tracks passing through the geometry are taken
// The number of tracks passing through the geometry are taken
// into account.
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
@@ -43,44 +43,40 @@
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. current * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageCellCurrent : public G4VPrimitivePlotter
{
public: // with description
G4PSPassageCellCurrent(G4String name, G4int depth=0);
virtual ~G4PSPassageCellCurrent();
public: // with description
G4PSPassageCellCurrent(G4String name, G4int depth = 0);
virtual ~G4PSPassageCellCurrent();
inline void Weighted(G4bool flg=true) { weighted = flg; }
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
virtual G4bool IsPassed(G4Step*);
virtual G4bool IsPassed(G4Step*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fCurrent;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fCurrent;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
};
#endif
@@ -34,28 +34,26 @@
////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for scoring a current.
// The number of tracks passing through the geometry are taken
// The number of tracks passing through the geometry are taken
// into account.
//
// Created: 2007-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageCellCurrent3D : public G4PSPassageCellCurrent
{
public: // with description
G4PSPassageCellCurrent3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSPassageCellCurrent3D();
public: // with description
G4PSPassageCellCurrent3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSPassageCellCurrent3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -36,7 +36,7 @@
// (Description)
// This is a primitive scorer class for scoring cell flux.
// The Cell Flux is defined by a track length divided by a geometry
// volume, where only tracks passing through the geometry are taken
// volume, where only tracks passing through the geometry are taken
// into account. e.g. the unit of Cell Flux is mm/mm3.
//
// If you want to score all tracks in the geometry volume,
@@ -47,46 +47,43 @@
// 2010-07-22 Add weighted option
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of kinetic energy (x)
// vs. cell flux * track weight (y) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageCellFlux : public G4VPrimitivePlotter
{
public: // with description
G4PSPassageCellFlux(G4String name, G4int depth=0);
G4PSPassageCellFlux(G4String name, const G4String& unit, G4int depth=0);
public: // with description
G4PSPassageCellFlux(G4String name, G4int depth = 0);
G4PSPassageCellFlux(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSPassageCellFlux();
virtual ~G4PSPassageCellFlux();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
virtual G4bool IsPassed(G4Step*);
virtual G4double ComputeVolume(G4Step*, G4int idx);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
virtual G4bool IsPassed(G4Step*);
virtual G4double ComputeVolume(G4Step*, G4int idx);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fCellFlux;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fCellFlux;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
};
#endif
@@ -44,23 +44,20 @@
// 2010-07-22 Introduce Unit specification.
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageCellFlux3D : public G4PSPassageCellFlux
{
public: // with description
G4PSPassageCellFlux3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSPassageCellFlux3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSPassageCellFlux3D();
public: // with description
G4PSPassageCellFlux3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSPassageCellFlux3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
virtual ~G4PSPassageCellFlux3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -45,29 +45,27 @@
// 2011-03-24 Give Size and Segmentation for relicated volume in cylinder.
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageCellFluxForCylinder3D : public G4PSPassageCellFlux3D
{
public: // with description
G4PSPassageCellFluxForCylinder3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSPassageCellFluxForCylinder3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
virtual ~G4PSPassageCellFluxForCylinder3D();
public: // with description
G4PSPassageCellFluxForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSPassageCellFluxForCylinder3D(G4String name, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSPassageCellFluxForCylinder3D();
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
void SetCylinderSize(G4double dr, G4double dz);
void SetNumberOfSegments(G4int nSeg[3]);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
protected: // with description
virtual G4double ComputeVolume(G4Step*, G4int idx);
private:
private:
// Order of segmentation (Z PHI R) in CylinderMesh
G4ThreeVector cylinderSize;
G4int nSegment[3];
G4ThreeVector cylinderSize;
G4int nSegment[3];
};
#endif
@@ -36,48 +36,44 @@
// (Description)
// This is a primitive scorer class for scoring only track length.
// The tracks which passed a geometry is taken into account.
//
//
//
// Created: 2005-11-14 Tsukasa ASO, Akinori Kimura.
// 2010-07-22 Introduce Unit specification.
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of track length
// 2020-10-06 Use G4VPrimitivePlotter and fill 1-D histo of track length
// vs. number of tracks (not weighted) (Makoto Asai)
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageTrackLength : public G4VPrimitivePlotter
{
public: // with description
G4PSPassageTrackLength(G4String name, G4int depth=0);
G4PSPassageTrackLength(G4String name, const G4String& unit,
G4int depth=0);
virtual ~G4PSPassageTrackLength();
public: // with description
G4PSPassageTrackLength(G4String name, G4int depth = 0);
G4PSPassageTrackLength(G4String name, const G4String& unit, G4int depth = 0);
virtual ~G4PSPassageTrackLength();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4bool IsPassed(G4Step*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4bool IsPassed(G4Step*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fTrackLength;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4int fCurrentTrkID;
G4double fTrackLength;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
};
#endif
@@ -35,33 +35,30 @@
// (Description)
// This is a primitive scorer class for scoring only track length.
// The tracks which passed a geometry is taken into account.
//
//
//
// Created: 2008-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPassageTrackLength3D : public G4PSPassageTrackLength
{
public: // with description
G4PSPassageTrackLength3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSPassageTrackLength3D(G4String name,const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSPassageTrackLength3D(G4String name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSPassageTrackLength3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
virtual ~G4PSPassageTrackLength3D();
virtual ~G4PSPassageTrackLength3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -44,45 +44,38 @@
//
///////////////////////////////////////////////////////////////////////////////
class G4PSPopulation : public G4VPrimitiveScorer
{
public: // with description
G4PSPopulation(G4String name, G4int depth=0);
public: // with description
G4PSPopulation(G4String name, G4int depth = 0);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSPopulation();
public:
virtual ~G4PSPopulation();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
std::map<G4int,G4TrackLogger> fCellTrackLogger;
public:
virtual void SetUnit(const G4String& unit);
private:
G4int HCID;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
std::map<G4int, G4TrackLogger> fCellTrackLogger;
public:
};
#endif
@@ -41,24 +41,18 @@
class G4PSPopulation3D : public G4PSPopulation
{
public: // with description
G4PSPopulation3D(G4String name,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSPopulation3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
public:
virtual ~G4PSPopulation3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
public:
virtual ~G4PSPopulation3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -39,7 +39,7 @@
// This is a primitive scorer class for scoring Surface Current.
// Current version assumes only for G4Sphere shape, and the surface
// is defined at the inside of the sphere.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the inside of sphere.
@@ -52,47 +52,44 @@
// 17-Nov-2005 Bug fix. square definition.
// 31-Mar-2007 T.Aso, Add option for normalizing by the area.
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSSphereSurfaceCurrent : public G4VPrimitiveScorer
{
public: // with description
G4PSSphereSurfaceCurrent(G4String name, G4int direction, G4int depth=0);
G4PSSphereSurfaceCurrent(G4String name, G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSSphereSurfaceCurrent();
public: // with description
G4PSSphereSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceCurrent(G4String name, G4int direction, const G4String& unit,
G4int depth = 0);
virtual ~G4PSSphereSurfaceCurrent();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided by Area.
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided by Area.
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Sphere*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Sphere*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -35,7 +35,7 @@
// This is a primitive scorer class for scoring Surface Current.
// Current version assumes only for G4Sphere shape, and the surface
// is defined at the inside of the sphere.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the inside of sphere.
@@ -46,32 +46,27 @@
//
// Created: 2007-08-14 Tsukasa ASO
// 2010-07-22 Introduce Unit specification.
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSSphereSurfaceCurrent3D : public G4PSSphereSurfaceCurrent
{
public: // with description
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
virtual ~G4PSSphereSurfaceCurrent3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
virtual ~G4PSSphereSurfaceCurrent3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -39,7 +39,7 @@
// This is a primitive scorer class for scoring Surface Flux.
// Flux version assumes only for G4Sphere shape, and the surface
// is defined at the inside of the sphere.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the inside of sphere.
@@ -53,47 +53,45 @@
// 29-Mar-2007 T.Aso, Bug fix for momentum direction for out-going flux.
// 2010-07-22 Introduce Unit specification.
// 2010-07-22 Add weighted and divideByArea options
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSSphereSurfaceFlux : public G4VPrimitiveScorer
{
public: // with description
G4PSSphereSurfaceFlux(G4String name, G4int direction, G4int depth=0);
G4PSSphereSurfaceFlux(G4String name, G4int direction,
const G4String& unit, G4int depth=0);
virtual ~G4PSSphereSurfaceFlux();
public: // with description
G4PSSphereSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4int depth = 0);
virtual ~G4PSSphereSurfaceFlux();
inline void Weighted(G4bool flg=true) { weighted = flg; }
// Multiply track weight
inline void Weighted(G4bool flg = true) { weighted = flg; }
// Multiply track weight
inline void DivideByArea(G4bool flg=true) { divideByArea = flg; }
// Divided by Area.
inline void DivideByArea(G4bool flg = true) { divideByArea = flg; }
// Divided by Area.
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*,G4Sphere*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
G4int IsSelectedSurface(G4Step*, G4Sphere*);
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void SetUnit(const G4String& unit);
virtual void SetUnit(const G4String& unit);
protected:
virtual void DefineUnitAndCategory();
protected:
virtual void DefineUnitAndCategory();
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
private:
G4int HCID;
G4int fDirection;
G4THitsMap<G4double>* EvtMap;
G4bool weighted;
G4bool divideByArea;
};
#endif
@@ -36,7 +36,7 @@
// This is a primitive scorer class for scoring Surface Flux.
// Flux version assumes only for G4Sphere shape, and the surface
// is defined at the inside of the sphere.
// The current is given in the unit of area.
// The current is given in the unit of area.
// e.g. (Number of tracks)/mm2.
//
// Surface is defined at the inside of sphere.
@@ -51,26 +51,22 @@
class G4PSSphereSurfaceFlux3D : public G4PSSphereSurfaceFlux
{
public: // with description
G4PSSphereSurfaceFlux3D(G4String name, G4int direction,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
public: // with description
G4PSSphereSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSSphereSurfaceFlux3D(G4String name, G4int direction,
const G4String& unit,
G4int ni=1,G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSSphereSurfaceFlux3D(G4String name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
virtual ~G4PSSphereSurfaceFlux3D();
virtual ~G4PSSphereSurfaceFlux3D();
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
protected: // with description
virtual G4int GetIndex(G4Step*);
private:
G4int fDepthi, fDepthj, fDepthk;
};
#endif
@@ -32,44 +32,36 @@
#include "G4VPrimitiveScorer.hh"
#include "G4THitsMap.hh"
//////////////////////////////////////////////////////////////////////////////////
// (Description)
// This is a primitive scorer class for Debug.
//
//
// Created: 2011-03-24 Tsukasa ASO
//
//
///////////////////////////////////////////////////////////////////////////////
class G4PSStepChecker : public G4VPrimitiveScorer
{
public: // with description
G4PSStepChecker(G4String name, G4int depth=0);
public: // with description
G4PSStepChecker(G4String name, G4int depth = 0);
protected: // with description
virtual G4bool ProcessHits(G4Step*,G4TouchableHistory*);
protected: // with description
virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
public:
virtual ~G4PSStepChecker();
public:
virtual ~G4PSStepChecker();
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
private:
public:
public:
virtual void Initialize(G4HCofThisEvent*);
virtual void EndOfEvent(G4HCofThisEvent*);
virtual void clear();
public:
virtual void DrawAll();
virtual void PrintAll();
private:
public:
};
#endif

Some files were not shown because too many files have changed in this diff Show More