CMS 3D CMS Logo

TimingSD.h
Go to the documentation of this file.
1 #ifndef Forward_TimingSD_h
2 #define Forward_TimingSD_h
3 //
4 // Base sensitive class for timing detectors and sensors
5 //
6 // Created 17 June 2018 V.Ivantchenko
7 //
8 
11 
13 
16 
17 #include <string>
18 
19 class G4Step;
20 class G4StepPoint;
21 class G4Track;
22 class G4VPhysicalVolume;
23 class TrackingSlaveSD;
24 class SimTrackManager;
26 
27 //-------------------------------------------------------------------
28 
30  public Observer<const BeginOfEvent *>{
31 
32 public:
33 
34  TimingSD(const std::string&, const DDCompactView&,
36  const edm::ParameterSet&, const SimTrackManager*);
37 
38  ~TimingSD() override;
39 
40  bool ProcessHits(G4Step *,G4TouchableHistory *) override;
41 
42  void Initialize(G4HCofThisEvent * HCE) override;
43  void EndOfEvent(G4HCofThisEvent * eventHC) override;
44  void PrintAll() override;
45 
46  void fillHits(edm::PSimHitContainer&, const std::string&) override;
47  void clearHits() override;
48 
49 protected:
50 
51  void update(const BeginOfEvent *) override;
52 
53  // define time slices
54  void setTimeFactor(double);
55 
56  // define MC truth thresholds
57  void setCuts(double eCut, double historyCut);
58 
59  // by default accumulate hit for the same detector
60  // and time slice, use primary information for fastest
61  // Geant4 particle, check if for this detector new
62  // hit can be merged with the existing one
63  virtual bool checkHit(const G4Step*, BscG4Hit*);
64 
65  void setToLocal(const G4StepPoint* stepPoint,
66  const G4ThreeVector& globalPoint, G4ThreeVector& localPoint);
67 
68  // accessors
69  const G4ThreeVector& getLocalEntryPoint() const { return hitPointLocal; };
70  const G4ThreeVector& getGlobalEntryPoint() const { return hitPoint; };
71 
72 private:
73  void getStepInfo(const G4Step*);
74  bool hitExists(const G4Step*);
75  void createNewHit(const G4Step*);
76  void updateHit();
77  void storeHit(BscG4Hit*);
78 
81 
84 
86  const G4Track* theTrack;
87  const G4StepPoint* preStepPoint;
88  const G4StepPoint* postStepPoint;
89 
91 
92  int primID;
93  int hcID;
94  int tsID;
95  int primaryID;
96  int tSliceID;
97 
98  G4ThreeVector hitPoint;
99  G4ThreeVector hitPointExit;
100  G4ThreeVector hitPointLocal;
101  G4ThreeVector hitPointLocalExit;
102 
103  double tSlice;
104  double timeFactor;
105 
106  double energyCut; // MeV
107  double energyHistoryCut; // MeV
108 
109  double incidentEnergy; // MeV
110  float tof; // ns
111  float edeposit;
113 };
114 
115 #endif
116 
117 
118 
119 
uint32_t previousUnitID
Definition: TimingSD.h:90
void setTimeFactor(double)
Definition: TimingSD.cc:77
void EndOfEvent(G4HCofThisEvent *eventHC) override
Definition: TimingSD.cc:308
void clearHits() override
Definition: TimingSD.cc:346
double timeFactor
Definition: TimingSD.h:104
int hcID
Definition: TimingSD.h:93
float edepositHAD
Definition: TimingSD.h:112
G4ThreeVector hitPointLocal
Definition: TimingSD.h:100
void fillHits(edm::PSimHitContainer &, const std::string &) override
Definition: TimingSD.cc:337
const G4ThreeVector & getLocalEntryPoint() const
Definition: TimingSD.h:69
int primID
Definition: TimingSD.h:92
virtual bool checkHit(const G4Step *, BscG4Hit *)
Definition: TimingSD.cc:189
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:101
void createNewHit(const G4Step *)
Definition: TimingSD.cc:228
BscG4Hit * currentHit
Definition: TimingSD.h:85
float edepositEM
Definition: TimingSD.h:112
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:87
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
void setToLocal(const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
Definition: TimingSD.cc:299
void storeHit(BscG4Hit *)
Definition: TimingSD.cc:217
void getStepInfo(const G4Step *)
Definition: TimingSD.cc:111
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
Definition: TimingSD.cc:341
float tof
Definition: TimingSD.h:110
bool ProcessHits(G4Step *, G4TouchableHistory *) override
Definition: TimingSD.cc:99
int tsID
Definition: TimingSD.h:94
float edeposit
Definition: TimingSD.h:111
TrackingSlaveSD * slave
Definition: TimingSD.h:79
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:80
bool hitExists(const G4Step *)
Definition: TimingSD.cc:161
const G4Track * theTrack
Definition: TimingSD.h:86
double energyHistoryCut
Definition: TimingSD.h:107
const G4ThreeVector & getGlobalEntryPoint() const
Definition: TimingSD.h:70
void PrintAll() override
Definition: TimingSD.cc:332
const G4StepPoint * preStepPoint
Definition: TimingSD.h:87
~TimingSD() override
Definition: TimingSD.cc:54
int tSliceID
Definition: TimingSD.h:96
double energyCut
Definition: TimingSD.h:106
uint32_t unitID
Definition: TimingSD.h:90
double tSlice
Definition: TimingSD.h:103
void updateHit()
Definition: TimingSD.cc:282
TimingSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
Definition: TimingSD.cc:40
const G4StepPoint * postStepPoint
Definition: TimingSD.h:88
BscG4HitCollection * theHC
Definition: TimingSD.h:83
const SimTrackManager * theManager
Definition: TimingSD.h:82
std::vector< PSimHit > PSimHitContainer
double incidentEnergy
Definition: TimingSD.h:109
G4THitsCollection< BscG4Hit > BscG4HitCollection
void Initialize(G4HCofThisEvent *HCE) override
Definition: TimingSD.cc:59
G4ThreeVector hitPointExit
Definition: TimingSD.h:99
G4ThreeVector hitPoint
Definition: TimingSD.h:98
int primaryID
Definition: TimingSD.h:95