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 class DDCompactView;
21 
22 class SensitiveDetector : public G4VSensitiveDetector
23 {
24 public:
25  explicit SensitiveDetector(const std::string & iname,
26  const DDCompactView & cpv,
28  edm::ParameterSet const & p,
29  bool calo);
30 
31  ~SensitiveDetector() override;
32 
33  void Initialize(G4HCofThisEvent * eventHC) override;
34  G4bool ProcessHits(G4Step * step ,G4TouchableHistory * tHistory) override = 0;
35  void EndOfEvent(G4HCofThisEvent * eventHC) override;
36 
37  virtual uint32_t setDetUnitId(const G4Step * step) = 0;
38  virtual void clearHits() = 0;
39 
40  inline const std::vector<std::string>& getNames() const { return m_namesOfSD; }
41 
42  inline bool isCaloSD() const { return m_isCalo; }
43 
44 protected:
45 
46  // generic geometry methods, all coordinates in mm
48  Local3DPoint InitialStepPosition(const G4Step * step, coordinates) const;
49  Local3DPoint FinalStepPosition(const G4Step * step, coordinates) const;
50 
51  // local coordinates to the volume, in which the step is done
52  Local3DPoint LocalPreStepPosition(const G4Step * step) const;
53  Local3DPoint LocalPostStepPosition(const G4Step * step) const;
54 
55  inline Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector& point) const
56  { return Local3DPoint(point.x(),point.y(),point.z()); }
57 
58  void setNames(const std::vector<std::string>&);
59  void NaNTrap(const G4Step* step ) const;
60 
61  TrackInformation* cmsTrackInformation(const G4Track* aTrack);
62 
63 private:
64 
65  void AssignSD(const std::string & vname);
66 
67  std::vector<std::string> m_namesOfSD;
68  bool m_isCalo;
69 };
70 
71 #endif
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
virtual void clearHits()=0
~SensitiveDetector() override
G4bool ProcessHits(G4Step *step, G4TouchableHistory *tHistory) override=0
virtual uint32_t setDetUnitId(const G4Step *step)=0
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
void AssignSD(const std::string &vname)
std::vector< std::string > m_namesOfSD
const std::vector< std::string > & getNames() const
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
void EndOfEvent(G4HCofThisEvent *eventHC) override
Local3DPoint LocalPostStepPosition(const G4Step *step) const
void setNames(const std::vector< std::string > &)
Local3DPoint LocalPreStepPosition(const G4Step *step) const
step
bool isCaloSD() const
SensitiveDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
void Initialize(G4HCofThisEvent *eventHC) override
*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
void NaNTrap(const G4Step *step) const
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const