106{
109 if (isInitializer && !isInitialized) {
110 isInitialized = true;
113 fMeanNumberOfPhotons->resize(
nVolumes,
new std::vector<G4double>(nvec, 0.0));
114 fIntegral->resize(
nVolumes,
nullptr);
115
116 for (std::size_t i = 0; i <
nVolumes; ++i) {
117 auto mat = ((*pLogicalVolumes)[i])->GetMaterial();
118 auto MPT = mat->GetMaterialPropertiesTable();
119
120 if (nullptr == MPT) { continue; }
122 if (nullptr == rindex) { continue; }
123 (*fRindex)[i] = rindex;
124
126 if (nMax <= 1.0) { continue; }
128 (*fBetaLim)[i] = b;
129 beta = std::min(beta, b);
133 if (0 == nn) { continue; }
134
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);
139 }
140
141
142 G4double y0 = AverageNumberOfPhotons(1.0, b0, (*rindex)[0]);
143 (*(*fMeanNumberOfPhotons)[i])[0] = y0;
144 if (1 == nn) { continue; }
145
146
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);
156 y0 = y;
157 e0 = e;
158 (*(*((*fIntegral)[i]))[k])[j] = sum;
159 }
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;
165 }
166 beta += dbeta;
167 beta = std::min(beta, 1.0);
168 }
169 }
170 } else {
171 for (std::size_t i = 0; i <
nVolumes; ++i) {
172 beta = std::min(beta, (*fBetaLim)[i]);
173 }
174 }
176}
G4PhysicsFreeVector G4MaterialPropertyVector
G4double GetMaxEnergy() const
G4double GetMaxValue() const
G4double Energy(const std::size_t index) const
G4double GetMinEnergy() const
std::size_t GetVectorLength() const