// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // G. PaternĂ², March 2019. It is used in case of biasing // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "OpticalPhotonPhysics.hh" #include "G4OpticalPhoton.hh" #include "G4Cerenkov.hh" #include "G4Scintillation.hh" #include "G4OpAbsorption.hh" #include "G4OpRayleigh.hh" #include "G4OpMieHG.hh" #include "G4OpBoundaryProcess.hh" #include "G4ProcessManager.hh" #include "G4EmSaturation.hh" #include "G4LossTableManager.hh" #include "G4UAtomicDeexcitation.hh" G4ThreadLocal G4Cerenkov* OpticalPhotonPhysics::fCerenkovProcess = 0; G4ThreadLocal G4Scintillation* OpticalPhotonPhysics::fScintillationProcess = 0; G4ThreadLocal G4OpAbsorption* OpticalPhotonPhysics::fAbsorptionProcess = 0; G4ThreadLocal G4OpRayleigh* OpticalPhotonPhysics::fRayleighScatteringProcess = 0; G4ThreadLocal G4OpMieHG* OpticalPhotonPhysics::fMieHGScatteringProcess = 0; G4ThreadLocal G4OpBoundaryProcess* OpticalPhotonPhysics::fBoundaryProcess = 0; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... OpticalPhotonPhysics::OpticalPhotonPhysics(const G4String& name):G4VPhysicsConstructor(name) { fOPVerboseLevel = 0; fMaxNumPhotonStep = 30; IWantCerernkov = false; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... OpticalPhotonPhysics::~OpticalPhotonPhysics(){;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void OpticalPhotonPhysics::ConstructParticle() { G4OpticalPhoton::OpticalPhotonDefinition(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void OpticalPhotonPhysics::ConstructProcess() { G4cout << "### Optical Physics activated ###" << G4endl;; if(IWantCerernkov) { fCerenkovProcess = new G4Cerenkov("Cerenkov"); fCerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotonStep); fCerenkovProcess->SetMaxBetaChangePerStep(10.0); fCerenkovProcess->SetTrackSecondariesFirst(true); fCerenkovProcess->SetVerboseLevel(fOPVerboseLevel); G4cout << "### Cerenkov Process activated ###" << G4endl; } fScintillationProcess = new G4Scintillation("Scintillation"); //fScintillationProcess->SetScintillationYieldFactor(1.); fScintillationProcess->SetTrackSecondariesFirst(true); fAbsorptionProcess = new G4OpAbsorption(); fRayleighScatteringProcess = new G4OpRayleigh(); fMieHGScatteringProcess = new G4OpMieHG(); fBoundaryProcess = new G4OpBoundaryProcess(); fScintillationProcess->SetVerboseLevel(fOPVerboseLevel); fAbsorptionProcess->SetVerboseLevel(fOPVerboseLevel); fRayleighScatteringProcess->SetVerboseLevel(fOPVerboseLevel); fMieHGScatteringProcess->SetVerboseLevel(fOPVerboseLevel); fBoundaryProcess->SetVerboseLevel(fOPVerboseLevel); /* //Use Birks Correction in the Scintillation process if(G4Threading::IsMasterThread()) { G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation(); fScintillationProcess->AddSaturation(emSaturation); } */ GetParticleIterator()->reset(); while((*GetParticleIterator())()) { G4ParticleDefinition* particle = GetParticleIterator()->value(); G4ProcessManager* pmanager = particle->GetProcessManager(); G4String particleName = particle->GetParticleName(); if (IWantCerernkov && fCerenkovProcess->IsApplicable(*particle)) { pmanager->AddProcess(fCerenkovProcess); pmanager->SetProcessOrdering(fCerenkovProcess,idxPostStep); } if (fScintillationProcess->IsApplicable(*particle)) { pmanager->AddProcess(fScintillationProcess); pmanager->SetProcessOrderingToLast(fScintillationProcess, idxAtRest); pmanager->SetProcessOrderingToLast(fScintillationProcess, idxPostStep); } if (particleName == "opticalphoton") { G4cout << "### Add Discrete Processes to OpticalPhoton ###" << G4endl; pmanager->AddDiscreteProcess(fAbsorptionProcess); pmanager->AddDiscreteProcess(fRayleighScatteringProcess); pmanager->AddDiscreteProcess(fMieHGScatteringProcess); pmanager->AddDiscreteProcess(fBoundaryProcess); } } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......