9 #include "CLHEP/Units/SystemOfUnits.h"
10 #include "CLHEP/Units/PhysicalConstants.h"
13 #include "G4ParticleTypes.hh"
14 #include "G4ParticleDefinition.hh"
15 #include "G4ProcessManager.hh"
16 #include "G4OpBoundaryProcess.hh"
17 #include "G4OpProcessSubType.hh"
20 : G4VSensitiveDetector(
name), m_HitColl(hitCollectionName), m_readoutPos(readoutPos)
43 G4ThreeVector
pos = aStep->GetTrack()->GetPosition();
44 G4ThreeVector
momentum = aStep->GetPreStepPoint()->GetMomentum();
49 if (aStep->GetTrack()->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition()){
58 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
66 G4StepPoint *endPoint = aStep->GetPostStepPoint();
67 if (endPoint->GetStepStatus() != fGeomBoundary)
77 G4MaterialPropertiesTable *MPT = aStep->GetPreStepPoint()->GetMaterial()->GetMaterialPropertiesTable();
80 G4MaterialPropertyVector *RindexMPV = MPT->GetProperty(kRINDEX);
86 double photonEnergy = aStep->GetTrack()->GetDynamicParticle()->GetTotalMomentum();
87 Rindex = RindexMPV->Value(photonEnergy,
index);
90 G4ThreeVector momDir = aStep->GetPreStepPoint()->GetMomentumDirection();
91 G4double angleFromY =
atan(sqrt(1 -
pow(momDir.y(), 2.0)) / momDir.y());
95 if (angleFromY > asin(1.0 / Rindex)){
96 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
105 G4bool isTIR =
false;
106 G4ProcessVector *postStepDoItVector = G4OpticalPhoton::OpticalPhotonDefinition()->GetProcessManager()->GetPostStepProcessVector(typeDoIt);
107 G4int n_proc = postStepDoItVector->entries();
108 for (G4int
i = 0;
i < n_proc; ++
i){
109 G4OpBoundaryProcess *opProc =
dynamic_cast<G4OpBoundaryProcess *
>((*postStepDoItVector)[
i]);
110 if (opProc && opProc->GetStatus() == TotalInternalReflection){
117 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
126 G4MaterialPropertyVector *AbsMPV = MPT->GetProperty(kABSLENGTH);
127 G4double Absorption = AbsMPV->Value(aStep->GetTrack()->GetDynamicParticle()->GetTotalMomentum(),
index);
130 G4double absChance = 1 -
exp(-pathLength / Absorption);
133 if (CLHEP::RandFlat::shoot(0.0, 1.0) < absChance){
134 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
144 id = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetCopyNo();
152 m_hitMap.insert(std::pair<uint32_t,ZDC_SimFiberHit*>(
hash,hit));
154 it->second->Add(1, photonEnergy);
160 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
176 if (verboseLevel > 5){
177 G4cout <<
"ZDC_FiberSD::EndOfAthenaEvent(): Printing Final Energy(eV) deposited in Fibers " << G4endl;
180 float energyTotal = 0;
182 photonCount += hit.second->getNPhotons();
183 energyTotal += hit.second->getEdep();
186 G4cout <<
"ZDC_FiberSD::EndOfAthenaEvent(): Final Energy(eV) deposited in Fiber "
187 << energyTotal <<
" ev and Number of Photons deposited = " << photonCount
188 <<
" across " <<
m_hitMap.size() <<
" volumes" << G4endl;