Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,91 @@
// This code implementation is the intellectual property of
// the RD44 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: EXPO_Detector.icc,v 2.1 1998/07/12 02:36:58 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// See also G4/run/example/MyDetectorConstruction.cc.
#include <G4VUserDetectorConstruction.hh>
#ifdef DEBUG
#include <stdio.h>
#endif
#include <globals.hh>
#include <G4Element.hh>
#include <G4Material.hh>
#include <G4Box.hh>
#include <G4Tubs.hh>
#include <G4LogicalVolume.hh>
#include <G4PVPlacement.hh>
#include <G4ThreeVector.hh>
class EXPO_DetectorConstruction : public G4VUserDetectorConstruction
{
public:
EXPO_DetectorConstruction()
{
}
~EXPO_DetectorConstruction()
{
}
G4VPhysicalVolume* Construct()
{
G4String name,symbol;
G4double iz,a;
G4double z,density;
G4int nel;
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : begin.\n");
#endif
// Elements
G4Element* elN = new G4Element (name="Nitrogen" , symbol="N", iz=7., a=14.01*g/mole);
G4Element* elO = new G4Element (name="Oxygen" , symbol="O", iz=8., a=16.00*g/mole);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end Elements.\n");
#endif
// Materials
G4Material* Air = new G4Material("Air" , density = 1.29e-03*g/cm3, nel=2);
Air->AddElement (elN, .7);
Air->AddElement (elO, .3);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end Air.\n");
#endif
G4Material* Al = new G4Material("Aluminium", z=13., a = 26.98 *g/mole, density = 2.7 *g/cm3);
G4Material* Fe = new G4Material("Iron" , z=26., a = 55.85 *g/mole, density = 7.87 *g/cm3);
G4Material* Pb = new G4Material("Lead" , z=82., a = 207.19*g/mole, density = 11.35*g/cm3);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end Materials.\n");
#endif
// Geometry
G4Box* myWorldBox = new G4Box ("WorldBox" ,10000*cm,10000*cm,10000*cm);
G4Box* myCalorBox = new G4Box ("CalorBox" ,1500*cm ,1500*cm ,1000*cm);
G4Tubs* myChambTube = new G4Tubs ("ChambTube" ,50*cm,150*cm,200*cm,0.*deg,360.*deg);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end Geometry.\n");
#endif
// Logical volumes
G4LogicalVolume* myWorldLog = new G4LogicalVolume (myWorldBox ,Air,"WorldLog" ,0,0,0);
G4LogicalVolume* myCalorLog = new G4LogicalVolume (myCalorBox ,Air,"CalorLog" ,0,0,0);
G4LogicalVolume* myChambLog = new G4LogicalVolume (myChambTube ,Pb ,"ChambLog" ,0,0,0);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end Logical volumes.\n");
#endif
// Physical volumes
G4PVPlacement* myWorldPhys = new G4PVPlacement (0,G4ThreeVector() ,"WorldPhys",myWorldLog,0 ,false,0);
G4PVPlacement* myCalorPhys = new G4PVPlacement (0,G4ThreeVector() ,"CalorPhys",myCalorLog,myWorldPhys,false,0);
G4PVPlacement* myChambPhys = new G4PVPlacement (0,G4ThreeVector(0*cm,0*cm,0*cm),"ChambPhys",myChambLog,myCalorPhys,false,1);
#ifdef DEBUG
printf ("debug : EXPO_DetectorConstruction.Construct : end.\n");
#endif
return myWorldPhys;
}
};
@@ -0,0 +1,61 @@
// This code implementation is the intellectual property of
// the RD44 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: EXPO_PhysicsList.hh,v 2.1 1998/07/12 02:36:58 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This class is a class derived from G4VUserPhysicsList
// for constructing all particles and processes.
//
// History
// first version 10 Jan. 1998 by H.Kurashige
// ------------------------------------------------------------
#ifndef EXPO_PhysicsList_h
#define EXPO_PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class EXPO_PhysicsList: public G4VUserPhysicsList
{
public:
EXPO_PhysicsList();
virtual ~EXPO_PhysicsList();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
//
virtual void SetCuts(G4double aCut);
protected:
// these methods Construct particles
virtual void ConstructBosons();
virtual void ConstructLeptons();
virtual void ConstructMesons();
virtual void ConstructBarions();
virtual void ConstructIons();
protected:
// these methods Construct physics processes and register them
virtual void ConstructGeneral();
virtual void ConstructEM();
virtual void ConstructHad();
virtual void ConstructLeptHad();
};
#endif
@@ -0,0 +1,284 @@
// This code implementation is the intellectual property of
// the RD44 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: EXPO_PhysicsList.icc,v 2.2 1998/07/13 17:29:28 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a version for maximum particle set
// History
// first version 10 Jan. 1998 by H.Kurashige
// add decay at rest 26 Feb. 1998 by H.Kurashige
// ------------------------------------------------------------
#include "globals.hh"
#include "EXPO_PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip.h>
EXPO_PhysicsList::EXPO_PhysicsList(): G4VUserPhysicsList()
{
SetVerboseLevel(1);
}
EXPO_PhysicsList::~EXPO_PhysicsList()
{
}
void EXPO_PhysicsList::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();
ConstructBarions();
}
void EXPO_PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void EXPO_PhysicsList::ConstructLeptons()
{
// leptons
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4TauMinus::TauMinusDefinition();
G4TauPlus::TauPlusDefinition();
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoTau::NeutrinoTauDefinition();
G4AntiNeutrinoTau::AntiNeutrinoTauDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
}
void EXPO_PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
G4DMesonPlus::DMesonPlusDefinition();
G4DMesonMinus::DMesonMinusDefinition();
G4DMesonZero::DMesonZeroDefinition();
G4AntiDMesonZero::AntiDMesonZeroDefinition();
G4DsMesonPlus::DsMesonPlusDefinition();
G4DsMesonMinus::DsMesonMinusDefinition();
G4JPsi::JPsiDefinition();
G4BMesonPlus::BMesonPlusDefinition();
G4BMesonMinus::BMesonMinusDefinition();
G4BMesonZero::BMesonZeroDefinition();
G4AntiBMesonZero::AntiBMesonZeroDefinition();
G4BsMesonZero::BsMesonZeroDefinition();
G4AntiBsMesonZero::AntiBsMesonZeroDefinition();
}
void EXPO_PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
G4Lambda::LambdaDefinition();
G4AntiLambda::AntiLambdaDefinition();
G4SigmaZero::SigmaZeroDefinition();
G4AntiSigmaZero::AntiSigmaZeroDefinition();
G4SigmaPlus::SigmaPlusDefinition();
G4AntiSigmaPlus::AntiSigmaPlusDefinition();
G4SigmaMinus::SigmaMinusDefinition();
G4AntiSigmaMinus::AntiSigmaMinusDefinition();
G4XiZero::XiZeroDefinition();
G4AntiXiZero::AntiXiZeroDefinition();
G4XiMinus::XiMinusDefinition();
G4AntiXiMinus::AntiXiMinusDefinition();
G4OmegaMinus::OmegaMinusDefinition();
G4AntiOmegaMinus::AntiOmegaMinusDefinition();
G4LambdacPlus::LambdacPlusDefinition();
G4SigmacPlusPlus::SigmacPlusPlusDefinition();
G4SigmacPlus::SigmacPlusDefinition();
G4SigmacZero::SigmacZeroDefinition();
G4XicPlus::XicPlusDefinition();
G4XicZero::XicZeroDefinition();
G4OmegacZero::OmegacZeroDefinition();
G4AntiLambdacPlus::AntiLambdacPlusDefinition();
G4AntiSigmacPlusPlus::AntiSigmacPlusPlusDefinition();
G4AntiSigmacPlus::AntiSigmacPlusDefinition();
G4AntiSigmacZero::AntiSigmacZeroDefinition();
G4AntiXicPlus::AntiXicPlusDefinition();
G4AntiXicZero::AntiXicZeroDefinition();
G4AntiOmegacZero::AntiOmegacZeroDefinition();
}
void EXPO_PhysicsList::ConstructIons()
{
// nuclei
G4Alpha::AlphaDefinition();
G4Deuteron::DeuteronDefinition();
G4Triton::TritonDefinition();
}
void EXPO_PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructLeptHad();
ConstructHad();
ConstructGeneral();
}
#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"
void EXPO_PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
// Construct processes for gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for 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
// Construct processes for 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
// Construct processes for 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->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);
}
}
}
}
void EXPO_PhysicsList::ConstructHad()
{;}
void EXPO_PhysicsList::ConstructLeptHad()
{;}
#include "G4Decay.hh"
void EXPO_PhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX);
}
}
}
void EXPO_PhysicsList::SetCuts(G4double cut)
{
if (verboseLevel >0){
G4cout << "EXPO_PhysicsList::SetCuts:";
G4cout << "CutLength : " << cut/mm << " (mm)" << endl;
}
// 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(cut, "gamma");
SetCutValue(cut, "e-");
SetCutValue(cut, "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(cut, "proton");
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
if (verboseLevel>1) {
DumpCutValuesTable();
}
}
@@ -0,0 +1,48 @@
// This code implementation is the intellectual property of
// the RD44 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: EXPO_Primary.icc,v 2.1 1998/07/12 02:36:59 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// See also G4/run/example/EXPO_PrimaryGeneratorAction.cc.
#include <G4VUserPrimaryGeneratorAction.hh>
#include <globals.hh>
#include <G4Event.hh>
#include <G4ParticleGun.hh>
#include <G4ParticleTable.hh>
#include <G4ParticleDefinition.hh>
class EXPO_PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
private:
G4ParticleGun* particleGun;
public:
EXPO_PrimaryGeneratorAction()
{
G4int n_particle = 1;
G4String particleName;
particleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
particleGun->SetParticleDefinition (particle);
particleGun->SetParticleEnergy (1.*GeV);
particleGun->SetParticleMomentumDirection (G4ThreeVector(1.,0.,0.));
particleGun->SetParticlePosition (G4ThreeVector(0.*cm,0.*cm,0.*cm));
}
~EXPO_PrimaryGeneratorAction()
{
delete particleGun;
}
void GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
};
+34
View File
@@ -0,0 +1,34 @@
// This code implementation is the intellectual property of
// the RD44 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: G4o.h,v 2.1 1998/07/12 02:36:59 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef G4o_h
#define G4o_h
#include <OShell.h>
#ifdef __cplusplus
extern "C"{
#endif
void G4oAddCommands (void*);
void G4oExecuteScript (char*);
OShell G4oGetShell ();
#ifdef __cplusplus
}
#endif
#endif /*G4o_h*/
+41
View File
@@ -0,0 +1,41 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oCommon.hh,v 2.1 1998/07/12 02:37:00 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/*
Included by G4o.h.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*G4*/
#include <G4UImanager.hh>
#include <G4UIcommand.hh>
#include <G4UIparameter.hh>
#include <G4UIcommandTree.hh>
/*Co*/
#include <CMemory.h>
#include <CPrinter.h>
#include <CText.h>
#include <CFile.h>
#include <OType.h>
#include <OShell.h>
#include <OProcess.h>
static void SetTypes ();
static void ExecuteScript (char*);
static int Execute_G4 (int,char**,OProcess);
static int DoMethod (OIdentifier,char*,void*,int,char**,void*,int*);
static G4UIcommand* GetCommandIdentifier (char*);
static void GetCommands (G4UIcommandTree*,int*,char***);
static int ProduceODB (G4UIcommand*,char*);
+463
View File
@@ -0,0 +1,463 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oCommon.icc,v 2.2 1998/08/12 14:21:55 barrand Exp $
// GEANT4 tag $Name: geant4-00 $
//
/*
Included by G4o.cc.
*/
/***************************************************************************/
void SetTypes (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
OType otype;
/*.........................................................................*/
if(OTypeGetIdentifier("G4")!=NULL) return; /*Done*/
otype = OTypeCreate ("G4");
OTypeSetDoMethodFunction (otype,DoMethod);
OTypeAddNewClassMethodProperty (otype,"getCommandGuidance" ,OPropertyString,NULL);
OTypeAddNewClassMethodProperty (otype,"askListOfCommands" ,OPropertyString,NULL);
OTypeAddNewClassMethodProperty (otype,"createCommandPanel" ,OPropertyVoid,NULL);
}
/***************************************************************************/
int Execute_G4 (
int a_argn
,char** a_args
,OProcess a_process
)
/***************************************************************************/
/*
osh> G4 <string:command> <string:param 1> ...
*/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
int count;
char* string = NULL;
/*.........................................................................*/
if(a_argn<=1)
{
CWarnF ("At least one argument expected in:\n%s\n",OProcessGetCommand(a_process));
return EXIT_FAILURE;
}
for(count=1;count<a_argn;count++)
{
CStringConcatenate (&string,a_args[count]);
CStringConcatenate (&string," ");
}
ExecuteScript (string);
CStringDelete (string);
return EXIT_SUCCESS;
}
/***************************************************************************/
void ExecuteScript (
char* a_string
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI;
int linen = 0;
char** lines = NULL;
/*.........................................................................*/
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return;
lines = CTextCreateFromString (a_string,&linen);
if( (linen!=0) && (lines!=NULL) )
{
int count;
for(count=0;count<linen;count++)
{
CStringTrim(lines[count]);
if( (lines[count]==NULL) || (lines[count][0]=='\0') || (lines[count][0]=='#') ) continue;
UI->ApplyCommand(lines[count]);
}
}
CTextDelete (linen,lines);
}
/***************************************************************************/
int DoMethod (
OIdentifier This
,char* a_name
,void* a_user
,int a_argn
,char** a_args
,void* a_addr
,int* a_number
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
if(a_number!=NULL) *a_number = 0;
if(a_name==NULL) return 0;
if(This==NULL)
{
if(strcmp(a_name,"getCommandGuidance")==0)
{
G4UIcommand* command;
char* string = NULL;
int count,linen,paramn;
if(a_argn!=1)
{
CWarnF ("One arguments expected for %s property.\n",a_name);
return 0;
}
command = GetCommandIdentifier(a_args[0]);
if(command==NULL)
{
CWarnF ("Unknown G4 command :\n%s\n",a_args[0]);
return 0;
}
linen = command->GetGuidanceEntries();
for(count=0;count<linen;count++)
{
CStringConcatenate (&string,(char*)command->GetGuidanceLine(count).data());
CStringConcatenate (&string,"\n");
}
paramn = command->GetParameterEntries();
for(count=0;count<paramn;count++)
{
char* info;
char* line;
G4UIparameter* parameter = (G4UIparameter*)command->GetParameter(count);
info = (char*)parameter->GetParameterName().data();
line = CStringCreateF(12+strlen(info)+1,"Parameter : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
if( ! parameter->GetParameterGuidance().isNull() )
{
CStringConcatenate (&string,(char*)parameter->GetParameterGuidance().data());
CStringConcatenate (&string,"\n");
}
line = CStringCreateF(19+1+1," Parameter type : %c\n",parameter->GetParameterType());
CStringConcatenate (&string,line);
CStringDelete (line);
if(parameter->IsOmittable()==TRUE)
line = CStringDuplicate(" Omittable : true\n");
else
line = CStringDuplicate(" Omittable : false\n");
CStringConcatenate (&string,line);
CStringDelete (line);
if( ! parameter->GetDefaultValue().isNull() )
{
info = (char*)parameter->GetDefaultValue().data();
line = CStringCreateF(19+strlen(info)+1," Default value : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
}
if( ! parameter->GetParameterRange().isNull() )
{
info = (char*)parameter->GetParameterRange().data();
line = CStringCreateF(19+strlen(info)+1," Parameter range : %s\n",info);
CStringConcatenate (&string,line);
CStringDelete (line);
}
}
*((char**)a_addr) = string;
return FREE_BLOCK;
}
else if(strcmp(a_name,"askListOfCommands")==0)
{
G4UIcommandTree* treeTop;
char* string = NULL;
G4UImanager* UI;
int linen = 0;
char** lines = NULL;
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return 0;
treeTop = UI->GetTree();
if(treeTop==NULL) return 0;
if(a_argn==1) treeTop = treeTop->GetTree(a_args[0]);
GetCommands (treeTop,&linen,&lines);
string = CTextConvertToString (linen,lines,"\n");
CTextDelete (linen,lines);
*((char**)a_addr) = string;
return FREE_BLOCK;
}
else if(strcmp(a_name,"createCommandPanel")==0)
{
if(a_argn!=2)
{
CWarnF ("Two arguments expected for %s property.\n",a_name);
return 0;
}
return ProduceODB(GetCommandIdentifier(a_args[0]),a_args[1]);
}
else
{
CInfoF ("G4_DoMethod: %s is not a class routine property.\n",a_name);
return 0;
}
}
CInfoF ("G4_DoMethod: %s is not a routine property.\n",a_name);
a_user = NULL;
a_argn = 0;
a_args = NULL;
a_addr = NULL;
return 0;
}
/***************************************************************************/
void GetCommands (
G4UIcommandTree* a_tree
,int* a_linen
,char*** a_lines
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
/*.........................................................................*/
if(a_tree==NULL) return;
int n_commandEntry = a_tree->GetCommandEntry();
for( int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ )
{
G4UIcommand* command = a_tree->GetCommand(i_thCommand);
CTextAddLine (a_linen,a_lines,(char*)command->GetCommandPath().data());
}
int n_treeEntry = a_tree->GetTreeEntry();
for( int i_thTree = 1; i_thTree <= n_treeEntry; i_thTree++ )
{
GetCommands (a_tree->GetTree(i_thTree),a_linen,a_lines);
}
}
/***************************************************************************/
G4UIcommand* GetCommandIdentifier (
char* a_name
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UImanager* UI;
G4UIcommandTree* treeTop;
/*.........................................................................*/
if(a_name==NULL) return NULL;
UI = G4UImanager::GetUIpointer();
if(UI==NULL) return NULL;
treeTop = UI->GetTree();
if(treeTop==NULL) return NULL;
return treeTop->FindPath(a_name);
}
/***************************************************************************/
int ProduceODB (
G4UIcommand* a_command
,char* a_name
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
FILE* file;
int paramn,parami;
char* top = NULL;
/*.........................................................................*/
if(a_command==NULL) return 0;
paramn = a_command->GetParameterEntries();
file = CFileOpenForWriting (a_name);
if(file==NULL) return 0;
fprintf (file,"\
!----------------------------\n\
begin OInterface\n\
prefix = G4Params_\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_palette\n\
type = XmFormDialog\n\
children = G4Params_command\
");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," G4Params_label_%d G4Params_text_%d",parami,parami);
}
fprintf (file," G4Params_ok G4Params_apply G4Params_cancel\n\
autoUnmanage = False\n\
dialogTitle = G4 parameters\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_command\n\
type = XmPushButton\n\
labelString = %s\n\
background = black\n\
foreground = white\n\
leftAttachment = attach_form\n\
rightAttachment = attach_form\n\
topAttachment = attach_form\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
echo `do G4 getCommandGuidance $command`\n\
end\n\
",a_command->GetCommandPath().data());
for(parami=0;parami<paramn;parami++)
{
G4UIparameter* parameter = (G4UIparameter*)a_command->GetParameter(parami);
fprintf (file,"\
!----------------------------\n\
begin OWidget\n\
name = G4Params_label_%d\n\
type = XmLabel\n\
labelString = %s\n\
createCallback = osh> setWidgetResource `thisWidget` height `getWidgetResource G4Params_text_%d height`\n\
leftAttachment = attach_form\n\
",parami,parameter->GetParameterName().data(),parami);
if(parami==0)
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_command\n\
");
}
else
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_text_%d\n\
",parami-1);
}
fprintf (file,"\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_text_%d\n\
type = XmText\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_label_%d\n\
rightAttachment = attach_form\n\
",parami,parami);
if(parami==0)
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_command\n\
");
}
else
{
fprintf (file,"\
topAttachment = attach_widget\n\
topWidget = G4Params_text_%d\n\
",parami-1);
}
if( ! parameter->GetDefaultValue().isNull() )
{
fprintf (file,"\
value = %s\n\
",parameter->GetDefaultValue().data());
}
fprintf (file,"\
end\n\
");
}
if(paramn>=1)
{
top = CStringCreateF(14+32,"G4Params_text_%d",paramn-1);
}
else
{
top = CStringDuplicate("G4Params_command");
}
fprintf (file,"\
!----------------------------\n\
begin OWidget\n\
name = G4Params_ok\n\
type = XmPushButton\n\
labelString = Ok\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
");
for(parami=0;parami<paramn;parami++)
{
fprintf (file,"\
param_%d=`getWidgetResource G4Params_text_%d value`\\\n\
",parami,parami);
}
fprintf (file,"\
G4 $command");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," $param_%d",parami);
}
fprintf (file,"\\\n\
unmanageWidget `thisWidgetParent`\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_form\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_apply\n\
type = XmPushButton\n\
labelString = Apply\n\
activateCallback = osh>\\\n\
command=`getWidgetResource G4Params_command labelString`\\\n\
",top);
for(parami=0;parami<paramn;parami++)
{
fprintf (file,"\
param_%d=`getWidgetResource G4Params_text_%d value`\\\n\
",parami,parami);
}
fprintf (file,"\
G4 $command");
for(parami=0;parami<paramn;parami++)
{
fprintf (file," $param_%d",parami);
}
fprintf (file,"\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_ok\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
!----------------------------\n\
begin OWidget\n\
name = G4Params_cancel\n\
type = XmPushButton\n\
labelString = Cancel\n\
activateCallback = osh> unmanageWidget `thisWidgetParent`\n\
bottomAttachment = attach_form\n\
leftAttachment = attach_widget\n\
leftWidget = G4Params_apply\n\
rightAttachment = attach_form\n\
topAttachment = attach_widget\n\
topWidget = %s\n\
end\n\
",top,top);
CStringDelete (top);
fclose(file);
return 1;
}
+113
View File
@@ -0,0 +1,113 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oDrawer.hh,v 2.2 1998/09/16 12:06:17 barrand Exp $
// GEANT4 tag $Name: geant4-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef G4ODRAWER_HH
#define G4ODRAWER_HH
#include <G4VVisManager.hh>
#include <ONode.h>
#include <OColormap.h>
class G4Event;
class G4Polyline;
class G4Text;
class G4Circle;
class G4Square;
class G4Polymarker;
class G4Polyhedron;
class G4NURBS;
class G4VSolid;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4VisAttributes;
class G4Colour;
class G4oDrawer: public G4VVisManager {
public:
static G4oDrawer* GetInstance (); // Access to private constructor.
~G4oDrawer ();
void SetWorldVolume (G4VPhysicalVolume* world);
void Draw (const G4Polyline&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Text&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Circle&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Square&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Polymarker&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Polyhedron&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4NURBS&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
// Now Follow functions for drawing a GEANT4 geometry object. Note
// that the 2nd argument overrides any visualization attributes that
// are associated with the object itself.
void Draw (const G4VSolid&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4LogicalVolume&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void GeometryHasChanged ();
//////////////////////////////////////////////////////////////////////
// Timing messages.
void EventBegins ();
// All stacks are clear and event processing is about to start.
void EventEnded (G4Event* pEvent);
// Event processing has ended and event-persistent data is available.
void SetNode (ONode);
private:
G4oDrawer (); // Private constructor.
static G4oDrawer* fpInstance; // Pointer to single instance.
static ONode node;
static OColormap colormap;
void SetColour (const G4Colour&);
};
#endif
+31
View File
@@ -0,0 +1,31 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oEXPO.h,v 2.1 1998/07/12 02:37:01 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef G4oEXPO_h
#define G4oEXPO_h
#ifdef __cplusplus
extern "C"{
#endif
void G4oEXPO_Initialize ();
#ifdef __cplusplus
}
#endif
#endif /*G4oEXPO_h*/
+66
View File
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oScene.hh,v 2.2 1998/07/12 02:37:01 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef G4OSCENE_HH
#define G4OSCENE_HH
#include <G4VGraphicsScene.hh>
class G4PhysicalVolumeModel;
class G4VPhysicalVolume;
class G4LogicalVolume;
#include <ONode.h>
class G4oScene : public G4VGraphicsScene {
public:
//Inherited
void AddThis (const G4Box& box);
void AddThis (const G4Cons& cons);
void AddThis (const G4Tubs& tubs);
void AddThis (const G4Trd& trd);
void AddThis (const G4Trap& trap);
void AddThis (const G4Sphere& sphere);
void AddThis (const G4Para& para );
void AddThis (const G4Torus& torus );
void AddThis (const G4VSolid& solid); // For solids not above.
void PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs);
void PostAddThis ();
void EstablishSpecials (G4PhysicalVolumeModel&);
//Local
G4oScene ();
~G4oScene ();
void SetNodeName (char*);
ONode GetNode ();
private:
static ONode node;
const G4Transform3D* fpAccTransf; // Accumulated transformation.
static char* nodeName;
void AddPolyhedron (G4Polyhedron*);
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
};
#endif
+27
View File
@@ -0,0 +1,27 @@
// This code implementation is the intellectual property of
// the RD44 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: G4oState.hh,v 2.1 1998/07/12 02:37:02 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4oState_h
#define G4oState_h
#include <G4VStateDependent.hh>
#include <G4UIsession.hh>
class G4oState : public G4VStateDependent, public G4UIsession {
public:
G4oState (G4String);
G4bool Notify (G4ApplicationState);
void PauseSessionStart (G4String);
private:
G4String name;
};
#endif
+35
View File
@@ -0,0 +1,35 @@
// This code implementation is the intellectual property of
// the RD44 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: WoG4o.h,v 2.1 1998/07/12 02:37:02 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef WoG4o_h
#define WoG4o_h
#ifdef HAS_G4O
/*G4o*/
#include <G4o.h>
/*Wo*/
#include <Wo.h>
#include <OInterface.h>
#include <OInterpreter.h>
#endif /*HAS_G4O*/
#endif /*WoG4o_h*/
+23
View File
@@ -0,0 +1,23 @@
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
/* | Permission to use, copy, modify, and distribute this software | */
/* | and its documentation for any purpose and without fee is hereby | */
/* | granted, provided that the above copyright notice appear in all | */
/* | copies and that both that copyright notice and this permission | */
/* | notice appear in supporting documentation. This software is | */
/* | provided "as is" without express or implied warranty. | */
/* +---------------------- Copyright notice -------------------------------+ */
#ifndef WoG4o_ic
#define WoG4o_ic
#ifdef HAS_G4O
G4oAddCommands (WoGetShellInterpreter());
OInterfaceAddPackage ("G4o");
OInterpreterAddInterpreter ("G4",G4oExecuteScript);
#endif /*HAS_G4O*/
#endif /*WoG4o_ic*/