9#include <simulation/background/BkgSensitiveDetector.h>
10#include <simulation/background/BkgNeutronWeight.h>
11#include <simulation/dataobjects/BeamBackHit.h>
12#include <framework/gearbox/Unit.h>
13#include <framework/gearbox/Const.h>
18#include <framework/datastore/StoreArray.h>
19#include <framework/datastore/RelationArray.h>
32 Simulation::SensitiveDetectorBase(
"BKG",
Const::invalidDetector), m_trackID(0), m_startPos(0., 0., 0.), m_startMom(0., 0., 0.),
33 m_startTime(0), m_startEnergy(0), m_energyDeposit(0), m_trackLength(0.)
49 std::string subDet = subDett;
51 else if (subDet ==
"PXD")
m_subDet = 1;
52 else if (subDet ==
"SVD")
m_subDet = 2;
53 else if (subDet ==
"CDC")
m_subDet = 3;
54 else if (subDet ==
"ARICH")
m_subDet = 4;
55 else if (subDet ==
"TOP")
m_subDet = 5;
56 else if (subDet ==
"ECL")
m_subDet = 6;
57 else if (subDet ==
"EKLM")
m_subDet = 7;
58 else if (subDet ==
"BKLM")
m_subDet = 8;
62 const int nc[] = {3, 4, 6, 9, 2, 9, 6, 4};
63 const int indx[] = {96, 288, 864, 1151, 7776, 8064, 8544, 8736};
64 std::vector<int> indxv(indx, indx +
sizeof(indx) /
sizeof(
int));
65 m_eclrepscale = nc[upper_bound(indxv.begin(), indxv.end(), iden) - indxv.begin()];
76 const G4StepPoint& preStep = *aStep->GetPreStepPoint();
77 G4Track& track = *aStep->GetTrack();
83 const G4ThreeVector& worldPosition = preStep.GetPosition();
87 const G4ThreeVector& momentum = preStep.GetMomentum() ;
105 if (track.GetNextVolume() != track.GetVolume() || track.GetTrackStatus() >= fStopAndKill) {
106 int pdgCode = track.GetDefinition()->GetPDGEncoding();
107 double endEnergy = track.GetKineticEnergy() *
Unit::MeV;
108 double neutWeight = 0;
117 int sector = preStep.GetTouchable()->GetCopyNumber(1);
118 if ((sector == 0) && (
m_eclrepscale == 2) && ((
id & 1) != 0))
id += 144;
127 RelationArray relBeamBackHitToMCParticle(mcParticles, beamBackHits);
The class to get the weighting factor for a 1-MeV-equivalent neutron flux on silicon.
double m_energyDeposit
Energy deposited in volume.
ROOT::Math::XYZVector m_startPos
Particle position at the entrance in volume.
double m_startEnergy
Particle energy at the entrance in volume.
double m_startTime
Global time.
double m_trackLength
Length of the track in the volume.
int m_eclrepscale
Replica (=sector) scale in ECL.
int m_subDet
Subdetector id number.
ROOT::Math::XYZVector m_startMom
Particle momentum at the entrance in volume.
int m_identifier
Identifier of subdetector component.
This class provides a set of constants for the framework.
static const ParticleType neutron
neutron particle
Low-level class to create/modify relations between StoreArrays.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
static void registerMCParticleRelation(const std::string &name, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight)
Register an relation involving MCParticles.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
static const double mm
[millimeters]
static const double MeV
[megaelectronvolt]
static const double cm
Standard units with the value = 1.
double getWeight(double ke)
Get weighting factor to convert a neutron to its 1-MeV equivalent.
static BkgNeutronWeight & getInstance()
Return a reference to the singleton BkgNeutronWeight instance.
BkgSensitiveDetector(const char *subDet, int iden=0)
Constructor.
bool step(G4Step *aStep, G4TouchableHistory *) override
Process each step and calculate variables defined in PXDSimHit.
Abstract base class for different kinds of events.