Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
+30
-26
@@ -24,43 +24,47 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5ActionInitialization.cc
|
||||
/// \brief Implementation of the B5ActionInitialization class
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the B5::ActionInitialization class
|
||||
|
||||
#include "B5ActionInitialization.hh"
|
||||
#include "B5PrimaryGeneratorAction.hh"
|
||||
#include "B5RunAction.hh"
|
||||
#include "B5EventAction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5ActionInitialization::B5ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5ActionInitialization::~B5ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5ActionInitialization::BuildForMaster() const
|
||||
namespace B5
|
||||
{
|
||||
B5EventAction* eventAction = new B5EventAction;
|
||||
SetUserAction(new B5RunAction(eventAction));
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
EventAction* eventAction = new EventAction;
|
||||
SetUserAction(new RunAction(eventAction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5ActionInitialization::Build() const
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B5PrimaryGeneratorAction);
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
|
||||
auto eventAction = new B5EventAction;
|
||||
auto eventAction = new EventAction;
|
||||
SetUserAction(eventAction);
|
||||
|
||||
SetUserAction(new B5RunAction(eventAction));
|
||||
SetUserAction(new RunAction(eventAction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+12
-8
@@ -24,20 +24,22 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5CellParameterisation.cc
|
||||
/// \brief Implementation of the B5CellParameterisation class
|
||||
/// \file CellParameterisation.cc
|
||||
/// \brief Implementation of the B5::CellParameterisation class
|
||||
|
||||
#include "B5CellParameterisation.hh"
|
||||
#include "B5Constants.hh"
|
||||
#include "CellParameterisation.hh"
|
||||
#include "Constants.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5CellParameterisation::B5CellParameterisation()
|
||||
: G4VPVParameterisation()
|
||||
CellParameterisation::CellParameterisation()
|
||||
{
|
||||
for (auto copyNo=0; copyNo<kNofEmCells; copyNo++) {
|
||||
auto column = copyNo / kNofEmRows ;
|
||||
@@ -49,15 +51,17 @@ B5CellParameterisation::B5CellParameterisation()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5CellParameterisation::~B5CellParameterisation()
|
||||
CellParameterisation::~CellParameterisation()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5CellParameterisation::ComputeTransformation(
|
||||
void CellParameterisation::ComputeTransformation(
|
||||
const G4int copyNo,G4VPhysicalVolume *physVol) const
|
||||
{
|
||||
physVol->SetTranslation(G4ThreeVector(fXCell[copyNo],fYCell[copyNo],0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+35
-39
@@ -24,16 +24,16 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5DetectorConstruction.cc
|
||||
/// \brief Implementation of the B5DetectorConstruction class
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the B5::DetectorConstruction class
|
||||
|
||||
#include "B5DetectorConstruction.hh"
|
||||
#include "B5MagneticField.hh"
|
||||
#include "B5CellParameterisation.hh"
|
||||
#include "B5HodoscopeSD.hh"
|
||||
#include "B5DriftChamberSD.hh"
|
||||
#include "B5EmCalorimeterSD.hh"
|
||||
#include "B5HadCalorimeterSD.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "MagneticField.hh"
|
||||
#include "CellParameterisation.hh"
|
||||
#include "HodoscopeSD.hh"
|
||||
#include "DriftChamberSD.hh"
|
||||
#include "EmCalorimeterSD.hh"
|
||||
#include "HadCalorimeterSD.hh"
|
||||
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
@@ -65,23 +65,17 @@
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal B5MagneticField* B5DetectorConstruction::fMagneticField = 0;
|
||||
G4ThreadLocal G4FieldManager* B5DetectorConstruction::fFieldMgr = 0;
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DetectorConstruction::B5DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(nullptr),
|
||||
fHodoscope1Logical(nullptr), fHodoscope2Logical(nullptr),
|
||||
fWirePlane1Logical(nullptr), fWirePlane2Logical(nullptr),
|
||||
fCellLogical(nullptr), fHadCalScintiLogical(nullptr),
|
||||
fMagneticLogical(nullptr),
|
||||
fVisAttributes(),
|
||||
fArmAngle(30.*deg), fArmRotation(nullptr), fSecondArmPhys(nullptr)
|
||||
G4ThreadLocal MagneticField* DetectorConstruction::fMagneticField = 0;
|
||||
G4ThreadLocal G4FieldManager* DetectorConstruction::fFieldMgr = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
fArmRotation = new G4RotationMatrix();
|
||||
fArmRotation->rotateY(fArmAngle);
|
||||
@@ -92,7 +86,7 @@ B5DetectorConstruction::B5DetectorConstruction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DetectorConstruction::~B5DetectorConstruction()
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fArmRotation;
|
||||
delete fMessenger;
|
||||
@@ -104,12 +98,12 @@ B5DetectorConstruction::~B5DetectorConstruction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B5DetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Construct materials
|
||||
ConstructMaterials();
|
||||
auto air = G4Material::GetMaterial("G4_AIR");
|
||||
//auto argonGas = G4Material::GetMaterial("B5_Ar");
|
||||
//auto argonGas = G4Material::GetMaterial("_Ar");
|
||||
auto argonGas = G4Material::GetMaterial("G4_Ar");
|
||||
auto scintillator = G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
auto csI = G4Material::GetMaterial("G4_CESIUM_IODIDE");
|
||||
@@ -254,7 +248,7 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
|
||||
= new G4Box("cellBox",7.5*cm,7.5*cm,15.*cm);
|
||||
fCellLogical
|
||||
= new G4LogicalVolume(cellSolid,csI,"cellLogical");
|
||||
G4VPVParameterisation* cellParam = new B5CellParameterisation();
|
||||
G4VPVParameterisation* cellParam = new CellParameterisation();
|
||||
new G4PVParameterised("cellPhysical",fCellLogical,emCalorimeterLogical,
|
||||
kXAxis,kNofEmCells,cellParam);
|
||||
|
||||
@@ -362,38 +356,38 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::ConstructSDandField()
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// sensitive detectors -----------------------------------------------------
|
||||
auto sdManager = G4SDManager::GetSDMpointer();
|
||||
G4String SDname;
|
||||
|
||||
auto hodoscope1 = new B5HodoscopeSD(SDname="/hodoscope1");
|
||||
auto hodoscope1 = new HodoscopeSD(SDname="/hodoscope1");
|
||||
sdManager->AddNewDetector(hodoscope1);
|
||||
fHodoscope1Logical->SetSensitiveDetector(hodoscope1);
|
||||
|
||||
auto hodoscope2 = new B5HodoscopeSD(SDname="/hodoscope2");
|
||||
auto hodoscope2 = new HodoscopeSD(SDname="/hodoscope2");
|
||||
sdManager->AddNewDetector(hodoscope2);
|
||||
fHodoscope2Logical->SetSensitiveDetector(hodoscope2);
|
||||
|
||||
auto chamber1 = new B5DriftChamberSD(SDname="/chamber1");
|
||||
auto chamber1 = new DriftChamberSD(SDname="/chamber1");
|
||||
sdManager->AddNewDetector(chamber1);
|
||||
fWirePlane1Logical->SetSensitiveDetector(chamber1);
|
||||
|
||||
auto chamber2 = new B5DriftChamberSD(SDname="/chamber2");
|
||||
auto chamber2 = new DriftChamberSD(SDname="/chamber2");
|
||||
sdManager->AddNewDetector(chamber2);
|
||||
fWirePlane2Logical->SetSensitiveDetector(chamber2);
|
||||
|
||||
auto emCalorimeter = new B5EmCalorimeterSD(SDname="/EMcalorimeter");
|
||||
auto emCalorimeter = new EmCalorimeterSD(SDname="/EMcalorimeter");
|
||||
sdManager->AddNewDetector(emCalorimeter);
|
||||
fCellLogical->SetSensitiveDetector(emCalorimeter);
|
||||
|
||||
auto hadCalorimeter = new B5HadCalorimeterSD(SDname="/HadCalorimeter");
|
||||
auto hadCalorimeter = new HadCalorimeterSD(SDname="/HadCalorimeter");
|
||||
sdManager->AddNewDetector(hadCalorimeter);
|
||||
fHadCalScintiLogical->SetSensitiveDetector(hadCalorimeter);
|
||||
|
||||
// magnetic field ----------------------------------------------------------
|
||||
fMagneticField = new B5MagneticField();
|
||||
fMagneticField = new MagneticField();
|
||||
fFieldMgr = new G4FieldManager();
|
||||
fFieldMgr->SetDetectorField(fMagneticField);
|
||||
fFieldMgr->CreateChordFinder(fMagneticField);
|
||||
@@ -403,7 +397,7 @@ void B5DetectorConstruction::ConstructSDandField()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::ConstructMaterials()
|
||||
void DetectorConstruction::ConstructMaterials()
|
||||
{
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
@@ -414,7 +408,7 @@ void B5DetectorConstruction::ConstructMaterials()
|
||||
nistManager->FindOrBuildMaterial("G4_Ar");
|
||||
// With a density different from the one defined in NIST
|
||||
// G4double density = 1.782e-03*g/cm3;
|
||||
// nistManager->BuildMaterialWithNewDensity("B5_Ar","G4_Ar",density);
|
||||
// nistManager->BuildMaterialWithNewDensity("_Ar","G4_Ar",density);
|
||||
// !! cases segmentation fault
|
||||
|
||||
// Scintillator
|
||||
@@ -442,7 +436,7 @@ void B5DetectorConstruction::ConstructMaterials()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::SetArmAngle(G4double val)
|
||||
void DetectorConstruction::SetArmAngle(G4double val)
|
||||
{
|
||||
if (!fSecondArmPhys) {
|
||||
G4cerr << "Detector has not yet been constructed." << G4endl;
|
||||
@@ -462,7 +456,7 @@ void B5DetectorConstruction::SetArmAngle(G4double val)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::DefineCommands()
|
||||
void DetectorConstruction::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
@@ -472,7 +466,7 @@ void B5DetectorConstruction::DefineCommands()
|
||||
// armAngle command
|
||||
auto& armAngleCmd
|
||||
= fMessenger->DeclareMethodWithUnit("armAngle","deg",
|
||||
&B5DetectorConstruction::SetArmAngle,
|
||||
&DetectorConstruction::SetArmAngle,
|
||||
"Set rotation angle of the second arm.");
|
||||
armAngleCmd.SetParameterName("angle", true);
|
||||
armAngleCmd.SetRange("angle>=0. && angle<180.");
|
||||
@@ -480,3 +474,5 @@ void B5DetectorConstruction::DefineCommands()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+53
-51
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5DriftChamberHit.cc
|
||||
/// \brief Implementation of the B5DriftChamberHit class
|
||||
/// \file DriftChamberHit.cc
|
||||
/// \brief Implementation of the B5::DriftChamberHit class
|
||||
|
||||
#include "B5DriftChamberHit.hh"
|
||||
#include "DriftChamberHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
@@ -41,60 +41,60 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5DriftChamberHit>* B5DriftChamberHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit()
|
||||
: G4VHit(),
|
||||
fLayerID(-1), fTime(0.), fLocalPos(), fWorldPos()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit(G4int layerID)
|
||||
: G4VHit(),
|
||||
fLayerID(layerID), fTime(0.), fLocalPos(), fWorldPos()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::~B5DriftChamberHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit(const B5DriftChamberHit &right)
|
||||
: G4VHit(),
|
||||
fLayerID(right.fLayerID),
|
||||
fTime(right.fTime),
|
||||
fLocalPos(right.fLocalPos),
|
||||
fWorldPos(right.fWorldPos)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5DriftChamberHit& B5DriftChamberHit::operator=(const B5DriftChamberHit &right)
|
||||
namespace B5
|
||||
{
|
||||
fLayerID = right.fLayerID;
|
||||
fTime = right.fTime;
|
||||
fLocalPos = right.fLocalPos;
|
||||
fWorldPos = right.fWorldPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5DriftChamberHit::operator==(const B5DriftChamberHit &/*right*/) const
|
||||
G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DriftChamberHit::DriftChamberHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DriftChamberHit::DriftChamberHit(G4int layerID)
|
||||
: fLayerID(layerID)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DriftChamberHit::~DriftChamberHit()
|
||||
{}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// DriftChamberHit::DriftChamberHit(const DriftChamberHit &right)
|
||||
// : G4VHit(),
|
||||
// fLayerID(right.fLayerID),
|
||||
// fTime(right.fTime),
|
||||
// fLocalPos(right.fLocalPos),
|
||||
// fWorldPos(right.fWorldPos)
|
||||
// {}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// const DriftChamberHit& DriftChamberHit::operator=(const DriftChamberHit &right)
|
||||
// {
|
||||
// fLayerID = right.fLayerID;
|
||||
// fTime = right.fTime;
|
||||
// fLocalPos = right.fLocalPos;
|
||||
// fWorldPos = right.fWorldPos;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool DriftChamberHit::operator==(const DriftChamberHit &/*right*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberHit::Draw()
|
||||
void DriftChamberHit::Draw()
|
||||
{
|
||||
auto visManager = G4VVisManager::GetConcreteInstance();
|
||||
if (! visManager) return;
|
||||
@@ -110,10 +110,10 @@ void B5DriftChamberHit::Draw()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
|
||||
const std::map<G4String,G4AttDef>* DriftChamberHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
auto store = G4AttDefStore::GetInstance("B5DriftChamberHit",isNew);
|
||||
auto store = G4AttDefStore::GetInstance("DriftChamberHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
@@ -134,7 +134,7 @@ const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
|
||||
std::vector<G4AttValue>* DriftChamberHit::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
@@ -152,7 +152,7 @@ std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberHit::Print()
|
||||
void DriftChamberHit::Print()
|
||||
{
|
||||
G4cout << " Layer[" << fLayerID << "] : time " << fTime/ns
|
||||
<< " (nsec) --- local (x,y) " << fLocalPos.x()
|
||||
@@ -160,3 +160,5 @@ void B5DriftChamberHit::Print()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+16
-12
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5DriftChamberSD.cc
|
||||
/// \brief Implementation of the B5DriftChamber class
|
||||
/// \file DriftChamberSD.cc
|
||||
/// \brief Implementation of the B5::DriftChamber class
|
||||
|
||||
#include "B5DriftChamberSD.hh"
|
||||
#include "B5DriftChamberHit.hh"
|
||||
#include "DriftChamberSD.hh"
|
||||
#include "DriftChamberHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
@@ -37,26 +37,28 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberSD::B5DriftChamberSD(G4String name)
|
||||
: G4VSensitiveDetector(name),
|
||||
fHitsCollection(nullptr), fHCID(-1)
|
||||
DriftChamberSD::DriftChamberSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
collectionName.insert("driftChamberColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberSD::~B5DriftChamberSD()
|
||||
DriftChamberSD::~DriftChamberSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberSD::Initialize(G4HCofThisEvent* hce)
|
||||
void DriftChamberSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5DriftChamberHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
= new DriftChamberHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
|
||||
if (fHCID<0) {
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
|
||||
@@ -66,7 +68,7 @@ void B5DriftChamberSD::Initialize(G4HCofThisEvent* hce)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
G4bool DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
auto charge = step->GetTrack()->GetDefinition()->GetPDGCharge();
|
||||
if (charge==0.) return true;
|
||||
@@ -81,7 +83,7 @@ G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
auto localPos
|
||||
= touchable->GetHistory()->GetTopTransform().TransformPoint(worldPos);
|
||||
|
||||
auto hit = new B5DriftChamberHit(copyNo);
|
||||
auto hit = new DriftChamberHit(copyNo);
|
||||
hit->SetWorldPos(worldPos);
|
||||
hit->SetLocalPos(localPos);
|
||||
hit->SetTime(preStepPoint->GetGlobalTime());
|
||||
@@ -92,3 +94,5 @@ G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+56
-54
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5EmCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5EmCalorimeterHit class
|
||||
/// \file EmCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5::EmCalorimeterHit class
|
||||
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
#include "EmCalorimeterHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
@@ -40,63 +40,63 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5EmCalorimeterHit>* B5EmCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit()
|
||||
: G4VHit(),
|
||||
fCellID(-1), fEdep(0.), fPos(0.), fPLogV(nullptr)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit(G4int cellID)
|
||||
: G4VHit(),
|
||||
fCellID(cellID), fEdep(0.), fPos(0.), fPLogV(nullptr)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::~B5EmCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit(const B5EmCalorimeterHit &right)
|
||||
: G4VHit(),
|
||||
fCellID(right.fCellID),
|
||||
fEdep(right.fEdep),
|
||||
fPos(right.fPos),
|
||||
fRot(right.fRot),
|
||||
fPLogV(right.fPLogV)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5EmCalorimeterHit& B5EmCalorimeterHit::operator=(const B5EmCalorimeterHit
|
||||
&right)
|
||||
namespace B5
|
||||
{
|
||||
fCellID = right.fCellID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5EmCalorimeterHit::operator==(const B5EmCalorimeterHit &right) const
|
||||
G4ThreadLocal G4Allocator<EmCalorimeterHit>* EmCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EmCalorimeterHit::EmCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EmCalorimeterHit::EmCalorimeterHit(G4int cellID)
|
||||
: fCellID(cellID)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EmCalorimeterHit::~EmCalorimeterHit()
|
||||
{}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// EmCalorimeterHit::EmCalorimeterHit(const EmCalorimeterHit &right)
|
||||
// : G4VHit(),
|
||||
// fCellID(right.fCellID),
|
||||
// fEdep(right.fEdep),
|
||||
// fPos(right.fPos),
|
||||
// fRot(right.fRot),
|
||||
// fPLogV(right.fPLogV)
|
||||
// {}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// const EmCalorimeterHit& EmCalorimeterHit::operator=(const EmCalorimeterHit
|
||||
// &right)
|
||||
// {
|
||||
// fCellID = right.fCellID;
|
||||
// fEdep = right.fEdep;
|
||||
// fPos = right.fPos;
|
||||
// fRot = right.fRot;
|
||||
// fPLogV = right.fPLogV;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool EmCalorimeterHit::operator==(const EmCalorimeterHit &right) const
|
||||
{
|
||||
return (fCellID==right.fCellID);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterHit::Draw()
|
||||
void EmCalorimeterHit::Draw()
|
||||
{
|
||||
auto visManager = G4VVisManager::GetConcreteInstance();
|
||||
if ( ! visManager || (fEdep==0.) ) return;
|
||||
@@ -117,10 +117,10 @@ void B5EmCalorimeterHit::Draw()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
|
||||
const std::map<G4String,G4AttDef>* EmCalorimeterHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
auto store = G4AttDefStore::GetInstance("B5EmCalorimeterHit",isNew);
|
||||
auto store = G4AttDefStore::GetInstance("EmCalorimeterHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
@@ -145,7 +145,7 @@ const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
|
||||
std::vector<G4AttValue>* EmCalorimeterHit::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
@@ -168,9 +168,11 @@ std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterHit::Print()
|
||||
void EmCalorimeterHit::Print()
|
||||
{
|
||||
G4cout << " Cell[" << fCellID << "] " << fEdep/MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+17
-13
@@ -24,12 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5EmCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5EmCalorimeterSD class
|
||||
/// \file EmCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5::EmCalorimeterSD class
|
||||
|
||||
#include "B5EmCalorimeterSD.hh"
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
#include "B5Constants.hh"
|
||||
#include "EmCalorimeterSD.hh"
|
||||
#include "EmCalorimeterHit.hh"
|
||||
#include "Constants.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
@@ -38,26 +38,28 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterSD::B5EmCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name),
|
||||
fHitsCollection(nullptr), fHCID(-1)
|
||||
EmCalorimeterSD::EmCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
collectionName.insert("EMcalorimeterColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterSD::~B5EmCalorimeterSD()
|
||||
EmCalorimeterSD::~EmCalorimeterSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
void EmCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5EmCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
= new EmCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0) {
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
|
||||
}
|
||||
@@ -65,13 +67,13 @@ void B5EmCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
|
||||
// fill calorimeter hits with zero energy deposition
|
||||
for (auto i=0;i<kNofEmCells;i++) {
|
||||
fHitsCollection->insert(new B5EmCalorimeterHit(i));
|
||||
fHitsCollection->insert(new EmCalorimeterHit(i));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
|
||||
G4bool EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
|
||||
{
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
@@ -97,3 +99,5 @@ G4bool B5EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,15 +24,15 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5EventAction.cc
|
||||
/// \brief Implementation of the B5EventAction class
|
||||
/// \file EventAction.cc
|
||||
/// \brief Implementation of the B5::EventAction class
|
||||
|
||||
#include "B5EventAction.hh"
|
||||
#include "B5HodoscopeHit.hh"
|
||||
#include "B5DriftChamberHit.hh"
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
#include "B5Constants.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "HodoscopeHit.hh"
|
||||
#include "DriftChamberHit.hh"
|
||||
#include "EmCalorimeterHit.hh"
|
||||
#include "HadCalorimeterHit.hh"
|
||||
#include "Constants.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4RunManager.hh"
|
||||
@@ -42,12 +42,11 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "g4analysis.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
|
||||
using std::array;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// Utility function which finds a hit collection with the given Id
|
||||
@@ -57,8 +56,8 @@ G4VHitsCollection* GetHC(const G4Event* event, G4int collId) {
|
||||
if (!hce) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "No hits collection of this event found." << G4endl;
|
||||
G4Exception("B5EventAction::EndOfEventAction()",
|
||||
"B5Code001", JustWarning, msg);
|
||||
G4Exception("EventAction::EndOfEventAction()",
|
||||
"Code001", JustWarning, msg);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -66,26 +65,29 @@ G4VHitsCollection* GetHC(const G4Event* event, G4int collId) {
|
||||
if ( ! hc) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Hits collection " << collId << " of this event not found." << G4endl;
|
||||
G4Exception("B5EventAction::EndOfEventAction()",
|
||||
"B5Code001", JustWarning, msg);
|
||||
G4Exception("EventAction::EndOfEventAction()",
|
||||
"Code001", JustWarning, msg);
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EventAction::B5EventAction()
|
||||
: G4UserEventAction(),
|
||||
fHodHCID {{ -1, -1 }},
|
||||
fDriftHCID{{ -1, -1 }},
|
||||
fCalHCID {{ -1, -1 }},
|
||||
fDriftHistoID{{ {{ -1, -1 }}, {{ -1, -1 }} }},
|
||||
fCalEdep{{ vector<G4double>(kNofEmCells, 0.), vector<G4double>(kNofHadCells, 0.) }}
|
||||
// std::array<T, N> is an aggregate that contains a C array.
|
||||
// To initialize it, we need outer braces for the class itself
|
||||
// and inner braces for the C array
|
||||
EventAction::EventAction()
|
||||
// : G4UserEventAction(),
|
||||
// fHodHCID {{ -1, -1 }},
|
||||
// fDriftHCID{{ -1, -1 }},
|
||||
// fCalHCID {{ -1, -1 }},
|
||||
// fDriftHistoID{{ {{ -1, -1 }}, {{ -1, -1 }} }},
|
||||
// fCalEdep{{ vector<G4double>(kNofEmCells, 0.), vector<G4double>(kNofHadCells, 0.) }}
|
||||
// // std::array<T, N> is an aggregate that contains a C array.
|
||||
// // To initialize it, we need outer braces for the class itself
|
||||
// // and inner braces for the C array
|
||||
{
|
||||
// set printing per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
@@ -93,12 +95,12 @@ B5EventAction::B5EventAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EventAction::~B5EventAction()
|
||||
EventAction::~EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EventAction::BeginOfEventAction(const G4Event*)
|
||||
void EventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
// Find hit collections and histogram Ids by names (just once)
|
||||
// and save them in the data members of this class
|
||||
@@ -133,7 +135,7 @@ void B5EventAction::BeginOfEventAction(const G4Event*)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
void EventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
//
|
||||
// Fill histograms & ntuple
|
||||
@@ -153,7 +155,7 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
analysisManager->FillNtupleIColumn(iDet, nhit);
|
||||
|
||||
for (unsigned long i = 0; i < nhit; ++i) {
|
||||
auto hit = static_cast<B5DriftChamberHit*>(hc->GetHit(i));
|
||||
auto hit = static_cast<DriftChamberHit*>(hc->GetHit(i));
|
||||
auto localPos = hit->GetLocalPos();
|
||||
analysisManager->FillH2(fDriftHistoID[kH2][iDet], localPos.x(), localPos.y());
|
||||
}
|
||||
@@ -173,10 +175,10 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
G4double edep = 0.;
|
||||
// The EM and Had calorimeter hits are of different types
|
||||
if (iDet == 0) {
|
||||
auto hit = static_cast<B5EmCalorimeterHit*>(hc->GetHit(i));
|
||||
auto hit = static_cast<EmCalorimeterHit*>(hc->GetHit(i));
|
||||
edep = hit->GetEdep();
|
||||
} else {
|
||||
auto hit = static_cast<B5HadCalorimeterHit*>(hc->GetHit(i));
|
||||
auto hit = static_cast<HadCalorimeterHit*>(hc->GetHit(i));
|
||||
edep = hit->GetEdep();
|
||||
}
|
||||
if ( edep > 0. ) {
|
||||
@@ -195,7 +197,7 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
if ( ! hc ) return;
|
||||
|
||||
for (unsigned int i = 0; i<hc->GetSize(); ++i) {
|
||||
auto hit = static_cast<B5HodoscopeHit*>(hc->GetHit(i));
|
||||
auto hit = static_cast<HodoscopeHit*>(hc->GetHit(i));
|
||||
// columns 4, 5
|
||||
analysisManager->FillNtupleDColumn(iDet + 4, hit->GetTime());
|
||||
}
|
||||
@@ -233,7 +235,7 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
G4cout << "Drift Chamber " << iDet + 1 << " has " << hc->GetSize() << " hits." << G4endl;
|
||||
for (auto layer = 0; layer < kNofChambers; ++layer) {
|
||||
for (unsigned int i = 0; i < hc->GetSize(); i++) {
|
||||
auto hit = static_cast<B5DriftChamberHit*>(hc->GetHit(i));
|
||||
auto hit = static_cast<DriftChamberHit*>(hc->GetHit(i));
|
||||
if (hit->GetLayerID() == layer) hit->Print();
|
||||
}
|
||||
}
|
||||
@@ -248,3 +250,5 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+62
-60
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5HadCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5HadCalorimeterHit class
|
||||
/// \file HadCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5::HadCalorimeterHit class
|
||||
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
#include "B5DetectorConstruction.hh"
|
||||
#include "HadCalorimeterHit.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
@@ -42,63 +42,63 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5HadCalorimeterHit>* B5HadCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit()
|
||||
: G4VHit(),
|
||||
fColumnID(-1), fRowID(-1), fEdep(0.), fPos()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit(G4int columnID,G4int rowID)
|
||||
: G4VHit(),
|
||||
fColumnID(columnID), fRowID(rowID), fEdep(0.), fPos()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::~B5HadCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit(const B5HadCalorimeterHit &right)
|
||||
: G4VHit(),
|
||||
fColumnID(right.fColumnID),
|
||||
fRowID(right.fRowID),
|
||||
fEdep(right.fEdep),
|
||||
fPos(right.fPos),
|
||||
fRot(right.fRot)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5HadCalorimeterHit& B5HadCalorimeterHit::operator=(
|
||||
const B5HadCalorimeterHit &right)
|
||||
namespace B5
|
||||
{
|
||||
fColumnID = right.fColumnID;
|
||||
fRowID = right.fRowID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
return *this;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<HadCalorimeterHit>* HadCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HadCalorimeterHit::HadCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HadCalorimeterHit::HadCalorimeterHit(G4int columnID,G4int rowID)
|
||||
: fColumnID(columnID), fRowID(rowID)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HadCalorimeterHit::~HadCalorimeterHit()
|
||||
{}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// HadCalorimeterHit::HadCalorimeterHit(const HadCalorimeterHit &right)
|
||||
// : G4VHit(),
|
||||
// fColumnID(right.fColumnID),
|
||||
// fRowID(right.fRowID),
|
||||
// fEdep(right.fEdep),
|
||||
// fPos(right.fPos),
|
||||
// fRot(right.fRot)
|
||||
// {}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// const HadCalorimeterHit& HadCalorimeterHit::operator=(
|
||||
// const HadCalorimeterHit &right)
|
||||
// {
|
||||
// fColumnID = right.fColumnID;
|
||||
// fRowID = right.fRowID;
|
||||
// fEdep = right.fEdep;
|
||||
// fPos = right.fPos;
|
||||
// fRot = right.fRot;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool HadCalorimeterHit::operator==(const HadCalorimeterHit &right) const
|
||||
{
|
||||
return ( fColumnID==right.fColumnID && fRowID==right.fRowID );
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HadCalorimeterHit::operator==(const B5HadCalorimeterHit &right) const
|
||||
{
|
||||
return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterHit::Draw()
|
||||
void HadCalorimeterHit::Draw()
|
||||
{
|
||||
auto visManager = G4VVisManager::GetConcreteInstance();
|
||||
if (! visManager || (fEdep==0.)) return;
|
||||
@@ -115,10 +115,10 @@ void B5HadCalorimeterHit::Draw()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
|
||||
const std::map<G4String,G4AttDef>* HadCalorimeterHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
auto store = G4AttDefStore::GetInstance("B5HadCalorimeterHit",isNew);
|
||||
auto store = G4AttDefStore::GetInstance("HadCalorimeterHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
@@ -143,7 +143,7 @@ const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
|
||||
std::vector<G4AttValue>* HadCalorimeterHit::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
@@ -164,10 +164,12 @@ std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterHit::Print()
|
||||
void HadCalorimeterHit::Print()
|
||||
{
|
||||
G4cout << " Cell[" << fRowID << ", " << fColumnID << "] "
|
||||
<< fEdep/MeV << " (MeV) " << fPos << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+17
-13
@@ -24,12 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5HadCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5HadCalorimeterSD class
|
||||
/// \file HadCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5::HadCalorimeterSD class
|
||||
|
||||
#include "B5HadCalorimeterSD.hh"
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
#include "B5Constants.hh"
|
||||
#include "HadCalorimeterSD.hh"
|
||||
#include "HadCalorimeterHit.hh"
|
||||
#include "Constants.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
@@ -38,26 +38,28 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterSD::B5HadCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name),
|
||||
fHitsCollection(nullptr), fHCID(-1)
|
||||
HadCalorimeterSD::HadCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
collectionName.insert("HadCalorimeterColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterSD::~B5HadCalorimeterSD()
|
||||
HadCalorimeterSD::~HadCalorimeterSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
void HadCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5HadCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
= new HadCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0) {
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
|
||||
}
|
||||
@@ -66,14 +68,14 @@ void B5HadCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
// fill calorimeter hits with zero energy deposition
|
||||
for (auto column=0;column<kNofHadColumns;column++) {
|
||||
for (auto row=0;row<kNofHadRows;row++) {
|
||||
fHitsCollection->insert(new B5HadCalorimeterHit());
|
||||
fHitsCollection->insert(new HadCalorimeterHit());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
G4bool HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
@@ -101,3 +103,5 @@ G4bool B5HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5HodoscopeHit.cc
|
||||
/// \brief Implementation of the B5HodoscopeHit class
|
||||
/// \file HodoscopeHit.cc
|
||||
/// \brief Implementation of the B5::HodoscopeHit class
|
||||
|
||||
#include "B5HodoscopeHit.hh"
|
||||
#include "HodoscopeHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
@@ -41,55 +41,57 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5HodoscopeHit>* B5HodoscopeHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::B5HodoscopeHit(G4int id,G4double time)
|
||||
: G4VHit(),
|
||||
fId(id), fTime(time), fPos(0.), fPLogV(nullptr)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::~B5HodoscopeHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::B5HodoscopeHit(const B5HodoscopeHit &right)
|
||||
: G4VHit(),
|
||||
fId(right.fId),
|
||||
fTime(right.fTime),
|
||||
fPos(right.fPos),
|
||||
fRot(right.fRot),
|
||||
fPLogV(right.fPLogV)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5HodoscopeHit& B5HodoscopeHit::operator=(const B5HodoscopeHit &right)
|
||||
namespace B5
|
||||
{
|
||||
fId = right.fId;
|
||||
fTime = right.fTime;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HodoscopeHit::operator==(const B5HodoscopeHit &/*right*/) const
|
||||
G4ThreadLocal G4Allocator<HodoscopeHit>* HodoscopeHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HodoscopeHit::HodoscopeHit(G4int id,G4double time)
|
||||
: fId(id), fTime(time)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HodoscopeHit::~HodoscopeHit()
|
||||
{}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// HodoscopeHit::HodoscopeHit(const HodoscopeHit &right)
|
||||
// : G4VHit(),
|
||||
// fId(right.fId),
|
||||
// fTime(right.fTime),
|
||||
// fPos(right.fPos),
|
||||
// fRot(right.fRot),
|
||||
// fPLogV(right.fPLogV)
|
||||
// {}
|
||||
|
||||
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// const HodoscopeHit& HodoscopeHit::operator=(const HodoscopeHit &right)
|
||||
// {
|
||||
// fId = right.fId;
|
||||
// fTime = right.fTime;
|
||||
// fPos = right.fPos;
|
||||
// fRot = right.fRot;
|
||||
// fPLogV = right.fPLogV;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool HodoscopeHit::operator==(const HodoscopeHit &/*right*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeHit::Draw()
|
||||
void HodoscopeHit::Draw()
|
||||
{
|
||||
auto visManager = G4VVisManager::GetConcreteInstance();
|
||||
if (! visManager) return;
|
||||
@@ -106,10 +108,10 @@ void B5HodoscopeHit::Draw()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
|
||||
const std::map<G4String,G4AttDef>* HodoscopeHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
auto store = G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
|
||||
auto store = G4AttDefStore::GetInstance("HodoscopeHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
@@ -132,7 +134,7 @@ const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
|
||||
std::vector<G4AttValue>* HodoscopeHit::CreateAttValues() const
|
||||
{
|
||||
auto values = new std::vector<G4AttValue>;
|
||||
|
||||
@@ -155,9 +157,11 @@ std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeHit::Print()
|
||||
void HodoscopeHit::Print()
|
||||
{
|
||||
G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,11 +24,11 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5HodoscopeSD.cc
|
||||
/// \brief Implementation of the B5HodoscopeSD class
|
||||
/// \file HodoscopeSD.cc
|
||||
/// \brief Implementation of the B5::HodoscopeSD class
|
||||
|
||||
#include "B5HodoscopeSD.hh"
|
||||
#include "B5HodoscopeHit.hh"
|
||||
#include "HodoscopeSD.hh"
|
||||
#include "HodoscopeHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
@@ -37,25 +37,27 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeSD::B5HodoscopeSD(G4String name)
|
||||
: G4VSensitiveDetector(name),
|
||||
fHitsCollection(nullptr), fHCID(-1)
|
||||
HodoscopeSD::HodoscopeSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
collectionName.insert( "hodoscopeColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeSD::~B5HodoscopeSD()
|
||||
HodoscopeSD::~HodoscopeSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeSD::Initialize(G4HCofThisEvent* hce)
|
||||
void HodoscopeSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection = new B5HodoscopeHitsCollection
|
||||
fHitsCollection = new HodoscopeHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0) {
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
|
||||
@@ -65,7 +67,7 @@ void B5HodoscopeSD::Initialize(G4HCofThisEvent* hce)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
G4bool HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
@@ -92,7 +94,7 @@ G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
}
|
||||
else {
|
||||
// if not, create a new hit and set it to the collection
|
||||
auto hit = new B5HodoscopeHit(copyNo,hitTime);
|
||||
auto hit = new HodoscopeHit(copyNo,hitTime);
|
||||
auto physical = touchable->GetVolume();
|
||||
hit->SetLogV(physical->GetLogicalVolume());
|
||||
auto transform = touchable->GetHistory()->GetTopTransform();
|
||||
@@ -105,3 +107,5 @@ G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,20 +24,21 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5MagneticField.cc
|
||||
/// \brief Implementation of the B5MagneticField class
|
||||
/// \file MagneticField.cc
|
||||
/// \brief Implementation of the B5::MagneticField class
|
||||
|
||||
#include "B5MagneticField.hh"
|
||||
#include "MagneticField.hh"
|
||||
|
||||
#include "G4GenericMessenger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5MagneticField::B5MagneticField()
|
||||
: G4MagneticField(),
|
||||
fMessenger(nullptr), fBy(1.0*tesla)
|
||||
MagneticField::MagneticField()
|
||||
{
|
||||
// define commands for this class
|
||||
DefineCommands();
|
||||
@@ -45,12 +46,12 @@ B5MagneticField::B5MagneticField()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5MagneticField::~B5MagneticField()
|
||||
MagneticField::~MagneticField()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
void B5MagneticField::GetFieldValue(const G4double [4],double *bField) const
|
||||
void MagneticField::GetFieldValue(const G4double [4],double *bField) const
|
||||
{
|
||||
bField[0] = 0.;
|
||||
bField[1] = fBy;
|
||||
@@ -59,7 +60,7 @@ void B5MagneticField::GetFieldValue(const G4double [4],double *bField) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5MagneticField::DefineCommands()
|
||||
void MagneticField::DefineCommands()
|
||||
{
|
||||
// Define /B5/field command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
@@ -69,10 +70,12 @@ void B5MagneticField::DefineCommands()
|
||||
// fieldValue command
|
||||
auto& valueCmd
|
||||
= fMessenger->DeclareMethodWithUnit("value","tesla",
|
||||
&B5MagneticField::SetField,
|
||||
&MagneticField::SetField,
|
||||
"Set field strength.");
|
||||
valueCmd.SetParameterName("field", true);
|
||||
valueCmd.SetDefaultValue("1.");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+20
-15
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B5PrimaryGeneratorAction class
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B5::PrimaryGeneratorAction class
|
||||
|
||||
#include "B5PrimaryGeneratorAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
@@ -37,17 +37,20 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5PrimaryGeneratorAction::B5PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(nullptr), fMessenger(nullptr),
|
||||
fPositron(nullptr), fMuon(nullptr), fPion(nullptr),
|
||||
fKaon(nullptr), fProton(nullptr),
|
||||
fMomentum(1000.*MeV),
|
||||
fSigmaMomentum(50.*MeV),
|
||||
fSigmaAngle(2.*deg),
|
||||
fRandomizePrimary(true)
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
// : G4VUserPrimaryGeneratorAction(),
|
||||
// fParticleGun(nullptr), fMessenger(nullptr),
|
||||
// fPositron(nullptr), fMuon(nullptr), fPion(nullptr),
|
||||
// fKaon(nullptr), fProton(nullptr),
|
||||
// fMomentum(1000.*MeV),
|
||||
// fSigmaMomentum(50.*MeV),
|
||||
// fSigmaAngle(2.*deg),
|
||||
// fRandomizePrimary(true)
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
@@ -69,7 +72,7 @@ B5PrimaryGeneratorAction::B5PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5PrimaryGeneratorAction::~B5PrimaryGeneratorAction()
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
delete fMessenger;
|
||||
@@ -77,7 +80,7 @@ B5PrimaryGeneratorAction::~B5PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
{
|
||||
G4ParticleDefinition* particle;
|
||||
if (fRandomizePrimary) {
|
||||
@@ -119,7 +122,7 @@ void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5PrimaryGeneratorAction::DefineCommands()
|
||||
void PrimaryGeneratorAction::DefineCommands()
|
||||
{
|
||||
// Define /B5/generator command directory using generic messenger class
|
||||
fMessenger
|
||||
@@ -168,3 +171,5 @@ void B5PrimaryGeneratorAction::DefineCommands()
|
||||
}
|
||||
|
||||
//..oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,38 +24,36 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B5RunAction.cc
|
||||
/// \brief Implementation of the B5RunAction class
|
||||
/// \file RunAction.cc
|
||||
/// \brief Implementation of the B5::RunAction class
|
||||
|
||||
#include "B5RunAction.hh"
|
||||
#include "B5EventAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4GenericAnalysisManager.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
|
||||
using G4AnalysisManager = G4GenericAnalysisManager;
|
||||
namespace B5
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5RunAction::B5RunAction(B5EventAction* eventAction)
|
||||
: G4UserRunAction(),
|
||||
fEventAction(eventAction)
|
||||
RunAction::RunAction(EventAction* eventAction)
|
||||
: fEventAction(eventAction)
|
||||
{
|
||||
// Create the generic analysis manager
|
||||
// The choice of analysis technology is done according to the file extension
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetDefaultFileType("root");
|
||||
// If the filename extension is not provided, the default file type (root)
|
||||
// will be used for all files specified without extension.
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
|
||||
// Default settings
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
// Note: merging ntuples is available only with Root output
|
||||
analysisManager->SetFileName("B5");
|
||||
// If the filename extension is not provided, the default file type (root)
|
||||
// will be used for all files specified without extension.
|
||||
// analysisManager->SetDefaultFileType("xml");
|
||||
// The default file type (root) can be redefined by the user.
|
||||
|
||||
// Book histograms, ntuple
|
||||
|
||||
@@ -90,19 +88,18 @@ B5RunAction::B5RunAction(B5EventAction* eventAction)
|
||||
}
|
||||
|
||||
// Set ntuple output file
|
||||
analysisManager->SetNtupleFileName(0, "B4ntuple");
|
||||
analysisManager->SetNtupleFileName(0, "B5ntuple");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5RunAction::~B5RunAction()
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
@@ -110,22 +107,28 @@ void B5RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Reset histograms from previous run
|
||||
analysisManager->Reset();
|
||||
|
||||
// Open an output file
|
||||
// The default file name is set in B5RunAction::B5RunAction(),
|
||||
// The default file name is set in RunAction::RunAction(),
|
||||
// it can be overwritten in a macro
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// save histograms & ntuple
|
||||
//
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
|
||||
analysisManager->CloseFile(false);
|
||||
// Keep content of histos so that they are plotted.
|
||||
// The content will be reset at start of the next run.
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user