Belle II Software  release-08-01-10
SensitiveDetector.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 /* ECL headers. */
12 #include <ecl/dataobjects/ECLHit.h>
13 #include <ecl/dataobjects/ECLSimHit.h>
14 #include <ecl/dbobjects/ECLHadronComponentEmissionFunction.h>
15 
16 /* Basf2 headers. */
17 #include <framework/database/DBObjPtr.h>
18 #include <framework/datastore/RelationArray.h>
19 #include <framework/datastore/StoreArray.h>
20 #include <simulation/dataobjects/BeamBackHit.h>
21 #include <simulation/kernel/SensitiveDetectorBase.h>
22 
23 /* Geant4 headers. */
24 #include <G4EmCalculator.hh>
25 
26 /* ROOT headers. */
27 #include <Math/Vector3D.h>
28 #include <TGraph.h>
29 
30 namespace Belle2 {
35  namespace ECL {
36  class ECLGeometryPar;
39  public:
41  SensitiveDetector(G4String, G4double, G4double);
42 
45 
47  void Initialize(G4HCofThisEvent* HCTE) override;
48 
50  bool step(G4Step* aStep, G4TouchableHistory* history) override;
51 
53  void EndOfEvent(G4HCofThisEvent* eventHC) override;
54 
55  private:
56  TGraph* m_HadronEmissionFunction = nullptr;
57  double GetHadronIntensityFromDEDX(double);
59  int saveSimHit(G4int, G4int, G4int, G4double, G4double, const G4ThreeVector&, const G4ThreeVector&, double);
60  // members of SensitiveDetector
61  // G4double m_thresholdEnergyDeposit;// Energy Deposit threshold
62  // G4double m_thresholdKineticEnergy;// Kinetic Energy threshold
63  G4EmCalculator m_emCal;
70  int m_trackID;
71  double m_WeightedTime;
72  double m_energyDeposit;
74  G4ThreeVector m_WeightedPos;
75  G4ThreeVector m_momentum;
78  };
81  public:
83  explicit SensitiveDiode(const G4String&);
84 
87 
89  void Initialize(G4HCofThisEvent* HCTE) override;
90 
92  bool step(G4Step* aStep, G4TouchableHistory* history) override;
93 
95  void EndOfEvent(G4HCofThisEvent* eventHC) override;
96 
97  private:
98  // members of SensitiveDiode
101  struct hit_t {
102  int cellId;
103  double e;
104  double t;
105  };
106  int m_trackID;
107  double m_tsum;
108  double m_esum;
110  std::vector<hit_t> m_hits;
111  std::vector<int> m_cells;
113  };
114 
117  public:
119  explicit BkgSensitiveDiode(const G4String&);
120 
122  bool step(G4Step* aStep, G4TouchableHistory* history) override;
123  private:
124  int m_trackID;
125  ROOT::Math::XYZVector m_startPos;
126  ROOT::Math::XYZVector m_startMom;
127  double m_startTime;
128  double m_startEnergy;
130  double m_trackLength;
135  };
136  } // end of namespace ecl
138 } // end of namespace Belle2
139 
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Class for ECL Sensitive Detector for neutron background study.
bool step(G4Step *aStep, G4TouchableHistory *history) override
Process each step and calculate variables defined in ECLHit.
double m_energyDeposit
energy deposited in volume
ROOT::Math::XYZVector m_startPos
particle position at the entrance in volume
BkgSensitiveDiode(const G4String &)
Constructor.
double m_startEnergy
particle energy at the entrance in volume
double m_trackLength
length of the track in the volume
ECLGeometryPar * m_eclp
pointer to ECLGeometryPar
StoreArray< MCParticle > m_mcParticles
MCParticle array.
RelationArray m_eclBeamBkgHitRel
MCParticle to BeamBackHit relation array.
ROOT::Math::XYZVector m_startMom
particle momentum at the entrance in volume
StoreArray< BeamBackHit > m_eclBeamBkgHits
BeamBackHit array.
The Class for ECL Geometry Parameters.
Class for ECL Sensitive Detector.
bool step(G4Step *aStep, G4TouchableHistory *history) override
Process each step and calculate variables defined in ECLHit.
double m_energyDeposit
total energy deposited in a volume by a track
double GetHadronIntensityFromDEDX(double)
Evaluates hadron scintillation component emission function.
double m_hadronenergyDeposit
energy deposited resulting in hadronic scint component
TGraph * m_HadronEmissionFunction
Graph for hadron scintillation component emission function.
StoreArray< ECLSimHit > m_eclSimHits
ECLSimHit array.
G4ThreeVector m_momentum
initial momentum of track before energy deposition inside sensitive volume
DBObjPtr< ECLHadronComponentEmissionFunction > m_ECLHadronComponentEmissionFunction
Hadron Component Emission Function.
G4EmCalculator m_emCal
Used to get dE/dx for pulse shape simulations.
void EndOfEvent(G4HCofThisEvent *eventHC) override
Do what you want to do at the end of each event.
void Initialize(G4HCofThisEvent *HCTE) override
Register ECL hits collection into G4HCofThisEvent.
double m_WeightedTime
average track time weighted by energy deposition
RelationArray m_eclHitRel
MCParticle to ECLHit relation array.
StoreArray< ECLHit > m_eclHits
ECLHit array.
SensitiveDetector(G4String, G4double, G4double)
Constructor.
int saveSimHit(G4int, G4int, G4int, G4double, G4double, const G4ThreeVector &, const G4ThreeVector &, double)
Create ECLSimHit and ECLHit and relations from MCParticle and put them in datastore.
StoreArray< MCParticle > m_mcParticles
MCParticle array.
G4ThreeVector m_WeightedPos
average track position weighted by energy deposition
RelationArray m_eclSimHitRel
MCParticle to ECLSimHit relation array.
Class for ECL Sensitive Detector.
bool step(G4Step *aStep, G4TouchableHistory *history) override
Process each step and calculate variables defined in ECLHit.
std::vector< hit_t > m_hits
array of hits
int m_trackID
current track id
double m_tsum
average track time weighted by energy deposition
std::vector< int > m_cells
array of hitted crystals
SensitiveDiode(const G4String &)
Constructor.
double m_esum
total energy deposited in a volume by a track
void EndOfEvent(G4HCofThisEvent *eventHC) override
Do what you want to do at the end of each event.
void Initialize(G4HCofThisEvent *HCTE) override
Register ECL hits collection into G4HCofThisEvent.
ECLGeometryPar * m_eclp
pointer to ECLGeometryPar
StoreArray< ECLHit > m_eclHits
ECLHit array.
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
Base class for all Sensitive Detectors to create hits during simulation.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.
double t
time of energy deposition in a crystal
double e
energy deposition in a crystal