Import Geant4 8.3.0 source tree
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.18 2006/10/31 12:53:48 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: DetectorConstruction.cc,v 1.20 2007/03/19 20:10:38 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include <iomanip>
|
||||
|
||||
@@ -163,6 +164,12 @@ void DetectorConstruction::DefineMaterials()
|
||||
Sci->AddElement(C, natoms=9);
|
||||
Sci->AddElement(H, natoms=10);
|
||||
|
||||
G4Material* Lct =
|
||||
new G4Material("Lucite", density= 1.185*g/cm3, ncomponents=3);
|
||||
Lct->AddElement(C, 59.97*perCent);
|
||||
Lct->AddElement(H, 8.07*perCent);
|
||||
Lct->AddElement(O, 31.96*perCent);
|
||||
|
||||
G4Material* Sili =
|
||||
new G4Material("Silicon", density= 2.330*g/cm3, ncomponents=1);
|
||||
Sili->AddElement(Si, natoms=1);
|
||||
@@ -266,7 +273,8 @@ void DetectorConstruction::ComputeCalorParameters()
|
||||
LayerThickness += AbsorThickness[iAbs];
|
||||
}
|
||||
CalorThickness = NbOfLayers*LayerThickness;
|
||||
WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ;
|
||||
WorldSizeX = 1.2*CalorThickness;
|
||||
WorldSizeYZ = 1.2*CalorSizeYZ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.14 2006/06/29 16:52:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: EventAction.cc,v 1.15 2007/04/22 16:25:21 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysListEmStandard.cc,v 1.12 2006/06/29 16:52:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: PhysListEmStandard.cc,v 1.13 2007/04/24 13:05:14 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4ionIonisation.hh"
|
||||
#include "G4EmProcessOptions.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -114,6 +115,8 @@ void PhysListEmStandard::ConstructProcess()
|
||||
pmanager->AddProcess(new G4hIonisation, -1,2,2);
|
||||
}
|
||||
}
|
||||
G4EmProcessOptions opt;
|
||||
opt.SetSkin(1.0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsList.cc,v 1.16 2006/11/22 19:16:09 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: PhysicsList.cc,v 1.18 2007/04/06 17:41:54 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
#include "G4EmStandardPhysics71.hh"
|
||||
#include "G4EmStandardPhysics72.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
@@ -229,13 +230,19 @@ void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new G4EmStandardPhysics71(name);
|
||||
|
||||
} else if (name == "Livermore") {
|
||||
} else if (name == "G4standard_exp") {
|
||||
|
||||
emName = name;
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new G4EmStandardPhysics72(name);
|
||||
|
||||
} else if (name == "livermore") {
|
||||
|
||||
emName = name;
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new PhysListEmLivermore(name);
|
||||
|
||||
} else if (name == "Penelope") {
|
||||
} else if (name == "penelope") {
|
||||
|
||||
emName = name;
|
||||
delete emPhysicsList;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.29 2006/06/29 16:53:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: RunAction.cc,v 1.34 2007/04/24 13:05:14 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -49,6 +49,7 @@ RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
|
||||
:Detector(det), Primary(prim), histoManager(hist)
|
||||
{
|
||||
runMessenger = new RunActionMessenger(this);
|
||||
applyLimit = false;
|
||||
|
||||
for (G4int k=0; k<MaxAbsor; k++) { edeptrue[k] = rmstrue[k] = 1.;
|
||||
limittrue[k] = DBL_MAX;
|
||||
@@ -76,9 +77,10 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
//initialize cumulative quantities
|
||||
//
|
||||
for (G4int k=0; k<MaxAbsor; k++) {
|
||||
sumEAbs[k] = sum2EAbs[k] = sumLAbs[k] = sum2LAbs[k] = 0.;
|
||||
sumEAbs[k] = sum2EAbs[k] = sumLAbs[k] = sum2LAbs[k] = 0.;
|
||||
energyDeposit[k].clear();
|
||||
}
|
||||
|
||||
|
||||
//initialize Eflow
|
||||
//
|
||||
G4int nbPlanes = (Detector->GetNbOfLayers())*(Detector->GetNbOfAbsor()) + 2;
|
||||
@@ -99,8 +101,9 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
|
||||
void RunAction::fillPerEvent(G4int kAbs, G4double EAbs, G4double LAbs)
|
||||
{
|
||||
//accumulate statistic
|
||||
//accumulate statistic with restriction
|
||||
//
|
||||
if(applyLimit) energyDeposit[kAbs].push_back(EAbs);
|
||||
sumEAbs[kAbs] += EAbs; sum2EAbs[kAbs] += EAbs*EAbs;
|
||||
sumLAbs[kAbs] += LAbs; sum2LAbs[kAbs] += LAbs*LAbs;
|
||||
}
|
||||
@@ -110,11 +113,13 @@ void RunAction::fillPerEvent(G4int kAbs, G4double EAbs, G4double LAbs)
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int nEvt = aRun->GetNumberOfEvent();
|
||||
G4double norm = G4double(nEvt);
|
||||
if(norm > 0) norm = 1./norm;
|
||||
G4double qnorm = std::sqrt(norm);
|
||||
|
||||
//compute and print statistic
|
||||
//
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
G4double norm = 1.0/NbOfEvents;
|
||||
G4double qnorm = std::sqrt(norm);
|
||||
G4double beamEnergy = Primary->GetParticleGun()->GetParticleEnergy();
|
||||
G4double sqbeam = std::sqrt(beamEnergy/GeV);
|
||||
|
||||
@@ -124,27 +129,53 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
std::ios::fmtflags mode = G4cout.flags();
|
||||
G4int prec = G4cout.precision(2);
|
||||
G4cout << "\n------------------------------------------------------------\n";
|
||||
G4cout << std::setw( 8) << "material"
|
||||
<< std::setw(23) << "Total Edep"
|
||||
<< std::setw(27) << "sqrt(E0(GeV))*rmsE/Emean"
|
||||
G4cout << std::setw(14) << "material"
|
||||
<< std::setw(17) << "Total Edep"
|
||||
<< std::setw(33) << "sqrt(E0(GeV))*rmsE/Emean"
|
||||
<< std::setw(23) << "total tracklen \n \n";
|
||||
|
||||
for (G4int k=1; k<=Detector->GetNbOfAbsor(); k++)
|
||||
{
|
||||
MeanEAbs = sumEAbs[k]*norm;
|
||||
MeanEAbs2 = sum2EAbs[k]*norm;
|
||||
MeanEAbs = sumEAbs[k]*norm;
|
||||
MeanEAbs2 = sum2EAbs[k]*norm;
|
||||
rmsEAbs = std::sqrt(std::fabs(MeanEAbs2 - MeanEAbs*MeanEAbs));
|
||||
resolution= 100.*sqbeam*rmsEAbs/MeanEAbs;
|
||||
rmsres = resolution*qnorm;
|
||||
|
||||
MeanLAbs = sumLAbs[k]*norm;
|
||||
MeanLAbs2 = sum2LAbs[k]*norm;
|
||||
if(applyLimit) {
|
||||
G4int nn = 0;
|
||||
G4double sume = 0.0;
|
||||
G4double sume2 = 0.0;
|
||||
// compute trancated means
|
||||
G4double lim = rmsEAbs * 2.5;
|
||||
for(G4int i=0; i<nEvt; i++) {
|
||||
G4double e = (energyDeposit[k])[i];
|
||||
if(std::abs(e - MeanEAbs) < lim) {
|
||||
sume += e;
|
||||
sume2 += e*e;
|
||||
nn++;
|
||||
}
|
||||
}
|
||||
G4double norm1 = G4double(nn);
|
||||
if(norm1 > 0.0) norm1 = 1.0/norm1;
|
||||
MeanEAbs = sume*norm1;
|
||||
MeanEAbs2 = sume2*norm1;
|
||||
rmsEAbs = std::sqrt(std::fabs(MeanEAbs2 - MeanEAbs*MeanEAbs));
|
||||
}
|
||||
|
||||
resolution= 100.*sqbeam*rmsEAbs/MeanEAbs;
|
||||
rmsres = resolution*qnorm;
|
||||
|
||||
// Save mean and RMS
|
||||
sumEAbs[k] = MeanEAbs;
|
||||
sum2EAbs[k] = rmsEAbs;
|
||||
|
||||
MeanLAbs = sumLAbs[k]*norm;
|
||||
MeanLAbs2 = sum2LAbs[k]*norm;
|
||||
rmsLAbs = std::sqrt(std::fabs(MeanLAbs2 - MeanLAbs*MeanLAbs));
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< std::setw(10) << Detector->GetAbsorMaterial(k)->GetName() << ": "
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< std::setw(14) << Detector->GetAbsorMaterial(k)->GetName() << ": "
|
||||
<< std::setprecision(5)
|
||||
<< std::setw(6) << G4BestUnit(MeanEAbs,"Energy") << " +- "
|
||||
<< std::setprecision(4)
|
||||
@@ -153,7 +184,7 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
<< std::setw(5) << rmsres << " %"
|
||||
<< std::setprecision(3)
|
||||
<< std::setw(10) << G4BestUnit(MeanLAbs,"Length") << " +- "
|
||||
<< std::setw(4) << G4BestUnit( rmsLAbs,"Length")
|
||||
<< std::setw(4) << G4BestUnit( rmsLAbs,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
G4cout << "\n------------------------------------------------------------\n";
|
||||
@@ -199,16 +230,15 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
for (G4int j=1; j<=Detector->GetNbOfAbsor(); j++) {
|
||||
if (limittrue[j] < DBL_MAX) {
|
||||
if (!isStarted) {
|
||||
acc.BeginOfAcceptance("Sampling Calorimeter",NbOfEvents);
|
||||
acc.BeginOfAcceptance("Sampling Calorimeter",nEvt);
|
||||
isStarted = true;
|
||||
}
|
||||
MeanEAbs = sumEAbs[j]*norm;
|
||||
MeanEAbs2 = sum2EAbs[j]*norm;
|
||||
rmsEAbs = std::sqrt(std::fabs(MeanEAbs2 - MeanEAbs*MeanEAbs));
|
||||
MeanEAbs = sumEAbs[j];
|
||||
rmsEAbs = sum2EAbs[j];
|
||||
G4String mat = Detector->GetAbsorMaterial(j)->GetName();
|
||||
acc.EmAcceptanceGauss("Edep"+mat, NbOfEvents, MeanEAbs,
|
||||
acc.EmAcceptanceGauss("Edep"+mat, nEvt, MeanEAbs,
|
||||
edeptrue[j], rmstrue[j], limittrue[j]);
|
||||
acc.EmAcceptanceGauss("Erms"+mat, NbOfEvents, rmsEAbs,
|
||||
acc.EmAcceptanceGauss("Erms"+mat, nEvt, rmsEAbs,
|
||||
rmstrue[j], rmstrue[j], 2.0*limittrue[j]);
|
||||
}
|
||||
}
|
||||
@@ -216,9 +246,8 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
|
||||
//normalize histograms
|
||||
//
|
||||
G4double fac = 1./NbOfEvents;
|
||||
for (G4int ih = MaxAbsor+1; ih < MaxHisto; ih++) {
|
||||
histoManager->Normalize(ih,fac/MeV);
|
||||
histoManager->Normalize(ih,norm/MeV);
|
||||
}
|
||||
|
||||
//save histograms
|
||||
@@ -328,12 +357,12 @@ void RunAction::PrintDedxTables()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::SetEdepAndRMS(G4int i, G4ThreeVector Value)
|
||||
void RunAction::SetEdepAndRMS(G4int i, G4double edep, G4double rms, G4double lim)
|
||||
{
|
||||
if (i>=0 && i<MaxAbsor) {
|
||||
edeptrue [i] = Value(0);
|
||||
rmstrue [i] = Value(1);
|
||||
limittrue[i] = Value(2);
|
||||
edeptrue [i] = edep;
|
||||
rmstrue [i] = rms;
|
||||
limittrue[i] = lim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunActionMessenger.cc,v 1.9 2006/06/29 16:53:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: RunActionMessenger.cc,v 1.13 2007/04/25 10:07:27 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -33,7 +33,11 @@
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWith3Vector.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -41,41 +45,60 @@ RunActionMessenger::RunActionMessenger(RunAction* run)
|
||||
:Run(run)
|
||||
{
|
||||
runDir = new G4UIdirectory("/testem/run/");
|
||||
runDir->SetGuidance("run control");
|
||||
runDir->SetGuidance("run commands");
|
||||
|
||||
accCmd1 = new G4UIcmdWith3Vector("/testem/run/acceptanceL1",this);
|
||||
accCmd1->SetGuidance("set Edep and RMS");
|
||||
accCmd1->SetGuidance("acceptance values for first layer");
|
||||
accCmd1->SetParameterName("edep","rms","limit",true);
|
||||
accCmd1->SetRange("edep>0 && edep<1 && rms>0");
|
||||
accCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
accCmd2 = new G4UIcmdWith3Vector("/testem/run/acceptanceL2",this);
|
||||
accCmd2->SetGuidance("set Edep and RMS");
|
||||
accCmd2->SetGuidance("acceptance values for 2nd layer");
|
||||
accCmd2->SetParameterName("edep","rms","limit",true);
|
||||
accCmd2->SetRange("edep>0 && edep<1 && rms>0");
|
||||
accCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
accCmd = new G4UIcommand("/testem/run/acceptance",this);
|
||||
accCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
|
||||
//
|
||||
G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
|
||||
AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
|
||||
AbsNbPrm->SetParameterRange("AbsorNb>0");
|
||||
accCmd->SetParameter(AbsNbPrm);
|
||||
//
|
||||
G4UIparameter* edep = new G4UIparameter("Edep",'d',false);
|
||||
edep->SetGuidance("mean energy deposition (MeV)");
|
||||
edep->SetParameterRange("Edep>=0.");
|
||||
accCmd->SetParameter(edep);
|
||||
//
|
||||
G4UIparameter* rms = new G4UIparameter("RMS",'d',false);
|
||||
rms->SetGuidance("RMS of energy deposition (MeV)");
|
||||
rms->SetParameterRange("RMS>=0.");
|
||||
accCmd->SetParameter(rms);
|
||||
//
|
||||
G4UIparameter* lim = new G4UIparameter("nRMS",'d',false);
|
||||
lim->SetGuidance("Limit in number of RMS of energy deposition");
|
||||
lim->SetParameterRange("Limit>=0.");
|
||||
accCmd->SetParameter(lim);
|
||||
//
|
||||
limCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this);
|
||||
limCmd->SetGuidance("remove energy outside acceptance limit");
|
||||
limCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunActionMessenger::~RunActionMessenger()
|
||||
{
|
||||
delete accCmd1;
|
||||
delete accCmd2;
|
||||
delete accCmd;
|
||||
delete runDir;
|
||||
delete limCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == accCmd1 )
|
||||
{ Run->SetEdepAndRMS(1,accCmd1->GetNew3VectorValue(newValue));}
|
||||
if( command == accCmd )
|
||||
{
|
||||
G4int num;
|
||||
G4double edep, rms, lim;
|
||||
std::istringstream is(newValue);
|
||||
is >> num >> edep >> rms >> lim;
|
||||
Run->SetEdepAndRMS(num,edep,rms,lim);
|
||||
}
|
||||
|
||||
if( command == accCmd2 )
|
||||
{ Run->SetEdepAndRMS(2,accCmd2->GetNew3VectorValue(newValue));}
|
||||
if( command == limCmd )
|
||||
{ Run->SetApplyLimit(limCmd->GetNewBoolValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user