Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file F03ActionInitialization.cc
/// \brief Implementation of the F03ActionInitialization class
#include "F03ActionInitialization.hh"
#include "F03PrimaryGeneratorAction.hh"
#include "F03RunAction.hh"
#include "F03EventAction.hh"
#include "F03SteppingVerbose.hh"
#include "F03DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03ActionInitialization::F03ActionInitialization
(F03DetectorConstruction* detConstruction)
: G4VUserActionInitialization(),
fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03ActionInitialization::~F03ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03ActionInitialization::BuildForMaster() const
{
SetUserAction(new F03RunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03ActionInitialization::Build() const
{
SetUserAction(new F03PrimaryGeneratorAction(fDetConstruction));
F03RunAction* runAction = new F03RunAction();
SetUserAction(runAction);
F03EventAction* eventAction = new F03EventAction(runAction);
SetUserAction(eventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSteppingVerbose* F03ActionInitialization::InitializeSteppingVerbose() const
{
return new F03SteppingVerbose();
}
@@ -26,42 +26,43 @@
/// \file field/field03/src/F03CalorHit.cc
/// \brief Implementation of the F03CalorHit class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03CalorHit.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03CalorHit.hh"
G4Allocator<F03CalorHit> F03CalorHitAllocator;
G4ThreadLocal G4Allocator<F03CalorHit>* F03CalorHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03CalorHit::F03CalorHit()
: G4VHit(),
fEdepAbs(0.),
fEdepAbs(0.),
fTrackLengthAbs(0.),
fEdepGap(0.),
fEdepGap(0.),
fTrackLengthGap(0.)
{}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03CalorHit::~F03CalorHit()
{}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03CalorHit::F03CalorHit(const F03CalorHit& right)
: G4VHit(),
fEdepAbs(right.fEdepAbs),
fEdepAbs(right.fEdepAbs),
fTrackLengthAbs(right.fTrackLengthAbs),
fEdepGap(right.fEdepGap),
fEdepGap(right.fEdepGap),
fTrackLengthGap(right.fTrackLengthGap)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const F03CalorHit& F03CalorHit::operator=(const F03CalorHit& right)
{
@@ -70,16 +71,16 @@ const F03CalorHit& F03CalorHit::operator=(const F03CalorHit& right)
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int F03CalorHit::operator==(const F03CalorHit& right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03CalorHit::Print()
{}
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,13 +26,15 @@
/// \file field/field03/src/F03CalorimeterSD.cc
/// \brief Implementation of the F03CalorimeterSD class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03CalorimeterSD.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03CalorimeterSD.hh"
#include "F03CalorHit.hh"
#include "F03DetectorConstruction.hh"
@@ -41,59 +43,54 @@
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03CalorimeterSD::F03CalorimeterSD(G4String name,
F03CalorimeterSD::F03CalorimeterSD(G4String name,
F03DetectorConstruction* det)
: G4VSensitiveDetector(name),
fCalCollection(0),
fDetector(det),
fHitID(new G4int[500])
: G4VSensitiveDetector(name),
fCalCollection(0),
fDetector(det),
fHitID(new G4int[500])
{
collectionName.insert("CalCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03CalorimeterSD::~F03CalorimeterSD()
{
delete [] fHitID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03CalorimeterSD::Initialize(G4HCofThisEvent*)
{
fCalCollection = new F03CalorHitsCollection(SensitiveDetectorName,
collectionName[0]);
for (G4int j=0;j<1; j++)
{
fHitID[j] = -1;
}
fCalCollection = new F03CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<1; j++) {fHitID[j] = -1;};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool F03CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
G4double edep = step->GetTotalEnergyDeposit();
G4double stepl = 0.;
stepl = step->GetStepLength();
if ((edep == 0.) && (stepl == 0.) ) return false;
if ((edep == 0.) && (stepl == 0.) ) return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int number = 0 ;
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int number = 0;
if (fHitID[number]==-1)
{
{
F03CalorHit* calHit = new F03CalorHit();
if (physVol == fDetector->GetAbsorber()) calHit->AddAbs(edep,stepl);
fHitID[number] = fCalCollection->insert(calHit) - 1;
@@ -101,36 +98,23 @@ G4bool F03CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
G4cout << " New Calorimeter Hit on F03: " << number << G4endl;
}
else
{
{
if (physVol == fDetector->GetAbsorber())
(*fCalCollection)[fHitID[number]]->AddAbs(edep,stepl);
if (verboseLevel>0)
G4cout << " Energy added to F03: " << number << G4endl;
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03CalorimeterSD::EndOfEvent(G4HCofThisEvent* hce)
{
static G4int hcID = -1;
if (hcID<0)
{ hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
hce->AddHitsCollection(hcID, fCalCollection);
hce->AddHitsCollection(hcID,fCalCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F03CalorimeterSD::clear()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F03CalorimeterSD::PrintAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,92 +26,88 @@
/// \file field/field03/src/F03DetectorConstruction.cc
/// \brief Implementation of the F03DetectorConstruction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03DetectorConstruction.cc 77655 2013-11-27 08:51:59Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03DetectorConstruction.hh"
#include "F03DetectorMessenger.hh"
#include "F03CalorimeterSD.hh"
#include "F03FieldSetup.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4RunManager.hh"
#include "G4AutoDelete.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03DetectorConstruction::F03DetectorConstruction()
: fMagField(0), fEmFieldSetup(0), fDetectorMessenger(0), fCalorimeterSD(0),
: G4VUserDetectorConstruction(),
fDetectorMessenger(0),
fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
fSolidAbsorber(0), fLogicAbsorber(0), fPhysiAbsorber(0),
fSolidRadSlice(0), fLogicRadSlice(0), fPhysiRadSlice(0),
fSolidRadiator(0), fLogicRadiator(0), fPhysiRadiator(0),
fWorldMaterial(0), fAbsorberMaterial(0), fRadiatorMat(0),
fSolidRadSlice(0), fLogicRadSlice(0), fPhysiRadSlice(0),
fSolidRadiator(0), fLogicRadiator(0), fPhysiRadiator(0),
fWorldMaterial(0), fAbsorberMaterial(0), fRadiatorMat(0),
// default parameter values of the calorimeter
fWorldSizeR( 22000.*mm),
fWorldSizeZ( 44000.*mm),
fAbsorberThickness( 1.*mm),
fAbsorberRadius( 20000.*mm),
fZAbsorber( 21990.*mm),
fZStartAbs( 0.),
fZStartAbs( 0.),
fZEndAbs( 0.),
fRadThickness( 100.*mm),
fGasGap( 100.*mm),
fDetGap( 1.*mm),
fFoilNumber(1),
fWorldChanged(false)
fFoilNumber(1)
{
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new F03DetectorMessenger(this);
// create materials
DefineMaterials();
fEmFieldSetup = new F03FieldSetup() ;
fDetectorMessenger = new F03DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03DetectorConstruction::~F03DetectorConstruction()
{
{
delete fDetectorMessenger;
if (fEmFieldSetup) delete fEmFieldSetup ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* F03DetectorConstruction::Construct()
{
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::DefineMaterials()
{
// This function illustrates the possible ways to define materials
{
//This function illustrates the possible ways to define materials
G4String name, symbol ; // a=mass of a mole;
G4double a, z, density ; // z=mean number of protons;
G4int nel ;
G4String name, symbol; // a=mass of a mole;
G4double a, z, density; // z=mean number of protons;
G4int nel;
G4int ncomponents;
G4double fractionmass, pressure, temperature;
@@ -141,10 +137,10 @@ void F03DetectorConstruction::DefineMaterials()
// Mylar
density = 1.39*g/cm3;
G4Material* Mylar = new G4Material(name="Mylar", density, nel=3);
Mylar->AddElement(elO,2);
Mylar->AddElement(elC,5);
Mylar->AddElement(elH,4);
G4Material* mylar = new G4Material(name="Mylar", density, nel=3);
mylar->AddElement(elO,2);
mylar->AddElement(elC,5);
mylar->AddElement(elH,4);
// Polypropelene
@@ -154,39 +150,39 @@ void F03DetectorConstruction::DefineMaterials()
// Krypton as detector gas, STP
density = 3.700*mg/cm3 ;
a = 83.80*g/mole ;
density = 3.700*mg/cm3;
a = 83.80*g/mole;
G4Material* Kr = new G4Material(name="Kr",z=36., a, density );
// Dry air (average composition)
density = 1.7836*mg/cm3 ; // STP
G4Material* Argon = new G4Material(name="Argon" , density, ncomponents=1);
Argon->AddElement(elAr, 1);
density = 1.7836*mg/cm3; // STP
G4Material* argon = new G4Material(name="Argon" , density, ncomponents=1);
argon->AddElement(elAr, 1);
density = 1.25053*mg/cm3 ; // STP
G4Material* Nitrogen = new G4Material(name="N2" , density, ncomponents=1);
Nitrogen->AddElement(elN, 2);
density = 1.25053*mg/cm3; // STP
G4Material* nitrogen = new G4Material(name="N2" , density, ncomponents=1);
nitrogen->AddElement(elN, 2);
density = 1.4289*mg/cm3 ; // STP
G4Material* Oxygen = new G4Material(name="O2" , density, ncomponents=1);
Oxygen->AddElement(elO, 2);
density = 1.4289*mg/cm3; // STP
G4Material* oxygen = new G4Material(name="O2" , density, ncomponents=1);
oxygen->AddElement(elO, 2);
density = 1.2928*mg/cm3 ; // STP
density *= 1.0e-8 ; // pumped vacuum
density = 1.2928*mg/cm3; // STP
density *= 1.0e-8; // pumped vacuum
temperature = STP_Temperature;
pressure = 1.0e-8*STP_Pressure;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=3,
G4Material* air = new G4Material(name="Air" , density, ncomponents=3,
kStateGas,temperature,pressure);
Air->AddMaterial( Nitrogen, fractionmass = 0.7557 ) ;
Air->AddMaterial( Oxygen, fractionmass = 0.2315 ) ;
Air->AddMaterial( Argon, fractionmass = 0.0128 ) ;
air->AddMaterial( nitrogen, fractionmass = 0.7557 );
air->AddMaterial( oxygen, fractionmass = 0.2315 );
air->AddMaterial( argon, fractionmass = 0.0128 );
// Xenon as detector gas, STP
density = 5.858*mg/cm3 ;
a = 131.29*g/mole ;
density = 5.858*mg/cm3;
a = 131.29*g/mole;
G4Material* Xe = new G4Material(name="Xenon",z=54., a, density );
// Carbon dioxide, STP
@@ -198,43 +194,33 @@ void F03DetectorConstruction::DefineMaterials()
// 80% Xe + 20% CO2, STP
density = 5.0818*mg/cm3 ;
G4Material* Xe20CO2 = new G4Material(name="Xe20CO2" , density, ncomponents=2);
Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ) ;
Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ) ;
density = 5.0818*mg/cm3;
G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 );
Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 );
// 80% Kr + 20% CO2, STP
density = 3.601*mg/cm3 ;
G4Material* Kr20CO2 = new G4Material(name="Kr20CO2" , density,
ncomponents=2);
Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ) ;
Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ) ;
density = 3.601*mg/cm3;
G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 );
Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 );
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials of the calorimeter and TR radiator
fRadiatorMat = Air ; // CH2 ; // Mylar ;
fRadiatorMat = air; // CH2 ; // mylar;
fAbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ;
fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4;
fWorldMaterial = Air ;
fWorldMaterial = air;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* F03DetectorConstruction::ConstructCalorimeter()
{
G4int j ;
G4double zModule, zRadiator;
// complete the Calor parameters definition and Print
ComputeCalorParameters();
PrintCalorParameters();
// Cleanup old geometry
if (fPhysiWorld)
@@ -245,216 +231,224 @@ G4VPhysicalVolume* F03DetectorConstruction::ConstructCalorimeter()
G4SolidStore::GetInstance()->Clean();
}
// complete the Calor parameters definition and Print
ComputeCalorParameters();
PrintCalorParameters();
fSolidWorld = new G4Tubs("World", // its name
0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fWorldMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
fLogicWorld, // its logical volume
0, // its mother volume
false, // no boolean operation
0); // copy number
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fWorldMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
fLogicWorld, // its logical volume
0, // its mother volume
false, // no boolean op.
0); // copy number
// TR radiator envelope
G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap ;
G4double radThick = fFoilNumber*(fRadThickness + fGasGap) + fDetGap;
G4double zRad = fZAbsorber - 20*cm - 0.5*radThick ;
G4cout << "zRad = " << zRad/mm << " mm" << G4endl ;
G4double zRad = fZAbsorber - 20*cm - 0.5*radThick;
G4cout << "zRad = " << zRad/mm << " mm" << G4endl;
radThick *= 1.02 ;
G4cout << "radThick = " << radThick/mm << " mm" << G4endl ;
G4cout << "fFoilNumber = " << fFoilNumber << G4endl ;
G4cout << "fRadiatorMat = " << fRadiatorMat->GetName() << G4endl ;
G4cout << "WorldMaterial = " << fWorldMaterial->GetName() << G4endl ;
radThick *= 1.02;
G4cout << "radThick = " << radThick/mm << " mm" << G4endl;
G4cout << "fFoilNumber = " << fFoilNumber << G4endl;
G4cout << "fRadiatorMat = " << fRadiatorMat->GetName() << G4endl;
G4cout << "WorldMaterial = " << fWorldMaterial->GetName() << G4endl;
fSolidRadiator = new G4Tubs("Radiator",0.0,
1.01*fAbsorberRadius,
0.5*radThick,0.0, twopi) ;
fLogicRadiator = new G4LogicalVolume(fSolidRadiator,
fWorldMaterial,
"Radiator");
fSolidRadiator = new G4Tubs("Radiator",0.0,
1.01*fAbsorberRadius,
0.5*radThick,0.0, twopi);
// Set local field manager and local field in radiator and its daughters:
fLogicRadiator = new G4LogicalVolume(fSolidRadiator,
fWorldMaterial,
"Radiator");
G4bool allLocal = true ;
fLogicRadiator->SetFieldManager( fEmFieldSetup->GetLocalFieldManager(),
allLocal ) ;
fPhysiRadiator = new G4PVPlacement(0,
G4ThreeVector(0,0,zRad),
"Radiator", fLogicRadiator,
G4ThreeVector(0,0,zRad),
"Radiator", fLogicRadiator,
fPhysiWorld, false, 0);
fSolidRadSlice = new G4Tubs("RadSlice",0.0,
fAbsorberRadius,0.5*fRadThickness,0.0,twopi ) ;
fAbsorberRadius,0.5*fRadThickness,0.0,twopi);
fLogicRadSlice = new G4LogicalVolume(fSolidRadSlice,fRadiatorMat,
"RadSlice",0,0,0);
zModule = zRad + 0.5*radThick/1.02 ;
G4cout << "zModule = " << zModule/mm << " mm" << G4endl ;
G4double zModule, zRadiator;
zModule = zRad + 0.5*radThick/1.02;
G4cout << "zModule = " << zModule/mm << " mm" << G4endl;
for (j=0;j<fFoilNumber;j++)
{
for (G4int j=0;j<fFoilNumber;j++)
{
zRadiator = zModule - j*(fRadThickness + fGasGap);
G4cout << zRadiator/mm << " mm" << "\t";
// G4cout << "j = " << j << "\t";
zRadiator = zModule - j*(fRadThickness + fGasGap) ;
G4cout << zRadiator/mm << " mm" << "\t" ;
// G4cout << "j = " << j << "\t" ;
fPhysiRadSlice = new G4PVPlacement(0,G4ThreeVector(0.,0.,zRadiator-zRad),
"RadSlice",fLogicRadSlice,
fPhysiRadiator,false,j);
}
G4cout << G4endl ;
}
G4cout << G4endl;
// Absorber
if (fAbsorberThickness > 0.)
{
fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
fAbsorberRadius,
fAbsorberThickness/2.,
0.0,twopi);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
fPhysiWorld,
false,
0);
}
// Sensitive Detectors: Absorber
G4SDManager* sdManager = G4SDManager::GetSDMpointer();
fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
fAbsorberRadius,
fAbsorberThickness/2.,
0.0,twopi);
if (!fCalorimeterSD)
{
fCalorimeterSD = new F03CalorimeterSD("CalorSD",this);
sdManager->AddNewDetector( fCalorimeterSD );
}
if (fLogicAbsorber) fLogicAbsorber->SetSensitiveDetector(fCalorimeterSD);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
fPhysiWorld,
false,
0);
return fPhysiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n The WORLD is made of "
<< fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName() ;
G4cout << ", the transverse size (R) of the world is " << fWorldSizeR/mm << " mm. " << G4endl;
G4cout << " The ABSORBER is made of "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName() ;
G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm << " mm. " << G4endl;
G4cout << " Z position of the (middle of the) absorber " << fZAbsorber/mm << " mm." << G4endl;
G4cout << "\n The WORLD is made of "
<< fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName();
G4cout << ", the transverse size (R) of the world is "
<< fWorldSizeR/mm << " mm. " << G4endl;
G4cout << " The ABSORBER is made of "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName();
G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm
<< " mm. " << G4endl;
G4cout << " Z position of the (middle of the) absorber "
<< fZAbsorber/mm << " mm." << G4endl;
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// get the pointer to the material table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
// search the material by its name
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{
material = (*theMaterialTable)[j];
{ material = (*theMaterialTable)[j];
if (material->GetName() == materialChoice)
{
fAbsorberMaterial = material;
fLogicAbsorber->SetMaterial(material);
}
fLogicAbsorber->SetMaterial(material);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetWorldMaterial(G4String materialChoice)
{
// get the pointer to the material table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
// search the material by its name
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{
material = (*theMaterialTable)[j];
if (material->GetName() == materialChoice)
{ material = (*theMaterialTable)[j];
if(material->GetName() == materialChoice)
{
fWorldMaterial = material;
fLogicWorld->SetMaterial(material);
}
fLogicWorld->SetMaterial(material);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetAbsorberRadius(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
fAbsorberRadius = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetWorldSizeZ(G4double val)
{
fWorldChanged=true;
fWorldSizeZ = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetWorldSizeR(G4double val)
{
fWorldChanged=true;
fWorldSizeR = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::SetAbsorberZpos(G4double val)
{
fZAbsorber = val;
fZAbsorber = val;
ComputeCalorParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F03DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorConstruction::ConstructSDandField()
{
// Sensitive Detectors: Absorber
if (!fCalorimeterSD.Get()) {
F03CalorimeterSD* calorimeterSD = new F03CalorimeterSD("CalorSD",this);
fCalorimeterSD.Put(calorimeterSD);
}
SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get());
// Construct the field creator - this will register the field it creates
if (!fEmFieldSetup.Get()) {
F03FieldSetup* emFieldSetup = new F03FieldSetup();
fEmFieldSetup.Put(emFieldSetup);
G4AutoDelete::Register(emFieldSetup); //Kernel will delete the messenger
}
// Set local field manager and local field in radiator and its daughters:
G4bool allLocal = true;
fLogicRadiator->SetFieldManager(fEmFieldSetup.Get()->GetLocalFieldManager(),
allLocal );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,24 +26,23 @@
/// \file field/field03/src/F03DetectorMessenger.cc
/// \brief Implementation of the F03DetectorMessenger class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03DetectorMessenger.cc 77294 2013-11-22 11:01:00Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03DetectorMessenger.hh"
#include "F03DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "F03DetectorConstruction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03DetectorMessenger::F03DetectorMessenger(F03DetectorConstruction * det)
F03DetectorMessenger::F03DetectorMessenger(F03DetectorConstruction* det)
: G4UImessenger(),
fDetector(det),
fDetDir(0),
@@ -53,109 +52,103 @@ F03DetectorMessenger::F03DetectorMessenger(F03DetectorConstruction * det)
fAbsZposCmd(0),
fWorldMaterCmd(0),
fWorldZCmd(0),
fWorldRCmd(0),
fUpdateCmd(0)
{
fWorldRCmd(0)
{
fDetDir = new G4UIdirectory("/calor/");
fDetDir->SetGuidance("F03 detector control.");
fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",true);
fAbsMaterCmd->SetDefaultValue("Lead");
fAbsMaterCmd->AvailableForStates(G4State_Idle);
fAbsMaterCmd->SetToBeBroadcasted(false);
fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
fWorldMaterCmd->SetGuidance("Select Material of the World.");
fWorldMaterCmd->SetParameterName("wchoice",true);
fWorldMaterCmd->SetDefaultValue("Air");
fWorldMaterCmd->AvailableForStates(G4State_Idle);
fWorldMaterCmd->SetToBeBroadcasted(false);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("SizeZ",false,false);
fAbsThickCmd->SetDefaultUnit("mm");
fAbsThickCmd->SetRange("SizeZ>0.");
fAbsThickCmd->AvailableForStates(G4State_Idle);
fAbsThickCmd->SetToBeBroadcasted(false);
fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
fAbsRadCmd->SetGuidance("Set radius of the Absorber");
fAbsRadCmd->SetParameterName("SizeR",false,false);
fAbsRadCmd->SetDefaultUnit("mm");
fAbsRadCmd->SetRange("SizeR>0.");
fAbsRadCmd->AvailableForStates(G4State_Idle);
fAbsRadCmd->SetToBeBroadcasted(false);
fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
fAbsZposCmd->SetParameterName("Zpos",false,false);
fAbsZposCmd->SetDefaultUnit("mm");
fAbsZposCmd->AvailableForStates(G4State_Idle);
fAbsZposCmd->SetToBeBroadcasted(false);
fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
fWorldZCmd->SetGuidance("Set Z size of the World");
fWorldZCmd->SetParameterName("WSizeZ",false,false);
fWorldZCmd->SetDefaultUnit("mm");
fWorldZCmd->SetRange("WSizeZ>0.");
fWorldZCmd->AvailableForStates(G4State_Idle);
fWorldZCmd->SetToBeBroadcasted(false);
fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
fWorldRCmd->SetGuidance("Set R size of the World");
fWorldRCmd->SetParameterName("WSizeR",false,false);
fWorldRCmd->SetDefaultUnit("mm");
fWorldRCmd->SetRange("WSizeR>0.");
fWorldRCmd->AvailableForStates(G4State_Idle);
fUpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
fUpdateCmd->SetGuidance("Update calorimeter geometry.");
fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
fUpdateCmd->AvailableForStates(G4State_Idle);
fWorldRCmd->SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03DetectorMessenger::~F03DetectorMessenger()
{
delete fAbsMaterCmd;
delete fAbsThickCmd;
delete fAbsRadCmd;
delete fAbsZposCmd;
delete fAbsMaterCmd;
delete fAbsThickCmd;
delete fAbsRadCmd;
delete fAbsZposCmd;
delete fWorldMaterCmd;
delete fWorldZCmd;
delete fWorldRCmd;
delete fUpdateCmd;
delete fDetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if ( command == fAbsMaterCmd )
{
if( command == fAbsMaterCmd )
{ fDetector->SetAbsorberMaterial(newValue);}
if ( command == fWorldMaterCmd )
{ fDetector->SetWorldMaterial(newValue);}
if ( command == fAbsThickCmd )
{ fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
if ( command == fAbsRadCmd )
{ fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
if ( command == fAbsZposCmd )
{ fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
if ( command == fWorldZCmd )
{ fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
if ( command == fWorldRCmd )
{ fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
if ( command == fUpdateCmd )
{ fDetector->UpdateGeometry(); }
if( command == fWorldMaterCmd )
{ fDetector->SetWorldMaterial(newValue);}
if( command == fAbsThickCmd )
{fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
if( command == fAbsRadCmd )
{ fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
if( command == fAbsZposCmd )
{ fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
if( command == fWorldZCmd )
{ fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
if( command == fWorldRCmd )
{ fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,14 +26,17 @@
/// \file field/field03/src/F03EventAction.cc
/// \brief Implementation of the F03EventAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03EventAction.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03EventAction.hh"
#include "F03RunAction.hh"
#include "F03CalorHit.hh"
#include "F03EventActionMessenger.hh"
@@ -42,73 +45,64 @@
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03EventAction::F03EventAction(F03RunAction* action)
: G4UserEventAction(),
fCalorimeterCollID(-1),
fCalorimeterCollID(-1),
fEventMessenger(0),
fRunAction(action),
fRunAction(action),
fVerboseLevel(0),
fPrintModulo(10000)
{
fEventMessenger = new F03EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03EventAction::~F03EventAction()
{
delete fEventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
if(fVerboseLevel>1)
if (fVerboseLevel>1)
G4cout << "<<< Event " << evtNb << " started." << G4endl;
if (fCalorimeterCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
fCalorimeterCollID = SDman->GetCollectionID("CalCollection");
}
G4SDManager * sdManager = G4SDManager::GetSDMpointer();
fCalorimeterCollID = sdManager->GetCollectionID("CalCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03EventAction::EndOfEventAction(const G4Event* evt)
{
if(fVerboseLevel>0)
if (fVerboseLevel>0)
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
//save rndm status
// save rndm status
if (fRunAction->GetRndmFreq() == 2)
{
CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
{
G4Random::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
CLHEP::HepRandom::showEngineStatus();
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
G4Random::showEngineStatus();
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F03EventAction::SetEventVerbose(G4int level)
{
fVerboseLevel = level ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,57 +26,56 @@
/// \file field/field03/src/F03EventActionMessenger.cc
/// \brief Implementation of the F03EventActionMessenger class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03EventActionMessenger.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03EventActionMessenger.hh"
#include "F03EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03EventActionMessenger::F03EventActionMessenger(F03EventAction* action)
F03EventActionMessenger::F03EventActionMessenger(F03EventAction* evAct)
: G4UImessenger(),
fEventAction(action),
fEventAction(evAct),
fSetVerboseCmd(0),
fPrintCmd(0)
{
{
fSetVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
fSetVerboseCmd->SetGuidance("Set verbose level ." );
fSetVerboseCmd->SetGuidance("Set verbose level .");
fSetVerboseCmd->SetParameterName("level",true);
fSetVerboseCmd->SetDefaultValue(0);
fPrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
fPrintCmd->SetGuidance("Print events modulo n");
fPrintCmd->SetParameterName("EventNb",false);
fPrintCmd->SetRange("EventNb>0");
fPrintCmd->AvailableForStates(G4State_Idle);
fPrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03EventActionMessenger::~F03EventActionMessenger()
{
delete fSetVerboseCmd;
delete fPrintCmd;
delete fPrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (command == fSetVerboseCmd)
void F03EventActionMessenger::SetNewValue(G4UIcommand * command,
G4String newValue)
{
if(command == fSetVerboseCmd)
{fEventAction->SetEventVerbose(fSetVerboseCmd->GetNewIntValue(newValue));}
if (command == fPrintCmd)
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
if(command == fPrintCmd)
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,29 +26,33 @@
/// \file field/field03/src/F03FieldMessenger.cc
/// \brief Implementation of the F03FieldMessenger class
//
// $Id$
//
//
// $Id: F03FieldMessenger.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03FieldMessenger.hh"
#include "F03FieldSetup.hh"
#include "G4UIdirectory.hh"
#include "F03FieldSetup.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03FieldMessenger::F03FieldMessenger(F03FieldSetup* pEMfield)
F03FieldMessenger::F03FieldMessenger(F03FieldSetup* fieldSetup)
: G4UImessenger(),
fEMfieldSetup(pEMfield),
fEMfieldSetup(fieldSetup),
fFieldDir(0),
fStepperCmd(0),
fMagFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
{
{
fFieldDir = new G4UIdirectory("/field/");
fFieldDir->SetGuidance("F03 field tracking control.");
@@ -57,63 +61,54 @@ F03FieldMessenger::F03FieldMessenger(F03FieldSetup* pEMfield)
fStepperCmd->SetParameterName("choice",true);
fStepperCmd->SetDefaultValue(4);
fStepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
fUpdateCmd->SetGuidance("Update calorimeter geometry.");
fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
fUpdateCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
fMagFieldCmd->SetGuidance("Define magnetic field.");
fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
fMagFieldCmd->SetParameterName("Bz",false,false);
fMagFieldCmd->SetDefaultUnit("tesla");
fMagFieldCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd->AvailableForStates(G4State_Idle);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
fMinStepCmd->SetGuidance("Define minimal step");
fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
fMinStepCmd->SetParameterName("min step",false,false);
fMinStepCmd->SetDefaultUnit("mm");
fMinStepCmd->AvailableForStates(G4State_Idle);
fMinStepCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03FieldMessenger::~F03FieldMessenger()
{
delete fStepperCmd;
delete fMagFieldCmd;
delete fMinStepCmd;
delete fUpdateCmd;
delete fFieldDir;
delete fUpdateCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
{
{
if( command == fStepperCmd )
{
fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
}
if( command == fUpdateCmd )
{
fEMfieldSetup->UpdateField();
}
fEMfieldSetup->UpdateField();
if( command == fMagFieldCmd )
{
fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
// Check the value
G4cout << "Set field value to " <<
G4cout << "Set field value to " <<
fEMfieldSetup->GetConstantFieldValue() / gauss << " Gauss " << G4endl;
}
if( command == fMinStepCmd )
{
fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,17 +27,20 @@
/// \brief Implementation of the F03FieldSetup class
//
//
// $Id$
// $Id: F03FieldSetup.cc 77294 2013-11-22 11:01:00Z gcosmo $
//
//
//
// Field Setup class implementation.
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03FieldSetup.hh"
#include "F03FieldMessenger.hh"
#include "G4UniformMagField.hh"
#include "G4MagneticField.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4Mag_UsualEqRhs.hh"
@@ -54,31 +57,39 @@
#include "G4HelixSimpleRunge.hh"
#include "G4CashKarpRKF45.hh"
#include "G4RKG3_Stepper.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//////////////////////////////////////////////////////////////////////////
//
// Constructors:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03FieldSetup::F03FieldSetup()
: fChordFinder(0), fLocalChordFinder(0), fStepper(0)
: fFieldManager(0),
fLocalFieldManager(0),
fChordFinder(0),
fLocalChordFinder(0),
fEquation(0),
fLocalEquation(0),
fMagneticField(0),
fLocalMagneticField(0),
fStepper(0),
fLocalStepper(0),
fFieldMessenger(0)
{
fMagneticField = new G4UniformMagField(
G4ThreeVector(3.3*tesla,
0.0, // 0.5*tesla,
0.0 ));
fLocalMagneticField = new G4UniformMagField(
G4ThreeVector(3.3*tesla,
0.0, // 0.5*tesla,
0.0 ));
fMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
0.0, // 0.5*tesla,
0.0));
fLocalMagneticField = new G4UniformMagField(G4ThreeVector(3.3*tesla,
0.0, // 0.5*tesla,
0.0));
fFieldMessenger = new F03FieldMessenger(this) ;
fFieldMessenger = new F03FieldMessenger(this);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fLocalEquation = new G4Mag_UsualEqRhs(fLocalMagneticField);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fLocalEquation = new G4Mag_UsualEqRhs(fLocalMagneticField);
fMinStep = 0.25*mm ; // minimal step of 1 mm is default
fStepperType = 4 ; // ClassicalRK4 is default stepper
fStepperType = 4 ; // ClassicalRK4 is default stepper
fFieldManager = GetGlobalFieldManager();
fLocalFieldManager = new G4FieldManager();
@@ -86,176 +97,154 @@ F03FieldSetup::F03FieldSetup()
UpdateField();
}
/////////////////////////////////////////////////////////////////////////////////
F03FieldSetup::F03FieldSetup(G4ThreeVector fieldVector)
{
fMagneticField = new G4UniformMagField(fieldVector);
GetGlobalFieldManager()->CreateChordFinder(fMagneticField);
}
////////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03FieldSetup::~F03FieldSetup()
{
if(fMagneticField) delete fMagneticField;
if(fChordFinder) delete fChordFinder;
if(fStepper) delete fStepper;
delete fMagneticField;
delete fChordFinder;
delete fStepper;
delete fFieldMessenger;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update field
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03FieldSetup::UpdateField()
{
SetStepper();
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl;
fFieldManager->SetDetectorField(fMagneticField );
fLocalFieldManager->SetDetectorField(fLocalMagneticField );
fFieldManager->SetDetectorField(fMagneticField);
fLocalFieldManager->SetDetectorField(fLocalMagneticField);
if(fChordFinder) delete fChordFinder;
if(fLocalChordFinder) delete fLocalChordFinder;
if (fChordFinder) delete fChordFinder;
if (fLocalChordFinder) delete fLocalChordFinder;
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper);
fLocalChordFinder = new G4ChordFinder( fLocalMagneticField,
fMinStep,fLocalStepper);
fChordFinder = new G4ChordFinder(fMagneticField, fMinStep, fStepper);
fLocalChordFinder = new G4ChordFinder(fLocalMagneticField,
fMinStep,fLocalStepper);
fFieldManager->SetChordFinder( fChordFinder );
fLocalFieldManager->SetChordFinder( fLocalChordFinder );
fFieldManager->SetChordFinder(fChordFinder);
fLocalFieldManager->SetChordFinder(fLocalChordFinder);
}
/////////////////////////////////////////////////////////////////////////////
//
// Set stepper according to the stepper type
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03FieldSetup::SetStepper()
{
if(fStepper) delete fStepper;
if (fStepper) delete fStepper;
switch ( fStepperType )
switch ( fStepperType )
{
case 0:
fStepper = new G4ExplicitEuler( fEquation );
fLocalStepper = new G4ExplicitEuler( fLocalEquation );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
case 0:
fStepper = new G4ExplicitEuler( fEquation );
fLocalStepper = new G4ExplicitEuler( fLocalEquation );
G4cout<<"G4ExplicitEuler is called"<<G4endl;
break;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
fLocalStepper = new G4ImplicitEuler( fLocalEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
fLocalStepper = new G4ImplicitEuler( fLocalEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
break;
case 2:
fStepper = new G4SimpleRunge( fEquation );
fLocalStepper = new G4SimpleRunge( fLocalEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
case 2:
fStepper = new G4SimpleRunge( fEquation );
fLocalStepper = new G4SimpleRunge( fLocalEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
break;
case 3:
fStepper = new G4SimpleHeum( fEquation );
fLocalStepper = new G4SimpleHeum( fLocalEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
case 3:
fStepper = new G4SimpleHeum( fEquation );
fLocalStepper = new G4SimpleHeum( fLocalEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
break;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
fLocalStepper = new G4ClassicalRK4( fLocalEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
fLocalStepper = new G4ClassicalRK4( fLocalEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
break;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
fLocalStepper = new G4HelixExplicitEuler( fLocalEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
fLocalStepper = new G4HelixExplicitEuler( fLocalEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
break;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
fLocalStepper = new G4HelixImplicitEuler( fLocalEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
fLocalStepper = new G4HelixImplicitEuler( fLocalEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
break;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
fLocalStepper = new G4HelixSimpleRunge( fLocalEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
fLocalStepper = new G4HelixSimpleRunge( fLocalEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
break;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
fLocalStepper = new G4CashKarpRKF45( fLocalEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
fLocalStepper = new G4CashKarpRKF45( fLocalEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
break;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
fLocalStepper = new G4RKG3_Stepper( fLocalEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
fLocalStepper = new G4RKG3_Stepper( fLocalEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
break;
default: fStepper = 0;
}
}
/////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field to fieldValue along Z
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03FieldSetup::SetFieldValue(G4double fieldStrength)
{
G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
this->SetFieldValue( fieldSetVec );
// *************
SetFieldValue( fieldSetVec );
}
///////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
if(fMagneticField) delete fMagneticField;
if(fieldVector != G4ThreeVector(0.,0.,0.))
{
{
fMagneticField = new G4UniformMagField(fieldVector);
}
else
else
{
// If the new field's value is Zero, then
// setting the pointer to zero ensures
// that it is not used for propagation.
fMagneticField = 0;
// If the new field's value is Zero, then
// setting the pointer to zero ensures
// that it is not used for propagation.
fMagneticField = 0;
}
// Either
// Either
// - UpdateField() to reset all (ChordFinder, Equation);
// UpdateField();
// or simply update the field manager & equation of motion
// with pointer to new field
// UpdateField();
// or simply update the field manager & equation of motion
// with pointer to new field
GetGlobalFieldManager()->SetDetectorField(fMagneticField);
fEquation->SetFieldObj( fMagneticField );
fEquation->SetFieldObj( fMagneticField );
}
////////////////////////////////////////////////////////////////////////////////
//
// Utility method
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* F03FieldSetup::GetGlobalFieldManager()
G4FieldManager* F03FieldSetup::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// In place of G4UniformField::GetConstantFieldValue ...
//
G4ThreeVector F03FieldSetup::GetConstantFieldValue()
{
static G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
static G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
fMagneticField->GetFieldValue( position, fieldValue);
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
return fieldVec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,11 +27,14 @@
/// \brief Implementation of the F03PhysicsList class
//
//
// $Id$
//
// $Id: F03PhysicsList.cc 77795 2013-11-28 09:55:34Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Timer.hh"
#include "F03PhysicsList.hh"
#include "F03DetectorConstruction.hh"
#include "F03PhysicsListMessenger.hh"
@@ -43,65 +46,49 @@
#include "G4Material.hh"
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include <iomanip>
/////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PhysicsList::F03PhysicsList(F03DetectorConstruction* p)
: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
thePhotoElectricEffect(0), theComptonScattering(0),
theGammaConversion(0), theeminusIonisation(0),
theeminusBremsstrahlung(0), theeplusIonisation(0),
theeplusBremsstrahlung(0), theeplusAnnihilation(0),
theeminusStepCut(0), theeplusStepCut(0)
: G4VUserPhysicsList(), fMaxChargedStep(DBL_MAX)
{
pDet = p;
fDet = p;
defaultCutValue = 1.000*mm ;
defaultCutValue = 1.000*mm;
cutForGamma = defaultCutValue ;
cutForElectron = defaultCutValue ;
fCutForGamma = defaultCutValue;
fCutForElectron = defaultCutValue;
SetVerboseLevel(1);
physicsListMessenger = new F03PhysicsListMessenger(this);
fPhysicsListMessenger = new F03PhysicsListMessenger(this);
}
/////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PhysicsList::~F03PhysicsList()
{
delete physicsListMessenger;
delete fPhysicsListMessenger;
}
///////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
G4GenericIon::GenericIonDefinition();
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructBosons()
{
@@ -113,9 +100,10 @@ void F03PhysicsList::ConstructBosons()
G4ChargedGeantino::ChargedGeantinoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructLeptons()
{
// leptons
@@ -131,9 +119,11 @@ void F03PhysicsList::ConstructLeptons()
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructMesons()
{
// mesons
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
@@ -142,32 +132,27 @@ void F03PhysicsList::ConstructMesons()
G4KaonMinus::KaonMinusDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructBarions()
{
// barions
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
}
///////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::ConstructProcess()
{
AddTransportation();
//AddParameterisation();
ConstructEM();
ConstructGeneral();
}
/////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
@@ -199,90 +184,82 @@ void F03PhysicsList::ConstructEM()
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma")
if (particleName == "gamma")
{
// Construct processes for gamma
thePhotoElectricEffect = new G4PhotoElectricEffect();
theComptonScattering = new G4ComptonScattering();
theGammaConversion = new G4GammaConversion();
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
pmanager->AddDiscreteProcess(theComptonScattering);
G4PhotoElectricEffect* fPhotoElectricEffect = new G4PhotoElectricEffect();
G4ComptonScattering* fComptonScattering = new G4ComptonScattering();
G4GammaConversion* fGammaConversion = new G4GammaConversion();
pmanager->AddDiscreteProcess(theGammaConversion);
}
else if (particleName == "e-")
pmanager->AddDiscreteProcess(fPhotoElectricEffect);
pmanager->AddDiscreteProcess(fComptonScattering);
pmanager->AddDiscreteProcess(fGammaConversion);
}
else if (particleName == "e-")
{
// Construct processes for electron
// Construct processes for electron
theeminusIonisation = new G4eIonisation();
theeminusBremsstrahlung = new G4eBremsstrahlung();
G4eIonisation* feminusIonisation = new G4eIonisation();
G4eBremsstrahlung* feminusBremsstrahlung = new G4eBremsstrahlung();
F03StepCut* feminusStepCut = new F03StepCut();
feminusStepCut->SetMaxStep(fMaxChargedStep);
theeminusStepCut = new F03StepCut();
pmanager->AddProcess(theeminusIonisation,-1,2,2);
pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(theeminusStepCut,-1,-1,4);
theeminusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if (particleName == "e+")
pmanager->AddProcess(feminusIonisation,-1,2,2);
pmanager->AddProcess(feminusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(feminusStepCut,-1,-1,4);
}
else if (particleName == "e+")
{
// Construct processes for positron
// Construct processes for positron
theeplusIonisation = new G4eIonisation();
theeplusBremsstrahlung = new G4eBremsstrahlung();
theeplusStepCut = new F03StepCut();
pmanager->AddProcess(theeplusIonisation,-1,2,2);
pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(theeplusStepCut,-1,-1,5);
theeplusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if( particleName == "mu+" ||
particleName == "mu-" )
G4eIonisation* feplusIonisation = new G4eIonisation();
G4eBremsstrahlung* feplusBremsstrahlung = new G4eBremsstrahlung();
F03StepCut* feplusStepCut = new F03StepCut();
feplusStepCut->SetMaxStep(fMaxChargedStep);
pmanager->AddProcess(feplusIonisation,-1,2,2);
pmanager->AddProcess(feplusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(feplusStepCut,-1,-1,5);
}
else if( particleName == "mu+" || particleName == "mu-" )
{
// Construct processes for muon+
// Construct processes for muon+
F03StepCut* muonStepCut = new F03StepCut();
muonStepCut->SetMaxStep(fMaxChargedStep);
G4MuIonisation* muIonisation = new G4MuIonisation();
G4MuIonisation* themuIonisation = new G4MuIonisation() ;
pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
pmanager->AddProcess(themuIonisation,-1,2,2);
pmanager->AddProcess(muIonisation,-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
pmanager->AddProcess( muonStepCut,-1,-1,3);
muonStepCut->SetMaxStep(MaxChargedStep) ;
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
pmanager->AddProcess(muonStepCut,-1,-1,3);
}
else if (
particleName == "proton"
|| particleName == "antiproton"
|| particleName == "pi+"
|| particleName == "pi-"
|| particleName == "kaon+"
|| particleName == "kaon-"
)
else if ( particleName == "proton"
|| particleName == "antiproton"
|| particleName == "pi+"
|| particleName == "pi-"
|| particleName == "kaon+"
|| particleName == "kaon-"
)
{
F03StepCut* thehadronStepCut = new F03StepCut();
G4hIonisation* thehIonisation = new G4hIonisation() ;
F03StepCut* theHadronStepCut = new F03StepCut();
theHadronStepCut->SetMaxStep(10*mm);
G4hIonisation* thehIonisation = new G4hIonisation();
G4hMultipleScattering* thehMultipleScattering =
new G4hMultipleScattering() ;
new G4hMultipleScattering();
pmanager->AddProcess(thehMultipleScattering,-1,1,1);
pmanager->AddProcess(thehIonisation,-1,2,2);
pmanager->AddProcess( thehadronStepCut,-1,-1,3);
thehadronStepCut->SetMaxStep(MaxChargedStep) ;
pmanager->AddProcess(theHadronStepCut,-1,-1,3);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Decay.hh"
@@ -298,8 +275,8 @@ void F03PhysicsList::ConstructGeneral()
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle))
{
if (theDecayProcess->IsApplicable(*particle))
{
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
@@ -310,12 +287,12 @@ void F03PhysicsList::ConstructGeneral()
}
}
/////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::SetCuts()
{
G4Timer theTimer ;
theTimer.Start() ;
G4Timer theTimer;
theTimer.Start();
if (verboseLevel >0)
{
G4cout << "F03PhysicsList::SetCuts:";
@@ -323,40 +300,42 @@ void F03PhysicsList::SetCuts()
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(fCutForGamma,"gamma");
SetCutValue(cutForGamma,"gamma");
SetCutValue(cutForElectron,"e-");
SetCutValue(cutForElectron,"e+");
SetCutValue(fCutForElectron,"e-");
SetCutValue(fCutForElectron,"e+");
if (verboseLevel>1) DumpCutValuesTable();
theTimer.Stop();
G4cout.precision(6);
G4cout << G4endl ;
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
G4cout << G4endl;
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed()
<< " s " <<G4endl;
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::SetGammaCut(G4double val)
{
cutForGamma = val;
fCutForGamma = val;
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::SetElectronCut(G4double val)
{
cutForElectron = val;
fCutForElectron = val;
}
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsList::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
fMaxChargedStep = step;
G4cout << " MaxChargedStep=" << fMaxChargedStep << G4endl;
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,69 +27,62 @@
/// \brief Implementation of the F03PhysicsListMessenger class
//
//
// $Id$
// $Id: F03PhysicsListMessenger.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03PhysicsListMessenger.hh"
#include "F03PhysicsList.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PhysicsListMessenger::F03PhysicsListMessenger(F03PhysicsList * List)
:F03List(List)
: fF03List(List)
{
cutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
cutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
cutGCmd->SetParameterName("range",true);
cutGCmd->SetDefaultValue(1.);
cutGCmd->SetDefaultUnit("mm");
cutGCmd->AvailableForStates(G4State_Idle);
fCutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
fCutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
fCutGCmd->SetParameterName("range",true);
fCutGCmd->SetDefaultValue(1.);
fCutGCmd->SetDefaultUnit("mm");
fCutGCmd->AvailableForStates(G4State_Idle);
cutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
cutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
cutECmd->SetParameterName("range",true);
cutECmd->SetDefaultValue(1.);
cutECmd->SetDefaultUnit("mm");
cutECmd->AvailableForStates(G4State_Idle);
setMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
setMaxStepCmd->SetGuidance("Set max. step length in the detector");
setMaxStepCmd->SetParameterName("mxStep",true);
setMaxStepCmd->SetDefaultUnit("mm");
fCutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
fCutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
fCutECmd->SetParameterName("range",true);
fCutECmd->SetDefaultValue(1.);
fCutECmd->SetDefaultUnit("mm");
fCutECmd->AvailableForStates(G4State_Idle);
fSetMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
fSetMaxStepCmd->SetGuidance("Set max. step length in the detector");
fSetMaxStepCmd->SetParameterName("mxStep",true);
fSetMaxStepCmd->SetDefaultUnit("mm");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PhysicsListMessenger::~F03PhysicsListMessenger()
{
delete setMaxStepCmd;
delete cutGCmd;
delete cutECmd;
delete fSetMaxStepCmd;
delete fCutGCmd;
delete fCutECmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F03PhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == cutGCmd)
{ F03List->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
if(command == cutECmd)
{ F03List->SetElectronCut(eCmd->GetNewDoubleValue(newValue));}
if(command == setMaxStepCmd)
{ F03List->SetMaxStep(setMaxStepCmd->GetNewDoubleValue(newValue));}
if(command == fCutGCmd)
{fF03List->SetGammaCut(fCutGCmd->GetNewDoubleValue(newValue));}
if(command == fCutECmd)
{fF03List->SetElectronCut(fCutECmd->GetNewDoubleValue(newValue));}
if(command == fSetMaxStepCmd)
{fF03List->SetMaxStep(fSetMaxStepCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,13 +26,15 @@
/// \file field/field03/src/F03PrimaryGeneratorAction.cc
/// \brief Implementation of the F03PrimaryGeneratorAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03PrimaryGeneratorAction.cc 77892 2013-11-29 08:56:08Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03PrimaryGeneratorAction.hh"
#include "F03DetectorConstruction.hh"
#include "F03PrimaryGeneratorMessenger.hh"
@@ -40,35 +42,34 @@
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String F03PrimaryGeneratorAction::fgPrimaryParticleName="e-" ;
G4ParticleDefinition* F03PrimaryGeneratorAction::fgPrimaryParticle = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PrimaryGeneratorAction::F03PrimaryGeneratorAction(
F03DetectorConstruction* det)
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fDetector(det),
fMessenger(0),
fRndmFlag("off"),
fDetector(det),
fGunMessenger(0),
fRndmFlag("off"),
fXVertex(0.),
fYVertex(0.),
fZVertex(0.),
fYVertex(0.),
fZVertex(0.),
fVertexDefined(false)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// create a messenger for this class
//
fMessenger = new F03PrimaryGeneratorMessenger(this);
fGunMessenger = new F03PrimaryGeneratorMessenger(this);
// default particle kinematic
@@ -77,8 +78,8 @@ F03PrimaryGeneratorAction::F03PrimaryGeneratorAction(
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
fParticleGun->SetParticleDefinition(particle);
fgPrimaryParticleName = particle->GetParticleName() ;
fgPrimaryParticle = particle;
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
fParticleGun->SetParticleEnergy(1.*GeV);
@@ -88,84 +89,84 @@ F03PrimaryGeneratorAction::F03PrimaryGeneratorAction(
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PrimaryGeneratorAction::~F03PrimaryGeneratorAction()
{
delete fParticleGun;
delete fMessenger;
delete fGunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
fgPrimaryParticleName
= fParticleGun->GetParticleDefinition()->GetParticleName() ;
G4double x0,y0,z0 ;
// this function is called at the begining of event
//
fgPrimaryParticle = fParticleGun->GetParticleDefinition();
G4double x0,y0,z0;
if (fVertexDefined)
{
x0 = fXVertex ;
y0 = fYVertex ;
z0 = fZVertex ;
x0 = fXVertex;
y0 = fYVertex;
z0 = fZVertex;
}
else
{
x0 = 0. ;
y0 = 0. ;
x0 = 0.;
y0 = 0.;
z0 = fDetector->GetAbsorberZpos()-0.5*(fDetector->GetAbsorberThickness());
}
G4double r0, phi0;
G4double r0,phi0;
if (fRndmFlag == "on")
{
r0 = (fDetector->GetAbsorberRadius())*std::sqrt(G4UniformRand());
phi0 = twopi*G4UniformRand();
x0 = r0*std::cos(phi0);
y0 = r0*std::sin(phi0);
}
}
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String F03PrimaryGeneratorAction::GetPrimaryName()
{
return fgPrimaryParticleName ;
return fgPrimaryParticle->GetParticleName();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PrimaryGeneratorAction::SetXVertex(G4double x)
{
fVertexDefined = true ;
fXVertex = x ;
G4cout << " X coordinate of the primary vertex = " << fXVertex/mm
<< " mm." << G4endl;
fVertexDefined = true;
fXVertex = x;
G4cout << " X coordinate of the primary vertex = " << fXVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PrimaryGeneratorAction::SetYVertex(G4double y)
{
fVertexDefined = true ;
fYVertex = y ;
G4cout << " Y coordinate of the primary vertex = " << fYVertex/mm
<< " mm." << G4endl;
fVertexDefined = true;
fYVertex = y;
G4cout << " Y coordinate of the primary vertex = " << fYVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PrimaryGeneratorAction::SetZVertex(G4double z)
{
fVertexDefined = true ;
fZVertex = z ;
G4cout << " Z coordinate of the primary vertex = " << fZVertex/mm
<< " mm." << G4endl;
fVertexDefined = true;
fZVertex = z;
G4cout << " Z coordinate of the primary vertex = " << fZVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,20 +26,21 @@
/// \file field/field03/src/F03PrimaryGeneratorMessenger.cc
/// \brief Implementation of the F03PrimaryGeneratorMessenger class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03PrimaryGeneratorMessenger.cc 77892 2013-11-29 08:56:08Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03PrimaryGeneratorMessenger.hh"
#include "F03PrimaryGeneratorAction.hh"
#include "F03PrimaryGeneratorAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PrimaryGeneratorMessenger::F03PrimaryGeneratorMessenger(
F03PrimaryGeneratorAction* action)
@@ -49,7 +50,7 @@ F03PrimaryGeneratorMessenger::F03PrimaryGeneratorMessenger(
fSetXVertexCmd(0),
fSetYVertexCmd(0),
fSetZVertexCmd(0)
{
{
fRndmCmd = new G4UIcmdWithAString("/gun/random",this);
fRndmCmd->SetGuidance("Shoot randomly the incident particle.");
fRndmCmd->SetGuidance(" Choice : on, off(default)");
@@ -61,21 +62,24 @@ F03PrimaryGeneratorMessenger::F03PrimaryGeneratorMessenger(
fSetXVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
fSetXVertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
fSetXVertexCmd->SetParameterName("xv",true);
fSetXVertexCmd->SetDefaultValue(0.0*mm) ;
fSetXVertexCmd->SetDefaultValue(0.0*mm);
fSetXVertexCmd->SetDefaultUnit("mm");
fSetYVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
fSetYVertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
fSetYVertexCmd->SetParameterName("yv",true);
fSetYVertexCmd->SetDefaultValue(0.0*mm) ;
fSetYVertexCmd->SetDefaultValue(0.0*mm);
fSetYVertexCmd->SetDefaultUnit("mm");
fSetZVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
fSetZVertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
fSetZVertexCmd->SetParameterName("zv",true);
fSetZVertexCmd->SetDefaultValue(0.0*mm) ;
fSetZVertexCmd->SetDefaultValue(0.0*mm);
fSetZVertexCmd->SetDefaultUnit("mm");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03PrimaryGeneratorMessenger::~F03PrimaryGeneratorMessenger()
{
@@ -85,19 +89,19 @@ F03PrimaryGeneratorMessenger::~F03PrimaryGeneratorMessenger()
delete fSetZVertexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,
G4String newValue)
{
{
if( command == fRndmCmd )
{ fAction->SetRndmFlag(newValue);}
if( command == fSetXVertexCmd)
if( command == fSetXVertexCmd )
{ fAction->SetXVertex(fSetXVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetYVertexCmd)
if( command == fSetYVertexCmd )
{ fAction->SetYVertex(fSetYVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetZVertexCmd)
if( command == fSetZVertexCmd )
{ fAction->SetZVertex(fSetZVertexCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,11 +26,12 @@
/// \file field/field03/src/F03RunAction.cc
/// \brief Implementation of the F03RunAction class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// $Id: F03RunAction.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03RunAction.hh"
#include "F03RunMessenger.hh"
@@ -38,47 +39,46 @@
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03RunAction::F03RunAction()
: G4UserRunAction(),
fRunMessenger(0),
fMessenger(0),
fSaveRndm(0)
{
fRunMessenger = new F03RunMessenger(this);
fMessenger = new F03RunMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03RunAction::~F03RunAction()
{
delete fRunMessenger;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
///
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03RunAction::BeginOfRunAction(const G4Run* run)
{
{
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
// save Rndm status
if (fSaveRndm > 0)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
}
G4UImanager* uiManager = G4UImanager::GetUIpointer();
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("beginOfRun.rndm");
}
G4UImanager* ui = G4UImanager::GetUIpointer();
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if(visManager) uiManager->ApplyCommand("/vis/scene/notifyHandlers");
if (visManager) ui->ApplyCommand("/vis/scene/notifyHandlers");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03RunAction::EndOfRunAction(const G4Run*)
{
@@ -90,10 +90,10 @@ void F03RunAction::EndOfRunAction(const G4Run*)
// save Rndm status
if (fSaveRndm == 1)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
}
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("endOfRun.rndm");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,23 +26,21 @@
/// \file field/field03/src/F03RunMessenger.cc
/// \brief Implementation of the F03RunMessenger class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// $Id: F03RunMessenger.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03RunMessenger.hh"
#include "F03RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03RunMessenger::F03RunMessenger(F03RunAction* action)
: G4UImessenger(),
@@ -50,48 +48,49 @@ F03RunMessenger::F03RunMessenger(F03RunAction* action)
fRndmDir(0),
fRndmSaveCmd(0),
fRndmReadCmd(0)
{
{
fRndmDir = new G4UIdirectory("/rndm/");
fRndmDir->SetGuidance("Rndm status control.");
fRndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
fRndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
fRndmSaveCmd->
SetGuidance("set frequency to save rndm status on external files.");
fRndmSaveCmd->SetGuidance("freq = 0 not saved");
fRndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
fRndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
fRndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
fRndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
fRndmSaveCmd->SetParameterName("frequency",false);
fRndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
fRndmReadCmd->SetGuidance("get rndm status from an external file.");
fRndmReadCmd->SetParameterName("fileName",true);
fRndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03RunMessenger::~F03RunMessenger()
{
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
{
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == fRndmSaveCmd)
fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValues));
if (command == fRndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
CLHEP::HepRandom::restoreEngineStatus(newValues);
CLHEP::HepRandom::showEngineStatus();
}
{G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
G4Random::restoreEngineStatus(newValues);
G4Random::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,11 +26,11 @@
/// \file field/field03/src/F03StepCut.cc
/// \brief Implementation of the F03StepCut class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// $Id: F03StepCut.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03StepCut.hh"
@@ -39,7 +39,7 @@
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03StepCut::F03StepCut(const G4String& aName)
: G4VDiscreteProcess(aName),
@@ -50,25 +50,22 @@ F03StepCut::F03StepCut(const G4String& aName)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03StepCut::~F03StepCut()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03StepCut::F03StepCut(F03StepCut& right)
: G4VDiscreteProcess(right),
fMaxChargedStep(right.fMaxChargedStep)
: G4VDiscreteProcess(right)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03StepCut::SetMaxStep(G4double step)
{
fMaxChargedStep = step ;
fMaxChargedStep = step;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,54 +26,55 @@
/// \file field/field03/src/F03SteppingVerbose.cc
/// \brief Implementation of the F03SteppingVerbose class
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
// $Id: F03SteppingVerbose.cc 76602 2013-11-13 08:33:35Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F03SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03SteppingVerbose::F03SteppingVerbose()
: G4SteppingVerbose()
: G4SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F03SteppingVerbose::~F03SteppingVerbose()
{}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(8);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "KineE" << " "
<< std::setw(10) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process"
<< std::setw(10) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process"
<< std::setw(10) << "Dir_x" << " "
<< std::setw(10) << "Dir_y" << " "
<< std::setw(10) << "Dir_y" << " "
<< std::setw(10) << "Dir_z" << " "
<< G4endl;
<< G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
@@ -81,27 +82,32 @@ void F03SteppingVerbose::StepInfo()
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(
fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if( fTrack->GetNextVolume() != 0 ) {
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
G4cout << " "
<< std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << " UserLimit";
}
G4cout << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().x(),"Length")
<< std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().y(),"Length")
<< std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().z(),"Length");
G4cout << std::setw(12)
<< G4BestUnit(fTrack->GetMomentumDirection().x(),"Length")
<< std::setw(12)
<< G4BestUnit(fTrack->GetMomentumDirection().y(),"Length")
<< std::setw(12)
<< G4BestUnit(fTrack->GetMomentumDirection().z(),"Length");
G4cout << G4endl;
@@ -111,7 +117,7 @@ void F03SteppingVerbose::StepInfo()
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
@@ -120,7 +126,7 @@ void F03SteppingVerbose::StepInfo()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
@@ -135,44 +141,45 @@ void F03SteppingVerbose::StepInfo()
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F03SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(
fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
@@ -186,4 +193,4 @@ G4int prec = G4cout.precision(3);
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......