Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file GB03ActionInitialization.hh
/// \brief Definition of the GB03ActionInitialization class
@@ -23,8 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file GB03BOptnSplitOrKillOnBoundary.hh
/// \brief Definition of the GB03BOptnSplitOrKillOnBoundary class
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file GB03BOptrGeometryBasedBiasing.hh
/// \brief Definition of the GB03BOptrGeometryBasedBiasing class
@@ -88,6 +87,4 @@ class GB03BOptrGeometryBasedBiasing : public G4VBiasingOperator
G4GenericMessenger* fApplyProbabilityMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file GB03DetectorConstruction.hh
/// \brief Definition of the GB03DetectorConstruction class
@@ -38,7 +37,7 @@ class G4VPhysicalVolume;
class G4PVReplica;
class G4Material;
class G4Box;
class GB03DetectorMessenger;
class G4GenericMessenger;
class GB03DetectorConstruction : public G4VUserDetectorConstruction
{
@@ -80,21 +79,21 @@ class GB03DetectorConstruction : public G4VUserDetectorConstruction
G4Material* fWorldMaterial;
G4Material* fAbsorberMaterial;
G4Material* fGapMaterial;
G4Material* fHodoMaterial;
G4Box* fLayerSolid;
G4Box* fGapSolid;
G4LogicalVolume* fWorldLogical;
G4LogicalVolume* fCalorLogical;
G4LogicalVolume* fLayerLogical;
G4LogicalVolume* fGapLogical;
G4LogicalVolume* fHodoLogical;
G4VPhysicalVolume* fWorldPhysical;
G4VPhysicalVolume* fCalorPhysical;
G4PVReplica* fLayerPhysical;
G4VPhysicalVolume* fGapPhysical;
GB03DetectorMessenger* fDetectorMessenger;
G4GenericMessenger* fDetectorMessenger;
G4int fVerboseLevel;
G4bool fBiasingFlag;
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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 GB03EventAction.hh
/// \brief Definition of the GB03EventAction class
#ifndef GB03EventAction_h
#define GB03EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class G4Event;
template<typename T>
class G4THitsMap;
class GB03EventAction : public G4UserEventAction
{
public:
GB03EventAction() = default;
~GB03EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
private:
// methods
G4THitsMap<G4double>* GetHitsCollection(G4int hcID, const G4Event* event) const;
G4double GetSum(G4THitsMap<G4double>* hitsMap) const;
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep,
G4double gapTrackLength) const;
// data members
G4int fAbsoEdepHCID = -1;
G4int fGapEdepHCID = -1;
G4int fAbsoTrackLengthHCID = -1;
G4int fGapTrackLengthHCID = -1;
};
#endif
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * 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 GB03HodoHit.hh
/// \brief Definition of the GB03HodoHit class
/// The hit class.
///
/// It defines data members to store the the kinetic energy,
/// Hit postion, particle PDG id:
/// - fEkin, fEncoding, fPos
///
#ifndef GB03HodoHit_h
#define GB03HodoHit_h 1
#include "G4Allocator.hh"
#include "G4THitsCollection.hh"
#include "G4ThreeVector.hh"
#include "G4VHit.hh"
class GB03HodoHit : public G4VHit
{
public:
GB03HodoHit() = default;
GB03HodoHit(const GB03HodoHit&);
~GB03HodoHit() override = default;
// operators
const GB03HodoHit& operator=(const GB03HodoHit&);
G4bool operator==(const GB03HodoHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// methods from base class
void Draw() override;
void Print() override;
// methods to handle data
void Set(G4int id, G4double ek, G4double pw, G4ThreeVector xyz)
{
fEkin = ek;
fWeight = pw;
fEncoding = id;
fPos = xyz;
}
void SetEkin(G4double ek) { fEkin = ek; }
void SetWeight(G4double pw) { fWeight = pw; }
void SetId(G4int id) { fEncoding = id; }
void SetPos(G4ThreeVector xyz) { fPos = xyz; }
// get methods
G4double GetEkin() const { return fEkin; }
G4double GetWeight() const { return fWeight; }
G4int GetId() const { return fEncoding; }
G4ThreeVector GetPos() const { return fPos; }
private:
G4double fEkin{0.0}; ///< Kinetic energy
G4double fWeight{0.0}; ///< Track weight
G4int fEncoding{0}; ///< PDG integer identifier
G4ThreeVector fPos; ///< Hit position
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using GB03HodoHitsCollection = G4THitsCollection<GB03HodoHit>;
extern G4ThreadLocal G4Allocator<GB03HodoHit>* GB03HodoHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void* GB03HodoHit::operator new(size_t)
{
if (GB03HodoHitAllocator == nullptr) {
GB03HodoHitAllocator = new G4Allocator<GB03HodoHit>;
}
void* hit;
hit = (void*)GB03HodoHitAllocator->MallocSingle();
return hit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void GB03HodoHit::operator delete(void* hit)
{
GB03HodoHitAllocator->FreeSingle((GB03HodoHit*)hit);
}
#endif
@@ -23,38 +23,34 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file GB03DetectorMessenger.hh
/// \brief Definition of the GB03DetectorMessenger class
/// \file GB03HodoSD.hh
/// \brief Definition of the GB03HodoSD class
#ifndef GB03DetectorMessenger_h
#define GB03DetectorMessenger_h 1
#ifndef GB03HodoSD_h
#define GB03HodoSD_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
#include "GB03HodoHit.hh"
class GB03DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
#include "G4VSensitiveDetector.hh"
class GB03DetectorMessenger : public G4UImessenger
class GB03Run;
class GB03HodoSD : public G4VSensitiveDetector
{
public:
GB03DetectorMessenger(GB03DetectorConstruction*);
~GB03DetectorMessenger() override;
GB03HodoSD(G4String name);
~GB03HodoSD() override = default;
void SetNewValue(G4UIcommand*, G4String) override;
G4String GetCurrentValue(G4UIcommand* command) override;
void Initialize(G4HCofThisEvent*) override;
G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist) override;
void PrintAll() override;
private:
GB03DetectorConstruction* fDetector;
G4int fVerbose{1};
GB03Run* fRun{nullptr};
G4UIdirectory* fDirectory;
G4UIcmdWithAString* fAbsMaterialCmd;
G4UIcmdWithAString* fGapMaterialCmd;
G4UIcmdWithAnInteger* fNumLayerCmd;
G4UIcmdWithAnInteger* fVerboseCmd;
GB03HodoHitsCollection* fHitsCollection;
};
#endif
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file GB03PrimaryGeneratorAction.hh
/// \brief Definition of the GB03PrimaryGeneratorAction class
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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 GB03Run.hh
/// \brief Definition of the GB03Run class
#ifndef GB03Run_h
#define GB03Run_h 1
#include "G4Event.hh"
#include "G4Run.hh"
#include <map>
#include <tuple>
#include <utility>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ParticlesCount
{
public:
ParticlesCount() = default;
~ParticlesCount() = default;
std::tuple<G4double, G4int, G4double, G4double> GetCounter(const G4String& name)
{
return fPartCntr[name];
};
void Count(const G4String& name, G4double w, G4double E);
void Print() const;
void Merge(const ParticlesCount&);
void Reset() { fPartCntr.clear(); }
private:
std::map<G4String, std::tuple<G4double, G4int, G4double, G4double>> fPartCntr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class GB03Run : public G4Run
{
public:
// constructor and destructor.
GB03Run() = default;
~GB03Run() override;
void CountParticle(const G4String&, G4double, G4double);
const ParticlesCount* GetPartCounter() const { return &fPartCounter; }
// Merge run data
void Merge(const G4Run*) override;
private:
ParticlesCount fPartCounter;
};
#endif
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * 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 GB03RunAction.hh
/// \brief Definition of the GB03RunAction class
#ifndef GB03RunAction_h
#define GB03RunAction_h 1
#include "G4UserRunAction.hh"
class G4Run;
class GB03RunAction : public G4UserRunAction
{
public:
GB03RunAction();
~GB03RunAction() override = default;
G4Run* GenerateRun() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
private:
G4int fVerbose{1};
};
#endif