Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
+6
-8
@@ -28,22 +28,20 @@
|
||||
/// \brief Implementation of the ExGflashActionInitialization class
|
||||
|
||||
#include "ExGflashActionInitialization.hh"
|
||||
#include "ExGflashEventAction.hh"
|
||||
#include "ExGflashPrimaryGeneratorAction.hh"
|
||||
#include "ExGflashRunAction.hh"
|
||||
#include "ExGflashEventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashActionInitialization::ExGflashActionInitialization(ExGflashDetectorConstruction* det)
|
||||
ExGflashActionInitialization::ExGflashActionInitialization(
|
||||
ExGflashDetectorConstruction* det)
|
||||
: G4VUserActionInitialization(), fDetector(det)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashActionInitialization::~ExGflashActionInitialization()
|
||||
{
|
||||
}
|
||||
ExGflashActionInitialization::~ExGflashActionInitialization() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -59,6 +57,6 @@ void ExGflashActionInitialization::Build() const
|
||||
SetUserAction(new ExGflashPrimaryGeneratorAction);
|
||||
SetUserAction(new ExGflashRunAction(fDetector));
|
||||
SetUserAction(new ExGflashEventAction(fDetector));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+135
-153
@@ -33,59 +33,67 @@
|
||||
|
||||
// User Classes
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
#include "ExGflashSensitiveDetector.hh"
|
||||
#include "ExGflashMessenger.hh"
|
||||
#include "ExGflashHomoShowerTuning.hh"
|
||||
#include "ExGflashMessenger.hh"
|
||||
#include "ExGflashSensitiveDetector.hh"
|
||||
|
||||
// G4 Classes
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//fast simulation
|
||||
#include "GFlashHomoShowerParameterisation.hh"
|
||||
// fast simulation
|
||||
#include "G4FastSimulationManager.hh"
|
||||
#include "GFlashShowerModel.hh"
|
||||
#include "GFlashHitMaker.hh"
|
||||
#include "GFlashHomoShowerParameterisation.hh"
|
||||
#include "GFlashParticleBounds.hh"
|
||||
#include "GFlashShowerModel.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal GFlashShowerModel* ExGflashDetectorConstruction::fFastShowerModel = 0;
|
||||
G4ThreadLocal
|
||||
GFlashHomoShowerParameterisation* ExGflashDetectorConstruction::fParameterisation = 0;
|
||||
G4ThreadLocal GFlashParticleBounds* ExGflashDetectorConstruction::fParticleBounds = 0;
|
||||
G4ThreadLocal GFlashHitMaker* ExGflashDetectorConstruction::fHitMaker = 0;
|
||||
G4ThreadLocal GFlashShowerModel*
|
||||
ExGflashDetectorConstruction::fFastShowerModel = nullptr;
|
||||
G4ThreadLocal GFlashHomoShowerParameterisation*
|
||||
ExGflashDetectorConstruction::fParameterisation = nullptr;
|
||||
G4ThreadLocal GFlashParticleBounds*
|
||||
ExGflashDetectorConstruction::fParticleBounds = nullptr;
|
||||
G4ThreadLocal GFlashHitMaker* ExGflashDetectorConstruction::fHitMaker = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4int kMaxBin = 500;
|
||||
//const G4int kMaxRowCol = 50;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashDetectorConstruction::ExGflashDetectorConstruction()
|
||||
:G4VUserDetectorConstruction(),fNbOfCrystals(10),
|
||||
fCrystal_log(0),fDetMat(0),fRegion(0),
|
||||
fVerbose(0),fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fNbOfCrystals(10),
|
||||
fCrystal_log(nullptr),
|
||||
fDetMat(nullptr),
|
||||
fRegion(nullptr),
|
||||
fVerbose(0),
|
||||
fNLtot(40),
|
||||
fNRtot(50),
|
||||
fDLradl(0.5),
|
||||
fDRradl(0.1)
|
||||
{
|
||||
G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
|
||||
G4cout << "ExGflashDetectorConstruction::Detector constructor" << G4endl;
|
||||
fGflashMessenger = new ExGflashMessenger(this);
|
||||
|
||||
// Crystall
|
||||
fCrystalWidth = 3*cm;
|
||||
fCrystalLength = 24*cm;
|
||||
fCrystalWidth = 3 * cm;
|
||||
fCrystalLength = 24 * cm;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -93,7 +101,7 @@ ExGflashDetectorConstruction::ExGflashDetectorConstruction()
|
||||
ExGflashDetectorConstruction::~ExGflashDetectorConstruction()
|
||||
{
|
||||
delete fGflashMessenger;
|
||||
delete fFastShowerModel;
|
||||
delete fFastShowerModel;
|
||||
delete fParameterisation;
|
||||
delete fParticleBounds;
|
||||
delete fHitMaker;
|
||||
@@ -112,116 +120,90 @@ G4VPhysicalVolume* ExGflashDetectorConstruction::Construct()
|
||||
G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
|
||||
|
||||
fDetMat = pbWO4;
|
||||
|
||||
//------------------------------
|
||||
|
||||
//------------------------------
|
||||
// Calorimeter segments
|
||||
//------------------------------
|
||||
// Simplified `CMS-like` PbWO4 crystal calorimeter
|
||||
|
||||
|
||||
// Simplified `CMS-like` PbWO4 crystal calorimeter
|
||||
// Simplified `CMS-like` PbWO4 crystal calorimeter
|
||||
|
||||
// Calorimeter
|
||||
G4double calo_xside = (fCrystalWidth*fNbOfCrystals);
|
||||
G4double calo_yside = (fCrystalWidth*fNbOfCrystals);
|
||||
// Simplified `CMS-like` PbWO4 crystal calorimeter
|
||||
|
||||
// Calorimeter
|
||||
G4double calo_xside = (fCrystalWidth * fNbOfCrystals);
|
||||
G4double calo_yside = (fCrystalWidth * fNbOfCrystals);
|
||||
G4double calo_zside = fCrystalLength;
|
||||
|
||||
//The Experimental Hall
|
||||
G4double experimentalHall_x=calo_xside * 4;
|
||||
G4double experimentalHall_y=calo_yside * 4;
|
||||
G4double experimentalHall_z=calo_zside * 4;
|
||||
|
||||
G4VSolid* experimentalHall_box
|
||||
= new G4Box("expHall_box", // World Volume
|
||||
experimentalHall_x, // x size
|
||||
experimentalHall_y, // y size
|
||||
experimentalHall_z); // z size
|
||||
|
||||
G4LogicalVolume* experimentalHall_log
|
||||
= new G4LogicalVolume(experimentalHall_box,
|
||||
air,
|
||||
"expHall_log",
|
||||
0, //opt: fieldManager
|
||||
0, //opt: SensitiveDetector
|
||||
0); //opt: UserLimits
|
||||
G4VPhysicalVolume* experimentalHall_phys
|
||||
= new G4PVPlacement(0,
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"expHall",
|
||||
experimentalHall_log,
|
||||
0,
|
||||
false,
|
||||
0);
|
||||
|
||||
G4Box* calo_box= new G4Box("Calorimeter", // its name
|
||||
calo_xside/2., // size
|
||||
calo_yside/2.,
|
||||
calo_zside/2.);
|
||||
G4LogicalVolume* calo_log
|
||||
= new G4LogicalVolume(calo_box, // its solid
|
||||
air, // its material
|
||||
"calo_log", // its name
|
||||
0, // opt: fieldManager
|
||||
0, // opt: SensitiveDetector
|
||||
0); // opt: UserLimit
|
||||
|
||||
// The Experimental Hall
|
||||
G4double experimentalHall_x = calo_xside * 4;
|
||||
G4double experimentalHall_y = calo_yside * 4;
|
||||
G4double experimentalHall_z = calo_zside * 4;
|
||||
|
||||
G4VSolid* experimentalHall_box = new G4Box("expHall_box", // World Volume
|
||||
experimentalHall_x, // x size
|
||||
experimentalHall_y, // y size
|
||||
experimentalHall_z); // z size
|
||||
|
||||
auto experimentalHall_log =
|
||||
new G4LogicalVolume(experimentalHall_box, air, "expHall_log",
|
||||
nullptr, // opt: fieldManager
|
||||
nullptr, // opt: SensitiveDetector
|
||||
nullptr); // opt: UserLimits
|
||||
G4VPhysicalVolume* experimentalHall_phys = new G4PVPlacement(nullptr,
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
"expHall", experimentalHall_log, nullptr, false, 0);
|
||||
|
||||
G4Box* calo_box = new G4Box("Calorimeter", // its name
|
||||
calo_xside / 2., // size
|
||||
calo_yside / 2., calo_zside / 2.);
|
||||
auto calo_log = new G4LogicalVolume(calo_box, // its solid
|
||||
air, // its material
|
||||
"calo_log", // its name
|
||||
nullptr, // opt: fieldManager
|
||||
nullptr, // opt: SensitiveDetector
|
||||
nullptr); // opt: UserLimit
|
||||
|
||||
G4double xpos = 0.0;
|
||||
G4double ypos = 0.0;
|
||||
G4double zpos = calo_zside/2.;// face @ z= 0.0
|
||||
G4double zpos = calo_zside / 2.; // face @ z= 0.0
|
||||
|
||||
new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), calo_log,
|
||||
"calorimeter", experimentalHall_log, false, 1);
|
||||
|
||||
new G4PVPlacement(0,
|
||||
G4ThreeVector(xpos, ypos, zpos),
|
||||
calo_log,
|
||||
"calorimeter",
|
||||
experimentalHall_log,
|
||||
false,
|
||||
1);
|
||||
|
||||
// Crystals
|
||||
G4VSolid* crystal_box
|
||||
= new G4Box("Crystal", // its name
|
||||
fCrystalWidth/2,
|
||||
fCrystalWidth/2,
|
||||
fCrystalLength/2);
|
||||
// size
|
||||
fCrystal_log
|
||||
= new G4LogicalVolume(crystal_box, // its solid
|
||||
fDetMat, // its material
|
||||
"Crystal_log"); // its name
|
||||
|
||||
for (G4int i=0; i<fNbOfCrystals; i++)
|
||||
{
|
||||
|
||||
for (G4int j=0; j<fNbOfCrystals; j++)
|
||||
{
|
||||
G4int n = i*10+j;
|
||||
G4ThreeVector crystalPos((i*fCrystalWidth)-(calo_xside-fCrystalWidth)/2.,
|
||||
(j*fCrystalWidth)-(calo_yside-fCrystalWidth)/2.,0 );
|
||||
new G4PVPlacement(0, // no rotation
|
||||
crystalPos, // translation
|
||||
fCrystal_log,
|
||||
"crystal", // its name
|
||||
calo_log,
|
||||
false,
|
||||
n);
|
||||
}
|
||||
}
|
||||
G4cout << "There are " << fNbOfCrystals <<
|
||||
" crystals per row in the calorimeter, so in total "<<
|
||||
fNbOfCrystals*fNbOfCrystals << " crystals" << G4endl;
|
||||
G4VSolid* crystal_box = new G4Box("Crystal", // its name
|
||||
fCrystalWidth / 2, fCrystalWidth / 2, fCrystalLength / 2);
|
||||
// size
|
||||
fCrystal_log = new G4LogicalVolume(crystal_box, // its solid
|
||||
fDetMat, // its material
|
||||
"Crystal_log"); // its name
|
||||
|
||||
for ( G4int i = 0; i < fNbOfCrystals; i++ ) {
|
||||
for ( G4int j = 0; j < fNbOfCrystals; j++ ) {
|
||||
G4int n = i * 10 + j;
|
||||
G4ThreeVector crystalPos(
|
||||
(i * fCrystalWidth) - (calo_xside - fCrystalWidth) / 2.,
|
||||
(j * fCrystalWidth) - (calo_yside - fCrystalWidth) / 2., 0);
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
crystalPos, // translation
|
||||
fCrystal_log,
|
||||
"crystal", // its name
|
||||
calo_log, false, n);
|
||||
}
|
||||
}
|
||||
G4cout << "There are " << fNbOfCrystals
|
||||
<< " crystals per row in the calorimeter, so in total "
|
||||
<< fNbOfCrystals * fNbOfCrystals << " crystals" << G4endl;
|
||||
G4cout << "Total Calorimeter size" << calo_xside / cm << " cm x "
|
||||
<< calo_yside / cm << " cm x "
|
||||
<< calo_zside / cm << " cm" << G4endl;
|
||||
G4cout << "They have width of " << fCrystalWidth /cm <<
|
||||
" cm and a length of " << fCrystalLength /cm
|
||||
<<" cm. The Material is "<< fDetMat
|
||||
<<" Total: "<< fCrystalLength / fDetMat->GetRadlen()
|
||||
<<" X0" << G4endl;
|
||||
|
||||
|
||||
<< calo_yside / cm << " cm x " << calo_zside / cm << " cm" << G4endl;
|
||||
G4cout << "They have width of " << fCrystalWidth / cm
|
||||
<< " cm and a length of " << fCrystalLength / cm
|
||||
<< " cm. The Material is " << fDetMat
|
||||
<< " Total: " << fCrystalLength / fDetMat->GetRadlen() << " X0"
|
||||
<< G4endl;
|
||||
|
||||
experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
|
||||
calo_log->SetVisAttributes(caloVisAtt);
|
||||
fCrystal_log->SetVisAttributes(crystalVisAtt);
|
||||
|
||||
@@ -230,8 +212,8 @@ G4VPhysicalVolume* ExGflashDetectorConstruction::Construct()
|
||||
fRegion = new G4Region("crystals");
|
||||
calo_log->SetRegion(fRegion);
|
||||
fRegion->AddRootLogicalVolume(calo_log);
|
||||
|
||||
return experimentalHall_phys;
|
||||
|
||||
return experimentalHall_phys;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -242,22 +224,21 @@ void ExGflashDetectorConstruction::ConstructSDandField()
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
ExGflashSensitiveDetector* SD =
|
||||
new ExGflashSensitiveDetector("Calorimeter",this);
|
||||
auto SD = new ExGflashSensitiveDetector("Calorimeter", this);
|
||||
|
||||
SDman->AddNewDetector(SD);
|
||||
if (fCrystal_log)
|
||||
if ( fCrystal_log != nullptr ) {
|
||||
fCrystal_log->SetSensitiveDetector(SD);
|
||||
|
||||
}
|
||||
|
||||
// -- fast simulation models:
|
||||
// **********************************************
|
||||
// * Initializing shower modell
|
||||
// ***********************************************
|
||||
G4cout << "\n--> Creating shower parameterization models" << G4endl;
|
||||
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
|
||||
fParameterisation =
|
||||
new GFlashHomoShowerParameterisation(fDetMat,
|
||||
new ExGflashHomoShowerTuning());
|
||||
fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
|
||||
fParameterisation = new GFlashHomoShowerParameterisation(
|
||||
fDetMat, new ExGflashHomoShowerTuning());
|
||||
fFastShowerModel->SetParameterisation(*fParameterisation);
|
||||
// Energy Cuts to kill particles:
|
||||
fParticleBounds = new GFlashParticleBounds();
|
||||
@@ -265,22 +246,22 @@ void ExGflashDetectorConstruction::ConstructSDandField()
|
||||
// Makes the EnergieSpots
|
||||
fHitMaker = new GFlashHitMaker();
|
||||
fFastShowerModel->SetHitMaker(*fHitMaker);
|
||||
G4cout<<"end shower parameterization."<<G4endl;
|
||||
G4cout << "end shower parameterization." << G4endl;
|
||||
// **********************************************
|
||||
// Get Rad Len and R molere ?
|
||||
fSDRadLen = fDetMat->GetRadlen();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashDetectorConstruction::SetLBining(G4ThreeVector Value)
|
||||
{
|
||||
fNLtot = (G4int)Value(0);
|
||||
if (fNLtot > kMaxBin) {
|
||||
G4cout << "\n ---> warning from SetLBining: "
|
||||
<< fNLtot << " truncated to " << kMaxBin << G4endl;
|
||||
if ( fNLtot > kMaxBin ) {
|
||||
G4cout << "\n ---> warning from SetLBining: " << fNLtot << " truncated to "
|
||||
<< kMaxBin << G4endl;
|
||||
fNLtot = kMaxBin;
|
||||
}
|
||||
}
|
||||
fDLradl = Value(1);
|
||||
}
|
||||
|
||||
@@ -289,11 +270,11 @@ void ExGflashDetectorConstruction::SetLBining(G4ThreeVector Value)
|
||||
void ExGflashDetectorConstruction::SetRBining(G4ThreeVector Value)
|
||||
{
|
||||
fNRtot = (G4int)Value(0);
|
||||
if (fNRtot > kMaxBin) {
|
||||
G4cout << "\n ---> warning from SetRBining: "
|
||||
<< fNRtot << " truncated to " << kMaxBin << G4endl;
|
||||
if ( fNRtot > kMaxBin ) {
|
||||
G4cout << "\n ---> warning from SetRBining: " << fNRtot << " truncated to "
|
||||
<< kMaxBin << G4endl;
|
||||
fNRtot = kMaxBin;
|
||||
}
|
||||
}
|
||||
fDRradl = Value(1);
|
||||
}
|
||||
|
||||
@@ -305,10 +286,12 @@ void ExGflashDetectorConstruction::SetMaterial(G4String mat)
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(mat);
|
||||
|
||||
if(pttoMaterial && fDetMat != pttoMaterial) {
|
||||
if ( pttoMaterial != nullptr && fDetMat != pttoMaterial ) {
|
||||
fDetMat = pttoMaterial;
|
||||
if(fCrystal_log) { fCrystal_log->SetMaterial(fDetMat); }
|
||||
if(fParameterisation) {
|
||||
if ( fCrystal_log != nullptr ) {
|
||||
fCrystal_log->SetMaterial(fDetMat);
|
||||
}
|
||||
if ( fParameterisation != nullptr ) {
|
||||
fParameterisation->SetMaterial(fDetMat);
|
||||
fParameterisation->PrintMaterial(fDetMat);
|
||||
// Get Rad Len and R molere ?
|
||||
@@ -318,5 +301,4 @@ void ExGflashDetectorConstruction::SetMaterial(G4String mat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,143 +27,132 @@
|
||||
/// \file ExGflashEventAction.cc
|
||||
/// \brief Implementation of the ExGflashEventAction class
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
|
||||
|
||||
#include "ExGflashEventAction.hh"
|
||||
#include "ExGflashHit.hh"
|
||||
#include "ExGflashHistoManager.hh"
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
#include "ExGflashHistoManager.hh"
|
||||
#include "ExGflashHit.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
//std
|
||||
#include <iostream>
|
||||
#include "G4UImanager.hh"
|
||||
// std
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
typedef std::vector<G4double> MyVector;
|
||||
|
||||
//Gflash
|
||||
using MyVector = std::vector<G4double>;
|
||||
|
||||
// Gflash
|
||||
using namespace std;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashEventAction::ExGflashEventAction(ExGflashDetectorConstruction* det)
|
||||
: G4UserEventAction(),fCalorimeterCollectionId(-1),fDet(det)
|
||||
{
|
||||
}
|
||||
: G4UserEventAction(), fCalorimeterCollectionId(-1), fDet(det)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashEventAction::~ExGflashEventAction()
|
||||
{
|
||||
}
|
||||
ExGflashEventAction::~ExGflashEventAction() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashEventAction::BeginOfEventAction(const G4Event * /* evt */)
|
||||
{
|
||||
}
|
||||
void ExGflashEventAction::BeginOfEventAction(const G4Event* /* evt */) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashEventAction::EndOfEventAction(const G4Event *evt)
|
||||
{
|
||||
void ExGflashEventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String colNam;
|
||||
fCalorimeterCollectionId =
|
||||
SDman->GetCollectionID(colNam = "ExGflashCollection");
|
||||
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
G4String colNam;
|
||||
fCalorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
|
||||
if ( fCalorimeterCollectionId < 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fCalorimeterCollectionId<0) return;
|
||||
|
||||
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
|
||||
ExGflashHitsCollection* THC = 0;
|
||||
G4double totE = 0;
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
ExGflashHitsCollection* THC = nullptr;
|
||||
G4double totE = 0;
|
||||
|
||||
// Read out of the crysta ECAL
|
||||
THC=(ExGflashHitsCollection *)(HCE->GetHC(fCalorimeterCollectionId));
|
||||
THC = (ExGflashHitsCollection*)(HCE->GetHC(fCalorimeterCollectionId));
|
||||
|
||||
if (THC)
|
||||
{
|
||||
/// Hits in sensitive Detector
|
||||
int n_hit = THC->entries();
|
||||
// G4cout<<" " << n_hit<< " hits are stored in ExGflashHitsCollection "<<G4endl;
|
||||
G4PrimaryVertex* pvertex=evt->GetPrimaryVertex();
|
||||
//Computing (x,y,z) of vertex of initial particles
|
||||
G4ThreeVector vtx=pvertex->GetPosition();
|
||||
G4PrimaryParticle* pparticle=pvertex->GetPrimary();
|
||||
// direction of the Shower
|
||||
G4ThreeVector mom=pparticle->GetMomentumDirection();
|
||||
if ( THC != nullptr ) {
|
||||
/// Hits in sensitive Detector
|
||||
int n_hit = THC->entries();
|
||||
// G4cout<<" " << n_hit<< " hits are stored in ExGflashHitsCollection
|
||||
// "<<G4endl;
|
||||
G4PrimaryVertex* pvertex = evt->GetPrimaryVertex();
|
||||
// Computing (x,y,z) of vertex of initial particles
|
||||
G4ThreeVector vtx = pvertex->GetPosition();
|
||||
G4PrimaryParticle* pparticle = pvertex->GetPrimary();
|
||||
// direction of the Shower
|
||||
G4ThreeVector mom = pparticle->GetMomentumDirection();
|
||||
|
||||
G4double Ekin=pparticle->GetKineticEnergy();
|
||||
G4double mass=pparticle->GetParticleDefinition()->GetPDGMass();
|
||||
G4double Etot = Ekin/MeV + mass/MeV;
|
||||
G4double Ekin = pparticle->GetKineticEnergy();
|
||||
G4double mass = pparticle->GetParticleDefinition()->GetPDGMass();
|
||||
G4double Etot = Ekin / MeV + mass / MeV;
|
||||
|
||||
G4int nLbin = fDet->GetnLtot();
|
||||
G4int nRbin = fDet->GetnRtot();
|
||||
G4double dLradl = fDet->GetdLradl();
|
||||
G4double dRradl = fDet->GetdRradl();
|
||||
G4int nLbin = fDet->GetnLtot();
|
||||
G4int nRbin = fDet->GetnRtot();
|
||||
G4double dLradl = fDet->GetdLradl();
|
||||
G4double dRradl = fDet->GetdRradl();
|
||||
|
||||
G4double SDRadl = fDet->GetSDRadLen(); // SD matrial
|
||||
// init to to 0.0
|
||||
MyVector dEdL(nLbin,0.0);
|
||||
MyVector dEdR(nRbin,0.0);
|
||||
G4double SDRadl = fDet->GetSDRadLen(); // SD matrial
|
||||
// init to to 0.0
|
||||
MyVector dEdL(nLbin, 0.0);
|
||||
MyVector dEdR(nRbin, 0.0);
|
||||
|
||||
G4AnalysisManager* fAnalysisManager = G4AnalysisManager::Instance();
|
||||
G4AnalysisManager* fAnalysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
fAnalysisManager->FillH1(1,n_hit + 0.5);
|
||||
/// For all Hits in sensitive detector
|
||||
for (int i=0;i<n_hit;i++)
|
||||
{
|
||||
G4double estep = (*THC)[i]->GetEdep();
|
||||
fAnalysisManager->FillH1(2,estep/MeV);
|
||||
estep /= MeV;
|
||||
|
||||
if (estep >0.0)
|
||||
{
|
||||
totE += estep;
|
||||
|
||||
G4ThreeVector hitpos=(*THC)[i]->GetPos();
|
||||
// in shower coordinate system
|
||||
// from shower start
|
||||
G4ThreeVector l = hitpos - vtx;
|
||||
//longitudinal profile
|
||||
G4ThreeVector longitudinal = l.dot(mom) * mom;
|
||||
// shower profiles (Radial)
|
||||
G4ThreeVector radial = l - longitudinal;
|
||||
fAnalysisManager->FillH1(1, n_hit + 0.5);
|
||||
/// For all Hits in sensitive detector
|
||||
for ( int i = 0; i < n_hit; i++ ) {
|
||||
G4double estep = (*THC)[i]->GetEdep();
|
||||
fAnalysisManager->FillH1(2, estep / MeV);
|
||||
estep /= MeV;
|
||||
|
||||
G4int SlideNb = G4int((longitudinal.mag()/SDRadl) / dLradl);
|
||||
G4int RingNb = G4int((radial.mag()/SDRadl) / dRradl);
|
||||
if ( estep > 0.0 ) {
|
||||
totE += estep;
|
||||
|
||||
if ( SlideNb >=0 && SlideNb < nLbin) dEdL[SlideNb] += estep;
|
||||
if ( RingNb >=0 && RingNb < nLbin)dEdR[RingNb] += estep;
|
||||
}
|
||||
}
|
||||
G4ThreeVector hitpos = (*THC)[i]->GetPos();
|
||||
// in shower coordinate system
|
||||
// from shower start
|
||||
G4ThreeVector l = hitpos - vtx;
|
||||
// longitudinal profile
|
||||
G4ThreeVector longitudinal = l.dot(mom) * mom;
|
||||
// shower profiles (Radial)
|
||||
G4ThreeVector radial = l - longitudinal;
|
||||
|
||||
G4double Lnorm = 100. / dLradl / Etot;
|
||||
G4double Lsum = 0.0;
|
||||
for (int i=0;i<nLbin;i++)
|
||||
{ // Slide
|
||||
// fAnalysisManager->FillH1(3,(i +0.5) * dLradl,dEdL[i] * Lnorm);
|
||||
fAnalysisManager->FillP1(0,(i +0.5) * dLradl,dEdL[i] * Lnorm);
|
||||
Lsum += dEdL[i];
|
||||
fAnalysisManager->FillP1(2,(i +0.5) * dLradl,Lsum * Lnorm);
|
||||
}
|
||||
G4double Rnorm = 100. / dRradl / Etot;
|
||||
G4double Rsum = 0.0;
|
||||
for (int i=0;i<nRbin;i++)
|
||||
{ // Ring
|
||||
// fAnalysisManager->FillH1(4,(i +0.5) * dRradl,dEdR[i] * Rnorm);
|
||||
fAnalysisManager->FillP1(1,(i +0.5) * dRradl,dEdR[i] * Rnorm);
|
||||
Rsum += dEdR[i];
|
||||
fAnalysisManager->FillP1(3,(i +0.5) * dRradl,Rsum * Rnorm);
|
||||
}
|
||||
|
||||
fAnalysisManager->FillH1(0,totE/Etot * 100.);
|
||||
G4int SlideNb = G4int((longitudinal.mag() / SDRadl) / dLradl);
|
||||
G4int RingNb = G4int((radial.mag() / SDRadl) / dRradl);
|
||||
|
||||
if ( SlideNb >= 0 && SlideNb < nLbin ) dEdL[SlideNb] += estep;
|
||||
if ( RingNb >= 0 && RingNb < nLbin ) dEdR[RingNb] += estep;
|
||||
}
|
||||
}
|
||||
|
||||
G4double Lnorm = 100. / dLradl / Etot;
|
||||
G4double Lsum = 0.0;
|
||||
for ( int i = 0; i < nLbin; i++ ) { // Slide
|
||||
fAnalysisManager->FillP1(0, (i + 0.5) * dLradl, dEdL[i] * Lnorm);
|
||||
Lsum += dEdL[i];
|
||||
fAnalysisManager->FillP1(2, (i + 0.5) * dLradl, Lsum * Lnorm);
|
||||
}
|
||||
G4double Rnorm = 100. / dRradl / Etot;
|
||||
G4double Rsum = 0.0;
|
||||
for ( int i = 0; i < nRbin; i++ ) { // Ring
|
||||
fAnalysisManager->FillP1(1, (i + 0.5) * dRradl, dEdR[i] * Rnorm);
|
||||
Rsum += dEdR[i];
|
||||
fAnalysisManager->FillP1(3, (i + 0.5) * dRradl, Rsum * Rnorm);
|
||||
}
|
||||
|
||||
fAnalysisManager->FillH1(0, totE / Etot * 100.);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -45,61 +45,54 @@ ExGflashHistoManager::ExGflashHistoManager(ExGflashDetectorConstruction* myDet)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashHistoManager::~ExGflashHistoManager()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
ExGflashHistoManager::~ExGflashHistoManager() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashHistoManager::Book()
|
||||
{
|
||||
// Create or get analysis manager
|
||||
// The choice of analysis technology is done via selection of a namespace
|
||||
// in ExGflashHistoManager.hh
|
||||
G4AnalysisManager* fAnalysisManager = G4AnalysisManager::Instance();
|
||||
fAnalysisManager->SetDefaultFileType("root");
|
||||
fAnalysisManager->SetFileName(fFileName);
|
||||
fAnalysisManager->SetVerboseLevel(1);
|
||||
fAnalysisManager->SetActivation(true); // enable inactivation of histograms
|
||||
fAnalysisManager->SetActivation(true); // enable inactivation of histograms
|
||||
//
|
||||
// Creating histograms
|
||||
//
|
||||
// const G4int kMaxHisto = 9;
|
||||
// const G4int kMaxProf = 2;
|
||||
G4int nLbin = fDet->GetnLtot();
|
||||
G4int nRbin = fDet->GetnRtot();
|
||||
G4int nLbin = fDet->GetnLtot();
|
||||
G4int nRbin = fDet->GetnRtot();
|
||||
G4double dLradl = fDet->GetdLradl();
|
||||
G4double dRradl = fDet->GetdRradl();
|
||||
|
||||
|
||||
fAnalysisManager->CreateH1( "h0","total energy deposit(percent of Einc)",
|
||||
100,95.,105.);
|
||||
fAnalysisManager->CreateH1(
|
||||
"h0", "total energy deposit(percent of Einc)", 100, 95., 105.);
|
||||
|
||||
fAnalysisManager->CreateH1(
|
||||
"h1", "The number of Hits per event", 200, 0., 4.0e5);
|
||||
|
||||
fAnalysisManager->CreateH1("h2", "The energy of Hit (in MeV)", 200, 0., 10.);
|
||||
|
||||
fAnalysisManager->CreateH1( "h1","The number of Hits per event",
|
||||
200,0.,4.0e5);
|
||||
|
||||
fAnalysisManager->CreateH1( "h2","The energy of Hit (in MeV)",
|
||||
200,0.,10.);
|
||||
|
||||
// fAnalysisManager->CreateH1( "h3","longit energy profile (% of E inc)",
|
||||
// nLbin,0.,nLbin*dLradl);
|
||||
|
||||
|
||||
// fAnalysisManager->CreateH1( "h4","radial energy profile (% of E inc)",
|
||||
// nRbin,0.,nRbin*dRradl);
|
||||
|
||||
fAnalysisManager->CreateP1( "p0","longit energy profile (% of E inc)",
|
||||
nLbin,0.,nLbin*dLradl, 0., 2000.);
|
||||
|
||||
fAnalysisManager->CreateP1( "p1","radial energy profile (% of E inc)",
|
||||
nRbin,0.,nRbin*dRradl, 0., 2000.);
|
||||
|
||||
fAnalysisManager->CreateP1( "p2","Comul longit energy profile (% of E inc)",
|
||||
nLbin,0.,nLbin*dLradl, 0., 20000.);
|
||||
|
||||
fAnalysisManager->CreateP1( "p3","Cuml radial energy profile (% of E inc)",
|
||||
nRbin,0.,nRbin*dRradl, 0., 20000.);
|
||||
|
||||
// Create all histograms as inactivated
|
||||
fAnalysisManager->CreateP1("p0", "longit energy profile (% of E inc)", nLbin,
|
||||
0., nLbin * dLradl, 0., 2000.);
|
||||
|
||||
fAnalysisManager->CreateP1("p1", "radial energy profile (% of E inc)", nRbin,
|
||||
0., nRbin * dRradl, 0., 2000.);
|
||||
|
||||
fAnalysisManager->CreateP1("p2", "Comul longit energy profile (% of E inc)",
|
||||
nLbin, 0., nLbin * dLradl, 0., 20000.);
|
||||
|
||||
fAnalysisManager->CreateP1("p3", "Cuml radial energy profile (% of E inc)",
|
||||
nRbin, 0., nRbin * dRradl, 0., 20000.);
|
||||
|
||||
// Create all histograms as inactivated
|
||||
// for (G4int k=0; k<kMaxHisto; k++) {
|
||||
// fAnalysisManager->SetH1Activation(k, false);
|
||||
// }
|
||||
|
||||
@@ -29,56 +29,49 @@
|
||||
|
||||
#include "ExGflashHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<ExGflashHit>* ExGflashHitAllocator=0;
|
||||
G4ThreadLocal G4Allocator<ExGflashHit>* ExGflashHitAllocator = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashHit::ExGflashHit()
|
||||
: G4VHit()
|
||||
{}
|
||||
ExGflashHit::ExGflashHit() : G4VHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashHit::~ExGflashHit()
|
||||
{}
|
||||
ExGflashHit::~ExGflashHit() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashHit::ExGflashHit(const ExGflashHit &right)
|
||||
: G4VHit(right)
|
||||
ExGflashHit::ExGflashHit(const ExGflashHit& right) : G4VHit(right)
|
||||
//@@@ ExGflashHit:Is it right with the init?
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fPos = right.fPos;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const ExGflashHit & ExGflashHit::operator=(const ExGflashHit &right)
|
||||
{
|
||||
G4VHit::operator=(right);
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
return *this;
|
||||
}
|
||||
ExGflashHit& ExGflashHit::operator=(const ExGflashHit& right) = default;
|
||||
// {
|
||||
// G4VHit::operator=(right);
|
||||
// fEdep = right.fEdep;
|
||||
// fPos = right.fPos;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool ExGflashHit::operator==(const ExGflashHit &right) const
|
||||
G4bool ExGflashHit::operator==(const ExGflashHit& right) const
|
||||
{
|
||||
// @@@@ return false;
|
||||
if ((fPos==right.fPos) && (fEdep == right.fEdep)) return true;
|
||||
else return false;
|
||||
|
||||
return ((fEdep == right.fEdep) && (fPos == right.fPos));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -86,12 +79,11 @@ G4bool ExGflashHit::operator==(const ExGflashHit &right) const
|
||||
void ExGflashHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
if ( pVVisManager != nullptr ) {
|
||||
G4Circle circle(fPos);
|
||||
circle.SetScreenSize(0.04);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
G4Colour colour(1., 0., 0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
@@ -100,7 +92,6 @@ void ExGflashHit::Draw()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashHit::Print()
|
||||
{}
|
||||
void ExGflashHit::Print() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -33,55 +33,55 @@
|
||||
#include "ExGflashMessenger.hh"
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWith3Vector.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction * Det)
|
||||
:G4UImessenger(),fDetector(Det)
|
||||
ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction* Det)
|
||||
: G4UImessenger(), fDetector(Det)
|
||||
{
|
||||
fExGflashDir = new G4UIdirectory("/exgflash/");
|
||||
fExGflashDir->SetGuidance(" Gflash example commands.");
|
||||
|
||||
fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose",this);
|
||||
|
||||
fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose", this);
|
||||
fVerbose->SetGuidance("set exglash verbosity");
|
||||
fVerbose->SetGuidance("0- silent, 1 - on exit, 2 - run , 3 - event");
|
||||
fVerbose->SetParameterName("ver",false);
|
||||
fVerbose->SetParameterName("ver", false);
|
||||
fVerbose->SetRange("ver >= 0");
|
||||
fVerbose->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fVerbose->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fVerbose->SetToBeBroadcasted(false);
|
||||
|
||||
|
||||
fDetDir = new G4UIdirectory("/exgflash/det/");
|
||||
fDetDir->SetGuidance("detector construction commands");
|
||||
|
||||
fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat",this);
|
||||
fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat", this);
|
||||
fMaterCmd->SetGuidance("Select Material.");
|
||||
fMaterCmd->SetParameterName("material",false);
|
||||
fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterCmd->SetParameterName("material", false);
|
||||
fMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fMaterCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin",this);
|
||||
fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin", this);
|
||||
fLBinCmd->SetGuidance("set longitudinal bining");
|
||||
fLBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
|
||||
// must have omitable==true we use 2 values only
|
||||
fLBinCmd->SetParameterName("nLtot","dLradl"," ",true);
|
||||
fLBinCmd->SetParameterName("nLtot", "dLradl", " ", true);
|
||||
fLBinCmd->SetRange("nLtot>=1 && dLradl>0");
|
||||
fLBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fLBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fLBinCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin",this);
|
||||
fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin", this);
|
||||
fRBinCmd->SetGuidance("set radial bining");
|
||||
fRBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
|
||||
fRBinCmd->SetParameterName("nRtot","dRradl"," ",true);
|
||||
fRBinCmd->SetParameterName("nRtot", "dRradl", " ", true);
|
||||
fRBinCmd->SetRange("nRtot>=1 && dRradl>0");
|
||||
fRBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fRBinCmd->SetToBeBroadcasted(false);
|
||||
}
|
||||
fRBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fRBinCmd->SetToBeBroadcasted(false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -98,18 +98,22 @@ ExGflashMessenger::~ExGflashMessenger()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if( command == fMaterCmd )
|
||||
{ fDetector->SetMaterial(newValue);}
|
||||
|
||||
if( command == fVerbose )
|
||||
{ fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == fLBinCmd )
|
||||
{ fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));}
|
||||
|
||||
if( command == fRBinCmd )
|
||||
{ fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));}
|
||||
{
|
||||
if ( command == fMaterCmd ) {
|
||||
fDetector->SetMaterial(newValue);
|
||||
}
|
||||
|
||||
if ( command == fVerbose ) {
|
||||
fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
if ( command == fLBinCmd ) {
|
||||
fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));
|
||||
}
|
||||
|
||||
if ( command == fRBinCmd ) {
|
||||
fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+4
-4
@@ -28,15 +28,15 @@
|
||||
//
|
||||
#include "ExGflashPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashPrimaryGeneratorAction::ExGflashPrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(nullptr)
|
||||
{
|
||||
fParticleGun=new G4GeneralParticleSource;
|
||||
fParticleGun = new G4GeneralParticleSource;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -49,7 +49,7 @@ ExGflashPrimaryGeneratorAction::~ExGflashPrimaryGeneratorAction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashRunAction::ExGflashRunAction(ExGflashDetectorConstruction* det)
|
||||
// : G4UserRunAction(), fRunID(0), fDetector(det)
|
||||
: G4UserRunAction(), fDetector(det)
|
||||
{
|
||||
fHistoManager = new ExGflashHistoManager(fDetector);
|
||||
@@ -49,42 +48,46 @@ ExGflashRunAction::~ExGflashRunAction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
//histograms file
|
||||
// histograms file
|
||||
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
|
||||
if (analysis->IsActive()) analysis->OpenFile();
|
||||
|
||||
if (IsMaster()) fRunTimer.Start();
|
||||
if ( analysis->IsActive() ) {
|
||||
analysis->OpenFile();
|
||||
}
|
||||
|
||||
if ( IsMaster() ) {
|
||||
fRunTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashRunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
if (IsMaster()) {
|
||||
if ( IsMaster() ) {
|
||||
// For MT we need Timer Merge
|
||||
fRunTimer.Stop();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
G4cout << G4endl;
|
||||
G4cout << "Run Real Elapsed Time is: "<< fRunTimer.GetRealElapsed();
|
||||
G4cout << "Run Real Elapsed Time is: " << fRunTimer.GetRealElapsed();
|
||||
G4cout << G4endl;
|
||||
G4cout << "Run System Elapsed Time: " << fRunTimer.GetSystemElapsed();
|
||||
G4cout << G4endl;
|
||||
G4cout << "Run GetUserElapsed Time: " << fRunTimer.GetUserElapsed();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************"<< G4endl;
|
||||
|
||||
G4cout << "******************************************" << G4endl;
|
||||
|
||||
G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
|
||||
}
|
||||
//save histograms
|
||||
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
|
||||
if (analysis->IsActive()) {
|
||||
analysis->Write();
|
||||
// save histograms
|
||||
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
|
||||
if ( analysis->IsActive() ) {
|
||||
analysis->Write();
|
||||
analysis->CloseFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+36
-33
@@ -28,78 +28,81 @@
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
#include "ExGflashSensitiveDetector.hh"
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
#include "ExGflashHit.hh"
|
||||
#include "G4GFlashSpot.hh"
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
//WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
|
||||
// WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name,
|
||||
ExGflashDetectorConstruction* /* det */)
|
||||
// : G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1)
|
||||
: G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fHCID(-1)
|
||||
ExGflashSensitiveDetector::ExGflashSensitiveDetector(
|
||||
G4String name, ExGflashDetectorConstruction* /* det */)
|
||||
: G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fHCID(-1)
|
||||
{
|
||||
G4String caloname="ExGflashCollection";
|
||||
G4String caloname = "ExGflashCollection";
|
||||
collectionName.insert(caloname);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExGflashSensitiveDetector::~ExGflashSensitiveDetector()
|
||||
{}
|
||||
ExGflashSensitiveDetector::~ExGflashSensitiveDetector() = default;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashSensitiveDetector::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
if(fHCID<0){ fHCID = GetCollectionID(0); }
|
||||
fCaloHitsCollection=new
|
||||
ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection
|
||||
HCE->AddHitsCollection( fHCID, fCaloHitsCollection );
|
||||
if ( fHCID < 0 ) {
|
||||
fHCID = GetCollectionID(0);
|
||||
}
|
||||
fCaloHitsCollection = new ExGflashHitsCollection(
|
||||
SensitiveDetectorName, collectionName[0]); // first collection
|
||||
HCE->AddHitsCollection(fHCID, fCaloHitsCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*)
|
||||
{}
|
||||
void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool ExGflashSensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* /* ROhist */)
|
||||
G4bool ExGflashSensitiveDetector::ProcessHits(
|
||||
G4Step* aStep, G4TouchableHistory* /* ROhist */)
|
||||
{
|
||||
G4double e=aStep->GetTotalEnergyDeposit();
|
||||
if(e<=0.)return false;
|
||||
|
||||
ExGflashHit* caloHit=new ExGflashHit();
|
||||
G4double e = aStep->GetTotalEnergyDeposit();
|
||||
if ( e <= 0. ) return false;
|
||||
|
||||
auto caloHit = new ExGflashHit();
|
||||
caloHit->SetEdep(e);
|
||||
caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
|
||||
fCaloHitsCollection->insert(caloHit);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Separate GFLASH interface
|
||||
G4bool ExGflashSensitiveDetector::ProcessHits(G4GFlashSpot*aSpot ,G4TouchableHistory* /* ROhist */)
|
||||
{ //cout<<"This is ProcessHits GFLASH"<<endl;
|
||||
G4double e=aSpot->GetEnergySpot()->GetEnergy();
|
||||
if(e<=0.)return false;
|
||||
|
||||
// G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
|
||||
|
||||
ExGflashHit* caloHit=new ExGflashHit();
|
||||
G4bool ExGflashSensitiveDetector::ProcessHits(
|
||||
G4GFlashSpot* aSpot, G4TouchableHistory* /* ROhist */)
|
||||
{
|
||||
// cout<<"This is ProcessHits GFLASH"<<endl;
|
||||
G4double e = aSpot->GetEnergySpot()->GetEnergy();
|
||||
if ( e <= 0. ) return false;
|
||||
|
||||
// G4VPhysicalVolume* pCurrentVolume =
|
||||
// aSpot->GetTouchableHandle()->GetVolume();
|
||||
|
||||
auto caloHit = new ExGflashHit();
|
||||
caloHit->SetEdep(e);
|
||||
caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
|
||||
fCaloHitsCollection->insert(caloHit);
|
||||
// if (ROhist){;}
|
||||
|
||||
// if (ROhist){;}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user