Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+1 -4
View File
@@ -1,10 +1,7 @@
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
cmake_minimum_required(VERSION 3.12...3.20)
project(B2a)
#----------------------------------------------------------------------------
+11 -9
View File
@@ -31,7 +31,7 @@
#include "B2ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
@@ -47,14 +47,16 @@ int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
// Optionally: choose a different Random engine...
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
//use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
// Construct the default run manager
//
auto* runManager =
@@ -67,10 +69,10 @@ int main(int argc,char** argv)
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
runManager->SetUserInitialization(new B2ActionInitialization());
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
@@ -83,13 +85,13 @@ int main(int argc,char** argv)
// Process macro or start UI session
//
if ( ! ui ) {
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
File diff suppressed because it is too large Load Diff
@@ -49,4 +49,4 @@ class B2ActionInitialization : public G4VUserActionInitialization
#endif
@@ -38,21 +38,21 @@ class G4Event;
/// The primary generator action class with particle gum.
///
/// It defines a single particle which hits the Tracker
/// It defines a single particle which hits the Tracker
/// perpendicular to the input face. The type of the particle
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// (see the macros provided with this example).
class B2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B2PrimaryGeneratorAction();
B2PrimaryGeneratorAction();
virtual ~B2PrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event* );
G4ParticleGun* GetParticleGun() {return fParticleGun;}
// Set methods
void SetRandomFlag(G4bool );
+3 -3
View File
@@ -44,16 +44,16 @@ class G4HCofThisEvent;
/// B2Tracker sensitive detector class
///
/// The hits are accounted in hits in ProcessHits() function which is called
/// by Geant4 kernel at each step. A hit is created with each step with non zero
/// by Geant4 kernel at each step. A hit is created with each step with non zero
/// energy deposit.
class B2TrackerSD : public G4VSensitiveDetector
{
public:
B2TrackerSD(const G4String& name,
B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName);
virtual ~B2TrackerSD();
// methods from base class
virtual void Initialize(G4HCofThisEvent* hitCollection);
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
@@ -65,7 +65,7 @@ class B2aDetectorConstruction : public G4VUserDetectorConstruction
// methods
void DefineMaterials();
G4VPhysicalVolume* DefineVolumes();
// data members
G4int fNbOfChambers;
@@ -79,10 +79,10 @@ class B2aDetectorConstruction : public G4VUserDetectorConstruction
B2aDetectorMessenger* fMessenger; // messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,9 +52,9 @@ class B2aDetectorMessenger: public G4UImessenger
public:
B2aDetectorMessenger(B2aDetectorConstruction* );
virtual ~B2aDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
B2aDetectorConstruction* fDetectorConstruction;
@@ -57,6 +57,6 @@ void B2ActionInitialization::Build() const
SetUserAction(new B2PrimaryGeneratorAction);
SetUserAction(new B2RunAction);
SetUserAction(new B2EventAction);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -2
View File
@@ -71,9 +71,9 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
<< " trajectories stored in this event." << G4endl;
}
G4VHitsCollection* hc = event->GetHCofThisEvent()->GetHC(0);
G4cout << " "
G4cout << " "
<< hc->GetSize() << " hits stored in this event" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,7 +50,7 @@ B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
// default particle kinematic
G4ParticleDefinition* particleDefinition
G4ParticleDefinition* particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("proton");
fParticleGun->SetParticleDefinition(particleDefinition);
@@ -78,7 +78,7 @@ void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4double worldZHalfLength = 0;
G4LogicalVolume* worldLV
= G4LogicalVolumeStore::GetInstance()->GetVolume("World");
G4Box* worldBox = NULL;
G4Box* worldBox = nullptr;
if ( worldLV ) worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
if ( worldBox ) worldZHalfLength = worldBox->GetZHalfLength();
else {
+3 -3
View File
@@ -36,9 +36,9 @@
B2RunAction::B2RunAction()
: G4UserRunAction()
{
{
// set printing event number per each 100 events
G4RunManager::GetRunManager()->SetPrintProgress(1000);
G4RunManager::GetRunManager()->SetPrintProgress(1000);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +49,7 @@ B2RunAction::~B2RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::BeginOfRunAction(const G4Run*)
{
{
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
}
+1 -1
View File
@@ -36,7 +36,7 @@
#include <iomanip>
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator=0;
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+11 -11
View File
@@ -37,16 +37,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name),
fHitsCollection(NULL)
fHitsCollection(nullptr)
{
collectionName.insert(hitsCollectionName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::~B2TrackerSD()
B2TrackerSD::~B2TrackerSD()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,21 +55,21 @@ void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
G4int hcID
G4int hcID
= G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
hce->AddHitsCollection( hcID, fHitsCollection );
hce->AddHitsCollection( hcID, fHitsCollection );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4TouchableHistory*)
{
{
// energy deposit
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -94,10 +94,10 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
void B2TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
if ( verboseLevel>1 ) {
G4int nofHits = fHitsCollection->entries();
G4cout << G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
for ( G4int i=0; i<nofHits; i++ ) (*fHitsCollection)[i]->Print();
}
@@ -26,7 +26,7 @@
//
/// \file B2aDetectorConstruction.cc
/// \brief Implementation of the B2aDetectorConstruction class
#include "B2aDetectorConstruction.hh"
#include "B2aDetectorMessenger.hh"
#include "B2TrackerSD.hh"
@@ -53,16 +53,16 @@
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B2aDetectorConstruction::fMagFieldMessenger = 0;
G4ThreadLocal
G4GlobalMagFieldMessenger* B2aDetectorConstruction::fMagFieldMessenger = nullptr;
B2aDetectorConstruction::B2aDetectorConstruction()
:G4VUserDetectorConstruction(),
:G4VUserDetectorConstruction(),
fNbOfChambers(0),
fLogicTarget(NULL), fLogicChamber(NULL),
fTargetMaterial(NULL), fChamberMaterial(NULL),
fStepLimit(NULL),
fLogicTarget(nullptr), fLogicChamber(nullptr),
fTargetMaterial(nullptr), fChamberMaterial(nullptr),
fStepLimit(nullptr),
fCheckOverlaps(true)
{
fMessenger = new B2aDetectorMessenger(this);
@@ -72,16 +72,16 @@ B2aDetectorConstruction::B2aDetectorConstruction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2aDetectorConstruction::~B2aDetectorConstruction()
{
delete [] fLogicChamber;
delete [] fLogicChamber;
delete fStepLimit;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2aDetectorConstruction::Construct()
{
// Define materials
@@ -95,13 +95,13 @@ G4VPhysicalVolume* B2aDetectorConstruction::Construct()
void B2aDetectorConstruction::DefineMaterials()
{
// Material definition
// Material definition
G4NistManager* nistManager = G4NistManager::Instance();
// Air defined using NIST Manager
nistManager->FindOrBuildMaterial("G4_AIR");
// Lead defined using NIST Manager
fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb");
@@ -119,18 +119,18 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
G4Material* air = G4Material::GetMaterial("G4_AIR");
// Sizes of the principal geometrical components (solids)
G4double chamberSpacing = 80*cm; // from chamber center to center!
G4double chamberWidth = 20.0*cm; // width of the chambers
G4double targetLength = 5.0*cm; // full length of Target
G4double trackerLength = (fNbOfChambers+1)*chamberSpacing;
G4double worldLength = 1.2 * (2*targetLength + trackerLength);
G4double targetRadius = 0.5*targetLength; // Radius of Target
targetLength = 0.5*targetLength; // Half length of the Target
targetLength = 0.5*targetLength; // Half length of the Target
G4double trackerSize = 0.5*trackerLength; // Half length of the Tracker
// Definitions of Solids, Logical Volumes, Physical Volumes
@@ -151,9 +151,9 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
worldS, //its solid
air, //its material
"World"); //its name
// Must place the World Physical volume unrotated at (0,0,0).
//
//
G4VPhysicalVolume* worldPV
= new G4PVPlacement(
0, // no rotation
@@ -163,10 +163,10 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
0, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
// Target
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetLength+trackerSize));
G4Tubs* targetS
@@ -180,19 +180,19 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
worldLV, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
G4cout << "Target is " << 2*targetLength/cm << " cm of "
<< fTargetMaterial->GetName() << G4endl;
// Tracker
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
G4Tubs* trackerS
= new G4Tubs("tracker",0,trackerSize,trackerSize, 0.*deg, 360.*deg);
G4LogicalVolume* trackerLV
= new G4LogicalVolume(trackerS, air, "Tracker",0,0,0);
= new G4LogicalVolume(trackerS, air, "Tracker",0,0,0);
new G4PVPlacement(0, // no rotation
positionTracker, // at (x,y,z)
trackerLV, // its logical volume
@@ -200,7 +200,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
worldLV, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
// Visualization attributes
@@ -217,9 +217,9 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
<< G4endl
<< "The chambers are " << chamberWidth/cm << " cm of "
<< fChamberMaterial->GetName() << G4endl
<< "The distance between chamber is " << chamberSpacing/cm << " cm"
<< "The distance between chamber is " << chamberSpacing/cm << " cm"
<< G4endl;
G4double firstPosition = -trackerSize + chamberSpacing;
G4double firstLength = trackerLength/10;
G4double lastLength = trackerLength;
@@ -257,7 +257,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
trackerLV, // its mother volume
false, // no boolean operations
copyNo, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
}
@@ -271,7 +271,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
G4double maxStep = 0.5*chamberWidth;
fStepLimit = new G4UserLimits(maxStep);
trackerLV->SetUserLimits(fStepLimit);
/// Set additional contraints on the track, with G4UserSpecialCuts
///
/// G4double maxLength = 2*trackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
@@ -286,7 +286,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::ConstructSDandField()
{
// Sensitive detectors
@@ -295,7 +295,7 @@ void B2aDetectorConstruction::ConstructSDandField()
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
G4SDManager::GetSDMpointer()->AddNewDetector(aTrackerSD);
// Setting aTrackerSD to all logical volumes with the same name
// Setting aTrackerSD to all logical volumes with the same name
// of "Chamber_LV".
SetSensitiveDetector("Chamber_LV", aTrackerSD, true);
@@ -305,36 +305,36 @@ void B2aDetectorConstruction::ConstructSDandField()
G4ThreeVector fieldValue = G4ThreeVector();
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
fMagFieldMessenger->SetVerboseLevel(1);
// Register the field messenger for deleting
G4AutoDelete::Register(fMagFieldMessenger);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetTargetMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* pttoMaterial =
G4Material* pttoMaterial =
nistManager->FindOrBuildMaterial(materialName);
if (fTargetMaterial != pttoMaterial) {
if ( pttoMaterial ) {
fTargetMaterial = pttoMaterial;
if (fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
G4cout
<< G4endl
G4cout
<< G4endl
<< "----> The target is made of " << materialName << G4endl;
} else {
G4cout
<< G4endl
G4cout
<< G4endl
<< "--> WARNING from SetTargetMaterial : "
<< materialName << " not found" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
@@ -351,12 +351,12 @@ void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
if (fLogicChamber[copyNo]) fLogicChamber[copyNo]->
SetMaterial(fChamberMaterial);
}
G4cout
<< G4endl
G4cout
<< G4endl
<< "----> The chambers are made of " << materialName << G4endl;
} else {
G4cout
<< G4endl
G4cout
<< G4endl
<< "--> WARNING from SetChamberMaterial : "
<< materialName << " not found" << G4endl;
}
@@ -375,4 +375,4 @@ void B2aDetectorConstruction::SetMaxStep(G4double maxStep)
void B2aDetectorConstruction::SetCheckOverlaps(G4bool checkOverlaps)
{
fCheckOverlaps = checkOverlaps;
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file B2aDetectorMessenger.cc
/// \brief Implementation of the B2aDetectorMessenger class
@@ -87,7 +87,7 @@ void B2aDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
if( command == fStepMaxCmd ) {
fDetectorConstruction
->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+1 -4
View File
@@ -1,10 +1,7 @@
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
cmake_minimum_required(VERSION 3.12...3.20)
project(B2b)
#----------------------------------------------------------------------------
+11 -9
View File
@@ -31,7 +31,7 @@
#include "B2ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
@@ -47,14 +47,16 @@ int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
// Optionally: choose a different Random engine...
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
//use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
// Construct the default run manager
//
auto* runManager =
@@ -67,10 +69,10 @@ int main(int argc,char** argv)
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
runManager->SetUserInitialization(new B2ActionInitialization());
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
@@ -89,7 +91,7 @@ int main(int argc,char** argv)
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
if (ui->IsGUI()) {
File diff suppressed because it is too large Load Diff
@@ -49,4 +49,4 @@ class B2ActionInitialization : public G4VUserActionInitialization
#endif
@@ -38,21 +38,21 @@ class G4Event;
/// The primary generator action class with particle gum.
///
/// It defines a single particle which hits the Tracker
/// It defines a single particle which hits the Tracker
/// perpendicular to the input face. The type of the particle
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// (see the macros provided with this example).
class B2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B2PrimaryGeneratorAction();
B2PrimaryGeneratorAction();
virtual ~B2PrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event* );
G4ParticleGun* GetParticleGun() {return fParticleGun;}
// Set methods
void SetRandomFlag(G4bool );
+2 -2
View File
@@ -50,10 +50,10 @@ class G4HCofThisEvent;
class B2TrackerSD : public G4VSensitiveDetector
{
public:
B2TrackerSD(const G4String& name,
B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName);
virtual ~B2TrackerSD();
// methods from base class
virtual void Initialize(G4HCofThisEvent* hitCollection);
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
@@ -56,21 +56,21 @@ class G4Polyhedra;
/// They are spaced an equal distance apart, starting from given location.
class B2bChamberParameterisation : public G4VPVParameterisation
{
{
public:
B2bChamberParameterisation(G4int noChambers,
G4double startZ,
B2bChamberParameterisation(G4int noChambers,
G4double startZ,
G4double spacing,
G4double widthChamber,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal );
virtual ~B2bChamberParameterisation();
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions (G4Tubs & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
@@ -103,12 +103,12 @@ class B2bChamberParameterisation : public G4VPVParameterisation
private:
G4int fNoChambers;
G4int fNoChambers;
G4double fStartZ;
G4double fHalfWidth; // The half-width of each tracker chamber
G4double fSpacing; // The distance between the chambers' center
G4double fRmaxFirst; // The first half-length
G4double fRmaxIncr; // The Increment for the half-length
G4double fRmaxFirst; // The first half-length
G4double fRmaxIncr; // The Increment for the half-length
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -65,7 +65,7 @@ class B2bDetectorConstruction : public G4VUserDetectorConstruction
// methods
void DefineMaterials();
G4VPhysicalVolume* DefineVolumes();
// data members
G4LogicalVolume* fLogicTarget; // pointer to the logical Target
G4LogicalVolume* fLogicChamber; // pointer to the logical Chamber
@@ -76,11 +76,11 @@ class B2bDetectorConstruction : public G4VUserDetectorConstruction
G4UserLimits* fStepLimit; // pointer to user step limits
B2bDetectorMessenger* fMessenger; // detector messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,9 +52,9 @@ class B2bDetectorMessenger: public G4UImessenger
public:
B2bDetectorMessenger(B2bDetectorConstruction* );
virtual ~B2bDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
B2bDetectorConstruction* fDetectorConstruction;
@@ -57,6 +57,6 @@ void B2ActionInitialization::Build() const
SetUserAction(new B2PrimaryGeneratorAction);
SetUserAction(new B2RunAction);
SetUserAction(new B2EventAction);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+2 -2
View File
@@ -71,9 +71,9 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
<< " trajectories stored in this event." << G4endl;
}
G4VHitsCollection* hc = event->GetHCofThisEvent()->GetHC(0);
G4cout << " "
G4cout << " "
<< hc->GetSize() << " hits stored in this event" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,7 +50,7 @@ B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
// default particle kinematic
G4ParticleDefinition* particleDefinition
G4ParticleDefinition* particleDefinition
= G4ParticleTable::GetParticleTable()->FindParticle("proton");
fParticleGun->SetParticleDefinition(particleDefinition);
@@ -78,7 +78,7 @@ void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4double worldZHalfLength = 0;
G4LogicalVolume* worldLV
= G4LogicalVolumeStore::GetInstance()->GetVolume("World");
G4Box* worldBox = NULL;
G4Box* worldBox = nullptr;
if ( worldLV ) worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
if ( worldBox ) worldZHalfLength = worldBox->GetZHalfLength();
else {
+3 -3
View File
@@ -36,9 +36,9 @@
B2RunAction::B2RunAction()
: G4UserRunAction()
{
{
// set printing event number per each 100 events
G4RunManager::GetRunManager()->SetPrintProgress(1000);
G4RunManager::GetRunManager()->SetPrintProgress(1000);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +49,7 @@ B2RunAction::~B2RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::BeginOfRunAction(const G4Run*)
{
{
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
}
+1 -1
View File
@@ -36,7 +36,7 @@
#include <iomanip>
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator=0;
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+12 -12
View File
@@ -37,16 +37,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name),
fHitsCollection(NULL)
fHitsCollection(nullptr)
{
collectionName.insert(hitsCollectionName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::~B2TrackerSD()
B2TrackerSD::~B2TrackerSD()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,21 +55,21 @@ void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
G4int hcID
G4int hcID
= G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
hce->AddHitsCollection( hcID, fHitsCollection );
hce->AddHitsCollection( hcID, fHitsCollection );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4TouchableHistory*)
{
{
// energy deposit
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -94,11 +94,11 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
void B2TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
if ( verboseLevel>1 ) {
G4int nofHits = fHitsCollection->entries();
G4cout
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
for ( G4int i=0; i<nofHits; i++ ) (*fHitsCollection)[i]->Print();
}
@@ -36,20 +36,20 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bChamberParameterisation::B2bChamberParameterisation(
G4int noChambers,
G4double startZ, // Z of center of first
B2bChamberParameterisation::B2bChamberParameterisation(
G4int noChambers,
G4double startZ, // Z of center of first
G4double spacingZ, // Z spacing of centers
G4double widthChamber,
G4double lengthInitial,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal )
: G4VPVParameterisation()
{
fNoChambers = noChambers;
fStartZ = startZ;
fNoChambers = noChambers;
fStartZ = startZ;
fHalfWidth = 0.5*widthChamber;
fSpacing = spacingZ;
fRmaxFirst = 0.5 * lengthInitial;
fRmaxFirst = 0.5 * lengthInitial;
if( noChambers > 0 ){
fRmaxIncr = 0.5 * (lengthFinal-lengthInitial)/(noChambers-1);
if (spacingZ < widthChamber) {
@@ -74,7 +74,7 @@ void B2bChamberParameterisation::ComputeTransformation
G4double Zposition = fStartZ + copyNo * fSpacing;
G4ThreeVector origin(0,0,Zposition);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
physVol->SetRotation(nullptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
//
/// \file B2bDetectorConstruction.cc
/// \brief Implementation of the B2bDetectorConstruction class
#include "B2bDetectorConstruction.hh"
#include "B2bDetectorMessenger.hh"
#include "B2bChamberParameterisation.hh"
@@ -56,21 +56,21 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B2bDetectorConstruction::fMagFieldMessenger = 0;
G4ThreadLocal
G4GlobalMagFieldMessenger* B2bDetectorConstruction::fMagFieldMessenger = nullptr;
B2bDetectorConstruction::B2bDetectorConstruction()
:G4VUserDetectorConstruction(),
fLogicTarget(NULL), fLogicChamber(NULL),
fTargetMaterial(NULL), fChamberMaterial(NULL),
fStepLimit(NULL),
fLogicTarget(nullptr), fLogicChamber(nullptr),
fTargetMaterial(nullptr), fChamberMaterial(nullptr),
fStepLimit(nullptr),
fCheckOverlaps(true)
{
fMessenger = new B2bDetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bDetectorConstruction::~B2bDetectorConstruction()
{
delete fStepLimit;
@@ -78,7 +78,7 @@ B2bDetectorConstruction::~B2bDetectorConstruction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2bDetectorConstruction::Construct()
{
// Define materials
@@ -92,13 +92,13 @@ G4VPhysicalVolume* B2bDetectorConstruction::Construct()
void B2bDetectorConstruction::DefineMaterials()
{
// Material definition
// Material definition
G4NistManager* nistManager = G4NistManager::Instance();
// Air defined using NIST Manager
nistManager->FindOrBuildMaterial("G4_AIR");
// Lead defined using NIST Manager
fTargetMaterial = nistManager->FindOrBuildMaterial("G4_Pb");
@@ -116,19 +116,19 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
G4Material* air = G4Material::GetMaterial("G4_AIR");
// Sizes of the principal geometrical components (solids)
G4int NbOfChambers = 5;
G4double chamberSpacing = 80*cm; // from chamber center to center!
G4double chamberWidth = 20.0*cm; // width of the chambers
G4double targetLength = 5.0*cm; // full length of Target
G4double trackerLength = (NbOfChambers+1)*chamberSpacing;
G4double worldLength = 1.2 * (2*targetLength + trackerLength);
G4double targetRadius = 0.5*targetLength; // Radius of Target
targetLength = 0.5*targetLength; // Half length of the Target
targetLength = 0.5*targetLength; // Half length of the Target
G4double trackerSize = 0.5*trackerLength; // Half length of the Tracker
// Definitions of Solids, Logical Volumes, Physical Volumes
@@ -149,9 +149,9 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
worldS, //its solid
air, //its material
"World"); //its name
// Must place the World Physical volume unrotated at (0,0,0).
//
//
G4VPhysicalVolume* worldPV
= new G4PVPlacement(
0, // no rotation
@@ -161,10 +161,10 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
0, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
// Target
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetLength+trackerSize));
G4Tubs* targetS
@@ -178,19 +178,19 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
worldLV, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
G4cout << "Target is " << 2*targetLength/cm << " cm of "
<< fTargetMaterial->GetName() << G4endl;
// Tracker
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
G4Tubs* trackerS
= new G4Tubs("tracker",0,trackerSize,trackerSize, 0.*deg, 360.*deg);
G4LogicalVolume* trackerLV
= new G4LogicalVolume(trackerS, air, "Tracker",0,0,0);
= new G4LogicalVolume(trackerS, air, "Tracker",0,0,0);
new G4PVPlacement(0, // no rotation
positionTracker, // at (x,y,z)
trackerLV, // its logical volume
@@ -198,18 +198,18 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
worldLV, // its mother volume
false, // no boolean operations
0, // copy number
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
// Tracker segments
// An example of Parameterised volumes
// Dummy values for G4Tubs -- modified by parameterised volume
G4Tubs* chamberS
= new G4Tubs("tracker",0, 100*cm, 100*cm, 0.*deg, 360.*deg);
fLogicChamber
fLogicChamber
= new G4LogicalVolume(chamberS,fChamberMaterial,"Chamber",0,0,0);
G4double firstPosition = -trackerSize + chamberSpacing;
G4double firstLength = trackerLength/10;
G4double lastLength = trackerLength;
@@ -220,36 +220,36 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
firstPosition, // Z of center of first
chamberSpacing, // Z spacing of centers
chamberWidth, // chamber width
firstLength, // initial length
firstLength, // initial length
lastLength); // final length
// dummy value : kZAxis -- modified by parameterised volume
new G4PVParameterised("Chamber", // their name
fLogicChamber, // their logical volume
trackerLV, // Mother logical volume
kZAxis, // Are placed along this axis
kZAxis, // Are placed along this axis
NbOfChambers, // Number of chambers
chamberParam, // The parametrisation
fCheckOverlaps); // checking overlaps
fCheckOverlaps); // checking overlaps
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
<< G4endl
<< "The chambers are " << chamberWidth/cm << " cm of "
<< fChamberMaterial->GetName() << G4endl
<< "The distance between chamber is " << chamberSpacing/cm << " cm"
<< "The distance between chamber is " << chamberSpacing/cm << " cm"
<< G4endl;
// Visualization attributes
G4VisAttributes* boxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
worldLV ->SetVisAttributes(boxVisAtt);
worldLV ->SetVisAttributes(boxVisAtt);
fLogicTarget ->SetVisAttributes(boxVisAtt);
trackerLV ->SetVisAttributes(boxVisAtt);
G4VisAttributes* chamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
fLogicChamber->SetVisAttributes(chamberVisAtt);
// Example of User Limits
//
// Below is an example of how to set tracking constraints in a given
@@ -260,7 +260,7 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
G4double maxStep = 0.5*chamberWidth;
fStepLimit = new G4UserLimits(maxStep);
trackerLV->SetUserLimits(fStepLimit);
/// Set additional contraints on the track, with G4UserSpecialCuts
///
/// G4double maxLength = 2*trackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
@@ -275,7 +275,7 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::ConstructSDandField()
{
// Sensitive detectors
@@ -292,7 +292,7 @@ void B2bDetectorConstruction::ConstructSDandField()
G4ThreeVector fieldValue = G4ThreeVector();
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
fMagFieldMessenger->SetVerboseLevel(1);
// Register the field messenger for deleting
G4AutoDelete::Register(fMagFieldMessenger);
}
@@ -311,17 +311,17 @@ void B2bDetectorConstruction::SetTargetMaterial(G4String materialName)
fTargetMaterial = pttoMaterial;
if (fLogicTarget) fLogicTarget->SetMaterial(fTargetMaterial);
G4cout
<< G4endl
<< G4endl
<< "----> The target is made of " << materialName << G4endl;
} else {
G4cout
<< G4endl
<< G4endl
<< "--> WARNING from SetTargetMaterial : "
<< materialName << " not found" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
@@ -336,7 +336,7 @@ void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
fChamberMaterial = pttoMaterial;
if (fLogicChamber) fLogicChamber->SetMaterial(fChamberMaterial);
G4cout
<< G4endl
<< G4endl
<< "----> The chambers are made of " << materialName << G4endl;
} else {
G4cout
@@ -348,7 +348,7 @@ void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetMaxStep(G4double maxStep)
{
if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file B2bDetectorMessenger.cc
/// \brief Implementation of the B2bDetectorMessenger class
@@ -87,7 +87,7 @@ void B2bDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
if( command == fStepMaxCmd ) {
fDetectorConstruction
->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+1 -4
View File
@@ -1,9 +1,6 @@
#---Adding example B2 subdirectories explicitly
# and a custom target to for building all example B2 options ----------
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
cmake_minimum_required(VERSION 3.12...3.20)
add_subdirectory(B2a)
add_subdirectory(B2b)
+7
View File
@@ -14,6 +14,13 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
31-05-21 I. Hrivnacova (exampleB2-V10-07-01)
- Use nullptr instead of 0, NULL
- Clean trailing whitespaces from all files
30-05-21 M.Maire (exampleB2-V10-07-00)
- exampleB2a,b.cc: use G4SteppingVerboseWithUnits
02/11/20 B.Morgan (exampleB2-V10-06-02)
- Support same CMake version range as core Geant4