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
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
SensitiveDetector::clearHits
virtual void clearHits()=0
SensitiveDetector::~SensitiveDetector
~SensitiveDetector() override
Definition: SensitiveDetector.cc:43
step
step
Definition: StallMonitor.cc:94
SensitiveDetector::NaNTrap
void NaNTrap(const G4Step *step) const
Definition: SensitiveDetector.cc:110
SensitiveDetector::ProcessHits
G4bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override=0
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SensitiveDetector::AssignSD
void AssignSD(const std::string &vname)
Definition: SensitiveDetector.cc:49
SensitiveDetector::coordinates
coordinates
Definition: SensitiveDetector.h:48
SensitiveDetector
Definition: SensitiveDetector.h:25
SensitiveDetector::m_namesOfSD
std::vector< std::string > m_namesOfSD
Definition: SensitiveDetector.h:68
SensitiveDetector::setDetUnitId
virtual uint32_t setDetUnitId(const G4Step *step)=0
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
Point3DBase< float, LocalTag >
SensitiveDetector::FinalStepPosition
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
Definition: SensitiveDetector.cc:70
SensitiveDetector::LocalPreStepPosition
Local3DPoint LocalPreStepPosition(const G4Step *step) const
Definition: SensitiveDetector.cc:82
SensitiveDetector::InitialStepPosition
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const
Definition: SensitiveDetector.cc:58
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SensitiveDetectorCatalog.h
SensitiveDetector::ConvertToLocal3DPoint
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
Definition: SensitiveDetector.h:56
TrackInformation
Definition: TrackInformation.h:8
SensitiveDetector::LocalCoordinates
Definition: SensitiveDetector.h:48
SensitiveDetector::isCaloSD
bool isCaloSD() const
Definition: SensitiveDetector.h:44
edm::EventSetup
Definition: EventSetup.h:57
TrackInformation.h
SensitiveDetector::m_isCalo
bool m_isCalo
Definition: SensitiveDetector.h:69
SensitiveDetector::getNames
const std::vector< std::string > & getNames() const
Definition: SensitiveDetector.h:42
SensitiveDetector::setNames
void setNames(const std::vector< std::string > &)
Definition: SensitiveDetector.cc:105
SensitiveDetector::cmsTrackInformation
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
Definition: SensitiveDetector.cc:96
SensitiveDetector::Initialize
void Initialize(G4HCofThisEvent *eventHC) override
Definition: SensitiveDetector.cc:45
LocalPoint.h
SensitiveDetector::LocalPostStepPosition
Local3DPoint LocalPostStepPosition(const G4Step *step) const
Definition: SensitiveDetector.cc:89
SensitiveDetector::WorldCoordinates
Definition: SensitiveDetector.h:48
SensitiveDetector::EndOfEvent
void EndOfEvent(G4HCofThisEvent *eventHC) override
Definition: SensitiveDetector.cc:47
SensitiveDetector::SensitiveDetector
SensitiveDetector(const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
Definition: SensitiveDetector.cc:18
EventSetup
ParameterSet.h
calo
Definition: Common.h:9
point
*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
Local3DPoint
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9