37 #include <G4SystemOfUnits.hh>
67 declareProperty(
"Material", this->locals.materialName);
68 declareProperty(
"CriticalEnergy", this->locals.criticalEnergyRef);
69 this->m_applicablePartNames.emplace_back(
"e+");
70 this->m_applicablePartNames.emplace_back(
"e-");
76 locals.material = this->getMaterial(this->locals.materialName);
77 locals.criticalEnergy = this->locals.criticalEnergyRef * (this->locals.material->GetZ() + 1.2);
84 auto* primary = track.GetPrimaryTrack();
86 this->killParticle(step, primary->GetKineticEnergy(), 0e0);
95 G4double Ec = this->locals.criticalEnergy;
97 G4double y = Energy/Ec;
99 G4double b = 0.5, C = -0.5;
101 G4double tmax = 1.0 * (std::log(y) + C);
102 G4double a = 1.0 + b*tmax;
104 G4double X0 = this->locals.material->GetRadlen();
106 G4double Es = 21*MeV;
107 G4double Rm = X0*Es/Ec;
110 G4double deposit = Energy/double(nSpots);
113 G4ThreeVector xShower, yShower, zShower;
115 xShower = zShower.orthogonal();
116 yShower = zShower.cross(xShower);
120 for (
int i = 0; i < nSpots; i++) {
122 G4double bt = rndm->
gamma(a, 1e0);
126 G4double xr = rndm->
uniform(0e0,1e0);
127 G4double phi = rndm->
uniform(0e0,twopi);
129 if (xr < 0.9) r = xr/0.9*Rm;
130 else r = ((xr - 0.9)/0.1*2.5 + 1.0)*Rm;
132 G4ThreeVector position = sShower + z*zShower + r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
136 this->locals.hitMaker.make(hit, track);
155 this->m_applicablePartNames.emplace_back(
"pi+");
156 this->m_applicablePartNames.emplace_back(
"pi-");
168 auto* primary = track.GetPrimaryTrack();
170 this->killParticle(step, primary->GetKineticEnergy(), 0e0);
176 G4ThreeVector pos = track.GetPrimaryTrackLocalPosition();
177 G4ThreeVector dir = track.GetPrimaryTrackLocalDirection();
178 G4double distOut = track.GetEnvelopeSolid()->DistanceToOut(pos, dir);
179 G4ThreeVector showerCenter = pos + (distOut/2.)*dir;
181 showerCenter = track.GetInverseAffineTransformation()->TransformPoint(showerCenter);
184 G4ThreeVector zShower = primary->GetMomentumDirection();
185 G4ThreeVector xShower = zShower.orthogonal();
186 G4ThreeVector yShower = zShower.cross(xShower);
189 G4double Energy = primary->GetKineticEnergy();
191 G4double deposit = Energy/double(nSpot);
193 for (
int i = 0; i < nSpot; i++) {
194 double z = rndm->
gauss(0, 20*cm);
195 double r = rndm->
gauss(0, 10*cm);
196 double phi = rndm->
uniform(0e0, twopi);
197 G4ThreeVector position = showerCenter + z*zShower + r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
200 this->locals.hitMaker.make(hit, track);