File indexing completed on 2025-01-18 09:59:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4VPrimitiveScorer_h
0030 #define G4VPrimitiveScorer_h 1
0031
0032 class G4Step;
0033 class G4HCofThisEvent;
0034 class G4TouchableHistory;
0035 #include "G4MultiFunctionalDetector.hh"
0036 #include "G4VSDFilter.hh"
0037 #include "globals.hh"
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 class G4VPrimitiveScorer
0050 {
0051 friend class G4MultiFunctionalDetector;
0052
0053 public:
0054 G4VPrimitiveScorer(G4String name, G4int depth = 0);
0055 virtual ~G4VPrimitiveScorer() = default;
0056
0057
0058
0059
0060 G4int GetCollectionID(G4int);
0061
0062
0063
0064 virtual void Initialize(G4HCofThisEvent*);
0065 virtual void EndOfEvent(G4HCofThisEvent*);
0066 virtual void clear();
0067 virtual void DrawAll();
0068 virtual void PrintAll();
0069
0070 void SetUnit(const G4String& unit) { unitName = unit; }
0071 const G4String& GetUnit() const { return unitName; }
0072 G4double GetUnitValue() const { return unitValue; }
0073
0074
0075 inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d) { detector = d; }
0076 inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const { return detector; }
0077 inline G4String GetName() const { return primitiveName; }
0078 inline void SetFilter(G4VSDFilter* f) { filter = f; }
0079 inline G4VSDFilter* GetFilter() const { return filter; }
0080 inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
0081 inline G4int GetVerboseLevel() const { return verboseLevel; }
0082
0083 inline void SetNijk(G4int i, G4int j, G4int k)
0084 {
0085 fNi = i;
0086 fNj = j;
0087 fNk = k;
0088 }
0089
0090 protected:
0091
0092
0093 G4VSolid* ComputeSolid(G4Step* aStep, G4int replicaIdx);
0094
0095
0096 G4VSolid* ComputeCurrentSolid(G4Step* aStep);
0097
0098
0099 virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*) = 0;
0100
0101
0102
0103
0104 virtual G4int GetIndex(G4Step*);
0105
0106 void CheckAndSetUnit(const G4String& unit, const G4String& category);
0107
0108 protected:
0109 G4String primitiveName;
0110 G4MultiFunctionalDetector* detector{nullptr};
0111 G4VSDFilter* filter{nullptr};
0112 G4int verboseLevel{0};
0113 G4int indexDepth;
0114 G4String unitName{"NoUnit"};
0115 G4double unitValue{1.0};
0116 G4int fNi{0}, fNj{0}, fNk{0};
0117
0118 private:
0119 inline G4bool HitPrimitive(G4Step* aStep, G4TouchableHistory* ROhis)
0120 {
0121 if (filter != nullptr) {
0122 if (! (filter->Accept(aStep))) return false;
0123 }
0124 return ProcessHits(aStep, ROhis);
0125 }
0126 };
0127
0128 #endif