109 if (isInitializer && !isInitialized) {
110 isInitialized =
true;
113 fMeanNumberOfPhotons->resize(
nVolumes,
new std::vector<G4double>(nvec, 0.0));
114 fIntegral->resize(
nVolumes,
nullptr);
116 for (std::size_t i = 0; i <
nVolumes; ++i) {
117 auto mat = ((*pLogicalVolumes)[i])->GetMaterial();
118 auto MPT = mat->GetMaterialPropertiesTable();
120 if (
nullptr == MPT) {
continue; }
122 if (
nullptr == rindex) {
continue; }
123 (*fRindex)[i] = rindex;
126 if (nMax <= 1.0) {
continue; }
129 beta = std::min(beta, b);
133 if (0 == nn) {
continue; }
135 auto iptr =
new std::vector<std::vector<G4double>* >((std::size_t)nvec,
nullptr);
136 (*fIntegral)[i] = iptr;
137 for (
auto & ptr : *iptr) {
138 ptr =
new std::vector<G4double>(nn, 0.0);
142 G4double y0 = AverageNumberOfPhotons(1.0, b0, (*rindex)[0]);
143 (*(*fMeanNumberOfPhotons)[i])[0] = y0;
144 if (1 == nn) {
continue; }
147 for (
G4int k = 0; k < nvec; ++k) {
148 (*((*fIntegral)[i]))[k]->resize(nn, 0.0);
152 for (std::size_t j = 1; j < nn; ++j) {
154 G4double y = AverageNumberOfPhotons(1.0, beta, (*rindex)[j]);
155 sum += 0.5*(y - y0)*(e - e0);
158 (*(*((*fIntegral)[i]))[k])[j] = sum;
160 if (deltae > 0.0) { (*(*fMeanNumberOfPhotons)[i])[k] = sum/deltae; }
161 if (sum > 0.0) { sum = 1.0/sum; }
162 for (std::size_t j = 1; j < nn; ++j) {
163 G4double y = (*(*((*fIntegral)[i]))[k])[j]/sum;
164 (*(*((*fIntegral)[i]))[k])[j] = y;
167 beta = std::min(beta, 1.0);
171 for (std::size_t i = 0; i <
nVolumes; ++i) {
172 beta = std::min(beta, (*fBetaLim)[i]);
188 fParticle = dynPart->GetDefinition();
189 fPreStepKinE = dynPart->GetKineticEnergy();
190 fCharge = fParticle->GetPDGCharge()/CLHEP::eplus;
191 fMass = fParticle->GetPDGMass();
196 if (x < minAllowedStep) {
return false; }
201 fMeanNPhotons = x * AverageNumberOfPhotons(fCharge,
pPreStepBeta, nmax);
204 x = std::max(x, minAllowedStep);
216 G4double kinE = postStep->GetKineticEnergy();
220 G4int idx = std::max(
G4int((beta - b)/dbeta), 0);
221 idx = std::min(idx, nvec - 1);
222 std::vector<G4double>* v = (*((*fIntegral)[
pIndex]))[idx];
227 G4double time = preStep->GetGlobalTime();
228 G4double dt = postStep->GetGlobalTime() - time;
232 G4double x = (1.0 + fPreStepKinE/fMass);
244 auto const rindex = (*fRindex)[
pIndex];
245 std::size_t ni = rindex->GetVectorLength();
246 if (0 == ni) {
return; }
248 G4double mean = delta*fCharge*fCharge*(*(*fMeanNumberOfPhotons)[
pIndex])[idx];
250 for (
G4int i=0; i<nn; ++i) {
252 for (
G4int j = 0; j < ngamma; ++j) {
257 for (std::size_t k = 1; k < ni; ++k) {
259 e = rindex->Energy(k - 1);
260 e += (rindex->Energy(k) - e)*(q - (*v)[k - 1])/((*v)[k] - (*v)[k - 1]);
261 n = (*rindex)[k - 1];
262 n += ((*rindex)[k] - n)*(q - (*v)[k - 1])/((*v)[k] - (*v)[k - 1]);
270 G4double maxSin2 = (1.0 - minCos)*(1.0 + minCos);
274 sint2 = (1.0 - cost)*(1.0 + cost);
276 }
while(q * maxSin2 > sint2);
286 G4ThreeVector photonPolarization(cost*cosPhi, cost*sinPhi, -sint);
292 dp->SetPolarization(photonPolarization);
293 auto track =
new G4Track(dp, t, posnew);
294 out.push_back(track);
299 beta = std::sqrt(ekin * (ekin + 2*fMass))/(fMass + ekin);