77 IPDFThetaBias =
false;
81 IPDFEnergyBias =
false;
83 IPDFPosThetaBias =
false;
85 IPDFPosPhiBias =
false;
86 bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4]
87 = bweights[5] = bweights[6] = bweights[7] = bweights[8] = 1.;
167 if (atype ==
"biasx") {
170 XBiasH = IPDFXBiasH = ZeroPhysVector;
171 }
else if (atype ==
"biasy") {
174 YBiasH = IPDFYBiasH = ZeroPhysVector;
175 }
else if (atype ==
"biasz") {
178 ZBiasH = IPDFZBiasH = ZeroPhysVector;
179 }
else if (atype ==
"biast") {
181 IPDFThetaBias =
false;
182 ThetaBiasH = IPDFThetaBiasH = ZeroPhysVector;
183 }
else if (atype ==
"biasp") {
186 PhiBiasH = IPDFPhiBiasH = ZeroPhysVector;
187 }
else if (atype ==
"biase") {
189 IPDFEnergyBias =
false;
190 EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector;
191 }
else if (atype ==
"biaspt") {
192 PosThetaBias =
false;
193 IPDFPosThetaBias =
false;
194 PosThetaBiasH = IPDFPosThetaBiasH = ZeroPhysVector;
195 }
else if (atype ==
"biaspp") {
197 IPDFPosPhiBias =
false;
198 PosPhiBiasH = IPDFPosPhiBiasH = ZeroPhysVector;
205 if (verbosityLevel >= 1)
207 if (XBias ==
false) {
213 if (IPDFXBias ==
false) {
215 G4double bins[1024], vals[1024], sum;
219 vals[0] = XBiasH(
size_t(0));
221 for (ii = 1; ii < maxbin; ii++) {
223 vals[ii] = XBiasH(
size_t(ii)) + vals[ii - 1];
224 sum = sum + XBiasH(
size_t(ii));
227 for (ii = 0; ii < maxbin; ii++) {
228 vals[ii] = vals[ii] / sum;
243 G4int biasn2 = numberOfBin / 2;
244 G4int biasn3 = numberOfBin - 1;
245 while (biasn1 != biasn3 - 1) {
246 if (rndm > IPDFXBiasH(biasn2))
250 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
253 bweights[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
259 bweights[0] = NatProb / bweights[0];
260 if (verbosityLevel >= 1)
261 G4cout <<
"X bin weight " << bweights[0] <<
" " << rndm <<
G4endl;
267 if (verbosityLevel >= 1)
269 if (YBias ==
false) {
275 if (IPDFYBias ==
false) {
277 G4double bins[1024], vals[1024], sum;
281 vals[0] = YBiasH(
size_t(0));
283 for (ii = 1; ii < maxbin; ii++) {
285 vals[ii] = YBiasH(
size_t(ii)) + vals[ii - 1];
286 sum = sum + YBiasH(
size_t(ii));
289 for (ii = 0; ii < maxbin; ii++) {
290 vals[ii] = vals[ii] / sum;
300 G4int biasn2 = numberOfBin / 2;
301 G4int biasn3 = numberOfBin - 1;
302 while (biasn1 != biasn3 - 1) {
303 if (rndm > IPDFYBiasH(biasn2))
307 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
309 bweights[1] = IPDFYBiasH(biasn2) - IPDFYBiasH(biasn2 - 1);
313 bweights[1] = NatProb / bweights[1];
314 if (verbosityLevel >= 1)
315 G4cout <<
"Y bin weight " << bweights[1] <<
" " << rndm <<
G4endl;
321 if (verbosityLevel >= 1)
323 if (ZBias ==
false) {
329 if (IPDFZBias ==
false) {
331 G4double bins[1024], vals[1024], sum;
335 vals[0] = ZBiasH(
size_t(0));
337 for (ii = 1; ii < maxbin; ii++) {
339 vals[ii] = ZBiasH(
size_t(ii)) + vals[ii - 1];
340 sum = sum + ZBiasH(
size_t(ii));
343 for (ii = 0; ii < maxbin; ii++) {
344 vals[ii] = vals[ii] / sum;
355 G4int biasn2 = numberOfBin / 2;
356 G4int biasn3 = numberOfBin - 1;
357 while (biasn1 != biasn3 - 1) {
358 if (rndm > IPDFZBiasH(biasn2))
362 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
364 bweights[2] = IPDFZBiasH(biasn2) - IPDFZBiasH(biasn2 - 1);
368 bweights[2] = NatProb / bweights[2];
369 if (verbosityLevel >= 1)
370 G4cout <<
"Z bin weight " << bweights[2] <<
" " << rndm <<
G4endl;
376 if (verbosityLevel >= 1) {
380 if (ThetaBias ==
false) {
386 if (IPDFThetaBias ==
false) {
388 G4double bins[1024], vals[1024], sum;
392 vals[0] = ThetaBiasH(
size_t(0));
394 for (ii = 1; ii < maxbin; ii++) {
396 vals[ii] = ThetaBiasH(
size_t(ii)) + vals[ii - 1];
397 sum = sum + ThetaBiasH(
size_t(ii));
400 for (ii = 0; ii < maxbin; ii++) {
401 vals[ii] = vals[ii] / sum;
405 IPDFThetaBias =
true;
412 G4int biasn2 = numberOfBin / 2;
413 G4int biasn3 = numberOfBin - 1;
414 while (biasn1 != biasn3 - 1) {
415 if (rndm > IPDFThetaBiasH(biasn2))
419 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
421 bweights[3] = IPDFThetaBiasH(biasn2) - IPDFThetaBiasH(biasn2 - 1);
425 bweights[3] = NatProb / bweights[3];
426 if (verbosityLevel >= 1)
427 G4cout <<
"Theta bin weight " << bweights[3] <<
" " << rndm
434 if (verbosityLevel >= 1)
436 if (PhiBias ==
false) {
442 if (IPDFPhiBias ==
false) {
444 G4double bins[1024], vals[1024], sum;
448 vals[0] = PhiBiasH(
size_t(0));
450 for (ii = 1; ii < maxbin; ii++) {
452 vals[ii] = PhiBiasH(
size_t(ii)) + vals[ii - 1];
453 sum = sum + PhiBiasH(
size_t(ii));
456 for (ii = 0; ii < maxbin; ii++) {
457 vals[ii] = vals[ii] / sum;
468 G4int biasn2 = numberOfBin / 2;
469 G4int biasn3 = numberOfBin - 1;
470 while (biasn1 != biasn3 - 1) {
471 if (rndm > IPDFPhiBiasH(biasn2))
475 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
477 bweights[4] = IPDFPhiBiasH(biasn2) - IPDFPhiBiasH(biasn2 - 1);
481 bweights[4] = NatProb / bweights[4];
482 if (verbosityLevel >= 1)
483 G4cout <<
"Phi bin weight " << bweights[4] <<
" " << rndm <<
G4endl;
489 if (verbosityLevel >= 1)
491 if (EnergyBias ==
false) {
497 if (IPDFEnergyBias ==
false) {
499 G4double bins[1024], vals[1024], sum;
503 vals[0] = EnergyBiasH(
size_t(0));
505 for (ii = 1; ii < maxbin; ii++) {
507 vals[ii] = EnergyBiasH(
size_t(ii)) + vals[ii - 1];
508 sum = sum + EnergyBiasH(
size_t(ii));
510 IPDFEnergyBiasH = ZeroPhysVector;
511 for (ii = 0; ii < maxbin; ii++) {
512 vals[ii] = vals[ii] / sum;
516 IPDFEnergyBias =
true;
523 G4int biasn2 = numberOfBin / 2;
524 G4int biasn3 = numberOfBin - 1;
525 while (biasn1 != biasn3 - 1) {
526 if (rndm > IPDFEnergyBiasH(biasn2))
530 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
532 bweights[5] = IPDFEnergyBiasH(biasn2) - IPDFEnergyBiasH(biasn2 - 1);
536 bweights[5] = NatProb / bweights[5];
537 if (verbosityLevel >= 1)
538 G4cout <<
"Energy bin weight " << bweights[5] <<
" " << rndm
540 return (IPDFEnergyBiasH.
GetEnergy(rndm));
545 if (verbosityLevel >= 1) {
549 if (PosThetaBias ==
false) {
555 if (IPDFPosThetaBias ==
false) {
557 G4double bins[1024], vals[1024], sum;
561 vals[0] = PosThetaBiasH(
size_t(0));
563 for (ii = 1; ii < maxbin; ii++) {
565 vals[ii] = PosThetaBiasH(
size_t(ii)) + vals[ii - 1];
566 sum = sum + PosThetaBiasH(
size_t(ii));
569 for (ii = 0; ii < maxbin; ii++) {
570 vals[ii] = vals[ii] / sum;
574 IPDFPosThetaBias =
true;
581 G4int biasn2 = numberOfBin / 2;
582 G4int biasn3 = numberOfBin - 1;
583 while (biasn1 != biasn3 - 1) {
584 if (rndm > IPDFPosThetaBiasH(biasn2))
588 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
590 bweights[6] = IPDFPosThetaBiasH(biasn2) - IPDFPosThetaBiasH(biasn2 - 1);
595 bweights[6] = NatProb / bweights[6];
596 if (verbosityLevel >= 1)
597 G4cout <<
"PosTheta bin weight " << bweights[6] <<
" " << rndm
599 return (IPDFPosThetaBiasH.
GetEnergy(rndm));
604 if (verbosityLevel >= 1)
606 if (PosPhiBias ==
false) {
612 if (IPDFPosPhiBias ==
false) {
614 G4double bins[1024], vals[1024], sum;
618 vals[0] = PosPhiBiasH(
size_t(0));
620 for (ii = 1; ii < maxbin; ii++) {
622 vals[ii] = PosPhiBiasH(
size_t(ii)) + vals[ii - 1];
623 sum = sum + PosPhiBiasH(
size_t(ii));
626 for (ii = 0; ii < maxbin; ii++) {
627 vals[ii] = vals[ii] / sum;
631 IPDFPosPhiBias =
true;
638 G4int biasn2 = numberOfBin / 2;
639 G4int biasn3 = numberOfBin - 1;
640 while (biasn1 != biasn3 - 1) {
641 if (rndm > IPDFPosPhiBiasH(biasn2))
645 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
647 bweights[7] = IPDFPosPhiBiasH(biasn2) - IPDFPosPhiBiasH(biasn2 - 1);
651 bweights[7] = NatProb / bweights[7];
652 if (verbosityLevel >= 1)
653 G4cout <<
"PosPhi bin weight " << bweights[7] <<
" " << rndm
655 return (IPDFPosPhiBiasH.
GetEnergy(rndm));
DOUBLE PRECISION function rndm(RDUMMY)
void InsertValues(G4double energy, G4double value)
void SetEnergyBias(G4ThreeVector)
void SetYBias(G4ThreeVector)
size_t GetVectorLength() const
G4double GetLowEdgeEnergy(size_t binNumber) const
void SetPosThetaBias(G4ThreeVector)
void SetThetaBias(G4ThreeVector)
void SetZBias(G4ThreeVector)
void SetXBias(G4ThreeVector)
G4GLOB_DLL std::ostream G4cout
G4double GetEnergy(G4double aValue)
void SetPhiBias(G4ThreeVector)
G4double GenRandPosTheta()
void SetPosPhiBias(G4ThreeVector)