Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.3 2006-06-29 16:46:47 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -43,22 +45,24 @@
|
||||
#include "G4SolidStore.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:pWorld(0), pBox(0), aMaterial(0)
|
||||
:fWorld(0), fBox(0), fMaterial(0)
|
||||
{
|
||||
boxSize = 100*m; worldSize = 1.2*boxSize;
|
||||
fBoxSize = 100*m; fWorldSize = 1.2*fBoxSize;
|
||||
DefineMaterials();
|
||||
SetMaterial("Water");
|
||||
detectorMessenger = new DetectorMessenger(this);
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{ delete detectorMessenger;}
|
||||
{ delete fDetectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -151,7 +155,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//default material
|
||||
wMaterial = vacuum;
|
||||
fWMaterial = vacuum;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -167,54 +171,54 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
|
||||
// World
|
||||
//
|
||||
G4Box*
|
||||
sWorld = new G4Box("World", //name
|
||||
worldSize/2,worldSize/2,worldSize/2); //dimensions
|
||||
sWorld = new G4Box("World", //name
|
||||
fWorldSize/2,fWorldSize/2,fWorldSize/2); //dimensions
|
||||
|
||||
G4LogicalVolume*
|
||||
lWorld = new G4LogicalVolume(sWorld, //shape
|
||||
wMaterial, //material
|
||||
"World"); //name
|
||||
G4LogicalVolume*
|
||||
lWorld = new G4LogicalVolume(sWorld, //shape
|
||||
fWMaterial, //material
|
||||
"World"); //name
|
||||
|
||||
pWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
lWorld, //logical volume
|
||||
"World", //name
|
||||
0, //mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
fWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
lWorld, //logical volume
|
||||
"World", //name
|
||||
0, //mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
// Box
|
||||
//
|
||||
//
|
||||
G4Box*
|
||||
sBox = new G4Box("Container", //its name
|
||||
boxSize/2,boxSize/2,boxSize/2); //its dimensions
|
||||
|
||||
sBox = new G4Box("Container", //its name
|
||||
fBoxSize/2,fBoxSize/2,fBoxSize/2); //its dimensions
|
||||
|
||||
G4LogicalVolume*
|
||||
lBox = new G4LogicalVolume(sBox, //its shape
|
||||
aMaterial, //its material
|
||||
aMaterial->GetName()); //its name
|
||||
lBox = new G4LogicalVolume(sBox, //its shape
|
||||
fMaterial, //its material
|
||||
fMaterial->GetName()); //its name
|
||||
|
||||
pBox = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
lBox, //its logical volume
|
||||
aMaterial->GetName(), //its name
|
||||
lWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
fBox = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
lBox, //its logical volume
|
||||
fMaterial->GetName(), //its name
|
||||
lWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
PrintParameters();
|
||||
|
||||
//always return the root volume
|
||||
//
|
||||
return pWorld;
|
||||
return fWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::PrintParameters()
|
||||
{
|
||||
G4cout << "\n The Box is " << G4BestUnit(boxSize,"Length")
|
||||
<< " of " << aMaterial->GetName() << G4endl;
|
||||
G4cout << "\n The Box is " << G4BestUnit(fBoxSize,"Length")
|
||||
<< " of " << fMaterial->GetName() << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -224,7 +228,7 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial) {
|
||||
aMaterial = pttoMaterial;
|
||||
fMaterial = pttoMaterial;
|
||||
UpdateGeometry();
|
||||
} else {
|
||||
G4cout << "\n--> warning from DetectorConstruction::SetMaterial : "
|
||||
@@ -236,7 +240,7 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
|
||||
|
||||
void DetectorConstruction::SetSize(G4double value)
|
||||
{
|
||||
boxSize = value; worldSize = 1.2*boxSize;
|
||||
fBoxSize = value; fWorldSize = 1.2*fBoxSize;
|
||||
UpdateGeometry();
|
||||
}
|
||||
|
||||
@@ -246,7 +250,7 @@ void DetectorConstruction::SetSize(G4double value)
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
if (pWorld)
|
||||
if (fWorld)
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorMessenger.cc,v 1.2 2006-06-29 16:46:49 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,56 +42,56 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
:Detector(Det)
|
||||
:fDetector(Det)
|
||||
{
|
||||
testemDir = new G4UIdirectory("/testem/");
|
||||
testemDir->SetGuidance("commands specific to this example");
|
||||
fTestemDir = new G4UIdirectory("/testem/");
|
||||
fTestemDir->SetGuidance("commands specific to this example");
|
||||
|
||||
detDir = new G4UIdirectory("/testem/det/");
|
||||
detDir->SetGuidance("detector construction");
|
||||
fDetDir = new G4UIdirectory("/testem/det/");
|
||||
fDetDir->SetGuidance("detector construction");
|
||||
|
||||
MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this);
|
||||
MaterCmd->SetGuidance("Select material of the box.");
|
||||
MaterCmd->SetParameterName("choice",false);
|
||||
MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this);
|
||||
fMaterCmd->SetGuidance("Select material of the box.");
|
||||
fMaterCmd->SetParameterName("choice",false);
|
||||
fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
SizeCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSize",this);
|
||||
SizeCmd->SetGuidance("Set size of the box");
|
||||
SizeCmd->SetParameterName("Size",false);
|
||||
SizeCmd->SetRange("Size>0.");
|
||||
SizeCmd->SetUnitCategory("Length");
|
||||
SizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSizeCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSize",this);
|
||||
fSizeCmd->SetGuidance("Set size of the box");
|
||||
fSizeCmd->SetParameterName("Size",false);
|
||||
fSizeCmd->SetRange("Size>0.");
|
||||
fSizeCmd->SetUnitCategory("Length");
|
||||
fSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
|
||||
UpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->AvailableForStates(G4State_Idle);
|
||||
fUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
|
||||
fUpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
fUpdateCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete MaterCmd;
|
||||
delete SizeCmd;
|
||||
delete UpdateCmd;
|
||||
delete detDir;
|
||||
delete testemDir;
|
||||
delete fMaterCmd;
|
||||
delete fSizeCmd;
|
||||
delete fUpdateCmd;
|
||||
delete fDetDir;
|
||||
delete fTestemDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if( command == MaterCmd )
|
||||
{ Detector->SetMaterial(newValue);}
|
||||
if( command == fMaterCmd )
|
||||
{ fDetector->SetMaterial(newValue);}
|
||||
|
||||
if( command == SizeCmd )
|
||||
{ Detector->SetSize(SizeCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fSizeCmd )
|
||||
{ fDetector->SetSize(fSizeCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ Detector->UpdateGeometry(); }
|
||||
if( command == fUpdateCmd )
|
||||
{ fDetector->UpdateGeometry(); }
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.4 2010-06-07 05:40:46 perl Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,16 +41,16 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction()
|
||||
:printModulo(10000),eventMessenger(0)
|
||||
:fPrintModulo(10000),fEventMessenger(0)
|
||||
{
|
||||
eventMessenger = new EventActionMessenger(this);
|
||||
fEventMessenger = new EventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
delete fEventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,7 +60,7 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
G4int evtNb = evt->GetEventID();
|
||||
|
||||
//printing survey
|
||||
if (evtNb%printModulo == 0)
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventActionMessenger.cc,v 1.2 2006-06-29 16:46:53 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/EventActionMessenger.cc
|
||||
/// \brief Implementation of the EventActionMessenger class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,32 +41,32 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
|
||||
:eventAction(EvAct)
|
||||
:fEventAction(EvAct)
|
||||
{
|
||||
eventDir = new G4UIdirectory("/testem/event/");
|
||||
eventDir ->SetGuidance("event control");
|
||||
fEventDir = new G4UIdirectory("/testem/event/");
|
||||
fEventDir ->SetGuidance("event control");
|
||||
|
||||
PrintCmd = new G4UIcmdWithAnInteger("/testem/event/printModulo",this);
|
||||
PrintCmd->SetGuidance("Print events modulo n");
|
||||
PrintCmd->SetParameterName("EventNb",false);
|
||||
PrintCmd->SetRange("EventNb>0");
|
||||
PrintCmd->AvailableForStates(G4State_Idle);
|
||||
fPrintCmd = new G4UIcmdWithAnInteger("/testem/event/printModulo",this);
|
||||
fPrintCmd->SetGuidance("Print events modulo n");
|
||||
fPrintCmd->SetParameterName("EventNb",false);
|
||||
fPrintCmd->SetRange("EventNb>0");
|
||||
fPrintCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventActionMessenger::~EventActionMessenger()
|
||||
{
|
||||
delete PrintCmd;
|
||||
delete eventDir;
|
||||
delete fPrintCmd;
|
||||
delete fEventDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if (command == PrintCmd)
|
||||
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
|
||||
if (command == fPrintCmd)
|
||||
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,241 +23,69 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: HistoManager.cc,v 1.9 2010-11-09 21:06:39 asaim Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "HistoMessenger.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
:af(0),tree(0),factoryOn(false)
|
||||
: fFileName("testem15")
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Creating the analysis factory
|
||||
af = AIDA_createAnalysisFactory();
|
||||
if(!af) {
|
||||
G4cout << " HistoManager::HistoManager() :"
|
||||
<< " problem creating the AIDA analysis factory."
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
fileName[0] = "testem15";
|
||||
fileType = "root";
|
||||
fileOption = "";
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) {
|
||||
histo[k] = 0;
|
||||
exist[k] = false;
|
||||
Unit[k] = 1.0;
|
||||
Width[k] = 1.0;
|
||||
ascii[k] = false;
|
||||
}
|
||||
|
||||
histoMessenger = new HistoMessenger(this);
|
||||
Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete histoMessenger;
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Book()
|
||||
{
|
||||
// Create or get analysis manager
|
||||
// The choice of analysis technology is done via selection of a namespace
|
||||
// in HistoManager.hh
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetFileName(fFileName);
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetActivation(true); //enable inactivation of histograms
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete af;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::book()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(!af) return;
|
||||
|
||||
// Creating a tree mapped to an hbook file.
|
||||
fileName[1] = fileName[0] + "." + fileType;
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
AIDA::ITreeFactory* tf = af->createTreeFactory();
|
||||
tree = tf->create(fileName[1], fileType, readOnly, createNew, fileOption);
|
||||
delete tf;
|
||||
if(!tree) {
|
||||
G4cout << "HistoManager::book() :"
|
||||
<< " problem creating the AIDA tree with "
|
||||
<< " storeName = " << fileName[1]
|
||||
<< " storeType = " << fileType
|
||||
<< " readOnly = " << readOnly
|
||||
<< " createNew = " << createNew
|
||||
<< " options = " << fileOption
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
AIDA::IHistogramFactory* 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]);
|
||||
factoryOn = true;
|
||||
}
|
||||
}
|
||||
delete hf;
|
||||
if(factoryOn)
|
||||
G4cout << "\n----> Histogram Tree is opened " << fileName[1] << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::save()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (factoryOn) {
|
||||
saveAscii(); // Write ascii file, if any
|
||||
tree->commit(); // Writing the histograms to the file
|
||||
tree->close(); // and closing the tree (and the file)
|
||||
G4cout << "\n----> Histogram Tree is saved in " << fileName[1] << G4endl;
|
||||
|
||||
delete tree;
|
||||
tree = 0;
|
||||
factoryOn = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::FillHisto(G4int ih, G4double e, G4double weight)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::FillHisto() : histo " << ih
|
||||
<< "does not exist; e= " << e << " w= " << weight << G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(exist[ih]) histo[ih]->fill(e/Unit[ih], weight);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SetHisto(G4int ih,
|
||||
G4int nbins, G4double valmin, G4double valmax, const 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"};
|
||||
// Define histograms start values
|
||||
const G4int kMaxHisto = 10;
|
||||
const G4String id[] = { "0", "1", "2", "3" , "4", "5", "6" , "7", "8", "9"};
|
||||
const G4String title[] =
|
||||
{ "dummy", //0
|
||||
"Multiple Scattering. True step length", //1
|
||||
"Multiple Scattering. Geom step length", //2
|
||||
"Multiple Scattering. Ratio geomSl/trueSl", //3
|
||||
"Multiple Scattering. Lateral displacement: radius", //4
|
||||
"Multiple Scattering. Lateral displac: psi_space", //5
|
||||
"Multiple Scattering. Angular distrib: theta_plane", //6
|
||||
"Multiple Scattering. Phi-position angle", //7
|
||||
"Multiple Scattering. Phi-direction angle", //8
|
||||
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)"//9
|
||||
};
|
||||
{ "dummy", //0
|
||||
"Multiple Scattering. True step length", //1
|
||||
"Multiple Scattering. Geom step length", //2
|
||||
"Multiple Scattering. Ratio geomSl/trueSl", //3
|
||||
"Multiple Scattering. Lateral displacement: radius", //4
|
||||
"Multiple Scattering. Lateral displac: psi_space", //5
|
||||
"Multiple Scattering. Angular distrib: theta_plane", //6
|
||||
"Multiple Scattering. Phi-position angle", //7
|
||||
"Multiple Scattering. Phi-direction angle", //8
|
||||
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)"//9
|
||||
};
|
||||
|
||||
// Default values (to be reset via /analysis/h1/set command)
|
||||
G4int nbins = 100;
|
||||
G4double vmin = 0.;
|
||||
G4double vmax = 100.;
|
||||
|
||||
|
||||
G4String titl = title[ih];
|
||||
G4double vmin = valmin, vmax = valmax;
|
||||
Unit[ih] = 1.;
|
||||
|
||||
if (unit != "none") {
|
||||
titl = title[ih] + " (" + unit + ")";
|
||||
Unit[ih] = G4UnitDefinition::GetValueOf(unit);
|
||||
vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
|
||||
// Create all histograms as inactivated
|
||||
// as we have not yet set nbins, vmin, vmax
|
||||
for (G4int k=0; k<kMaxHisto; k++) {
|
||||
G4int ih = analysisManager->CreateH1(id[k], title[k], nbins, vmin, vmax);
|
||||
analysisManager->SetActivation(G4VAnalysisManager::kH1, ih, false);
|
||||
}
|
||||
|
||||
exist[ih] = true;
|
||||
Label[ih] = id[ih];
|
||||
Title[ih] = titl;
|
||||
Nbins[ih] = nbins;
|
||||
Vmin[ih] = vmin;
|
||||
Vmax[ih] = vmax;
|
||||
Width[ih] = (valmax-valmin)/nbins;
|
||||
|
||||
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
|
||||
<< nbins << " bins from "
|
||||
<< vmin << " " << unit << " to " << vmax << " " << 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......
|
||||
|
||||
void HistoManager::PrintHisto(G4int ih)
|
||||
{
|
||||
if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
|
||||
else
|
||||
G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
|
||||
<< "does not exist" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include <fstream>
|
||||
|
||||
void HistoManager::saveAscii()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
if (!ascii[0]) return;
|
||||
|
||||
G4String name = fileName[0] + ".ascii";
|
||||
std::ofstream File(name, std::ios::out);
|
||||
File.setf( std::ios::scientific, std::ios::floatfield );
|
||||
|
||||
//write selected histograms
|
||||
for (G4int ih=0; ih<MaxHisto; ih++) {
|
||||
if (exist[ih] && ascii[ih]) {
|
||||
File << "\n 1D histogram " << ih << ": " << Title[ih]
|
||||
<< "\n \n \t X \t\t Y" << G4endl;
|
||||
|
||||
for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
|
||||
File << " " << iBin << "\t"
|
||||
<< 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
|
||||
histo[ih]->axis().binUpperEdge(iBin)) << "\t"
|
||||
<< histo[ih]->binHeight(iBin)
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: HistoMessenger.cc,v 1.3 2007-11-13 14:13:31 maire Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "HistoMessenger.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#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");
|
||||
|
||||
typeCmd = new G4UIcmdWithAString("/testem/histo/setFileType",this);
|
||||
typeCmd->SetGuidance("set histograms file type: hbook, root, XML");
|
||||
typeCmd->SetCandidates("hbook root XML");
|
||||
|
||||
optionCmd = new G4UIcmdWithAString("/testem/histo/setFileOption",this);
|
||||
optionCmd->SetGuidance("set option 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);
|
||||
|
||||
prhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/printHisto",this);
|
||||
prhistoCmd->SetGuidance("print histo #id on ascii file");
|
||||
prhistoCmd->SetParameterName("id",false);
|
||||
prhistoCmd->SetRange("id>0");
|
||||
|
||||
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 prhistoCmd;
|
||||
delete histoCmd;
|
||||
delete optionCmd;
|
||||
delete typeCmd;
|
||||
delete factoryCmd;
|
||||
delete histoDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
|
||||
{
|
||||
if (command == factoryCmd)
|
||||
histoManager->SetFileName(newValues);
|
||||
|
||||
if (command == typeCmd)
|
||||
histoManager->SetFileType(newValues);
|
||||
|
||||
if (command == optionCmd)
|
||||
histoManager->SetFileOption(newValues);
|
||||
|
||||
if (command == histoCmd)
|
||||
{ G4int ih,nbBins; G4double vmin,vmax; char unts[30];
|
||||
const char* t = newValues;
|
||||
std::istringstream is(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 == prhistoCmd)
|
||||
histoManager->PrintHisto(prhistoCmd->GetNewIntValue(newValues));
|
||||
|
||||
if (command == rmhistoCmd)
|
||||
histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file electromagnetic/TestEm15/src/PhysListEmStandard.cc
|
||||
/// \brief Implementation of the PhysListEmStandard class
|
||||
//
|
||||
// $Id: PhysListEmStandard.cc,v 1.4 2009-11-19 17:58:25 maire Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,7 +41,7 @@
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4UrbanMscModel95.hh"
|
||||
#include "G4UrbanMscModel96.hh"
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4MuMultipleScattering.hh"
|
||||
|
||||
@@ -86,15 +88,15 @@ void PhysListEmStandard::ConstructProcess()
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
G4eMultipleScattering* msc = new G4eMultipleScattering();
|
||||
msc->AddEmModel(0, new G4UrbanMscModel95());
|
||||
msc->AddEmModel(0, new G4UrbanMscModel96());
|
||||
pmanager->AddProcess(msc, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
|
||||
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
G4eMultipleScattering* msc = new G4eMultipleScattering();
|
||||
msc->AddEmModel(0, new G4UrbanMscModel95());
|
||||
msc->AddEmModel(0, new G4UrbanMscModel96());
|
||||
pmanager->AddProcess(msc, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
|
||||
@@ -113,8 +115,8 @@ void PhysListEmStandard::ConstructProcess()
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2,2);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1,1,1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1,2,2);
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file electromagnetic/TestEm15/src/PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id: PhysicsList.cc,v 1.2 2006-06-29 16:47:04 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -37,6 +39,7 @@
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -45,18 +48,18 @@ PhysicsList::PhysicsList()
|
||||
{
|
||||
G4LossTableManager::Instance();
|
||||
|
||||
currentDefaultCut = 1.0*mm;
|
||||
cutForGamma = currentDefaultCut;
|
||||
cutForElectron = currentDefaultCut;
|
||||
cutForPositron = currentDefaultCut;
|
||||
fCurrentDefaultCut = 1.0*mm;
|
||||
fCutForGamma = fCurrentDefaultCut;
|
||||
fCutForElectron = fCurrentDefaultCut;
|
||||
fCutForPositron = fCurrentDefaultCut;
|
||||
|
||||
pMessenger = new PhysicsListMessenger(this);
|
||||
fMessenger = new PhysicsListMessenger(this);
|
||||
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// EM physics
|
||||
emName = G4String("standard");
|
||||
emPhysicsList = new PhysListEmStandard(emName);
|
||||
fEmName = G4String("standard");
|
||||
fEmPhysicsList = new PhysListEmStandard(fEmName);
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ PhysicsList::PhysicsList()
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{
|
||||
delete pMessenger;
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -175,7 +178,7 @@ void PhysicsList::ConstructProcess()
|
||||
|
||||
// Electromagnetic physics list
|
||||
//
|
||||
emPhysicsList->ConstructProcess();
|
||||
fEmPhysicsList->ConstructProcess();
|
||||
|
||||
// Em options
|
||||
//
|
||||
@@ -191,20 +194,28 @@ void PhysicsList::ConstructProcess()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4EmStandardPhysics_option3.hh"
|
||||
|
||||
void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
|
||||
}
|
||||
|
||||
if (name == emName) return;
|
||||
if (name == fEmName) return;
|
||||
|
||||
if (name == "standard") {
|
||||
|
||||
emName = name;
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new PhysListEmStandard(name);
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new PhysListEmStandard(name);
|
||||
|
||||
} else if (name == "emstandard_opt3") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option3();
|
||||
|
||||
} else {
|
||||
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
|
||||
<< " is not defined"
|
||||
@@ -229,7 +240,7 @@ void PhysicsList::AddStepMax()
|
||||
|
||||
if (stepMaxProcess->IsApplicable(*particle) && pmanager)
|
||||
{
|
||||
pmanager ->AddDiscreteProcess(stepMaxProcess);
|
||||
pmanager ->AddDiscreteProcess(stepMaxProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,33 +256,33 @@ void PhysicsList::SetCuts()
|
||||
{
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForPositron, "e+");
|
||||
SetCutValue(fCutForGamma, "gamma");
|
||||
SetCutValue(fCutForElectron, "e-");
|
||||
SetCutValue(fCutForPositron, "e+");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
cutForGamma = cut;
|
||||
SetParticleCuts(cutForGamma, G4Gamma::Gamma());
|
||||
fCutForGamma = cut;
|
||||
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
cutForElectron = cut;
|
||||
SetParticleCuts(cutForElectron, G4Electron::Electron());
|
||||
fCutForElectron = cut;
|
||||
SetParticleCuts(fCutForElectron, G4Electron::Electron());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForPositron(G4double cut)
|
||||
{
|
||||
cutForPositron = cut;
|
||||
SetParticleCuts(cutForPositron, G4Positron::Positron());
|
||||
fCutForPositron = cut;
|
||||
SetParticleCuts(fCutForPositron, G4Positron::Positron());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysicsListMessenger.cc,v 1.2 2006-06-29 16:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/PhysicsListMessenger.cc
|
||||
/// \brief Implementation of the PhysicsListMessenger class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,55 +41,55 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
:pPhysicsList(pPhys)
|
||||
:fPhysicsList(pPhys)
|
||||
{
|
||||
physDir = new G4UIdirectory("/testem/phys/");
|
||||
physDir->SetGuidance("physics list commands");
|
||||
fPhysDir = new G4UIdirectory("/testem/phys/");
|
||||
fPhysDir->SetGuidance("physics list commands");
|
||||
|
||||
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setGCut",this);
|
||||
gammaCutCmd->SetGuidance("Set gamma cut.");
|
||||
gammaCutCmd->SetParameterName("Gcut",false);
|
||||
gammaCutCmd->SetUnitCategory("Length");
|
||||
gammaCutCmd->SetRange("Gcut>0.0");
|
||||
gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fGammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setGCut",this);
|
||||
fGammaCutCmd->SetGuidance("Set gamma cut.");
|
||||
fGammaCutCmd->SetParameterName("Gcut",false);
|
||||
fGammaCutCmd->SetUnitCategory("Length");
|
||||
fGammaCutCmd->SetRange("Gcut>0.0");
|
||||
fGammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
electCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setECut",this);
|
||||
electCutCmd->SetGuidance("Set electron cut.");
|
||||
electCutCmd->SetParameterName("Ecut",false);
|
||||
electCutCmd->SetUnitCategory("Length");
|
||||
electCutCmd->SetRange("Ecut>0.0");
|
||||
electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fElectCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setECut",this);
|
||||
fElectCutCmd->SetGuidance("Set electron cut.");
|
||||
fElectCutCmd->SetParameterName("Ecut",false);
|
||||
fElectCutCmd->SetUnitCategory("Length");
|
||||
fElectCutCmd->SetRange("Ecut>0.0");
|
||||
fElectCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
protoCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setPCut",this);
|
||||
protoCutCmd->SetGuidance("Set positron cut.");
|
||||
protoCutCmd->SetParameterName("Pcut",false);
|
||||
protoCutCmd->SetUnitCategory("Length");
|
||||
protoCutCmd->SetRange("Pcut>0.0");
|
||||
protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fProtoCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setPCut",this);
|
||||
fProtoCutCmd->SetGuidance("Set positron cut.");
|
||||
fProtoCutCmd->SetParameterName("Pcut",false);
|
||||
fProtoCutCmd->SetUnitCategory("Length");
|
||||
fProtoCutCmd->SetRange("Pcut>0.0");
|
||||
fProtoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
allCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setCuts",this);
|
||||
allCutCmd->SetGuidance("Set cut for all.");
|
||||
allCutCmd->SetParameterName("cut",false);
|
||||
allCutCmd->SetUnitCategory("Length");
|
||||
allCutCmd->SetRange("cut>0.0");
|
||||
allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fAllCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setCuts",this);
|
||||
fAllCutCmd->SetGuidance("Set cut for all.");
|
||||
fAllCutCmd->SetParameterName("cut",false);
|
||||
fAllCutCmd->SetUnitCategory("Length");
|
||||
fAllCutCmd->SetRange("cut>0.0");
|
||||
fAllCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
pListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
|
||||
pListCmd->SetGuidance("Add modula physics list.");
|
||||
pListCmd->SetParameterName("PList",false);
|
||||
pListCmd->AvailableForStates(G4State_PreInit);
|
||||
fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
|
||||
fListCmd->SetGuidance("Add modula physics list.");
|
||||
fListCmd->SetParameterName("PList",false);
|
||||
fListCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsListMessenger::~PhysicsListMessenger()
|
||||
{
|
||||
delete gammaCutCmd;
|
||||
delete electCutCmd;
|
||||
delete protoCutCmd;
|
||||
delete allCutCmd;
|
||||
delete pListCmd;
|
||||
delete physDir;
|
||||
delete fGammaCutCmd;
|
||||
delete fElectCutCmd;
|
||||
delete fProtoCutCmd;
|
||||
delete fAllCutCmd;
|
||||
delete fListCmd;
|
||||
delete fPhysDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -95,25 +97,25 @@ PhysicsListMessenger::~PhysicsListMessenger()
|
||||
void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == gammaCutCmd )
|
||||
{ pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fGammaCutCmd )
|
||||
{ fPhysicsList->SetCutForGamma(fGammaCutCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == electCutCmd )
|
||||
{ pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fElectCutCmd )
|
||||
{ fPhysicsList->SetCutForElectron(fElectCutCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == protoCutCmd )
|
||||
{ pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fProtoCutCmd )
|
||||
{ fPhysicsList->SetCutForPositron(fProtoCutCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == allCutCmd )
|
||||
if( command == fAllCutCmd )
|
||||
{
|
||||
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
|
||||
pPhysicsList->SetCutForGamma(cut);
|
||||
pPhysicsList->SetCutForElectron(cut);
|
||||
pPhysicsList->SetCutForPositron(cut);
|
||||
G4double cut = fAllCutCmd->GetNewDoubleValue(newValue);
|
||||
fPhysicsList->SetCutForGamma(cut);
|
||||
fPhysicsList->SetCutForElectron(cut);
|
||||
fPhysicsList->SetCutForPositron(cut);
|
||||
}
|
||||
|
||||
if( command == pListCmd )
|
||||
{ pPhysicsList->AddPhysicsList(newValue);}
|
||||
if( command == fListCmd )
|
||||
{ fPhysicsList->AddPhysicsList(newValue);}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.2 2006-06-29 16:47:10 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -36,25 +38,26 @@
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det)
|
||||
:detector(det)
|
||||
:fDetector(det)
|
||||
{
|
||||
particleGun = new G4ParticleGun(1);
|
||||
fParticleGun = new G4ParticleGun(1);
|
||||
G4ParticleDefinition* particle
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleEnergy(1*MeV);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleEnergy(1*MeV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -63,11 +66,11 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
G4double halfSize = 0.5*(detector->GetWorldSize());
|
||||
G4double halfSize = 0.5*(fDetector->GetWorldSize());
|
||||
G4double x0 = - halfSize;
|
||||
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0, 0., 0.));
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0, 0., 0.));
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.5 2006-06-29 16:47:13 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -41,19 +43,23 @@
|
||||
#include "G4EmCalculator.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include <iomanip>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
|
||||
HistoManager* histo)
|
||||
: detector(det), primary(prim), ProcCounter(0), histoManager(histo)
|
||||
{ }
|
||||
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim)
|
||||
: fDetector(det), fPrimary(prim), fProcCounter(0)
|
||||
{
|
||||
fHistoManager = new HistoManager();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{ }
|
||||
{
|
||||
delete fHistoManager;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -62,18 +68,23 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
// save Rndm status
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
////G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
ProcCounter = new ProcessesCount;
|
||||
totalCount = 0;
|
||||
fProcCounter = new ProcessesCount;
|
||||
fTotalCount = 0;
|
||||
|
||||
truePL = truePL2 = geomPL = geomPL2 = 0.;
|
||||
lDispl = lDispl2 = psiSpa = psiSpa2 = 0.;
|
||||
tetPrj = tetPrj2 = 0.;
|
||||
phiCor = phiCor2 = 0.;
|
||||
|
||||
histoManager->book();
|
||||
fTruePL = fTruePL2 = fGeomPL = fGeomPL2 = 0.;
|
||||
fLDispl = fLDispl2 = fPsiSpa = fPsiSpa2 = 0.;
|
||||
fTetPrj = fTetPrj2 = 0.;
|
||||
fPhiCor = fPhiCor2 = 0.;
|
||||
|
||||
//histograms
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->IsActive() ) {
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -81,12 +92,12 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
void RunAction::CountProcesses(G4String procName)
|
||||
{
|
||||
//does the process already encounted ?
|
||||
size_t nbProc = ProcCounter->size();
|
||||
size_t nbProc = fProcCounter->size();
|
||||
size_t i = 0;
|
||||
while ((i<nbProc)&&((*ProcCounter)[i]->GetName()!=procName)) i++;
|
||||
if (i == nbProc) ProcCounter->push_back( new OneProcessCount(procName));
|
||||
while ((i<nbProc)&&((*fProcCounter)[i]->GetName()!=procName)) i++;
|
||||
if (i == nbProc) fProcCounter->push_back( new OneProcessCount(procName));
|
||||
|
||||
(*ProcCounter)[i]->Count();
|
||||
(*fProcCounter)[i]->Count();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -98,53 +109,53 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
|
||||
G4int prec = G4cout.precision(5);
|
||||
|
||||
G4Material* material = detector->GetMaterial();
|
||||
G4Material* material = fDetector->GetMaterial();
|
||||
G4double density = material->GetDensity();
|
||||
|
||||
G4ParticleDefinition* particle =
|
||||
primary->GetParticleGun()->GetParticleDefinition();
|
||||
fPrimary->GetParticleGun()->GetParticleDefinition();
|
||||
G4String Particle = particle->GetParticleName();
|
||||
G4double energy = primary->GetParticleGun()->GetParticleEnergy();
|
||||
G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
|
||||
G4cout << "\n The run consists of " << NbOfEvents << " "<< Particle << " of "
|
||||
<< G4BestUnit(energy,"Energy") << " through "
|
||||
<< G4BestUnit(detector->GetBoxSize(),"Length") << " of "
|
||||
<< material->GetName() << " (density: "
|
||||
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
<< G4BestUnit(fDetector->GetBoxSize(),"Length") << " of "
|
||||
<< material->GetName() << " (density: "
|
||||
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
|
||||
//frequency of processes
|
||||
G4cout << "\n Process calls frequency --->";
|
||||
for (size_t i=0; i< ProcCounter->size();i++) {
|
||||
G4String procName = (*ProcCounter)[i]->GetName();
|
||||
G4int count = (*ProcCounter)[i]->GetCounter();
|
||||
for (size_t i=0; i< fProcCounter->size();i++) {
|
||||
G4String procName = (*fProcCounter)[i]->GetName();
|
||||
G4int count = (*fProcCounter)[i]->GetCounter();
|
||||
G4cout << "\t" << procName << " = " << count;
|
||||
}
|
||||
|
||||
if (totalCount == 0) return;
|
||||
if (fTotalCount == 0) return;
|
||||
|
||||
//compute path length and related quantities
|
||||
//
|
||||
G4double MeanTPL = truePL /totalCount;
|
||||
G4double MeanTPL2 = truePL2/totalCount;
|
||||
G4double MeanTPL = fTruePL /fTotalCount;
|
||||
G4double MeanTPL2 = fTruePL2/fTotalCount;
|
||||
G4double rmsTPL = std::sqrt(std::fabs(MeanTPL2 - MeanTPL*MeanTPL));
|
||||
|
||||
G4double MeanGPL = geomPL /totalCount;
|
||||
G4double MeanGPL2 = geomPL2/totalCount;
|
||||
G4double MeanGPL = fGeomPL /fTotalCount;
|
||||
G4double MeanGPL2 = fGeomPL2/fTotalCount;
|
||||
G4double rmsGPL = std::sqrt(std::fabs(MeanGPL2 - MeanGPL*MeanGPL));
|
||||
|
||||
G4double MeanLaD = lDispl /totalCount;
|
||||
G4double MeanLaD2 = lDispl2/totalCount;
|
||||
G4double MeanLaD = fLDispl /fTotalCount;
|
||||
G4double MeanLaD2 = fLDispl2/fTotalCount;
|
||||
G4double rmsLaD = std::sqrt(std::fabs(MeanLaD2 - MeanLaD*MeanLaD));
|
||||
|
||||
G4double MeanPsi = psiSpa /(totalCount);
|
||||
G4double MeanPsi2 = psiSpa2/(totalCount);
|
||||
G4double MeanPsi = fPsiSpa /(fTotalCount);
|
||||
G4double MeanPsi2 = fPsiSpa2/(fTotalCount);
|
||||
G4double rmsPsi = std::sqrt(std::fabs(MeanPsi2 - MeanPsi*MeanPsi));
|
||||
|
||||
G4double MeanTeta = tetPrj /(2*totalCount);
|
||||
G4double MeanTeta2 = tetPrj2/(2*totalCount);
|
||||
G4double MeanTeta = fTetPrj /(2*fTotalCount);
|
||||
G4double MeanTeta2 = fTetPrj2/(2*fTotalCount);
|
||||
G4double rmsTeta = std::sqrt(std::fabs(MeanTeta2 - MeanTeta*MeanTeta));
|
||||
|
||||
G4double MeanCorrel = phiCor /(totalCount);
|
||||
G4double MeanCorrel2 = phiCor2/(totalCount);
|
||||
G4double MeanCorrel = fPhiCor /(fTotalCount);
|
||||
G4double MeanCorrel2 = fPhiCor2/(fTotalCount);
|
||||
G4double rmsCorrel = std::sqrt(std::fabs(MeanCorrel2-MeanCorrel*MeanCorrel));
|
||||
|
||||
G4cout << "\n\n truePathLength :\t" << G4BestUnit(MeanTPL,"Length")
|
||||
@@ -154,18 +165,18 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
<< "\n lateralDisplac :\t" << G4BestUnit(MeanLaD,"Length")
|
||||
<< " +- " << G4BestUnit( rmsLaD,"Length")
|
||||
<< "\n Psi :\t" << MeanPsi/mrad << " mrad"
|
||||
<< " +- " << rmsPsi /mrad << " mrad"
|
||||
<< " +- " << rmsPsi /mrad << " mrad"
|
||||
<< " (" << MeanPsi/deg << " deg"
|
||||
<< " +- " << rmsPsi /deg << " deg)"
|
||||
<< " +- " << rmsPsi /deg << " deg)"
|
||||
<< G4endl;
|
||||
|
||||
|
||||
G4cout << "\n Theta_plane :\t" << rmsTeta/mrad << " mrad"
|
||||
<< " (" << rmsTeta/deg << " deg)"
|
||||
<< "\n phi correlation:\t" << MeanCorrel
|
||||
<< " +- " << rmsCorrel
|
||||
<< " (std::cos(phi_pos - phi_dir))"
|
||||
<< " +- " << rmsCorrel
|
||||
<< " (std::cos(phi_pos - phi_dir))"
|
||||
<< G4endl;
|
||||
|
||||
|
||||
|
||||
//cross check from G4EmCalculator
|
||||
//
|
||||
@@ -185,26 +196,31 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
|
||||
G4cout << "\n transport mean free path :\t" << G4BestUnit(MSmfp,"Length")
|
||||
<< "\n range from restrict dE/dx:\t" << G4BestUnit(range,"Length")
|
||||
<< "\n ---> effective facRange :\t" << efFacrange
|
||||
<< "\n ---> effective facRange :\t" << efFacrange
|
||||
<< G4endl;
|
||||
|
||||
G4cout << "\n compute theta0 from Highland :\t"
|
||||
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
|
||||
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
|
||||
<< G4endl;
|
||||
|
||||
//restore default format
|
||||
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
|
||||
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
|
||||
<< G4endl;
|
||||
|
||||
//restore default format
|
||||
G4cout.precision(prec);
|
||||
|
||||
// delete and remove all contents in ProcCounter
|
||||
while (ProcCounter->size()>0){
|
||||
OneProcessCount* aProcCount=ProcCounter->back();
|
||||
ProcCounter->pop_back();
|
||||
// delete and remove all contents in fProcCounter
|
||||
while (fProcCounter->size()>0){
|
||||
OneProcessCount* aProcCount=fProcCounter->back();
|
||||
fProcCounter->pop_back();
|
||||
delete aProcCount;
|
||||
}
|
||||
delete ProcCounter;
|
||||
delete fProcCounter;
|
||||
|
||||
histoManager->save();
|
||||
//save histograms
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->IsActive() ) {
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
|
||||
// show Rndm status
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
@@ -218,10 +234,10 @@ G4double RunAction::ComputeMscHighland(G4double pathLength)
|
||||
//projected angular distribution.
|
||||
//Eur. Phys. Jour. C15 (2000) page 166, formule 23.9
|
||||
|
||||
G4double t = pathLength/(detector->GetMaterial()->GetRadlen());
|
||||
G4double t = pathLength/(fDetector->GetMaterial()->GetRadlen());
|
||||
if (t < DBL_MIN) return 0.;
|
||||
|
||||
G4ParticleGun* particle = primary->GetParticleGun();
|
||||
G4ParticleGun* particle = fPrimary->GetParticleGun();
|
||||
G4double T = particle->GetParticleEnergy();
|
||||
G4double M = particle->GetParticleDefinition()->GetPDGMass();
|
||||
G4double z = std::abs(particle->GetParticleDefinition()->GetPDGCharge()/eplus);
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: StepMax.cc,v 1.2 2006-06-29 16:47:16 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/StepMax.cc
|
||||
/// \brief Implementation of the StepMax class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -35,14 +37,14 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StepMax::StepMax(const G4String& processName)
|
||||
: G4VDiscreteProcess(processName),MaxChargedStep(DBL_MAX)
|
||||
: G4VDiscreteProcess(processName),fMaxChargedStep(DBL_MAX)
|
||||
{
|
||||
pMess = new StepMaxMessenger(this);
|
||||
fMess = new StepMaxMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StepMax::~StepMax() { delete pMess; }
|
||||
StepMax::~StepMax() { delete fMess; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -53,7 +55,7 @@ G4bool StepMax::IsApplicable(const G4ParticleDefinition& particle)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void StepMax::SetMaxStep(G4double step) {MaxChargedStep = step;}
|
||||
void StepMax::SetMaxStep(G4double step) {fMaxChargedStep = step;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -66,10 +68,10 @@ G4double StepMax::PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
|
||||
G4double ProposedStep = DBL_MAX;
|
||||
|
||||
if((MaxChargedStep > 0.) &&
|
||||
if((fMaxChargedStep > 0.) &&
|
||||
(aTrack.GetVolume() != 0) &&
|
||||
(aTrack.GetVolume()->GetName() != "World"))
|
||||
ProposedStep = MaxChargedStep;
|
||||
ProposedStep = fMaxChargedStep;
|
||||
|
||||
return ProposedStep;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: StepMaxMessenger.cc,v 1.2 2006-06-29 16:47:18 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/StepMaxMessenger.cc
|
||||
/// \brief Implementation of the StepMaxMessenger class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -37,28 +39,28 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StepMaxMessenger::StepMaxMessenger(StepMax* stepM)
|
||||
:pStepMax(stepM)
|
||||
:fStepMax(stepM)
|
||||
{
|
||||
StepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
|
||||
StepMaxCmd->SetGuidance("Set max allowed step length");
|
||||
StepMaxCmd->SetParameterName("mxStep",false);
|
||||
StepMaxCmd->SetRange("mxStep>0.");
|
||||
StepMaxCmd->SetUnitCategory("Length");
|
||||
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
|
||||
fStepMaxCmd->SetGuidance("Set max allowed step length");
|
||||
fStepMaxCmd->SetParameterName("mxStep",false);
|
||||
fStepMaxCmd->SetRange("mxStep>0.");
|
||||
fStepMaxCmd->SetUnitCategory("Length");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StepMaxMessenger::~StepMaxMessenger()
|
||||
{
|
||||
delete StepMaxCmd;
|
||||
delete fStepMaxCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void StepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if (command == StepMaxCmd)
|
||||
{ pStepMax->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
|
||||
if (command == fStepMaxCmd)
|
||||
{ fStepMax->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: SteppingAction.cc,v 1.6 2007-03-15 15:52:39 maire Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
/// \file electromagnetic/TestEm15/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,9 +42,8 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(DetectorConstruction* det,
|
||||
PrimaryGeneratorAction* prim, RunAction* RuAct,
|
||||
HistoManager* Hist)
|
||||
:detector(det), primary(prim), runAction(RuAct), histoManager(Hist)
|
||||
PrimaryGeneratorAction* prim, RunAction* RuAct)
|
||||
:fDetector(det), fPrimary(prim), fRunAction(RuAct)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -57,7 +58,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
G4StepPoint* prePoint = aStep->GetPreStepPoint();
|
||||
|
||||
// if World --> return
|
||||
if (prePoint->GetTouchableHandle()->GetVolume()==detector->GetWorld()) return;
|
||||
if(prePoint->GetTouchableHandle()->GetVolume()==fDetector->GetWorld()) return;
|
||||
|
||||
// here we enter in the absorber Box
|
||||
// tag the event to be killed anyway after this step
|
||||
@@ -68,9 +69,9 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
//
|
||||
G4StepPoint* endPoint = aStep->GetPostStepPoint();
|
||||
G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
|
||||
runAction->CountProcesses(procName);
|
||||
fRunAction->CountProcesses(procName);
|
||||
|
||||
if (procName != "msc" && procName != "stepMax") return;
|
||||
if (procName != "msc" && procName != "muMsc" && procName != "stepMax") return;
|
||||
|
||||
//below, only multiple Scattering happens
|
||||
//
|
||||
@@ -78,40 +79,41 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
G4ThreeVector direction = endPoint->GetMomentumDirection();
|
||||
|
||||
G4double truePathLength = aStep->GetStepLength();
|
||||
G4double geomPathLength = position.x() + 0.5*detector->GetBoxSize();
|
||||
G4double geomPathLength = position.x() + 0.5*fDetector->GetBoxSize();
|
||||
G4double ratio = geomPathLength/truePathLength;
|
||||
runAction->SumPathLength(truePathLength,geomPathLength);
|
||||
histoManager->FillHisto(1,truePathLength);
|
||||
histoManager->FillHisto(2,geomPathLength);
|
||||
histoManager->FillHisto(3,ratio);
|
||||
fRunAction->SumPathLength(truePathLength,geomPathLength);
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillH1(1,truePathLength);
|
||||
analysisManager->FillH1(2,geomPathLength);
|
||||
analysisManager->FillH1(3,ratio);
|
||||
|
||||
G4double yend = position.y(), zend = position.z();
|
||||
G4double lateralDisplacement = std::sqrt(yend*yend + zend*zend);
|
||||
runAction->SumLateralDisplacement(lateralDisplacement);
|
||||
histoManager->FillHisto(4,lateralDisplacement);
|
||||
fRunAction->SumLateralDisplacement(lateralDisplacement);
|
||||
analysisManager->FillH1(4,lateralDisplacement);
|
||||
|
||||
G4double psi = std::atan(lateralDisplacement/geomPathLength);
|
||||
runAction->SumPsi(psi);
|
||||
histoManager->FillHisto(5,psi);
|
||||
fRunAction->SumPsi(psi);
|
||||
analysisManager->FillH1(5,psi);
|
||||
|
||||
G4double xdir = direction.x(), ydir = direction.y(), zdir = direction.z();
|
||||
G4double tetaPlane = std::atan2(ydir, xdir);
|
||||
runAction->SumTetaPlane(tetaPlane);
|
||||
histoManager->FillHisto(6,tetaPlane);
|
||||
fRunAction->SumTetaPlane(tetaPlane);
|
||||
analysisManager->FillH1(6,tetaPlane);
|
||||
tetaPlane = std::atan2(zdir, xdir);
|
||||
runAction->SumTetaPlane(tetaPlane);
|
||||
histoManager->FillHisto(6,tetaPlane);
|
||||
fRunAction->SumTetaPlane(tetaPlane);
|
||||
analysisManager->FillH1(6,tetaPlane);
|
||||
|
||||
G4double phiPos = std::atan2(zend, yend);
|
||||
histoManager->FillHisto(7,phiPos);
|
||||
analysisManager->FillH1(7,phiPos);
|
||||
G4double phiDir = std::atan2(zdir, ydir);
|
||||
histoManager->FillHisto(8,phiDir);
|
||||
analysisManager->FillH1(8,phiDir);
|
||||
|
||||
G4double phiCorrel = 0.;
|
||||
if (lateralDisplacement > 0.)
|
||||
phiCorrel = (yend*ydir + zend*zdir)/lateralDisplacement;
|
||||
runAction->SumPhiCorrel(phiCorrel);
|
||||
histoManager->FillHisto(9,phiCorrel);
|
||||
fRunAction->SumPhiCorrel(phiCorrel);
|
||||
analysisManager->FillH1(9,phiCorrel);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file electromagnetic/TestEm15/src/SteppingVerbose.cc
|
||||
/// \brief Implementation of the SteppingVerbose class
|
||||
//
|
||||
// $Id: SteppingVerbose.cc,v 1.1 2010-09-16 16:26:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,26 +60,26 @@ void SteppingVerbose::StepInfo()
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
|
||||
const G4VProcess* process
|
||||
= fStep->GetPostStepPoint()->GetProcessDefinedStep();
|
||||
@@ -89,28 +91,28 @@ void SteppingVerbose::StepInfo()
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << "\n :----- List of secondaries ----------------"
|
||||
<< G4endl;
|
||||
G4cout << "\n :----- List of secondaries ----------------"
|
||||
<< G4endl;
|
||||
G4cout.precision(4);
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< std::setw(13)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
|
||||
<< ": energy ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< " time ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
|
||||
G4cout << G4endl;
|
||||
}
|
||||
G4cout << " "
|
||||
<< std::setw(13)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
|
||||
<< ": energy ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< " time ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :------------------------------------------\n"
|
||||
<< G4endl;
|
||||
G4cout << " :------------------------------------------\n"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,25 +131,25 @@ G4int prec = G4cout.precision(3);
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName()
|
||||
<< " initStep" << G4endl;
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName()
|
||||
<< " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user