Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.7 2004/01/21 17:29:27 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: DetectorConstruction.cc,v 1.11 2004/06/09 14:18:47 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -54,12 +54,6 @@ DetectorConstruction::DetectorConstruction()
|
||||
solidLayer(0),logicLayer(0),physiLayer(0),
|
||||
magField(0)
|
||||
{
|
||||
for (G4int i=0; i<MaxAbsor; i++)
|
||||
{
|
||||
AbsorMaterial[i]=0; AbsorThickness[i]=0.;
|
||||
solidAbsor[i]=0;logicAbsor[i]=0;physiAbsor[i]=0;
|
||||
}
|
||||
//
|
||||
// default parameter values of the calorimeter
|
||||
NbOfAbsor = 2;
|
||||
AbsorThickness[0] = 2.3*mm;
|
||||
@@ -67,13 +61,13 @@ DetectorConstruction::DetectorConstruction()
|
||||
NbOfLayers = 50;
|
||||
CalorSizeYZ = 40.*cm;
|
||||
ComputeCalorParameters();
|
||||
|
||||
|
||||
// materials
|
||||
DefineMaterials();
|
||||
SetWorldMaterial("Galactic");
|
||||
SetAbsorMaterial(0,"Lead");
|
||||
SetAbsorMaterial(1,"liquidArgon");
|
||||
|
||||
SetAbsorMaterial(1,"liquidArgon");
|
||||
|
||||
// create UserLimits
|
||||
userLimits = new G4UserLimits();
|
||||
|
||||
@@ -106,7 +100,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
// define Elements
|
||||
//
|
||||
G4double z,a;
|
||||
|
||||
|
||||
G4Element* H = new G4Element("Hydrogen", "H" , z= 1., a= 1.008*g/mole);
|
||||
G4Element* C = new G4Element("Carbon", "C" , z= 6., a= 12.01*g/mole);
|
||||
G4Element* N = new G4Element("Nitrogen", "N" , z= 7., a= 14.01*g/mole);
|
||||
@@ -136,7 +130,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
// define simple materials
|
||||
//
|
||||
G4double density;
|
||||
|
||||
|
||||
new G4Material("liquidH2", z=1., a= 1.008*g/mole, density= 70.8*mg/cm3);
|
||||
new G4Material("Aluminium", z=13., a= 26.98*g/mole, density= 2.700*g/cm3);
|
||||
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
|
||||
@@ -152,7 +146,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
// define a material from elements. case 1: chemical molecule
|
||||
//
|
||||
G4int natoms;
|
||||
|
||||
|
||||
G4Material* H2O =
|
||||
new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
|
||||
H2O->AddElement(H, natoms=2);
|
||||
@@ -522,6 +516,7 @@ void DetectorConstruction::SetMaxStepSize(G4double val)
|
||||
userLimits->SetMaxAllowedStep(val);
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.cc,v 1.1 2003/09/22 14:06:16 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: DetectorMessenger.cc,v 1.5 2004/06/09 14:18:47 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -122,7 +120,7 @@ DetectorMessenger::~DetectorMessenger()
|
||||
delete SizeYZCmd;
|
||||
delete NbLayersCmd;
|
||||
delete NbAbsorCmd;
|
||||
delete AbsorCmd;
|
||||
delete AbsorCmd;
|
||||
delete MagFieldCmd;
|
||||
delete UpdateCmd;
|
||||
delete MaxStepCmd;
|
||||
@@ -132,13 +130,13 @@ DetectorMessenger::~DetectorMessenger()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
{
|
||||
if( command == SizeYZCmd )
|
||||
{ Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
|
||||
if( command == NbLayersCmd )
|
||||
{ Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
|
||||
|
||||
|
||||
if( command == NbAbsorCmd )
|
||||
{ Detector->SetNbOfAbsor(NbAbsorCmd->GetNewIntValue(newValue));}
|
||||
|
||||
@@ -154,7 +152,7 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
Detector->SetAbsorMaterial (num,material);
|
||||
Detector->SetAbsorThickness(num,tick);
|
||||
}
|
||||
|
||||
|
||||
if( command == MagFieldCmd )
|
||||
{ Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
|
||||
+35
-30
@@ -21,52 +21,57 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: PhysListGeneral.cc,v 1.2 2003/10/06 10:09:25 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: EmAcceptance.cc,v 1.3 2004/06/20 01:32:20 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysListGeneral.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Decay.hh"
|
||||
#include "EmAcceptance.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListGeneral::PhysListGeneral(const G4String& name)
|
||||
: G4VPhysicsConstructor(name)
|
||||
EmAcceptance::EmAcceptance()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListGeneral::~PhysListGeneral()
|
||||
EmAcceptance::~EmAcceptance()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysListGeneral::ConstructProcess()
|
||||
void EmAcceptance::BeginOfAcceptance(const G4String& title, G4int stat)
|
||||
{
|
||||
// Add Decay Process
|
||||
|
||||
G4Decay* fDecayProcess = new G4Decay();
|
||||
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
if (fDecayProcess->IsApplicable(*particle)) {
|
||||
|
||||
pmanager ->AddProcess(fDecayProcess);
|
||||
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
|
||||
|
||||
}
|
||||
}
|
||||
G4cout << "\n<<<<<ACCEPTANCE>>>>> " << stat << " events for " << title
|
||||
<< G4endl;
|
||||
isAccepted = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EmAcceptance::EndOfAcceptance()
|
||||
{
|
||||
G4String resume = "IS ACCEPTED";
|
||||
if (!isAccepted) resume = "IS NOT ACCEPTED";
|
||||
G4cout << "<<<<<END>>>>> " << resume << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EmAcceptance::EmAcceptanceGauss(const G4String& title, G4int stat,
|
||||
G4double avr, G4double avr0,
|
||||
G4double rms, G4double limit)
|
||||
{
|
||||
G4double x = sqrt((G4double)stat);
|
||||
G4double dde = avr - avr0;
|
||||
G4double de = dde*x/rms;
|
||||
|
||||
G4cout << title << ": " << avr << " del"<< title << "= " << dde
|
||||
<< " nrms= " << de << G4endl;
|
||||
|
||||
if (abs(de) > limit) isAccepted = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -20,12 +20,9 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.8 2004/06/21 10:52:55 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.4 2004/01/21 17:29:27 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -33,21 +30,25 @@
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "EventActionMessenger.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#ifdef USE_AIDA
|
||||
#include "AIDA/IHistogram1D.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(DetectorConstruction* det, RunAction* run)
|
||||
:detector(det),runAct(run),drawFlag("none"),printModulo(10000),eventMessenger(0)
|
||||
EventAction::EventAction(DetectorConstruction* det, RunAction* run,
|
||||
HistoManager* hist)
|
||||
:detector(det), runAct(run), histoManager(hist)
|
||||
{
|
||||
drawFlag = "none";
|
||||
printModulo = 10000;
|
||||
eventMessenger = new EventActionMessenger(this);
|
||||
}
|
||||
|
||||
@@ -69,15 +70,9 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
G4cout << "\n---> Begin Of Event: " << evtNb << G4endl;
|
||||
|
||||
//initialize EnergyDeposit per event
|
||||
size_t n = detector->GetNbOfAbsor();
|
||||
energyDeposit.resize(n);
|
||||
energyLeaving.resize(n);
|
||||
trackLengthCh.resize(n);
|
||||
for (size_t k=0; k<n; k++) {
|
||||
energyDeposit[k] = 0.0;
|
||||
energyLeaving[k] = 0.0;
|
||||
trackLengthCh[k] = 0.0;
|
||||
}
|
||||
//
|
||||
for (G4int k=0; k<MaxAbsor; k++)
|
||||
energyDeposit[k] = energyLeaving[k] = trackLengthCh[k] = 0.0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -86,11 +81,12 @@ void EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
for (G4int k=0; k<detector->GetNbOfAbsor(); k++) {
|
||||
runAct->fillPerEvent(k,energyDeposit[k],trackLengthCh[k],
|
||||
energyLeaving[k]/(G4double)(detector->GetNbOfLayers()));
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (runAct->GetHisto(k)) {
|
||||
G4double unit = runAct->GetHistoUnit(k);
|
||||
runAct->GetHisto(k)->fill(energyDeposit[k]/unit);
|
||||
energyLeaving[k]/(G4double)(detector->GetNbOfLayers()));
|
||||
|
||||
#ifdef USE_AIDA
|
||||
if (histoManager->GetHisto(k)) {
|
||||
G4double unit = histoManager->GetHistoUnit(k);
|
||||
histoManager->GetHisto(k)->fill(energyDeposit[k]/unit);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: HistoManager.cc,v 1.2 2004/06/21 10:52:55 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "HistoMessenger.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#ifdef USE_AIDA
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
{
|
||||
fileName = "testem3.paw";
|
||||
factoryOn = false;
|
||||
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) { histo[k] = 0; exist[k] = false;}
|
||||
|
||||
histoMessenger = new HistoMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
SaveFactory();
|
||||
delete histoMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SetFactory()
|
||||
{
|
||||
if (factoryOn) {
|
||||
G4cout << "\n--->HistoManager::SetFactory(): factory already exists"
|
||||
<< G4endl;
|
||||
SaveFactory();
|
||||
}
|
||||
|
||||
#ifdef USE_AIDA
|
||||
// Creating the analysis factory
|
||||
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
|
||||
|
||||
// Creating the tree factory
|
||||
AIDA::ITreeFactory* tf = af->createTreeFactory();
|
||||
|
||||
// Creating a tree mapped to an hbook file.
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
tree = tf->create(fileName, "hbook", readOnly, createNew);
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
hf = af->createHistogramFactory(*tree);
|
||||
|
||||
// create selected histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) {
|
||||
if (exist[k]) histo[k] = hf->createHistogram1D( Label[k], Title[k],
|
||||
Nbins[k], Vmin[k], Vmax[k]);
|
||||
else histo[k] = 0;
|
||||
}
|
||||
delete tf;
|
||||
delete af;
|
||||
#endif //USE_AIDA
|
||||
|
||||
factoryOn = true;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SaveFactory()
|
||||
{
|
||||
if (factoryOn) {
|
||||
|
||||
#ifdef USE_AIDA
|
||||
tree->commit(); // Writing the histograms to the file
|
||||
tree->close(); // and closing the tree (and the file)
|
||||
G4cout << "---> Histograms are saved" << G4endl;
|
||||
delete hf;
|
||||
delete tree;
|
||||
#endif //USE_AIDA
|
||||
|
||||
factoryOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SetHisto(G4int ih,
|
||||
G4int nbins, G4double valmin, G4double valmax, G4String unit)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
|
||||
<< "does not exist" << G4endl;
|
||||
return;
|
||||
}
|
||||
const G4String id[] = {"0","1","2","3","4","5","6","7","8""9","10"};
|
||||
G4String title = "Edep in absorber " + id[ih] + " (" + unit + ")";
|
||||
G4double valunit = G4UnitDefinition::GetValueOf(unit);
|
||||
|
||||
exist[ih] = true;
|
||||
Label[ih] = id[ih+1];
|
||||
Title[ih] = title;
|
||||
Nbins[ih] = nbins;
|
||||
Vmin[ih] = valmin/valunit;
|
||||
Vmax[ih] = valmax/valunit;
|
||||
Width[ih] = (valmax-valmin)/nbins;
|
||||
Unit[ih] = valunit;
|
||||
|
||||
G4cout << "----> SetHisto " << ih << ": " << title << "; "
|
||||
<< nbins << " bins from "
|
||||
<< valmin << " " << unit << " to " << valmax << " " << unit << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::RemoveHisto(G4int ih)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
|
||||
<< "does not exist" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
histo[ih] = 0; exist[ih] = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif //G4ANALYSIS_USE
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: HistoMessenger.cc,v 1.2 2004/06/16 10:35:43 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#include "HistoMessenger.hh"
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoMessenger::HistoMessenger(HistoManager* manager)
|
||||
:histoManager (manager)
|
||||
{
|
||||
histoDir = new G4UIdirectory("/testem/histo/");
|
||||
histoDir->SetGuidance("histograms control");
|
||||
|
||||
factoryCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
|
||||
factoryCmd->SetGuidance("set name for the histograms file");
|
||||
|
||||
histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
|
||||
histoCmd->SetGuidance("Set bining of the histo number ih :");
|
||||
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
|
||||
//
|
||||
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
|
||||
ih->SetGuidance("histo number : from 1 to MaxHisto");
|
||||
ih->SetParameterRange("ih>=0");
|
||||
histoCmd->SetParameter(ih);
|
||||
//
|
||||
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
|
||||
nbBins->SetGuidance("number of bins");
|
||||
nbBins->SetParameterRange("nbBins>0");
|
||||
histoCmd->SetParameter(nbBins);
|
||||
//
|
||||
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
|
||||
valMin->SetGuidance("valMin, expressed in unit");
|
||||
histoCmd->SetParameter(valMin);
|
||||
//
|
||||
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
|
||||
valMax->SetGuidance("valMax, expressed in unit");
|
||||
histoCmd->SetParameter(valMax);
|
||||
//
|
||||
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
|
||||
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
|
||||
unit->SetDefaultValue("none");
|
||||
histoCmd->SetParameter(unit);
|
||||
|
||||
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
|
||||
rmhistoCmd->SetGuidance("desactivate histo #id");
|
||||
rmhistoCmd->SetParameterName("id",false);
|
||||
rmhistoCmd->SetRange("id>=0");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoMessenger::~HistoMessenger()
|
||||
{
|
||||
delete rmhistoCmd;
|
||||
delete histoCmd;
|
||||
delete factoryCmd;
|
||||
delete histoDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if (command == factoryCmd)
|
||||
histoManager->SetFileName(newValues);
|
||||
|
||||
if (command == histoCmd)
|
||||
{ G4int ih,nbBins; G4double vmin,vmax; char unts[30];
|
||||
const char* t = newValues;
|
||||
std::istrstream is((char*)t);
|
||||
is >> ih >> nbBins >> vmin >> vmax >> unts;
|
||||
G4String unit = unts;
|
||||
G4double vUnit = 1. ;
|
||||
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
|
||||
histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
|
||||
}
|
||||
|
||||
if (command == rmhistoCmd)
|
||||
{ histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: PhysListEmG4v52.cc,v 1.1 2003/10/06 10:09:24 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: PhysListEmG4v52.cc,v 1.2 2004/03/24 18:25:31 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -108,7 +108,7 @@ void PhysListEmG4v52::ConstructProcess()
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4MultipleScattering52,-1,1,1);
|
||||
pmanager->AddProcess(new G4hIonisation52, -1,2,2);
|
||||
pmanager->AddProcess(new G4hIonisation52, -1,2,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: PhysListEmStandard.cc,v 1.3 2003/10/24 12:12:12 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: PhysListEmStandard.cc,v 1.5 2004/04/28 16:58:49 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysListParticles.cc,v 1.1 2003/09/22 14:06:20 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysListParticles.hh"
|
||||
|
||||
// Bosons
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
|
||||
// leptons
|
||||
#include "G4MuonPlus.hh"
|
||||
#include "G4MuonMinus.hh"
|
||||
#include "G4NeutrinoMu.hh"
|
||||
#include "G4AntiNeutrinoMu.hh"
|
||||
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4AntiNeutrinoE.hh"
|
||||
|
||||
// Mesons
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionZero.hh"
|
||||
#include "G4Eta.hh"
|
||||
#include "G4EtaPrime.hh"
|
||||
|
||||
#include "G4KaonPlus.hh"
|
||||
#include "G4KaonMinus.hh"
|
||||
#include "G4KaonZero.hh"
|
||||
#include "G4AntiKaonZero.hh"
|
||||
#include "G4KaonZeroLong.hh"
|
||||
#include "G4KaonZeroShort.hh"
|
||||
|
||||
// Baryons
|
||||
#include "G4Proton.hh"
|
||||
#include "G4AntiProton.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4AntiNeutron.hh"
|
||||
|
||||
// Nuclei
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4GenericIon.hh"
|
||||
|
||||
#include "IonC12.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListParticles::PhysListParticles(const G4String& name)
|
||||
: G4VPhysicsConstructor(name)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListParticles::~PhysListParticles()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysListParticles::ConstructParticle()
|
||||
{
|
||||
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
|
||||
// ions
|
||||
G4Deuteron::DeuteronDefinition();
|
||||
G4Triton::TritonDefinition();
|
||||
G4He3::He3Definition();
|
||||
G4Alpha::AlphaDefinition();
|
||||
G4GenericIon::GenericIonDefinition();
|
||||
IonC12::IonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -21,19 +21,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
// $Id: PhysicsList.cc,v 1.5 2004/04/28 17:40:48 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
#include "PhysicsListMessenger.hh"
|
||||
|
||||
#include "PhysListParticles.hh"
|
||||
#include "PhysListGeneral.hh"
|
||||
#include "PhysListEmStandard.hh"
|
||||
#include "PhysListEmG4v52.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -49,12 +50,6 @@ PhysicsList::PhysicsList() : G4VModularPhysicsList()
|
||||
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// Particles
|
||||
particleList = new PhysListParticles("particles");
|
||||
|
||||
// General Physics
|
||||
generalPhysicsList = new PhysListGeneral("general");
|
||||
|
||||
// EM physics
|
||||
emName = G4String("standard");
|
||||
emPhysicsList = new PhysListEmStandard(emName);
|
||||
@@ -70,17 +65,134 @@ PhysicsList::~PhysicsList()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Bosons
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
|
||||
// leptons
|
||||
#include "G4MuonPlus.hh"
|
||||
#include "G4MuonMinus.hh"
|
||||
#include "G4NeutrinoMu.hh"
|
||||
#include "G4AntiNeutrinoMu.hh"
|
||||
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4AntiNeutrinoE.hh"
|
||||
|
||||
// Mesons
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionZero.hh"
|
||||
#include "G4Eta.hh"
|
||||
#include "G4EtaPrime.hh"
|
||||
|
||||
#include "G4KaonPlus.hh"
|
||||
#include "G4KaonMinus.hh"
|
||||
#include "G4KaonZero.hh"
|
||||
#include "G4AntiKaonZero.hh"
|
||||
#include "G4KaonZeroLong.hh"
|
||||
#include "G4KaonZeroShort.hh"
|
||||
|
||||
// Baryons
|
||||
#include "G4Proton.hh"
|
||||
#include "G4AntiProton.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4AntiNeutron.hh"
|
||||
|
||||
// Nuclei
|
||||
#include "G4Alpha.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4GenericIon.hh"
|
||||
|
||||
#include "IonC12.hh"
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
particleList->ConstructParticle();
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
|
||||
// ions
|
||||
G4Deuteron::DeuteronDefinition();
|
||||
G4Triton::TritonDefinition();
|
||||
G4He3::He3Definition();
|
||||
G4Alpha::AlphaDefinition();
|
||||
G4GenericIon::GenericIonDefinition();
|
||||
IonC12::IonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
generalPhysicsList->ConstructProcess();
|
||||
|
||||
// Add Decay Process
|
||||
//
|
||||
G4Decay* fDecayProcess = new G4Decay();
|
||||
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
if (fDecayProcess->IsApplicable(*particle)) {
|
||||
|
||||
pmanager ->AddProcess(fDecayProcess);
|
||||
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// electromagnetic Physics List
|
||||
//
|
||||
emPhysicsList->ConstructProcess();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.1 2003/09/22 14:06:20 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.3 2004/04/28 16:58:49 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -20,39 +20,36 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.19 2004/06/16 16:25:12 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.11 2004/01/21 17:29:27 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunActionMessenger.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "EmAcceptance.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include <iomanip>
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(DetectorConstruction* det)
|
||||
:Detector(det)
|
||||
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
|
||||
HistoManager* hist)
|
||||
:Detector(det), Primary(prim), histoManager(hist)
|
||||
{
|
||||
runMessenger = new RunActionMessenger(this);
|
||||
|
||||
fileName = "testem3.paw";
|
||||
for (G4int k=0; k<MaxAbsor; k++) {hbins[k] = 0; histoUnit[k] = 1.;}
|
||||
|
||||
for (G4int k=0; k<MaxAbsor; k++) { edeptrue[k] = rmstrue[k] = 1.;
|
||||
limittrue[k] = DBL_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -64,28 +61,6 @@ RunAction::~RunAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::SetHisto(G4int k,
|
||||
G4int nbins, G4double valmin, G4double valmax, G4String unit)
|
||||
{
|
||||
const G4String id[] = {"0","1","2","3","4","5","6","7","8","9","10"};
|
||||
G4String title = "Edep in absorber " + id[k] + " (" + unit + ")";
|
||||
G4double valunit = G4UnitDefinition::GetValueOf(unit);
|
||||
|
||||
hid[k] = id[k+1];
|
||||
htitle[k] = title;
|
||||
hbins[k] = nbins;
|
||||
hmin[k] = valmin/valunit;
|
||||
hmax[k] = valmax/valunit;
|
||||
histoUnit[k] = valunit;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
G4cout << "---->SetHisto: " << title << " ; " << nbins << " bins from "
|
||||
<< hmin[k] << " " + unit << " to " << hmax[k] << " " + unit << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
@@ -102,32 +77,13 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
sumEAbs[k] = sum2EAbs[k] = sumLAbs[k] = sum2LAbs[k] =
|
||||
sumEleav[k]= sum2Eleav[k] = 0.;
|
||||
}
|
||||
|
||||
|
||||
//histograms
|
||||
//
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Creating the analysis factory
|
||||
std::auto_ptr<AIDA::IAnalysisFactory> af(AIDA_createAnalysisFactory());
|
||||
|
||||
// Creating the tree factory
|
||||
std::auto_ptr<AIDA::ITreeFactory> tf(af->createTreeFactory());
|
||||
|
||||
// Creating a tree mapped to an hbook file.
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
tree = tf->create(fileName, "hbook", readOnly, createNew);
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
hf = af->createHistogramFactory(*tree);
|
||||
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxAbsor; k++) {
|
||||
if (hbins[k] > 0)
|
||||
histo[k] = hf->createHistogram1D(hid[k],htitle[k],hbins[k],hmin[k],hmax[k]);
|
||||
else histo[k] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
histoManager->SetFactory();
|
||||
#endif
|
||||
|
||||
//example of print dEdx tables
|
||||
//
|
||||
////PrintDedxTables();
|
||||
@@ -137,7 +93,7 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
|
||||
void RunAction::fillPerEvent(G4int kAbs, G4double EAbs, G4double LAbs,
|
||||
G4double Eleav)
|
||||
{
|
||||
{
|
||||
//accumulate statistic
|
||||
//
|
||||
sumEAbs[kAbs] += EAbs; sum2EAbs[kAbs] += EAbs*EAbs;
|
||||
@@ -153,58 +109,79 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
//compute and print statistic
|
||||
//
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
G4double norme = 1./NbOfEvents;
|
||||
G4double norm = 1.0/NbOfEvents;
|
||||
G4double qnorm = sqrt(norm);
|
||||
G4double beamEnergy = Primary->GetParticleGun()->GetParticleEnergy();
|
||||
G4double sqbeam = sqrt(beamEnergy/GeV);
|
||||
|
||||
G4double MeanEAbs,rmsEAbs,MeanLAbs,rmsLAbs,MeanEleav,rmsEleav;
|
||||
G4double MeanEAbs,MeanEAbs2,rmsEAbs,resolution,rmsres;
|
||||
G4double MeanLAbs,MeanLAbs2,rmsLAbs;
|
||||
|
||||
std::ios::fmtflags mode = G4cout.flags();
|
||||
G4cout.setf(std::ios::fixed,std::ios::floatfield);
|
||||
G4int prec = G4cout.precision(2);
|
||||
|
||||
G4cout << "\n-------------------------------------------------------------\n"
|
||||
<< std::setw(51) << "total energy dep"
|
||||
<< std::setw(30) << "total tracklen"
|
||||
<< std::setw(40) << "mean energy leaving per layer \n \n";
|
||||
G4cout << "\n------------------------------------------------------------\n";
|
||||
G4cout << std::setw( 8) << "material"
|
||||
<< std::setw(23) << "Total Edep"
|
||||
<< std::setw(27) << "sqrt(E0(GeV))*rmsE/Emean"
|
||||
<< std::setw(23) << "total tracklen \n \n";
|
||||
|
||||
for (G4int k=0; k<Detector->GetNbOfAbsor(); k++)
|
||||
{
|
||||
MeanEAbs = norme*sumEAbs[k];
|
||||
rmsEAbs = norme*sqrt(abs(NbOfEvents*sum2EAbs[k] - sumEAbs[k]*sumEAbs[k]));
|
||||
MeanEAbs = sumEAbs[k]*norm;
|
||||
MeanEAbs2 = sum2EAbs[k]*norm;
|
||||
rmsEAbs = sqrt(abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
|
||||
resolution= 100.*sqbeam*rmsEAbs/MeanEAbs;
|
||||
rmsres = resolution*qnorm;
|
||||
|
||||
MeanLAbs = norme*sumLAbs[k];
|
||||
rmsLAbs = norme*sqrt(abs(NbOfEvents*sum2LAbs[k] - sumLAbs[k]*sumLAbs[k]));
|
||||
|
||||
MeanEleav = norme*sumEleav[k];
|
||||
rmsEleav=norme*sqrt(abs(NbOfEvents*sum2Eleav[k]-sumEleav[k]*sumEleav[k]));
|
||||
MeanLAbs = sumLAbs[k]*norm;
|
||||
MeanLAbs2 = sum2LAbs[k]*norm;
|
||||
rmsLAbs = sqrt(abs(MeanLAbs2 - MeanLAbs*MeanLAbs));
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< " Absorber" << k
|
||||
<< " (" << std::setw(12) << Detector->GetAbsorMaterial(k)->GetName()
|
||||
<< ") :"
|
||||
<< std::setw( 7) << G4BestUnit(MeanEAbs,"Energy") << " +- "
|
||||
<< std::setw( 5) << G4BestUnit( rmsEAbs,"Energy")
|
||||
<< std::setw(12) << G4BestUnit(MeanLAbs,"Length") << " +- "
|
||||
<< std::setw( 5) << G4BestUnit( rmsLAbs,"Length")
|
||||
<< std::setw(22) << G4BestUnit(MeanEleav,"Energy") << " +- "
|
||||
<< std::setw( 5) << G4BestUnit( rmsEleav,"Energy")
|
||||
<< G4endl;
|
||||
<< std::setw(10) << Detector->GetAbsorMaterial(k)->GetName() << ": "
|
||||
<< std::setprecision(5)
|
||||
<< std::setw(6) << G4BestUnit(MeanEAbs,"Energy") << " +- "
|
||||
<< std::setprecision(4)
|
||||
<< std::setw(5) << G4BestUnit( rmsEAbs,"Energy")
|
||||
<< std::setw(10) << resolution << " +- "
|
||||
<< std::setw(5) << rmsres << " %"
|
||||
<< std::setprecision(3)
|
||||
<< std::setw(10) << G4BestUnit(MeanLAbs,"Length") << " +- "
|
||||
<< std::setw(4) << G4BestUnit( rmsLAbs,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
G4cout << "\n------------------------------------------------------------\n";
|
||||
|
||||
G4cout << "\n-------------------------------------------------------------";
|
||||
G4cout << G4endl;
|
||||
G4cout.setf(mode,std::ios::floatfield);
|
||||
G4cout.precision(prec);
|
||||
|
||||
// Acceptance
|
||||
EmAcceptance acc;
|
||||
G4bool isStarted = false;
|
||||
for (G4int j=0; j<Detector->GetNbOfAbsor(); j++) {
|
||||
if (limittrue[j] < DBL_MAX) {
|
||||
if (!isStarted) {
|
||||
acc.BeginOfAcceptance("Sampling Calorimeter",NbOfEvents);
|
||||
isStarted = true;
|
||||
}
|
||||
MeanEAbs = sumEAbs[j]*norm;
|
||||
MeanEAbs2 = sum2EAbs[j]*norm;
|
||||
rmsEAbs = sqrt(abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
|
||||
G4String mat = Detector->GetAbsorMaterial(j)->GetName();
|
||||
acc.EmAcceptanceGauss("Edep"+mat, NbOfEvents, MeanEAbs,
|
||||
edeptrue[j], rmstrue[j], limittrue[j]);
|
||||
acc.EmAcceptanceGauss("Erms"+mat, NbOfEvents, rmsEAbs,
|
||||
rmstrue[j], rmstrue[j], 2.0*limittrue[j]);
|
||||
}
|
||||
}
|
||||
if(isStarted) acc.EndOfAcceptance();
|
||||
|
||||
//save histograms and delete factory
|
||||
//
|
||||
//
|
||||
#ifdef G4ANALYSIS_USE
|
||||
tree->commit(); // Writing the histograms to the file
|
||||
tree->close(); // and closing the tree (and the file)
|
||||
G4cout << "---> Histograms are saved" << G4endl;
|
||||
delete hf;
|
||||
delete tree;
|
||||
histoManager->SaveFactory();
|
||||
#endif
|
||||
|
||||
// show Rndm status
|
||||
@@ -218,7 +195,7 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -259,16 +236,20 @@ void RunAction::PrintDedxTables()
|
||||
|
||||
G4ParticleDefinition*
|
||||
part = G4ParticleTable::GetParticleTable()->FindParticle("mu+");
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
|
||||
G4ProductionCutsTable* theCoupleTable =
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
const G4MaterialCutsCouple* couple = 0;
|
||||
|
||||
for (G4int iab=0;iab < Detector->GetNbOfAbsor(); iab++)
|
||||
{
|
||||
G4Material* mat = Detector->GetAbsorMaterial(iab);
|
||||
G4int index = mat->GetIndex();
|
||||
const G4MaterialCutsCouple* couple =
|
||||
theCoupleTable->GetMaterialCutsCouple(index);
|
||||
G4int index = 0;
|
||||
for (size_t i=0; i<numOfCouples; i++) {
|
||||
couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
if (couple->GetMaterial() == mat) {index = i; break;}
|
||||
}
|
||||
G4cout << "\nLIST";
|
||||
G4cout << "\nC \nC dE/dx (MeV/cm) for " << part->GetParticleName()
|
||||
<< " in " << mat ->GetName() << "\nC";
|
||||
@@ -293,7 +274,8 @@ void RunAction::PrintDedxTables()
|
||||
G4cout << "\nG4VAL \n ";
|
||||
for (G4int l=0;l<nbin; ++l)
|
||||
{
|
||||
G4double dedx = G4EnergyLossTables::GetDEDX(part,tk[l],couple);
|
||||
G4double dedx = G4LossTableManager::Instance()
|
||||
->GetDEDX(part,tk[l],couple);
|
||||
G4cout << dedx/(MeV/cm) << "\t";
|
||||
if ((l+1)%ncolumn == 0) G4cout << "\n ";
|
||||
}
|
||||
@@ -305,3 +287,14 @@ void RunAction::PrintDedxTables()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::SetEdepAndRMS(G4int i, G4ThreeVector Value)
|
||||
{
|
||||
if (i>=0 && i<MaxAbsor) {
|
||||
edeptrue [i] = Value(0);
|
||||
rmstrue [i] = Value(1);
|
||||
limittrue[i] = Value(2);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -20,80 +20,54 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunActionMessenger.cc,v 1.7 2004/06/15 11:39:59 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// $Id: RunActionMessenger.cc,v 1.3 2004/01/21 17:29:27 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunActionMessenger.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWith3Vector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunActionMessenger::RunActionMessenger(RunAction* run)
|
||||
:Run(run)
|
||||
{
|
||||
fileCmd = new G4UIcmdWithAString("/testem/run/setFileName",this);
|
||||
fileCmd->SetGuidance("set name for the histograms file");
|
||||
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);
|
||||
|
||||
HistoCmd = new G4UIcommand("/testem/run/setHisto",this);
|
||||
HistoCmd->SetGuidance("Set histo Edep in absorber k");
|
||||
HistoCmd->SetGuidance(" histo=absor number : from 0 to NbOfAbsor-1");
|
||||
HistoCmd->SetGuidance(" nb bins; Emin; Emax; unit (of Emin and Emax");
|
||||
//
|
||||
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("Emin, expressed in unit");
|
||||
HistoCmd->SetParameter(VminPrm);
|
||||
//
|
||||
G4UIparameter* VmaxPrm = new G4UIparameter("Vmax",'d',false);
|
||||
VmaxPrm->SetGuidance("Emax, expressed in unit");
|
||||
HistoCmd->SetParameter(VmaxPrm);
|
||||
//
|
||||
G4UIparameter* UnitPrm = new G4UIparameter("unit",'s',false);
|
||||
HistoCmd->SetParameter(UnitPrm);
|
||||
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);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunActionMessenger::~RunActionMessenger()
|
||||
{
|
||||
delete HistoCmd;
|
||||
delete fileCmd;
|
||||
delete accCmd1;
|
||||
delete accCmd2;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if (command == fileCmd) Run->SetFileName(newValue);
|
||||
{
|
||||
if( command == accCmd1 )
|
||||
{ Run->SetEdepAndRMS(0,accCmd1->GetNew3VectorValue(newValue));}
|
||||
|
||||
if (command == HistoCmd)
|
||||
{ G4int idh,nbins; G4double vmin,vmax; char unts[30];
|
||||
const char* t = newValue;
|
||||
std::istrstream is((char*)t);
|
||||
is >> idh >> nbins >> vmin >> vmax >> unts;
|
||||
G4String unit = unts;
|
||||
G4double vUnit = G4UIcommand::ValueOf(unit);
|
||||
Run->SetHisto (idh,nbins,vmin*vUnit,vmax*vUnit,unit);
|
||||
}
|
||||
if( command == accCmd2 )
|
||||
{ Run->SetEdepAndRMS(1,accCmd2->GetNew3VectorValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.cc,v 1.9 2004/01/21 17:29:27 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: SteppingAction.cc,v 1.10 2004/03/16 18:06:17 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -67,8 +67,8 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
// sum up per event
|
||||
eventAct->SumEnergy(absorNo,edep,stepl);
|
||||
|
||||
// energy leaving each volume
|
||||
if (track->GetNextVolume() != volume) {
|
||||
// energy from secondaries leaving each volume
|
||||
if ((track->GetTrackID() != 1)&&(track->GetNextVolume() != volume)) {
|
||||
G4double EnLeaving = track->GetKineticEnergy();
|
||||
if (track->GetDefinition() == G4Positron::Positron())
|
||||
EnLeaving += 2*electron_mass_c2;
|
||||
|
||||
Reference in New Issue
Block a user