78 IPDFThetaBias =
false;
82 IPDFEnergyBias =
false;
84 IPDFPosThetaBias =
false;
86 IPDFPosPhiBias =
false;
87 bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4]
88 = bweights[5] = bweights[6] = bweights[7] = bweights[8] = 1.;
168 if (atype ==
"biasx") {
171 XBiasH = IPDFXBiasH = ZeroPhysVector;
172 }
else if (atype ==
"biasy") {
175 YBiasH = IPDFYBiasH = ZeroPhysVector;
176 }
else if (atype ==
"biasz") {
179 ZBiasH = IPDFZBiasH = ZeroPhysVector;
180 }
else if (atype ==
"biast") {
182 IPDFThetaBias =
false;
183 ThetaBiasH = IPDFThetaBiasH = ZeroPhysVector;
184 }
else if (atype ==
"biasp") {
187 PhiBiasH = IPDFPhiBiasH = ZeroPhysVector;
188 }
else if (atype ==
"biase") {
190 IPDFEnergyBias =
false;
191 EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector;
192 }
else if (atype ==
"biaspt") {
193 PosThetaBias =
false;
194 IPDFPosThetaBias =
false;
195 PosThetaBiasH = IPDFPosThetaBiasH = ZeroPhysVector;
196 }
else if (atype ==
"biaspp") {
198 IPDFPosPhiBias =
false;
199 PosPhiBiasH = IPDFPosPhiBiasH = ZeroPhysVector;
206 if (verbosityLevel >= 1)
208 if (XBias ==
false) {
214 if (IPDFXBias ==
false) {
216 G4double bins[1024], vals[1024], sum;
220 vals[0] = XBiasH(
size_t(0));
222 for (ii = 1; ii < maxbin; ii++) {
224 vals[ii] = XBiasH(
size_t(ii)) + vals[ii - 1];
225 sum = sum + XBiasH(
size_t(ii));
228 for (ii = 0; ii < maxbin; ii++) {
229 vals[ii] = vals[ii] / sum;
244 G4int biasn2 = numberOfBin / 2;
245 G4int biasn3 = numberOfBin - 1;
246 while (biasn1 != biasn3 - 1) {
247 if (rndm > IPDFXBiasH(biasn2))
251 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
254 bweights[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
260 bweights[0] = NatProb / bweights[0];
261 if (verbosityLevel >= 1)
262 G4cout <<
"X bin weight " << bweights[0] <<
" " << rndm <<
G4endl;
268 if (verbosityLevel >= 1)
270 if (YBias ==
false) {
276 if (IPDFYBias ==
false) {
278 G4double bins[1024], vals[1024], sum;
282 vals[0] = YBiasH(
size_t(0));
284 for (ii = 1; ii < maxbin; ii++) {
286 vals[ii] = YBiasH(
size_t(ii)) + vals[ii - 1];
287 sum = sum + YBiasH(
size_t(ii));
290 for (ii = 0; ii < maxbin; ii++) {
291 vals[ii] = vals[ii] / sum;
301 G4int biasn2 = numberOfBin / 2;
302 G4int biasn3 = numberOfBin - 1;
303 while (biasn1 != biasn3 - 1) {
304 if (rndm > IPDFYBiasH(biasn2))
308 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
310 bweights[1] = IPDFYBiasH(biasn2) - IPDFYBiasH(biasn2 - 1);
314 bweights[1] = NatProb / bweights[1];
315 if (verbosityLevel >= 1)
316 G4cout <<
"Y bin weight " << bweights[1] <<
" " << rndm <<
G4endl;
322 if (verbosityLevel >= 1)
324 if (ZBias ==
false) {
330 if (IPDFZBias ==
false) {
332 G4double bins[1024], vals[1024], sum;
336 vals[0] = ZBiasH(
size_t(0));
338 for (ii = 1; ii < maxbin; ii++) {
340 vals[ii] = ZBiasH(
size_t(ii)) + vals[ii - 1];
341 sum = sum + ZBiasH(
size_t(ii));
344 for (ii = 0; ii < maxbin; ii++) {
345 vals[ii] = vals[ii] / sum;
356 G4int biasn2 = numberOfBin / 2;
357 G4int biasn3 = numberOfBin - 1;
358 while (biasn1 != biasn3 - 1) {
359 if (rndm > IPDFZBiasH(biasn2))
363 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
365 bweights[2] = IPDFZBiasH(biasn2) - IPDFZBiasH(biasn2 - 1);
369 bweights[2] = NatProb / bweights[2];
370 if (verbosityLevel >= 1)
371 G4cout <<
"Z bin weight " << bweights[2] <<
" " << rndm <<
G4endl;
377 if (verbosityLevel >= 1) {
381 if (ThetaBias ==
false) {
387 if (IPDFThetaBias ==
false) {
389 G4double bins[1024], vals[1024], sum;
393 vals[0] = ThetaBiasH(
size_t(0));
395 for (ii = 1; ii < maxbin; ii++) {
397 vals[ii] = ThetaBiasH(
size_t(ii)) + vals[ii - 1];
398 sum = sum + ThetaBiasH(
size_t(ii));
401 for (ii = 0; ii < maxbin; ii++) {
402 vals[ii] = vals[ii] / sum;
406 IPDFThetaBias =
true;
413 G4int biasn2 = numberOfBin / 2;
414 G4int biasn3 = numberOfBin - 1;
415 while (biasn1 != biasn3 - 1) {
416 if (rndm > IPDFThetaBiasH(biasn2))
420 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
422 bweights[3] = IPDFThetaBiasH(biasn2) - IPDFThetaBiasH(biasn2 - 1);
426 bweights[3] = NatProb / bweights[3];
427 if (verbosityLevel >= 1)
428 G4cout <<
"Theta bin weight " << bweights[3] <<
" " << rndm
435 if (verbosityLevel >= 1)
437 if (PhiBias ==
false) {
443 if (IPDFPhiBias ==
false) {
445 G4double bins[1024], vals[1024], sum;
449 vals[0] = PhiBiasH(
size_t(0));
451 for (ii = 1; ii < maxbin; ii++) {
453 vals[ii] = PhiBiasH(
size_t(ii)) + vals[ii - 1];
454 sum = sum + PhiBiasH(
size_t(ii));
457 for (ii = 0; ii < maxbin; ii++) {
458 vals[ii] = vals[ii] / sum;
469 G4int biasn2 = numberOfBin / 2;
470 G4int biasn3 = numberOfBin - 1;
471 while (biasn1 != biasn3 - 1) {
472 if (rndm > IPDFPhiBiasH(biasn2))
476 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
478 bweights[4] = IPDFPhiBiasH(biasn2) - IPDFPhiBiasH(biasn2 - 1);
482 bweights[4] = NatProb / bweights[4];
483 if (verbosityLevel >= 1)
484 G4cout <<
"Phi bin weight " << bweights[4] <<
" " << rndm <<
G4endl;
490 if (verbosityLevel >= 1)
492 if (EnergyBias ==
false) {
498 if (IPDFEnergyBias ==
false) {
500 G4double bins[1024], vals[1024], sum;
504 vals[0] = EnergyBiasH(
size_t(0));
506 for (ii = 1; ii < maxbin; ii++) {
508 vals[ii] = EnergyBiasH(
size_t(ii)) + vals[ii - 1];
509 sum = sum + EnergyBiasH(
size_t(ii));
511 IPDFEnergyBiasH = ZeroPhysVector;
512 for (ii = 0; ii < maxbin; ii++) {
513 vals[ii] = vals[ii] / sum;
517 IPDFEnergyBias =
true;
524 G4int biasn2 = numberOfBin / 2;
525 G4int biasn3 = numberOfBin - 1;
526 while (biasn1 != biasn3 - 1) {
527 if (rndm > IPDFEnergyBiasH(biasn2))
531 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
533 bweights[5] = IPDFEnergyBiasH(biasn2) - IPDFEnergyBiasH(biasn2 - 1);
537 bweights[5] = NatProb / bweights[5];
538 if (verbosityLevel >= 1)
539 G4cout <<
"Energy bin weight " << bweights[5] <<
" " << rndm
541 return (IPDFEnergyBiasH.
GetEnergy(rndm));
546 if (verbosityLevel >= 1) {
550 if (PosThetaBias ==
false) {
556 if (IPDFPosThetaBias ==
false) {
558 G4double bins[1024], vals[1024], sum;
562 vals[0] = PosThetaBiasH(
size_t(0));
564 for (ii = 1; ii < maxbin; ii++) {
566 vals[ii] = PosThetaBiasH(
size_t(ii)) + vals[ii - 1];
567 sum = sum + PosThetaBiasH(
size_t(ii));
570 for (ii = 0; ii < maxbin; ii++) {
571 vals[ii] = vals[ii] / sum;
575 IPDFPosThetaBias =
true;
582 G4int biasn2 = numberOfBin / 2;
583 G4int biasn3 = numberOfBin - 1;
584 while (biasn1 != biasn3 - 1) {
585 if (rndm > IPDFPosThetaBiasH(biasn2))
589 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
591 bweights[6] = IPDFPosThetaBiasH(biasn2) - IPDFPosThetaBiasH(biasn2 - 1);
596 bweights[6] = NatProb / bweights[6];
597 if (verbosityLevel >= 1)
598 G4cout <<
"PosTheta bin weight " << bweights[6] <<
" " << rndm
600 return (IPDFPosThetaBiasH.
GetEnergy(rndm));
605 if (verbosityLevel >= 1)
607 if (PosPhiBias ==
false) {
613 if (IPDFPosPhiBias ==
false) {
615 G4double bins[1024], vals[1024], sum;
619 vals[0] = PosPhiBiasH(
size_t(0));
621 for (ii = 1; ii < maxbin; ii++) {
623 vals[ii] = PosPhiBiasH(
size_t(ii)) + vals[ii - 1];
624 sum = sum + PosPhiBiasH(
size_t(ii));
627 for (ii = 0; ii < maxbin; ii++) {
628 vals[ii] = vals[ii] / sum;
632 IPDFPosPhiBias =
true;
639 G4int biasn2 = numberOfBin / 2;
640 G4int biasn3 = numberOfBin - 1;
641 while (biasn1 != biasn3 - 1) {
642 if (rndm > IPDFPosPhiBiasH(biasn2))
646 biasn2 = biasn1 + (biasn3 - biasn1 + 1) / 2;
648 bweights[7] = IPDFPosPhiBiasH(biasn2) - IPDFPosPhiBiasH(biasn2 - 1);
652 bweights[7] = NatProb / bweights[7];
653 if (verbosityLevel >= 1)
654 G4cout <<
"PosPhi bin weight " << bweights[7] <<
" " << rndm
656 return (IPDFPosPhiBiasH.
GetEnergy(rndm));
G4DLLIMPORT std::ostream G4cout
void InsertValues(G4double energy, G4double value)
G4double GetLowEdgeEnergy(size_t binNumber) const
G4double GetEnergy(G4double aValue)
size_t GetVectorLength() const
void SetThetaBias(G4ThreeVector)
void SetYBias(G4ThreeVector)
void SetEnergyBias(G4ThreeVector)
void SetPhiBias(G4ThreeVector)
void SetPosThetaBias(G4ThreeVector)
void SetZBias(G4ThreeVector)
G4double GenRandPosTheta()
void SetPosPhiBias(G4ThreeVector)
void SetXBias(G4ThreeVector)