CMS 3D CMS Logo

SensitiveDetector.h
Go to the documentation of this file.
1 #ifndef SimG4Core_SensitiveDetector_H
2 #define SimG4Core_SensitiveDetector_H
3 
7 
8 #include "G4VSensitiveDetector.hh"
9 
10 #include <string>
11 #include <cstdint>
12 
13 class G4Track;
14 class G4Step;
15 class G4HCofThisEvent;
16 class G4TouchableHistory;
17 class G4VPhysicalVolume;
18 
19 class SensitiveDetector : public G4VSensitiveDetector {
20 public:
21  explicit SensitiveDetector(const std::string& iname,
23  bool calo,
24  const std::string& newcollname = "");
25 
26  ~SensitiveDetector() override;
27 
28  void Initialize(G4HCofThisEvent* eventHC) override;
29  G4bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override = 0;
30  void EndOfEvent(G4HCofThisEvent* eventHC) override;
31 
32  virtual uint32_t setDetUnitId(const G4Step* step) = 0;
33  virtual void clearHits() = 0;
34 
35  inline const std::vector<std::string>& getNames() const { return m_namesOfSD; }
36 
37  inline bool isCaloSD() const { return m_isCalo; }
38 
39 protected:
40  // generic geometry methods, all coordinates in mm
42  Local3DPoint InitialStepPosition(const G4Step* step, coordinates) const;
43  Local3DPoint FinalStepPosition(const G4Step* step, coordinates) const;
44 
45  // local coordinates to the volume, in which the step is done
46  Local3DPoint LocalPreStepPosition(const G4Step* step) const;
47  Local3DPoint LocalPostStepPosition(const G4Step* step) const;
48 
49  inline Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector& point) const {
50  return Local3DPoint(point.x(), point.y(), point.z());
51  }
52 
53  void setNames(const std::vector<std::string>&);
54  void NaNTrap(const G4Step* step) const;
55 
56  TrackInformation* cmsTrackInformation(const G4Track* aTrack);
57 
58 private:
59  void AssignSD(const std::string& vname);
60 
61  std::vector<std::string> m_namesOfSD;
62  bool m_isCalo;
63 };
64 
65 #endif
virtual void clearHits()=0
~SensitiveDetector() override
SensitiveDetector(const std::string &iname, const SensitiveDetectorCatalog &, bool calo, const std::string &newcollname="")
G4bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override=0
virtual uint32_t setDetUnitId(const G4Step *step)=0
void AssignSD(const std::string &vname)
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
std::vector< std::string > m_namesOfSD
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const
bool isCaloSD() const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
Local3DPoint LocalPreStepPosition(const G4Step *step) const
void EndOfEvent(G4HCofThisEvent *eventHC) override
void setNames(const std::vector< std::string > &)
const std::vector< std::string > & getNames() const
Local3DPoint LocalPostStepPosition(const G4Step *step) const
step
Definition: StallMonitor.cc:83
void Initialize(G4HCofThisEvent *eventHC) override
void NaNTrap(const G4Step *step) const
Definition: Common.h:9
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9