Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# Setup the project
#
cmake_minimum_required(VERSION 3.12...3.20)
cmake_minimum_required(VERSION 3.16...3.21)
project(B2b)
#----------------------------------------------------------------------------
+4 -4
View File
@@ -27,8 +27,8 @@
/// \file exampleB2b.cc
/// \brief Main program of the B2b example
#include "B2bDetectorConstruction.hh"
#include "B2ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
@@ -64,14 +64,14 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
runManager->SetUserInitialization(new B2bDetectorConstruction());
runManager->SetUserInitialization(new B2b::DetectorConstruction());
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
runManager->SetUserInitialization(new B2ActionInitialization());
runManager->SetUserInitialization(new B2::ActionInitialization());
// Initialize visualization
//
File diff suppressed because it is too large Load Diff
@@ -24,29 +24,31 @@
// ********************************************************************
//
//
/// \file B2ActionInitialization.hh
/// \brief Definition of the B2ActionInitialization class
/// \file ActionInitialization.hh
/// \brief Definition of the B2::ActionInitialization class
#ifndef B2ActionInitialization_h
#define B2ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class B4DetectorConstruction;
namespace B2
{
/// Action initialization class.
///
class B2ActionInitialization : public G4VUserActionInitialization
class ActionInitialization : public G4VUserActionInitialization
{
public:
B2ActionInitialization();
virtual ~B2ActionInitialization();
ActionInitialization();
~ActionInitialization() override;
virtual void BuildForMaster() const;
virtual void Build() const;
void BuildForMaster() const override;
void Build() const override;
};
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2bChamberParameterisation.hh
/// \brief Definition of the B2bChamberParameterisation class
/// \file ChamberParameterisation.hh
/// \brief Definition of the B2b::ChamberParameterisation class
#ifndef B2bChamberParameterisation_h
#define B2bChamberParameterisation_h 1
@@ -50,56 +50,59 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
namespace B2b
{
/// A parameterisation that describes a series of boxes along Z.
///
/// The boxes have equal width, & their lengths are a linear equation.
/// They are spaced an equal distance apart, starting from given location.
class B2bChamberParameterisation : public G4VPVParameterisation
class ChamberParameterisation : public G4VPVParameterisation
{
public:
B2bChamberParameterisation(G4int noChambers,
ChamberParameterisation(G4int noChambers,
G4double startZ,
G4double spacing,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal );
virtual ~B2bChamberParameterisation();
~ChamberParameterisation() override;
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
G4VPhysicalVolume* physVol) const override;
void ComputeDimensions (G4Tubs & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
const G4VPhysicalVolume* physVol) const override;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Box&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Trd&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Trap&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Sphere&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Orb&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Ellipsoid&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Torus&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Para&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Hype&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Polycone&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Polyhedra&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
private:
@@ -111,6 +114,6 @@ class B2bChamberParameterisation : public G4VPVParameterisation
G4double fRmaxIncr; // The Increment for the half-length
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2bDetectorConstruction.hh
/// \brief Definition of the B2bDetectorConstruction class
/// \file DetectorConstruction.hh
/// \brief Definition of the B2b::DetectorConstruction class
#ifndef B2bDetectorConstruction_h
#define B2bDetectorConstruction_h 1
@@ -40,20 +40,23 @@ class G4Material;
class G4UserLimits;
class G4GlobalMagFieldMessenger;
class B2bDetectorMessenger;
namespace B2b
{
class DetectorMessenger;
/// Detector construction class to define materials, geometry
/// and global uniform magnetic field.
class B2bDetectorConstruction : public G4VUserDetectorConstruction
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B2bDetectorConstruction();
virtual ~B2bDetectorConstruction();
DetectorConstruction();
~DetectorConstruction() override;
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
// Set methods
void SetTargetMaterial (G4String );
@@ -66,23 +69,23 @@ class B2bDetectorConstruction : public G4VUserDetectorConstruction
void DefineMaterials();
G4VPhysicalVolume* DefineVolumes();
// data members
G4LogicalVolume* fLogicTarget; // pointer to the logical Target
G4LogicalVolume* fLogicChamber; // pointer to the logical Chamber
G4Material* fTargetMaterial; // pointer to the target material
G4Material* fChamberMaterial; // pointer to the chamber material
G4UserLimits* fStepLimit; // pointer to user step limits
B2bDetectorMessenger* fMessenger; // detector messenger
// static data members
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
// data members
G4LogicalVolume* fLogicTarget = nullptr; // pointer to the logical Target
G4LogicalVolume* fLogicChamber = nullptr; // pointer to the logical Chamber
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
G4Material* fTargetMaterial = nullptr; // pointer to the target material
G4Material* fChamberMaterial = nullptr; // pointer to the chamber material
G4UserLimits* fStepLimit = nullptr; // pointer to user step limits
DetectorMessenger* fMessenger = nullptr; // messenger
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2bDetectorMessenger.hh
/// \brief Definition of the B2bDetectorMessenger class
/// \file DetectorMessenger.hh
/// \brief Definition of the B2b::DetectorMessenger class
#ifndef B2bDetectorMessenger_h
#define B2bDetectorMessenger_h 1
@@ -33,40 +33,42 @@
#include "globals.hh"
#include "G4UImessenger.hh"
class B2bDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace B2b
{
/// Messenger class that defines commands for B2bDetectorConstruction.
class DetectorConstruction;
/// Messenger class that defines commands for B2b::DetectorConstruction.
///
/// It implements commands:
/// - /B2/det/setTargetMaterial name
/// - /B2/det/setChamberMaterial name
/// - /B2/det/stepMax value unit
class B2bDetectorMessenger: public G4UImessenger
class DetectorMessenger: public G4UImessenger
{
public:
B2bDetectorMessenger(B2bDetectorConstruction* );
virtual ~B2bDetectorMessenger();
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger() override;
virtual void SetNewValue(G4UIcommand*, G4String);
void SetNewValue(G4UIcommand*, G4String) override;
private:
B2bDetectorConstruction* fDetectorConstruction;
DetectorConstruction* fDetectorConstruction = nullptr;
G4UIdirectory* fB2Directory;
G4UIdirectory* fDetDirectory;
G4UIdirectory* fDirectory = nullptr;
G4UIdirectory* fDetDirectory = nullptr;
G4UIcmdWithAString* fTargMatCmd;
G4UIcmdWithAString* fChamMatCmd;
G4UIcmdWithAString* fTargMatCmd = nullptr;
G4UIcmdWithAString* fChamMatCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2EventAction.hh
/// \brief Definition of the B2EventAction class
/// \file EventAction.hh
/// \brief Definition of the B2::EventAction class
#ifndef B2EventAction_h
#define B2EventAction_h 1
@@ -34,18 +34,21 @@
#include "globals.hh"
namespace B2
{
/// Event action class
class B2EventAction : public G4UserEventAction
class EventAction : public G4UserEventAction
{
public:
B2EventAction();
virtual ~B2EventAction();
EventAction();
~EventAction() override;
virtual void BeginOfEventAction(const G4Event* );
virtual void EndOfEventAction(const G4Event* );
void BeginOfEventAction(const G4Event* ) override;
void EndOfEventAction(const G4Event* ) override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2PrimaryGeneratorAction.hh
/// \brief Definition of the B2PrimaryGeneratorAction class
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the B2::PrimaryGeneratorAction class
#ifndef B2PrimaryGeneratorAction_h
#define B2PrimaryGeneratorAction_h 1
@@ -36,6 +36,9 @@
class G4ParticleGun;
class G4Event;
namespace B2
{
/// The primary generator action class with particle gum.
///
/// It defines a single particle which hits the Tracker
@@ -43,13 +46,13 @@ class G4Event;
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// (see the macros provided with this example).
class B2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B2PrimaryGeneratorAction();
virtual ~B2PrimaryGeneratorAction();
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
virtual void GeneratePrimaries(G4Event* );
void GeneratePrimaries(G4Event* ) override;
G4ParticleGun* GetParticleGun() {return fParticleGun;}
@@ -57,9 +60,9 @@ class B2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
void SetRandomFlag(G4bool );
private:
G4ParticleGun* fParticleGun; // G4 particle gun
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2RunAction.hh
/// \brief Definition of the B2RunAction class
/// \file RunAction.hh
/// \brief Definition of the B2::RunAction class
#ifndef B2RunAction_h
#define B2RunAction_h 1
@@ -33,22 +33,23 @@
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
namespace B2
{
/// Run action class
class B2RunAction : public G4UserRunAction
class RunAction : public G4UserRunAction
{
public:
B2RunAction();
virtual ~B2RunAction();
RunAction();
~RunAction() override;
virtual void BeginOfRunAction(const G4Run* run);
virtual void EndOfRunAction(const G4Run* run);
void BeginOfRunAction(const G4Run* run) override;
void EndOfRunAction(const G4Run* run) override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B2TrackerHit.hh
/// \brief Definition of the B2TrackerHit class
/// \file TrackerHit.hh
/// \brief Definition of the B2::TrackerHit class
#ifndef B2TrackerHit_h
#define B2TrackerHit_h 1
@@ -36,29 +36,32 @@
#include "G4ThreeVector.hh"
#include "tls.hh"
namespace B2
{
/// Tracker hit class
///
/// It defines data members to store the trackID, chamberNb, energy deposit,
/// and position of charged particles in a selected volume:
/// - fTrackID, fChamberNB, fEdep, fPos
class B2TrackerHit : public G4VHit
class TrackerHit : public G4VHit
{
public:
B2TrackerHit();
B2TrackerHit(const B2TrackerHit&);
virtual ~B2TrackerHit();
TrackerHit();
TrackerHit(const TrackerHit&) = default;
~TrackerHit() override;
// operators
const B2TrackerHit& operator=(const B2TrackerHit&);
G4bool operator==(const B2TrackerHit&) const;
TrackerHit& operator=(const TrackerHit&) = default;
G4bool operator==(const TrackerHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// methods from base class
virtual void Draw();
virtual void Print();
void Draw() override;
void Print() override;
// Set methods
void SetTrackID (G4int track) { fTrackID = track; };
@@ -73,35 +76,36 @@ class B2TrackerHit : public G4VHit
G4ThreeVector GetPos() const { return fPos; };
private:
G4int fTrackID;
G4int fChamberNb;
G4double fEdep;
G4ThreeVector fPos;
G4int fTrackID = -1;
G4int fChamberNb = -1;
G4double fEdep = 0.;
G4ThreeVector fPos;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef G4THitsCollection<B2TrackerHit> B2TrackerHitsCollection;
typedef G4THitsCollection<TrackerHit> TrackerHitsCollection;
extern G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator;
extern G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void* B2TrackerHit::operator new(size_t)
inline void* TrackerHit::operator new(size_t)
{
if(!B2TrackerHitAllocator)
B2TrackerHitAllocator = new G4Allocator<B2TrackerHit>;
return (void *) B2TrackerHitAllocator->MallocSingle();
if(!TrackerHitAllocator)
TrackerHitAllocator = new G4Allocator<TrackerHit>;
return (void *) TrackerHitAllocator->MallocSingle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void B2TrackerHit::operator delete(void *hit)
inline void TrackerHit::operator delete(void *hit)
{
B2TrackerHitAllocator->FreeSingle((B2TrackerHit*) hit);
TrackerHitAllocator->FreeSingle((TrackerHit*) hit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,45 +24,46 @@
// ********************************************************************
//
//
/// \file B2TrackerSD.hh
/// \brief Definition of the B2TrackerSD class
/// \file TrackerSD.hh
/// \brief Definition of the B2::TrackerSD class
#ifndef B2TrackerSD_h
#define B2TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "B2TrackerHit.hh"
#include "TrackerHit.hh"
#include <vector>
class G4Step;
class G4HCofThisEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace B2
{
/// B2Tracker sensitive detector class
/// Tracker 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
/// energy deposit.
class B2TrackerSD : public G4VSensitiveDetector
class TrackerSD : public G4VSensitiveDetector
{
public:
B2TrackerSD(const G4String& name,
TrackerSD(const G4String& name,
const G4String& hitsCollectionName);
virtual ~B2TrackerSD();
~TrackerSD() override;
// methods from base class
virtual void Initialize(G4HCofThisEvent* hitCollection);
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
virtual void EndOfEvent(G4HCofThisEvent* hitCollection);
void Initialize(G4HCofThisEvent* hitCollection) override;
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
void EndOfEvent(G4HCofThisEvent* hitCollection) override;
private:
B2TrackerHitsCollection* fHitsCollection;
TrackerHitsCollection* fHitsCollection = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,39 +24,44 @@
// ********************************************************************
//
//
/// \file B2ActionInitialization.cc
/// \brief Implementation of the B2ActionInitialization class
/// \file ActionInitialization.cc
/// \brief Implementation of the B2::ActionInitialization class
#include "B2ActionInitialization.hh"
#include "B2PrimaryGeneratorAction.hh"
#include "B2RunAction.hh"
#include "B2EventAction.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2ActionInitialization::B2ActionInitialization()
: G4VUserActionInitialization()
ActionInitialization::ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2ActionInitialization::~B2ActionInitialization()
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2ActionInitialization::BuildForMaster() const
void ActionInitialization::BuildForMaster() const
{
SetUserAction(new B2RunAction);
SetUserAction(new RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2ActionInitialization::Build() const
void ActionInitialization::Build() const
{
SetUserAction(new B2PrimaryGeneratorAction);
SetUserAction(new B2RunAction);
SetUserAction(new B2EventAction);
SetUserAction(new PrimaryGeneratorAction);
SetUserAction(new RunAction);
SetUserAction(new EventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,26 +24,28 @@
// ********************************************************************
//
//
/// \file B2bChamberParameterisation.cc
/// \brief Implementation of the B2bChamberParameterisation class
/// \file ChamberParameterisation.cc
/// \brief Implementation of the B2b::ChamberParameterisation class
#include "B2bChamberParameterisation.hh"
#include "ChamberParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4SystemOfUnits.hh"
namespace B2b
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bChamberParameterisation::B2bChamberParameterisation(
ChamberParameterisation::ChamberParameterisation(
G4int noChambers,
G4double startZ, // Z of center of first
G4double spacingZ, // Z spacing of centers
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal )
: G4VPVParameterisation()
{
fNoChambers = noChambers;
fStartZ = startZ;
@@ -53,7 +55,7 @@ B2bChamberParameterisation::B2bChamberParameterisation(
if( noChambers > 0 ){
fRmaxIncr = 0.5 * (lengthFinal-lengthInitial)/(noChambers-1);
if (spacingZ < widthChamber) {
G4Exception("B2bChamberParameterisation::B2bChamberParameterisation()",
G4Exception("ChamberParameterisation::ChamberParameterisation()",
"InvalidSetup", FatalException,
"Width>Spacing");
}
@@ -62,12 +64,12 @@ B2bChamberParameterisation::B2bChamberParameterisation(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bChamberParameterisation::~B2bChamberParameterisation()
ChamberParameterisation::~ChamberParameterisation()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bChamberParameterisation::ComputeTransformation
void ChamberParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
// Note: copyNo will start with zero!
@@ -79,7 +81,7 @@ void B2bChamberParameterisation::ComputeTransformation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bChamberParameterisation::ComputeDimensions
void ChamberParameterisation::ComputeDimensions
(G4Tubs& trackerChamber, const G4int copyNo, const G4VPhysicalVolume*) const
{
// Note: copyNo will start with zero!
@@ -92,3 +94,5 @@ void B2bChamberParameterisation::ComputeDimensions
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,13 +24,13 @@
// ********************************************************************
//
//
/// \file B2bDetectorConstruction.cc
/// \brief Implementation of the B2bDetectorConstruction class
/// \file DetectorConstruction.cc
/// \brief Implementation of the B2b::DetectorConstruction class
#include "B2bDetectorConstruction.hh"
#include "B2bDetectorMessenger.hh"
#include "B2bChamberParameterisation.hh"
#include "B2TrackerSD.hh"
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "ChamberParameterisation.hh"
#include "TrackerSD.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
@@ -54,24 +54,24 @@
#include "G4SystemOfUnits.hh"
using namespace B2;
namespace B2b
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B2bDetectorConstruction::fMagFieldMessenger = nullptr;
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
B2bDetectorConstruction::B2bDetectorConstruction()
:G4VUserDetectorConstruction(),
fLogicTarget(nullptr), fLogicChamber(nullptr),
fTargetMaterial(nullptr), fChamberMaterial(nullptr),
fStepLimit(nullptr),
fCheckOverlaps(true)
DetectorConstruction::DetectorConstruction()
{
fMessenger = new B2bDetectorMessenger(this);
fMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bDetectorConstruction::~B2bDetectorConstruction()
DetectorConstruction::~DetectorConstruction()
{
delete fStepLimit;
delete fMessenger;
@@ -79,7 +79,7 @@ B2bDetectorConstruction::~B2bDetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2bDetectorConstruction::Construct()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Define materials
DefineMaterials();
@@ -90,7 +90,7 @@ G4VPhysicalVolume* B2bDetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::DefineMaterials()
void DetectorConstruction::DefineMaterials()
{
// Material definition
@@ -111,7 +111,7 @@ void B2bDetectorConstruction::DefineMaterials()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
G4Material* air = G4Material::GetMaterial("G4_AIR");
@@ -215,7 +215,7 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
G4double lastLength = trackerLength;
G4VPVParameterisation* chamberParam =
new B2bChamberParameterisation(
new ChamberParameterisation(
NbOfChambers, // NoChambers
firstPosition, // Z of center of first
chamberSpacing, // Z spacing of centers
@@ -276,13 +276,13 @@ G4VPhysicalVolume* B2bDetectorConstruction::DefineVolumes()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::ConstructSDandField()
void DetectorConstruction::ConstructSDandField()
{
// Sensitive detectors
G4String trackerChamberSDname = "B2/TrackerChamberSD";
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
TrackerSD* aTrackerSD = new TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
G4SDManager::GetSDMpointer()->AddNewDetector(aTrackerSD);
SetSensitiveDetector( fLogicChamber, aTrackerSD );
@@ -299,7 +299,7 @@ void B2bDetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetTargetMaterial(G4String materialName)
void DetectorConstruction::SetTargetMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
@@ -324,7 +324,7 @@ void B2bDetectorConstruction::SetTargetMaterial(G4String materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
void DetectorConstruction::SetChamberMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
@@ -349,9 +349,11 @@ void B2bDetectorConstruction::SetChamberMaterial(G4String materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorConstruction::SetMaxStep(G4double maxStep)
void DetectorConstruction::SetMaxStep(G4double maxStep)
{
if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,24 +24,26 @@
// ********************************************************************
//
//
/// \file B2bDetectorMessenger.cc
/// \brief Implementation of the B2bDetectorMessenger class
/// \file DetectorMessenger.cc
/// \brief Implementation of the B2b::DetectorMessenger class
#include "B2bDetectorMessenger.hh"
#include "B2bDetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
namespace B2b
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bDetectorMessenger::B2bDetectorMessenger(B2bDetectorConstruction* Det)
: G4UImessenger(),
fDetectorConstruction(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction* Det)
: fDetectorConstruction(Det)
{
fB2Directory = new G4UIdirectory("/B2/");
fB2Directory->SetGuidance("UI commands specific to this example.");
fDirectory = new G4UIdirectory("/B2/");
fDirectory->SetGuidance("UI commands specific to this example.");
fDetDirectory = new G4UIdirectory("/B2/det/");
fDetDirectory->SetGuidance("Detector construction control");
@@ -65,18 +67,18 @@ B2bDetectorMessenger::B2bDetectorMessenger(B2bDetectorConstruction* Det)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2bDetectorMessenger::~B2bDetectorMessenger()
DetectorMessenger::~DetectorMessenger()
{
delete fTargMatCmd;
delete fChamMatCmd;
delete fStepMaxCmd;
delete fB2Directory;
delete fDirectory;
delete fDetDirectory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2bDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fTargMatCmd )
{ fDetectorConstruction->SetTargetMaterial(newValue);}
@@ -91,3 +93,5 @@ void B2bDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2EventAction.cc
/// \brief Implementation of the B2EventAction class
/// \file EventAction.cc
/// \brief Implementation of the B2::EventAction class
#include "B2EventAction.hh"
#include "EventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
@@ -35,25 +35,27 @@
#include "G4Trajectory.hh"
#include "G4ios.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2EventAction::B2EventAction()
: G4UserEventAction()
EventAction::EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2EventAction::~B2EventAction()
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::BeginOfEventAction(const G4Event*)
void EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::EndOfEventAction(const G4Event* event)
void EventAction::EndOfEventAction(const G4Event* event)
{
// get number of stored trajectories
@@ -77,3 +79,6 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2PrimaryGeneratorAction.cc
/// \brief Implementation of the B2PrimaryGeneratorAction class
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the B2::PrimaryGeneratorAction class
#include "B2PrimaryGeneratorAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
@@ -37,13 +37,14 @@
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction()
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
@@ -60,14 +61,14 @@ B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2PrimaryGeneratorAction::~B2PrimaryGeneratorAction()
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// This function is called at the begining of event
@@ -95,3 +96,6 @@ void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,18 +24,20 @@
// ********************************************************************
//
//
/// \file B2RunAction.cc
/// \brief Implementation of the B2RunAction class
/// \file RunAction.cc
/// \brief Implementation of the B2::RunAction class
#include "B2RunAction.hh"
#include "RunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2RunAction::B2RunAction()
: G4UserRunAction()
RunAction::RunAction()
{
// set printing event number per each 100 events
G4RunManager::GetRunManager()->SetPrintProgress(1000);
@@ -43,12 +45,12 @@ B2RunAction::B2RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2RunAction::~B2RunAction()
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::BeginOfRunAction(const G4Run*)
void RunAction::BeginOfRunAction(const G4Run*)
{
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
@@ -56,7 +58,10 @@ void B2RunAction::BeginOfRunAction(const G4Run*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::EndOfRunAction(const G4Run* )
void RunAction::EndOfRunAction(const G4Run* )
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2TrackerHit.cc
/// \brief Implementation of the B2TrackerHit class
/// \file TrackerHit.cc
/// \brief Implementation of the B2::TrackerHit class
#include "B2TrackerHit.hh"
#include "TrackerHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
@@ -36,55 +36,30 @@
#include <iomanip>
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator = nullptr;
namespace B2
{
G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::B2TrackerHit()
: G4VHit(),
fTrackID(-1),
fChamberNb(-1),
fEdep(0.),
fPos(G4ThreeVector())
TrackerHit::TrackerHit()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::~B2TrackerHit() {}
TrackerHit::~TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::B2TrackerHit(const B2TrackerHit& right)
: G4VHit()
{
fTrackID = right.fTrackID;
fChamberNb = right.fChamberNb;
fEdep = right.fEdep;
fPos = right.fPos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const B2TrackerHit& B2TrackerHit::operator=(const B2TrackerHit& right)
{
fTrackID = right.fTrackID;
fChamberNb = right.fChamberNb;
fEdep = right.fEdep;
fPos = right.fPos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerHit::operator==(const B2TrackerHit& right) const
G4bool TrackerHit::operator==(const TrackerHit& right) const
{
return ( this == &right ) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerHit::Draw()
void TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
@@ -101,7 +76,7 @@ void B2TrackerHit::Draw()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerHit::Print()
void TrackerHit::Print()
{
G4cout
<< " trackID: " << fTrackID << " chamberNb: " << fChamberNb
@@ -113,3 +88,5 @@ void B2TrackerHit::Print()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,39 +24,41 @@
// ********************************************************************
//
//
/// \file B2TrackerSD.cc
/// \brief Implementation of the B2TrackerSD class
/// \file TrackerSD.cc
/// \brief Implementation of the B2::TrackerSD class
#include "B2TrackerSD.hh"
#include "TrackerSD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name),
fHitsCollection(nullptr)
TrackerSD::TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name)
{
collectionName.insert(hitsCollectionName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::~B2TrackerSD()
TrackerSD::~TrackerSD()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
void TrackerSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
= new TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
@@ -67,7 +69,7 @@ void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4bool TrackerSD::ProcessHits(G4Step* aStep,
G4TouchableHistory*)
{
// energy deposit
@@ -75,7 +77,7 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
if (edep==0.) return false;
B2TrackerHit* newHit = new B2TrackerHit();
TrackerHit* newHit = new TrackerHit();
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
@@ -92,16 +94,18 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerSD::EndOfEvent(G4HCofThisEvent*)
void TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
G4int nofHits = fHitsCollection->entries();
G4cout
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
G4cout << 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();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}