Import Geant4 4.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:39:52 +02:00
parent 921d3b1cda
commit 330b82b769
4524 changed files with 178689 additions and 43575 deletions
@@ -0,0 +1,455 @@
//
// ********************************************************************
// * 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: DMXAnalysisManager.cc
// GEANT4 tag $Name:
//
// Author: Alex Howard (a.s.howard@ic.ac.uk)
//
// History:
// -----------
// 16 Jan 2002 Alex Howard Created
// 17 June 2002 Alex Howard Successfully Modified to AIDA 2.2
//
// -------------------------------------------------------------------
#ifdef G4ANALYSIS_USE
#include "DMXAnalysisManager.hh"
//#include "g4std/iomanip"
DMXAnalysisManager* DMXAnalysisManager::instance = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXAnalysisManager::DMXAnalysisManager() :
af(0), tree(0), hf(0), tpf(0), pf(0)
{
// tree is created and booked inside book()
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXAnalysisManager::~DMXAnalysisManager()
{
delete pf;
pf=0;
delete tpf;
tpf=0;
delete hf;
hf=0;
delete tree;
tree=0;
delete af;
af = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXAnalysisManager* DMXAnalysisManager::getInstance()
{
if (instance == 0) instance = new DMXAnalysisManager;
return instance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::book(G4String histogramfile)
{
// histoManager->selectStore("DMX.his");
G4cout << " Histogramfile: " << histogramfile << G4endl;
//build up the factories
af = AIDA_createAnalysisFactory();
//parameters for the TreeFactory
G4bool fileExists = false;
G4bool readOnly = false;
ITreeFactory * tf = af->createTreeFactory();
tree = tf->create(histogramfile, readOnly, fileExists, "hbook");
G4cout << "Tree store : " << tree->storeName() << G4endl;
G4cout << " Booked Hbook File " << G4endl;
//HistoFactory and TupleFactory depend on theTree
hf = af->createHistogramFactory( *tree );
tpf = af->createTupleFactory(*tree );
// ---- primary ntuple ------
ITuple* ntuple1 = tpf->create( "1 Energy", "Particle Source Energy",
"float energy" );
assert(ntuple1);
// ---- secondary ntuple ------
ITuple* ntuple2 = tpf->create( "2 Hits Info", "Scintillation Hits Info",
"float Event,e_prim,tot_e,s_hits,xe_time,num_ph,avphtime,1stpart,1stparte,gamma,neutron,posi,elec,other,seed1,seed2" );
assert(ntuple2);
// ---- tertiary ntuple ------
ITuple* ntuple3 = tpf->create( "3 Pmt Info", "PMT Hits Info",
"float event, hits, xpos, ypos, zpos" );
assert(ntuple3);
// ---- extra ntuple ------
ITuple* ntuple4 = tpf->create( "4 Particle Info", "Particles energy type",
"float energy, NameIdx" );
assert(ntuple4);
// Creating an 1-dimensional histogram in the root directory of the tree
IHistogram1D* hEsourcep;
hEsourcep = hf->create1D("10","Source Energy /keV", 1000,0.,10000.);
IHistogram1D* hEdepp;
hEdepp = hf->create1D("20","Energy Deposit /keV", 1000,0.,1000.);
IHistogram1D* hEdepRecoil;
hEdepRecoil = hf->create1D("30","Nuclear Recoil Edep /keV", 100,0.,100.);
IHistogram1D* hNumPhLow;
hNumPhLow = hf->create1D("40","Number of Photons - LowE", 200,0.,200.);
IHistogram1D* hNumPhHigh;
hNumPhHigh = hf->create1D("50","Number of Photons - HighE", 100,0.,10000.);
IHistogram1D* hAvPhArrival;
hAvPhArrival = hf->create1D("60","Average Photon Arrival/ns", 200,0.,200.);
IHistogram1D* h1stPhArrival;
h1stPhArrival = hf->create1D("61","1st event Photon Arrival", 200,0.,200.);
IHistogram2D* hPMTHits;
hPMTHits = hf->create2D("70","PMT Hit Pattern",
300 ,-30.,30.,300,-30.,30.);
IHistogram2D* h1stPMTHit;
h1stPMTHit = hf->create2D("71","1st event PMT Hit Pattern",
300 ,-30.,30.,300,-30.,30.);
IHistogram1D* hGammaEdep;
hGammaEdep = hf->create1D("91","Gamma Energy Deposit/keV", 1000,0.,1000.);
IHistogram1D* hNeutronEdep;
hNeutronEdep = hf->create1D("92","Neutron Ener Deposit/keV", 1000,0.,1000.);
IHistogram1D* hElectronEdep;
hElectronEdep = hf->create1D("93","Electron Ener Deposit/keV",1000,0.,1000.);
IHistogram1D* hPositronEdep;
hPositronEdep = hf->create1D("94","Positron Ener Deposit/keV",1000,0.,1000.);
IHistogram1D* hOtherEdep;
hOtherEdep = hf->create1D("95","Other Ener Deposit/keV", 1000,0.,1000.);
delete tf;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::finish()
{
// Committing the transaction with the tree
G4std::cout << "Committing..." << G4std::endl;
// write all histograms to file
tree->commit();
G4std::cout << "Closing the tree..." << G4std::endl;
// close (will again commit)
tree->close();
// extra delete as objects are created in book() method rather than during
// initialisation of class
delete pf;
delete tpf;
delete hf;
delete tree;
delete af;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::analyseScintHits(G4int event_id, G4double energy_pri, G4double totEnergy, G4int S_hits, G4double firstLXeHitTime, G4int P_hits, G4double aveTimePmtHits, G4String firstparticleName, G4double firstParticleE, G4bool gamma_ev, G4bool neutron_ev, G4bool positron_ev,G4bool electron_ev,G4bool other_ev, long seed1, long seed2)
{
G4int firstparticleIndex = 0;
if(firstparticleName == "gamma") firstparticleIndex = 1;
if(firstparticleName == "neutron") firstparticleIndex = 2;
if(firstparticleName == "electron") firstparticleIndex = 3;
if(firstparticleName == "positron") firstparticleIndex = 4;
if(firstparticleName == "other") {
firstparticleIndex = 5;
IHistogram1D* h4 = dynamic_cast<IHistogram1D *> ( tree->find("30") );
h4->fill(totEnergy); // fill(x,y,weight)
}
IHistogram1D* h2 = dynamic_cast<IHistogram1D *> ( tree->find("40") );
h2->fill(P_hits,10.); // fill(x,weight)
IHistogram1D* h3 = dynamic_cast<IHistogram1D *> ( tree->find("50") );
h3->fill(P_hits); // fill(x,y,weight)
IHistogram1D* h1 = dynamic_cast<IHistogram1D *> ( tree->find("10") );
h1->fill( energy_pri/keV ); // fill(x,weight)
IHistogram1D* h5 = dynamic_cast<IHistogram1D *> ( tree->find("20") );
h5->fill( totEnergy/keV );
IHistogram1D* h6 = dynamic_cast<IHistogram1D *> ( tree->find("60") );
h6->fill(aveTimePmtHits/ns); // fill(x,y,weight)
ITuple * ntuple = dynamic_cast<ITuple *> ( tree->find("2 Hits Info") );
// Fill the ntuple
ntuple->fill( ntuple->findColumn( "Event" ), (G4float) event_id );
ntuple->fill( ntuple->findColumn( "e_prim" ), (G4float) energy_pri/keV );
ntuple->fill( ntuple->findColumn( "tot_e" ), (G4float) totEnergy );
ntuple->fill( ntuple->findColumn( "s_hits" ), (G4float) S_hits );
ntuple->fill( ntuple->findColumn( "xe_time" ), (G4float) firstLXeHitTime );
ntuple->fill( ntuple->findColumn( "num_ph" ), (G4float) P_hits );
ntuple->fill( ntuple->findColumn( "avphtime"), (G4float) aveTimePmtHits );
ntuple->fill( ntuple->findColumn( "1stpart" ), (G4float) firstparticleIndex);
ntuple->fill( ntuple->findColumn( "1stparte"), (G4float) firstParticleE );
ntuple->fill( ntuple->findColumn( "gamma" ), (G4float) gamma_ev );
ntuple->fill( ntuple->findColumn( "neutron" ), (G4float) neutron_ev );
ntuple->fill( ntuple->findColumn( "posi" ), (G4float) positron_ev );
ntuple->fill( ntuple->findColumn( "elec" ), (G4float) electron_ev );
ntuple->fill( ntuple->findColumn( "other" ), (G4float) other_ev );
ntuple->fill( ntuple->findColumn( "seed1" ), (G4float) seed1 );
ntuple->fill( ntuple->findColumn( "seed2" ), (G4float) seed2 );
//ntuple->fill( ntuple->findColumn( "Event" ), static_cast<float>(event_id) );
//Values of attributes are prepared; store them to the nTuple:
ntuple->addRow();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::analysePMTHits(G4int event, G4int i, G4double x, G4double y, G4double z)
{
IHistogram2D* h7 = dynamic_cast<IHistogram2D *> ( tree->find("70") );
h7->fill(x/mm, y/mm); // fill(x,y,weight)
if (event == 0 ) {
IHistogram2D* h9 = dynamic_cast<IHistogram2D *> ( tree->find("71") );
h9->fill(x,y); // fill(x,y,weight)
}
ITuple * ntuple = dynamic_cast<ITuple *> ( tree->find("3 Pmt Info") );
// Fill the secondaries ntuple
ntuple->fill( ntuple->findColumn( "event" ), (G4float) event );
ntuple->fill( ntuple->findColumn( "hits" ), (G4float) i );
ntuple->fill( ntuple->findColumn( "xpos" ), (G4float) x );
ntuple->fill( ntuple->findColumn( "ypos" ), (G4float) y );
ntuple->fill( ntuple->findColumn( "zpos" ), (G4float) z );
// NEW: Values of attributes are prepared; store them to the nTuple:
ntuple->addRow(); // check for returning true ...
// IHistogram1D* h3 = dynamic_cast<IHistogram1D *> ( theTree->find("30") );
//h3->fill(ph_hits);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::analysePrimaryGenerator(G4double energy)
{
// IHistogram1D* h1 = dynamic_cast<IHistogram1D *> ( tree->find("10") );
// h1->fill(static_cast<double>(energy/keV)); // fill(x,weight)
ITuple * ntuple = dynamic_cast<ITuple *> ( tree->find("1 Energy") );
// Fill energy ntple:
ntuple->fill( ntuple->findColumn( "energy" ), (G4float) energy );
// NEW: Values of attributes are prepared; store them to the nTuple:
ntuple->addRow(); // check for returning true ...
// h1 and h2 are the order in which they are filled, "1" and "2"
// are the labels associated with the histogram
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::analyseParticleSource(G4double energy, G4String name)
{
if(name == "gamma") {
IHistogram1D* h11 = dynamic_cast<IHistogram1D *> ( tree->find("91") );
h11->fill(energy/keV); // fill(x,weight)
}
if(name == "neutron") {
IHistogram1D* h12 = dynamic_cast<IHistogram1D *> ( tree->find("92") );
h12->fill(energy/keV); // fill(x,weight)
}
if(name == "electron") {
IHistogram1D* h13 = dynamic_cast<IHistogram1D *> ( tree->find("93") );
h13->fill(energy/keV); // fill(x,weight)
}
if(name == "positron") {
IHistogram1D* h14 = dynamic_cast<IHistogram1D *> ( tree->find("94") );
h14->fill(energy/keV); // fill(x,weight)
}
if(name == "other") {
IHistogram1D* h15 = dynamic_cast<IHistogram1D *> ( tree->find("95") );
h15->fill(energy/keV); // fill(x,weight)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::HistFirstTime(G4double time)
{
IHistogram1D* h8 = dynamic_cast<IHistogram1D *> ( tree->find("61") );
h8->fill(time/ns); // fill(x,y,weight)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXAnalysisManager::PlotHistos(G4bool interactive)
{
IHistogram1D* h1p = dynamic_cast<IHistogram1D *> ( tree->find("10") );
IHistogram1D& h1 = *h1p;
IHistogram1D* h2p = dynamic_cast<IHistogram1D *> ( tree->find("20") );
IHistogram1D& h2 = *h2p;
IHistogram1D* h3p = dynamic_cast<IHistogram1D *> ( tree->find("40") );
IHistogram1D& h3 = *h3p;
IHistogram1D* h4p = dynamic_cast<IHistogram1D *> ( tree->find("50") );
IHistogram1D& h4 = *h4p;
IHistogram1D* h5p = dynamic_cast<IHistogram1D *> ( tree->find("60") );
IHistogram1D& h5 = *h5p;
IHistogram1D* h6p = dynamic_cast<IHistogram1D *> ( tree->find("61") );
IHistogram1D& h6 = *h6p;
IHistogram2D* h7p = dynamic_cast<IHistogram2D *> ( tree->find("70") );
IHistogram2D& h7 = *h7p;
IHistogram1D* h8p = dynamic_cast<IHistogram1D *> ( tree->find("91") );
IHistogram1D& h8 = *h8p;
// Creating the plotter factory
pf = af->createPlotterFactory();
// Creating a plotter
IPlotter* plotter = pf->create();
// plotter = pf->create();
// Creating two regions
plotter->clearPage();
plotter->createRegions(2, 2, 0); // set the current working region to the first one
plotter->show();
// Plotting the second histogram in the first region
plotter->plot( h1 );
// Plotting the first histogram in the next available region
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h2 );
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h3 );
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h4 );
// Update the canvas on the screen
plotter->refresh();
plotter->write("summary1.ps", "ps");
if (interactive) {
// Wait for the keyboard return to avoid destroying the plotter window too quickly.
G4cout << "Press <ENTER> to exit" << G4endl;
G4cin.get();
}
plotter = pf->create();
plotter->clearPage();
plotter->createRegions(2, 2, 0); // set the current working region to the first one
plotter->show();
// plotter->setCurrentRegion( 0 );
plotter->plot( h5 );
// Plotting the first histogram in the next available region
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h6 );
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h7 );
plotter->next(); // or explicitly : plotter->setCurrentRegion( 1 );
plotter->plot( h8 );
// Update the canvas on the screen
plotter->refresh();
plotter->write("summary2.ps", "ps");
if (interactive) {
// Wait for the keyboard return to avoid destroying the plotter window too quickly.
G4cout << "Press <ENTER> to exit" << G4endl;
G4cin.get();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,23 @@
G4double EField = 0.0*kilovolt/cm;
// create electric field
G4UniformElectricField* elecField =
new G4UniformElectricField(G4ThreeVector(0,EField,0));
// equation of motion
G4EqMagElectricField* EquationOfMotion =
new G4EqMagElectricField(elecField);
// stepper for equation of motion
G4MagIntegratorStepper* DMXStepper =
new G4ClassicalRK4(EquationOfMotion);
// chordfinder
G4ChordFinder* DMXChordFinder =
new G4ChordFinder(elecField, 1.0e-3*mm, DMXStepper);
// field manager
G4FieldManager* DMXFieldManager = new G4FieldManager();
DMXFieldManager->SetChordFinder(DMXChordFinder);
G4TransportationManager::GetTransportationManager()
-> SetFieldManager(DMXFieldManager);
@@ -0,0 +1,209 @@
G4double density, // density
a, // atomic mass
z; // atomic number
G4String name, // name
symbol; // symbol
G4int ncomponents, // n components
iz, // number of protons
in; // number of nuceons
G4double abundance, // abundance
temperature, // temperature
pressure; // pressure
// making vacuum
G4Material* vacuum = new G4Material
(name="Vacuum", z=1., a=1.*g/mole, density=1.e-20*g/cm3,
kStateGas, temperature=0.1*kelvin, pressure=1.e-20*bar);
// xenons
G4Element* elementXe = new G4Element( "Xenon", "Xe", 54., 131.29*g/mole );
G4Material* LXe = new G4Material
("LXe", 3.02*g/cm3, 1, kStateLiquid, 173.15*kelvin, 1.5*atmosphere );
G4Material* GXe = new G4Material
("GXe", 0.005887*g/cm3, 1, kStateGas, 173.15*kelvin, 1.5*atmosphere );
LXe->AddElement( elementXe, 1);
GXe->AddElement( elementXe, 1);
const G4int NUMENTRIES = 3;
// G4double LXe_PP[NUMENTRIES] = { 7.07*eV, 7.07*eV };
G4double LXe_PP[NUMENTRIES] = { 7.0*eV , 7.07*eV, 7.14*eV };
G4double LXe_SCINT[NUMENTRIES] = { 0.1, 1.0, 0.1 };
G4double LXe_RIND[NUMENTRIES] = { 1.59 , 1.57, 1.54 };
G4double LXe_ABSL[NUMENTRIES] = { 35.*cm, 35.*cm, 35.*cm}; //atten length
G4MaterialPropertiesTable *LXe_mt = new G4MaterialPropertiesTable();
LXe_mt->AddProperty("SCINTILLATION", LXe_PP, LXe_SCINT, NUMENTRIES);
LXe_mt->AddProperty("RINDEX", LXe_PP, LXe_RIND, NUMENTRIES);
LXe_mt->AddProperty("ABSLENGTH", LXe_PP, LXe_ABSL, NUMENTRIES);
LXe->SetMaterialPropertiesTable(LXe_mt);
// G4double GXe_PP[NUMENTRIES] = { 7.07*eV, 7.07*eV };
G4double GXe_PP[NUMENTRIES] = { 7.0*eV, 7.07*eV, 7.14*eV };
G4double GXe_SCINT[NUMENTRIES] = { 0.1, 1.0, 0.1 };
G4double GXe_RIND[NUMENTRIES] = { 1.00, 1.00, 1.00 };
G4double GXe_ABSL[NUMENTRIES] = { 100*m, 100*m, 100*m}; //atten length
G4MaterialPropertiesTable *GXe_mt = new G4MaterialPropertiesTable();
GXe_mt->AddProperty("SCINTILLATION", GXe_PP, GXe_SCINT, NUMENTRIES);
GXe_mt->AddProperty("RINDEX", GXe_PP, GXe_RIND, NUMENTRIES);
GXe_mt->AddProperty("ABSLENGTH", GXe_PP, GXe_ABSL, NUMENTRIES);
GXe->SetMaterialPropertiesTable(GXe_mt);
// making quartz
G4Element* O = new G4Element
(name="Oxygen" ,symbol="O" , z= 8., a=16.00*g/mole);
G4Element* Si = new G4Element
(name="Silicon",symbol="Si" , z= 14., a=28.09*g/mole);
G4Material* quartz = new G4Material
(name="quartz", density=2.200*g/cm3, ncomponents=2);
quartz->AddElement(Si, 1);
quartz->AddElement(O , 2);
G4double quartz_PP[NUMENTRIES] = { 5.0*eV, 6.69*eV, 7.50*eV }; // lambda range 4 ri
G4double quartz_RIND[NUMENTRIES] = { 1.51, 1.57, 1.61 }; // ref index
// G4double quartz_RIND[NUMENTRIES] = { 1.45, 1.51, 1.54 }; // ref index
G4double quartz_ABSL[NUMENTRIES] = { 3.0*cm, 3.0*cm, 3.0*cm };// atten length
G4MaterialPropertiesTable *quartz_mt = new G4MaterialPropertiesTable();
quartz_mt->AddProperty("RINDEX", quartz_PP, quartz_RIND, NUMENTRIES);
quartz_mt->AddProperty("ABSLENGTH", quartz_PP, quartz_ABSL, NUMENTRIES);
quartz->SetMaterialPropertiesTable(quartz_mt);
// aluminium
G4Element* Al = new G4Element
(name="Aluminium" ,symbol="Al" , z= 13., a=26.98*g/mole);
G4Material* metalAl = new G4Material
(name="MetalAluminium", density=2.700*g/cm3, ncomponents=1);
metalAl->AddElement(Al, 1);
// iron
G4Element* Fe = new G4Element
(name="Iron" ,symbol="Fe" , z= 26., a=55.85*g/mole);
G4Material* metalFe = new G4Material
(name="MetalIron", density=7.874*g/cm3, ncomponents=1);
metalFe->AddElement(Fe, 1);
// stainless steel
G4Element* C = new G4Element( "Carbon", "C", 6. , 12.011*g/mole);
G4Element* Co = new G4Element( "Cobalt", "Co", 27. , 58.9332*g/mole);
G4Material* ssteel = new G4Material
(name="Steel", density=7.7*g/cm3, ncomponents=3);
ssteel->AddElement(C, 0.04);
ssteel->AddElement(Fe, 0.88);
ssteel->AddElement(Co, 0.08);
// copper
G4Element* Cu = new G4Element
(name="Copper" ,symbol="Cu" , z= 29., a=63.55*g/mole);
G4Material* metalCu = new G4Material
(name="MetalCopper", density=8.960*g/cm3, ncomponents=1);
metalCu->AddElement(Cu, 1);
// lead
G4Element* Pb = new G4Element
(name="Lead",symbol="Pb" , z= 82., a=207.2*g/mole);
G4Material* metalPb = new G4Material
(name="MetalLead", density=11.340*g/cm3, ncomponents=1);
metalPb->AddElement(Pb, 1);
// Americium: - NOTE it's AmO2..........
G4Isotope* Am241 = new G4Isotope
(name="Americium241", iz= 95, in=241, a=241.0*g/mole);
G4Element* Am = new G4Element
(name="Americium241", "Am", ncomponents=1);
Am->AddIsotope(Am241, abundance=1);
G4Material* sourceAm = new G4Material
(name="AmericiumSource", density=13.61*g/cm3, ncomponents=2);
sourceAm->AddElement(Am, 1);
sourceAm->AddElement(O , 2);
/*
// using Uranium because Americium not yet defined for RDM
G4Isotope* U235 = new G4Isotope
(name="Uranium235", iz= 92, in=235, a=235.0*g/mole);
G4Element* U = new G4Element
(name="Uranium", "U", ncomponents=1);
U->AddIsotope(U235, abundance=1);
G4Material* sourceAm = new G4Material
(name="UraniumSource", density=13.61*g/cm3, ncomponents=1);
sourceAm->AddElement(U, 1);
*/
// air
G4Element* N = new G4Element
(name="Nitrogen",symbol="N" , z= 7., a=14.00674*g/mole);
G4Material* Air = new G4Material
("AIR", 1.2929*kg/m3, 2, kStateGas, 300.00*kelvin, 1.0*atmosphere);
Air->AddElement(N, 0.8);
Air->AddElement(O , 0.2);
// liquid nitrogen:
G4Material* LN2 = new G4Material
("LN2", 0.8*g/cm3, 1, kStateLiquid, 77.*kelvin, 1.0*atmosphere);
LN2->AddElement(N, 1);
//concrete
G4Element* H = new G4Element
(name="Hydrogen",symbol="H" , z= 1., a=1.00794*g/mole);
G4Element* Ca = new G4Element
(name="Calcium",symbol="Ca" , z= 20., a=40.078*g/mole);
G4Material* concrete = new G4Material
(name="Concrete", density=2.3*g/cm3, ncomponents=6);
concrete->AddElement(Si, 0.227915);
concrete->AddElement(O, 0.60541);
concrete->AddElement(H, 0.09972);
concrete->AddElement(Ca, 0.04986);
concrete->AddElement(Al, 0.014245);
concrete->AddElement(Fe, 0.00285);
//water
G4Material* water = new G4Material
(name="water", density=1.00*g/cm3, ncomponents=2);
water->AddElement(H , 2);
water->AddElement(O , 1);
// wood
G4Material* wood = new G4Material
(name="wood", density=0.9*g/cm3, ncomponents=3);
wood->AddElement(H , 4);
wood->AddElement(O , 1);
wood->AddElement(C , 2);
// print materials
// G4cout << *(G4Material::GetMaterialTable()) << G4endl;
// G4cout << *(G4Isotope::GetIsotopeTable()) << G4endl;
// G4cout << *(G4Element::GetElementTable()) << G4endl;
// assign materials
world_mat = concrete;
lab_mat = Air;
cupboard_mat = wood;
glass_mat = quartz;
panel_mat = metalAl;
door_mat = wood;
desk_mat = wood;
crate_mat = metalAl;
LN2jacket_mat = ssteel;
LN2_mat = LN2;
jacket_mat = ssteel;
jacketflange_mat = ssteel;
vacuum_mat = vacuum;
copper_mat = metalCu;
vessel_mat = ssteel;
GXe_mat = GXe;
CuShield_mat = metalCu;
LXe_mat = LXe;
alpha_mat = metalPb;
americium_mat = sourceAm;
ring_mat = ssteel;
mirror_mat = metalAl;
grid_mat = LXe;
pmt_mat = quartz;
phcath_mat = metalAl;
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// SteppingActionMessenger program
// --------------------------------------------------------------
#include "DMXDetectorMessenger.hh"
#include "DMXDetectorConstruction.hh"
#include "globals.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
DMXDetectorMessenger::DMXDetectorMessenger
(DMXDetectorConstruction* DC):detectorConstruction(DC) {
RoomEKineCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/RoomMinEnergyCut",this);
RoomEKineCutCmd->SetGuidance("Minimum Charged particle cut in ROOM");
RoomEKineCutCmd->SetParameterName("ECut",false,false);
RoomEKineCutCmd->SetRange("ECut>=250.0*eV");
RoomEKineCutCmd->SetDefaultUnit("eV");
RoomEKineCutCmd->SetUnitCategory("Energy");
RoomEKineCutCmd->AvailableForStates(PreInit,Idle);
EKineCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/MinEnergyCut",this);
EKineCutCmd->SetGuidance("Minimum Charged particle cut inside detector");
EKineCutCmd->SetParameterName("ECut",false,false);
EKineCutCmd->SetRange("ECut>=250.0*eV");
EKineCutCmd->SetDefaultUnit("eV");
EKineCutCmd->SetUnitCategory("Energy");
EKineCutCmd->AvailableForStates(PreInit,Idle);
RoomTimeCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/RoomTimeCut",this);
RoomTimeCutCmd->SetGuidance("Set Time Cut (for neutrons) inside ROOM");
RoomTimeCutCmd->SetParameterName("RTCut",false,false);
RoomTimeCutCmd->SetRange("RTCut>0.");
RoomTimeCutCmd->SetDefaultUnit("ns");
RoomTimeCutCmd->SetUnitCategory("Time");
RoomTimeCutCmd->AvailableForStates(PreInit,Idle);
TimeCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/TimeCut",this);
TimeCutCmd->SetGuidance("Set Time Cut (for neutrons) inside detector");
TimeCutCmd->SetParameterName("TCut",false,false);
TimeCutCmd->SetRange("TCut>0.");
TimeCutCmd->SetDefaultUnit("ns");
TimeCutCmd->SetUnitCategory("Time");
TimeCutCmd->AvailableForStates(PreInit,Idle);
//UpdateCmd = new G4UIcmdWithoutParameter("/dmx/update",this);
//UpdateCmd->SetGuidance("Update calorimeter geometry.");
//UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
//UpdateCmd->SetGuidance("if you changed timecut value(s).");
//UpdateCmd->AvailableForStates(Idle);
}
//ooooooooooooooooooooooooooooooooooooooooo
DMXDetectorMessenger::~DMXDetectorMessenger() {
delete RoomTimeCutCmd;
delete TimeCutCmd;
// delete UpdateCmd;
}
//ooooooooooooooooooooooooooooooooooooooooo
void DMXDetectorMessenger::SetNewValue(G4UIcommand* command,
G4String newValue) {
if(command == EKineCutCmd)
detectorConstruction->
SetEnergyCut(EKineCutCmd->GetNewDoubleValue(newValue));
if(command == RoomEKineCutCmd)
detectorConstruction->
SetEnergyCut(RoomEKineCutCmd->GetNewDoubleValue(newValue));
if(command == TimeCutCmd)
detectorConstruction->
SetTimeCut(TimeCutCmd->GetNewDoubleValue(newValue));
if(command == RoomTimeCutCmd)
detectorConstruction->
SetRoomTimeCut(RoomTimeCutCmd->GetNewDoubleValue(newValue));
// if( command == UpdateCmd )
// { detectorConstruction->UpdateGeometry(); }
}
@@ -0,0 +1,598 @@
// Window - AIR + glass ************************************************
G4double glassThick = 3.0*mm;
G4double sidepanelWidth = 43.*cm;
G4double windowWidth = labWidth - 2.*sidepanelWidth;
G4double windowHeight = labHeight - 112.0*cm;
G4double glassPosY = 0.5*(worldLength - glassThick);
G4double glassPosZ = 0.5*(labHeight - windowHeight);
G4Box* glass_box = new G4Box
("glass_box",0.5*windowWidth, 0.5*glassThick, 0.5*windowHeight );
glass_log = new G4LogicalVolume(glass_box, glass_mat, "glass_log");
glass_phys = new G4PVPlacement
(0, G4ThreeVector(0., glassPosY, glassPosZ), "glass_phys", glass_log,
world_phys, false, 0);
G4VisAttributes* glass_vat= new G4VisAttributes(blue);
glass_vat->SetVisibility(true);
glass_vat->SetForceSolid(true);
glass_log->SetVisAttributes(glass_vat);
// hole in wall between glass and "lab": ************************************
G4double holeThick = wallThick - glassThick;
G4double windowPosY = 0.5*(worldLength - holeThick) - glassThick;
G4double windowPosZ = glassPosZ;
G4Box* window_box = new G4Box
("window_box",0.5*windowWidth, 0.5*holeThick, 0.5*windowHeight );
window_log = new G4LogicalVolume(window_box, lab_mat, "window_log");
window_phys = new G4PVPlacement
(0, G4ThreeVector(0., windowPosY, windowPosZ), "window_phys",
window_log, world_phys, false, 0);
G4VisAttributes* window_vat= new G4VisAttributes(yellow);
// window_log->SetVisAttributes(G4VisAttributes::Invisible);
window_vat->SetVisibility(true);
window_log->SetVisAttributes(window_vat);
// Side panels of Window - AIR + Al ****************************************
G4double panelThick = 5.0*mm;
// G4double sidepanelWidth = 43.*cm; // defined earlier
G4double sidepanelPosX = 0.5*(labWidth - sidepanelWidth);
G4double sidepanelPosY = 0.5*(worldLength - panelThick);
G4double sidepanelPosZ = glassPosZ;
G4Box* sidepanel_box = new G4Box
("sidepanel_box",0.5*sidepanelWidth, 0.5*panelThick, 0.5*windowHeight );
sidepanel_log = new G4LogicalVolume
(sidepanel_box, panel_mat, "sidepanel_log");
sidepanel_phys = new G4PVPlacement
(0, G4ThreeVector(sidepanelPosX, sidepanelPosY, sidepanelPosZ),
"sidepanel_phys", sidepanel_log, world_phys, false, 0);
sidepanel_phys = new G4PVPlacement
(0, G4ThreeVector(-sidepanelPosX, sidepanelPosY, sidepanelPosZ),
"sidepanel_phys", sidepanel_log, world_phys, false, 1);
G4VisAttributes* panel_vat= new G4VisAttributes(grey);
panel_vat->SetVisibility(true);
panel_vat->SetForceSolid(true);
sidepanel_log->SetVisAttributes(panel_vat);
// panel hole in wall between Al and "lab": ******************************
G4double panelholePosX = sidepanelPosX;
G4double panelholePosY = 0.5*(worldLength - holeThick) - panelThick;
G4double panelholePosZ = sidepanelPosZ;
G4Box* panelhole_box = new G4Box
("panelhole_box",0.5*sidepanelWidth, 0.5*holeThick, 0.5*windowHeight );
panelhole_log = new G4LogicalVolume
(panelhole_box, lab_mat, "panelhole_log");
panelhole_phys = new G4PVPlacement
(0, G4ThreeVector(panelholePosX, panelholePosY, panelholePosZ),
"panelhole_phys", panelhole_log, world_phys, false, 0);
panelhole_phys = new G4PVPlacement
(0, G4ThreeVector(-panelholePosX, panelholePosY, panelholePosZ),
"panelhole_phys", panelhole_log, world_phys, false, 1);
panelhole_log->SetVisAttributes(window_vat);
// DOOR Window - AIR + glass ************************************************
G4double doorwindowWidth = 62.*cm;
G4double doorwindowHeight = 84.0*cm;
G4double doorglassPosX = 0.5*(labWidth - doorwindowWidth) - sidepanelWidth;
G4double doorglassPosY = 0.5*(worldLength - panelThick);
G4double doorglassPosZ = glassPosZ - 0.5*(windowHeight+doorwindowHeight);
G4Box* doorglass_box = new G4Box
("doorglass_box",0.5*doorwindowWidth, 0.5*panelThick, 0.5*doorwindowHeight );
doorglass_log = new G4LogicalVolume
(doorglass_box, panel_mat, "doorglass_log");
doorglass_phys = new G4PVPlacement
(0, G4ThreeVector(doorglassPosX, doorglassPosY, doorglassPosZ),
"doorglass_phys", doorglass_log, world_phys, false, 0);
doorglass_log->SetVisAttributes(panel_vat);
// door hole in wall between glass and "lab": ******************************
G4double doorwindowPosX = doorglassPosX;
G4double doorwindowPosY = 0.5*(worldLength - holeThick) - panelThick;
G4double doorwindowPosZ = doorglassPosZ;
G4Box* doorwindow_box = new G4Box
("doorwindow_box",0.5*doorwindowWidth, 0.5*holeThick, 0.5*doorwindowHeight );
doorwindow_log = new G4LogicalVolume
(doorwindow_box, lab_mat, "doorwindow_log");
doorwindow_phys = new G4PVPlacement
(0, G4ThreeVector(doorwindowPosX, doorwindowPosY, doorwindowPosZ),
"doorwindow_phys", doorwindow_log, world_phys, false, 0);
doorwindow_log->SetVisAttributes(window_vat);
// cupboards: ***************************************************************
// cupboard 1:
G4double cupboardDepth = 38.0*cm; //X
G4double cupboard1Width = 91.0*cm; //Y
G4double cupboard2Width = 153.0*cm; //Y
G4double cupboardHeight = 91.0*cm; //Z
G4double woodThick = 2.0*cm;
G4double insideDepth = cupboardDepth - 2.*woodThick;
G4double inside1Width = cupboard1Width - 2.*woodThick;
G4double inside2Width = cupboard2Width - 2.*woodThick;
G4double insideHeight = cupboardHeight - 2.*woodThick;
//nb: cupboard orientation is sideways because they are lined along the wall
G4Box* cupboard_box = new G4Box
("cupboard_box", 0.5*cupboardDepth, 0.5*cupboard1Width, 0.5*cupboardHeight);
G4Box* inside_box = new G4Box
("inside_box", 0.5*insideDepth, 0.5*inside1Width, 0.5*insideHeight);
G4Box* shelf_box = new G4Box
("shelf_box", 0.5*insideDepth, 0.5*inside1Width, 0.5*woodThick);
G4Box* cupdoor_box = new G4Box
("cupdoor_box", 0.5*woodThick+1.0*nanometer, 0.25*inside1Width, 0.5*insideHeight);
// ("cupdoor_box", 0.5*woodThick, 0.25*inside1Width, 0.5*insideHeight);
G4RotationMatrix rotMatrixCupboard;
rotMatrixCupboard.rotateY(0.0*deg);
G4SubtractionSolid* cupboard_frame = new G4SubtractionSolid
("cupboard_frame", cupboard_box, inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4UnionSolid* cupboard_shelf1 = new G4UnionSolid
("cupboard_shelf1", cupboard_frame, shelf_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.30*(insideHeight))));
G4UnionSolid* cupboard_shelf2 = new G4UnionSolid
("cupboard_shelf2", cupboard_shelf1, shelf_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,-0.05*(insideHeight))));
G4SubtractionSolid* cupboard_sol = new G4SubtractionSolid
("cupboard_sol", cupboard_shelf2, cupdoor_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(-0.5*(insideDepth+woodThick),0.25*inside1Width,0.)));
cupboard_log = new G4LogicalVolume
(cupboard_sol, cupboard_mat, "cupboard_log");
G4double cupb_X = 0.5*(labWidth - cupboardDepth);
// G4double cupb_Y = 0.5*(labLength - cupboard1Width) - 2.0*cm;
G4double cupb_Y = 0.5*labLength;
G4double cupb_Z = 0.5*(labHeight - cupboardHeight) - 25.4*cm;
for (G4int i=0; i<5; i++)
{
cupb_Y -= cupboard1Width+2.0*cm;
cupboard_phys = new G4PVPlacement
(0, G4ThreeVector(cupb_X, cupb_Y, cupb_Z), "cupboard_phys",
cupboard_log, lab_phys, false, i);
}
cupb_X = -(0.5*(labWidth - cupboard1Width) - cupboardDepth - 2.0*cm);
G4double cupb_Y2 = -0.5*(labLength - cupboardDepth);
G4RotationMatrix rotMatrixWallcupboard;
rotMatrixWallcupboard.rotateZ(-90.0*deg);
cupboard_phys = new G4PVPlacement
(G4Transform3D
(rotMatrixWallcupboard,G4ThreeVector(cupb_X, cupb_Y2, cupb_Z)),
"cupboard_phys", cupboard_log, lab_phys, false, 5);
G4VisAttributes* cupboard_vat= new G4VisAttributes(yellow);
cupboard_vat->SetVisibility(true);
cupboard_vat->SetForceSolid(true);
cupboard_log->SetVisAttributes(cupboard_vat);
// cupboard 2 (bigger/wider) ***********************************************
G4Box* cupboard2_box = new G4Box
("cupboard2_box", 0.5*cupboardDepth, 0.5*cupboard2Width, 0.5*cupboardHeight);
G4Box* inside2_box = new G4Box
("inside2_box", 0.5*insideDepth, 0.5*inside2Width, 0.5*insideHeight);
G4Box* shelf2_box = new G4Box
("shelf2_box", 0.5*insideDepth, 0.5*inside2Width, 0.5*woodThick);
G4Box* cupdoor_box2 = new G4Box
("cupdoor_box2", 0.5*woodThick+1.0*nanometer, 0.25*inside2Width, 0.5*insideHeight);
// ("cupdoor_box2", 0.5*woodThick, 0.25*inside2Width, 0.5*insideHeight);
G4SubtractionSolid* cupboard2_frame = new G4SubtractionSolid
("cupboard2_frame", cupboard2_box, inside2_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4UnionSolid* cupboard2_shelf1 = new G4UnionSolid
("cupboard2_shelf1", cupboard2_frame, shelf2_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.30*(insideHeight))));
G4UnionSolid* cupboard2_shelf2 = new G4UnionSolid
("cupboard2_shelf2", cupboard2_shelf1, shelf2_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.10*(insideHeight))));
G4SubtractionSolid* cupboard2_sol = new G4SubtractionSolid
("cupboard2_sol", cupboard2_shelf2, cupdoor_box2, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(-0.5*(insideDepth+woodThick),0.25*inside2Width,0.)));
cupboard2_log = new G4LogicalVolume
(cupboard2_sol, cupboard_mat, "cupboard2_log");
cupb_X = 0.5*(labWidth - cupboardDepth);
// cupb_Y = -(0.5*(labLength - cupboard2Width) - 2.0*cm);
cupb_Y -= 0.5*cupboard1Width + 0.5*cupboard2Width
+ 2.0*cm; //using last cupboard posn on right...
// cupb_Z = 0.5*(labHeight - cupboardHeight) - 25.4*cm;
cupboard2_phys = new G4PVPlacement
(0,G4ThreeVector(cupb_X, cupb_Y, cupb_Z),
"cupboard2_phys", cupboard2_log, lab_phys, false, 0);
cupb_X = -0.5*(labWidth - cupboardDepth);
cupb_Y = -(0.5*(labLength - cupboard2Width) - cupboardDepth - 2.0*cm);
G4RotationMatrix rotMatrixWallcupboard2;
rotMatrixWallcupboard2.rotateZ(-180.0*deg);
cupboard2_phys = new G4PVPlacement
(G4Transform3D
(rotMatrixWallcupboard2,G4ThreeVector(cupb_X, cupb_Y, cupb_Z)),
"cupboard2_phys", cupboard2_log, lab_phys, false, 1);
cupboard2_log->SetVisAttributes(cupboard_vat);
// NOW add the (wooden) DOOR:
G4double doorWidth = 1.67*m; //X
G4double doorThick = 4.0*cm; //Y
G4double doorHeight = 2.09*m; //Z
G4double doorPosY = -0.5*(worldLength - doorThick);
G4double doorPosZ = -0.5*(worldHeight - doorHeight);
G4Box* door_box = new G4Box
("door_box",0.5*doorWidth, 0.5*doorThick, 0.5*doorHeight );
door_log = new G4LogicalVolume(door_box, door_mat, "door_log");
door_phys = new G4PVPlacement
(0, G4ThreeVector(0., doorPosY, doorPosZ), "door_phys", door_log,
world_phys, false, 0);
G4VisAttributes* door_vat= new G4VisAttributes(brown);
door_vat->SetVisibility(true);
door_vat->SetForceSolid(true);
door_log->SetVisAttributes(door_vat);
// hole in wall between door and "lab": ************************************
G4double doorholeThick = wallThick - doorThick;
G4double doorholePosY = -(0.5*(worldLength - doorholeThick) - doorThick);
G4double doorholePosZ = doorPosZ;
G4Box* doorhole_box = new G4Box
("doorhole_box",0.5*doorWidth, 0.5*doorholeThick, 0.5*doorHeight );
doorhole_log = new G4LogicalVolume(doorhole_box, lab_mat, "doorhole_log");
doorhole_phys = new G4PVPlacement
(0, G4ThreeVector(0., doorholePosY, doorholePosZ), "doorhole_phys",
doorhole_log, world_phys, false, 0);
G4VisAttributes* doorhole_vat= new G4VisAttributes(cyan);
// window_log->SetVisAttributes(G4VisAttributes::Invisible);
doorhole_vat->SetVisibility(true);
doorhole_log->SetVisAttributes(doorhole_vat);
// desks: *****************************************************************
//now add Desks - wood, but have the opportunity for three different woods -
// Cupboard, Door and then desks
// desk1 - no cupboard underneath - should be bigger subtraction?:
G4double desk1Depth = 57.0*cm; //X
G4double desk1Width = 160.0*cm; //Y
G4double desk1Height = 90.5*cm; //Z
G4double deskThick = 3.0*cm;
G4double desk1_insideDepth = desk1Depth - 2.*deskThick;
G4double desk1_insideWidth = desk1Width - 2.*deskThick;
G4double desk1_insideHeight = desk1Height - 2.*deskThick;
//nb: desk orientation is sideways because they are lined along the wall
G4Box* desk1_box = new G4Box
("desk1_box", 0.5*desk1Depth, 0.5*desk1Width, 0.5*desk1Height);
G4Box* desk1_inside_box = new G4Box
("desk1_inside_box", 0.5*desk1_insideDepth, 0.5*desk1_insideWidth,
0.5*desk1_insideHeight);
G4Box* desk1_door_box = new G4Box
("desk1_door_box", 0.5*deskThick+1.0*nanometer, 0.25*desk1_insideWidth,
0.5*desk1_insideHeight);
// ("desk1_door_box", 0.5*deskThick, 0.25*desk1_insideWidth,
// 0.5*desk1_insideHeight);
G4RotationMatrix rotMatrixDesk;
rotMatrixDesk.rotateY(0.0*deg);
G4SubtractionSolid* desk1_frame = new G4SubtractionSolid
("desk1_frame", desk1_box, desk1_inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4SubtractionSolid* desk1_sol = new G4SubtractionSolid
("desk1_sol", desk1_frame, desk1_door_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(-0.5*(desk1_insideDepth+deskThick),-0.25*desk1_insideWidth,0.)));
desk1_log = new G4LogicalVolume(desk1_sol, desk_mat, "desk1_log");
G4double desk_X = 0.5*(labWidth - desk1Depth);
G4double desk_Y = -(0.5*(labLength - desk1Width) - 30.0*cm);
G4double desk_Z = 0.5*(desk1Height - labHeight);
desk1_phys = new G4PVPlacement
(0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk1_phys",
desk1_log, lab_phys, false, 0);
G4VisAttributes* desk_vat= new G4VisAttributes(brown);
desk_vat->SetVisibility(true);
desk_vat->SetForceSolid(true);
desk1_log->SetVisAttributes(desk_vat);
// *****************
// desk2 (drawers):
G4double desk2Depth = 57.0*cm; //X
G4double desk2Width = 156.0*cm; //Y
G4double desk2Height = desk1Height; //Z
G4double desk2_insideDepth = desk2Depth - 2.*deskThick;
G4double desk2_insideWidth = desk2Width - 2.*deskThick;
G4double desk2_insideHeight = desk2Height - 2.*deskThick;
//nb: desk orientation is sideways because they are lined along the wall
G4Box* desk2_box = new G4Box
("desk2_box", 0.5*desk2Depth, 0.5*desk2Width, 0.5*desk2Height);
G4Box* desk2_inside_box = new G4Box
("desk2_inside_box", 0.5*desk2_insideDepth, 0.5*desk2_insideWidth,
0.5*desk2_insideHeight);
G4Box* desk2_door_box = new G4Box
("desk2_door_box", 0.5*deskThick+1.0*nanometer, 0.2*desk2_insideWidth,
0.5*desk2_insideHeight);
// ("desk2_door_box", 0.5*deskThick, 0.2*desk2_insideWidth,
// 0.5*desk2_insideHeight);
G4SubtractionSolid* desk2_frame = new G4SubtractionSolid
("desk2_frame", desk2_box, desk2_inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4SubtractionSolid* desk2_sol = new G4SubtractionSolid
("desk2_sol", desk2_frame, desk2_door_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(-0.5*(desk2_insideDepth+deskThick),-0.25*desk2_insideWidth,0.)));
desk2_log = new G4LogicalVolume(desk2_sol, desk_mat, "desk2_log");
desk_X = 0.5*(labWidth - desk2Depth);
desk_Y += 0.5*(desk2Width + desk1Width) + 2.0*cm;
desk_Z = 0.5*(desk2Height - labHeight);
desk2_phys = new G4PVPlacement
(0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk2_phys",
desk2_log, lab_phys, false, 0);
desk2_log->SetVisAttributes(desk_vat);
// *****************
// desk3 (cupboard underneath):
G4double desk3Depth = 79.0*cm; //X
G4double desk3Width = 160.0*cm; //Y
G4double desk3Height = desk1Height; //Z
G4double desk3_insideDepth = desk3Depth - 2.*deskThick;
G4double desk3_insideWidth = desk3Width - 2.*deskThick;
G4double desk3_insideHeight = desk3Height - 2.*deskThick;
//nb: desk orientation is sideways because they are lined along the wall
G4Box* desk3_box = new G4Box
("desk3_box", 0.5*desk3Depth, 0.5*desk3Width, 0.5*desk3Height);
G4Box* desk3_inside_box = new G4Box
("desk3_inside_box", 0.5*desk3_insideDepth, 0.5*desk3_insideWidth,
0.5*desk3_insideHeight);
G4Box* desk3_door_box = new G4Box
("desk3_door_box", 0.5*deskThick+1.0*nanometer, 0.15*desk3_insideWidth, 0.5*desk1_insideHeight);
// ("desk3_door_box", 0.5*deskThick, 0.15*desk3_insideWidth,
// 0.5*desk1_insideHeight);
G4SubtractionSolid* desk3_frame = new G4SubtractionSolid
("desk3_frame", desk3_box, desk3_inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4SubtractionSolid* desk3_sol = new G4SubtractionSolid
("desk3_sol", desk3_frame, desk3_door_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(-0.5*(desk3_insideDepth+deskThick),-0.35*desk3_insideWidth,0.)));
desk3_log = new G4LogicalVolume(desk3_sol, desk_mat, "desk3_log");
desk_X = 0.5*(labWidth - desk3Depth);
desk_Y += 0.5*(desk3Width + desk3Width) + 2.0*cm;
desk_Z = 0.5*(desk3Height - labHeight);
desk3_phys = new G4PVPlacement
(0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk3_phys",
desk3_log, lab_phys, false, 0);
desk3_log->SetVisAttributes(desk_vat);
// *****************
// wooden radiator trunking - along LHS wall
G4double trunkDepth = 20.0*cm; //X
G4double trunkWidth = labLength; //Y
G4double trunkHeight = desk1Height; //Z
G4double trunkThick = 3.0*cm;
// not 2.*trunkThick since only 2 sides of box - top and front
G4double trunk_insideDepth = trunkDepth - trunkThick;
G4double trunk_insideWidth = trunkWidth;
G4double trunk_insideHeight = trunkHeight - trunkThick;
G4Box* trunk_box = new G4Box
("trunk_box", 0.5*trunkDepth, 0.5*trunkWidth, 0.5*trunkHeight);
G4Box* trunk_inside_box = new G4Box
("trunk_inside_box", 0.5*trunk_insideDepth, 0.5*trunk_insideWidth,
0.5*trunk_insideHeight);
trunk_log = new G4LogicalVolume(trunk_box, desk_mat, "trunk_log");
trunk_inside_log = new G4LogicalVolume
(trunk_inside_box, lab_mat, "trunk_inside_log");
G4double trunk_X = -0.5*(labWidth - trunkDepth);
G4double trunk_Y = 0.0*m;
G4double trunk_Z = -0.5*(labHeight - trunkHeight);
trunk_phys = new G4PVPlacement
(0, G4ThreeVector(trunk_X, trunk_Y, trunk_Z), "trunk_phys",
trunk_log, lab_phys, false, 0);
G4double trunkinside_X = -0.5*(trunkDepth - trunk_insideDepth);
G4double trunkinside_Y = 0.0*m;
G4double trunkinside_Z = -0.5*(trunkHeight - trunk_insideHeight);
trunk_inside_phys = new G4PVPlacement
(0, G4ThreeVector(trunkinside_X, trunkinside_Y, trunkinside_Z),
"trunk_inside_phys",trunk_inside_log, trunk_phys, false, 0);
trunk_log->SetVisAttributes(desk_vat);
trunk_inside_log->SetVisAttributes(window_vat);
// *****************
// desk4,5,6 (actually 4 with multi-place idx) LHS with cupboards underneath:
G4double desk4Depth = 79.0*cm; //X
G4double desk4Width = 79.0*cm; //Y
G4double desk4Height = desk1Height; //Z
G4double desk4_insideDepth = desk4Depth - 2.*deskThick;
G4double desk4_insideWidth = desk4Width - 2.*deskThick;
G4double desk4_insideHeight = desk4Height - 2.*deskThick;
//nb: desk orientation is sideways because they are lined along the wall
G4Box* desk4_box = new G4Box
("desk4_box", 0.5*desk4Depth, 0.5*desk4Width, 0.5*desk4Height);
G4Box* desk4_inside_box = new G4Box
("desk4_inside_box", 0.5*desk4_insideDepth, 0.5*desk4_insideWidth,
0.5*desk4_insideHeight);
G4Box* desk4_door_box = new G4Box
("desk4_door_box", 0.5*deskThick+1.0*nanometer, 0.45*desk4_insideWidth,
0.5*desk4_insideHeight);
// ("desk4_door_box", 0.5*deskThick, 0.45*desk4_insideWidth,
// 0.5*desk4_insideHeight);
G4SubtractionSolid* desk4_frame = new G4SubtractionSolid
("desk4_frame", desk4_box, desk4_inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4SubtractionSolid* desk4_sol = new G4SubtractionSolid
("desk4_sol", desk4_frame, desk4_door_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(0.5*(desk4_insideDepth+deskThick),0.,0.)));
desk4_log = new G4LogicalVolume(desk4_sol, desk_mat, "desk4_log");
desk_X = -0.5*(labWidth - desk4Depth) + trunkDepth;
desk_Y = -(0.5*(labLength - desk4Width) - 5.0*cm);
desk_Z = 0.5*(desk4Height - labHeight);
G4double crateWidth = 60.0*cm; //Y
G4double crate_Y;
G4RotationMatrix rotMatrixDesk4;
rotMatrixDesk4.rotateZ(0.0*deg);
for (i=0; i<3; i++)
{
if( i == 2)
{
desk_Y += crateWidth;
crate_Y = desk_Y - 0.5*(desk4Width + crateWidth);
}
desk4_phys = new G4PVPlacement
(G4Transform3D(rotMatrixDesk4, G4ThreeVector(desk_X, desk_Y, desk_Z)),
"desk4_phys", desk4_log, lab_phys, false, i);
desk_Y += desk4Width+2.0*cm;
}
desk4_log->SetVisAttributes(desk_vat);
// *****************
// aluminium crate rack:
G4double crateDepth = 64.0*cm; //X
// G4double crateWidth = 60.0*cm; //Y - moved above...........
G4double crateHeight = 128.0*cm; //Z
G4double crateThick = 3.0*cm;
G4double crate_insideDepth = crateDepth - 2.*crateThick;
G4double crate_insideWidth = crateWidth - 2.*crateThick;
G4double crate_insideHeight = crateHeight - 2.*crateThick;
//nb: crate orientation is sideways because they are lined along the wall
G4Box* crate_box = new G4Box
("crate_box", 0.5*crateDepth, 0.5*crateWidth, 0.5*crateHeight);
G4Box* crate_inside_box = new G4Box
("crate_inside_box", 0.5*crate_insideDepth, 0.5*crate_insideWidth,
0.5*crate_insideHeight);
G4Box* crate_front_box = new G4Box
("crate_front_box", 0.5*crateThick+1.0*nanometer, 0.5*crate_insideWidth,
0.5*crate_insideHeight);
G4SubtractionSolid* crate_frame = new G4SubtractionSolid
("crate_frame", crate_box, crate_inside_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
G4SubtractionSolid* crate_sol = new G4SubtractionSolid
("crate_sol", crate_frame, crate_front_box, G4Transform3D
(rotMatrixCupboard, G4ThreeVector
(0.5*(crate_insideDepth+crateThick),0.,0.)));
crate_log = new G4LogicalVolume(crate_sol, crate_mat, "crate_log");
G4double crate_X = -0.5*(labWidth - crateDepth) + trunkDepth;
// crate_Y defined previously (by desk spacing.......)
G4double crate_Z = 0.5*(crateHeight - labHeight);
crate_phys = new G4PVPlacement
(0, G4ThreeVector(crate_X, crate_Y, crate_Z), "crate_phys",
crate_log, lab_phys, false, 0);
G4VisAttributes* crate_vat= new G4VisAttributes(grey);
crate_vat->SetVisibility(true);
crate_vat->SetForceSolid(true);
crate_log->SetVisAttributes(crate_vat);
// clean room desks: ****************************************************
// first oblong desk (type "3"):
desk_X = -0.5*(labWidth - desk3Width) + 50.0*cm;
desk_Y = 0.5*(labLength - desk3Width - 30.0*cm);
desk_Z = 0.5*(desk4Height - labHeight);
G4RotationMatrix rotMatrixCleanDesk;
rotMatrixCleanDesk.rotateZ(90.0*deg);
desk3_phys = new G4PVPlacement
(G4Transform3D
(rotMatrixCleanDesk,G4ThreeVector(desk_X, desk_Y, desk_Z)),
"desk3_phys", desk3_log, lab_phys, false, 1);
// square desk (type "4"):
desk_X += 0.5*desk3Width + 0.5*desk4Width; // rotated hence Width
rotMatrixCleanDesk.rotateZ(-180.0*deg);
desk4_phys = new G4PVPlacement
(G4Transform3D
(rotMatrixCleanDesk, G4ThreeVector(desk_X, desk_Y, desk_Z)),
"desk4_phys", desk4_log, lab_phys, false, 3);
@@ -0,0 +1,17 @@
glass_log->SetUserLimits(theUserLimitsForRoom);
window_log->SetUserLimits(theUserLimitsForRoom);
sidepanel_log->SetUserLimits(theUserLimitsForRoom);
panelhole_log->SetUserLimits(theUserLimitsForRoom);
doorglass_log->SetUserLimits(theUserLimitsForRoom);
doorwindow_log->SetUserLimits(theUserLimitsForRoom);
door_log->SetUserLimits(theUserLimitsForRoom);
doorhole_log->SetUserLimits(theUserLimitsForRoom);
cupboard_log->SetUserLimits(theUserLimitsForRoom);
cupboard2_log->SetUserLimits(theUserLimitsForRoom);
desk1_log->SetUserLimits(theUserLimitsForRoom);
desk2_log->SetUserLimits(theUserLimitsForRoom);
desk3_log->SetUserLimits(theUserLimitsForRoom);
desk4_log->SetUserLimits(theUserLimitsForRoom);
crate_log->SetUserLimits(theUserLimitsForRoom);
trunk_log->SetUserLimits(theUserLimitsForRoom);
trunk_inside_log->SetUserLimits(theUserLimitsForRoom);
@@ -33,15 +33,27 @@
// by A. Howard and H. Araujo
// (27th November 2001)
//
// History/Additions:
// 16 Jan 2002 Added analysis
//
//
// EventAction program
// --------------------------------------------------------------
#include "DMXEventAction.hh"
// pass parameters for messengers:
#include "DMXRunAction.hh"
#include "DMXPrimaryGeneratorAction.hh"
// note DMXPmtHit.hh and DMXScintHit.hh are included in DMXEventAction.hh
#include "DMXEventActionMessenger.hh"
#ifdef G4ANALYSIS_USE
#include "DMXAnalysisManager.hh"
#endif
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
@@ -58,7 +70,10 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXEventAction::DMXEventAction() {
DMXEventAction::DMXEventAction(DMXRunAction* DMXRun,
DMXPrimaryGeneratorAction* DMXGenerator)
: runAct(DMXRun),genAction(DMXGenerator)
{
// create messenger
eventMessenger = new DMXEventActionMessenger(this);
@@ -76,6 +91,9 @@ DMXEventAction::DMXEventAction() {
scintillatorCollID = -1;
pmtCollID = -1;
energy_pri=0;
seeds=NULL;
}
@@ -89,11 +107,24 @@ DMXEventAction::~DMXEventAction() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::BeginOfEventAction(const G4Event* evt) {
// grab seeds
seeds = genAction->GetEventSeeds();
// grab energy of primary
energy_pri = genAction->GetEnergyPrimary();
event_id = evt->GetEventID();
// print this information event by event (modulo n)
if (event_id%printModulo == 0)
G4cout << "\n---> Begin of event: " << event_id << G4endl;
{
G4cout << "\n---> Begin of event: " << event_id << G4endl;
G4cout << " Primary Energy: " << G4BestUnit(energy_pri,"Energy")
<< G4endl;
// HepRandom::showEngineStatus();
}
// get ID for scintillator hits collection
if (scintillatorCollID==-1) {
@@ -129,6 +160,7 @@ void DMXEventAction::EndOfEventAction(const G4Event* evt) {
totEnergy = 0.;
totEnergyGammas = 0.;
totEnergyNeutrons = 0.;
firstParticleE = 0.;
particleEnergy = 0.;
firstLXeHitTime = 0.;
aveTimePmtHits = 0.;
@@ -151,16 +183,20 @@ void DMXEventAction::EndOfEventAction(const G4Event* evt) {
// scintillator hits
if(SHC) {
S_hits = SHC->entries();
for (G4int i=0; i<S_hits; i++) {
if(i==0) {
firstParticleName = (*SHC)[0]->GetParticle();
firstLXeHitTime = (*SHC)[0]->GetTime();
if (event_id%printModulo == 0)
G4cout << " First hit: " << firstParticleName << G4endl;
firstParticleE = (*SHC)[0]->GetParticleEnergy();
if (event_id%printModulo == 0) {
G4cout << " First hit in LXe: " << firstParticleName << G4endl;
G4cout << " Number of hits in LXe: " << S_hits << G4endl;
}
}
hitEnergy = (*SHC)[i]->GetEdep();
totEnergy += hitEnergy;
particleName = (*SHC)[i]->GetParticle();
particleEnergy = (*SHC)[i]->GetParticleEnergy();
@@ -188,36 +224,50 @@ void DMXEventAction::EndOfEventAction(const G4Event* evt) {
if(start_neutron && !start_gamma)
totEnergyNeutrons += hitEnergy;
}
if (event_id%printModulo == 0)
G4cout << " Total energy in LXe: "
<< G4BestUnit(totEnergy,"Energy") << G4endl;
}
// PMT hits
if(PHC) {
P_hits = PHC->entries();
// average time of PMT hits
for (G4int i=0; i<P_hits; i++)
aveTimePmtHits +=
((*PHC)[i]->GetTime() - firstLXeHitTime)
/ (G4double)P_hits;
if (event_id%printModulo == 0)
for (G4int i=0; i<P_hits; i++) {
G4double time = ( (*PHC)[i]->GetTime() - firstLXeHitTime );
aveTimePmtHits += time / (G4double)P_hits;
if (event_id == 0) {
#ifdef G4ANALYSIS_USE
// pass first event for histogram record:
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->HistFirstTime(time);
#endif
}
}
if (event_id%printModulo == 0) {
G4cout << " Average light collection time: "
<< G4BestUnit(aveTimePmtHits,"Time") << G4endl;
G4cout << " Number of PMT hits (photons): " << P_hits << G4endl;
// #ifdef G4ANALYSIS_USE
// // plot histograms, interactively:
// DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
// analysis->PlotHistosInter();
// #endif
}
// write out (x,y,z) of PMT hits
if (savePmtFlag)
writePmtHitsToFile(PHC);
}
// write out event summary
if(saveHitsFlag)
writeScintHitsToFile();
// draw trajectories
if(drawColsFlag=="standard" && drawTrksFlag!="none")
drawTracks(evt);
@@ -230,7 +280,6 @@ void DMXEventAction::EndOfEventAction(const G4Event* evt) {
if (event_id%printModulo == 0)
G4cout << "---> End of event: " << event_id << G4endl;
}
@@ -238,73 +287,99 @@ void DMXEventAction::EndOfEventAction(const G4Event* evt) {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::writeScintHitsToFile(void) {
G4String filename="hits.out";
// G4String filename="hits.out";
G4String filename=runAct->GetsavehitsFile();
G4std::ofstream hitsfile(filename, G4std::ios::app);
if(!event_id) {
G4std::ofstream hitsfile(filename);
hitsfile <<"Evt Etot LXe LXeTime PMT PmtTime First Flags"
hitsfile <<"Evt E_Prim Etot LXe LXeTime PMT PmtTime First Flags Seed1 Seed2"
<< G4endl;
hitsfile <<"# MeV hits ns hits ns hit" << G4endl
hitsfile <<"# MeV MeV hits ns hits ns hit"
<< G4endl
<< G4endl;
}
if(S_hits) {
if(hitsfile.is_open()) {
if(hitsfile.is_open()) {
hitsfile << G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6)
<< event_id << "\t"
<< totEnergy/MeV << "\t"
<< S_hits << "\t"
<< G4std::setiosflags(G4std::ios::scientific)
<< G4std::setprecision(2)
<< firstLXeHitTime/nanosecond << "\t"
<< P_hits << "\t"
<< G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< aveTimePmtHits/nanosecond << "\t"
<< firstParticleName << "\t"
<< (gamma_ev ? "gamma " : "")
<< (neutron_ev ? "neutron " : "")
<< (positron_ev ? "positron " : "")
<< (electron_ev ? "electron " : "")
<< (other_ev ? "other " : "")
<< G4endl;
if (event_id%printModulo == 0)
G4cout << " Event summary in file " << filename << G4endl;
hitsfile.close();
hitsfile << G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6)
<< event_id << "\t"
<< energy_pri/MeV << "\t"
<< totEnergy/MeV << "\t"
<< S_hits << "\t"
<< G4std::setiosflags(G4std::ios::scientific)
<< G4std::setprecision(2)
<< firstLXeHitTime/nanosecond << "\t"
<< P_hits << "\t"
<< G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< aveTimePmtHits/nanosecond << "\t"
<< firstParticleName << "\t"
<< (gamma_ev ? "gamma " : "")
<< (neutron_ev ? "neutron " : "")
<< (positron_ev ? "positron " : "")
<< (electron_ev ? "electron " : "")
<< (other_ev ? "other " : "")
<< *seeds << "\t"
<< *(seeds+1) << "\t"
<< G4endl;
if (event_id%printModulo == 0)
G4cout << " Event summary in file " << filename << G4endl;
hitsfile.close();
}
#ifdef G4ANALYSIS_USE
long seed1 = *seeds;
long seed2 = *(seeds+1);
// pass event summary to analysis manager for booking into histos and ntple
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->analyseScintHits(event_id,energy_pri,totEnergy,S_hits,firstLXeHitTime,P_hits,aveTimePmtHits,firstParticleName,firstParticleE,gamma_ev,neutron_ev,positron_ev,electron_ev,other_ev,seed1,seed2);
#endif
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::writePmtHitsToFile(const DMXPmtHitsCollection* hits) {
G4String filename="pmt.out";
G4std::ofstream pmtfile(filename);
// G4String filename="pmt.out";
G4String filename=runAct->GetsavepmtFile();
G4std::ofstream pmtfile(filename, G4std::ios::app);
G4double x; G4double y; G4double z;
if(pmtfile.is_open()) {
pmtfile << "Hit# X, mm Y, mm Z, mm" << G4endl;
pmtfile << G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(3)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6);
<< G4std::setprecision(3)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6);
for (G4int i=0; i<P_hits; i++)
pmtfile << i << "\t"
<< ((*hits)[i]->GetPos()).x()/mm << "\t"
<< ((*hits)[i]->GetPos()).y()/mm << "\t"
<< ((*hits)[i]->GetPos()).z()/mm << G4endl;
{
x = ((*hits)[i]->GetPos()).x()/mm;
y = ((*hits)[i]->GetPos()).y()/mm;
z = ((*hits)[i]->GetPos()).z()/mm;
pmtfile << i << "\t"
<< x << "\t"
<< y << "\t"
<< z << G4endl;
#ifdef G4ANALYSIS_USE
// pass pmt hit summary to analysis manager for booking in ntples
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->analysePMTHits(event_id,i,x,y,z);
#endif
}
if (event_id%printModulo == 0)
G4cout << P_hits << " PMT hits in " << filename << G4endl;
pmtfile.close();
if (event_id%printModulo == 0)
G4cout << " PMT hits in " << filename << G4endl;
}
}
@@ -76,6 +76,8 @@ G4double DMXMaxTimeCuts::PostStepGetPhysicalInteractionLength(
// can apply cuts for specific particles - use if(particleDef):
// G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
// G4cout << " Time: " << pUserLimits->GetUserMaxTime(aTrack) << G4endl;
if (pUserLimits) {
G4double temp = DBL_MAX;
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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: DMXMinEkineCuts.cc,v 1.2 2002/06/18 10:17:30 ahoward Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// --------------------------------------------------------------
// 15 April 1998 M.Maire
// --------------------------------------------------------------
#include "DMXMinEkineCuts.hh"
#include "G4Step.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
DMXMinEkineCuts::DMXMinEkineCuts(const G4String& aName)
: DMXSpecialCuts(aName)
{
if (verboseLevel>1) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
SetProcessType(fUserDefined);
}
DMXMinEkineCuts::~DMXMinEkineCuts()
{}
DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCuts& right)
{}
G4double DMXMinEkineCuts::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double ,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double proposedStep = DBL_MAX;
// get the pointer to UserLimits
G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
//min kinetic energy
G4double temp = DBL_MAX;
G4double eKine = aParticle->GetKineticEnergy();
G4Material* aMaterial = aTrack.GetMaterial();
G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
G4double rangeNow = DBL_MAX;
rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,aMaterial);
if (eKine < eMin ) {
proposedStep = 0.;
} else {
// charged particles only
G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,aMaterial);
temp = rangeNow - rangeMin;
if (proposedStep > temp) proposedStep = temp;
}
}
return proposedStep;
}
@@ -33,6 +33,7 @@
// by A. Howard and H. Araujo
// (27th November 2001)
//
//
// ParticleSource program
// --------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
@@ -389,7 +390,7 @@ void DMXParticleSource::GeneratePrimaryVertex(G4Event *evt)
// create a new vertex
G4PrimaryVertex* vertex =
new G4PrimaryVertex(particle_position,particle_time);
if(verbosityLevel >= 2)
G4cout << "Creating primaries and assigning to vertex" << G4endl;
// create new primaries and set them to the vertex
@@ -409,6 +410,8 @@ void DMXParticleSource::GeneratePrimaryVertex(G4Event *evt)
G4cout << " NumberOfParticlesToBeGenerated: "
<< NumberOfParticlesToBeGenerated << G4endl;
}
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ ) {
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
@@ -424,3 +427,6 @@ void DMXParticleSource::GeneratePrimaryVertex(G4Event *evt)
G4cout << " Primary Vetex generated "<< G4endl;
}
@@ -47,46 +47,24 @@
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
/*
#include "G4hZiegler1977p.hh"
#include "G4hZiegler1985p.hh"
#include "G4hZiegler1977He.hh"
#include "G4hICRU49p.hh"
#include "G4hICRU49He.hh"
#include "G4hZiegler1977Nuclear.hh"
#include "G4hZiegler1985Nuclear.hh"
*/
//#include "G4BosonConstructor.hh"
//#include "G4LeptonConstructor.hh"
//#include "G4MesonConstructor.hh"
//#include "G4BaryonConstructor.hh"
//#include "G4IonConstructor.hh"
//#include "G4ShortLivedConstructor.hh"
//#include "G4Material.hh"
//#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
#include "G4UserLimits.hh"
//#include "G4FastSimulationManagerProcess.hh"
// Constructor /////////////////////////////////////////////////////////////
DMXPhysicsList::DMXPhysicsList() : G4VUserPhysicsList() {
DMXPhysicsList::DMXPhysicsList() : G4VUserPhysicsList()
{
defaultCutValue = 1.0*micrometer;
defaultCutValue = 1.0*micrometer; //
cutForGamma = defaultCutValue;
cutForElectron = 1.0*nanometer;
cutForPositron = defaultCutValue;
cutForProton = defaultCutValue;
cutForAlpha = 1.0*nanometer;
cutForGenericIon = 1.0*nanometer;
cutForOpticalPhoton = defaultCutValue;
cutForOpticalPhoton = 1.0*mm;
VerboseLevel = 1;
OpVerbLevel = 0;
@@ -96,20 +74,19 @@ DMXPhysicsList::DMXPhysicsList() : G4VUserPhysicsList() {
// Destructor //////////////////////////////////////////////////////////////
DMXPhysicsList::~DMXPhysicsList() {;}
DMXPhysicsList::~DMXPhysicsList()
{;}
// Construct Particles /////////////////////////////////////////////////////
void DMXPhysicsList::ConstructParticle() {
void DMXPhysicsList::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.
// create all particles - DON'T! - inefficient - but are they created?
// GENERIC ION runs okay without declaration - see hTest
ConstructMyBosons();
ConstructMyLeptons();
ConstructMyMesons();
@@ -180,8 +157,6 @@ void DMXPhysicsList::ConstructMyBaryons()
G4AntiNeutron::AntiNeutronDefinition();
}
// NB: FOR ROCK EXAMPLE WILL HAVE TO EXPAND PHYSICS PARTICLE CONSTRUCTORS
// construct Ions://///////////////////////////////////////////////////
void DMXPhysicsList::ConstructMyIons()
@@ -205,7 +180,8 @@ void DMXPhysicsList::ConstructMyShortLiveds()
// Construct Processes //////////////////////////////////////////////////////
void DMXPhysicsList::ConstructProcess() {
void DMXPhysicsList::ConstructProcess()
{
AddTransportation();
@@ -222,6 +198,7 @@ void DMXPhysicsList::ConstructProcess() {
// Transportation ///////////////////////////////////////////////////////////
#include "DMXMaxTimeCuts.hh"
#include "DMXMinEkineCuts.hh"
void DMXPhysicsList::AddTransportation() {
@@ -231,8 +208,12 @@ void DMXPhysicsList::AddTransportation() {
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if(particle != G4OpticalPhoton::OpticalPhotonDefinition())
pmanager->AddDiscreteProcess(new DMXMaxTimeCuts());
G4String particleName = particle->GetParticleName();
// time cuts for ONLY neutrons:
if(particleName == "neutron")
pmanager->AddDiscreteProcess(new DMXMaxTimeCuts());
// Energy cuts to kill charged (embedded in method) particles:
pmanager->AddDiscreteProcess(new DMXMinEkineCuts());
}
}
@@ -261,8 +242,8 @@ void DMXPhysicsList::AddTransportation() {
// alpha and GenericIon and deuterons, triton, He3:
#include "G4hLowEnergyIonisation.hh"
#include "G4EnergyLossTables.hh"
// this uses Ziegler 1988 and is the default - requires detailed testing
// particularly with split between NuclearStopping and electron ionisation
// hLowEnergyIonisation uses Ziegler 1988 as the default
//muon:
#include "G4MuIonisation.hh"
@@ -271,7 +252,7 @@ void DMXPhysicsList::AddTransportation() {
#include "G4MuonMinusCaptureAtRest.hh"
//OTHERS:
//#include "G4hIonisation.hh"
//#include "G4hIonisation.hh" // standard hadron ionisation
void DMXPhysicsList::ConstructEM() {
@@ -294,89 +275,82 @@ void DMXPhysicsList::ConstructEM() {
// cannot specify different LowEnergyIonisation models for different
// particles, but can change model globally for Ion, Alpha and Proton.
if (particleName == "gamma") {
//gamma
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh());
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton());
pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion());
if (particleName == "gamma")
{
//gamma
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh());
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton());
pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion());
}
else if (particleName == "e-")
{
//electron
// process ordering: AddProcess(name, at rest, along step, post step)
// -1 = not implemented, then ordering
pmanager->AddProcess(aMultipleScattering, -1, 1, 1);
pmanager->AddProcess(loweIon, -1, 2, 2);
pmanager->AddProcess(loweBrem, -1,-1, 3);
}
else if (particleName == "e+")
{
//positron
pmanager->AddProcess(aMultipleScattering, -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(aMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4MuIonisation(), -1, 2, 2);
pmanager->AddProcess(new G4MuBremsstrahlung(), -1,-1, 3);
pmanager->AddProcess(new G4MuPairProduction(), -1,-1, 4);
pmanager->AddProcess(new G4MuonMinusCaptureAtRest(), 0,-1,-1);
}
else if (particleName == "proton" ||
particleName == "alpha" ||
particleName == "deuteron" ||
particleName == "triton" ||
particleName == "He3" ||
particleName == "GenericIon" ||
(particleType == "nucleus" && charge != 0))
{
// OBJECT may be dynamically created as either a GenericIon or nucleus
// G4Nucleus exists and therefore has particle type nucleus
// genericIon:
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon,-1,2,2);
}
else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino"))
{
//all others charged particles except geantino
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon, -1,2,2);
// pmanager->AddProcess(new G4hIonisation(), -1,2,2);
}
ahadronLowEIon->SetNuclearStoppingOn() ;
} else if (particleName == "e-") {
//electron
// process ordering: AddProcess(name, at rest, along step, post step)
// -1 = not implemented, then ordering............
pmanager->AddProcess(aMultipleScattering, -1, 1,1);
pmanager->AddProcess(loweIon, -1, 2,2);
pmanager->AddProcess(loweBrem, -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(aMultipleScattering, -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(aMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4MuIonisation(), -1, 2, 2);
pmanager->AddProcess(new G4MuBremsstrahlung(), -1, -1, 3);
pmanager->AddProcess(new G4MuPairProduction(), -1, -1, 4);
pmanager->AddProcess(new G4MuonMinusCaptureAtRest(),0,-1,-1);
} else if (particleName == "GenericIon" ||
(particleType == "nucleus" && charge != 0)) {
// OBJECT may be dynamically created as either a GenericIon or a nucleus
// G4Nucleus exists and therefore has particle type nucleus
// genericIon:
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon,-1,2,2);
} else if (particleName == "Alpha") {
// alpha:
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon,-1,2,2);
} else if (particleName == "Proton") {
// alpha:
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon,-1,2,2);
} else if (particleName == "deuteron"
|| particleName == "triton"
|| particleName == "He3") {
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon,-1,2,2);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(aMultipleScattering,-1,1,1);
pmanager->AddProcess(ahadronLowEIon, -1,2,2);
// pmanager->AddProcess(new G4hIonisation(), -1,2,2);
}
ahadronLowEIon->SetNuclearStoppingOn() ;
//fluorescence switch off for hadrons (for now):
ahadronLowEIon->SetFluorescence(false);
//fluorescence switch off for hadrons (for now) PIXE:
ahadronLowEIon->SetFluorescence(false);
//fluorescence apply specific cut for flourescence from photons, electrons
//and bremsstrahlung photons:
G4double cut = 250*eV;
lowePhot->SetCutForLowEnSecPhotons(cut);
loweIon->SetCutForLowEnSecPhotons(cut);
loweBrem->SetCutForLowEnSecPhotons(cut);
G4double cut = 250*eV;
lowePhot->SetCutForLowEnSecPhotons(cut);
loweIon->SetCutForLowEnSecPhotons(cut);
loweBrem->SetCutForLowEnSecPhotons(cut);
// ahadronLowEIon->SetNuclearStoppingOff() ;
// ahadronLowEIon->SetNuclearStoppingOff() ;
// ahadronLowEIon->SetStoppingPowerTableName("ICRU_R49p") ;
//ahadronLowEIon->SetStoppingPowerTableName("ICRU_R49p") ;
//ahadronLowEIon->SetStoppingPowerTableName("Ziegler1977H") ;
// ahadronLowEIon->SetStoppingPowerTableName("Ziegler1977H") ;
}
}
@@ -388,17 +362,22 @@ void DMXPhysicsList::ConstructEM() {
#include "G4OpRayleigh.hh"
#include "G4OpBoundaryProcess.hh"
void DMXPhysicsList::ConstructOp() {
void DMXPhysicsList::ConstructOp()
{
// ATTENTION!!!!:
// Number of scintillation photons generated is wrong (!=correct yield)
// this is due to a mis-implementation within G4 Tracking and the
// scintillation process (to be corrected soon)
// default scintillation process
G4Scintillation* theScintProcessDef = new G4Scintillation("Scintillation");
// theScintProcessDef->DumpPhysicsTable();
theScintProcessDef->SetTrackSecondariesFirst(true);
theScintProcessDef->SetScintillationYield(50000./MeV);
// Fano factor assumed 1 should be much less for Xe - 0.13?
// but is the Fano factor already included in the correlated electron
// production........
theScintProcessDef->SetResolutionScale(1.);
theScintProcessDef->SetScintillationYield(11000./MeV); // including QE 20%
// Fano factor assumed 1; should be much less for Xe ~ 0.13
// but the Fano factor is already partially included in the correlated
// electron production - therefore not the absolute Fano factor here:
theScintProcessDef->SetResolutionScale(1.0);
theScintProcessDef->SetScintillationTime(45.*ns);
theScintProcessDef->SetVerboseLevel(OpVerbLevel);
@@ -406,8 +385,8 @@ void DMXPhysicsList::ConstructOp() {
G4Scintillation* theScintProcessAlpha = new G4Scintillation("Scintillation");
// theScintProcessNuc->DumpPhysicsTable();
theScintProcessAlpha->SetTrackSecondariesFirst(true);
theScintProcessAlpha->SetScintillationYield(60000./MeV);
theScintProcessAlpha->SetResolutionScale(0./MeV);
theScintProcessAlpha->SetScintillationYield(12000./MeV); // including QE 20%
theScintProcessAlpha->SetResolutionScale(1.0);
theScintProcessAlpha->SetScintillationTime(20.*ns);
theScintProcessAlpha->SetVerboseLevel(OpVerbLevel);
@@ -415,8 +394,8 @@ void DMXPhysicsList::ConstructOp() {
G4Scintillation* theScintProcessNuc = new G4Scintillation("Scintillation");
// theScintProcessNuc->DumpPhysicsTable();
theScintProcessNuc->SetTrackSecondariesFirst(true);
theScintProcessNuc->SetScintillationYield(5000./MeV);
theScintProcessNuc->SetResolutionScale(0./MeV);
theScintProcessNuc->SetScintillationYield(1000./MeV); // including QE 20%
theScintProcessNuc->SetResolutionScale(1.);
theScintProcessNuc->SetScintillationTime(20.*ns);
theScintProcessNuc->SetVerboseLevel(OpVerbLevel);
@@ -433,31 +412,45 @@ void DMXPhysicsList::ConstructOp() {
theBoundaryProcess->SetModel(themodel);
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (theScintProcessDef->IsApplicable(*particle)) {
// if(particle->GetPDGMass() > 5.0*GeV)
if(particle->GetParticleName() == "GenericIon")
pmanager->AddDiscreteProcess(theScintProcessNuc);
else if(particle->GetParticleName() == "alpha")
pmanager->AddDiscreteProcess(theScintProcessAlpha);
else
pmanager->AddDiscreteProcess(theScintProcessDef);
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (theScintProcessDef->IsApplicable(*particle)) {
// if(particle->GetPDGMass() > 5.0*GeV)
if(particle->GetParticleName() == "GenericIon") {
pmanager->AddProcess(theScintProcessNuc); // AtRestDiscrete
pmanager->SetProcessOrderingToLast(theScintProcessNuc,idxAtRest);
pmanager->SetProcessOrderingToLast(theScintProcessNuc,idxPostStep);
}
else if(particle->GetParticleName() == "alpha") {
pmanager->AddProcess(theScintProcessAlpha);
pmanager->SetProcessOrderingToLast(theScintProcessAlpha,idxAtRest);
pmanager->SetProcessOrderingToLast(theScintProcessAlpha,idxPostStep);
}
else {
pmanager->AddProcess(theScintProcessDef);
pmanager->SetProcessOrderingToLast(theScintProcessDef,idxAtRest);
pmanager->SetProcessOrderingToLast(theScintProcessDef,idxPostStep);
}
}
if (particleName == "opticalphoton") {
pmanager->AddDiscreteProcess(theAbsorptionProcess);
pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
pmanager->AddDiscreteProcess(theBoundaryProcess);
}
}
if (particleName == "opticalphoton") {
pmanager->AddDiscreteProcess(theAbsorptionProcess);
pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
pmanager->AddDiscreteProcess(theBoundaryProcess);
}
}
}
// Hadronic rocesses ////////////////////////////////////////////////////////
// Hadronic processes ////////////////////////////////////////////////////////
// Elastic processes:
#include "G4HadronElasticProcess.hh"
// Inelastic processes:
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4KaonPlusInelasticProcess.hh"
@@ -472,7 +465,7 @@ void DMXPhysicsList::ConstructOp() {
#include "G4TritonInelasticProcess.hh"
#include "G4AlphaInelasticProcess.hh"
// Low-energy Models
// Low-energy Models: < 20GeV
#include "G4LElastic.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
@@ -488,7 +481,7 @@ void DMXPhysicsList::ConstructOp() {
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
// High-energy Models
// High-energy Models: >20 GeV
#include "G4HEPionPlusInelastic.hh"
#include "G4HEPionMinusInelastic.hh"
#include "G4HEKaonPlusInelastic.hh"
@@ -499,6 +492,8 @@ void DMXPhysicsList::ConstructOp() {
#include "G4HEAntiProtonInelastic.hh"
#include "G4HENeutronInelastic.hh"
#include "G4HEAntiNeutronInelastic.hh"
// Neutron high-precision models: <20 MeV
#include "G4NeutronHPElastic.hh"
#include "G4NeutronHPElasticData.hh"
#include "G4NeutronHPCapture.hh"
@@ -510,6 +505,8 @@ void DMXPhysicsList::ConstructOp() {
// Stopping processes
#include "G4PiMinusAbsorptionAtRest.hh"
#include "G4KaonMinusAbsorptionAtRest.hh"
#include "G4AntiProtonAnnihilationAtRest.hh"
#include "G4AntiNeutronAnnihilationAtRest.hh"
// ConstructHad()
@@ -517,216 +514,228 @@ void DMXPhysicsList::ConstructOp() {
// to those particles with GHEISHA interactions (INTRC > 0).
// The processes are: Elastic scattering and Inelastic scattering.
// F.W.Jones 09-JUL-1998
void DMXPhysicsList::ConstructHad() {
void DMXPhysicsList::ConstructHad()
{
G4HadronElasticProcess* theElasticProcess = new G4HadronElasticProcess;
G4LElastic* theElasticModel = new G4LElastic;
theElasticProcess->RegisterMe(theElasticModel);
theParticleIterator->reset();
while ((*theParticleIterator)()) {
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
while ((*theParticleIterator)())
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "pi+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionPlusInelasticProcess* theInelasticProcess =
new G4PionPlusInelasticProcess("inelastic");
G4LEPionPlusInelastic* theLEInelasticModel =
new G4LEPionPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionPlusInelastic* theHEInelasticModel =
new G4HEPionPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
if (particleName == "pi+")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionPlusInelasticProcess* theInelasticProcess =
new G4PionPlusInelasticProcess("inelastic");
G4LEPionPlusInelastic* theLEInelasticModel =
new G4LEPionPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionPlusInelastic* theHEInelasticModel =
new G4HEPionPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "pi-")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionMinusInelasticProcess* theInelasticProcess =
new G4PionMinusInelasticProcess("inelastic");
G4LEPionMinusInelastic* theLEInelasticModel =
new G4LEPionMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionMinusInelastic* theHEInelasticModel =
new G4HEPionMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
G4String prcNam;
pmanager->AddRestProcess(new G4PiMinusAbsorptionAtRest, ordDefault);
}
else if (particleName == "kaon+")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonPlusInelasticProcess* theInelasticProcess =
new G4KaonPlusInelasticProcess("inelastic");
G4LEKaonPlusInelastic* theLEInelasticModel =
new G4LEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonPlusInelastic* theHEInelasticModel =
new G4HEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0S")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroSInelasticProcess* theInelasticProcess =
new G4KaonZeroSInelasticProcess("inelastic");
G4LEKaonZeroSInelastic* theLEInelasticModel =
new G4LEKaonZeroSInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0L")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroLInelasticProcess* theInelasticProcess =
new G4KaonZeroLInelasticProcess("inelastic");
G4LEKaonZeroLInelastic* theLEInelasticModel =
new G4LEKaonZeroLInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon-")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonMinusInelasticProcess* theInelasticProcess =
new G4KaonMinusInelasticProcess("inelastic");
G4LEKaonMinusInelastic* theLEInelasticModel =
new G4LEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonMinusInelastic* theHEInelasticModel =
new G4HEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
pmanager->AddRestProcess(new G4KaonMinusAbsorptionAtRest, ordDefault);
}
else if (particleName == "proton")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4ProtonInelasticProcess* theInelasticProcess =
new G4ProtonInelasticProcess("inelastic");
G4LEProtonInelastic* theLEInelasticModel = new G4LEProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEProtonInelastic* theHEInelasticModel = new G4HEProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_proton")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiProtonInelasticProcess* theInelasticProcess =
new G4AntiProtonInelasticProcess("inelastic");
G4LEAntiProtonInelastic* theLEInelasticModel =
new G4LEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiProtonInelastic* theHEInelasticModel =
new G4HEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "neutron") {
// elastic scattering
G4HadronElasticProcess* theNeutronElasticProcess =
new G4HadronElasticProcess;
G4LElastic* theElasticModel1 = new G4LElastic;
G4NeutronHPElastic * theElasticNeutron = new G4NeutronHPElastic;
theNeutronElasticProcess->RegisterMe(theElasticModel1);
theElasticModel1->SetMinEnergy(19*MeV);
theNeutronElasticProcess->RegisterMe(theElasticNeutron);
G4CrossSectionDataStore * theStore =
((G4HadronElasticProcess*)theNeutronElasticProcess)
->GetCrossSectionDataStore();
G4NeutronHPElasticData * theNeutronData = new G4NeutronHPElasticData;
theStore->AddDataSet(theNeutronData);
pmanager->AddDiscreteProcess(theNeutronElasticProcess);
// inelastic scattering
G4NeutronInelasticProcess* theInelasticProcess =
new G4NeutronInelasticProcess("inelastic");
G4LENeutronInelastic* theInelasticModel = new G4LENeutronInelastic;
theInelasticModel->SetMinEnergy(19*MeV);
theInelasticProcess->RegisterMe(theInelasticModel);
G4NeutronHPInelastic * theLENeutronInelasticModel =
new G4NeutronHPInelastic;
theInelasticProcess->RegisterMe(theLENeutronInelasticModel);
G4CrossSectionDataStore * theStore1 =
((G4HadronInelasticProcess*)theInelasticProcess)
->GetCrossSectionDataStore();
G4NeutronHPInelasticData * theNeutronData1 =
new G4NeutronHPInelasticData;
theStore1->AddDataSet(theNeutronData1);
pmanager->AddDiscreteProcess(theInelasticProcess);
// capture
G4HadronCaptureProcess* theCaptureProcess =
new G4HadronCaptureProcess;
G4LCapture* theCaptureModel = new G4LCapture;
theCaptureModel->SetMinEnergy(19*MeV);
theCaptureProcess->RegisterMe(theCaptureModel);
G4NeutronHPCapture * theLENeutronCaptureModel = new G4NeutronHPCapture;
theCaptureProcess->RegisterMe(theLENeutronCaptureModel);
G4CrossSectionDataStore * theStore3 =
((G4HadronCaptureProcess*)theCaptureProcess)->
GetCrossSectionDataStore();
G4NeutronHPCaptureData * theNeutronData3 = new G4NeutronHPCaptureData;
theStore3->AddDataSet(theNeutronData3);
pmanager->AddDiscreteProcess(theCaptureProcess);
// G4ProcessManager* pmanager = G4Neutron::Neutron->GetProcessManager();
// pmanager->AddProcess(new G4UserSpecialCuts(),-1,-1,1);
}
else if (particleName == "anti_neutron")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiNeutronInelasticProcess* theInelasticProcess =
new G4AntiNeutronInelasticProcess("inelastic");
G4LEAntiNeutronInelastic* theLEInelasticModel =
new G4LEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiNeutronInelastic* theHEInelasticModel =
new G4HEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "deuteron")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4DeuteronInelasticProcess* theInelasticProcess =
new G4DeuteronInelasticProcess("inelastic");
G4LEDeuteronInelastic* theLEInelasticModel =
new G4LEDeuteronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "triton")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4TritonInelasticProcess* theInelasticProcess =
new G4TritonInelasticProcess("inelastic");
G4LETritonInelastic* theLEInelasticModel =
new G4LETritonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "alpha")
{
pmanager->AddDiscreteProcess(theElasticProcess);
G4AlphaInelasticProcess* theInelasticProcess =
new G4AlphaInelasticProcess("inelastic");
G4LEAlphaInelastic* theLEInelasticModel =
new G4LEAlphaInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "pi-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4PionMinusInelasticProcess* theInelasticProcess =
new G4PionMinusInelasticProcess("inelastic");
G4LEPionMinusInelastic* theLEInelasticModel =
new G4LEPionMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEPionMinusInelastic* theHEInelasticModel =
new G4HEPionMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
G4String prcNam;
pmanager->AddRestProcess(new G4PiMinusAbsorptionAtRest, ordDefault);
}
else if (particleName == "kaon+") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonPlusInelasticProcess* theInelasticProcess =
new G4KaonPlusInelasticProcess("inelastic");
G4LEKaonPlusInelastic* theLEInelasticModel =
new G4LEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonPlusInelastic* theHEInelasticModel =
new G4HEKaonPlusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0S") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroSInelasticProcess* theInelasticProcess =
new G4KaonZeroSInelasticProcess("inelastic");
G4LEKaonZeroSInelastic* theLEInelasticModel =
new G4LEKaonZeroSInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon0L") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonZeroLInelasticProcess* theInelasticProcess =
new G4KaonZeroLInelasticProcess("inelastic");
G4LEKaonZeroLInelastic* theLEInelasticModel =
new G4LEKaonZeroLInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonZeroInelastic* theHEInelasticModel =
new G4HEKaonZeroInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "kaon-") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4KaonMinusInelasticProcess* theInelasticProcess =
new G4KaonMinusInelasticProcess("inelastic");
G4LEKaonMinusInelastic* theLEInelasticModel =
new G4LEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEKaonMinusInelastic* theHEInelasticModel =
new G4HEKaonMinusInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
pmanager->AddRestProcess(new G4KaonMinusAbsorptionAtRest, ordDefault);
}
else if (particleName == "proton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4ProtonInelasticProcess* theInelasticProcess =
new G4ProtonInelasticProcess("inelastic");
G4LEProtonInelastic* theLEInelasticModel = new G4LEProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEProtonInelastic* theHEInelasticModel = new G4HEProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "anti_proton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiProtonInelasticProcess* theInelasticProcess =
new G4AntiProtonInelasticProcess("inelastic");
G4LEAntiProtonInelastic* theLEInelasticModel =
new G4LEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiProtonInelastic* theHEInelasticModel =
new G4HEAntiProtonInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "neutron") {
// elastic scattering
G4HadronElasticProcess* theNeutronElasticProcess =
new G4HadronElasticProcess;
G4LElastic* theElasticModel1 = new G4LElastic;
G4NeutronHPElastic * theElasticNeutron = new G4NeutronHPElastic;
theNeutronElasticProcess->RegisterMe(theElasticModel1);
theElasticModel1->SetMinEnergy(19*MeV);
theNeutronElasticProcess->RegisterMe(theElasticNeutron);
G4CrossSectionDataStore * theStore =
((G4HadronElasticProcess*)theNeutronElasticProcess)
->GetCrossSectionDataStore();
G4NeutronHPElasticData * theNeutronData = new G4NeutronHPElasticData;
theStore->AddDataSet(theNeutronData);
pmanager->AddDiscreteProcess(theNeutronElasticProcess);
// inelastic scattering
G4NeutronInelasticProcess* theInelasticProcess =
new G4NeutronInelasticProcess("inelastic");
G4LENeutronInelastic* theInelasticModel = new G4LENeutronInelastic;
theInelasticModel->SetMinEnergy(19*MeV);
theInelasticProcess->RegisterMe(theInelasticModel);
G4NeutronHPInelastic * theLENeutronInelasticModel =
new G4NeutronHPInelastic;
theInelasticProcess->RegisterMe(theLENeutronInelasticModel);
G4CrossSectionDataStore * theStore1 =
((G4HadronInelasticProcess*)theInelasticProcess)
->GetCrossSectionDataStore();
G4NeutronHPInelasticData * theNeutronData1 =
new G4NeutronHPInelasticData;
theStore1->AddDataSet(theNeutronData1);
pmanager->AddDiscreteProcess(theInelasticProcess);
// capture
G4HadronCaptureProcess* theCaptureProcess =
new G4HadronCaptureProcess;
G4LCapture* theCaptureModel = new G4LCapture;
theCaptureModel->SetMinEnergy(19*MeV);
theCaptureProcess->RegisterMe(theCaptureModel);
G4NeutronHPCapture * theLENeutronCaptureModel = new G4NeutronHPCapture;
theCaptureProcess->RegisterMe(theLENeutronCaptureModel);
G4CrossSectionDataStore * theStore3 =
((G4HadronCaptureProcess*)theCaptureProcess)->
GetCrossSectionDataStore();
G4NeutronHPCaptureData * theNeutronData3 = new G4NeutronHPCaptureData;
theStore3->AddDataSet(theNeutronData3);
pmanager->AddDiscreteProcess(theCaptureProcess);
// G4ProcessManager* pmanager = G4Neutron::Neutron->GetProcessManager();
// pmanager->AddProcess(new G4UserSpecialCuts(),-1,-1,1);
}
else if (particleName == "anti_neutron") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AntiNeutronInelasticProcess* theInelasticProcess =
new G4AntiNeutronInelasticProcess("inelastic");
G4LEAntiNeutronInelastic* theLEInelasticModel =
new G4LEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
G4HEAntiNeutronInelastic* theHEInelasticModel =
new G4HEAntiNeutronInelastic;
theInelasticProcess->RegisterMe(theHEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "deuteron") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4DeuteronInelasticProcess* theInelasticProcess =
new G4DeuteronInelasticProcess("inelastic");
G4LEDeuteronInelastic* theLEInelasticModel =
new G4LEDeuteronInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "triton") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4TritonInelasticProcess* theInelasticProcess =
new G4TritonInelasticProcess("inelastic");
G4LETritonInelastic* theLEInelasticModel =
new G4LETritonInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
else if (particleName == "alpha") {
pmanager->AddDiscreteProcess(theElasticProcess);
G4AlphaInelasticProcess* theInelasticProcess =
new G4AlphaInelasticProcess("inelastic");
G4LEAlphaInelastic* theLEInelasticModel =
new G4LEAlphaInelastic;
theInelasticProcess->RegisterMe(theLEInelasticModel);
pmanager->AddDiscreteProcess(theInelasticProcess);
}
}
}
@@ -741,41 +750,46 @@ void DMXPhysicsList::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);
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);
}
}
}
// Declare radioactive decay to the GenericIon in the IonTable.
const G4IonTable *theIonTable =
G4ParticleTable::GetParticleTable()->GetIonTable();
G4RadioactiveDecay *theRadioactiveDecay = new G4RadioactiveDecay();
for (G4int i=0; i<theIonTable->Entries(); i++) {
G4String particleName = theIonTable->GetParticle(i)->GetParticleName();
G4String particleType = theIonTable->GetParticle(i)->GetParticleType();
if (particleName == "GenericIon") {
G4ProcessManager* pmanager =
theIonTable->GetParticle(i)->GetProcessManager();
pmanager->SetVerboseLevel(VerboseLevel);
pmanager ->AddProcess(theRadioactiveDecay);
pmanager ->SetProcessOrdering(theRadioactiveDecay, idxPostStep);
pmanager ->SetProcessOrdering(theRadioactiveDecay, idxAtRest);
}
}
for (G4int i=0; i<theIonTable->Entries(); i++)
{
G4String particleName = theIonTable->GetParticle(i)->GetParticleName();
G4String particleType = theIonTable->GetParticle(i)->GetParticleType();
if (particleName == "GenericIon")
{
G4ProcessManager* pmanager =
theIonTable->GetParticle(i)->GetProcessManager();
pmanager->SetVerboseLevel(VerboseLevel);
pmanager ->AddProcess(theRadioactiveDecay);
pmanager ->SetProcessOrdering(theRadioactiveDecay, idxPostStep);
pmanager ->SetProcessOrdering(theRadioactiveDecay, idxAtRest);
}
}
}
// Cuts /////////////////////////////////////////////////////////////////////
void DMXPhysicsList::SetCuts() {
void DMXPhysicsList::SetCuts()
{
if (verboseLevel >1)
G4cout << "DMXPhysicsList::SetCuts:";
@@ -786,8 +800,6 @@ void DMXPhysicsList::SetCuts() {
}
//special for low energy physics
// G4double lowlimit=250*eV; -- should this be lowered? - see Vladimir's
// htest
G4double lowlimit=250*eV;
G4Gamma ::SetEnergyRange(lowlimit,100*GeV);
G4Electron::SetEnergyRange(lowlimit,100*GeV);
@@ -33,20 +33,41 @@
// by A. Howard and H. Araujo
// (27th November 2001)
//
//
// PrimaryGeneratorAction program
// --------------------------------------------------------------
#include "DMXPrimaryGeneratorAction.hh"
#ifdef DMXENV_GPS_USE
#include "G4GeneralParticleSource.hh"
#else
#include "DMXParticleSource.hh"
#endif
#ifdef G4ANALYSIS_USE
#include "DMXAnalysisManager.hh"
#endif
#include "G4Event.hh"
#include "Randomize.hh"
#include "globals.hh"
DMXPrimaryGeneratorAction::DMXPrimaryGeneratorAction() {
#ifdef DMXENV_GPS_USE
particleGun = new G4GeneralParticleSource();
#else
particleGun = new DMXParticleSource();
#endif
energy_pri=0;
// seeds=NULL;
seeds[0] =-1;
seeds[1] =-1;
}
@@ -59,9 +80,21 @@ DMXPrimaryGeneratorAction::~DMXPrimaryGeneratorAction() {
void DMXPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) {
energy_pri = 0.;
// seeds
// seeds = HepRandom::getTheSeeds();
seeds[0] = *HepRandom::getTheSeeds();
seeds[1] = *(HepRandom::getTheSeeds()+1);
particleGun->GeneratePrimaryVertex(anEvent);
energy_pri = particleGun->GetParticleEnergy();
#ifdef G4ANALYSIS_USE
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->analysePrimaryGenerator(energy_pri);
#endif
}
@@ -33,6 +33,9 @@
// by A. Howard and H. Araujo
// (27th November 2001)
//
// History:
// 17 Jan 2002 Alex Howard Added Analysis
//
// RunAction program
// --------------------------------------------------------------
@@ -48,11 +51,19 @@
#include "g4std/iomanip"
#include "g4std/vector"
#ifdef G4ANALYSIS_USE
#include "DMXAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXRunAction::DMXRunAction()
{
runMessenger = new DMXRunActionMessenger(this);
savehitsFile = "hits.out";
savepmtFile = "pmt.out";
savehistFile = "dmx.his";
interactplot = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -60,6 +71,8 @@ DMXRunAction::DMXRunAction()
DMXRunAction::~DMXRunAction()
{
delete runMessenger;
runMessenger = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,14 +86,28 @@ void DMXRunAction::BeginOfRunAction(const G4Run* aRun)
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
#ifdef G4ANALYSIS_USE
// Book histograms and ntuples
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->book(savehistFile);
// analysis->PlotHistosInit();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXRunAction::EndOfRunAction(const G4Run* aRun)
{
#ifdef G4ANALYSIS_USE
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->PlotHistos(interactplot);
analysis->finish();
#endif
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
@@ -40,6 +40,7 @@
#include "DMXRunAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4ios.hh"
#include "globals.hh"
@@ -48,27 +49,64 @@
DMXRunActionMessenger::DMXRunActionMessenger(DMXRunAction* run)
:DMXRun(run)
{
FileCmd = new G4UIcmdWithAString("/run/filename",this);
FileCmd->SetGuidance(" The log file name for the run");
FileCmd->SetGuidance(" default = rdmex2.log ");
FileCmd->SetParameterName(" Input ",true);
FileCmd->SetDefaultValue("rdmex2.log");
FileCmd->AvailableForStates(Idle);
SaveHitsCmd = new G4UIcmdWithAString("/dmx/hitsfile",this);
SaveHitsCmd->SetGuidance("output file for hits collection (txt)");
SaveHitsCmd->SetGuidance("Default = hits.out");
SaveHitsCmd->SetParameterName("savehitsFile", false);
SaveHitsCmd->SetDefaultValue("hits.out");
SavePmtCmd = new G4UIcmdWithAString("/dmx/pmtfile",this);
SavePmtCmd->SetGuidance("output file for pmt hits (txt)");
SavePmtCmd->SetGuidance("Default = pmt.out");
SavePmtCmd->SetParameterName("savepmtFile", false);
SavePmtCmd->SetDefaultValue("pmt.out");
SaveHistFileCmd = new G4UIcmdWithAString("/dmx/histogramfile",this);
SaveHistFileCmd->SetGuidance("output file for histograms");
SaveHistFileCmd->SetGuidance("Default = dmx.his");
// SaveHistFileCmd->SetParameterName("savehistFile", false);
SaveHistFileCmd->SetParameterName("histFile", false);
SaveHistFileCmd->SetDefaultValue("dmx.his");
InteractPlotCmd = new G4UIcmdWithABool("/dmx/PlotAtEnd",this);
InteractPlotCmd->SetGuidance("Flag for Interactive plotting at end of run");
InteractPlotCmd->SetGuidance("Default = false");
InteractPlotCmd->SetParameterName("interactplot", false);
InteractPlotCmd->SetDefaultValue(false);
// FileCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXRunActionMessenger::~DMXRunActionMessenger()
{
delete FileCmd;
delete SaveHitsCmd;
delete SavePmtCmd;
delete SaveHistFileCmd;
delete InteractPlotCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXRunActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == FileCmd)
{DMXRun->SetFilename(newValue);}
if(command == SaveHitsCmd)
DMXRun->SetsavehitsFile(newValue);
if(command == SavePmtCmd)
DMXRun->SetsavepmtFile(newValue);
if(command == SaveHistFileCmd)
DMXRun->SetsavehistFile(newValue);
if(command == InteractPlotCmd) {
G4int vl;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> vl;
DMXRun->Setinteractplot(vl!=0);
}
}
@@ -33,6 +33,9 @@
// by A. Howard and H. Araujo
// (27th November 2001)
//
// History:
// 21 Feb 2002 AH: Added Analysis
//
// SteppingAction program
// --------------------------------------------------------------
@@ -41,6 +44,10 @@
#include "DMXEventAction.hh"
#ifdef G4ANALYSIS_USE
#include "DMXAnalysisManager.hh"
#endif
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
@@ -85,13 +92,25 @@ DMXSteppingAction::~DMXSteppingAction()
void DMXSteppingAction::UserSteppingAction(const G4Step* fStep)
{
// removed 28/11/01 - unnecessary unless program "hangs"
// removed 28/11/01 - unnecessary unless program "freezes"
// kill track if too many steps
// NB: This is set to DBL_MAX - therefore may cause program to "hang"
// G4int MaxNoSteps = DBL_MAX;
// G4int StepNo = fStep->GetTrack()->GetCurrentStepNumber();
// if(StepNo >= MaxNoSteps) fStep->GetTrack()->SetTrackStatus(fStopAndKill);
#ifdef G4ANALYSIS_USE
G4int StepNo = fStep->GetTrack()->GetCurrentStepNumber();
if(StepNo == 1)
{
G4double partEnergy = fStep->GetPreStepPoint()->GetKineticEnergy();
G4ParticleDefinition* particleType = fStep->GetTrack()->GetDefinition();
G4String particleName = particleType->GetParticleName();
DMXAnalysisManager* analysis = DMXAnalysisManager::getInstance();
analysis->analyseParticleSource(partEnergy, particleName);
}
#endif
// check what is to be drawn from EventAction/EventActionMessenger
G4String drawColsFlag = evtAction->GetDrawColsFlag();
G4String drawTrksFlag = evtAction->GetDrawTrksFlag();