00001
00002
00003 #include "BDSBackScatterBias.hh"
00004 #include "BDSGlobalConstants.hh"
00005 #include "G4SteppingManager.hh"
00006
00007
00008 BDSBackScatterBias::BDSBackScatterBias(const G4String& aName,
00009 G4ProcessType aType)
00010 : G4WrapperProcess(aName, aType), eFactor(1.0)
00011 {
00012 }
00013
00014 BDSBackScatterBias::BDSBackScatterBias(const BDSBackScatterBias& right)
00015 : G4WrapperProcess(right), eFactor(right.eFactor)
00016 {
00017 }
00018
00019 BDSBackScatterBias::~BDSBackScatterBias()
00020 {
00021 }
00022
00023
00024
00025 G4VParticleChange* BDSBackScatterBias::PostStepDoIt(
00026 const G4Track& track,
00027 const G4Step& stepData
00028 )
00029 {
00030 #ifdef DEBUG
00031 G4cout <<" ###PostStepDoIt " << G4endl;
00032 G4cout << "BDSBackScatterBias::PostStepDoit Getting pChange" << G4endl;
00033 #endif
00034 G4VParticleChange* pChange = pRegProcess->PostStepDoIt( track, stepData );
00035 pChange->SetVerboseLevel(0);
00036 #ifdef DEBUG
00037 G4cout << "BDSBackScatterBias::PostStepDoit Choosing setsecondaryweightbyprocess" << G4endl;
00038 #endif
00039 pChange->SetSecondaryWeightByProcess(true);
00040 pChange->SetParentWeightByProcess(true);
00041 #ifdef DEBUG
00042 G4cout << "BDSBackScatterBias::PostStepDoit Getting parent weight" << G4endl;
00043 #endif
00044 G4double w = pChange->GetParentWeight();
00045 G4double ws = w / eFactor;
00046
00047
00048 #ifdef DEBUG
00049 G4cout << "BDSBackScatterBias::PostStepDoit Getting number of secondaries" << G4endl;
00050 #endif
00051 G4int iNSec = pChange->GetNumberOfSecondaries();
00052
00053 #ifdef DEBUG
00054 G4cout << "BDSBackScatterBias::PostStepDoit Setting secondary weights" << G4endl;
00055 #endif
00056
00057 for (G4int i = 0; i < iNSec; i++) {
00058 pChange->GetSecondary(i)->SetWeight(ws);
00059 }
00060
00061 #ifdef DEBUG
00062 G4cout << "BDSBackScatterBias::PostStepDoIt number of secondaries: " << pChange->GetNumberOfSecondaries() << G4endl;
00063 #endif
00064 return pChange;
00065 }
00066