Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3CalorHit.cc,v 1.2 1999/12/15 14:49:02 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3CalorimeterSD.cc,v 1.2 1999/12/15 14:49:03 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3DetectorConstruction.cc,v 1.2 1999/12/15 14:49:03 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3DetectorMessenger.cc,v 1.2 1999/12/15 14:49:03 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: Em3EventAction.cc,v 1.5 2000/12/07 12:38:25 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: Em3EventAction.cc,v 1.8 2001/03/26 16:01:58 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -16,6 +16,7 @@
#include "Em3EventAction.hh"
#include "Em3RunAction.hh"
#include "Em3PrimaryGeneratorAction.hh"
#include "Em3DetectorConstruction.hh"
#include "Em3CalorHit.hh"
#include "Em3EventActionMessenger.hh"
@@ -35,10 +36,15 @@
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#ifndef G4NOHIST
#include "CLHEP/Hist/HBookFile.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em3EventAction::Em3EventAction(Em3RunAction* run, Em3DetectorConstruction* det)
:Em3Run(run),Detector(det),calorimeterCollID(-1),drawFlag("all"),
Em3EventAction::Em3EventAction(Em3RunAction* run,Em3PrimaryGeneratorAction* kin,
Em3DetectorConstruction* det)
:Em3Run(run),Em3Kin(kin),Detector(det),calorimeterCollID(-1),drawFlag("all"),
eventMessenger(NULL),printModulo(10000)
{
eventMessenger = new Em3EventActionMessenger(this);
@@ -56,9 +62,19 @@ Em3EventAction::~Em3EventAction()
void Em3EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
//survey printing
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin Of Event: " << evtNb << G4endl;
//save rndm status
if (Em3Run->GetRndmFreq() == 2)
{
HepRandom::saveEngineStatus("beginOfEvent.rndm");
if (evtNb%printModulo == 0) HepRandom::showEngineStatus();
}
// initialize Hits collection
if (calorimeterCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
@@ -74,10 +90,9 @@ void Em3EventAction::EndOfEventAction(const G4Event* evt)
Em3CalorHitsCollection* CHC = NULL;
G4int NbHits=0;
G4int NbOfAbsor=Detector->GetNbOfAbsor();
G4double Ebeam = Em3Kin->GetParticleGun()->GetParticleEnergy();
G4double totEAbs, totLAbs;
char str1[6], str2[6];
strcpy(str1,"EAbs");strcpy(str2,"LAbs");
if (HCE) CHC = (Em3CalorHitsCollection*)(HCE->GetHC(calorimeterCollID));
if (CHC)
@@ -90,7 +105,13 @@ void Em3EventAction::EndOfEventAction(const G4Event* evt)
totEAbs += (*CHC)[j]->GetEdepAbs(k);
totLAbs += (*CHC)[j]->GetTrakAbs(k);
}
Em3Run->fillPerEvent(k,totEAbs,totLAbs);
Em3Run->fillPerEvent(k,totEAbs,totLAbs);
#ifndef G4NOHIST
//fill histo
//
Em3Run->GetHisto(k)->accumulate(totEAbs/Ebeam);
#endif
}
}
@@ -106,19 +127,7 @@ void Em3EventAction::EndOfEventAction(const G4Event* evt)
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
//save rndm status
if (Em3Run->GetRndmFreq() == 2)
{
HepRandom::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
HepRandom::showEngineStatus();
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3EventActionMessenger.cc,v 1.2 1999/12/15 14:49:04 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3PhysicsList.cc,v 1.5 2000/04/17 12:05:39 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3PhysicsListMessenger.cc,v 1.1 2000/04/17 12:05:40 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3PrimaryGeneratorAction.cc,v 1.2 1999/12/15 14:49:04 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3PrimaryGeneratorMessenger.cc,v 1.2 1999/12/15 14:49:04 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: Em3RunAction.cc,v 1.5 2000/12/07 12:38:25 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: Em3RunAction.cc,v 1.8 2001/03/26 16:01:58 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -26,14 +26,22 @@
#include "Randomize.hh"
#include "g4std/iomanip"
#ifndef G4NOHIST
#include "CLHEP/Hist/HBookFile.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em3RunAction::Em3RunAction(Em3DetectorConstruction* det)
:Detector(det)
{
bookHisto();
runMessenger = new Em3RunActionMessenger(this);
saveRndm = 1;
saveRndm = 1;
#ifndef G4NOHIST
// init hbook
hbookManager = new HBookFile("TestEm3.paw", 68);
for (G4int k=0; k<MaxAbsor; k++) histo[k] = NULL;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -41,15 +49,18 @@ Em3RunAction::Em3RunAction(Em3DetectorConstruction* det)
Em3RunAction::~Em3RunAction()
{
delete runMessenger;
#ifndef G4NOHIST
// Write histogram file
hbookManager->write();
// Delete HBOOK stuff
delete [] histo;
delete hbookManager;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3RunAction::bookHisto()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
@@ -71,11 +82,52 @@ void Em3RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
}
//histograms
//
bookHisto();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3RunAction::bookHisto()
{
#ifndef G4NOHIST
// book histograms
char str[25];
strcpy(str,"Edep/Ebeam in absorber ");
G4int nbins=100; G4double vmin=0., vmax=1.;
G4int NbOfAbsor = Detector->GetNbOfAbsor();
for (G4int k=0; k<NbOfAbsor; k++)
{
str[23] = (char)((int)('0') + k);
if (histo[k]==NULL)
{ histo[k] = hbookManager->histogram(str,nbins,vmin,vmax);
G4cout << "bookHisto: " << k << " " << histo[k] << G4endl;
}
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3RunAction::SetHisto(G4int idh, G4int nbins, G4double vmin, G4double vmax)
{
#ifndef G4NOHIST
// (re)book histograms
char str[25];
strcpy(str,"Edep/Ebeam in absorber ");
str[23] = (char)((int)('0') + idh);
/// if (histo[idh] != NULL) delete histo[idh];
histo[idh] = hbookManager->histogram(str,nbins,vmin,vmax);
G4cout << "SetHisto: " << idh << " " << histo[idh] << G4endl;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3RunAction::EndOfRunAction(const G4Run* aRun)
{
if (G4VVisManager::GetConcreteInstance())
@@ -118,9 +170,9 @@ void Em3RunAction::EndOfRunAction(const G4Run* aRun)
G4cout << G4endl;
G4cout.setf(oldform,G4std::ios::floatfield);
G4cout.precision(oldprec);
// save Rndm status
if (saveRndm == 1)
if (saveRndm > 0)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("endOfRun.rndm");
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: Em3RunActionMessenger.cc,v 1.3 2000/01/21 09:11:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: Em3RunActionMessenger.cc,v 1.5 2001/03/26 16:01:59 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -19,6 +19,8 @@
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
@@ -35,8 +37,8 @@ Em3RunActionMessenger::Em3RunActionMessenger(Em3RunAction* run)
RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
RndmSaveCmd->SetGuidance("freq = 0 not saved");
RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
RndmSaveCmd->SetGuidance("freq > 0 saved on: endOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 2 saved on: beginOfEvent.rndm");
RndmSaveCmd->SetParameterName("frequency",false);
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
RndmSaveCmd->AvailableForStates(PreInit,Idle);
@@ -45,14 +47,42 @@ Em3RunActionMessenger::Em3RunActionMessenger(Em3RunAction* run)
RndmReadCmd->SetGuidance("get rndm status from an external file.");
RndmReadCmd->SetParameterName("fileName",true);
RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
RndmReadCmd->AvailableForStates(PreInit,Idle);
RndmReadCmd->AvailableForStates(PreInit,Idle);
HistoCmd = new G4UIcommand("/run/setHisto",this);
HistoCmd->SetGuidance("Set histo Edep/Ebeam in absorber k");
HistoCmd->SetGuidance(" histo=absor number : from 0 to NbOfAbsor-1");
HistoCmd->SetGuidance(" number of bins; Emin/Ebeam; Emax/Ebeam");
//
G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
AbsNbPrm->SetGuidance("histo=absor number : from 0 to NbOfAbsor-1");
AbsNbPrm->SetParameterRange("AbsorNb>=0");
HistoCmd->SetParameter(AbsNbPrm);
//
G4UIparameter* NbinPrm = new G4UIparameter("Nbin",'i',false);
NbinPrm->SetGuidance("number of bins");
NbinPrm->SetParameterRange("Nbin>=0");
HistoCmd->SetParameter(NbinPrm);
//
G4UIparameter* VminPrm = new G4UIparameter("Vmin",'d',false);
VminPrm->SetGuidance("Vmin=Emin/Ebeam");
VminPrm->SetParameterRange("Vmin>=0.&&Vmin<=1.");
HistoCmd->SetParameter(VminPrm);
//
G4UIparameter* VmaxPrm = new G4UIparameter("Vmax",'d',false);
VmaxPrm->SetGuidance("Vmax=Emax/Ebeam");
VmaxPrm->SetParameterRange("Vmax>=0.&&Vmax<=1.");
HistoCmd->SetParameter(VmaxPrm);
//
HistoCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em3RunActionMessenger::~Em3RunActionMessenger()
{
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
delete HistoCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -66,7 +96,15 @@ void Em3RunActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{ G4cout << "\n---> rndm status restored from file: " << newValue << G4endl;
HepRandom::restoreEngineStatus(newValue);
HepRandom::showEngineStatus();
}
}
if (command == HistoCmd)
{ G4int idh,nbins; G4double vmin,vmax;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> idh >> nbins >> vmin >> vmax;
Em3Run->SetHisto (idh,nbins,vmin,vmax);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: Em3SteppingAction.cc,v 1.2 1999/12/15 14:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: Em3SteppingAction.cc,v 1.3 2001/02/20 12:34:44 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -14,6 +14,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em3SteppingAction.hh"
#include "G4Step.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -28,8 +29,36 @@ Em3SteppingAction::~Em3SteppingAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em3SteppingAction::UserSteppingAction(const G4Step* aStep)
{ }
{
//// G4double destep = aStep->GetTotalEnergyDeposit();
//// G4double response = BirkAttenuation(aStep);
//// G4cout << " Destep: " << destep/keV << " keV"
//// << " response after Birk: " << response/keV << " keV" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double Em3SteppingAction::BirkAttenuation(const G4Step* aStep)
{
//Example of Birk attenuation law in organic scintillators.
//adapted from Geant3 PHYS337. See MIN 80 (1970) 239-244
//
const G4String myMaterial = "Scintillator";
const G4double birk1 = 0.013*g/(MeV*cm2);
//
G4double destep = aStep->GetTotalEnergyDeposit();
G4Material* material = aStep->GetTrack()->GetMaterial();
G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
//
G4double response = destep;
if ((material->GetName()==myMaterial)&&(charge!=0.))
{
G4double correction =
birk1*destep/((material->GetDensity())*(aStep->GetStepLength()));
response = destep/(1. + correction);
}
return response;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: Em3SteppingVerbose.cc,v 1.4 2000/12/06 16:43:39 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: Em3SteppingVerbose.cc,v 1.6 2001/02/19 14:07:37 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -46,7 +46,7 @@ void Em3SteppingVerbose::StepInfo()
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Volume" << " "
<< G4std::setw(10) << "Process" << G4endl;
}
@@ -61,16 +61,17 @@ void Em3SteppingVerbose::StepInfo()
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName();
G4cout << G4std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << G4std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << G4std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
G4cout << " "
<< G4std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
G4cout << " UserLimit";
}
G4cout << G4endl;
@@ -86,12 +87,12 @@ void Em3SteppingVerbose::StepInfo()
<< ",Along=" << G4std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << G4std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).entries()
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(G4int lp1=(*fSecondary).entries()-tN2ndariesTot;
lp1<(*fSecondary).entries(); lp1++){
for(G4int lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< G4std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
@@ -115,8 +116,8 @@ void Em3SteppingVerbose::StepInfo()
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void Em3SteppingVerbose::TrackingStarted()
@@ -134,7 +135,7 @@ G4int prec = G4cout.precision(3);
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Volume" << " "
<< G4std::setw(10) << "Process" << G4endl;
G4cout << G4std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
@@ -147,13 +148,13 @@ G4int prec = G4cout.precision(3);
<< G4std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
G4cout << G4std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << G4std::setw(10) << "OutOfWorld" << " ";
G4cout << G4std::setw(10) << "OutOfWorld";
}
G4cout << G4std::setw(10) << "initStep" << G4endl;
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Em3VisManager.cc,v 1.2 1999/12/15 14:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// John Allison 24th January 1998.