Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
Reference in New Issue
Block a user