Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm17/src/DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
// $Id: DetectorConstruction.cc,v 1.3 2007-05-12 16:33:53 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -44,22 +46,24 @@
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:pBox(0), lBox(0), aMaterial(0)
:fPBox(0), fLBox(0), fMaterial(0)
{
BoxSize = 1*m;
fBoxSize = 1*m;
DefineMaterials();
SetMaterial("Iron");
detectorMessenger = new DetectorMessenger(this);
fDetectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete detectorMessenger;}
{ delete fDetectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -128,34 +132,34 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
G4SolidStore::GetInstance()->Clean();
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
lBox = new G4LogicalVolume(sBox, //its shape
aMaterial, //its material
aMaterial->GetName()); //its name
fLBox = 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
0, //its mother volume
false, //no boolean operation
0); //copy number
fPBox = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLBox, //its logical volume
fMaterial->GetName(), //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
PrintParameters();
//always return the root volume
//
return pBox;
return fPBox;
}
//....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......
@@ -164,14 +168,14 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) aMaterial = pttoMaterial;
if (pttoMaterial) fMaterial = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSize(G4double value)
{
BoxSize = value;
fBoxSize = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm17/src/DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
// $Id: DetectorMessenger.cc,v 1.2 2006-06-29 16:48:51 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -43,56 +45,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/TestEm17/src/EventAction.cc
/// \brief Implementation of the EventAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,16 +40,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......
@@ -57,7 +59,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:48:55 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/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("physics list");
fEventDir = new G4UIdirectory("/testem/event/");
fEventDir ->SetGuidance("physics list");
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,119 +23,102 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.5 2010-11-09 20:41:49 asaim Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/HistoManager.cc
/// \brief Implementation of the HistoManager class
//
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....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),hf(0),factoryOn(false)
{
#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] = "testem17";
fileType = "root";
fileOption = "";
fileName[0] = "testem17";
factoryOn = false;
fNbHist = 0;
// histograms
for (G4int k=0; k<MaxHisto; k++) {
histo[k] = 0;
exist[k] = false;
Unit[k] = 1.0;
Width[k] = 1.0;
fHistId[k] = 0;
fHistPt[k] = 0;
fExist[k] = false;
fUnit[k] = 1.0;
fWidth[k] = 1.0;
fAscii[k] = false;
}
histoMessenger = new HistoMessenger(this);
fHistoMessenger = new HistoMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
delete histoMessenger;
#ifdef G4ANALYSIS_USE
delete af;
#endif
delete fHistoMessenger;
}
//....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
// if no histos, do nothing
if (fNbHist == 0) return;
// 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->SetVerboseLevel(0);
G4String extension = analysisManager->GetFileType();
fileName[1] = fileName[0] + "." + extension;
// Open an output file
//
G4bool fileOpen = analysisManager->OpenFile(fileName[0]);
if (!fileOpen) {
G4cout << "\n---> HistoManager::book(): cannot open " << fileName[1]
<< G4endl;
return;
}
// Creating a histogram factory, whose histograms will be handled by the tree
hf = af->createHistogramFactory(*tree);
}
// create selected histograms
//
analysisManager->SetFirstHistoId(1);
for (G4int k=0; k<MaxHisto; k++) {
if (exist[k]) {
histo[k] = hf->createHistogram1D( Label[k], Title[k],
Nbins[k], Vmin[k], Vmax[k]);
if (fExist[k]) {
fHistId[k] = analysisManager->CreateH1( fLabel[k], fTitle[k],
fNbins[k], fVmin[k], fVmax[k]);
fHistPt[k] = analysisManager->GetH1(fHistId[k]);
factoryOn = true;
}
}
if(factoryOn)
G4cout << "\n----> Histogram Tree is opened in " << fileName[1] << G4endl;
#endif
if (factoryOn)
G4cout << "\n----> Histogram file is opened in " << fileName[1] << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::save()
{
#ifdef G4ANALYSIS_USE
if (factoryOn) {
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 hf;
delete tree;
tree = 0;
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
saveAscii(); // Write fAscii file, if any
G4cout << "\n----> Histograms are saved in " << fileName[1] << G4endl;
delete G4AnalysisManager::Instance();
factoryOn = false;
}
#endif
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -144,54 +127,55 @@ 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;
<< "does not fExist; e= " << e << " w= " << weight << G4endl;
return;
}
#ifdef G4ANALYSIS_USE
if(exist[ih]) histo[ih]->fill(e/Unit[ih], weight);
#endif
if (fHistPt[ih]) fHistPt[ih]->fill(e/fUnit[ih], weight);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetHisto(G4int ih,
G4int nbins, G4double valmin, G4double valmax, const G4String& unit)
G4int nbins, G4double vmin, G4double vmax, const G4String& unit)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
<< "does not exist" << G4endl;
<< "does not fExist" << G4endl;
return;
}
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7"};
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
const G4String title[] =
{ "dummy", //0
"log10(Etransfert/Emu) Ionization", //1
"log10(Etransfert/Emu) Pair", //2
"log10(Etransfert/Emu) Brems", //3
"log10(Etransfert/Emu) Nuclear", //4
"log10(Etransfert/Emu) Ionization", //5
"log10(Etransfert/Emu) Pair", //6
"log10(Etransfert/Emu) Brems" //7
{ "dummy", //0
"log10(Etransfert/Emu) muIonization", //1
"log10(Etransfert/Emu) muPair", //2
"log10(Etransfert/Emu) muBrems", //3
"log10(Etransfert/Emu) muNuclear", //4
"log10(Etransfert/Emu) hIonization", //5
"log10(Etransfert/Emu) hPair", //6
"log10(Etransfert/Emu) hBrems", //7
"dummy", //8
"dummy" //9
};
G4String titl = title[ih];
G4double vmin = valmin, vmax = valmax;
Unit[ih] = 1.;
fUnit[ih] = 1.;
if (unit != "none") {
titl = title[ih] + " (" + unit + ")";
Unit[ih] = G4UnitDefinition::GetValueOf(unit);
vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
fUnit[ih] = G4UnitDefinition::GetValueOf(unit);
}
exist[ih] = true;
Label[ih] = id[ih];
Title[ih] = titl;
Nbins[ih] = nbins;
Vmin[ih] = vmin;
Vmax[ih] = vmax;
Width[ih] = (valmax-valmin)/nbins;
fExist[ih] = true;
fLabel[ih] = id[ih];
fTitle[ih] = titl;
fNbins[ih] = nbins;
fVmin[ih] = vmin;
fVmax[ih] = vmax;
fWidth[ih] = fUnit[ih]*(vmax-vmin)/nbins;
fNbHist++;
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
<< nbins << " bins from "
@@ -201,15 +185,60 @@ void HistoManager::SetHisto(G4int ih,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::RemoveHisto(G4int ih)
void HistoManager::Normalize(G4int ih, G4double fac)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
<< "does not exist" << G4endl;
if (ih >= MaxHisto) {
G4cout << "---> warning from HistoManager::Normalize() : histo " << ih
<< " fac= " << fac << G4endl;
return;
}
histo[ih] = 0; exist[ih] = false;
if (fHistPt[ih]) fHistPt[ih]->scale(fac);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::PrintHisto(G4int ih)
{
if (ih < MaxHisto) { fAscii[ih] = true; fAscii[0] = true; }
else
G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
<< "does not exist" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <fstream>
void HistoManager::saveAscii()
{
if (!fAscii[0]) return;
G4String name = fileName[0] + ".ascii";
std::ofstream File(name, std::ios::out);
if (!File) {
G4cout
<< "\n---> HistoManager::saveAscii(): cannot open " << name << G4endl;
return;
}
File.setf( std::ios::scientific, std::ios::floatfield );
//write selected histograms
for (G4int ih=0; ih<MaxHisto; ih++) {
if (fHistPt[ih] && fAscii[ih]) {
File << "\n 1D histogram " << ih << ": " << fTitle[ih]
<< "\n \n \t X \t\t Y" << G4endl;
for (G4int iBin=0; iBin<fNbins[ih]; iBin++) {
File << " " << iBin << "\t"
<< fHistPt[ih]->axis().bin_center(iBin) << "\t"
<< fHistPt[ih]->bin_height(iBin)
<< G4endl;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,11 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoMessenger.cc,v 1.2 2006-06-29 16:49:01 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/HistoMessenger.cc
/// \brief Implementation of the HistoMessenger class
//
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoMessenger.hh"
@@ -43,92 +46,74 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(HistoManager* manager)
:histoManager (manager)
:fHistoManager (manager)
{
histoDir = new G4UIdirectory("/testem/histo/");
histoDir->SetGuidance("histograms control");
fHistoDir = new G4UIdirectory("/testem/histo/");
fHistoDir->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");
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)");
fFileNameCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
fFileNameCmd->SetGuidance("set name for the histograms file");
fHistoCmd = new G4UIcommand("/testem/histo/setHisto",this);
fHistoCmd->SetGuidance("Set bining of the histo number ih :");
fHistoCmd->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);
fHistoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
fHistoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
fHistoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
fHistoCmd->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);
fHistoCmd->SetParameter(unit);
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
rmhistoCmd->SetGuidance("desactivate histo #id");
rmhistoCmd->SetParameterName("id",false);
rmhistoCmd->SetRange("id>0");
fPrtHistoCmd = new G4UIcmdWithAnInteger("/testem/histo/printHisto",this);
fPrtHistoCmd->SetGuidance("print histo #id on ascii file");
fPrtHistoCmd->SetParameterName("id",false);
fPrtHistoCmd->SetRange("id>0");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete rmhistoCmd;
delete histoCmd;
delete optionCmd;
delete typeCmd;
delete factoryCmd;
delete histoDir;
delete fPrtHistoCmd;
delete fHistoCmd;
delete fFileNameCmd;
delete fHistoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == factoryCmd)
histoManager->SetFileName(newValues);
if (command == fFileNameCmd)
fHistoManager->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];
if (command == fHistoCmd)
{ G4int ih,nbBins; G4double vmin,vmax; G4String unit;
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);
is >> ih >> nbBins >> vmin >> vmax >> unit;
fHistoManager->SetHisto (ih,nbBins,vmin,vmax,unit);
}
if (command == rmhistoCmd)
histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));
if (command == fPrtHistoCmd)
fHistoManager->PrintHisto(fPrtHistoCmd->GetNewIntValue(newValues));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MuCrossSections.cc,v 1.2 2006-06-29 16:49:03 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/MuCrossSections.cc
/// \brief Implementation of the MuCrossSections class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,6 +34,8 @@
#include "MuCrossSections.hh"
#include "G4Material.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +53,7 @@ MuCrossSections::~MuCrossSections()
G4double MuCrossSections::CR_Macroscopic(const G4String& process, G4Material* material,
G4double tkin, G4double ep)
// return the macroscopic cross section (1/L) in GEANT4 internal units
{
const G4ElementVector* theElementVector = material->GetElementVector();
@@ -94,17 +98,17 @@ G4double MuCrossSections::CR_PerAtom(const G4String& process, G4Element* element
double MuCrossSections::CRB_Mephi(double z,double a,double tkin,double ep)
//***********************************************************************
//*** crb_g4_1.inc in comparison with crb_.inc, following
//*** changes are introduced (September 24th, 1998):
//*** 1) function crb_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 2) special case of hidrogen (Z<1.5; b,b1,Dn_star)
//*** Numerical comparison: 5 decimal digits coincide.
//*** crb_g4_1.inc in comparison with crb_.inc, following
//*** changes are introduced (September 24th, 1998):
//*** 1) function crb_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 2) special case of hidrogen (Z<1.5; b,b1,Dn_star)
//*** Numerical comparison: 5 decimal digits coincide.
//***
//*** Cross section for bremsstrahlung by fast muon
//*** By R.P.Kokoulin, September 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin 1995, Preprint MEPhI
//*** (7,18,19,20,21,25,26); Dn (18) is modified to incorporate
//*** Bugaev's inelatic nuclear correction (28) for Z > 1.
//*** Cross section for bremsstrahlung by fast muon
//*** By R.P.Kokoulin, September 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin 1995, Preprint MEPhI
//*** (7,18,19,20,21,25,26); Dn (18) is modified to incorporate
//*** Bugaev's inelatic nuclear correction (28) for Z > 1.
//***********************************************************************
{
// double Z,A,Tkin,EP;
@@ -112,11 +116,11 @@ double MuCrossSections::CRB_Mephi(double z,double a,double tkin,double ep)
double e,v,delta,rab0,z_13,dn,b,b1,dn_star,rab1,fn,epmax1,fe,rab2;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double lamu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double alpha=1./137.036;
double rmass=amu/ame; // "207"
double rmass=lamu/ame; // "207"
double coeff=16./3.*alpha*avno*(re/rmass)*(re/rmass); // cm^2
double sqrte=1.64872127; // sqrt(2.71828...)
double btf=183.;
@@ -124,48 +128,48 @@ double MuCrossSections::CRB_Mephi(double z,double a,double tkin,double ep)
double bh=202.4;
double bh1=446.;
//***
if(ep >= tkin)
{
crb_g4=0.;
return crb_g4;
}
e=tkin+amu;
v=ep/e;
delta=amu*amu*v/(2.*(e-ep)); // qmin
rab0=delta*sqrte;
z_13=pow(z,-0.3333333); //
//*** nuclear size and excitation, screening parameters
dn=1.54*pow(a,0.27);
if(z <= 1.5) // special case for hydrogen
{
b=bh;
b1=bh1;
dn_star=dn;
}
else
{
b=btf;
b1=btf1;
dn_star=pow(dn,(1.-1./z)); // with Bugaev's correction
}
//*** nucleus contribution logarithm
rab1=b*z_13;
fn=log(rab1/(dn_star*(ame+rab0*rab1))*(amu+delta*(dn_star*sqrte-2.)));
if(fn < 0.) fn=0.;
//*** electron contribution logarithm
epmax1=e/(1.+amu*rmass/(2.*e));
if(ep >= epmax1)
{
fe=0.;
goto label10;
}
rab2=b1*z_13*z_13;
fe=log(rab2*amu/((1.+delta*rmass/(ame*sqrte))*(ame+rab0*rab2)));
if(fe < 0.) fe=0.;
if(ep >= tkin)
{
crb_g4=0.;
return crb_g4;
}
e=tkin+lamu;
v=ep/e;
delta=lamu*lamu*v/(2.*(e-ep)); // qmin
rab0=delta*sqrte;
z_13=pow(z,-0.3333333); //
//*** nuclear size and excitation, screening parameters
dn=1.54*pow(a,0.27);
if(z <= 1.5) // special case for hydrogen
{
b=bh;
b1=bh1;
dn_star=dn;
}
else
{
b=btf;
b1=btf1;
dn_star=pow(dn,(1.-1./z)); // with Bugaev's correction
}
//*** nucleus contribution logarithm
rab1=b*z_13;
fn=log(rab1/(dn_star*(ame+rab0*rab1))*(lamu+delta*(dn_star*sqrte-2.)));
if(fn < 0.) fn=0.;
//*** electron contribution logarithm
epmax1=e/(1.+lamu*rmass/(2.*e));
if(ep >= epmax1)
{
fe=0.;
goto label10;
}
rab2=b1*z_13*z_13;
fe=log(rab2*lamu/((1.+delta*rmass/(ame*sqrte))*(ame+rab0*rab2)));
if(fe < 0.) fe=0.;
//***
label10:
crb_g4=coeff*(1.-v*(1.-0.75*v))*z*(z*fn+fe)/(a*ep);
return crb_g4;
crb_g4=coeff*(1.-v*(1.-0.75*v))*z*(z*fn+fe)/(a*ep);
return crb_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -173,12 +177,12 @@ label10:
double MuCrossSections::CRK_Mephi(double z,double a,double tkin,double ep)
//***********************************************************************
//*** Cross section for knock-on electron production by fast muons
//*** (including bremsstrahlung e-diagrams and rad. correction).
//*** Units: cm^2/(g*GeV); Tkin, ep - GeV.
//*** By R.P.Kokoulin, October 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin, Phys.Atom.Nuclei, 1997
//*** (a bit simplified Kelner's version of Eq.30 - with 2 logarithms).
//*** Cross section for knock-on electron production by fast muons
//*** (including bremsstrahlung e-diagrams and rad. correction).
//*** Units: cm^2/(g*GeV); Tkin, ep - GeV.
//*** By R.P.Kokoulin, October 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin, Phys.Atom.Nuclei, 1997
//*** (a bit simplified Kelner's version of Eq.30 - with 2 logarithms).
//***
{
// double Z,A,Tkin,EP;
@@ -186,28 +190,28 @@ double MuCrossSections::CRK_Mephi(double z,double a,double tkin,double ep)
double e,epmax,v,sigma0,a1,a3;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double lamu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double alpha=1./137.036;
double pi=3.141592654;
double bmu=amu*amu/(2.*ame);
double coeff0=avno*2.*pi*ame*re*re;
double coeff1=alpha/(2.*pi);
double lpi=3.141592654;
double bmu=lamu*lamu/(2.*ame);
double coeff0=avno*2.*lpi*ame*re*re;
double coeff1=alpha/(2.*lpi);
//***
e=tkin+amu;
epmax=e/(1.+bmu/e);
if(ep >= epmax)
{
crk_g4=0.;
return crk_g4;
}
v=ep/e;
sigma0=coeff0*(z/a)*(1.-ep/epmax+0.5*v*v)/(ep*ep);
a1=log(1.+2.*ep/ame);
a3=log(4.*e*(e-ep)/(amu*amu));
crk_g4=sigma0*(1.+coeff1*a1*(a3-a1));
return crk_g4;
e=tkin+lamu;
epmax=e/(1.+bmu/e);
if(ep >= epmax)
{
crk_g4=0.;
return crk_g4;
}
v=ep/e;
sigma0=coeff0*(z/a)*(1.-ep/epmax+0.5*v*v)/(ep*ep);
a1=log(1.+2.*ep/ame);
a3=log(4.*e*(e-ep)/(lamu*lamu));
crk_g4=sigma0*(1.+coeff1*a1*(a3-a1));
return crk_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -215,44 +219,44 @@ double MuCrossSections::CRK_Mephi(double z,double a,double tkin,double ep)
double MuCrossSections::CRN_Mephi(double /* z */,double a,double tkin,double ep)
//***********************************************************************
//*** Differential cross section for photonuclear muon interaction.
//*** Formulae from Borog & Petrukhin, 1975
//*** Real photon cross section: Caldwell e.a., 1979
//*** Nuclear shadowing: Brodsky e.a., 1972
//*** Units: cm^2 / g GeV.
//*** CRN_G4_1.inc January 31st, 1998 R.P.Kokoulin
//*** Differential cross section for photonuclear muon interaction.
//*** Formulae from Borog & Petrukhin, 1975
//*** Real photon cross section: Caldwell e.a., 1979
//*** Nuclear shadowing: Brodsky e.a., 1972
//*** Units: cm^2 / g GeV.
//*** CRN_G4_1.inc January 31st, 1998 R.P.Kokoulin
//***********************************************************************
{
// double Z,A,Tkin,EP;
double crn_g4;
double e,aeff,sigph,v,v1,v2,amu2,up,down;
//***
double amu=0.105658389; // GeV
double lamu=0.105658389; // GeV
double avno=6.022137e23;
double amp=0.9382723; // GeV
double pi=3.14159265;
double lpi=3.14159265;
double alpha=1./137.036;
//***
double epmin_phn=0.20; // GeV
double alam2=0.400000; // GeV**2
double alam =0.632456; // sqrt(alam2)
double coeffn=alpha/pi*avno*1e-30; // cm^2/microbarn
double coeffn=alpha/lpi*avno*1e-30; // cm^2/microbarn
//***
e=tkin+amu;
crn_g4=0.;
if(ep >= e-0.5*amp) return crn_g4;
if(ep <= epmin_phn) return crn_g4;
aeff=0.22*a+0.78*pow(a,0.89); // shadowing
sigph=49.2+11.1*log(ep)+151.8/sqrt(ep); // microbarn
v=ep/e;
v1=1.-v;
v2=v*v;
amu2=amu*amu;
up=e*e*v1/amu2*(1.+amu2*v2/(alam2*v1));
down=1.+ep/alam*(1.+alam/(2.*amp)+ep/alam);
crn_g4=coeffn*aeff/a*sigph/ep*(-v1+(v1+0.5*v2*(1.+2.*amu2/alam2))*log(up/down));
if(crn_g4 < 0.) crn_g4=0.;
return crn_g4;
e=tkin+lamu;
crn_g4=0.;
if(ep >= e-0.5*amp) return crn_g4;
if(ep <= epmin_phn) return crn_g4;
aeff=0.22*a+0.78*pow(a,0.89); // shadowing
sigph=49.2+11.1*log(ep)+151.8/sqrt(ep); // microbarn
v=ep/e;
v1=1.-v;
v2=v*v;
amu2=lamu*lamu;
up=e*e*v1/amu2*(1.+amu2*v2/(alam2*v1));
down=1.+ep/alam*(1.+alam/(2.*amp)+ep/alam);
crn_g4=coeffn*aeff/a*sigph/ep*(-v1+(v1+0.5*v2*(1.+2.*amu2/alam2))*log(up/down));
if(crn_g4 < 0.) crn_g4=0.;
return crn_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -260,18 +264,18 @@ double MuCrossSections::CRN_Mephi(double /* z */,double a,double tkin,double ep)
double MuCrossSections::CRP_Mephi(double z,double a,double tkin,double ep)
//**********************************************************************
//*** crp_g4_1.inc in comparison with crp_m.inc, following
//*** changes are introduced (January 16th, 1998):
//*** 1) Avno/A, cm^2/gram GeV
//*** 2) zeta_loss(E,Z) from Kelner 1997, Eqs.(53-54)
//*** 3) function crp_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 4) bbb=183 (Thomas-Fermi)
//*** 5) special case of hidrogen (Z<1.5), bbb,g1,g2
//*** 6) expansions in 'xi' are simplified (Jan.17th,1998)
//*** crp_g4_1.inc in comparison with crp_m.inc, following
//*** changes are introduced (January 16th, 1998):
//*** 1) Avno/A, cm^2/gram GeV
//*** 2) zeta_loss(E,Z) from Kelner 1997, Eqs.(53-54)
//*** 3) function crp_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 4) bbb=183 (Thomas-Fermi)
//*** 5) special case of hidrogen (Z<1.5), bbb,g1,g2
//*** 6) expansions in 'xi' are simplified (Jan.17th,1998)
//***
//*** Cross section for electron pair production by fast muon
//*** By R.P.Kokoulin, December 1997
//*** Formulae from Kokoulin & Petrukhin 1971, Hobart, Eqs.(1,8,9,10)
//*** Cross section for electron pair production by fast muon
//*** By R.P.Kokoulin, December 1997
//*** Formulae from Kokoulin & Petrukhin 1971, Hobart, Eqs.(1,8,9,10)
{
// double Z,A,Tkin,EP;
double crp_g4;
@@ -281,17 +285,17 @@ double MuCrossSections::CRP_Mephi(double z,double a,double tkin,double ep)
double ale,cre,be,fe,ymu,ymd,ym1,alm_crm,a10,bm,fm;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double lamu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double pi=3.14159265;
double lpi=3.14159265;
double alpha=1./137.036;
double rmass=amu/ame; // "207"
double coeff=4./(3.*pi)*(alpha*re)*(alpha*re)*avno; // cm^2
double rmass=lamu/ame; // "207"
double coeff=4./(3.*lpi)*(alpha*re)*(alpha*re)*avno; // cm^2
double sqrte=1.64872127; // sqrt(2.71828...)
double c3=3.*sqrte*amu/4.; // for limits
double c3=3.*sqrte*lamu/4.; // for limits
double c7=4.*ame; // -"-
double c8=6.*amu*amu; // -"-
double c8=6.*lamu*lamu; // -"-
double xgi[8]={.0199,.1017,.2372,.4083,.5917,.7628,.8983,.9801}; // Gauss, 8
double wgi[8]={.0506,.1112,.1569,.1813,.1813,.1569,.1112,.0506}; // Gauss, 8
@@ -302,94 +306,94 @@ double MuCrossSections::CRP_Mephi(double z,double a,double tkin,double ep)
g1h=4.4e-5;
g2h=4.8e-5;
e=tkin+amu;
z13=pow(z,0.3333333);
e1=e-ep;
crp_g4=0.;
if(e1 <= c3*z13) return crp_g4; // ep > max
alf=c7/ep; // 4m/ep
a3=1.-alf;
if(a3 <= 0.) return crp_g4; // ep < min
//*** zeta calculation
if(z <= 1.5) // special case of hidrogen
{
bbb=bbbh;
g1=g1h;
g2=g2h;
}
else
{
bbb=bbbtf;
g1=g1tf;
g2=g2tf;
}
zeta1=0.073*log(e/(amu+g1*z13*z13*e))-0.26;
if(zeta1 > 0.)
{
zeta2=0.058*log(e/(amu+g2*z13*e))-0.14;
zeta=zeta1/zeta2;
}
else
{
zeta=0.;
}
z2=z*(z+zeta); //
//*** just to check (for comparison with crp_m)
// z2=z*(z+1.)
// bbb=189.
e=tkin+lamu;
z13=pow(z,0.3333333);
e1=e-ep;
crp_g4=0.;
if(e1 <= c3*z13) return crp_g4; // ep > max
alf=c7/ep; // 4m/ep
a3=1.-alf;
if(a3 <= 0.) return crp_g4; // ep < min
//*** zeta calculation
if(z <= 1.5) // special case of hidrogen
{
bbb=bbbh;
g1=g1h;
g2=g2h;
}
else
{
bbb=bbbtf;
g1=g1tf;
g2=g2tf;
}
zeta1=0.073*log(e/(lamu+g1*z13*z13*e))-0.26;
if(zeta1 > 0.)
{
zeta2=0.058*log(e/(lamu+g2*z13*e))-0.14;
zeta=zeta1/zeta2;
}
else
{
zeta=0.;
}
z2=z*(z+zeta); //
//*** just to check (for comparison with crp_m)
// z2=z*(z+1.)
// bbb=189.
//***
screen0=2.*ame*sqrte*bbb/(z13*ep); // be careful with "ame"
a0=e*e1;
a1=ep*ep/a0; // 2*beta
bet=0.5*a1; // beta
xi0=0.25*rmass*rmass*a1; // xi0
del=c8/a0; // 6mu^2/EE'
tmn=log((alf+2.*del*a3)/(1.+(1.-del)*sqrt(a3))); // log(1-rmax)
sum=0.;
for(int i=0; i<=7; i++) // integration
{
a4=exp(tmn*xgi[i]); // 1-r
a5=a4*(2.-a4); // 1-r2
a6=1.-a5; // r2
a7=1.+a6; // 1+r2
a9=3.+a6; // 3+r2
xi=xi0*a5;
xii=1./xi;
xi1=1.+xi;
screen=screen0*xi1/a5;
yeu=5.-a6+4.*bet*a7;
yed=2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6);
ye1=1.+yeu/yed;
ale=log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1));
cre=0.5*log(1.+(1.5/rmass*z13)*(1.5/rmass*z13)*xi1*ye1);
if(xi <= 1e3) //
{
be=((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
}
else
{
be=(3.-a6+a1*a7)/(2.*xi); // -(6.-5.*a6+3.*bet*a6)/(6.*xi*xi);
}
fe=max(0.,(ale-cre)*be);
ymu=4.+a6+3.*bet*a7;
ymd=a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6;
ym1=1.+ymu/ymd;
alm_crm=log(bbb*rmass/(1.5*z13*z13*(1.+screen*ym1)));
if(xi >= 1e-3) //
{
a10=(1.+a1)*a5; // (1+2b)(1-r2)
bm=(a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
}
else
{
bm=(5.-a6+bet*a9)*(xi/2.); // -(11.-5.*a6+.5*bet*(5.+a6))*(xi*xi/6.)
}
fm=max(0.,(alm_crm)*bm);
screen0=2.*ame*sqrte*bbb/(z13*ep); // be careful with "ame"
a0=e*e1;
a1=ep*ep/a0; // 2*beta
bet=0.5*a1; // beta
xi0=0.25*rmass*rmass*a1; // xi0
del=c8/a0; // 6mu^2/EE'
tmn=log((alf+2.*del*a3)/(1.+(1.-del)*sqrt(a3))); // log(1-rmax)
sum=0.;
for(int i=0; i<=7; i++) // integration
{
a4=exp(tmn*xgi[i]); // 1-r
a5=a4*(2.-a4); // 1-r2
a6=1.-a5; // r2
a7=1.+a6; // 1+r2
a9=3.+a6; // 3+r2
xi=xi0*a5;
xii=1./xi;
xi1=1.+xi;
screen=screen0*xi1/a5;
yeu=5.-a6+4.*bet*a7;
yed=2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6);
ye1=1.+yeu/yed;
ale=log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1));
cre=0.5*log(1.+(1.5/rmass*z13)*(1.5/rmass*z13)*xi1*ye1);
if(xi <= 1e3) //
{
be=((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
}
else
{
be=(3.-a6+a1*a7)/(2.*xi); // -(6.-5.*a6+3.*bet*a6)/(6.*xi*xi);
}
fe=max(0.,(ale-cre)*be);
ymu=4.+a6+3.*bet*a7;
ymd=a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6;
ym1=1.+ymu/ymd;
alm_crm=log(bbb*rmass/(1.5*z13*z13*(1.+screen*ym1)));
if(xi >= 1e-3) //
{
a10=(1.+a1)*a5; // (1+2b)(1-r2)
bm=(a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
}
else
{
bm=(5.-a6+bet*a9)*(xi/2.); // -(11.-5.*a6+.5*bet*(5.+a6))*(xi*xi/6.)
}
fm=max(0.,(alm_crm)*bm);
//***
sum=sum+a4*(fe+fm/(rmass*rmass))*wgi[i];
}
crp_g4=-tmn*sum*(z2/a)*coeff*e1/(e*ep);
return crp_g4;
sum=sum+a4*(fe+fm/(rmass*rmass))*wgi[i];
}
crp_g4=-tmn*sum*(z2/a)*coeff*e1/(e*ep);
return crp_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm17/src/MuNuclearBuilder.cc
/// \brief Implementation of the MuNuclearBuilder class
//
// $Id: MuNuclearBuilder.cc,v 1.2 2006-06-29 16:49:05 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -37,7 +39,10 @@
#include "G4MuonMinus.hh"
#include "G4ProcessManager.hh"
#include "G4MuNuclearInteraction.hh"
//#include "G4MuNuclearInteraction.hh"
//#include "G4PreCompoundModel.hh"
#include "G4MuonNuclearProcess.hh"
#include "G4MuonVDNuclearModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -54,6 +59,18 @@ MuNuclearBuilder::~MuNuclearBuilder()
void MuNuclearBuilder::ConstructProcess()
{
G4ProcessManager * pManager = 0;
G4MuonNuclearProcess* muNucProcess = new G4MuonNuclearProcess();
G4MuonVDNuclearModel* muNucModel = new G4MuonVDNuclearModel();
muNucProcess->RegisterMe(muNucModel);
pManager = G4MuonPlus::MuonPlus()->GetProcessManager();
pManager->AddDiscreteProcess(muNucProcess);
pManager = G4MuonMinus::MuonMinus()->GetProcessManager();
pManager->AddDiscreteProcess(muNucProcess);
/*
// Add standard EM Processes for Muon
G4ParticleDefinition* particle = G4MuonPlus::MuonPlus();
G4ProcessManager* pmanager = particle->GetProcessManager();
@@ -63,6 +80,7 @@ void MuNuclearBuilder::ConstructProcess()
pmanager = particle->GetProcessManager();
pmanager->AddProcess(new G4MuNuclearInteraction("muNucl"),-1,-1,4);
*/
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysListEmStandard.cc,v 1.4 2008-05-07 13:57:56 maire Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/PhysListEmStandard.cc
/// \brief Implementation of the PhysListEmStandard class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,6 +49,8 @@
#include "G4hPairProduction.hh"
#include "G4LossTableManager.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::PhysListEmStandard(const G4String& name)
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm17/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id: PhysicsList.cc,v 1.4 2006-10-24 10:06:21 maire Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,25 +52,26 @@
#include "G4IonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList() : G4VModularPhysicsList()
{
SetVerboseLevel(1);
pMessenger = new PhysicsListMessenger(this);
fMessenger = new PhysicsListMessenger(this);
// cuts
currentDefaultCut = 1.0*mm;
cutForGamma = currentDefaultCut;
cutForElectron = currentDefaultCut;
cutForPositron = currentDefaultCut;
fCurrentDefaultCut = 1.0*mm;
fCutForGamma = fCurrentDefaultCut;
fCutForElectron = fCurrentDefaultCut;
fCutForPositron = fCurrentDefaultCut;
// EM physics
emName = G4String("standard");
emPhysicsList = new PhysListEmStandard(emName);
fEmName = G4String("standard");
fEmPhysicsList = new PhysListEmStandard(fEmName);
muNuclPhysicsList = 0;
fMuNuclPhysicsList = 0;
// instanciate EnergyLossTable
G4LossTableManager::Instance();
@@ -78,7 +81,7 @@ PhysicsList::PhysicsList() : G4VModularPhysicsList()
PhysicsList::~PhysicsList()
{
delete pMessenger;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -114,8 +117,8 @@ void PhysicsList::ConstructProcess()
// electromagnetic Physics List
//
emPhysicsList->ConstructProcess();
if(muNuclPhysicsList) muNuclPhysicsList->ConstructProcess();
fEmPhysicsList->ConstructProcess();
if(fMuNuclPhysicsList) fMuNuclPhysicsList->ConstructProcess();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -126,16 +129,16 @@ void PhysicsList::AddPhysicsList(const G4String& name)
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
if (name == emName) return;
if (name == fEmName) return;
if (name == "standard" && name != emName) {
if (name == "standard" && name != fEmName) {
emName = name;
delete emPhysicsList;
emPhysicsList = new PhysListEmStandard(name);
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEmStandard(name);
} else if (name == "muNucl") {
muNuclPhysicsList = new MuNuclearBuilder(name);
fMuNuclPhysicsList = new MuNuclearBuilder(name);
} else {
@@ -157,9 +160,9 @@ 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+");
if (verboseLevel>0) DumpCutValuesTable();
}
@@ -172,24 +175,24 @@ void PhysicsList::SetCuts()
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:49:13 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/PhysicsListMessenger.cc
/// \brief Implementation of the PhysicsListMessenger class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,51 +40,51 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:pPhysicsList(pPhys)
:fPhysicsList(pPhys)
{
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 fGammaCutCmd;
delete fElectCutCmd;
delete fProtoCutCmd;
delete fAllCutCmd;
delete fListCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -90,25 +92,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:49:15 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -36,26 +38,27 @@
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.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("mu+");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleEnergy(10*TeV);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleEnergy(10*TeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -64,7 +67,7 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double halfSize = 0.5*(detector->GetSize());
G4double halfSize = 0.5*(fDetector->GetSize());
G4double x0 = - halfSize;
//randomize (y0,z0)
@@ -73,8 +76,8 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4double y0 = (2*G4UniformRand()-1.)*beam;
G4double z0 = (2*G4UniformRand()-1.)*beam;
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
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.4 2008-03-31 10:22:59 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,17 +42,15 @@
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#ifdef G4ANALYSIS_USE
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
HistoManager* HistM)
: detector(det), primary(prim), ProcCounter(0), histoManager(HistM)
: fDetector(det), fPrimary(prim), fProcCounter(0), fHistoManager(HistM)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -65,12 +65,12 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
CLHEP::HepRandom::showEngineStatus();
ProcCounter = new ProcessesCount;
fProcCounter = new ProcessesCount;
histoManager->book();
fHistoManager->book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -78,12 +78,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......
@@ -96,27 +96,27 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
std::ios::fmtflags mode = G4cout.flags();
G4int prec = G4cout.precision(2);
G4Material* material = detector->GetMaterial();
G4double length = detector->GetSize();
G4Material* material = fDetector->GetMaterial();
G4double length = fDetector->GetSize();
G4double density = material->GetDensity();
G4String particle = primary->GetParticleGun()->GetParticleDefinition()
G4String particle = fPrimary->GetParticleGun()->GetParticleDefinition()
->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(length,"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
<< G4BestUnit(length,"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
//total number of process calls
G4double countTot = 0.;
G4cout << "\n Number of process calls --->";
for (size_t i=0; i< ProcCounter->size();i++) {
G4String procName = (*ProcCounter)[i]->GetName();
for (size_t i=0; i< fProcCounter->size();i++) {
G4String procName = (*fProcCounter)[i]->GetName();
if (procName != "Transportation") {
G4int count = (*ProcCounter)[i]->GetCounter();
G4int count = (*fProcCounter)[i]->GetCounter();
G4cout << "\t" << procName << " : " << count;
countTot += count;
}
@@ -140,34 +140,34 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//
if(particle == "mu+" || particle == "mu-") {
totalCrossSection = 0.;
for (size_t i=0; i< ProcCounter->size();i++) {
G4String procName = (*ProcCounter)[i]->GetName();
for (size_t i=0; i< fProcCounter->size();i++) {
G4String procName = (*fProcCounter)[i]->GetName();
if (procName != "Transportation")
totalCrossSection += ComputeTheory(procName, NbOfEvents);
totalCrossSection += ComputeTheory(procName, NbOfEvents);
}
MeanFreePath = 1./totalCrossSection;
massCrossSection = totalCrossSection/density;
G4cout << " Theory: "
<< "total CrossSection = " << totalCrossSection*cm << " /cm"
<< "\t MeanFreePath = " << G4BestUnit(MeanFreePath,"Length")
<< "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
<< G4endl;
<< "total CrossSection = " << totalCrossSection*cm << " /cm"
<< "\t MeanFreePath = " << G4BestUnit(MeanFreePath,"Length")
<< "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
<< G4endl;
}
G4cout.setf(mode,std::ios::floatfield);
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();
fHistoManager->save();
// show Rndm status
CLHEP::HepRandom::showEngineStatus();
@@ -175,15 +175,10 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double RunAction::ComputeTheory(G4String process,
#ifdef G4ANALYSIS_USE
G4int NbOfMu)
#else
G4int /* NbOfMu */)
#endif
G4double RunAction::ComputeTheory(G4String process, G4int NbOfMu)
{
G4Material* material = detector->GetMaterial();
G4double ekin = primary->GetParticleGun()->GetParticleEnergy();
G4Material* material = fDetector->GetMaterial();
G4double ekin = fPrimary->GetParticleGun()->GetParticleEnergy();
MuCrossSections crossSections;
G4int id = 0; G4double cut = 0.;
@@ -200,30 +195,29 @@ G4double RunAction::ComputeTheory(G4String process,
G4int nbOfBins = 100;
G4double binMin = -10., binMax = 0., binWidth = (binMax-binMin)/nbOfBins;
#ifdef G4ANALYSIS_USE
G4double length = detector->GetSize();
//create histo for theoritical crossSections, with same bining as simulation
//
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
const G4String label[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19"};
AIDA::IHistogram1D* histoMC = 0; AIDA::IHistogram1D* histoTh = 0;
if (histoManager->HistoExist(id)) {
histoMC = histoManager->GetHisto(id);
nbOfBins = histoManager->GetNbins(id);
binMin = histoManager->GetVmin (id);
binMax = histoManager->GetVmax (id);
binWidth = histoManager->GetBinWidth(id);
G4AnaH1* histoTh = 0;
////G4AnaH1* histoMC = 0;
if (fHistoManager->HistoExist(id)) {
////histoMC = analysisManager->GetH1(id);
nbOfBins = fHistoManager->GetNbins(id);
binMin = fHistoManager->GetVmin (id);
binMax = fHistoManager->GetVmax (id);
binWidth = fHistoManager->GetBinWidth(id);
G4String labelTh = label[MaxHisto + id];
G4String titleTh = histoManager->GetTitle(id) + " (Th)";
histoTh = histoManager->GetHistogramFactory()
->createHistogram1D(labelTh,titleTh,nbOfBins,binMin,binMax);
G4String titleTh = fHistoManager->GetTitle(id) + " (Th)";
G4int histThId = analysisManager
->CreateH1(labelTh,titleTh,nbOfBins,binMin,binMax);
histoTh = analysisManager->GetH1(histThId);
}
#endif
//compute and plot differential crossSection, as function of energy transfert.
//compute and return integrated crossSection for a given process.
@@ -232,26 +226,23 @@ G4double RunAction::ComputeTheory(G4String process,
//
G4double lgeps, etransf, sigmaE, dsigma;
G4double sigmaTot = 0.;
const G4double ln10 = std::log(10.);
const G4double ln10 = std::log(10.);
G4double length = fDetector->GetSize();
for (G4int ibin=0; ibin<nbOfBins; ibin++) {
lgeps = binMin + (ibin+0.5)*binWidth;
etransf = ekin*std::pow(10.,lgeps);
sigmaE = crossSections.CR_Macroscopic(process,material,ekin,etransf);
dsigma = sigmaE*etransf*binWidth*ln10;
if (etransf > cut) sigmaTot += dsigma;
#ifdef G4ANALYSIS_USE
G4double NbProcess = NbOfMu*length*dsigma;
if (histoTh) histoTh->fill(lgeps,NbProcess);
#endif
if (histoTh) histoTh->fill(lgeps, NbProcess);
}
#ifdef G4ANALYSIS_USE
//compare simulation and theory
//
if (histoMC && histoTh) histoManager->GetHistogramFactory()
->divide(label[2*MaxHisto+id], *histoMC, *histoTh);
#endif
////if (histoMC && histoTh) fHistoManager->GetHistogramFactory()
//// ->divide(label[2*MaxHisto+id], *histoMC, *histoTh);
//return integrated crossSection
//
@@ -274,4 +265,4 @@ G4double RunAction::GetEnergyCut(G4Material* material, G4int idParticle)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: StackingAction.cc,v 1.2 2006-06-29 16:49:20 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/StackingAction.cc
/// \brief Implementation of the StackingAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: SteppingAction.cc,v 1.4 2008-03-31 10:22:59 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
/// \file electromagnetic/TestEm17/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,7 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(RunAction* RuAct, HistoManager* Hist)
:runAction(RuAct), histoManager(Hist)
:fRunAction(RuAct), fHistoManager(Hist)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,7 +57,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
//count processes
//
runAction->CountProcesses(procName);
fRunAction->CountProcesses(procName);
//plot energy transfered
//
@@ -76,7 +78,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
else if (procName == "hIoni") id = 5;
else if (procName == "hPairProd") id = 6;
else if (procName == "hBrems") id = 7;
histoManager->FillHisto(id,lgepsE);
fHistoManager->FillHisto(id,lgepsE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm17/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);
}