Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -61,6 +61,6 @@ void B5ActionInitialization::Build() const
SetUserAction(eventAction);
SetUserAction(new B5RunAction(eventAction));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+68 -68
View File
@@ -69,11 +69,11 @@
G4ThreadLocal B5MagneticField* B5DetectorConstruction::fMagneticField = 0;
G4ThreadLocal G4FieldManager* B5DetectorConstruction::fFieldMgr = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5DetectorConstruction::B5DetectorConstruction()
: G4VUserDetectorConstruction(),
: G4VUserDetectorConstruction(),
fMessenger(nullptr),
fHodoscope1Logical(nullptr), fHodoscope2Logical(nullptr),
fWirePlane1Logical(nullptr), fWirePlane2Logical(nullptr),
@@ -85,7 +85,7 @@ B5DetectorConstruction::B5DetectorConstruction()
{
fArmRotation = new G4RotationMatrix();
fArmRotation->rotateY(fArmAngle);
// define commands for this class
DefineCommands();
}
@@ -96,10 +96,10 @@ B5DetectorConstruction::~B5DetectorConstruction()
{
delete fArmRotation;
delete fMessenger;
for (auto visAttributes: fVisAttributes) {
delete visAttributes;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -114,52 +114,52 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
auto scintillator = G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
auto csI = G4Material::GetMaterial("G4_CESIUM_IODIDE");
auto lead = G4Material::GetMaterial("G4_Pb");
// Option to switch on/off checking of volumes overlaps
//
G4bool checkOverlaps = true;
// geometries --------------------------------------------------------------
// experimental hall (world volume)
auto worldSolid
auto worldSolid
= new G4Box("worldBox",10.*m,3.*m,10.*m);
auto worldLogical
= new G4LogicalVolume(worldSolid,air,"worldLogical");
auto worldPhysical
= new G4PVPlacement(0,G4ThreeVector(),worldLogical,"worldPhysical",0,
false,0,checkOverlaps);
// Tube with Local Magnetic field
auto magneticSolid
auto magneticSolid
= new G4Tubs("magneticTubs",0.,1.*m,1.*m,0.,360.*deg);
fMagneticLogical
= new G4LogicalVolume(magneticSolid, air, "magneticLogical");
// placement of Tube
G4RotationMatrix* fieldRot = new G4RotationMatrix();
fieldRot->rotateX(90.*deg);
new G4PVPlacement(fieldRot,G4ThreeVector(),fMagneticLogical,
"magneticPhysical",worldLogical,
false,0,checkOverlaps);
// set step limit in tube with magnetic field
// set step limit in tube with magnetic field
G4UserLimits* userLimits = new G4UserLimits(1*m);
fMagneticLogical->SetUserLimits(userLimits);
// first arm
auto firstArmSolid
auto firstArmSolid
= new G4Box("firstArmBox",1.5*m,1.*m,3.*m);
auto firstArmLogical
= new G4LogicalVolume(firstArmSolid,air,"firstArmLogical");
new G4PVPlacement(0,G4ThreeVector(0.,0.,-5.*m),firstArmLogical,
"firstArmPhysical",worldLogical,
false,0,checkOverlaps);
// second arm
auto secondArmSolid
auto secondArmSolid
= new G4Box("secondArmBox",2.*m,2.*m,3.5*m);
auto secondArmLogical
= new G4LogicalVolume(secondArmSolid,air,"secondArmLogical");
@@ -169,9 +169,9 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
= new G4PVPlacement(fArmRotation,G4ThreeVector(x,0.,z),secondArmLogical,
"fSecondArmPhys",worldLogical,
false,0,checkOverlaps);
// hodoscopes in first arm
auto hodoscope1Solid
auto hodoscope1Solid
= new G4Box("hodoscope1Box",5.*cm,20.*cm,0.5*cm);
fHodoscope1Logical
= new G4LogicalVolume(hodoscope1Solid,scintillator,"hodoscope1Logical");
@@ -182,9 +182,9 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
"hodoscope1Physical",firstArmLogical,
false,i,checkOverlaps);
}
// drift chambers in first arm
auto chamber1Solid
auto chamber1Solid
= new G4Box("chamber1Box",1.*m,30.*cm,1.*cm);
auto chamber1Logical
= new G4LogicalVolume(chamber1Solid,argonGas,"chamber1Logical");
@@ -195,18 +195,18 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
"chamber1Physical",firstArmLogical,
false,i,checkOverlaps);
}
// "virtual" wire plane
auto wirePlane1Solid
auto wirePlane1Solid
= new G4Box("wirePlane1Box",1.*m,30.*cm,0.1*mm);
fWirePlane1Logical
= new G4LogicalVolume(wirePlane1Solid,argonGas,"wirePlane1Logical");
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fWirePlane1Logical,
"wirePlane1Physical",chamber1Logical,
false,0,checkOverlaps);
// hodoscopes in second arm
auto hodoscope2Solid
auto hodoscope2Solid
= new G4Box("hodoscope2Box",5.*cm,20.*cm,0.5*cm);
fHodoscope2Logical
= new G4LogicalVolume(hodoscope2Solid,scintillator,"hodoscope2Logical");
@@ -217,47 +217,47 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
"hodoscope2Physical",secondArmLogical,
false,i,checkOverlaps);
}
// drift chambers in second arm
auto chamber2Solid
auto chamber2Solid
= new G4Box("chamber2Box",1.5*m,30.*cm,1.*cm);
auto chamber2Logical
= new G4LogicalVolume(chamber2Solid,argonGas,"chamber2Logical");
for (auto i=0;i<kNofChambers;i++) {
G4double z2 = (i-kNofChambers/2)*0.5*m - 1.5*m;
new G4PVPlacement(0,G4ThreeVector(0.,0.,z2),chamber2Logical,
"chamber2Physical",secondArmLogical,
false,i,checkOverlaps);
}
// "virtual" wire plane
auto wirePlane2Solid
auto wirePlane2Solid
= new G4Box("wirePlane2Box",1.5*m,30.*cm,0.1*mm);
fWirePlane2Logical
= new G4LogicalVolume(wirePlane2Solid,argonGas,"wirePlane2Logical");
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fWirePlane2Logical,
"wirePlane2Physical",chamber2Logical,
false,0,checkOverlaps);
// CsI calorimeter
auto emCalorimeterSolid
auto emCalorimeterSolid
= new G4Box("EMcalorimeterBox",1.5*m,30.*cm,15.*cm);
auto emCalorimeterLogical
= new G4LogicalVolume(emCalorimeterSolid,csI,"EMcalorimeterLogical");
new G4PVPlacement(0,G4ThreeVector(0.,0.,2.*m),emCalorimeterLogical,
"EMcalorimeterPhysical",secondArmLogical,
false,0,checkOverlaps);
// EMcalorimeter cells
auto cellSolid
auto cellSolid
= new G4Box("cellBox",7.5*cm,7.5*cm,15.*cm);
fCellLogical
= new G4LogicalVolume(cellSolid,csI,"cellLogical");
G4VPVParameterisation* cellParam = new B5CellParameterisation();
new G4PVParameterised("cellPhysical",fCellLogical,emCalorimeterLogical,
kXAxis,kNofEmCells,cellParam);
// hadron calorimeter
auto hadCalorimeterSolid
= new G4Box("HadCalorimeterBox",1.5*m,30.*cm,50.*cm);
@@ -266,7 +266,7 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
new G4PVPlacement(0,G4ThreeVector(0.,0.,3.*m),hadCalorimeterLogical,
"HadCalorimeterPhysical",secondArmLogical,
false,0,checkOverlaps);
// hadron calorimeter column
auto HadCalColumnSolid
= new G4Box("HadCalColumnBox",15.*cm,30.*cm,50.*cm);
@@ -274,7 +274,7 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
= new G4LogicalVolume(HadCalColumnSolid,lead,"HadCalColumnLogical");
new G4PVReplica("HadCalColumnPhysical",HadCalColumnLogical,
hadCalorimeterLogical,kXAxis,kNofHadColumns,30.*cm);
// hadron calorimeter cell
auto HadCalCellSolid
= new G4Box("HadCalCellBox",15.*cm,15.*cm,50.*cm);
@@ -282,7 +282,7 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
= new G4LogicalVolume(HadCalCellSolid,lead,"HadCalCellLogical");
new G4PVReplica("HadCalCellPhysical",HadCalCellLogical,
HadCalColumnLogical,kYAxis,kNofHadRows,30.*cm);
// hadron calorimeter layers
auto HadCalLayerSolid
= new G4Box("HadCalLayerBox",15.*cm,15.*cm,2.5*cm);
@@ -290,7 +290,7 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
= new G4LogicalVolume(HadCalLayerSolid,lead,"HadCalLayerLogical");
new G4PVReplica("HadCalLayerPhysical",HadCalLayerLogical,
HadCalCellLogical,kZAxis,kNofHadCells,5.*cm);
// scintillator plates
auto HadCalScintiSolid
= new G4Box("HadCalScintiBox",15.*cm,15.*cm,0.5*cm);
@@ -300,53 +300,53 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
new G4PVPlacement(0,G4ThreeVector(0.,0.,2.*cm),fHadCalScintiLogical,
"HadCalScintiPhysical",HadCalLayerLogical,
false,0,checkOverlaps);
// visualization attributes ------------------------------------------------
auto visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
visAttributes->SetVisibility(false);
worldLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.9)); // LightGray
fMagneticLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
visAttributes->SetVisibility(false);
firstArmLogical->SetVisAttributes(visAttributes);
secondArmLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.0,0.0));
fHodoscope1Logical->SetVisAttributes(visAttributes);
fHodoscope2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
chamber1Logical->SetVisAttributes(visAttributes);
chamber2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0,0.8888,0.0));
visAttributes->SetVisibility(false);
fWirePlane1Logical->SetVisAttributes(visAttributes);
fWirePlane2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.8888,0.0));
visAttributes->SetVisibility(false);
emCalorimeterLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.0));
fCellLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
hadCalorimeterLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
visAttributes->SetVisibility(false);
HadCalColumnLogical->SetVisAttributes(visAttributes);
@@ -354,9 +354,9 @@ G4VPhysicalVolume* B5DetectorConstruction::Construct()
HadCalLayerLogical->SetVisAttributes(visAttributes);
fHadCalScintiLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
// return the world physical volume ----------------------------------------
return worldPhysical;
}
@@ -367,7 +367,7 @@ void B5DetectorConstruction::ConstructSDandField()
// sensitive detectors -----------------------------------------------------
auto sdManager = G4SDManager::GetSDMpointer();
G4String SDname;
auto hodoscope1 = new B5HodoscopeSD(SDname="/hodoscope1");
sdManager->AddNewDetector(hodoscope1);
fHodoscope1Logical->SetSensitiveDetector(hodoscope1);
@@ -375,7 +375,7 @@ void B5DetectorConstruction::ConstructSDandField()
auto hodoscope2 = new B5HodoscopeSD(SDname="/hodoscope2");
sdManager->AddNewDetector(hodoscope2);
fHodoscope2Logical->SetSensitiveDetector(hodoscope2);
auto chamber1 = new B5DriftChamberSD(SDname="/chamber1");
sdManager->AddNewDetector(chamber1);
fWirePlane1Logical->SetSensitiveDetector(chamber1);
@@ -383,11 +383,11 @@ void B5DetectorConstruction::ConstructSDandField()
auto chamber2 = new B5DriftChamberSD(SDname="/chamber2");
sdManager->AddNewDetector(chamber2);
fWirePlane2Logical->SetSensitiveDetector(chamber2);
auto emCalorimeter = new B5EmCalorimeterSD(SDname="/EMcalorimeter");
sdManager->AddNewDetector(emCalorimeter);
fCellLogical->SetSensitiveDetector(emCalorimeter);
auto hadCalorimeter = new B5HadCalorimeterSD(SDname="/HadCalorimeter");
sdManager->AddNewDetector(hadCalorimeter);
fHadCalScintiLogical->SetSensitiveDetector(hadCalorimeter);
@@ -399,7 +399,7 @@ void B5DetectorConstruction::ConstructSDandField()
fFieldMgr->CreateChordFinder(fMagneticField);
G4bool forceToAllDaughters = true;
fMagneticLogical->SetFieldManager(fFieldMgr, forceToAllDaughters);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -407,26 +407,26 @@ void B5DetectorConstruction::ConstructMaterials()
{
auto nistManager = G4NistManager::Instance();
// Air
// Air
nistManager->FindOrBuildMaterial("G4_AIR");
// Argon gas
nistManager->FindOrBuildMaterial("G4_Ar");
// With a density different from the one defined in NIST
// G4double density = 1.782e-03*g/cm3;
// G4double density = 1.782e-03*g/cm3;
// nistManager->BuildMaterialWithNewDensity("B5_Ar","G4_Ar",density);
// !! cases segmentation fault
// Scintillator
// (PolyVinylToluene, C_9H_10)
nistManager->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
// CsI
nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
// Lead
nistManager->FindOrBuildMaterial("G4_Pb");
// Vacuum "Galactic"
// nistManager->FindOrBuildMaterial("G4_Galactic");
@@ -448,14 +448,14 @@ void B5DetectorConstruction::SetArmAngle(G4double val)
G4cerr << "Detector has not yet been constructed." << G4endl;
return;
}
fArmAngle = val;
*fArmRotation = G4RotationMatrix(); // make it unit vector
fArmRotation->rotateY(fArmAngle);
auto x = -5.*m * std::sin(fArmAngle);
auto z = 5.*m * std::cos(fArmAngle);
fSecondArmPhys->SetTranslation(G4ThreeVector(x,0.,z));
// tell G4RunManager that we change the geometry
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
@@ -465,14 +465,14 @@ void B5DetectorConstruction::SetArmAngle(G4double val)
void B5DetectorConstruction::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/B5/detector/",
fMessenger = new G4GenericMessenger(this,
"/B5/detector/",
"Detector control");
// armAngle command
auto& armAngleCmd
= fMessenger->DeclareMethodWithUnit("armAngle","deg",
&B5DetectorConstruction::SetArmAngle,
&B5DetectorConstruction::SetArmAngle,
"Set rotation angle of the second arm.");
armAngleCmd.SetParameterName("angle", true);
armAngleCmd.SetRange("angle>=0. && angle<180.");
+14 -14
View File
@@ -48,15 +48,15 @@ G4ThreadLocal G4Allocator<B5DriftChamberHit>* B5DriftChamberHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5DriftChamberHit::B5DriftChamberHit()
: G4VHit(),
fLayerID(-1), fTime(0.), fLocalPos(0), fWorldPos(0)
: G4VHit(),
fLayerID(-1), fTime(0.), fLocalPos(), fWorldPos()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5DriftChamberHit::B5DriftChamberHit(G4int layerID)
: G4VHit(),
fLayerID(layerID), fTime(0.), fLocalPos(0), fWorldPos(0)
: G4VHit(),
fLayerID(layerID), fTime(0.), fLocalPos(), fWorldPos()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -116,19 +116,19 @@ const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
auto store = G4AttDefStore::GetInstance("B5DriftChamberHit",isNew);
if (isNew) {
(*store)["HitType"]
(*store)["HitType"]
= G4AttDef("HitType","Hit Type","Physics","","G4String");
(*store)["ID"]
(*store)["ID"]
= G4AttDef("ID","ID","Physics","","G4int");
(*store)["Time"]
(*store)["Time"]
= G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
(*store)["Pos"]
(*store)["Pos"]
= G4AttDef("Pos", "Position", "Physics","G4BestUnit","G4ThreeVector");
}
return store;
}
@@ -137,7 +137,7 @@ const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
{
auto values = new std::vector<G4AttValue>;
values
->push_back(G4AttValue("HitType","DriftChamberHit",""));
values
@@ -146,7 +146,7 @@ std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
values
->push_back(G4AttValue("Pos",G4BestUnit(fWorldPos,"Length"),""));
return values;
}
+9 -9
View File
@@ -40,7 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5DriftChamberSD::B5DriftChamberSD(G4String name)
: G4VSensitiveDetector(name),
: G4VSensitiveDetector(name),
fHitsCollection(nullptr), fHCID(-1)
{
collectionName.insert("driftChamberColl");
@@ -55,11 +55,11 @@ B5DriftChamberSD::~B5DriftChamberSD()
void B5DriftChamberSD::Initialize(G4HCofThisEvent* hce)
{
fHitsCollection
fHitsCollection
= new B5DriftChamberHitsCollection(SensitiveDetectorName,collectionName[0]);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
}
hce->AddHitsCollection(fHCID,fHitsCollection);
}
@@ -70,7 +70,7 @@ G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
auto charge = step->GetTrack()->GetDefinition()->GetPDGCharge();
if (charge==0.) return true;
auto preStepPoint = step->GetPreStepPoint();
auto touchable = step->GetPreStepPoint()->GetTouchable();
@@ -78,16 +78,16 @@ G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
auto copyNo = motherPhysical->GetCopyNo();
auto worldPos = preStepPoint->GetPosition();
auto localPos
auto localPos
= touchable->GetHistory()->GetTopTransform().TransformPoint(worldPos);
auto hit = new B5DriftChamberHit(copyNo);
hit->SetWorldPos(worldPos);
hit->SetLocalPos(localPos);
hit->SetTime(preStepPoint->GetGlobalTime());
fHitsCollection->insert(hit);
return true;
}
+16 -16
View File
@@ -47,14 +47,14 @@ G4ThreadLocal G4Allocator<B5EmCalorimeterHit>* B5EmCalorimeterHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5EmCalorimeterHit::B5EmCalorimeterHit()
: G4VHit(),
: G4VHit(),
fCellID(-1), fEdep(0.), fPos(0.), fPLogV(nullptr)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5EmCalorimeterHit::B5EmCalorimeterHit(G4int cellID)
: G4VHit(),
: G4VHit(),
fCellID(cellID), fEdep(0.), fPos(0.), fPLogV(nullptr)
{}
@@ -123,21 +123,21 @@ const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
auto store = G4AttDefStore::GetInstance("B5EmCalorimeterHit",isNew);
if (isNew) {
(*store)["HitType"]
(*store)["HitType"]
= G4AttDef("HitType","Hit Type","Physics","","G4String");
(*store)["ID"]
(*store)["ID"]
= G4AttDef("ID","ID","Physics","","G4int");
(*store)["Energy"]
= G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit",
(*store)["Energy"]
= G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit",
"G4double");
(*store)["Pos"]
= G4AttDef("Pos", "Position", "Physics","G4BestUnit",
(*store)["Pos"]
= G4AttDef("Pos", "Position", "Physics","G4BestUnit",
"G4ThreeVector");
(*store)["LVol"]
(*store)["LVol"]
= G4AttDef("LVol","Logical Volume","Physics","","G4String");
}
return store;
@@ -148,7 +148,7 @@ const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
{
auto values = new std::vector<G4AttValue>;
values
->push_back(G4AttValue("HitType","EmCalorimeterHit",""));
values
@@ -157,12 +157,12 @@ std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
values
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
if (fPLogV)
values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
else
values->push_back(G4AttValue("LVol"," ",""));
return values;
}
+7 -7
View File
@@ -41,7 +41,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5EmCalorimeterSD::B5EmCalorimeterSD(G4String name)
: G4VSensitiveDetector(name),
: G4VSensitiveDetector(name),
fHitsCollection(nullptr), fHCID(-1)
{
collectionName.insert("EMcalorimeterColl");
@@ -56,13 +56,13 @@ B5EmCalorimeterSD::~B5EmCalorimeterSD()
void B5EmCalorimeterSD::Initialize(G4HCofThisEvent* hce)
{
fHitsCollection
fHitsCollection
= new B5EmCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
}
hce->AddHitsCollection(fHCID,fHitsCollection);
// fill calorimeter hits with zero energy deposition
for (auto i=0;i<kNofEmCells;i++) {
fHitsCollection->insert(new B5EmCalorimeterHit(i));
@@ -75,11 +75,11 @@ G4bool B5EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
{
auto edep = step->GetTotalEnergyDeposit();
if (edep==0.) return true;
auto touchable = step->GetPreStepPoint()->GetTouchable();
auto physical = touchable->GetVolume();
auto copyNo = physical->GetCopyNo();
auto hit = (*fHitsCollection)[copyNo];
// check if it is first touch
if (!(hit->GetLogV())) {
@@ -92,7 +92,7 @@ G4bool B5EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
}
// add energy deposition
hit->AddEdep(edep);
return true;
}
+24 -24
View File
@@ -51,12 +51,12 @@ using std::vector;
namespace {
// Utility function which finds a hit collection with the given Id
// and print warnings if not found
// and print warnings if not found
G4VHitsCollection* GetHC(const G4Event* event, G4int collId) {
auto hce = event->GetHCofThisEvent();
if (!hce) {
G4ExceptionDescription msg;
msg << "No hits collection of this event found." << G4endl;
msg << "No hits collection of this event found." << G4endl;
G4Exception("B5EventAction::EndOfEventAction()",
"B5Code001", JustWarning, msg);
return nullptr;
@@ -65,11 +65,11 @@ G4VHitsCollection* GetHC(const G4Event* event, G4int collId) {
auto hc = hce->GetHC(collId);
if ( ! hc) {
G4ExceptionDescription msg;
msg << "Hits collection " << collId << " of this event not found." << G4endl;
msg << "Hits collection " << collId << " of this event not found." << G4endl;
G4Exception("B5EventAction::EndOfEventAction()",
"B5Code001", JustWarning, msg);
}
return hc;
return hc;
}
}
@@ -77,14 +77,14 @@ G4VHitsCollection* GetHC(const G4Event* event, G4int collId) {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5EventAction::B5EventAction()
: G4UserEventAction(),
: 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
// 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
@@ -108,15 +108,15 @@ void B5EventAction::BeginOfEventAction(const G4Event*)
auto analysisManager = G4AnalysisManager::Instance();
// hits collections names
array<G4String, kDim> hHCName
array<G4String, kDim> hHCName
= {{ "hodoscope1/hodoscopeColl", "hodoscope2/hodoscopeColl" }};
array<G4String, kDim> dHCName
array<G4String, kDim> dHCName
= {{ "chamber1/driftChamberColl", "chamber2/driftChamberColl" }};
array<G4String, kDim> cHCName
array<G4String, kDim> cHCName
= {{ "EMcalorimeter/EMcalorimeterColl", "HadCalorimeter/HadCalorimeterColl" }};
// histograms names
array<array<G4String, kDim>, kDim> histoName
array<array<G4String, kDim>, kDim> histoName
= {{ {{ "Chamber1", "Chamber2" }}, {{ "Chamber1 XY", "Chamber2 XY" }} }};
for (G4int iDet = 0; iDet < kDim; ++iDet) {
@@ -129,7 +129,7 @@ void B5EventAction::BeginOfEventAction(const G4Event*)
fDriftHistoID[kH2][iDet] = analysisManager->GetH2Id(histoName[kH2][iDet]);
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -137,11 +137,11 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
{
//
// Fill histograms & ntuple
//
//
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
// Drift chambers hits
for (G4int iDet = 0; iDet < kDim; ++iDet) {
auto hc = GetHC(event, fDriftHCID[iDet]);
@@ -151,17 +151,17 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
analysisManager->FillH1(fDriftHistoID[kH1][iDet], nhit );
// columns 0, 1
analysisManager->FillNtupleIColumn(iDet, nhit);
for (unsigned long i = 0; i < nhit; ++i) {
auto hit = static_cast<B5DriftChamberHit*>(hc->GetHit(i));
auto localPos = hit->GetLocalPos();
analysisManager->FillH2(fDriftHistoID[kH2][iDet], localPos.x(), localPos.y());
}
}
// Em/Had Calorimeters hits
array<G4int, kDim> totalCalHit = {{ 0, 0 }};
array<G4double, kDim> totalCalEdep = {{ 0., 0. }};
array<G4int, kDim> totalCalHit = {{ 0, 0 }};
array<G4double, kDim> totalCalEdep = {{ 0., 0. }};
for (G4int iDet = 0; iDet < kDim; ++iDet) {
auto hc = GetHC(event, fCalHCID[iDet]);
@@ -204,18 +204,18 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
//
// Print diagnostics
//
//
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
if ( printModulo == 0 || event->GetEventID() % printModulo != 0) return;
auto primary = event->GetPrimaryVertex(0)->GetPrimary(0);
G4cout
G4cout
<< G4endl
<< ">>> Event " << event->GetEventID() << " >>> Simulation truth : "
<< primary->GetG4code()->GetParticleName()
<< " " << primary->GetMomentum() << G4endl;
// Hodoscopes
for (G4int iDet = 0; iDet < kDim; ++iDet) {
auto hc = GetHC(event, fHodHCID[iDet]);
@@ -242,7 +242,7 @@ void B5EventAction::EndOfEventAction(const G4Event* event)
// Calorimeters
array<G4String, kDim> calName = {{ "EM", "Hadron" }};
for (G4int iDet = 0; iDet < kDim; ++iDet) {
G4cout << calName[iDet] << " Calorimeter has " << totalCalHit[iDet] << " hits."
G4cout << calName[iDet] << " Calorimeter has " << totalCalHit[iDet] << " hits."
<< " Total Edep is " << totalCalEdep[iDet]/MeV << " (MeV)" << G4endl;
}
}
+16 -16
View File
@@ -49,15 +49,15 @@ G4ThreadLocal G4Allocator<B5HadCalorimeterHit>* B5HadCalorimeterHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5HadCalorimeterHit::B5HadCalorimeterHit()
: G4VHit(),
fColumnID(-1), fRowID(-1), fEdep(0.), fPos(0)
: 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(0)
: G4VHit(),
fColumnID(columnID), fRowID(rowID), fEdep(0.), fPos()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -121,20 +121,20 @@ const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
auto store = G4AttDefStore::GetInstance("B5HadCalorimeterHit",isNew);
if (isNew) {
(*store)["HitType"]
(*store)["HitType"]
= G4AttDef("HitType","Hit Type","Physics","","G4String");
(*store)["Column"]
(*store)["Column"]
= G4AttDef("Column","Column ID","Physics","","G4int");
(*store)["Row"]
(*store)["Row"]
= G4AttDef("Row","Row ID","Physics","","G4int");
(*store)["Energy"]
(*store)["Energy"]
= G4AttDef("Energy","Energy Deposited","Physics","G4BestUnit",
"G4double");
(*store)["Pos"]
(*store)["Pos"]
= G4AttDef("Pos", "Position", "Physics","G4BestUnit",
"G4ThreeVector");
}
@@ -146,7 +146,7 @@ const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
{
auto values = new std::vector<G4AttValue>;
values
->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
values
@@ -158,7 +158,7 @@ std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
values
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
return values;
}
@@ -168,6 +168,6 @@ void B5HadCalorimeterHit::Print()
{
G4cout << " Cell[" << fRowID << ", " << fColumnID << "] "
<< fEdep/MeV << " (MeV) " << fPos << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+9 -9
View File
@@ -41,7 +41,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5HadCalorimeterSD::B5HadCalorimeterSD(G4String name)
: G4VSensitiveDetector(name),
: G4VSensitiveDetector(name),
fHitsCollection(nullptr), fHCID(-1)
{
collectionName.insert("HadCalorimeterColl");
@@ -56,13 +56,13 @@ B5HadCalorimeterSD::~B5HadCalorimeterSD()
void B5HadCalorimeterSD::Initialize(G4HCofThisEvent* hce)
{
fHitsCollection
fHitsCollection
= new B5HadCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
}
hce->AddHitsCollection(fHCID,fHitsCollection);
// fill calorimeter hits with zero energy deposition
for (auto column=0;column<kNofHadColumns;column++) {
for (auto row=0;row<kNofHadRows;row++) {
@@ -77,13 +77,13 @@ G4bool B5HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
auto edep = step->GetTotalEnergyDeposit();
if (edep==0.) return true;
auto touchable = step->GetPreStepPoint()->GetTouchable();
auto touchable = step->GetPreStepPoint()->GetTouchable();
auto rowNo = touchable->GetCopyNumber(2);
auto columnNo = touchable->GetCopyNumber(3);
auto hitID = kNofHadRows*columnNo+rowNo;
auto hit = (*fHitsCollection)[hitID];
// check if it is first touch
if (hit->GetColumnID()<0) {
hit->SetColumnID(columnNo);
@@ -96,7 +96,7 @@ G4bool B5HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
}
// add energy deposition
hit->AddEdep(edep);
return true;
}
+13 -13
View File
@@ -48,7 +48,7 @@ G4ThreadLocal G4Allocator<B5HodoscopeHit>* B5HodoscopeHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5HodoscopeHit::B5HodoscopeHit(G4int id,G4double time)
: G4VHit(),
: G4VHit(),
fId(id), fTime(time), fPos(0.), fPLogV(nullptr)
{}
@@ -112,19 +112,19 @@ const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
auto store = G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
if (isNew) {
(*store)["HitType"]
(*store)["HitType"]
= G4AttDef("HitType","Hit Type","Physics","","G4String");
(*store)["ID"]
(*store)["ID"]
= G4AttDef("ID","ID","Physics","","G4int");
(*store)["Time"]
(*store)["Time"]
= G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
(*store)["Pos"]
(*store)["Pos"]
= G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector");
(*store)["LVol"]
(*store)["LVol"]
= G4AttDef("LVol","Logical Volume","Physics","","G4String");
}
return store;
@@ -135,7 +135,7 @@ const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
{
auto values = new std::vector<G4AttValue>;
values
->push_back(G4AttValue("HitType","HodoscopeHit",""));
values
@@ -144,12 +144,12 @@ std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
values
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
if (fPLogV)
values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
else
values->push_back(G4AttValue("LVol"," ",""));
return values;
}
+8 -8
View File
@@ -40,7 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5HodoscopeSD::B5HodoscopeSD(G4String name)
: G4VSensitiveDetector(name),
: G4VSensitiveDetector(name),
fHitsCollection(nullptr), fHCID(-1)
{
collectionName.insert( "hodoscopeColl");
@@ -57,8 +57,8 @@ void B5HodoscopeSD::Initialize(G4HCofThisEvent* hce)
{
fHitsCollection = new B5HodoscopeHitsCollection
(SensitiveDetectorName,collectionName[0]);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
if (fHCID<0) {
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
}
hce->AddHitsCollection(fHCID,fHitsCollection);
}
@@ -69,12 +69,12 @@ G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
auto edep = step->GetTotalEnergyDeposit();
if (edep==0.) return true;
auto preStepPoint = step->GetPreStepPoint();
auto touchable = preStepPoint->GetTouchable();
auto copyNo = touchable->GetVolume()->GetCopyNo();
auto hitTime = preStepPoint->GetGlobalTime();
// check if this finger already has a hit
auto ix = -1;
for (std::size_t i=0;i<fHitsCollection->entries();++i) {
@@ -86,8 +86,8 @@ G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
if (ix>=0) {
// if it has, then take the earlier time
if ((*fHitsCollection)[ix]->GetTime()>hitTime) {
(*fHitsCollection)[ix]->SetTime(hitTime);
if ((*fHitsCollection)[ix]->GetTime()>hitTime) {
(*fHitsCollection)[ix]->SetTime(hitTime);
}
}
else {
@@ -100,7 +100,7 @@ G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
hit->SetRot(transform.NetRotation());
hit->SetPos(transform.NetTranslation());
fHitsCollection->insert(hit);
}
}
return true;
}
+7 -7
View File
@@ -36,7 +36,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5MagneticField::B5MagneticField()
: G4MagneticField(),
: G4MagneticField(),
fMessenger(nullptr), fBy(1.0*tesla)
{
// define commands for this class
@@ -46,8 +46,8 @@ B5MagneticField::B5MagneticField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5MagneticField::~B5MagneticField()
{
delete fMessenger;
{
delete fMessenger;
}
void B5MagneticField::GetFieldValue(const G4double [4],double *bField) const
@@ -62,14 +62,14 @@ void B5MagneticField::GetFieldValue(const G4double [4],double *bField) const
void B5MagneticField::DefineCommands()
{
// Define /B5/field command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/B5/field/",
fMessenger = new G4GenericMessenger(this,
"/B5/field/",
"Field control");
// fieldValue command
// fieldValue command
auto& valueCmd
= fMessenger->DeclareMethodWithUnit("value","tesla",
&B5MagneticField::SetField,
&B5MagneticField::SetField,
"Set field strength.");
valueCmd.SetParameterName("field", true);
valueCmd.SetDefaultValue("1.");
@@ -40,9 +40,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B5PrimaryGeneratorAction::B5PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(nullptr), fMessenger(nullptr),
fPositron(nullptr), fMuon(nullptr), fPion(nullptr),
: G4VUserPrimaryGeneratorAction(),
fParticleGun(nullptr), fMessenger(nullptr),
fPositron(nullptr), fMuon(nullptr), fPion(nullptr),
fKaon(nullptr), fProton(nullptr),
fMomentum(1000.*MeV),
fSigmaMomentum(50.*MeV),
@@ -51,18 +51,18 @@ B5PrimaryGeneratorAction::B5PrimaryGeneratorAction()
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
auto particleTable = G4ParticleTable::GetParticleTable();
fPositron = particleTable->FindParticle("e+");
fMuon = particleTable->FindParticle("mu+");
fPion = particleTable->FindParticle("pi+");
fKaon = particleTable->FindParticle("kaon+");
fProton = particleTable->FindParticle("proton");
// default particle kinematics
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-8.*m));
fParticleGun->SetParticleDefinition(fPositron);
// define commands for this class
DefineCommands();
}
@@ -79,7 +79,7 @@ B5PrimaryGeneratorAction::~B5PrimaryGeneratorAction()
void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
{
G4ParticleDefinition* particle;
G4ParticleDefinition* particle;
if (fRandomizePrimary) {
G4int i = (int)(5.*G4UniformRand());
switch(i) {
@@ -104,16 +104,16 @@ void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
else {
particle = fParticleGun->GetParticleDefinition();
}
auto pp = fMomentum + (G4UniformRand()-0.5)*fSigmaMomentum;
auto mass = particle->GetPDGMass();
auto ekin = std::sqrt(pp*pp+mass*mass)-mass;
fParticleGun->SetParticleEnergy(ekin);
auto angle = (G4UniformRand()-0.5)*fSigmaAngle;
fParticleGun->SetParticleMomentumDirection(
G4ThreeVector(std::sin(angle),0.,std::cos(angle)));
fParticleGun->GeneratePrimaryVertex(event);
}
@@ -122,46 +122,46 @@ void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
void B5PrimaryGeneratorAction::DefineCommands()
{
// Define /B5/generator command directory using generic messenger class
fMessenger
= new G4GenericMessenger(this,
"/B5/generator/",
fMessenger
= new G4GenericMessenger(this,
"/B5/generator/",
"Primary generator control");
// momentum command
auto& momentumCmd
= fMessenger->DeclarePropertyWithUnit("momentum", "GeV", fMomentum,
= fMessenger->DeclarePropertyWithUnit("momentum", "GeV", fMomentum,
"Mean momentum of primaries.");
momentumCmd.SetParameterName("p", true);
momentumCmd.SetRange("p>=0.");
momentumCmd.SetRange("p>=0.");
momentumCmd.SetDefaultValue("1.");
// ok
//momentumCmd.SetParameterName("p", true);
//momentumCmd.SetRange("p>=0.");
//momentumCmd.SetRange("p>=0.");
// sigmaMomentum command
auto& sigmaMomentumCmd
= fMessenger->DeclarePropertyWithUnit("sigmaMomentum",
"MeV", fSigmaMomentum, "Sigma momentum of primaries.");
sigmaMomentumCmd.SetParameterName("sp", true);
sigmaMomentumCmd.SetRange("sp>=0.");
sigmaMomentumCmd.SetRange("sp>=0.");
sigmaMomentumCmd.SetDefaultValue("50.");
// sigmaAngle command
auto& sigmaAngleCmd
= fMessenger->DeclarePropertyWithUnit("sigmaAngle", "deg", fSigmaAngle,
= fMessenger->DeclarePropertyWithUnit("sigmaAngle", "deg", fSigmaAngle,
"Sigma angle divergence of primaries.");
sigmaAngleCmd.SetParameterName("t", true);
sigmaAngleCmd.SetRange("t>=0.");
sigmaAngleCmd.SetRange("t>=0.");
sigmaAngleCmd.SetDefaultValue("2.");
// randomizePrimary command
auto& randomCmd
= fMessenger->DeclareProperty("randomizePrimary", fRandomizePrimary);
G4String guidance
= "Boolean flag for randomizing primary particle types.\n";
= "Boolean flag for randomizing primary particle types.\n";
guidance
+= "In case this flag is false, you can select the primary particle\n";
guidance += " with /gun/particle command.";
guidance += " with /gun/particle command.";
randomCmd.SetGuidance(guidance);
randomCmd.SetParameterName("flg", true);
randomCmd.SetDefaultValue("true");
+11 -11
View File
@@ -42,7 +42,7 @@ using G4AnalysisManager = G4GenericAnalysisManager;
B5RunAction::B5RunAction(B5EventAction* eventAction)
: G4UserRunAction(),
fEventAction(eventAction)
{
{
// Create the generic analysis manager
// The choice of analysis technology is done according to the file extension
auto analysisManager = G4AnalysisManager::Instance();
@@ -58,18 +58,18 @@ B5RunAction::B5RunAction(B5EventAction* eventAction)
// The default file type (root) can be redefined by the user.
// Book histograms, ntuple
// Creating 1D histograms
analysisManager
->CreateH1("Chamber1","Drift Chamber 1 # Hits", 50, 0., 50); // h1 Id = 0
analysisManager
->CreateH1("Chamber2","Drift Chamber 2 # Hits", 50, 0., 50); // h1 Id = 1
// Creating 2D histograms
analysisManager
analysisManager
->CreateH2("Chamber1 XY","Drift Chamber 1 X vs Y", // h2 Id = 0
50, -1000., 1000, 50, -300., 300.);
analysisManager
50, -1000., 1000, 50, -300., 300.);
analysisManager
->CreateH2("Chamber2 XY","Drift Chamber 2 X vs Y", // h2 Id = 1
50, -1500., 1500, 50, -300., 300.);
@@ -83,7 +83,7 @@ B5RunAction::B5RunAction(B5EventAction* eventAction)
analysisManager->CreateNtupleDColumn("Time1"); // column Id = 4
analysisManager->CreateNtupleDColumn("Time2"); // column Id = 5
analysisManager // column Id = 6
->CreateNtupleDColumn("ECEnergyVector", fEventAction->GetEmCalEdep());
->CreateNtupleDColumn("ECEnergyVector", fEventAction->GetEmCalEdep());
analysisManager // column Id = 7
->CreateNtupleDColumn("HCEnergyVector", fEventAction->GetHadCalEdep());
analysisManager->FinishNtuple();
@@ -97,20 +97,20 @@ B5RunAction::B5RunAction(B5EventAction* eventAction)
B5RunAction::~B5RunAction()
{
delete G4AnalysisManager::Instance();
delete G4AnalysisManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B5RunAction::BeginOfRunAction(const G4Run* /*run*/)
{
{
//inform the runManager to save random number seed
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// Get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
// Open an output file
// Open an output file
// The default file name is set in B5RunAction::B5RunAction(),
// it can be overwritten in a macro
analysisManager->OpenFile();