Import Geant4 8.1.0 source tree
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: CheckVolumeSD.cc,v 1.3 2006/06/29 17:24:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CheckVolumeSD
|
||||
//
|
||||
// Created: 31.01.2003 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "CheckVolumeSD.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
CheckVolumeSD::CheckVolumeSD(const G4String& name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
theHisto = HistoManager::GetPointer();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
CheckVolumeSD::~CheckVolumeSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void CheckVolumeSD::Initialize(G4HCofThisEvent*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool CheckVolumeSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
if(track->GetTrackID() > 1) theHisto->AddLeakingParticle(track);
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void CheckVolumeSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void CheckVolumeSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void CheckVolumeSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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.5 2006/06/29 17:24:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DetectorConstruction
|
||||
//
|
||||
// Created: 31.01.2003 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#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 "TargetSD.hh"
|
||||
#include "CheckVolumeSD.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
logicTarget = 0;
|
||||
logicCheck = 0;
|
||||
logicWorld = 0;
|
||||
detectorMessenger = new DetectorMessenger(this);
|
||||
|
||||
radius = 10.*cm;
|
||||
|
||||
targetMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
|
||||
worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
|
||||
|
||||
// Prepare sensitive detectors
|
||||
checkSD = new CheckVolumeSD("checkSD");
|
||||
(G4SDManager::GetSDMpointer())->AddNewDetector( checkSD );
|
||||
targetSD = new TargetSD("targetSD");
|
||||
(G4SDManager::GetSDMpointer())->AddNewDetector( targetSD );
|
||||
}
|
||||
|
||||
//....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 checkR = radius + mm;
|
||||
G4double worldR = radius + cm;
|
||||
G4double targetZ = HistoManager::GetPointer()->Length()*0.5;
|
||||
G4double checkZ = targetZ + mm;
|
||||
G4double worldZ = targetZ + cm;
|
||||
|
||||
G4int nSlices = HistoManager::GetPointer()->NumberOfSlices();
|
||||
G4double sliceZ = targetZ/G4double(nSlices);
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4Tubs* solidW = new G4Tubs("World",0.,worldR,worldZ,0.,twopi);
|
||||
logicWorld = new G4LogicalVolume( solidW,worldMaterial,"World");
|
||||
G4VPhysicalVolume* world = new G4PVPlacement(0,G4ThreeVector(),
|
||||
logicWorld,"World",0,false,0);
|
||||
//
|
||||
// Check volume
|
||||
//
|
||||
G4Tubs* solidC = new G4Tubs("Check",0.,checkR,checkZ,0.,twopi);
|
||||
logicCheck = new G4LogicalVolume( solidC,worldMaterial,"World");
|
||||
// G4VPhysicalVolume* physC =
|
||||
new G4PVPlacement(0,G4ThreeVector(),logicCheck,"World",logicWorld,false,0);
|
||||
logicCheck->SetSensitiveDetector(checkSD);
|
||||
|
||||
//
|
||||
// Target volume
|
||||
//
|
||||
G4Tubs* solidA = new G4Tubs("Target",0.,radius,sliceZ,0.,twopi);
|
||||
logicTarget = new G4LogicalVolume( solidA,targetMaterial,"Target");
|
||||
logicTarget->SetSensitiveDetector(targetSD);
|
||||
|
||||
G4double z = sliceZ - targetZ;
|
||||
|
||||
for(G4int i=0; i<nSlices; i++) {
|
||||
// physC =
|
||||
new G4PVPlacement(0,G4ThreeVector(0.0,0.0,z),logicTarget,"Target",logicCheck,false,i);
|
||||
z += 2.0*sliceZ;
|
||||
}
|
||||
G4cout << "### Target consist of " << nSlices
|
||||
<< " of " << targetMaterial->GetName()
|
||||
<< " disks with R(mm)= " << radius/mm
|
||||
<< " Width(mm)= " << 2.0*sliceZ/mm
|
||||
<< " Total Length(mm)= " << 2.0*targetZ/mm
|
||||
<< " ###" << G4endl;
|
||||
|
||||
// colors
|
||||
logicWorld->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
|
||||
G4VisAttributes* regWcolor = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3));
|
||||
logicCheck->SetVisAttributes(regWcolor);
|
||||
|
||||
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) {
|
||||
radius = val;
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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.3 2006/06/29 17:24:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DetectorMessenger
|
||||
//
|
||||
// Created: 31.01.03 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#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/NumberOfBinsE",this);
|
||||
binCmd->SetGuidance("Set number of bins for Energy");
|
||||
binCmd->SetParameterName("NEbins",false);
|
||||
binCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
nOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/NumberDivZ",this);
|
||||
nOfAbsCmd->SetGuidance("Set number of slices");
|
||||
nOfAbsCmd->SetParameterName("NZ",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);
|
||||
|
||||
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 verbCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
|
||||
if( command == matCmd )
|
||||
Detector->SetTargetMaterial(newValue);
|
||||
|
||||
if( command == mat1Cmd )
|
||||
Detector->SetWorldMaterial(newValue);
|
||||
|
||||
if( command == rCmd )
|
||||
Detector->SetTargetRadius(rCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == lCmd )
|
||||
HistoManager::GetPointer()->SetTargetLength(lCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == nOfAbsCmd )
|
||||
HistoManager::GetPointer()->SetNumberOfSlices(nOfAbsCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == binCmd )
|
||||
HistoManager::GetPointer()->SetNumberOfBinsE(binCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == verbCmd )
|
||||
HistoManager::GetPointer()->SetVerbose(verbCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == updateCmd )
|
||||
Detector->UpdateGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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.3 2006/06/29 17:24:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// EventAction
|
||||
//
|
||||
// Created: 31.04.2006 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "HistoManager.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(HistoManager::GetPointer()->GetVerbose() > 0 ||
|
||||
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;
|
||||
}
|
||||
|
||||
if(HistoManager::GetPointer()->GetVerbose() > 1)
|
||||
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.3 2006/06/29 17:24:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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,299 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include <memory> // for the auto_ptr(T>
|
||||
#include <AIDA/AIDA.h>
|
||||
#include "HistoMessenger.hh"
|
||||
#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;
|
||||
tupleName = "tuple.hbook";
|
||||
tupleId = "100";
|
||||
tupleList = "";
|
||||
ntup = 0;
|
||||
messenger = 0;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
messenger = new HistoMessenger(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Histo::~Histo()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
for(G4int i=0; i<nHisto; i++) {
|
||||
if(histo[i]) delete histo[i];
|
||||
}
|
||||
delete messenger;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Histo::book()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
G4cout << "### Histo books " << nHisto << " histograms " << G4endl;
|
||||
// Creating the analysis factory
|
||||
std::auto_ptr< AIDA::IAnalysisFactory > af( AIDA_createAnalysisFactory() );
|
||||
if(verbose>0)
|
||||
G4cout<<"HIsto books analysis factory ......... "<<G4endl;
|
||||
|
||||
// Creating the tree factory
|
||||
std::auto_ptr< 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
|
||||
std::auto_ptr< 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]);
|
||||
}
|
||||
}
|
||||
// Creating a tuple factory, whose tuples will be handled by the tree
|
||||
if(tupleList != "") {
|
||||
if(verbose>0)
|
||||
G4cout<<"Histo books tuple factory for "<<tupleName <<G4endl;
|
||||
std::auto_ptr< AIDA::ITupleFactory > tpf( af->createTupleFactory( *tree ) );
|
||||
ntup = tpf->create(tupleId, tupleName, tupleList);
|
||||
}
|
||||
#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;
|
||||
for(G4int i=0; i<nHisto; i++) {
|
||||
if(histo[i]) histo[i]->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
|
||||
<< G4endl;
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(i>=0 && i<nHisto) {
|
||||
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::addTuple(const G4String& w1, const G4String& w2, const G4String& w3)
|
||||
{
|
||||
tupleId = w1;
|
||||
tupleName = w2;
|
||||
tupleList = w3;
|
||||
|
||||
G4cout<<" addTuple: Id "<<w1<<" Name "<<w2<<" List "<<w3<<G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Histo::fillTuple(const G4String& parname, G4double x)
|
||||
{
|
||||
if(verbose > 1)
|
||||
G4cout << "fill tuple by parameter <" << parname << "> = " << x << G4endl;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(ntup) ntup->fill(ntup->findColumn(parname), (float)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Histo::addRow()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(ntup) ntup->addRow();
|
||||
#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,433 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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.5 2006/06/29 17:24:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// 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 "G4Proton.hh"
|
||||
#include "G4AntiProton.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4MuonPlus.hh"
|
||||
#include "G4MuonMinus.hh"
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionZero.hh"
|
||||
#include "G4KaonPlus.hh"
|
||||
#include "G4KaonMinus.hh"
|
||||
#include "G4KaonZeroShort.hh"
|
||||
#include "G4KaonZeroLong.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
#include "G4Triton.hh"
|
||||
#include "G4He3.hh"
|
||||
#include "G4Alpha.hh"
|
||||
#include "Histo.hh"
|
||||
#include "globals.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()
|
||||
{
|
||||
verbose= 0;
|
||||
nSlices = 300;
|
||||
nBinsE = 100;
|
||||
nHisto = 19;
|
||||
length = 300.*mm;
|
||||
histo = new Histo(verbose);
|
||||
neutron = G4Neutron::Neutron();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete histo;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void HistoManager::bookHisto()
|
||||
{
|
||||
histo->add1D("1",
|
||||
"Energy deposition (MeV/mm/event) in the target",nSlices,0.0,length/mm,MeV/mm);
|
||||
|
||||
histo->add1D("2",
|
||||
"Log10 Energy (MeV) of gammas",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("3",
|
||||
"Log10 Energy (MeV) of electrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("4",
|
||||
"Log10 Energy (MeV) of positrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("5",
|
||||
"Log10 Energy (MeV) of protons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("6",
|
||||
"Log10 Energy (MeV) of neutrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("7",
|
||||
"Log10 Energy (MeV) of charged pions",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("8",
|
||||
"Log10 Energy (MeV) of pi0",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("9",
|
||||
"Log10 Energy (MeV) of charged kaons",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("10",
|
||||
"Log10 Energy (MeV) of neutral kaons",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("11",
|
||||
"Log10 Energy (MeV) of deuterons and tritons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("12",
|
||||
"Log10 Energy (MeV) of He3 and alpha",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("13",
|
||||
"Log10 Energy (MeV) of Generic Ions",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("14",
|
||||
"Log10 Energy (MeV) of muons",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("15",
|
||||
"log10 Energy (MeV) of side-leaked neutrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("16",
|
||||
"log10 Energy (MeV) of forward-leaked neutrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("17",
|
||||
"log10 Energy (MeV) of backward-leaked neutrons",nBinsE,-5.,5.,1.0);
|
||||
|
||||
histo->add1D("18",
|
||||
"log10 Energy (MeV) of leaking protons",nBinsE,-4.,6.,1.0);
|
||||
|
||||
histo->add1D("19",
|
||||
"log10 Energy (MeV) of leaking charged pions",nBinsE,-4.,6.,1.0);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void HistoManager::BeginOfRun()
|
||||
{
|
||||
absZ0 = -0.5*length;
|
||||
n_evt = 0;
|
||||
n_elec = 0;
|
||||
n_posit = 0;
|
||||
n_gam = 0;
|
||||
n_step = 0;
|
||||
n_prot_leak = 0;
|
||||
n_pion_leak = 0;
|
||||
n_ions = 0;
|
||||
n_deut = 0;
|
||||
n_alpha = 0;
|
||||
n_kaons = 0;
|
||||
n_muons = 0;
|
||||
n_cpions = 0;
|
||||
n_pi0 = 0;
|
||||
n_neutron = 0;
|
||||
n_proton = 0;
|
||||
n_aproton = 0;
|
||||
n_neu_forw = 0;
|
||||
n_neu_leak = 0;
|
||||
n_neu_back = 0;
|
||||
|
||||
bookHisto();
|
||||
histo->book();
|
||||
|
||||
if(verbose > 0)
|
||||
G4cout << "HistoManager: Histograms are booked and run has been started"
|
||||
<<G4endl<<" BeginOfRun (After histo->book)"<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void HistoManager::EndOfRun()
|
||||
{
|
||||
|
||||
G4cout << "HistoManager: End of run actions are started" << G4endl;
|
||||
|
||||
// Average values
|
||||
G4cout<<"========================================================"<<G4endl;
|
||||
|
||||
G4double x = (G4double)n_evt;
|
||||
if(n_evt > 0) x = 1.0/x;
|
||||
|
||||
G4double xe = x*(G4double)n_elec;
|
||||
G4double xg = x*(G4double)n_gam;
|
||||
G4double xp = x*(G4double)n_posit;
|
||||
G4double xs = x*(G4double)n_step;
|
||||
G4double xn = x*(G4double)n_neutron;
|
||||
G4double xpn = x*(G4double)n_proton;
|
||||
G4double xap = x*(G4double)n_aproton;
|
||||
G4double xnf = x*(G4double)n_neu_forw;
|
||||
G4double xnb = x*(G4double)n_neu_leak;
|
||||
G4double xnbw= x*(G4double)n_neu_back;
|
||||
G4double xpl = x*(G4double)n_prot_leak;
|
||||
G4double xal = x*(G4double)n_pion_leak;
|
||||
G4double xpc = x*(G4double)n_cpions;
|
||||
G4double xp0 = x*(G4double)n_pi0;
|
||||
G4double xpk = x*(G4double)n_kaons;
|
||||
G4double xpm = x*(G4double)n_muons;
|
||||
G4double xid = x*(G4double)n_deut;
|
||||
G4double xia = x*(G4double)n_alpha;
|
||||
G4double xio = x*(G4double)n_ions;
|
||||
|
||||
G4cout << "Beam particle "
|
||||
<< primaryDef->GetParticleName() <<G4endl;
|
||||
G4cout << "Beam Energy(MeV) "
|
||||
<< primaryKineticEnergy/MeV <<G4endl;
|
||||
G4cout << "Number of events " << n_evt <<G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of steps " << xs << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of gamma " << xg << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of e- " << xe << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of e+ " << xp << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of neutrons " << xn << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of protons " << xpn << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of antiprotons " << xap << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of pi+ & pi- " << xpc << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of pi0 " << xp0 << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of kaons " << xpk << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of muons " << xpm << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of deuterons+tritons " << xid << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of He3+alpha " << xia << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of ions " << xio << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of forward neutrons " << xnf << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of reflected neutrons " << xnb << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of leaked neutrons " << xnbw << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of proton leak " << xpl << G4endl;
|
||||
G4cout << std::setprecision(4) << "Average number of pion leak " << xal << G4endl;
|
||||
G4cout<<"========================================================"<<G4endl;
|
||||
G4cout<<G4endl;
|
||||
|
||||
// normalise histograms
|
||||
for(G4int i=0; i<nHisto; i++) {
|
||||
histo->scale(i,x);
|
||||
}
|
||||
|
||||
if(verbose > 1) histo->print(0);
|
||||
histo->save();
|
||||
histo->reset();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void HistoManager::ScoreNewTrack(const G4Track* track)
|
||||
{
|
||||
const G4ParticleDefinition* pd = track->GetDefinition();
|
||||
G4String name = pd->GetParticleName();
|
||||
G4double e = track->GetKineticEnergy();
|
||||
|
||||
// Primary track
|
||||
if(0 == track->GetParentID()) {
|
||||
|
||||
n_evt++;
|
||||
primaryKineticEnergy = e;
|
||||
primaryDef = pd;
|
||||
G4ThreeVector dir = track->GetMomentumDirection();
|
||||
if(1 < verbose)
|
||||
G4cout << "### Primary " << name
|
||||
<< " kinE(MeV)= " << e/MeV
|
||||
<< "; m(MeV)= " << pd->GetPDGMass()/MeV
|
||||
<< "; pos(mm)= " << track->GetPosition()/mm
|
||||
<< "; dir= " << track->GetMomentumDirection()
|
||||
<< G4endl;
|
||||
|
||||
// Secondary track
|
||||
} else {
|
||||
if(1 < verbose)
|
||||
G4cout << "=== Secondary " << name
|
||||
<< " kinE(MeV)= " << e/MeV
|
||||
<< "; m(MeV)= " << pd->GetPDGMass()/MeV
|
||||
<< "; pos(mm)= " << track->GetPosition()/mm
|
||||
<< "; dir= " << track->GetMomentumDirection()
|
||||
<< G4endl;
|
||||
e = std::log10(e/MeV);
|
||||
if(pd == G4Gamma::Gamma()) {
|
||||
n_gam++;
|
||||
histo->fill(1,e,1.0);
|
||||
} else if ( pd == G4Electron::Electron()) {
|
||||
n_elec++;
|
||||
histo->fill(2,e,1.0);
|
||||
} else if ( pd == G4Positron::Positron()) {
|
||||
n_posit++;
|
||||
histo->fill(3,e,1.0);
|
||||
} else if ( pd == G4Proton::Proton()) {
|
||||
n_proton++;
|
||||
histo->fill(4,e,1.0);
|
||||
} else if ( pd == neutron) {
|
||||
n_neutron++;
|
||||
histo->fill(5,e,1.0);
|
||||
} else if ( pd == G4AntiProton::AntiProton()) {
|
||||
n_aproton++;
|
||||
} else if ( pd == G4PionPlus::PionPlus() || pd == G4PionMinus::PionMinus()) {
|
||||
n_cpions++;
|
||||
histo->fill(6,e,1.0);
|
||||
} else if ( pd == G4PionZero::PionZero()) {
|
||||
n_pi0++;
|
||||
histo->fill(7,e,1.0);
|
||||
} else if ( pd == G4KaonPlus::KaonPlus() || pd == G4KaonMinus::KaonMinus()) {
|
||||
n_kaons++;
|
||||
histo->fill(8,e,1.0);
|
||||
} else if ( pd == G4KaonZeroShort::KaonZeroShort() || pd == G4KaonZeroLong::KaonZeroLong()) {
|
||||
n_kaons++;
|
||||
histo->fill(9,e,1.0);
|
||||
} else if ( pd == G4Deuteron::Deuteron() || pd == G4Triton::Triton()) {
|
||||
n_deut++;
|
||||
histo->fill(10,e,1.0);
|
||||
} else if ( pd == G4He3::He3() || pd == G4Alpha::Alpha()) {
|
||||
n_alpha++;
|
||||
histo->fill(11,e,1.0);
|
||||
} else if ( pd->GetParticleType() == "nucleus") {
|
||||
n_ions++;
|
||||
histo->fill(12,e,1.0);
|
||||
} else if ( pd == G4MuonPlus::MuonPlus() || pd == G4MuonMinus::MuonMinus()) {
|
||||
n_muons++;
|
||||
histo->fill(13,e,1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::AddTargetStep(const G4Step* step)
|
||||
{
|
||||
n_step++;
|
||||
const G4Track* track = step->GetTrack();
|
||||
currentDef = track->GetDefinition();
|
||||
currentKinEnergy = track->GetKineticEnergy();
|
||||
|
||||
G4ThreeVector pos =
|
||||
(step->GetPreStepPoint()->GetPosition() +
|
||||
step->GetPostStepPoint()->GetPosition())*0.5;
|
||||
|
||||
G4double z = pos.z() - absZ0;
|
||||
histo->fill(0,z,step->GetTotalEnergyDeposit());
|
||||
|
||||
if(1 < verbose)
|
||||
G4cout << "HistoManager::AddEnergy: e(keV)= " << step->GetTotalEnergyDeposit()/keV
|
||||
<< "; z(mm)= " << z/mm
|
||||
<< "; step(mm)= " << step->GetStepLength()/mm
|
||||
<< " by " << currentDef->GetParticleName()
|
||||
<< " E(MeV)= " << currentKinEnergy/MeV
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void HistoManager::AddLeakingParticle(const G4Track* track)
|
||||
{
|
||||
const G4ParticleDefinition* pd = track->GetDefinition();
|
||||
G4double e = std::log10(track->GetKineticEnergy()/MeV);
|
||||
|
||||
G4ThreeVector pos = track->GetPosition();
|
||||
G4ThreeVector dir = track->GetMomentumDirection();
|
||||
G4double x = pos.x();
|
||||
G4double y = pos.y();
|
||||
G4double z = pos.z();
|
||||
|
||||
G4bool isLeaking = false;
|
||||
|
||||
// Forward
|
||||
if(z > -absZ0 && dir.z() > 0.0) {
|
||||
if(pd == neutron) {
|
||||
n_neu_forw++;
|
||||
histo->fill(15,e,1.0);
|
||||
} else isLeaking = true;
|
||||
|
||||
// Backward
|
||||
} else if (z < absZ0 && dir.z() < 0.0) {
|
||||
if(pd == neutron) {
|
||||
n_neu_leak++;
|
||||
histo->fill(16,e,1.0);
|
||||
} else isLeaking = true;
|
||||
|
||||
// Side
|
||||
} else if (std::abs(z) <= -absZ0 && x*dir.x() + y*dir.y() > 0.0) {
|
||||
isLeaking = true;
|
||||
if(pd == neutron) {
|
||||
n_neu_back++;
|
||||
histo->fill(14,e,1.0);
|
||||
} else isLeaking = true;
|
||||
}
|
||||
|
||||
// protons and pions
|
||||
if(isLeaking) {
|
||||
if(pd == G4Proton::Proton()) {
|
||||
histo->fill(17,e,1.0);
|
||||
n_prot_leak++;
|
||||
} else if (pd == G4PionPlus::PionPlus() || pd == G4PionMinus::PionMinus()) {
|
||||
histo->fill(18,e,1.0);
|
||||
n_pion_leak++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....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.5 2006/06/29 17:24:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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......
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysicsList.cc,v 1.11 2006/06/29 17:24:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PhysicsList
|
||||
//
|
||||
// Created: 31.04.2006 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
#include "PhysicsListMessenger.hh"
|
||||
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4EmStandardPhysics72.hh"
|
||||
#include "G4EmStandardPhysics71.hh"
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
#include "G4HadronElasticPhysics.hh"
|
||||
#include "G4QStoppingPhysics.hh"
|
||||
#include "G4LHEPStoppingPhysics.hh"
|
||||
#include "G4IonBinaryCascadePhysics.hh"
|
||||
#include "G4IonPhysics.hh"
|
||||
#include "G4EmExtraPhysics.hh"
|
||||
#include "G4EmProcessOptions.hh"
|
||||
|
||||
#include "HadronPhysicsQGSP_BIC.hh"
|
||||
#include "HadronPhysicsLHEP.hh"
|
||||
#include "HadronPhysicsLHEP_BIC.hh"
|
||||
#include "HadronPhysicsLHEP_BIC_HP.hh"
|
||||
#include "HadronPhysicsLHEP_BERT.hh"
|
||||
#include "HadronPhysicsLHEP_BERT_HP.hh"
|
||||
#include "HadronPhysicsQGSP_BERT_HP.hh"
|
||||
#include "HadronPhysicsQGSP_BERT.hh"
|
||||
#include "HadronPhysicsQGSC.hh"
|
||||
#include "HadronPhysicsQGSP.hh"
|
||||
#include "G4HadronInelasticQBBC.hh"
|
||||
#include "G4HadronInelasticQLHEP.hh"
|
||||
#include "G4IonPhysics.hh"
|
||||
#include "G4HadronProcessStore.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
PhysicsList::PhysicsList() : G4VModularPhysicsList()
|
||||
{
|
||||
G4LossTableManager::Instance();
|
||||
defaultCutValue = 1.*mm;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForPositron = defaultCutValue;
|
||||
|
||||
pMessenger = new PhysicsListMessenger(this);
|
||||
|
||||
// Particles
|
||||
particleList = new G4DecayPhysics("decays");
|
||||
|
||||
// EM physics
|
||||
emPhysicsList = new G4EmStandardPhysics("standard");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{
|
||||
delete pMessenger;
|
||||
delete particleList;
|
||||
delete emPhysicsList;
|
||||
for(size_t i=0; i<hadronPhys.size(); i++) {
|
||||
delete hadronPhys[i];
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
particleList->ConstructParticle();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
emPhysicsList->ConstructProcess();
|
||||
particleList->ConstructProcess();
|
||||
for(size_t i=0; i<hadronPhys.size(); i++) {
|
||||
hadronPhys[i]->ConstructProcess();
|
||||
}
|
||||
|
||||
G4HadronProcessStore::Instance()->Dump(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
{
|
||||
if (verboseLevel>0)
|
||||
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
|
||||
|
||||
if (name == "LHEP") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("LElastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsLHEP());
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "em_fast") {
|
||||
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new G4EmStandardPhysics72("standard");
|
||||
|
||||
} else if (name == "em_71") {
|
||||
|
||||
delete emPhysicsList;
|
||||
emPhysicsList = new G4EmStandardPhysics71("standard");
|
||||
|
||||
} else if (name == "LHEP_BERT") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsLHEP_BERT());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "LHEP_BERT_HP") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsLHEP_BERT_HP());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "LHEP_BIC") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new HadronPhysicsLHEP_BIC());
|
||||
|
||||
} else if (name == "LHEP_BIC_HP") {
|
||||
|
||||
SetStandardList(true);
|
||||
hadronPhys.push_back( new HadronPhysicsLHEP_BIC_HP());
|
||||
|
||||
} else if (name == "QGSC") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsQGSC());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "QGSP") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsQGSP());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "LHEP_EMV") {
|
||||
|
||||
AddPhysicsList("em_71");
|
||||
AddPhysicsList("LHEP");
|
||||
|
||||
} else if (name == "QGSP_EMV") {
|
||||
|
||||
AddPhysicsList("em_71");
|
||||
AddPhysicsList("QGSP");
|
||||
|
||||
} else if (name == "QGSP_EMX") {
|
||||
|
||||
AddPhysicsList("em_fast");
|
||||
AddPhysicsList("QGSP");
|
||||
|
||||
} else if (name == "QGSP_BERT") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new HadronPhysicsQGSP_BERT());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "QGSP_BERT_HP") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,true));
|
||||
hadronPhys.push_back( new HadronPhysicsQGSP_BERT_HP());
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "QGSP_BIC") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new HadronPhysicsQGSP_BIC());
|
||||
|
||||
} else if (name == "QBBC") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new G4HadronInelasticQBBC("QBBC",verboseLevel));
|
||||
|
||||
} else if (name == "QBBC_BERT") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new G4HadronInelasticQBBC("QBBC",verboseLevel,
|
||||
false,true,false,false));
|
||||
|
||||
} else if (name == "QBBC_HP") {
|
||||
|
||||
SetStandardList(true);
|
||||
hadronPhys.push_back( new G4HadronInelasticQBBC("QBBC",verboseLevel,
|
||||
false,false,false,true));
|
||||
|
||||
} else if (name == "QBBC_CHIPS") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new G4HadronInelasticQBBC("QBBC",verboseLevel,
|
||||
false,false,true,false));
|
||||
|
||||
} else if (name == "QBBC_FTF") {
|
||||
|
||||
SetStandardList(false);
|
||||
hadronPhys.push_back( new G4HadronInelasticQBBC("QBBC",verboseLevel,
|
||||
true,false,false,false));
|
||||
|
||||
} else if (name == "QQGSP") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new G4HadronInelasticQLHEP("QGSP",verboseLevel,
|
||||
true,false,false,false));
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else if (name == "QQGSP_BERT") {
|
||||
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,false));
|
||||
hadronPhys.push_back( new G4HadronInelasticQLHEP("QGSP_BERT",verboseLevel,
|
||||
true,true,false,false));
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonPhysics("ion"));
|
||||
|
||||
} else {
|
||||
|
||||
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
|
||||
<< " is not defined"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::SetStandardList(G4bool flagHP)
|
||||
{
|
||||
hadronPhys.push_back( new G4EmExtraPhysics("gamma_nuc"));
|
||||
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",verboseLevel,
|
||||
flagHP));
|
||||
hadronPhys.push_back( new G4QStoppingPhysics("stopping"));
|
||||
hadronPhys.push_back( new G4IonBinaryCascadePhysics("binary_ion"));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForPositron, "e+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
cutForGamma = cut;
|
||||
SetParticleCuts(cutForGamma, G4Gamma::Gamma());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
cutForElectron = cut;
|
||||
SetParticleCuts(cutForElectron, G4Electron::Electron());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForPositron(G4double cut)
|
||||
{
|
||||
cutForPositron = cut;
|
||||
SetParticleCuts(cutForPositron, G4Positron::Positron());
|
||||
}
|
||||
|
||||
void PhysicsList::List()
|
||||
{
|
||||
G4cout << "### PhysicsLists available: LHEP LHEP_BERT LHEP_BERT_HP LHEP_BIC LHEP_BIC_HP" << G4endl;
|
||||
G4cout << " QGSC QGSP QGSP_BERT QGSP_BERT_HP QGSP_BIC QBBC" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysicsListMessenger.cc,v 1.3 2006/06/29 17:24:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PhysicsListMessenger
|
||||
//
|
||||
// Created: 31.01.2006 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
#include "PhysicsListMessenger.hh"
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
:pPhysicsList(pPhys)
|
||||
{
|
||||
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutGamma",this);
|
||||
gammaCutCmd->SetGuidance("Set gamma cut.");
|
||||
gammaCutCmd->SetParameterName("Gcut",false);
|
||||
gammaCutCmd->SetUnitCategory("Length");
|
||||
gammaCutCmd->SetRange("Gcut>0.0");
|
||||
gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
electCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutEl",this);
|
||||
electCutCmd->SetGuidance("Set electron cut.");
|
||||
electCutCmd->SetParameterName("Ecut",false);
|
||||
electCutCmd->SetUnitCategory("Length");
|
||||
electCutCmd->SetRange("Ecut>0.0");
|
||||
electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
posCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutPos",this);
|
||||
posCutCmd->SetGuidance("Set positron cut.");
|
||||
posCutCmd->SetParameterName("Pcut",false);
|
||||
posCutCmd->SetUnitCategory("Length");
|
||||
posCutCmd->SetRange("Pcut>0.0");
|
||||
posCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
allCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutsAll",this);
|
||||
allCutCmd->SetGuidance("Set cut for all.");
|
||||
allCutCmd->SetParameterName("cut",false);
|
||||
allCutCmd->SetUnitCategory("Length");
|
||||
allCutCmd->SetRange("cut>0.0");
|
||||
allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
pListCmd = new G4UIcmdWithAString("/testhadr/Physics",this);
|
||||
pListCmd->SetGuidance("Add modula physics list.");
|
||||
pListCmd->SetParameterName("PList",false);
|
||||
pListCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
listCmd = new G4UIcmdWithoutParameter("/testhadr/ListPhysics",this);
|
||||
listCmd->SetGuidance("Available Physics Lists");
|
||||
listCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsListMessenger::~PhysicsListMessenger()
|
||||
{
|
||||
delete gammaCutCmd;
|
||||
delete electCutCmd;
|
||||
delete posCutCmd;
|
||||
delete allCutCmd;
|
||||
delete pListCmd;
|
||||
delete listCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == gammaCutCmd )
|
||||
pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == electCutCmd )
|
||||
pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == posCutCmd )
|
||||
pPhysicsList->SetCutForPositron(posCutCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == allCutCmd )
|
||||
{
|
||||
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
|
||||
pPhysicsList->SetCutForGamma(cut);
|
||||
pPhysicsList->SetCutForElectron(cut);
|
||||
pPhysicsList->SetCutForPositron(cut);
|
||||
}
|
||||
|
||||
if( command == pListCmd )
|
||||
pPhysicsList->AddPhysicsList(newValue);
|
||||
|
||||
if( command == listCmd )
|
||||
pPhysicsList->List();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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.3 2006/06/29 17:24:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// EventActionMessenger
|
||||
//
|
||||
// Created: 31.01.03 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
particleGun = new G4ParticleGun(1);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
histo = HistoManager::GetPointer();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double zVertex = -(5.0*mm + histo->Length());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,zVertex));
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
// GEANT4
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int id = aRun->GetRunID();
|
||||
G4cout << "### Run " << id << " start" << G4endl;
|
||||
(HistoManager::GetPointer())->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*)
|
||||
{
|
||||
|
||||
G4cout << "RunAction: End of run actions are started" << G4endl;
|
||||
(HistoManager::GetPointer())->EndOfRun();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: StackingAction.cc,v 1.3 2006/06/29 17:24:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// StackingAction
|
||||
//
|
||||
// Created: 31.04.2006 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "StackingAction.hh"
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "StackingMessenger.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StackingAction::StackingAction()
|
||||
{
|
||||
stackMessenger = new StackingMessenger(this);
|
||||
histoManager = HistoManager::GetPointer();
|
||||
killSecondary = false;
|
||||
pname = "";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StackingAction::~StackingAction()
|
||||
{
|
||||
delete stackMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
StackingAction::ClassifyNewTrack(const G4Track* aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack status = fUrgent;
|
||||
|
||||
if (aTrack->GetTrackStatus() == fAlive)
|
||||
histoManager->ScoreNewTrack(aTrack);
|
||||
|
||||
const G4String name = aTrack->GetDefinition()->GetParticleName();
|
||||
|
||||
if(histoManager->GetVerbose() > 1 ) {
|
||||
G4cout << "Track #"
|
||||
<< aTrack->GetTrackID() << " of " << name
|
||||
<< " E(MeV)= " << aTrack->GetKineticEnergy()/MeV
|
||||
<< " produced by "
|
||||
<< histoManager->CurrentDefinition()->GetParticleName()
|
||||
<< " ID= " << aTrack->GetParentID()
|
||||
<< " with E(MeV)= " << histoManager->CurrentKinEnergy()/MeV
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//stack or delete secondaries
|
||||
if (killSecondary) status = fKill;
|
||||
else if(pname == name) status = fKill;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: StackingMessenger.cc,v 1.3 2006/06/29 17:24:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// StackingMessenger
|
||||
//
|
||||
// Created: 31.05.2006 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "StackingMessenger.hh"
|
||||
|
||||
#include "StackingAction.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StackingMessenger::StackingMessenger(StackingAction* stack)
|
||||
:stackAction(stack)
|
||||
{
|
||||
killCmd = new G4UIcmdWithABool("/testhadr/KillAllSecondaries",this);
|
||||
killCmd->SetGuidance(" Choice : true false");
|
||||
killCmd->SetParameterName("choice",true);
|
||||
killCmd->SetDefaultValue(false);
|
||||
|
||||
kCmd = new G4UIcmdWithAString("/testhadr/Kill", this);
|
||||
kCmd->SetGuidance("Kill secondary particles of defined type");
|
||||
kCmd->SetParameterName("ch", true);
|
||||
kCmd->SetDefaultValue("none");
|
||||
kCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
StackingMessenger::~StackingMessenger()
|
||||
{
|
||||
delete killCmd;
|
||||
delete kCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void StackingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if(command == killCmd)
|
||||
stackAction->SetKillStatus(killCmd->GetNewBoolValue(newValue));
|
||||
|
||||
if(command == kCmd)
|
||||
stackAction->SetKill(newValue);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: TargetSD.cc,v 1.4 2006/06/29 17:24:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TargetSD
|
||||
//
|
||||
// Created: 31.01.2003 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "TargetSD.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Step.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
TargetSD::TargetSD(const G4String& name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
theHisto = HistoManager::GetPointer();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
TargetSD::~TargetSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void TargetSD::Initialize(G4HCofThisEvent*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool TargetSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
theHisto->AddTargetStep(aStep);
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void TargetSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void TargetSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void TargetSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Reference in New Issue
Block a user