Import Geant4 8.3.0 source tree
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.3 2006/06/29 16:47:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: DetectorConstruction.cc,v 1.4 2007/01/18 09:07:20 hbu Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
@@ -194,6 +195,23 @@ void DetectorConstruction::SetMaxStepSize(G4double val)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetMaxStepLength(G4double val)
|
||||
{
|
||||
// set the maximum length of tracking step
|
||||
//
|
||||
if (val <= DBL_MIN)
|
||||
{ G4cout << "\n --->warning from SetMaxStepLength: maxStep "
|
||||
<< val << " out of range. Command refused" << G4endl;
|
||||
return;
|
||||
}
|
||||
G4TransportationManager* tmanager =
|
||||
G4TransportationManager::GetTransportationManager();
|
||||
tmanager->GetPropagatorInField()
|
||||
->SetLargestAcceptableStep(val);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:47:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: DetectorMessenger.cc,v 1.3 2007/01/18 09:07:20 hbu Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -79,6 +79,16 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
MaxStepCmd->SetRange("Size>0.");
|
||||
MaxStepCmd->SetUnitCategory("Length");
|
||||
MaxStepCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
trackdir = new G4UIdirectory("/testem/tracking/");
|
||||
trackdir->SetGuidance("step length");
|
||||
MaxStepLength = new G4UIcmdWithADoubleAndUnit("/testem/tracking/setMaxStepLength",this);
|
||||
MaxStepLength->SetGuidance("Set the maximum length of tracking step");
|
||||
MaxStepLength->SetGuidance("when integrating magnetic field line.");
|
||||
MaxStepLength->SetParameterName("Size",false);
|
||||
MaxStepLength->SetRange("Size>0.");
|
||||
MaxStepLength->SetUnitCategory("Length");
|
||||
MaxStepLength->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -90,8 +100,10 @@ DetectorMessenger::~DetectorMessenger()
|
||||
delete MagFieldCmd;
|
||||
delete UpdateCmd;
|
||||
delete MaxStepCmd;
|
||||
delete MaxStepLength;
|
||||
delete detDir;
|
||||
delete testemDir;
|
||||
delete trackdir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -112,6 +124,9 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
|
||||
if( command == MaxStepCmd )
|
||||
{ Detector->SetMaxStepSize(MaxStepCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == MaxStepLength )
|
||||
{ Detector->SetMaxStepLength(MaxStepLength->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//....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)
|
||||
{
|
||||
#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] = "testem16";
|
||||
fileType = "hbook";
|
||||
fileOption = "--noErrors uncompress";
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) {
|
||||
histo[k] = 0;
|
||||
exist[k] = false;
|
||||
Unit[k] = 1.0;
|
||||
Width[k] = 1.0;
|
||||
}
|
||||
|
||||
histoMessenger = new HistoMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete histoMessenger;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete af;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::book()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(!af) {
|
||||
G4cout << "HistoManager::book: WARNING AnalysisFactory is not created,"
|
||||
<< " there will be no AIDA histos" << G4endl;
|
||||
return;
|
||||
}
|
||||
G4cout << "\n----> Book AIDA histograms "<< G4endl;
|
||||
|
||||
// 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 in " << fileName[1] << G4endl;
|
||||
#else
|
||||
G4cout << "G4ANALYSIS_USE was not set, there will be no AIDA histos"
|
||||
<< G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....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 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" };
|
||||
const G4String title[] =
|
||||
{ "dummy", //0
|
||||
"SynRad Energy", //1
|
||||
"SynRad Power ", //2
|
||||
"Path Length" //3
|
||||
};
|
||||
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
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......
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//....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);
|
||||
|
||||
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
|
||||
rmhistoCmd->SetGuidance("desactivate histo #id");
|
||||
rmhistoCmd->SetParameterName("id",false);
|
||||
rmhistoCmd->SetRange("id>0");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoMessenger::~HistoMessenger()
|
||||
{
|
||||
delete rmhistoCmd;
|
||||
delete histoCmd;
|
||||
delete 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 == rmhistoCmd)
|
||||
histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.6 2006/06/29 16:48:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: RunAction.cc,v 1.8 2007/01/18 10:24:35 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -36,82 +36,24 @@
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction()
|
||||
:af(0), tree(0)
|
||||
RunAction::RunAction(HistoManager* histo)
|
||||
:histoManager(histo)
|
||||
{
|
||||
for (G4int j=0; j<n_histos; j++) histo[j] = 0;
|
||||
n_gam_sync = 0;
|
||||
e_gam_sync = 0;
|
||||
e_gam_sync2 = 0;
|
||||
e_gam_sync_max =0;
|
||||
lam_gam_sync = 0;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Creating the analysis factory
|
||||
af = AIDA_createAnalysisFactory();
|
||||
|
||||
if (af) {
|
||||
// Creating the tree factory
|
||||
AIDA::ITreeFactory* tf = af->createTreeFactory();
|
||||
|
||||
// Creating a tree mapped to an hbook file.
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
G4String options = "--noErrors uncompress";
|
||||
tree = tf->create("testem16.hbook","hbook",readOnly,createNew,options);
|
||||
//tree = tf->create("testem16.root", "root",readOnly,createNew,options);
|
||||
//tree = tf->create("testem16.xml" ,"xml" ,readOnly,createNew,options);
|
||||
delete tf;
|
||||
|
||||
if (tree) {
|
||||
// Creating a histogram factory
|
||||
AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
|
||||
|
||||
// Creating histograms
|
||||
const G4double Ecr=66.5025;
|
||||
histo[0] = hf->createHistogram1D("1","SynRad Energy in keV",100, 0 ,5.*Ecr);
|
||||
histo[1] = hf->createHistogram1D("2","SynRad Power in keV",100, 0 ,5.*Ecr);
|
||||
histo[2] = hf->createHistogram1D("3","Path Length in m",100, 0, 1.6);
|
||||
|
||||
delete hf;
|
||||
G4cout << "\n----> Histogram tree is opened" << G4endl;
|
||||
}
|
||||
}
|
||||
G4cout << "G4ANALYSIS_USE was set, there will be AIDA histos" << '\n';
|
||||
#else
|
||||
G4cout << "G4ANALYSIS_USE was not set, there will be no AIDA histos" << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
bool debug=true;
|
||||
bool Commit_Ok=tree->commit(); // Writing the histograms to the file
|
||||
if (Commit_Ok)
|
||||
{ if(debug) G4cout << "tree->commit() ok. Writing of histogram file done"
|
||||
<< '\n';
|
||||
}
|
||||
else if(!Commit_Ok)
|
||||
{ G4cout << "tree->commit() not successful, no histogram file written"
|
||||
<< '\n';
|
||||
}
|
||||
tree->close(); // and closing the tree (and the file)
|
||||
|
||||
delete tree;
|
||||
delete af;
|
||||
#endif
|
||||
}
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -122,6 +64,9 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
// save Rndm status
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
//book histograms
|
||||
histoManager->book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -145,6 +90,10 @@ void RunAction::EndOfRunAction(const G4Run*)
|
||||
|
||||
// show Rndm status
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
//save histograms
|
||||
histoManager->save();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: SteppingAction.cc,v 1.4 2006/06/29 16:48:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: SteppingAction.cc,v 1.5 2007/01/18 09:07:20 hbu Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -35,15 +35,12 @@
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/IHistogram1D.h"
|
||||
#endif
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(RunAction* RuAct)
|
||||
:runAction(RuAct)
|
||||
SteppingAction::SteppingAction(RunAction* RuAct, HistoManager* histo)
|
||||
:runAction(RuAct), histoManager(histo)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -96,17 +93,10 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
<< " PGamma=" << G4BestUnit(PGamma,"Energy")
|
||||
<< " #secondaries lp=" << lp
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// fill histos
|
||||
if( runAction->GetHisto(0) ) // check the histos exist
|
||||
{
|
||||
runAction->GetHisto(0)->fill(Egamma/keV);
|
||||
runAction->GetHisto(1)->fill(Egamma/keV,Egamma/keV);
|
||||
runAction->GetHisto(2)->fill(aStep->GetStepLength()/m);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
histoManager->FillHisto(1,Egamma);
|
||||
histoManager->FillHisto(2,Egamma,Egamma/keV); // power spectrum : gamma weighted with its energy
|
||||
histoManager->FillHisto(3,aStep->GetStepLength());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user