Skip to content

Commit

Permalink
Activate G4HepEM Tracking manager
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanGonzalezCaminero committed Oct 15, 2024
1 parent f025f58 commit fdb01f3
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions src/HepEMPhysics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,80 +60,80 @@ HepEMPhysics::~HepEMPhysics() {}

void HepEMPhysics::ConstructProcess()
{
// G4EmStandardPhysics::ConstructProcess();
G4EmStandardPhysics::ConstructProcess();

// // Register custom tracking manager for e-/e+ and gammas.
// auto *trackingManager = new G4HepEmTrackingManager();
// G4Electron::Definition()->SetTrackingManager(trackingManager);
// G4Positron::Definition()->SetTrackingManager(trackingManager);
// G4Gamma::Definition()->SetTrackingManager(trackingManager);
// Register custom tracking manager for e-/e+ and gammas.
auto *trackingManager = new G4HepEmTrackingManager();
G4Electron::Definition()->SetTrackingManager(trackingManager);
G4Positron::Definition()->SetTrackingManager(trackingManager);
G4Gamma::Definition()->SetTrackingManager(trackingManager);

// Integration trough G4 process:
// // Integration trough G4 process:

G4PhysicsListHelper *ph = G4PhysicsListHelper::GetPhysicsListHelper();
// G4PhysicsListHelper *ph = G4PhysicsListHelper::GetPhysicsListHelper();

// from G4EmStandardPhysics
G4EmBuilder::PrepareEMPhysics();
// // from G4EmStandardPhysics
// G4EmBuilder::PrepareEMPhysics();

G4EmParameters *param = G4EmParameters::Instance();
// G4EmParameters *param = G4EmParameters::Instance();

// processes used by several particles
G4hMultipleScattering *hmsc = new G4hMultipleScattering("ionmsc");
// // processes used by several particles
// G4hMultipleScattering *hmsc = new G4hMultipleScattering("ionmsc");

// nuclear stopping is enabled if th eenergy limit above zero
G4double nielEnergyLimit = param->MaxNIELEnergy();
G4NuclearStopping *pnuc = nullptr;
if (nielEnergyLimit > 0.0) {
pnuc = new G4NuclearStopping();
pnuc->SetMaxKinEnergy(nielEnergyLimit);
}
// end of G4EmStandardPhysics
// // nuclear stopping is enabled if th eenergy limit above zero
// G4double nielEnergyLimit = param->MaxNIELEnergy();
// G4NuclearStopping *pnuc = nullptr;
// if (nielEnergyLimit > 0.0) {
// pnuc = new G4NuclearStopping();
// pnuc->SetMaxKinEnergy(nielEnergyLimit);
// }
// // end of G4EmStandardPhysics

// creae the only one G4HepEm process that will be assigned to e-/e+ and gamma
G4HepEmProcess *hepEmProcess = new G4HepEmProcess();
// // creae the only one G4HepEm process that will be assigned to e-/e+ and gamma
// G4HepEmProcess *hepEmProcess = new G4HepEmProcess();

// Add standard EM Processes
//
auto aParticleIterator = GetParticleIterator();
aParticleIterator->reset();
while ((*aParticleIterator)()) {
G4ParticleDefinition *particle = aParticleIterator->value();
G4String particleName = particle->GetParticleName();
// // Add standard EM Processes
// //
// auto aParticleIterator = GetParticleIterator();
// aParticleIterator->reset();
// while ((*aParticleIterator)()) {
// G4ParticleDefinition *particle = aParticleIterator->value();
// G4String particleName = particle->GetParticleName();

if (particleName == "gamma") {
// if (particleName == "gamma") {

// Add G4HepEm process to gamma: includes Conversion, Compton and photoelectric effect.
particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);
// // Add G4HepEm process to gamma: includes Conversion, Compton and photoelectric effect.
// particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);

} else if (particleName == "e-") {
// } else if (particleName == "e-") {

// Add G4HepEm process to e-: includes Ionisation and Bremsstrahlung for e-
particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);
// // Add G4HepEm process to e-: includes Ionisation and Bremsstrahlung for e-
// particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);

} else if (particleName == "e+") {
// } else if (particleName == "e+") {

// Add G4HepEm process to e+: includes Ionisation, Bremsstrahlung and e+e-
// annihilation into 2 gamma interactions for e+
particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);
}
}
// // Add G4HepEm process to e+: includes Ionisation, Bremsstrahlung and e+e-
// // annihilation into 2 gamma interactions for e+
// particle->GetProcessManager()->AddProcess(hepEmProcess, -1, -1, 1);
// }
// }

// from G4EmStandardPhysics
// // from G4EmStandardPhysics

// generic ion
G4ParticleDefinition *particle = G4GenericIon::GenericIon();
G4ionIonisation *ionIoni = new G4ionIonisation();
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(ionIoni, particle);
if (nullptr != pnuc) {
ph->RegisterProcess(pnuc, particle);
}
// // generic ion
// G4ParticleDefinition *particle = G4GenericIon::GenericIon();
// G4ionIonisation *ionIoni = new G4ionIonisation();
// ph->RegisterProcess(hmsc, particle);
// ph->RegisterProcess(ionIoni, particle);
// if (nullptr != pnuc) {
// ph->RegisterProcess(pnuc, particle);
// }

// muons, hadrons ions
G4EmBuilder::ConstructCharged(hmsc, pnuc);
// // muons, hadrons ions
// G4EmBuilder::ConstructCharged(hmsc, pnuc);

// extra configuration
G4EmModelActivator mact(GetPhysicsName());
// // extra configuration
// G4EmModelActivator mact(GetPhysicsName());

// end of G4EmStandardPhysics
// // end of G4EmStandardPhysics
}

0 comments on commit fdb01f3

Please sign in to comment.