Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -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