diff --git a/geant4/LEMuSR/src/AsymCheck.cc b/geant4/LEMuSR/src/AsymCheck.cc index 8bfd81e..b654562 100644 --- a/geant4/LEMuSR/src/AsymCheck.cc +++ b/geant4/LEMuSR/src/AsymCheck.cc @@ -43,7 +43,7 @@ AsymCheck::AsymCheck() AsymCheck::~AsymCheck() { PrintAsym(); - G4cout <<"\n Left/Right Asymmetry: L vs R = " << L <<" vs " << R <<" => A = " << A <<" for "<< L+R <<" particles.\n"< A = " << A <<" for "<< L+R <<" particles.\n"<GetVerboseLevel(); - // execute DecayIt() + + #ifdef G4VERBOSE if (GetVerboseLevel()>1) { G4cerr << "LEMuSRDecay::DoIt : selected decay channel addr:" << decaychannel <SetVerboseLevel(GetVerboseLevel()); + decaychannel->DumpInfo(); } #endif @@ -113,7 +115,7 @@ G4VParticleChange* LEMuSRDecay::DecayIt(const G4Track& aTrack, const G4Step& aSt G4ThreeVector parent_polarization = aParticle->GetPolarization(); //-----------------------------INFORMATION--------------------------------- - // G4cout <<"LEMuSRDecay MESSAGE:: polarization is " << parent_polarization <<" .\n"; + // G4cout <<"LEMuSRDecay MESSAGE:: polarization is " << parent_polarization <<" .\n"; if(aParticle->GetDefinition()->GetParticleName()=="mu+"||aParticle->GetDefinition()->GetParticleName()=="Mu") { decaychannel->SetParentPolarization(parent_polarization); @@ -129,9 +131,7 @@ G4VParticleChange* LEMuSRDecay::DecayIt(const G4Track& aTrack, const G4Step& aSt testb++; } #ifdef G4VERBOSE - if (GetVerboseLevel()>1) { - G4cout<<"Decay Channela "< +#include // HEADER @@ -98,9 +98,9 @@ LEMuSRDetectorConstruction::LEMuSRDetectorConstruction() FieldMapsDir=getenv("LEMuSR_FIELDMAPS_DIR"); if(FieldMapsDir) - G4cout<<"Fied Maps Directory is: "<< FieldMapsDir< +#include LEMuSRElMagField::LEMuSRElMagField( G4ElectricField *E, G4MagneticField *B, G4double field1_val, G4double field2_val) { diff --git a/geant4/LEMuSR/src/LEMuSRMuoniumParticle.cc b/geant4/LEMuSR/src/LEMuSRMuoniumParticle.cc new file mode 100644 index 0000000..501644a --- /dev/null +++ b/geant4/LEMuSR/src/LEMuSRMuoniumParticle.cc @@ -0,0 +1,94 @@ +// +// ******************************************************************** +// * DISCLAIMER * +// * * +// * The following disclaimer summarizes all the specific disclaimers * +// * of contributors to this software. The specific disclaimers,which * +// * govern, are listed with their locations in: * +// * http://cern.ch/geant4/license * +// * * +// * 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. * +// * * +// * This code implementation is the intellectual property of the * +// * GEANT4 collaboration. * +// * By copying, distributing or modifying the Program (or any work * +// * based on the Program) you indicate your acceptance of this * +// * statement, and all its terms. * +// ******************************************************************** +// +// +// $Id: LEMuSRMuoniumParticle.cc,v 1.10 2005/01/14 03:49:17 asaim Exp $ +// GEANT4 tag $Name: geant4-08-00-patch-01 $ +// +// +// ---------------------------------------------------------------------- +// GEANT 4 class implementation file +// +// History: first implementation, based on object model of +// 4th April 1996, G.Cosmo +// ********************************************************************** +// New impelemenataion as an utility class M.Asai, 26 July 2004 +// ---------------------------------------------------------------------- + +#include "LEMuSRMuoniumParticle.hh" +#include "G4ParticleTable.hh" + +#include "G4MuonDecayChannel.hh" +#include "G4DecayTable.hh" + +// ###################################################################### +// ### MUONIUM ### +// ###################################################################### +LEMuSRMuoniumParticle* LEMuSRMuoniumParticle::theInstance = 0; + +LEMuSRMuoniumParticle* LEMuSRMuoniumParticle::Definition() +{ + if (theInstance !=0) return theInstance; + const G4String name = "Mu"; + // search in particle table] + G4ParticleTable* pTable = G4ParticleTable::GetParticleTable(); + G4ParticleDefinition* anInstance = pTable->FindParticle(name); + if (anInstance ==0) + { + // create particle + // + // Arguments for constructor are as follows + // name mass width charge + // 2*spin parity C-conjugation + // 2*Isospin 2*Isospin3 G-parity + // type lepton number baryon number PDG encoding + // stable lifetime decay table + // shortlived subType anti_encoding + anInstance = new G4ParticleDefinition( + name, 0.1056584*GeV, 2.99591e-16*MeV, 0.*eplus, + 1, 0, 0, + 0, 0, 0, + "lepton", -1, 0, -1313, + false, 2197.03*ns, NULL, + false, "mu" + ); + //create Decay Table + G4DecayTable* table = new G4DecayTable(); + // create a decay channel + G4VDecayChannel* mode = new G4MuonDecayChannel("Mu",1.00); + table->Insert(mode); + anInstance->SetDecayTable(table); + } + theInstance = reinterpret_cast(anInstance); + return theInstance; +} + +LEMuSRMuoniumParticle* LEMuSRMuoniumParticle::MuoniumDefinition() +{ + return Definition(); +} + +LEMuSRMuoniumParticle* LEMuSRMuoniumParticle::Muonium() +{ + return Definition(); +} + diff --git a/geant4/LEMuSR/src/LEMuSRPhysicsList.cc b/geant4/LEMuSR/src/LEMuSRPhysicsList.cc index 361b712..75763b7 100644 --- a/geant4/LEMuSR/src/LEMuSRPhysicsList.cc +++ b/geant4/LEMuSR/src/LEMuSRPhysicsList.cc @@ -1,11 +1,10 @@ -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION // -// ID : LEMuSRPhysicsList.cc , v 1.1 +// ID : LEMuSRMuonPhysics.cc , v 1.5 // AUTHOR: Taofiq PARAISO -// DATE : 2004-08-24 16:33 -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$// -// +// DATE : 2006-02-25 14:47 +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$// // & &&&&&&&&&& &&&&&&& &&&&&&&& // & & && && & && // & & & & & & && @@ -17,77 +16,572 @@ // & // & // & -// PHYSICS LIST -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$// - +// MuonPhysics +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// AFTER $Id$ +// GEANT4 tag $Name: geant4-08-00-patch-01 $ exampleN07.cc +// #include "LEMuSRPhysicsList.hh" -#include "globals.hh" #include "G4ParticleDefinition.hh" #include "G4ProcessManager.hh" #include "G4ProcessVector.hh" #include "G4ParticleTypes.hh" #include "G4ParticleTable.hh" +#include "G4ios.hh" -#include "G4Material.hh" -#include "G4MaterialTable.hh" -#include "G4ios.hh" -#include +// LEMuSR Muonium Particle +#include "LEMuSRMuoniumParticle.hh" -#include "LEMuSRGeneralPhysics.hh" -#include "LEMuSREMPhysics.hh" -#include "LEMuSRMuonPhysics.hh" -#include "LEMuSRHadronPhysics.hh" -#include "LEMuSRIonPhysics.hh" -LEMuSRPhysicsList::LEMuSRPhysicsList(): G4VModularPhysicsList() + + + + + + + +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// CONSTRUCTOR AND DESTRUCTOR // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + +LEMuSRPhysicsList::LEMuSRPhysicsList(): G4VUserPhysicsList() { - SetCuts(); - - //! Register General Processes - RegisterPhysics( new LEMuSRGeneralPhysics("general") ); - - //! Register Electro-Magnetic Prcesses - RegisterPhysics( new LEMuSREMPhysics("standard EM")); - - //! Register Muon Processes - RegisterPhysics( new LEMuSRMuonPhysics("muon")); - - //! Register Hadron Processes - RegisterPhysics( new LEMuSRHadronPhysics("hadron")); - - //! Register Ion Processes - RegisterPhysics( new LEMuSRIonPhysics("ion")); - - + defaultCutValue = 1.0*mm; + SetVerboseLevel(1); } LEMuSRPhysicsList::~LEMuSRPhysicsList() +{} + + + + + + +/*! \anchor constructparticles*/ +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// CONSTRUCTION OF THE DIFFERENT PARTICLES // +// CALLS THE DIFFERENT CONSTRUCTION METHODS // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + +void LEMuSRPhysicsList::ConstructParticle() { + // In this method, static member functions should be called + // for all particles which you want to use. + // This ensures that objects of these particle types will be + // created in the program. + + ConstructBosons(); + ConstructLeptons(); + ConstructBaryons(); + // ConstructMesons(); } - /*! - * " G4VUserPhysicsList::SetCutsWithDefault" method sets - * the default cut value for all particle types . - * The cut value is given in distance, and is then converted - * in energy according the particle's stopping range in different - * materials. - */ + + + +/*! \anchor constructparticlesmethods*/ +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// CONSTRUCTION METHODS FOR THE DIFFERENT PARTICLES // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + +void LEMuSRPhysicsList::ConstructBosons() +{ + // pseudo-particles + G4Geantino::GeantinoDefinition(); + G4ChargedGeantino::ChargedGeantinoDefinition(); + + // gamma + G4Gamma::GammaDefinition(); +} + +void LEMuSRPhysicsList::ConstructLeptons() +{ + // leptons + G4Electron::ElectronDefinition(); + G4Positron::PositronDefinition(); + G4MuonPlus::MuonPlusDefinition(); + LEMuSRMuoniumParticle::MuoniumDefinition(); + G4MuonMinus::MuonMinusDefinition(); + + G4NeutrinoE::NeutrinoEDefinition(); + G4AntiNeutrinoE::AntiNeutrinoEDefinition(); + G4NeutrinoMu::NeutrinoMuDefinition(); + G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); +} + +void LEMuSRPhysicsList::ConstructMesons() +{ + // mesons + G4PionPlus::PionPlusDefinition(); + G4PionMinus::PionMinusDefinition(); + G4PionZero::PionZeroDefinition(); + G4Eta::EtaDefinition(); + G4EtaPrime::EtaPrimeDefinition(); + G4KaonPlus::KaonPlusDefinition(); + G4KaonMinus::KaonMinusDefinition(); + G4KaonZero::KaonZeroDefinition(); + G4AntiKaonZero::AntiKaonZeroDefinition(); + G4KaonZeroLong::KaonZeroLongDefinition(); + G4KaonZeroShort::KaonZeroShortDefinition(); +} + +void LEMuSRPhysicsList::ConstructBaryons() +{ +// barions + G4Proton::ProtonDefinition(); + G4AntiProton::AntiProtonDefinition(); + G4Neutron::NeutronDefinition(); + G4AntiNeutron::AntiNeutronDefinition(); +} + + + + + + + + + + + + +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// DECLARE PROCESSES // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + +#include "G4ComptonScattering.hh" +#include "G4GammaConversion.hh" +#include "G4PhotoElectricEffect.hh" + +#include "G4MultipleScattering.hh" + +#include "G4eIonisation.hh" +#include "G4eBremsstrahlung.hh" +#include "G4eplusAnnihilation.hh" + +#include "G4MuIonisation.hh" +#include "G4MuBremsstrahlung.hh" +#include "G4MuPairProduction.hh" + +#include "G4hIonisation.hh" + + +// LEMuSR Processes +#include "LEMuSRAtRestSpinRotation.hh" +#include "LEMuSRDepolarize.hh" +#include "LEMuSRMSC.hh" +#include "LEMuSRMUONIUM.hh" +#include "LEMuSRMUONIUMScatt.hh" + +/*! \anchor constructprocesses*/ +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// CONSTRUCTION OF THE DIFFERENT PROCESSES // +// CALLS THE DIFFERENT CONSTRUCTION METHODS // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + + +void LEMuSRPhysicsList::ConstructProcess() +{ + /*! The transportation process is added to all particle. cf. + * G4VPhysicsList + */ + AddTransportation(); + + /*! Construction of Electromagnetic processes: + * those are the processes for the leptons and the bosons + */ + ConstructEM(); + + /*! Construction of the Decay process when applicable. */ + ConstructGeneral(); +} + + + + +/*! \anchor constructprocessesmetods*/ +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// THE DIFFERENT PROCESSES CONSTRUCTION METHODS // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + + +void LEMuSRPhysicsList::ConstructEM() +{ + theParticleIterator->reset(); + while( (*theParticleIterator)() ){ + G4ParticleDefinition* particle = theParticleIterator->value(); + G4ProcessManager* pmanager = particle->GetProcessManager(); + G4String particleName = particle->GetParticleName(); + + if (particleName == "gamma") { + // gamma + pmanager->AddDiscreteProcess(new G4GammaConversion()); + pmanager->AddDiscreteProcess(new G4ComptonScattering()); + pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); + + } else if (particleName == "e-") { + //electron + G4VProcess* theeminusMultipleScattering = new G4MultipleScattering(); + G4VProcess* theeminusIonisation = new G4eIonisation(); + G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung(); + // + // add processes + pmanager->AddProcess(theeminusMultipleScattering); + pmanager->AddProcess(theeminusIonisation); + pmanager->AddProcess(theeminusBremsstrahlung); + // + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1); + pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2); + pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxAlongStep,3); + // + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1); + pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2); + pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3); + + } else if (particleName == "e+") { + //positron + G4VProcess* theeplusMultipleScattering = new G4MultipleScattering(); + G4VProcess* theeplusIonisation = new G4eIonisation(); + G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung(); + G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation(); + // + // add processes + pmanager->AddProcess(theeplusMultipleScattering); + pmanager->AddProcess(theeplusIonisation); + pmanager->AddProcess(theeplusBremsstrahlung); + pmanager->AddProcess(theeplusAnnihilation); + // + // set ordering for AtRestDoIt + pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest); + // + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1); + pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2); + pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxAlongStep,3); + // + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1); + pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2); + pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3); + pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4); + + } + + + + /*! \anchor muplusphysics*/ + //! Muon Plus Physics is implemented here. + else if( particleName == "mu+" ) { + + // PROCESSES FOR MUON PLUS + + //! Multiple Scattering including Meyer'Algorithm: LEMuSRMSC + G4VProcess* aMultipleScattering = new LEMuSRMSC(); + + //! Muonium formation: LEMuSRMUONIUM + G4VProcess* aMuoniumFormation = new LEMuSRMUONIUM(); + + //! Spin Precession Process At Rest: LEMuSRAtRestSpinRotation + G4VProcess* aRestSpinRotation = new LEMuSRAtRestSpinRotation(); + + + + //! Unchanged \gf processes + G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung(); + G4VProcess* aPairProduction = new G4MuPairProduction(); + G4VProcess* anIonisation = new G4MuIonisation(); + + + + // ADD WANTED PROCESSES TO PROCESS MANAGER + + // add lemu processes + pmanager->AddProcess(aMultipleScattering); + pmanager->AddProcess(aMuoniumFormation); + pmanager->AddProcess(aRestSpinRotation); + + // add \gf processes + pmanager->AddProcess(aBremsstrahlung); + pmanager->AddProcess(anIonisation); + pmanager->AddProcess(aPairProduction); + + + // SET PROCESSES ORDERING (ALONG STEP. POST STEP. AT REST). + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1); + pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2); + pmanager->SetProcessOrdering(aBremsstrahlung, idxAlongStep,3); + pmanager->SetProcessOrdering(aPairProduction, idxAlongStep,4); + + + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1); + pmanager->SetProcessOrdering(aMuoniumFormation, idxPostStep,2); + pmanager->SetProcessOrdering(anIonisation, idxPostStep,3); + pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,4); + pmanager->SetProcessOrdering(aPairProduction, idxPostStep,5); + + // set ordering for AtRestDoIt + pmanager->SetProcessOrdering(aRestSpinRotation, idxAtRest,1); + + + } + + + /*! \anchor muoniumphysics*/ + //! Muonium Physics is implemented here. + else if( particleName == "Mu" ) { + + // PROCESSES FOR MUONIUM + + //! Spin Precession Process At Rest: LEMuSRAtRestSpinRotation + G4VProcess* aRestSpinRotation = new LEMuSRAtRestSpinRotation(); + G4VProcess* aMuScatt = new LEMuSRMUONIUMScatt(); + + /* + //! Unchanged \gf processes + G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung(); + G4VProcess* aPairProduction = new G4MuPairProduction(); + G4VProcess* anIonisation = new G4MuIonisation(); + + */ + + // ADD WANTED PROCESSES TO PROCESS MANAGER + + // add lemu processes + pmanager->AddProcess(aMuScatt); + pmanager->AddProcess(aRestSpinRotation); + + // add \gf processes + // pmanager->AddProcess(aBremsstrahlung); + // pmanager->AddProcess(anIonisation); + // pmanager->AddProcess(aPairProduction); + + + // SET PROCESSES ORDERING (ALONG STEP. POST STEP. AT REST). + // set ordering for AlongStepDoIt + // pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1); + // pmanager->SetProcessOrdering(aBremsstrahlung, idxAlongStep,2); + // pmanager->SetProcessOrdering(aPairProduction, idxAlongStep,3); + + + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMuScatt, idxPostStep,1); + // pmanager->SetProcessOrdering(anIonisation, idxPostStep,2); + // pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3); + // pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4); + + // set ordering for AtRestDoIt + pmanager->SetProcessOrdering(aRestSpinRotation, idxAtRest,1); + + + } + + + /*! \anchor muonminusphysics*/ + //! Muon Minus Physics is implemented here. + else if( particleName == "mu-" ) { + //muon minus + G4VProcess* aMultipleScattering = new G4MultipleScattering(); + G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung(); + G4VProcess* aPairProduction = new G4MuPairProduction(); + G4VProcess* anIonisation = new G4MuIonisation(); + // + // add processes + pmanager->AddProcess(anIonisation); + pmanager->AddProcess(aMultipleScattering); + pmanager->AddProcess(aBremsstrahlung); + pmanager->AddProcess(aPairProduction); + // + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1); + pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2); + pmanager->SetProcessOrdering(aBremsstrahlung, idxAlongStep,3); + pmanager->SetProcessOrdering(aPairProduction, idxAlongStep,4); + + // + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1); + pmanager->SetProcessOrdering(anIonisation, idxPostStep,2); + pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3); + pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4); + + + + + } else if ((!particle->IsShortLived()) && + (particle->GetPDGCharge() != 0.0) && + (particle->GetParticleName() != "chargedgeantino")) { + // all others charged particles except geantino + G4VProcess* aMultipleScattering = new G4MultipleScattering(); + G4VProcess* anIonisation = new G4hIonisation(); + // + // add processes + pmanager->AddProcess(anIonisation); + pmanager->AddProcess(aMultipleScattering); + // + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1); + pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2); + // + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1); + pmanager->SetProcessOrdering(anIonisation, idxPostStep,2); + } + } +} + + + + + +// LEMuSR decay process +#include "LEMuSRMuonDecayChannel.hh" +#include "LEMuSRDecay.hh" +// Geant decay processes +#include "G4MuonDecayChannel.hh" +#include "G4MuonDecayChannelWithSpin.hh" +#include "G4DecayWithSpin.hh" +#include "G4Decay.hh" +#include "G4UserSpecialCuts.hh" +#include "G4DecayTable.hh" + + +/*! \anchor constructdecayprocess*/ +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +// // +// CONSTRUCTION METHOD FOR DECAY PROCESS // +// // +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + +//! This method constructs the decay process for all the particles. +void LEMuSRPhysicsList::ConstructGeneral() +{ + /*! Declare Decay Processes (from \lemu and \gf).*/ + G4Decay* theDecayProcess = new G4Decay(); + LEMuSRDecay* theLEMuSRDecayProcess = new LEMuSRDecay(); + + /*! Initialization of the particle iterator.*/ + theParticleIterator->reset(); + + + while( (*theParticleIterator)() ) + { + G4ParticleDefinition* particle = theParticleIterator->value(); + + /*! If the particle is a muon plus or a muonium, + * add the decay process from \lemu. + */ + if (particle->GetParticleName()=="mu+") + { + /*! Initialize the decay table.*/ + /*! + * Although the asymmetric decay process is a feature of + *new Geant4 versions, + * it is recommended to use the original \lemu implementation. + */ + G4DecayTable* MuonPlusDecayTable = new G4DecayTable(); + MuonPlusDecayTable -> Insert(new LEMuSRMuonDecayChannel("mu+",1.00)); + MuonPlusDecayTable ->DumpInfo(); + G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(MuonPlusDecayTable); + + G4ProcessManager* pmanager = particle->GetProcessManager(); + if (theLEMuSRDecayProcess->IsApplicable(*particle)) + { + pmanager ->AddProcess(theLEMuSRDecayProcess); + // set ordering for PostStepDoIt and AtRestDoIt + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxPostStep); + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxAtRest); + } + } + else if (particle->GetParticleName()=="Mu") + { + /*! Initialize the decay table.*/ + + /*! + Half of the muonium have a completely isotropic decay. + */ + G4DecayTable* MuoniumDecayTable = new G4DecayTable(); + MuoniumDecayTable -> Insert(new LEMuSRMuonDecayChannel("Mu",0.5)); + MuoniumDecayTable -> Insert(new G4MuonDecayChannel("Mu",0.5)); + MuoniumDecayTable ->DumpInfo(); + LEMuSRMuoniumParticle::MuoniumDefinition() -> SetDecayTable(MuoniumDecayTable); + + G4ProcessManager* pmanager = particle->GetProcessManager(); + if (theLEMuSRDecayProcess->IsApplicable(*particle)) + { + pmanager ->AddProcess(theLEMuSRDecayProcess); + // set ordering for PostStepDoIt and AtRestDoIt + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxPostStep); + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxAtRest); + } + + + + } + + + + + + /*! For all other particles, + * add the decay process from \lemu also, it checks if particle is muon or not. + */ + else + { + G4ProcessManager* pmanager = particle->GetProcessManager(); + if (theLEMuSRDecayProcess->IsApplicable(*particle)) + { + pmanager ->AddProcess(theLEMuSRDecayProcess); + // set ordering for PostStepDoIt and AtRestDoIt + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxPostStep); + pmanager ->SetProcessOrdering(theLEMuSRDecayProcess, idxAtRest); + } + } + + } + +} + +#include "G4Region.hh" +#include "G4RegionStore.hh" +#include "G4ProductionCuts.hh" + void LEMuSRPhysicsList::SetCuts() { - defaultCutValue = 1.0*cm; - SetCutsWithDefault(); - - SetCutValue(1.*mm, "e+"); - SetCutValue(1.*mm, "e-"); - SetCutValue(1*mm, "proton"); - - // SetCutValue(0.001*mm, "mu+"); - // SetCutValue(0.001*mm, "Mu"); - + if (verboseLevel >0){ + G4cout << "LEMuSRPhysicsList::SetCuts: default cut length : " + << G4BestUnit(defaultCutValue,"Length") << G4endl; + } + + // These values are used as the default production thresholds + // for the world volume. + SetCutsWithDefault(); + + } - - diff --git a/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc b/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc index 66a6c7c..10f2195 100644 --- a/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc +++ b/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc @@ -46,7 +46,7 @@ #include "G4ios.hh" #include -#include "G4Muonium.hh" +#include "LEMuSRMuoniumParticle.hh" /*! * In the constructor the PGA messenger is initialized diff --git a/geant4/LEMuSR/src/LEMuSRRunAction.cc b/geant4/LEMuSR/src/LEMuSRRunAction.cc index 4547b3f..9355a4f 100644 --- a/geant4/LEMuSR/src/LEMuSRRunAction.cc +++ b/geant4/LEMuSR/src/LEMuSRRunAction.cc @@ -74,10 +74,6 @@ void LEMuSRRunAction::BeginOfRunAction(const G4Run* aRun) G4RunManager::GetRunManager()->SetRandomNumberStore(true); - if (G4VVisManager::GetConcreteInstance()) - { - UI->ApplyCommand("/vis/scene/notifyHandlers"); - } @@ -87,10 +83,7 @@ void LEMuSRRunAction::BeginOfRunAction(const G4Run* aRun) /*! Updates the user interface manager.*/ void LEMuSRRunAction::EndOfRunAction(const G4Run*) { - if (G4VVisManager::GetConcreteInstance()) - { - G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update"); - } + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/geant4/LEMuSR/src/LEMuSRSteppingAction.cc b/geant4/LEMuSR/src/LEMuSRSteppingAction.cc index e7054d1..19aa557 100644 --- a/geant4/LEMuSR/src/LEMuSRSteppingAction.cc +++ b/geant4/LEMuSR/src/LEMuSRSteppingAction.cc @@ -111,7 +111,7 @@ void LEMuSRSteppingAction::LoopKiller(const G4Step *aStep) G4cout<<"killed "<GetTrack()->GetDefinition()->GetParticleName()=="e-" + /* if(aStep->GetTrack()->GetDefinition()->GetParticleName()=="e-" ||aStep->GetTrack()->GetDefinition()->GetParticleName()=="gamma" ||aStep->GetTrack()->GetDefinition()->GetParticleName()=="nu_e" ||aStep->GetTrack()->GetDefinition()->GetParticleName()=="anti_nu_e" @@ -120,7 +120,7 @@ void LEMuSRSteppingAction::LoopKiller(const G4Step *aStep) { aStep->GetTrack()->SetTrackStatus(fStopAndKill); } - + */ } diff --git a/geant4/LEMuSR/src/LEMuSRVisManager.cc b/geant4/LEMuSR/src/LEMuSRVisManager.cc index 30d32be..b6b5ae3 100644 --- a/geant4/LEMuSR/src/LEMuSRVisManager.cc +++ b/geant4/LEMuSR/src/LEMuSRVisManager.cc @@ -102,7 +102,6 @@ void LEMuSRVisManager::RegisterGraphicsSystems () { #endif #ifdef G4VIS_USE_OPENGLX - G4OpenGLImmediateX* OPENGL=new G4OpenGLImmediateX; RegisterGraphicsSystem (new G4OpenGLImmediateX); RegisterGraphicsSystem (new G4OpenGLStoredX); #endif diff --git a/geant4/LEMuSR/src/LEMuSRdummydets.cc b/geant4/LEMuSR/src/LEMuSRdummydets.cc index 072c35b..b3127b7 100644 --- a/geant4/LEMuSR/src/LEMuSRdummydets.cc +++ b/geant4/LEMuSR/src/LEMuSRdummydets.cc @@ -54,7 +54,7 @@ // G4 CLASSES #include "G4ios.hh" -#include +#include // HEADER @@ -92,8 +92,8 @@ void LEMuSRDetectorConstruction::lemuAsym() // solids Asym_tube = new G4Tubs("sAsym",0.*cm,1*cm,0.0000001*cm, dSPhi, dEPhi); - G4Sphere *Asym_sphl = new G4Sphere("sphAsymL",25*cm,25.001*cm,0.*deg,360*deg,90*deg,90*deg); - G4Sphere *Asym_sphr = new G4Sphere("sphAsymR",25*cm,25.001*cm,0.*deg,360*deg,0*deg,90*deg); + G4Sphere *Asym_sphl = new G4Sphere("sphAsymL",25*cm,25.000001*cm,0.*deg,360*deg,90*deg,90*deg); + G4Sphere *Asym_sphr = new G4Sphere("sphAsymR",25*cm,25.000001*cm,0.*deg,360*deg,0*deg,90*deg); // logical volumes lv_Asym = new G4LogicalVolume(Asym_tube,G4Material::GetMaterial("vacuum"),"lv_Asym",0,0,0);