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 private:
66  void getStepInfo(const G4Step*);
67  bool hitExists(const G4Step*);
68  void createNewHit(const G4Step*);
69  void updateHit();
70  void storeHit(BscG4Hit*);
71 
74 
77 
79  const G4Track* theTrack;
80  const G4StepPoint* preStepPoint;
81  const G4StepPoint* postStepPoint;
82 
84 
85  int primID;
86  int hcID;
87  int tsID;
88  int primaryID;
89  int tSliceID;
90 
91  G4ThreeVector hitPoint;
92  G4ThreeVector hitPointExit;
93  G4ThreeVector hitPointLocal;
94  G4ThreeVector hitPointLocalExit;
95 
96  double tSlice;
97  double timeFactor;
98 
99  double energyCut; // MeV
100  double energyHistoryCut; // MeV
101 
102  double incidentEnergy; // MeV
103  float tof; // ns
104  float edeposit;
106 };
107 
108 #endif
uint32_t previousUnitID
Definition: TimingSD.h:83
void setTimeFactor(double)
Definition: TimingSD.cc:79
void EndOfEvent(G4HCofThisEvent *eventHC) override
Definition: TimingSD.cc:317
void clearHits() override
Definition: TimingSD.cc:367
double timeFactor
Definition: TimingSD.h:97
int hcID
Definition: TimingSD.h:86
float edepositHAD
Definition: TimingSD.h:105
const G4ThreeVector & getGlobalEntryPoint() const
Definition: TimingSD.h:63
G4ThreeVector hitPointLocal
Definition: TimingSD.h:93
void fillHits(edm::PSimHitContainer &, const std::string &) override
Definition: TimingSD.cc:354
int primID
Definition: TimingSD.h:85
virtual bool checkHit(const G4Step *, BscG4Hit *)
Definition: TimingSD.cc:214
G4ThreeVector hitPointLocalExit
Definition: TimingSD.h:94
void createNewHit(const G4Step *)
Definition: TimingSD.cc:252
BscG4Hit * currentHit
Definition: TimingSD.h:78
float edepositEM
Definition: TimingSD.h:105
void setCuts(double eCut, double historyCut)
Definition: TimingSD.cc:89
void setToLocal(const G4StepPoint *stepPoint, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint)
Definition: TimingSD.cc:312
TimingSD(const std::string &, const SensitiveDetectorCatalog &, const SimTrackManager *)
Definition: TimingSD.cc:37
void storeHit(BscG4Hit *)
Definition: TimingSD.cc:241
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:360
const G4ThreeVector & getLocalEntryPoint() const
Definition: TimingSD.h:62
float tof
Definition: TimingSD.h:103
bool ProcessHits(G4Step *, G4TouchableHistory *) override
Definition: TimingSD.cc:102
int tsID
Definition: TimingSD.h:87
float edeposit
Definition: TimingSD.h:104
TrackingSlaveSD * slave
Definition: TimingSD.h:72
G4ProcessTypeEnumerator * theEnumerator
Definition: TimingSD.h:73
bool hitExists(const G4Step *)
Definition: TimingSD.cc:182
const G4Track * theTrack
Definition: TimingSD.h:79
double energyHistoryCut
Definition: TimingSD.h:100
void PrintAll() override
Definition: TimingSD.cc:347
const G4StepPoint * preStepPoint
Definition: TimingSD.h:80
~TimingSD() override
Definition: TimingSD.cc:59
int tSliceID
Definition: TimingSD.h:89
double energyCut
Definition: TimingSD.h:99
uint32_t unitID
Definition: TimingSD.h:83
double tSlice
Definition: TimingSD.h:96
void updateHit()
Definition: TimingSD.cc:298
const G4StepPoint * postStepPoint
Definition: TimingSD.h:81
BscG4HitCollection * theHC
Definition: TimingSD.h:76
const SimTrackManager * theManager
Definition: TimingSD.h:75
std::vector< PSimHit > PSimHitContainer
double incidentEnergy
Definition: TimingSD.h:102
G4THitsCollection< BscG4Hit > BscG4HitCollection
void Initialize(G4HCofThisEvent *HCE) override
Definition: TimingSD.cc:64
G4ThreeVector hitPointExit
Definition: TimingSD.h:92
G4ThreeVector hitPoint
Definition: TimingSD.h:91
int primaryID
Definition: TimingSD.h:88