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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /digits_hits/detector/include/G4VSensitiveDetector.hh (Version 11.3.0) and /digits_hits/detector/include/G4VSensitiveDetector.hh (Version 11.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4VSensitiveDetector                        << 
 27 //                                                 26 //
 28 // Class description:                          << 
 29 //                                                 27 //
 30 // This is the abstract base class of the sens <<  28 
 31 // sensitive detector which generates hits mus << 
 32 // class.                                      << 
 33 // In the derived class constructor, name(s) o << 
 34 // are made by the sensitive detector must be  << 
 35 // vector.                                     << 
 36 //                                             << 
 37 // Author: Makoto Asai                         << 
 38 // ------------------------------------------- << 
 39 #ifndef G4VSensitiveDetector_h                     29 #ifndef G4VSensitiveDetector_h
 40 #define G4VSensitiveDetector_h 1                   30 #define G4VSensitiveDetector_h 1
 41                                                    31 
 42 #include "G4CollectionNameVector.hh"               32 #include "G4CollectionNameVector.hh"
 43 #include "G4HCofThisEvent.hh"                      33 #include "G4HCofThisEvent.hh"
 44 #include "G4Step.hh"                               34 #include "G4Step.hh"
 45 #include "G4TouchableHistory.hh"                   35 #include "G4TouchableHistory.hh"
 46 #include "G4VHit.hh"                               36 #include "G4VHit.hh"
 47 #include "G4VReadOutGeometry.hh"                   37 #include "G4VReadOutGeometry.hh"
 48 #include "G4VSDFilter.hh"                          38 #include "G4VSDFilter.hh"
 49                                                    39 
                                                   >>  40 // class description:
                                                   >>  41 //
                                                   >>  42 //  This is the abstract base class of the sensitive detector. The user's
                                                   >>  43 // sensitive detector which generates hits must be derived from this
                                                   >>  44 // class.
                                                   >>  45 //  In the derived class constructor, name(s) of hits collection(s) which
                                                   >>  46 // are made by the sensitive detector must be set to "collectionName" string
                                                   >>  47 // vector.
                                                   >>  48 
 50 class G4VSensitiveDetector                         49 class G4VSensitiveDetector
 51 {                                                  50 {
 52  public:                                           51  public:
 53   // Constructors. The user's concrete class m     52   // Constructors. The user's concrete class must use one of these constructors
 54   // by the constructor initializer of the der     53   // by the constructor initializer of the derived class. The name of
 55   // the sensitive detector must be unique.        54   // the sensitive detector must be unique.
 56   explicit G4VSensitiveDetector(const G4String <<  55   explicit G4VSensitiveDetector(G4String name);
 57   G4VSensitiveDetector(const G4VSensitiveDetec     56   G4VSensitiveDetector(const G4VSensitiveDetector& right);
 58   G4VSensitiveDetector& operator=(const G4VSen     57   G4VSensitiveDetector& operator=(const G4VSensitiveDetector& right);
 59   virtual ~G4VSensitiveDetector() = default;       58   virtual ~G4VSensitiveDetector() = default;
 60                                                    59 
 61   G4bool operator==(const G4VSensitiveDetector     60   G4bool operator==(const G4VSensitiveDetector& right) const;
 62   G4bool operator!=(const G4VSensitiveDetector     61   G4bool operator!=(const G4VSensitiveDetector& right) const;
 63                                                    62 
 64   //  These two methods are invoked at the beg     63   //  These two methods are invoked at the begining and at the end of each
 65   // event. The hits collection(s) created by      64   // event. The hits collection(s) created by this sensitive detector must
 66   // be set to the G4HCofThisEvent object at o     65   // be set to the G4HCofThisEvent object at one of these two methods.
 67   virtual void Initialize(G4HCofThisEvent*) {}     66   virtual void Initialize(G4HCofThisEvent*) {}
 68   virtual void EndOfEvent(G4HCofThisEvent*) {}     67   virtual void EndOfEvent(G4HCofThisEvent*) {}
 69                                                    68 
 70   //  This method is invoked if the event abor     69   //  This method is invoked if the event abortion is occured. Hits collections
 71   // created but not beibg set to G4HCofThisEv     70   // created but not beibg set to G4HCofThisEvent at the event should be
 72   // deleted. Collection(s) which have already     71   // deleted. Collection(s) which have already set to G4HCofThisEvent will be
 73   // deleted automatically.                        72   // deleted automatically.
 74   virtual void clear() {}                          73   virtual void clear() {}
 75                                                    74 
 76   virtual void DrawAll() {}                        75   virtual void DrawAll() {}
 77   virtual void PrintAll() {}                       76   virtual void PrintAll() {}
 78                                                    77 
 79   //  This is the public method invoked by G4S     78   //  This is the public method invoked by G4SteppingManager for generating
 80   // hit(s). The actual user's implementation      79   // hit(s). The actual user's implementation for generating hit(s) must be
 81   // implemented in GenerateHits() virtual pro     80   // implemented in GenerateHits() virtual protected method. This method
 82   // MUST NOT be overriden.                        81   // MUST NOT be overriden.
 83   inline G4bool Hit(G4Step* aStep)                 82   inline G4bool Hit(G4Step* aStep)
 84   {                                                83   {
 85     G4TouchableHistory* ROhis = nullptr;           84     G4TouchableHistory* ROhis = nullptr;
 86     if (! isActive()) return false;                85     if (! isActive()) return false;
 87     if (filter != nullptr) {                       86     if (filter != nullptr) {
 88       if (! (filter->Accept(aStep))) return fa     87       if (! (filter->Accept(aStep))) return false;
 89     }                                              88     }
 90     if (ROgeometry != nullptr) {                   89     if (ROgeometry != nullptr) {
 91       if (! (ROgeometry->CheckROVolume(aStep,      90       if (! (ROgeometry->CheckROVolume(aStep, ROhis))) return false;
 92     }                                              91     }
 93     return ProcessHits(aStep, ROhis);              92     return ProcessHits(aStep, ROhis);
 94   }                                                93   }
 95                                                    94 
 96   //  Register the Readout geometry.               95   //  Register the Readout geometry.
 97   inline void SetROgeometry(G4VReadOutGeometry     96   inline void SetROgeometry(G4VReadOutGeometry* value) { ROgeometry = value; }
 98                                                    97 
 99   //  Register a filter                            98   //  Register a filter
100   inline void SetFilter(G4VSDFilter* value) {      99   inline void SetFilter(G4VSDFilter* value) { filter = value; }
101                                                   100 
102   inline G4int GetNumberOfCollections() const     101   inline G4int GetNumberOfCollections() const { return G4int(collectionName.size()); }
103   inline const G4String& GetCollectionName(G4i << 102   inline G4String GetCollectionName(G4int id) const { return collectionName[id]; }
104   inline void SetVerboseLevel(G4int vl) { verb    103   inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
105   inline void Activate(G4bool activeFlag) { ac    104   inline void Activate(G4bool activeFlag) { active = activeFlag; }
106   inline G4bool isActive() const { return acti    105   inline G4bool isActive() const { return active; }
107   inline const G4String& GetName() const { ret << 106   inline G4String GetName() const { return SensitiveDetectorName; }
108   inline const G4String& GetPathName() const { << 107   inline G4String GetPathName() const { return thePathName; }
109   inline const G4String& GetFullPathName() con << 108   inline G4String GetFullPathName() const { return fullPathName; }
110   inline G4VReadOutGeometry* GetROgeometry() c    109   inline G4VReadOutGeometry* GetROgeometry() const { return ROgeometry; }
111   inline G4VSDFilter* GetFilter() const { retu    110   inline G4VSDFilter* GetFilter() const { return filter; }
112                                                   111 
113   virtual G4VSensitiveDetector* Clone() const;    112   virtual G4VSensitiveDetector* Clone() const;
114                                                   113 
115  protected:  // with description                  114  protected:  // with description
116   //  The user MUST implement this method for     115   //  The user MUST implement this method for generating hit(s) using the
117   // information of G4Step object. Note that t    116   // information of G4Step object. Note that the volume and the position
118   // information is kept in PreStepPoint of G4    117   // information is kept in PreStepPoint of G4Step.
119   //  Be aware that this method is a protected    118   //  Be aware that this method is a protected method and it sill be invoked
120   // by Hit() method of Base class after Reado    119   // by Hit() method of Base class after Readout geometry associated to the
121   // sensitive detector is handled.               120   // sensitive detector is handled.
122   //  "ROhist" will be given only is a Readout    121   //  "ROhist" will be given only is a Readout geometry is defined to this
123   // sensitive detector. The G4TouchableHistor    122   // sensitive detector. The G4TouchableHistory object of the tracking geometry
124   // is stored in the PreStepPoint object of G    123   // is stored in the PreStepPoint object of G4Step.
125   virtual G4bool ProcessHits(G4Step* aStep, G4    124   virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist) = 0;
126                                                   125 
127   //  This is a utility method which returns t    126   //  This is a utility method which returns the hits collection ID of the
128   // "i"-th collection. "i" is the order (star    127   // "i"-th collection. "i" is the order (starting with zero) of the collection
129   // whose name is stored to the collectionNam    128   // whose name is stored to the collectionName protected vector.
130   virtual G4int GetCollectionID(G4int i);         129   virtual G4int GetCollectionID(G4int i);
131                                                   130 
132  protected:                                       131  protected:
133   //  This protected name vector must be fille    132   //  This protected name vector must be filled at the constructor of the user's
134   // concrete class for registering the name(s    133   // concrete class for registering the name(s) of hits collection(s) being
135   // created by this particular sensitive dete    134   // created by this particular sensitive detector.
136   G4CollectionNameVector collectionName;          135   G4CollectionNameVector collectionName;
137                                                   136 
138   G4String SensitiveDetectorName;  // detector    137   G4String SensitiveDetectorName;  // detector name
139   G4String thePathName;  // directory path        138   G4String thePathName;  // directory path
140   G4String fullPathName;  // path + detector n    139   G4String fullPathName;  // path + detector name
141   G4int verboseLevel{0};                          140   G4int verboseLevel{0};
142   G4bool active{true};                            141   G4bool active{true};
143   G4VReadOutGeometry* ROgeometry{nullptr};        142   G4VReadOutGeometry* ROgeometry{nullptr};
144   G4VSDFilter* filter{nullptr};                   143   G4VSDFilter* filter{nullptr};
145 };                                                144 };
146                                                   145 
147 #endif                                            146 #endif
148                                                   147