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