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>
48 std::string subDet = subDett;
50 else if (subDet ==
"PXD")
m_subDet = 1;
51 else if (subDet ==
"SVD")
m_subDet = 2;
52 else if (subDet ==
"CDC")
m_subDet = 3;
53 else if (subDet ==
"ARICH")
m_subDet = 4;
54 else if (subDet ==
"TOP")
m_subDet = 5;
55 else if (subDet ==
"ECL")
m_subDet = 6;
56 else if (subDet ==
"EKLM")
m_subDet = 7;
57 else if (subDet ==
"BKLM")
m_subDet = 8;
61 const int nc[] = {3, 4, 6, 9, 2, 9, 6, 4};
62 const int indx[] = {96, 288, 864, 1151, 7776, 8064, 8544, 8736};
63 std::vector<int> indxv(indx, indx +
sizeof(indx) /
sizeof(
int));
64 m_eclrepscale = nc[upper_bound(indxv.begin(), indxv.end(), iden) - indxv.begin()];
75 const G4StepPoint& preStep = *aStep->GetPreStepPoint();
76 G4Track& track = *aStep->GetTrack();
82 const G4ThreeVector& worldPosition = preStep.GetPosition();
86 const G4ThreeVector& momentum = preStep.GetMomentum() ;
104 if (track.GetNextVolume() != track.GetVolume() || track.GetTrackStatus() >= fStopAndKill) {
105 int pdgCode = track.GetDefinition()->GetPDGEncoding();
106 double endEnergy = track.GetKineticEnergy() *
Unit::MeV;
107 double neutWeight = 0;
116 int sector = preStep.GetTouchable()->GetCopyNumber(1);
117 if ((sector == 0) && (
m_eclrepscale == 2) && ((
id & 1) != 0))
id += 144;
126 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.
SensitiveDetectorBase(const std::string &name, Const::EDetector subdetector)
Create a new Sensitive detecor with a given name and belonging to a given subdetector.
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.