Import Geant4 3.0.0 source tree
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
// 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: G3toG4DetectorConstruction.cc,v 1.1 2000/07/24 11:23:43 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
// G3toG4DetectorConstruction. Most the work is Done in
|
||||
// G4BuildGeom, which returns a G4LogicalVolume*, a pointer to the
|
||||
// top-level logiical volume in the detector defined by the call List file
|
||||
// inFile
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G3toG4DetectorConstruction.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
G3toG4DetectorConstruction::G3toG4DetectorConstruction(G4String inFile){
|
||||
_inFile = inFile;
|
||||
G4cout << "Instantiated G3toG4DetectorConstruction using call list file \""
|
||||
<< _inFile << "\"" << G4endl;
|
||||
}
|
||||
|
||||
G3toG4DetectorConstruction::~G3toG4DetectorConstruction(){
|
||||
// G4cout << "Deleted G3toG4DetectorConstruction..." << G4endl;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G3toG4DetectorConstruction::Construct(){
|
||||
_lv = G4BuildGeom(_inFile);
|
||||
//_lv = SimpleConstruct();
|
||||
if (_lv != 0) {
|
||||
_pv = new G4PVPlacement(0, G4ThreeVector(), _lv, _lv->GetName(), 0,
|
||||
false, 0);
|
||||
G4cout << "Top-level G3toG4 logical volume " << _lv->GetName() << " "
|
||||
<< *(_lv -> GetVisAttributes()) << G4endl;
|
||||
} else
|
||||
G4cerr << "creation of logical mother failed !!!" << G4endl;
|
||||
return _pv;
|
||||
}
|
||||
G4LogicalVolume*
|
||||
G3toG4DetectorConstruction::SimpleConstruct(){
|
||||
G4String name, symbol; //a=mass of a mole;
|
||||
G4double a, z, density, fractionmass; //z=mean number of protons;
|
||||
G4int ncomponents, iz, n; //iz=number of protons in an isotope;
|
||||
// n=number of nucleons in an isotope;
|
||||
|
||||
a = 14.01*g/mole;
|
||||
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
||||
|
||||
a = 16.00*g/mole;
|
||||
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
||||
|
||||
//
|
||||
// define a material from elements. case 2: mixture by fractional mass
|
||||
//
|
||||
|
||||
density = 1.290*mg/cm3;
|
||||
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
|
||||
Air->AddElement(N, fractionmass=0.7);
|
||||
Air->AddElement(O, fractionmass=0.3);
|
||||
G4VSolid* Mother = new G4Box("TestMother", //its name
|
||||
100*cm, 100*cm, 100*cm); //its size
|
||||
|
||||
G4VSolid* Daughter = new G4Box("TestDaughter", 50*cm, 20*cm, 10*cm);
|
||||
|
||||
G4LogicalVolume* logicMother = new G4LogicalVolume(Mother, //its solid
|
||||
Air, //its material
|
||||
"LTestMother");//its name
|
||||
|
||||
G4LogicalVolume* logicDaughter = new G4LogicalVolume(Daughter, //its solid
|
||||
Air, //its material
|
||||
"LTestDaughter");
|
||||
|
||||
G4VPhysicalVolume* physiDaughter = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
logicDaughter,
|
||||
"PTestDaughter",
|
||||
logicMother,
|
||||
false,0);
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
|
||||
logicMother->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
G4VisAttributes* DaughterVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
DaughterVisAtt->SetVisibility(true);
|
||||
logicDaughter->SetVisAttributes(DaughterVisAtt);
|
||||
return logicMother;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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: G3toG4EventAction.cc,v 1.1 2000/07/24 11:23:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "g4rw/tvordvec.h"
|
||||
#include "G4ios.hh"
|
||||
#include "G3toG4EventAction.hh"
|
||||
#include "G3toG4EventActionMessenger.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4EventAction::G3toG4EventAction()
|
||||
: drawFlag("all"),eventMessenger(NULL)
|
||||
{
|
||||
eventMessenger = new G3toG4EventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4EventAction::~G3toG4EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4EventAction::BeginOfEventAction(const G4Event* Ev)
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4EventAction::EndOfEventAction(const G4Event* Ev)
|
||||
{
|
||||
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
|
||||
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
|
||||
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if(trajectoryContainer){
|
||||
n_trajectories = trajectoryContainer->entries();
|
||||
}
|
||||
G4cout << " " << n_trajectories
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
|
||||
if(G4VVisManager::GetConcreteInstance()){
|
||||
for(G4int i=0; i<n_trajectories; i++) {
|
||||
G4Trajectory* trj = (G4Trajectory*)(*(evt->GetTrajectoryContainer()))[i];
|
||||
if (drawFlag == "all") trj->DrawTrajectory(50);
|
||||
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
|
||||
trj->DrawTrajectory(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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: G3toG4EventActionMessenger.cc,v 1.1 2000/07/24 11:23:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G3toG4EventActionMessenger.hh"
|
||||
|
||||
#include "G3toG4EventAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4EventActionMessenger::G3toG4EventActionMessenger(G3toG4EventAction* EvAct)
|
||||
:eventAction(EvAct)
|
||||
{
|
||||
DrawCmd = new G4UIcmdWithAString("/event/draw",this);
|
||||
DrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
DrawCmd->SetGuidance(" Choice : none, charged, all (default)");
|
||||
DrawCmd->SetParameterName("choice",true);
|
||||
DrawCmd->SetDefaultValue("all");
|
||||
DrawCmd->SetCandidates("none charged all");
|
||||
DrawCmd->AvailableForStates(Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4EventActionMessenger::~G3toG4EventActionMessenger()
|
||||
{
|
||||
delete DrawCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if(command == DrawCmd)
|
||||
{eventAction->SetDrawFlag(newValue);}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,293 @@
|
||||
// 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: G3toG4PhysicsList.cc,v 1.1 2000/07/24 11:23:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G3toG4PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4PhysicsList::G3toG4PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
currentDefaultCut = defaultCutValue = 2.0*mm;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = defaultCutValue;
|
||||
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4PhysicsList::~G3toG4PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::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();
|
||||
ConstructMesons();
|
||||
ConstructBaryons();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#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"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
//gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering());
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion());
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
|
||||
pmanager->AddProcess(new G4MuIonisation(), -1, 2,2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung(), -1,-1,3);
|
||||
pmanager->AddProcess(new G4MuPairProduction(), -1,-1,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
|
||||
pmanager->AddProcess(new G4hIonisation(), -1,2,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void G3toG4PhysicsList::ConstructGeneral()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4PhysicsList::SetCuts()
|
||||
{
|
||||
// reactualise cutValues
|
||||
if (currentDefaultCut != defaultCutValue)
|
||||
{
|
||||
if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
|
||||
if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
|
||||
if(cutForProton == currentDefaultCut) cutForProton = defaultCutValue;
|
||||
currentDefaultCut = defaultCutValue;
|
||||
}
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "G3toG4PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForElectron, "e+");
|
||||
|
||||
// set cut values for proton and anti_proton before all other hadrons
|
||||
// because some processes for hadrons need cut values for proton/anti_proton
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValue(cutForProton, "anti_proton");
|
||||
|
||||
SetCutValueForOthers(defaultCutValue);
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void G3toG4PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForGamma = cut;
|
||||
}
|
||||
|
||||
void G3toG4PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForElectron = cut;
|
||||
}
|
||||
|
||||
void G3toG4PhysicsList::SetCutForProton(G4double cut)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForProton = cut;
|
||||
}
|
||||
|
||||
G4double G3toG4PhysicsList::GetCutForGamma() const
|
||||
{
|
||||
return cutForGamma;
|
||||
}
|
||||
|
||||
G4double G3toG4PhysicsList::GetCutForElectron() const
|
||||
{
|
||||
return cutForElectron;
|
||||
}
|
||||
|
||||
G4double G3toG4PhysicsList::GetCutForProton() const
|
||||
{
|
||||
return cutForGamma;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// 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: G3toG4PrimaryGeneratorAction.cc,v 1.2 2000/08/01 09:44:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G3toG4PrimaryGeneratorAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
G3toG4PrimaryGeneratorAction::G3toG4PrimaryGeneratorAction(){
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="chargedgeantino");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
G4ThreeVector direction(0, 0, 1);
|
||||
particleGun->SetParticleMomentumDirection(direction.unit());
|
||||
particleGun->SetParticleEnergy(1.*GeV);
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm, 0.*cm,0.*cm));
|
||||
}
|
||||
|
||||
G3toG4PrimaryGeneratorAction::~G3toG4PrimaryGeneratorAction(){
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
void
|
||||
G3toG4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){
|
||||
//G4ThreeVector direction = GetRandomDirection();
|
||||
//particleGun->SetParticleMomentumDirection( direction.unit() ) ;
|
||||
G4cout << ">>>>>>>> Primary direction: "
|
||||
<< particleGun->GetParticleMomentumDirection() << G4endl;
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
G4ThreeVector
|
||||
G3toG4PrimaryGeneratorAction::GetRandomDirection() {
|
||||
|
||||
G4ThreeVector retval;
|
||||
|
||||
G4double CosTheta;
|
||||
G4double SinTheta;
|
||||
|
||||
G4double Phi;
|
||||
G4double SinPhi;
|
||||
G4double CosPhi;
|
||||
|
||||
G4double rand;
|
||||
|
||||
rand = G4UniformRand();
|
||||
|
||||
CosTheta = 2.0*rand -1.0;
|
||||
SinTheta = sqrt (1.-CosTheta*CosTheta);
|
||||
rand = G4UniformRand();
|
||||
Phi = twopi*rand;
|
||||
SinPhi = sin (Phi);
|
||||
CosPhi = cos (Phi);
|
||||
retval.setX(SinTheta*CosPhi);
|
||||
retval.setY(SinTheta*SinPhi);
|
||||
retval.setZ(CosTheta);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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: G3toG4RunAction.cc,v 1.1 2000/07/24 11:23:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G3toG4RunAction.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G3toG4RunAction::G3toG4RunAction(){
|
||||
runIDcounter = 0;
|
||||
}
|
||||
|
||||
G3toG4RunAction::~G3toG4RunAction(){;}
|
||||
|
||||
void G3toG4RunAction::BeginOfRunAction(const G4Run* aRun){
|
||||
((G4Run *)(aRun))->SetRunID(runIDcounter++);
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
UI->ApplyCommand("/vis~/clear/view");
|
||||
UI->ApplyCommand("/vis~/draw/current");
|
||||
}
|
||||
}
|
||||
|
||||
void G3toG4RunAction::EndOfRunAction(const G4Run* aRun){;}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
// 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: G3toG4VisManager.cc,v 1.1 2000/07/24 11:23:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4ios.hh"
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "G3toG4VisManager.hh"
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
#include "G4DAWNFILE.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
#include "G4Wo.hh"
|
||||
#include "G4Xo.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
#include "G4OpenGLImmediateX.hh"
|
||||
#include "G4OpenGLStoredX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
#include "G4OpenGLImmediateWin32.hh"
|
||||
#include "G4OpenGLStoredWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
#include "G4OpenGLImmediateXm.hh"
|
||||
#include "G4OpenGLStoredXm.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIX
|
||||
#include "G4OpenInventorX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYX
|
||||
#include "G4RayX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G3toG4VisManager::G3toG4VisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G3toG4VisManager::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
RegisterGraphicsSystem (new G4Wo);
|
||||
RegisterGraphicsSystem (new G4Xo);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateX);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredXm);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIX
|
||||
RegisterGraphicsSystem (new G4OpenInventorX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
RegisterGraphicsSystem (new G4OpenInventorWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYX
|
||||
RegisterGraphicsSystem (new G4RayX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
#endif
|
||||
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
<< G4endl;
|
||||
PrintAvailableGraphicsSystems ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
Reference in New Issue
Block a user