53 G4Track& photon = *aStep->GetTrack();
56 if (photon.GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
return false;
66 G4ThreeVector localPosition = photon.GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(photon.GetPosition());
67 double xLocal = localPosition.x() *
Unit::mm;
68 double yLocal = localPosition.y() *
Unit::mm;
73 auto* info =
dynamic_cast<Simulation::TrackInfo*
>(photon.GetUserInformation());
75 applyQE = info->getStatus() < 3;
76 fraction = info->getFraction();
80 if (qeffi == 0 or gRandom->Uniform() * fraction > qeffi) {
81 photon.SetTrackStatus(fStopAndKill);
85 info->setFraction(qeffi);
89 const G4ThreeVector& g_detPoint = photon.GetPosition();
90 const G4ThreeVector& g_detMomDir = photon.GetMomentumDirection();
91 ROOT::Math::XYZPoint detPoint(g_detPoint.x(), g_detPoint.y(), g_detPoint.z());
92 ROOT::Math::XYZVector detMomDir(g_detMomDir.x(), g_detMomDir.y(), g_detMomDir.z());
93 double detTime = photon.GetGlobalTime();
94 double length = photon.GetTrackLength();
97 const G4ThreeVector& g_emiPoint = photon.GetVertexPosition();
98 const G4ThreeVector& g_emiMomDir = photon.GetVertexMomentumDirection();
99 ROOT::Math::XYZPoint emiPoint(g_emiPoint.x(), g_emiPoint.y(), g_emiPoint.z());
100 ROOT::Math::XYZVector emiMomDir(g_emiMomDir.x(), g_emiMomDir.y(), g_emiMomDir.z());
101 double emiTime = photon.GetGlobalTime() - photon.GetLocalTime();
110 auto* simHit =
m_simHits.appendNew(moduleID, pmtID, xLocal, yLocal,
113 int parentID = photon.GetParentID();
114 if (parentID == 0) parentID = photon.GetTrackID();
118 if (geo->isModuleIDValid(moduleID)) {
120 const auto& module = geo->getModule(moduleID);
121 emiPoint = module.pointToLocal(emiPoint);
122 detPoint = module.pointToLocal(detPoint);
123 emiMomDir = module.momentumToLocal(emiMomDir);
124 detMomDir = module.momentumToLocal(detMomDir);
126 B2ERROR(
"TOP::SensitivePMT: undefined module ID."
127 <<
LogVar(
"moduleID", moduleID));
130 emiPoint, emiMomDir, emiTime,
131 detPoint, detMomDir, detTime,
134 simHit->addRelationTo(simPhoton);
137 photon.SetTrackStatus(fStopAndKill);
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
RelationArray m_relParticleHit
relations
int m_pmtReplicaDepth
replica depth of PMT volume
TOPGeometryPar * m_topgp
geometry parameters
StoreArray< TOPSimPhoton > m_simPhotons
collection of simulated photons
StoreArray< TOPSimHit > m_simHits
collection of simulated hits
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
double getPMTEfficiency(double energy, int moduleID, int pmtID, double x, double y) const
Returns PMT pixel efficiency, a product of quantum and collection efficiency.
static const double mm
[millimeters]
static const double eV
[electronvolt]
static const double MeV
[megaelectronvolt]
Class to store variables with their name which were sent to the logging service.