CMS 3D CMS Logo

SensitiveDetector.h
Go to the documentation of this file.
1 #ifndef SimG4Core_SensitiveDetector_H
2 #define SimG4Core_SensitiveDetector_H
3 
5 
9 
10 #include "G4VSensitiveDetector.hh"
11 
12 #include <string>
13 #include <cstdint>
14 
15 class G4Track;
16 class G4Step;
17 class G4HCofThisEvent;
18 class G4TouchableHistory;
19 class G4VPhysicalVolume;
20 
21 namespace edm {
22  class EventSetup;
23 }
24 
25 class SensitiveDetector : public G4VSensitiveDetector {
26 public:
27  explicit SensitiveDetector(const std::string& iname,
28  const edm::EventSetup& es,
30  edm::ParameterSet const& p,
31  bool calo);
32 
33  ~SensitiveDetector() override;
34 
35  void Initialize(G4HCofThisEvent* eventHC) override;
36  G4bool ProcessHits(G4Step* step, G4TouchableHistory* tHistory) override = 0;
37  void EndOfEvent(G4HCofThisEvent* eventHC) override;
38 
39  virtual uint32_t setDetUnitId(const G4Step* step) = 0;
40  virtual void clearHits() = 0;
41 
42  inline const std::vector<std::string>& getNames() const { return m_namesOfSD; }
43 
44  inline bool isCaloSD() const { return m_isCalo; }
45 
46 protected:
47  // generic geometry methods, all coordinates in mm
48  enum coordinates { WorldCoordinates, LocalCoordinates };
49  Local3DPoint InitialStepPosition(const G4Step* step, coordinates) const;
50  Local3DPoint FinalStepPosition(const G4Step* step, coordinates) const;
51 
52  // local coordinates to the volume, in which the step is done
53  Local3DPoint LocalPreStepPosition(const G4Step* step) const;
54  Local3DPoint LocalPostStepPosition(const G4Step* step) const;
55 
56  inline Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector& point) const {
57  return Local3DPoint(point.x(), point.y(), point.z());
58  }
59 
60  void setNames(const std::vector<std::string>&);
61  void NaNTrap(const G4Step* step) const;
62 
63  TrackInformation* cmsTrackInformation(const G4Track* aTrack);
64 
65 private:
66  void AssignSD(const std::string& vname);
67 
68  std::vector<std::string> m_namesOfSD;
69  bool m_isCalo;
70 };
71 
72 #endif
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
std::vector< std::string > m_namesOfSD
const std::vector< std::string > & getNames() const
HLT enums.
step
Definition: StallMonitor.cc:94
bool isCaloSD() const
*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