Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorConstruction.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
/////////////////////////////////////////////////////////////////////////
//
// DetectorConstruction
//
// Created: 20.06.2008 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4RunManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
{
logicTarget = 0;
logicWorld = 0;
detectorMessenger = new DetectorMessenger(this);
radius = 5.*cm;
length = 10.*cm;
targetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{
delete detectorMessenger;
}
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// Sizes
G4double worldR = radius + cm;
G4double worldZ = length + cm;
//
// World
//
G4Tubs* solidW = new G4Tubs("World",0.,worldR,worldZ/2.0,0.,twopi);
logicWorld = new G4LogicalVolume( solidW,worldMaterial,"World");
G4VPhysicalVolume* world = new G4PVPlacement(0,G4ThreeVector(),
logicWorld,"World",0,false,0);
//
// Target volume
//
G4Tubs* solidA = new G4Tubs("Target",0.,radius,length/2.0,0.,twopi);
logicTarget = new G4LogicalVolume( solidA,targetMaterial,"Target");
new G4PVPlacement(0,G4ThreeVector(),logicTarget,"Target",logicWorld,false,0);
G4cout << "### Target consist of "
<< targetMaterial->GetName()
<< " disks with R(mm)= " << radius/mm
<< " Length(mm)= " << length/mm
<< " ###" << G4endl;
// colors
logicWorld->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
logicTarget->SetVisAttributes(regCcolor);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
return world;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetTargetMaterial(const G4String& mat)
{
// search the material by its name
G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (material && material != targetMaterial) {
targetMaterial = material;
if(logicTarget) logicTarget->SetMaterial(targetMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldMaterial(const G4String& mat)
{
// search the material by its name
G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(mat);
if (material && material != worldMaterial) {
worldMaterial = material;
if(logicWorld) logicWorld->SetMaterial(worldMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetTargetRadius(G4double val)
{
if(val > 0.0 && val != radius) {
radius = val;
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetTargetLength(G4double val)
{
if(val > 0.0 && val != length) {
length = val;
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,199 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
/////////////////////////////////////////////////////////////////////////
//
// DetectorMessenger
//
// Created: 20.06.08 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "HistoManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
{
testDir = new G4UIdirectory("/testhadr/");
testDir->SetGuidance(" Hadronic Extended Example.");
matCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
matCmd->SetGuidance("Select Material for the target");
matCmd->SetParameterName("tMaterial",false);
matCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
mat1Cmd->SetGuidance("Select Material for world");
mat1Cmd->SetParameterName("wMaterial",false);
mat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
rCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
rCmd->SetGuidance("Set radius of the target");
rCmd->SetParameterName("radius",false);
rCmd->SetUnitCategory("Length");
rCmd->SetRange("radius>0");
rCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
lCmd->SetGuidance("Set length of the target");
lCmd->SetParameterName("length",false);
lCmd->SetUnitCategory("Length");
lCmd->SetRange("length>0");
lCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
binCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this);
binCmd->SetGuidance("Set number of bins for energy");
binCmd->SetParameterName("NEbins",false);
binCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
nOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this);
nOfAbsCmd->SetGuidance("Set number of bins for momentum");
nOfAbsCmd->SetParameterName("NPbins",false);
nOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
updateCmd = new G4UIcmdWithoutParameter("/testhadr/update",this);
updateCmd->SetGuidance("Update geometry.");
updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
updateCmd->SetGuidance("if you changed geometrical value(s)");
updateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
partCmd = new G4UIcmdWithAString("/testhadr/particle",this);
partCmd->SetGuidance("Set particle name");
partCmd->SetParameterName("Particle",false);
partCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
csCmd = new G4UIcmdWithAString("/testhadr/targetElm",this);
csCmd->SetGuidance("Set element name");
csCmd->SetParameterName("Elm",false);
csCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
e1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this);
e1Cmd->SetGuidance("Set min kinetic energy");
e1Cmd->SetParameterName("eMin",false);
e1Cmd->SetUnitCategory("Energy");
e1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
e2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this);
e2Cmd->SetGuidance("Set max kinetic energy");
e2Cmd->SetParameterName("eMax",false);
e2Cmd->SetUnitCategory("Energy");
e2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
p1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this);
p1Cmd->SetGuidance("Set min momentum");
p1Cmd->SetParameterName("pMin",false);
p1Cmd->SetUnitCategory("Energy");
p1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
p2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this);
p2Cmd->SetGuidance("Set max momentum");
p2Cmd->SetParameterName("pMax",false);
p2Cmd->SetUnitCategory("Energy");
p2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this);
verbCmd->SetGuidance("Set verbose for ");
verbCmd->SetParameterName("verb",false);
verbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete matCmd;
delete mat1Cmd;
delete rCmd;
delete lCmd;
delete nOfAbsCmd;
delete updateCmd;
delete testDir;
delete partCmd;
delete csCmd;
delete e1Cmd;
delete e2Cmd;
delete p1Cmd;
delete p2Cmd;
delete verbCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
HistoManager* histo = HistoManager::GetPointer();
if( command == matCmd ) {
Detector->SetTargetMaterial(newValue);
} else if( command == mat1Cmd ) {
Detector->SetWorldMaterial(newValue);
} else if( command == rCmd ) {
Detector->SetTargetRadius(rCmd->GetNewDoubleValue(newValue));
} else if( command == lCmd ) {
Detector->SetTargetLength(lCmd->GetNewDoubleValue(newValue));
} else if( command == updateCmd ) {
Detector->UpdateGeometry();
} else if( command == binCmd ) {
histo->SetNumberOfBinsE(binCmd->GetNewIntValue(newValue));
} else if( command == nOfAbsCmd ) {
histo->SetNumberOfBinsP(nOfAbsCmd->GetNewIntValue(newValue));
} else if( command == verbCmd ) {
histo->SetVerbose(verbCmd->GetNewIntValue(newValue));
} else if( command == partCmd ) {
histo->SetParticleName(newValue);
} else if( command == csCmd ) {
histo->SetElementName(newValue);
} else if( command == e1Cmd ) {
histo->SetMinKinEnergy(e1Cmd->GetNewDoubleValue(newValue));
} else if( command == e2Cmd ) {
histo->SetMaxKinEnergy(e2Cmd->GetNewDoubleValue(newValue));
} else if( command == p1Cmd ) {
histo->SetMinMomentum(p1Cmd->GetNewDoubleValue(newValue));
} else if( command == p2Cmd ) {
histo->SetMaxMomentum(p2Cmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+126
View File
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventAction.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
/////////////////////////////////////////////////////////////////////////
//
// EventAction
//
// Created: 21.06.2008 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
#include "EventAction.hh"
#include "G4Event.hh"
#include "EventActionMessenger.hh"
#include "G4UImanager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::EventAction():
printModulo(100),
nSelected(0),
drawFlag("all"),
debugStarted(false)
{
eventMessenger = new EventActionMessenger(this);
UI = G4UImanager::GetUIpointer();
selectedEvents.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::~EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::BeginOfEventAction(const G4Event* evt)
{
// New event
G4int nEvt = evt->GetEventID();
if(nSelected>0) {
for(G4int i=0; i<nSelected; i++) {
if(nEvt == selectedEvents[i]) {
UI->ApplyCommand("/random/saveThisEvent");
UI->ApplyCommand("/tracking/verbose 2");
debugStarted = true;
break;
}
}
}
// Initialize user actions
if(G4int(nEvt/printModulo)*printModulo == nEvt) {
G4cout << "EventAction: Event # "
<< nEvt << " started" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::EndOfEventAction(const G4Event* evt)
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager) {
G4TrajectoryContainer* trjc = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trjc) n_trajectories = trjc->entries();
for(G4int i=0; i<n_trajectories; i++) {
G4Trajectory* t = (G4Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") t->DrawTrajectory(1000);
else if ((drawFlag == "charged")&&(t->GetCharge() != 0.))
t->DrawTrajectory(1000);
else if ((drawFlag == "neutral")&&(t->GetCharge() == 0.))
t->DrawTrajectory(1000);
else if ((drawFlag == "charged+n")&&((t->GetCharge() != 0.)||
(t->GetCharge()==0.&&t->GetParticleName()=="neutron")))
t->DrawTrajectory(1000);
}
}
if(debugStarted) {
UI->ApplyCommand("/tracking/verbose 0");
debugStarted = false;
G4cout << "EventAction: Event ended" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventActionMessenger.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
/////////////////////////////////////////////////////////////////////////
//
// EventActionMessenger
//
// Created: 31.01.03 V.Ivanchenko
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
////////////////////////////////////////////////////////////////////////
//
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
:eventAction(EvAct)
{
drawCmd = new G4UIcmdWithAString("/testhadr/DrawTracks", this);
drawCmd->SetGuidance("Draw the tracks in the event");
drawCmd->SetGuidance(" Choice : neutral, charged, all");
drawCmd->SetParameterName("choice",true);
drawCmd->SetDefaultValue("all");
drawCmd->SetCandidates("none charged all");
drawCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
printCmd = new G4UIcmdWithAnInteger("/testhadr/PrintModulo",this);
printCmd->SetGuidance("Print events modulo n");
printCmd->SetParameterName("EventNb",false);
printCmd->SetRange("EventNb>0");
printCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dCmd = new G4UIcmdWithAnInteger("/testhadr/DebugEvent",this);
dCmd->SetGuidance("D event to debug");
dCmd->SetParameterName("fNb",false);
dCmd->SetRange("fNb>0");
dCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::~EventActionMessenger()
{
delete drawCmd;
delete printCmd;
delete dCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == drawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == printCmd)
{eventAction->SetPrintModulo(printCmd->GetNewIntValue(newValue));}
if(command == dCmd)
{eventAction->AddEventToDebug(dCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,254 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//---------------------------------------------------------------------------
//
// ClassName: Histo - Generic histogram/ntuple manager class
//
//
// Author: V.Ivanchenko 30.10.03
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Histo.hh"
#include "HistoMessenger.hh"
#ifdef G4ANALYSIS_USE
#include <AIDA/AIDA.h>
#endif
//#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Histo::Histo(G4int ver)
{
verbose = ver;
histName = "histo";
histType = "hbook";
option = "--noErrors uncompress";
nHisto = 0;
defaultAct = 1;
messenger = new HistoMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Histo::~Histo()
{
delete messenger;
#ifdef G4ANALYSIS_USE
for(G4int i=0; i<nHisto; i++) {
if(histo[i]) delete histo[i];
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::book()
{
#ifdef G4ANALYSIS_USE
G4cout << "### Histo books " << nHisto << " histograms " << G4endl;
// Creating the analysis factory
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
if(verbose>0)
G4cout<<"Histo books analysis factory"<<G4endl;
// Creating the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
if(verbose>0)
G4cout<<"Histo books tree factory ......... "<<G4endl;
// Creating a tree mapped to a new hbook file.
G4String name = histName + "." + histType;
tree = tf->create(name, histType, false, true, option);
G4cout << "Histo: tree store : " << tree->storeName() << G4endl;
// Creating a histogram factory, whose histograms will be handled by the tree
AIDA::IHistogramFactory* hf = af->createHistogramFactory( *tree );
// Creating an 1-dimensional histograms in the root directory of the tree
for(G4int i=0; i<nHisto; i++) {
if(active[i]) {
if(verbose>0)
G4cout<<" I am in book: histogram "<< i << " id= " << ids[i] <<G4endl;
histo[i] = hf->createHistogram1D(ids[i], tittles[i], bins[i], xmin[i], xmax[i]);
}
}
delete hf;
delete tf;
delete af;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::save()
{
#ifdef G4ANALYSIS_USE
// Write histogram file
tree->commit();
G4cout << "Closing the tree..." << G4endl;
tree->close();
G4cout << "Histograms and Ntuples are saved" << G4endl;
reset();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::reset()
{
#ifdef G4ANALYSIS_USE
for(G4int i=0; i<nHisto; i++) {
if(histo[i]) histo[i]->reset();
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setFileType(const G4String& nam)
{
if(nam == "hbook" || nam == "root" || nam == "aida") histType = nam;
else if(nam == "XML" || nam == "xml") histType = "aida";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::add1D(const G4String& id, const G4String& name, G4int nb,
G4double x1, G4double x2, G4double u)
{
if(nHisto > 0) {
for(G4int i=0; i<nHisto; i++) {
if(ids[i] == id) return;
}
}
if(verbose > 0)
G4cout << "New histogram will be booked: #" << id << " <" << name
<< " " << nb << " " << x1 << " " << x2 << " " << u
<< G4endl;
nHisto++;
x1 /= u;
x2 /= u;
active.push_back(defaultAct);
bins.push_back(nb);
xmin.push_back(x1);
xmax.push_back(x2);
unit.push_back(u);
ids.push_back(id);
tittles.push_back(name);
histo.push_back(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setHisto1D(G4int i, G4int nb, G4double x1, G4double x2, G4double u)
{
if(i>=0 && i<nHisto) {
if(verbose > 0)
{
G4cout << "Update histogram: #" << i
<< " " << nb << " " << x1 << " " << x2 << " " << u
<< G4endl;
}
bins[i] = nb;
xmin[i] = x1;
xmax[i] = x2;
unit[i] = u;
} else {
G4cout << "Histo::setHisto1D: WARNING! wrong histogram index " << i << G4endl;
G4cout << "nHisto = " << nHisto << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::fill(G4int i, G4double x, G4double w)
{
if(verbose > 1) {
G4cout << "fill histogram: #" << i << " at x= " << x
<< " weight= " << w << " unit= " << unit[i]
<< G4endl;
}
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
histo[i]->fill(x/unit[i], w);
//histo[i]->fill((float)(x/unit[i]), (float)w);
} else {
G4cout << "Histo::fill: WARNING! wrong histogram index " << i << G4endl;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::scale(G4int i, G4double x)
{
if(verbose > 0)
G4cout << "Scale histogram: #" << i << " by factor " << x << G4endl;
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
histo[i]->scale(x);
} else {
G4cout << "Histo::scale: WARNING! wrong histogram index " << i << G4endl;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::print(G4int i)
{
G4cout<<"### Histogram "<<i<<" ###"<<G4endl;
#ifdef G4ANALYSIS_USE
if(i>=0 && i<nHisto) {
G4double step = (xmax[i] - xmin[i])/G4double( bins[i]);
G4double x = xmin[i] - step*0.5;
G4double y, maxX=0, maxY=0;
G4int maxJ=0;
for(G4int j=0; j<bins[i]; j++) {
x += step;
y = histo[i]->binHeight(j);
if(maxY < y) {maxY = y; maxX = x; maxJ = j;}
G4cout<<x<<" "<<y<<G4endl;
}
G4cout<<" maxJ "<<maxJ<<" maxX "<<maxX<<" maxY "<<maxY<<G4endl;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,251 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.4 2008/11/20 11:59:06 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//---------------------------------------------------------------------------
//
// ClassName: HistoManager
//
//
// Author: V.Ivanchenko 30/01/01
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include "G4Neutron.hh"
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4NistManager.hh"
#include "G4HadronicProcessStore.hh"
#include "G4NucleiProperties.hh"
#include "G4NistManager.hh"
#include "G4StableIsotopes.hh"
#include "Histo.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager* HistoManager::fManager = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager* HistoManager::GetPointer()
{
if(!fManager) {
static HistoManager manager;
fManager = &manager;
}
return fManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager::HistoManager()
{
histo = new Histo(verbose);
neutron = G4Neutron::Neutron();
verbose = 1;
particleName = "proton";
elementName = "Al";
minKinEnergy = 0.1*MeV;
maxKinEnergy = 1*TeV;
minMomentum = 1*MeV;
maxMomentum = 100*TeV;
nBinsE = 700;
nBinsP = 800;
needsReset = false;
isInitialised = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager::~HistoManager()
{
delete histo;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::BeginOfRun()
{
needsReset = false;
G4double p1 = std::log10(minMomentum/GeV);
G4double p2 = std::log10(maxMomentum/GeV);
G4double e1 = std::log10(minKinEnergy/MeV);
G4double e2 = std::log10(maxKinEnergy/MeV);
//G4cout<<"e1= "<<e1<<" e2= "<<e2<<" p1= "<<p1<<" p2= "<<p2<<G4endl;
if(isInitialised) {
histo->setHisto1D(0,nBinsP,p1,p2);
histo->setHisto1D(1,nBinsE,e1,e2);
histo->setHisto1D(2,nBinsP,p1,p2);
histo->setHisto1D(3,nBinsE,e1,e2);
histo->setHisto1D(4,nBinsE,e1,e2);
histo->setHisto1D(5,nBinsE,e1,e2);
histo->setHisto1D(6,nBinsE,e1,e2);
} else {
histo->add1D("h1","Elastic cross section (barn) as a functions of log10(p/GeV)",
nBinsP,p1,p2);
histo->add1D("h2","Elastic cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h3","Inelastic cross section (barn) as a functions of log10(p/GeV)",
nBinsP,p1,p2);
histo->add1D("h4","Inelastic cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h5","Capture cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h6","Fission cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
histo->add1D("h7","Charge exchange cross section (barn) as a functions of log10(E/MeV)",
nBinsE,e1,e2);
}
isInitialised = true;
histo->book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::EndOfRun()
{
if(verbose > 0) {
G4cout << "HistoManager: End of run actions are started" << G4endl;
}
if(needsReset) BeginOfRun();
const G4Element* elm =
G4NistManager::Instance()->FindOrBuildElement(elementName);
const G4ParticleDefinition* particle =
G4ParticleTable::GetParticleTable()->FindParticle(particleName);
G4cout << "### Fill Cross Sections for " << particleName
<< " off " << elementName
<< G4endl;
if(verbose > 0) {
G4cout << "-------------------------------------------------------------"
<< G4endl;
G4cout << " N E(MeV) Elastic(barn) Inelastic(barn)";
if(particle == neutron) G4cout << " Capture(barn) Fission(barn)";
G4cout << " ChargeExchange(barn)" << G4endl;
G4cout << "-------------------------------------------------------------"
<< G4endl;
}
if(!particle || !elm) {
G4cout << "HistoManager WARNING Particle or element undefined" << G4endl;
return;
}
G4int prec = G4cout.precision();
G4cout.precision(7);
G4HadronicProcessStore* store = G4HadronicProcessStore::Instance();
G4double mass = particle->GetPDGMass();
// Build histograms
G4double p1 = std::log10(minMomentum/GeV);
G4double p2 = std::log10(maxMomentum/GeV);
G4double e1 = std::log10(minKinEnergy/MeV);
G4double e2 = std::log10(maxKinEnergy/MeV);
G4double de = (e2 - e1)/G4double(nBinsE);
G4double dp = (p2 - p1)/G4double(nBinsP);
G4double x = e1 - de*0.5;
G4double e, p, xs;
G4int i;
for(i=0; i<nBinsE; i++) {
x += de;
e = std::pow(10.,x)*MeV;
if(verbose>0) G4cout << std::setw(5) << i << std::setw(12) << e;
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << std::setw(14) << xs/barn;
histo->fill(1, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << " " << std::setw(17) << xs/barn;
histo->fill(3, x, xs/barn);
if(particle == neutron) {
xs = store->GetCaptureCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << " " << std::setw(17) << xs/barn;
histo->fill(4, x, xs/barn);
xs = store->GetFissionCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << " " << std::setw(17) << xs/barn;
histo->fill(5, x, xs/barn);
}
xs = store->GetChargeExchangeCrossSectionPerAtom(particle,e,elm);
if(verbose>0) G4cout << " " << std::setw(17) << xs/barn;
histo->fill(6, x, xs/barn);
if(verbose>0) G4cout << G4endl;
}
x = p1 - dp*0.5;
for(i=0; i<nBinsP; i++) {
x += dp;
p = std::pow(10.,x)*GeV;
e = std::sqrt(p*p + mass*mass) - mass;
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm);
histo->fill(0, x, xs/barn);
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm);
histo->fill(2, x, xs/barn);
}
if(verbose > 0) {
G4cout << "---------------------------------------------------------"
<< G4endl;
}
G4cout.precision(prec);
if(verbose > 1) histo->print(0);
histo->save();
histo->reset();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::SetVerbose(G4int val)
{
verbose = val;
histo->setVerbose(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,139 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: HistoMessenger.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
/////////////////////////////////////////////////////////////////////////
//
// HistoMessenger
//
// Created: 31.01.2003 V.Ivanchenko
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
////////////////////////////////////////////////////////////////////////
//
#include "HistoMessenger.hh"
#include "Histo.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(Histo* man) : histo (man)
{
factoryCmd = new G4UIcmdWithAString("/testhadr/HistoName",this);
factoryCmd->SetGuidance("set name for the histograms file");
fileCmd = new G4UIcmdWithAString("/testhadr/HistoType",this);
fileCmd->SetGuidance("set type (hbook, root, aida) for the histograms file");
fileCmd->SetCandidates("hbook root aida");
optCmd = new G4UIcmdWithAString("/testhadr/HistoOption",this);
optCmd->SetGuidance("set AIDA option for the histograms file");
printCmd = new G4UIcmdWithAnInteger("/testhadr/HistoPrint",this);
printCmd->SetGuidance("Print histogram by ID, if ID=0 - all.");
printCmd->SetParameterName("pr",false);
printCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
histoCmd = new G4UIcommand("/testhadr/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);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete fileCmd;
delete histoCmd;
delete factoryCmd;
delete optCmd;
delete printCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == factoryCmd)
histo->setFileName(newValues);
if (command == fileCmd)
histo->setFileType(newValues);
if (command == optCmd)
histo->setFileOption(newValues);
if (command == printCmd)
histo->print(printCmd->GetNewIntValue(newValues));
if (command == histoCmd) {
G4int ih, nbBins;
G4double vmin,vmax;
G4String unit;
std::istringstream is(newValues);
is >> ih >> nbBins >> vmin >> vmax >> unit;
G4double vUnit = 1. ;
if (unit != "none" && unit != "") vUnit = G4UIcommand::ValueOf(unit);
histo->setHisto1D(ih,nbBins,vmin,vmax,vUnit);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
/////////////////////////////////////////////////////////////////////////
//
// PrimaryGeneratorAction
//
// Created: 20.06.2008 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
#include "PrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
particleGun = new G4ParticleGun(1);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+97
View File
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/////////////////////////////////////////////////////////////////////////
//
// RunAction
//
// Created: 21.06.2008 V.Ivanchenko
//
// Modified:
//
////////////////////////////////////////////////////////////////////////
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4Run.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
HistoManager* manager = HistoManager::GetPointer();
G4int id = aRun->GetRunID();
if(manager->GetVerbose()>0) {
G4cout << "### Run " << id << " start" << G4endl;
}
manager->BeginOfRun();
#ifdef G4VIS_USE
G4UImanager* UI = G4UImanager::GetUIpointer();
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::EndOfRunAction(const G4Run*)
{
HistoManager* manager = HistoManager::GetPointer();
if(manager->GetVerbose()>0) {
G4cout << "RunAction: End of run actions are started" << G4endl;
}
manager->EndOfRun();
#ifdef G4VIS_USE
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....