Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: ActionInitialization.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization()
|
||||
{
|
||||
fMasterRunAction = new RunAction();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
RunAction* run = new RunAction();
|
||||
#else
|
||||
RunAction* run = fMasterRunAction;
|
||||
#endif
|
||||
|
||||
SetUserAction(run);
|
||||
SetUserAction(new EventAction());
|
||||
SetUserAction(new PrimaryGeneratorAction());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(fMasterRunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,185 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 77210 2013-11-22 01:58:38Z adotti $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fTargetMaterial(0), fWorldMaterial(0),
|
||||
fLogicTarget(0), fLogicWorld(0),
|
||||
fDetectorMessenger(0)
|
||||
{
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
|
||||
fRadius = 5.*cm;
|
||||
fLength = 10.*cm;
|
||||
|
||||
fTargetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
|
||||
fWorldMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fDetectorMessenger;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Cleanup old geometry
|
||||
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// Sizes
|
||||
G4double worldR = fRadius + cm;
|
||||
G4double worldZ = fLength + cm;
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4Tubs* solidW = new G4Tubs("World", 0., worldR, 0.5*worldZ, 0., twopi);
|
||||
fLogicWorld = new G4LogicalVolume(solidW, fWorldMaterial,"World");
|
||||
G4VPhysicalVolume* world = new G4PVPlacement(0, G4ThreeVector(),
|
||||
fLogicWorld, "World",
|
||||
0, false, 0);
|
||||
|
||||
//
|
||||
// Target volume
|
||||
//
|
||||
G4Tubs* solidA = new G4Tubs("Target", 0., fRadius, 0.5*fLength, 0.,twopi);
|
||||
fLogicTarget = new G4LogicalVolume( solidA, fTargetMaterial, "Target");
|
||||
new G4PVPlacement(0, G4ThreeVector(), fLogicTarget, "Target",
|
||||
fLogicWorld, false, 0);
|
||||
|
||||
G4cout << "### Target consist of "
|
||||
<< fTargetMaterial->GetName()
|
||||
<< " disks with R(mm)= " << fRadius/mm
|
||||
<< " fLength(mm)= " << fLength/mm
|
||||
<< " ###" << G4endl;
|
||||
|
||||
// colors
|
||||
fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
|
||||
fLogicTarget->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 != fTargetMaterial) {
|
||||
fTargetMaterial = material;
|
||||
if(fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
|
||||
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 != fWorldMaterial) {
|
||||
fWorldMaterial = material;
|
||||
if(fLogicWorld) fLogicWorld->SetMaterial(fWorldMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
|
||||
void DetectorConstruction::SetTargetRadius(G4double val)
|
||||
{
|
||||
if(val > 0.0 && val != fRadius) {
|
||||
fRadius = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetTargetLength(G4double val)
|
||||
{
|
||||
if(val > 0.0 && val != fLength) {
|
||||
fLength = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,121 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 77210 2013-11-22 01:58:38Z adotti $
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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)
|
||||
:G4UImessenger(), fDetector(Det)
|
||||
{
|
||||
ftestDir = new G4UIdirectory("/testhadr/");
|
||||
ftestDir->SetGuidance(" Hadronic Extended Example.");
|
||||
|
||||
fmatCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
|
||||
fmatCmd->SetGuidance("Select Material for the target");
|
||||
fmatCmd->SetParameterName("tMaterial",false);
|
||||
fmatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fmatCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fmat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
|
||||
fmat1Cmd->SetGuidance("Select Material for world");
|
||||
fmat1Cmd->SetParameterName("wMaterial",false);
|
||||
fmat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fmat1Cmd->SetToBeBroadcasted(false);
|
||||
|
||||
frCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
|
||||
frCmd->SetGuidance("Set radius of the target");
|
||||
frCmd->SetParameterName("radius",false);
|
||||
frCmd->SetUnitCategory("Length");
|
||||
frCmd->SetRange("radius>0");
|
||||
frCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
frCmd->SetToBeBroadcasted(false);
|
||||
|
||||
flCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
|
||||
flCmd->SetGuidance("Set length of the target");
|
||||
flCmd->SetParameterName("length",false);
|
||||
flCmd->SetUnitCategory("Length");
|
||||
flCmd->SetRange("length>0");
|
||||
flCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
flCmd->SetToBeBroadcasted(false);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fmatCmd;
|
||||
delete fmat1Cmd;
|
||||
delete frCmd;
|
||||
delete flCmd;
|
||||
delete ftestDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if( command == fmatCmd ) {
|
||||
fDetector->SetTargetMaterial(newValue);
|
||||
} else if( command == fmat1Cmd ) {
|
||||
fDetector->SetWorldMaterial(newValue);
|
||||
} else if( command == frCmd ) {
|
||||
fDetector->SetTargetRadius(frCmd->GetNewDoubleValue(newValue));
|
||||
} else if( command == flCmd ) {
|
||||
fDetector->SetTargetLength(flCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
// $Id: EventAction.cc 70748 2013-06-05 12:00:51Z ihrivnac $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// EventAction
|
||||
//
|
||||
// Created: 21.06.2008 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "EventActionMessenger.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction():
|
||||
G4UserEventAction(),
|
||||
fEventMessenger(0),
|
||||
fUI(0),
|
||||
fSelectedEvents(),
|
||||
fPrintModulo(100),
|
||||
fSelected(0),
|
||||
fDebugStarted(false)
|
||||
{
|
||||
fEventMessenger = new EventActionMessenger(this);
|
||||
fUI = G4UImanager::GetUIpointer();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
{
|
||||
delete fEventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
// New event
|
||||
G4int nEvt = evt->GetEventID();
|
||||
|
||||
if(fSelected>0) {
|
||||
for(G4int i=0; i<fSelected; ++i) {
|
||||
if(nEvt == fSelectedEvents[i]) {
|
||||
fUI->ApplyCommand("/random/saveThisEvent");
|
||||
fUI->ApplyCommand("/tracking/verbose 2");
|
||||
fDebugStarted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize user actions
|
||||
if(G4int(nEvt/fPrintModulo)*fPrintModulo == nEvt) {
|
||||
G4cout << "EventAction: Event # "
|
||||
<< nEvt << " started" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
if(fDebugStarted) {
|
||||
fUI->ApplyCommand("/tracking/verbose 0");
|
||||
fDebugStarted = false;
|
||||
G4cout << "EventAction: Event ended" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,88 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file EventActionMessenger.cc
|
||||
/// \brief Implementation of the EventActionMessenger class
|
||||
//
|
||||
// $Id: EventActionMessenger.cc 70747 2013-06-05 11:56:02Z ihrivnac $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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)
|
||||
: G4UImessenger(), fEventAction(evAct),
|
||||
fPrintCmd(0), fCmd(0)
|
||||
{
|
||||
fPrintCmd = new G4UIcmdWithAnInteger("/testhadr/PrintModulo",this);
|
||||
fPrintCmd->SetGuidance("Print events modulo n");
|
||||
fPrintCmd->SetParameterName("EventNb",false);
|
||||
fPrintCmd->SetRange("EventNb>0");
|
||||
fPrintCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fCmd = new G4UIcmdWithAnInteger("/testhadr/DebugEvent",this);
|
||||
fCmd->SetGuidance("D event to debug");
|
||||
fCmd->SetParameterName("fNb",false);
|
||||
fCmd->SetRange("fNb>0");
|
||||
fCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventActionMessenger::~EventActionMessenger()
|
||||
{
|
||||
delete fPrintCmd;
|
||||
delete fCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventActionMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if(command == fPrintCmd)
|
||||
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
|
||||
if(command == fCmd)
|
||||
{fEventAction->AddEventToDebug(fCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,242 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file HistoManager.cc
|
||||
/// \brief Implementation of the HistoManager class
|
||||
//
|
||||
// $Id: HistoManager.cc 75733 2013-11-05 17:57:53Z vnivanch $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// 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 "G4SystemOfUnits.hh"
|
||||
|
||||
#include "HistoManagerMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
{
|
||||
fAnalysisManager = 0;
|
||||
fHistoName = "hadr00";
|
||||
|
||||
fNeutron = G4Neutron::Neutron();
|
||||
fMessenger = new HistoManagerMessenger(this);
|
||||
fVerbose = 1;
|
||||
|
||||
fParticleName = "proton";
|
||||
fElementName = "Al";
|
||||
|
||||
fMinKinEnergy = 0.1*MeV;
|
||||
fMaxKinEnergy = 10*TeV;
|
||||
fMinMomentum = 1*MeV;
|
||||
fMaxMomentum = 10*TeV;
|
||||
|
||||
fBinsE = 800;
|
||||
fBinsP = 700;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::BeginOfRun()
|
||||
{
|
||||
G4double p1 = std::log10(fMinMomentum/GeV);
|
||||
G4double p2 = std::log10(fMaxMomentum/GeV);
|
||||
G4double e1 = std::log10(fMinKinEnergy/MeV);
|
||||
G4double e2 = std::log10(fMaxKinEnergy/MeV);
|
||||
|
||||
//G4cout<<"e1= "<<e1<<" e2= "<<e2<<" p1= "<<p1<<" p2= "<<p2<<G4endl;
|
||||
|
||||
fAnalysisManager = G4AnalysisManager::Instance();
|
||||
fAnalysisManager->OpenFile(fHistoName+".root");
|
||||
fAnalysisManager->SetFirstHistoId(1);
|
||||
|
||||
fAnalysisManager->CreateH1("h1",
|
||||
"Elastic cross section (barn) as a functions of log10(p/GeV)",
|
||||
fBinsP,p1,p2);
|
||||
fAnalysisManager->CreateH1("h2",
|
||||
"Elastic cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
fAnalysisManager->CreateH1("h3",
|
||||
"Inelastic cross section (barn) as a functions of log10(p/GeV)",
|
||||
fBinsP,p1,p2);
|
||||
fAnalysisManager->CreateH1("h4",
|
||||
"Inelastic cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
fAnalysisManager->CreateH1("h5",
|
||||
"Capture cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
fAnalysisManager->CreateH1("h6",
|
||||
"Fission cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
fAnalysisManager->CreateH1("h7",
|
||||
"Charge exchange cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
fAnalysisManager->CreateH1("h8",
|
||||
"Total cross section (barn) as a functions of log10(E/MeV)",
|
||||
fBinsE,e1,e2);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::EndOfRun()
|
||||
{
|
||||
if(fVerbose > 0) {
|
||||
G4cout << "HistoManager: End of run actions are started" << G4endl;
|
||||
}
|
||||
|
||||
const G4Element* elm =
|
||||
G4NistManager::Instance()->FindOrBuildElement(fElementName);
|
||||
const G4Material* mat =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial("G4_"+fElementName);
|
||||
const G4ParticleDefinition* particle =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(fParticleName);
|
||||
|
||||
G4cout << "### Fill Cross Sections for " << fParticleName
|
||||
<< " off " << fElementName
|
||||
<< G4endl;
|
||||
if(fVerbose > 0) {
|
||||
G4cout << "-------------------------------------------------------------"
|
||||
<< G4endl;
|
||||
G4cout << " N E(MeV) Elastic(b) Inelastic(b)";
|
||||
if(particle == fNeutron) { G4cout << " Capture(b) Fission(b)"; }
|
||||
G4cout << " Total(b)" << G4endl;
|
||||
G4cout << "-------------------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
if(!particle || !elm) {
|
||||
G4cout << "HistoManager WARNING Particle or element undefined" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4int prec = G4cout.precision();
|
||||
G4cout.precision(4);
|
||||
|
||||
G4HadronicProcessStore* store = G4HadronicProcessStore::Instance();
|
||||
G4double mass = particle->GetPDGMass();
|
||||
|
||||
// Build histograms
|
||||
|
||||
G4double p1 = std::log10(fMinMomentum/GeV);
|
||||
G4double p2 = std::log10(fMaxMomentum/GeV);
|
||||
G4double e1 = std::log10(fMinKinEnergy/MeV);
|
||||
G4double e2 = std::log10(fMaxKinEnergy/MeV);
|
||||
G4double de = (e2 - e1)/G4double(fBinsE);
|
||||
G4double dp = (p2 - p1)/G4double(fBinsP);
|
||||
|
||||
G4double x = e1 - de*0.5;
|
||||
G4double e, p, xs, xtot;
|
||||
G4int i;
|
||||
for(i=0; i<fBinsE; i++) {
|
||||
x += de;
|
||||
e = std::pow(10.,x)*MeV;
|
||||
if(fVerbose>0) G4cout << std::setw(5) << i << std::setw(12) << e;
|
||||
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
|
||||
xtot = xs;
|
||||
if(fVerbose>0) G4cout << std::setw(12) << xs/barn;
|
||||
fAnalysisManager->FillH1(2, x, xs/barn);
|
||||
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
|
||||
xtot += xs;
|
||||
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
|
||||
fAnalysisManager->FillH1(4, x, xs/barn);
|
||||
if(particle == fNeutron) {
|
||||
xs = store->GetCaptureCrossSectionPerAtom(particle,e,elm,mat);
|
||||
xtot += xs;
|
||||
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
|
||||
fAnalysisManager->FillH1(5, x, xs/barn);
|
||||
xs = store->GetFissionCrossSectionPerAtom(particle,e,elm,mat);
|
||||
xtot += xs;
|
||||
if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
|
||||
fAnalysisManager->FillH1(6, x, xs/barn);
|
||||
}
|
||||
xs = store->GetChargeExchangeCrossSectionPerAtom(particle,e,elm,mat);
|
||||
if(fVerbose>0) G4cout << " " << std::setw(12) << xtot/barn << G4endl;
|
||||
fAnalysisManager->FillH1(7, x, xs/barn);
|
||||
fAnalysisManager->FillH1(8, x, xtot/barn);
|
||||
}
|
||||
|
||||
x = p1 - dp*0.5;
|
||||
for(i=0; i<fBinsP; i++) {
|
||||
x += dp;
|
||||
p = std::pow(10.,x)*GeV;
|
||||
e = std::sqrt(p*p + mass*mass) - mass;
|
||||
xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
|
||||
fAnalysisManager->FillH1(1, x, xs/barn);
|
||||
xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
|
||||
fAnalysisManager->FillH1(3, x, xs/barn);
|
||||
}
|
||||
if(fVerbose > 0) {
|
||||
G4cout << "-------------------------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
fAnalysisManager->Write();
|
||||
fAnalysisManager->CloseFile();
|
||||
|
||||
delete fAnalysisManager;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SetVerbose(G4int val)
|
||||
{
|
||||
fVerbose = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file HistoManagerMessenger.cc
|
||||
/// \brief Implementation of the HistoManagerMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: HistoManagerMessenger.cc 70747 2013-06-05 11:56:02Z ihrivnac $
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HistoManagerMessenger
|
||||
//
|
||||
// Created: 20.06.08 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "HistoManagerMessenger.hh"
|
||||
|
||||
#include "HistoManager.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......
|
||||
|
||||
HistoManagerMessenger::HistoManagerMessenger(HistoManager * p)
|
||||
:G4UImessenger(), fHisto(p)
|
||||
{
|
||||
fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this);
|
||||
fbinCmd->SetGuidance("Set number of bins for energy");
|
||||
fbinCmd->SetParameterName("NEbins",false);
|
||||
fbinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this);
|
||||
fnOfAbsCmd->SetGuidance("Set number of bins for momentum");
|
||||
fnOfAbsCmd->SetParameterName("NPbins",false);
|
||||
fnOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fpartCmd = new G4UIcmdWithAString("/testhadr/particle",this);
|
||||
fpartCmd->SetGuidance("Set particle name");
|
||||
fpartCmd->SetParameterName("Particle",false);
|
||||
fpartCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm",this);
|
||||
fcsCmd->SetGuidance("Set element name");
|
||||
fcsCmd->SetParameterName("Elm",false);
|
||||
fcsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this);
|
||||
fe1Cmd->SetGuidance("Set min kinetic energy");
|
||||
fe1Cmd->SetParameterName("eMin",false);
|
||||
fe1Cmd->SetUnitCategory("Energy");
|
||||
fe1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this);
|
||||
fe2Cmd->SetGuidance("Set max kinetic energy");
|
||||
fe2Cmd->SetParameterName("eMax",false);
|
||||
fe2Cmd->SetUnitCategory("Energy");
|
||||
fe2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this);
|
||||
fp1Cmd->SetGuidance("Set min momentum");
|
||||
fp1Cmd->SetParameterName("pMin",false);
|
||||
fp1Cmd->SetUnitCategory("Energy");
|
||||
fp1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this);
|
||||
fp2Cmd->SetGuidance("Set max momentum");
|
||||
fp2Cmd->SetParameterName("pMax",false);
|
||||
fp2Cmd->SetUnitCategory("Energy");
|
||||
fp2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this);
|
||||
fverbCmd->SetGuidance("Set verbose for ");
|
||||
fverbCmd->SetParameterName("verb",false);
|
||||
fverbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fFCmd = new G4UIcmdWithAString("/testhadr/fileName",this);
|
||||
fFCmd->SetGuidance("set name for the histograms file");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManagerMessenger::~HistoManagerMessenger()
|
||||
{
|
||||
delete fnOfAbsCmd;
|
||||
delete fpartCmd;
|
||||
delete fcsCmd;
|
||||
delete fe1Cmd;
|
||||
delete fe2Cmd;
|
||||
delete fp1Cmd;
|
||||
delete fp2Cmd;
|
||||
delete fverbCmd;
|
||||
delete fFCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManagerMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if( command == fbinCmd ) {
|
||||
fHisto->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue));
|
||||
} else if( command == fnOfAbsCmd ) {
|
||||
fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue));
|
||||
} else if( command == fverbCmd ) {
|
||||
fHisto->SetVerbose(fverbCmd->GetNewIntValue(newValue));
|
||||
} else if( command == fpartCmd ) {
|
||||
fHisto->SetParticleName(newValue);
|
||||
} else if( command == fcsCmd ) {
|
||||
fHisto->SetElementName(newValue);
|
||||
} else if( command == fe1Cmd ) {
|
||||
fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue));
|
||||
} else if( command == fe2Cmd ) {
|
||||
fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue));
|
||||
} else if( command == fp1Cmd ) {
|
||||
fHisto->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue));
|
||||
} else if( command == fp2Cmd ) {
|
||||
fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue));
|
||||
} else if( command == fFCmd ) {
|
||||
fHisto->SetHistoName(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 70747 2013-06-05 11:56:02Z ihrivnac $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PrimaryGeneratorAction
|
||||
//
|
||||
// Created: 20.06.2008 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
|
||||
{
|
||||
fParticleGun = new G4ParticleGun(1);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(1.*GeV);
|
||||
fParticleGun->SetParticleDefinition(G4Proton::Proton());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,107 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
// $Id: RunAction.hh,v 1.1 2008-07-07 16:37:26 vnivanch Exp $
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 class file
|
||||
// RunAction
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction()
|
||||
{
|
||||
fHisto = new HistoManager();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete fHisto;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4bool show = true;
|
||||
if(G4Threading::IsWorkerThread() == true) { show = false; }
|
||||
|
||||
if(show) {
|
||||
G4int id = aRun->GetRunID();
|
||||
G4cout << "### Run " << id << " start" << G4endl;
|
||||
fHisto->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*)
|
||||
{
|
||||
G4bool show = true;
|
||||
if(G4Threading::IsWorkerThread() == true) { show = false; }
|
||||
|
||||
if(show) {
|
||||
G4cout << "RunAction: End of run actions are started" << G4endl;
|
||||
fHisto->EndOfRun();
|
||||
}
|
||||
#ifdef G4VIS_USE
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user