Belle II Software  release-06-01-15
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 #include <simulation/kernel/SensitiveDetectorBase.h>
12 #include <simulation/dataobjects/BeamBackHit.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/RelationArray.h>
15 #include <framework/database/DBObjPtr.h>
16 #include <ecl/dataobjects/ECLSimHit.h>
17 #include <ecl/dataobjects/ECLHit.h>
18 #include <ecl/dbobjects/ECLHadronComponentEmissionFunction.h>
19 
20 #include "G4EmCalculator.hh"
21 
22 #include "TGraph.h"
23 
24 namespace Belle2 {
29  namespace ECL {
30  class ECLGeometryPar;
33  public:
35  SensitiveDetector(G4String, G4double, G4double);
36 
39 
41  void Initialize(G4HCofThisEvent* HCTE) override;
42 
44  bool step(G4Step* aStep, G4TouchableHistory* history) override;
45 
47  void EndOfEvent(G4HCofThisEvent* eventHC) override;
48 
49  private:
50  TGraph* m_HadronEmissionFunction = nullptr;
51  double GetHadronIntensityFromDEDX(double);
53  int saveSimHit(G4int, G4int, G4int, G4double, G4double, const G4ThreeVector&, const G4ThreeVector&, double);
54  // members of SensitiveDetector
55  // G4double m_thresholdEnergyDeposit;// Energy Deposit threshold
56  // G4double m_thresholdKineticEnergy;// Kinetic Energy threshold
57  G4EmCalculator m_emCal;
64  int m_trackID;
65  double m_WeightedTime;
66  double m_energyDeposit;
68  G4ThreeVector m_WeightedPos;
69  G4ThreeVector m_momentum;
72  };
75  public:
77  explicit SensitiveDiode(const G4String&);
78 
81 
83  void Initialize(G4HCofThisEvent* HCTE) override;
84 
86  bool step(G4Step* aStep, G4TouchableHistory* history) override;
87 
89  void EndOfEvent(G4HCofThisEvent* eventHC) override;
90 
91  private:
92  // members of SensitiveDiode
95  struct hit_t {
96  int cellId;
97  double e;
98  double t;
99  };
100  int m_trackID;
101  double m_tsum;
102  double m_esum;
104  std::vector<hit_t> m_hits;
105  std::vector<int> m_cells;
107  };
108 
111  public:
113  explicit BkgSensitiveDiode(const G4String&);
114 
116  bool step(G4Step* aStep, G4TouchableHistory* history) override;
117  private:
118  int m_trackID;
119  TVector3 m_startPos;
120  TVector3 m_startMom;
121  double m_startTime;
122  double m_startEnergy;
124  double m_trackLength;
129  };
130  } // end of namespace ecl
132 } // end of namespace Belle2
133 
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
TVector3 m_startMom
particle momentum at the entrance in volume
BkgSensitiveDiode(const G4String &)
Constructor.
TVector3 m_startPos
particle position at the entrance in volume
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.
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