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  ~SensitiveDetector() override;
30 
31  void Initialize(G4HCofThisEvent * eventHC) override;
32  G4bool ProcessHits(G4Step * step ,G4TouchableHistory * tHistory) override = 0;
33  void EndOfEvent(G4HCofThisEvent * eventHC) override;
34 
35  virtual uint32_t setDetUnitId(const G4Step * step) = 0;
36  virtual void clearHits() = 0;
37 
38  inline const std::vector<std::string>& getNames() const { return namesOfSD; }
39 
40 protected:
41 
42  // generic geometry methods, all coordinates in mm
44  Local3DPoint InitialStepPosition(const G4Step * step, coordinates) const;
45  Local3DPoint FinalStepPosition(const G4Step * step, coordinates) const;
46 
47  Local3DPoint LocalPreStepPosition(const G4Step * step) const;
48  Local3DPoint LocalPostStepPosition(const G4Step * step) const;
49 
50  inline Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector& point) const
51  { return Local3DPoint(point.x(),point.y(),point.z()); }
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 
60  void AssignSD(const std::string & vname);
61 
62  std::vector<std::string> namesOfSD;
63 };
64 
65 #endif
SensitiveDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
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)
const std::vector< std::string > & getNames() const
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
std::vector< std::string > namesOfSD
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
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