11 #include <beast/plume/simulation/SensitiveDetector.h>
12 #include <beast/plume/dataobjects/PlumeSimHit.h>
13 #include <beast/plume/dataobjects/PlumeHit.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/RelationArray.h>
22 #define _USE_MATH_DEFINES
35 SensitiveDetector::SensitiveDetector():
36 Simulation::SensitiveDetectorBase(
"PlumeSensitiveDetector",
Const::invalidDetector)
74 mcParticles.registerInDataStore();
75 simHits.registerInDataStore();
76 plumeHits.registerInDataStore();
98 const G4Track& track = *
step->GetTrack();
99 const G4StepPoint& preStepPoint = *
step->GetPreStepPoint();
100 const G4StepPoint& postStepPoint = *
step->GetPostStepPoint();
113 G4ThreeVector preStepPointPosition = preStepPoint.GetPosition();
114 G4ThreeVector trackMomentum = track.GetMomentum();
126 G4TouchableHandle theTouchable = preStepPoint.GetTouchableHandle();
127 G4ThreeVector worldDirection = preStepPoint.GetMomentumDirection();
128 G4ThreeVector localDirection = theTouchable->GetHistory()->GetTopTransform().TransformAxis(worldDirection);
130 if (localDirection.z() < 0.) {
137 if (localDirection.x() < 0. && localDirection.y() > 0.) {
139 }
else if (localDirection.x() < 0. && localDirection.y() < 0.) {
141 }
else if (localDirection.x() > 0. && localDirection.y() < 0.) {
142 current_phiAngle = M_PI + atan(-1. * localDirection.x() / localDirection.y());
143 }
else if (localDirection.x() > 0. && localDirection.y() > 0.) {
144 current_phiAngle = 2. * M_PI - atan(localDirection.x() / localDirection.y());
145 }
else if (localDirection.x() < 0. && localDirection.y() == 0.) {
147 }
else if (localDirection.x() > 0. && localDirection.y() == 0.) {
149 }
else if (localDirection.x() == 0. && localDirection.y() > 0.) {
151 }
else if (localDirection.x() == 0. && localDirection.y() < 0.) {
155 G4ThreeVector localINPosition = theTouchable->GetHistory()->GetTopTransform().TransformPoint(preStepPointPosition);
169 if (track.GetNextVolume() != track.GetVolume() || track.GetTrackStatus() >= fStopAndKill) {
171 G4ThreeVector postStepPointPosition = postStepPoint.GetPosition();
176 G4ThreeVector localOUTPosition = preStepPoint.GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(
177 postStepPointPosition);