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 
29 class TimingSD : public SensitiveTkDetector, public Observer<const BeginOfEvent*> {
30 public:
32 
33  ~TimingSD() override;
34 
35  bool ProcessHits(G4Step*, G4TouchableHistory*) override;
36 
37  void Initialize(G4HCofThisEvent* HCE) override;
38  void EndOfEvent(G4HCofThisEvent* eventHC) override;
39  void PrintAll() override;
40 
41  void fillHits(edm::PSimHitContainer&, const std::string&) override;
42  void clearHits() override;
43 
44 protected:
45  void update(const BeginOfEvent*) override;
46 
47  // define time slices
48  void setTimeFactor(double);
49 
50  // define MC truth thresholds
51  void setCuts(double eCut, double historyCut);
52 
53  // by default accumulate hit for the same detector
54  // and time slice, use primary information for fastest
55  // Geant4 particle, check if for this detector new
56  // hit can be merged with the existing one
57  virtual bool checkHit(const G4Step*, BscG4Hit*);
58 
59  void setToLocal(const G4StepPoint* stepPoint, const G4ThreeVector& globalPoint, G4ThreeVector& localPoint);
60 
61  // accessors
62  const G4ThreeVector& getLocalEntryPoint() const { return hitPointLocal; };
63  const G4ThreeVector& getGlobalEntryPoint() const { return hitPoint; };
64 
65  // general method to assign track ID to be stored in hits
66  virtual int getTrackID(const G4Track*);
67 
68 private:
69  void getStepInfo(const G4Step*);
70  bool hitExists(const G4Step*);
71  void createNewHit(const G4Step*);
72  void updateHit();
73  void storeHit(BscG4Hit*);
74 
77 
80 
82  const G4Track* theTrack;
83  const G4StepPoint* preStepPoint;
84  const G4StepPoint* postStepPoint;
85 
87 
88  int primID;
89  int hcID;
90  int tsID;
91  int primaryID;
92  int tSliceID;
93 
94  G4ThreeVector hitPoint;
95  G4ThreeVector hitPointExit;
96  G4ThreeVector hitPointLocal;
97  G4ThreeVector hitPointLocalExit;
98 
99  double tSlice;
100  double timeFactor;
101 
102  double energyCut; // MeV
103  double energyHistoryCut; // MeV
104 
105  double incidentEnergy; // MeV
106  float tof; // ns
107  float edeposit;
109 };
110 
111 #endif
uint32_t previousUnitID
Definition: TimingSD.h:86
void setTimeFactor(double)
Definition: TimingSD.cc:79
void EndOfEvent(G4HCofThisEvent *eventHC) override
Definition: TimingSD.cc:323
void clearHits() override
Definition: TimingSD.cc:373
double timeFactor
Definition: TimingSD.h:100
int hcID
Definition: TimingSD.h:89
float edepositHAD
Definition: TimingSD.h:108
const G4ThreeVector & getGlobalEntryPoint() const
Definition: TimingSD.h:63
G4ThreeVector hitPointLocal
Definition: TimingSD.h:96
void fillHits(edm::PSimHitContainer &, const std::string &) override
Definition: TimingSD.cc:360
int primID
Definition: TimingSD.h:88
virtual bool checkHit(const G4Step *, BscG4Hit *)
Definition: TimingSD.cc:220
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:97
void createNewHit(const G4Step *)
Definition: TimingSD.cc:258
BscG4Hit * currentHit
Definition: TimingSD.h:81
float edepositEM
Definition: TimingSD.h:108
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:89
void setToLocal(const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
Definition: TimingSD.cc:318
TimingSD(const std::string &, const SensitiveDetectorCatalog &, const SimTrackManager *)
Definition: TimingSD.cc:37
void storeHit(BscG4Hit *)
Definition: TimingSD.cc:247
void getStepInfo(const G4Step *)
Definition: TimingSD.cc:113
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
Definition: TimingSD.cc:366
const G4ThreeVector & getLocalEntryPoint() const
Definition: TimingSD.h:62
float tof
Definition: TimingSD.h:106
bool ProcessHits(G4Step *, G4TouchableHistory *) override
Definition: TimingSD.cc:102
int tsID
Definition: TimingSD.h:90
float edeposit
Definition: TimingSD.h:107
TrackingSlaveSD * slave
Definition: TimingSD.h:75
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:76
bool hitExists(const G4Step *)
Definition: TimingSD.cc:188
const G4Track * theTrack
Definition: TimingSD.h:82
double energyHistoryCut
Definition: TimingSD.h:103
void PrintAll() override
Definition: TimingSD.cc:353
const G4StepPoint * preStepPoint
Definition: TimingSD.h:83
~TimingSD() override
Definition: TimingSD.cc:59
int tSliceID
Definition: TimingSD.h:92
double energyCut
Definition: TimingSD.h:102
uint32_t unitID
Definition: TimingSD.h:86
double tSlice
Definition: TimingSD.h:99
void updateHit()
Definition: TimingSD.cc:304
const G4StepPoint * postStepPoint
Definition: TimingSD.h:84
BscG4HitCollection * theHC
Definition: TimingSD.h:79
virtual int getTrackID(const G4Track *)
Definition: TimingSD.cc:375
const SimTrackManager * theManager
Definition: TimingSD.h:78
std::vector< PSimHit > PSimHitContainer
double incidentEnergy
Definition: TimingSD.h:105
G4THitsCollection< BscG4Hit > BscG4HitCollection
void Initialize(G4HCofThisEvent *HCE) override
Definition: TimingSD.cc:64
G4ThreeVector hitPointExit
Definition: TimingSD.h:95
G4ThreeVector hitPoint
Definition: TimingSD.h:94
int primaryID
Definition: TimingSD.h:91