Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
/// \file exoticphysics/monopole/src/G4MonopolePhysics.cc
|
||||
/// \brief Implementation of the G4MonopolePhysics class
|
||||
//
|
||||
// $Id: G4MonopolePhysics.cc 104872 2017-06-23 14:19:16Z gcosmo $
|
||||
// $Id: G4MonopolePhysics.cc 107526 2017-11-21 07:17:43Z gcosmo $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -36,7 +36,8 @@
|
||||
//
|
||||
// Modified:
|
||||
//
|
||||
// 12.07.10 S.Burdin (changed the magnetic and electric charge variables from integer to double)
|
||||
// 12.07.10 S.Burdin (changed the magnetic and electric charge variables
|
||||
// from integer to double)
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
@@ -68,8 +69,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4MonopolePhysics::G4MonopolePhysics(const G4String& nam)
|
||||
: G4VPhysicsConstructor(nam),
|
||||
fMessenger(0), fMpl(0)
|
||||
: G4VPhysicsConstructor(nam), fMpl(nullptr)
|
||||
{
|
||||
fMagCharge = 1.0;
|
||||
// fMagCharge = -1.0;
|
||||
@@ -77,6 +77,7 @@ G4MonopolePhysics::G4MonopolePhysics(const G4String& nam)
|
||||
fElCharge = 0.0;
|
||||
fMonopoleMass = 100.*GeV;
|
||||
SetPhysicsType(bUnknown);
|
||||
fMessenger = new G4MonopolePhysicsMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -100,8 +101,6 @@ void G4MonopolePhysics::ConstructProcess()
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << "G4MonopolePhysics::ConstructProcess" << G4endl;
|
||||
}
|
||||
|
||||
fMessenger = new G4MonopolePhysicsMessenger(this);
|
||||
|
||||
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
|
||||
G4ProcessManager* pmanager = fMpl->GetProcessManager();
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
/// \file exoticphysics/monopole/src/G4MonopolePhysicsMessenger.cc
|
||||
/// \brief Implementation of the G4MonopolePhysicsMessenger class
|
||||
//
|
||||
// $Id: G4MonopolePhysicsMessenger.cc 68036 2013-03-13 14:13:45Z gcosmo $
|
||||
// $Id: G4MonopolePhysicsMessenger.cc 107526 2017-11-21 07:17:43Z gcosmo $
|
||||
//
|
||||
// 12.07.10 S.Burdin (changed the magnetic and electric charge variables from integer to double)
|
||||
// 12.07.10 S.Burdin (changed the magnetic and electric charge variables
|
||||
// from integer to double)
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -46,13 +47,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4MonopolePhysicsMessenger::G4MonopolePhysicsMessenger(G4MonopolePhysics* p)
|
||||
: G4UImessenger(),
|
||||
fPhys(p),
|
||||
fPhysicsDir(0),
|
||||
fPhysicsCmd(0),
|
||||
fMCmd(0),
|
||||
fZCmd(0),
|
||||
fMassCmd(0)
|
||||
: G4UImessenger(), fPhys(p)
|
||||
{
|
||||
fPhysicsDir = new G4UIdirectory("/monopole/");
|
||||
fPhysicsDir->SetGuidance("histograms control");
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file exoticphysics/monopole/src/G4MonopoleTransportation.cc
|
||||
/// \brief Implementation of the G4MonopoleTransportation class
|
||||
//
|
||||
// $Id: G4MonopoleTransportation.cc 104872 2017-06-23 14:19:16Z gcosmo $
|
||||
// $Id: G4MonopoleTransportation.cc 106979 2017-10-31 09:01:20Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -294,8 +294,7 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
particleMagneticCharge ); // in Mev/c
|
||||
|
||||
G4EquationOfMotion* equationOfMotion =
|
||||
(fFieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetStepper())
|
||||
->GetEquationOfMotion();
|
||||
fFieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetEquationOfMotion();
|
||||
|
||||
equationOfMotion
|
||||
->SetChargeMomentumMass( chargeState, // Was particleMagneticCharge - in Mev/c
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: HistoManager.cc 104174 2017-05-15 12:12:45Z selles $
|
||||
// GEANT4 tag $Name: geant4-09-04-cand-00 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager(DetectorConstruction* det, G4double binLength)
|
||||
: fDetector(det), fBinLength(binLength)
|
||||
|
||||
{
|
||||
fVerbose = true;
|
||||
|
||||
fHistoId.resize(MaxHisto);
|
||||
fExist.resize(MaxHisto);
|
||||
fActive.resize(MaxHisto);
|
||||
fLabel.resize(MaxHisto);
|
||||
fTitle.resize(MaxHisto);
|
||||
fNbins.resize(MaxHisto);
|
||||
fVmin.resize(MaxHisto);
|
||||
fVmax.resize(MaxHisto);
|
||||
fUnit1.resize(MaxHisto);
|
||||
fUnit2.resize(MaxHisto);
|
||||
fWidth.resize(MaxHisto);
|
||||
fIds.resize(MaxHisto);
|
||||
|
||||
// histograms
|
||||
fNbHisto = 0;
|
||||
for (G4int k=0; k<MaxHisto; k++) {
|
||||
fHistoId[k] = 0;
|
||||
fExist[k] = false;
|
||||
fActive[k] = false;
|
||||
fUnit1[k] = 1.0;
|
||||
fUnit2[k] = 1.0;
|
||||
fWidth[k] = 1.0;
|
||||
}
|
||||
|
||||
fNtupleActive = false;
|
||||
fTupleName = "tuple";
|
||||
fTupleTitle = "test";
|
||||
|
||||
fTupleI.assign(MaxHisto,-1);
|
||||
fTupleF.assign(MaxHisto,-1);
|
||||
fTupleD.assign(MaxHisto,-1);
|
||||
|
||||
Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Book()
|
||||
{
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Create or get analysis manager
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetActivation(false); // enable inactivation of histograms
|
||||
|
||||
// Define the histogramms
|
||||
if(analysisManager->GetNofH1s()==0)
|
||||
{
|
||||
G4double length = fDetector->GetAbsorSizeX();
|
||||
G4int nbBins = G4lrint(length / fBinLength);
|
||||
|
||||
// Create histograms
|
||||
fNbHisto = 0;
|
||||
Add1D(0,"dummy", nbBins, 0, length, "mm");
|
||||
Add1D(1,"Edep (MeV/mm) along absorber (mm)", nbBins, 0, length, "mm");
|
||||
Add1D(2,"DEDX (MeV/mm) of proton", 100, -3., 7.);
|
||||
Add1D(3,"DEDX (MeV/mm) of monopole", 100, -3., 7.);
|
||||
Add1D(4,"Range(mm) of proton", 100, -3., 7., "mm");
|
||||
Add1D(5,"Range(mm) of monopole", 100, -3., 7., "mm");
|
||||
|
||||
// Creating an 1-dimensional histograms in the root directory of the tree
|
||||
for(G4int i=0; i<fNbHisto; i++)
|
||||
{
|
||||
fHistoId[i] = analysisManager->CreateH1(fIds[i], fTitle[i],
|
||||
fNbins[i], fVmin[i], fVmax[i]);
|
||||
analysisManager->SetH1Activation(fHistoId[i],fActive[i]);
|
||||
}
|
||||
|
||||
// Creating a tuple factory, whose tuples will be handled by the tree
|
||||
if(fNtupleActive) {
|
||||
analysisManager->CreateNtuple(fTupleName,fTupleTitle);
|
||||
G4int i;
|
||||
G4int n = fNtupleI.size();
|
||||
for(i=0; i<n; ++i) {
|
||||
if(fTupleI[i] == -1)
|
||||
{ fTupleI[i] = analysisManager->CreateNtupleIColumn(fNtupleI[i]); }
|
||||
}
|
||||
n = fNtupleF.size();
|
||||
for(i=0; i<n; ++i) {
|
||||
if(fTupleF[i] == -1)
|
||||
{ fTupleF[i] = analysisManager->CreateNtupleFColumn(fNtupleF[i]); }
|
||||
}
|
||||
n = fNtupleD.size();
|
||||
for(i=0; i<n; ++i) {
|
||||
if(fTupleD[i] == -1)
|
||||
{ fTupleD[i] = analysisManager->CreateNtupleDColumn(fNtupleD[i]); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Added to catch the SetActivation parameters set througj UI interface
|
||||
for (G4int k=0; k<MaxHisto; k++)
|
||||
fExist[k] = analysisManager->GetH1Activation(fHistoId[k]);
|
||||
|
||||
// Check if a filename is set
|
||||
if(analysisManager->GetFileName()=="") return;
|
||||
|
||||
// Activate the analysisManage ronly if a filename is set
|
||||
analysisManager->SetActivation(true); // enable inactivation of histograms
|
||||
|
||||
}
|
||||
|
||||
void HistoManager::SetBinLength(G4double binLength)
|
||||
{
|
||||
fBinLength = binLength;
|
||||
|
||||
G4double length = fDetector->GetAbsorSizeX();
|
||||
G4int nbBins = G4lrint(length / fBinLength);
|
||||
SetHisto1D(1, nbBins, 0., length, "mm");
|
||||
}
|
||||
|
||||
|
||||
void HistoManager::Update(G4double binLength)
|
||||
{
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
G4double histo1_binLength = analysisManager->GetH1Width(fHistoId[1]);
|
||||
if(fabs(histo1_binLength-binLength)>0.01)
|
||||
{
|
||||
G4double length = fDetector->GetAbsorSizeX();
|
||||
G4int nbBins = G4lrint(length / binLength);
|
||||
analysisManager->SetH1(fHistoId[1], nbBins,
|
||||
G4AnalysisManager::Instance()->GetH1Xmin(fHistoId[1]),
|
||||
G4AnalysisManager::Instance()->GetH1Xmax(fHistoId[1]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Add1D(G4int histoId, const G4String& name, G4int nb,
|
||||
G4double x1, G4double x2,
|
||||
const G4String& u1, const G4String& u2)
|
||||
{
|
||||
std::stringstream sg;
|
||||
sg<<histoId;
|
||||
const G4String id = sg.str();
|
||||
|
||||
if(fVerbose) {
|
||||
G4cout << "New histogram will be booked: #" << id << " <" << name
|
||||
<< " " << nb << " " << x1 << " " << x2 << " " << u1<<" "<<u2
|
||||
<< G4endl;
|
||||
}
|
||||
fNbHisto++;
|
||||
|
||||
double vUnit1= (u1=="none")? 1. : (G4UnitDefinition::GetValueOf(u1));
|
||||
fUnit1[histoId]=vUnit1;
|
||||
double vUnit2= (u2=="none")? 1. : (G4UnitDefinition::GetValueOf(u2));
|
||||
fUnit2[histoId]=vUnit2;
|
||||
|
||||
x1 /= vUnit1;
|
||||
x2 /= vUnit1;
|
||||
fNbins[histoId]=nb;
|
||||
fVmin[histoId]=x1;
|
||||
fVmax[histoId]=x2;
|
||||
fWidth[histoId] = (x2-x1)/nb;
|
||||
fTitle[histoId]=name;
|
||||
fIds[histoId]=id;
|
||||
G4int exist = (name.substr(0,5)=="dummy"||name.substr(0,5)=="Dummy")?false:true;
|
||||
fExist[histoId]=exist;
|
||||
fActive[histoId]=exist;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::SetHisto1D(G4int ih,
|
||||
G4int nbins, G4double valmin, G4double valmax,
|
||||
const G4String& unit)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
|
||||
<< "does not exist" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// const G4String id[] = { "0", "1", "2", "3", "4", "5", "6" };
|
||||
// const G4String title[] =
|
||||
// { "dummy", //0
|
||||
// "continuous energy loss along primary track", //1
|
||||
// "energy from secondaries", //2
|
||||
// "total energy lost by primary track", //3
|
||||
// "energy spectrum of e-+", //4
|
||||
// "energy spectrum of gamma", //5
|
||||
// "step size" //6
|
||||
// };
|
||||
|
||||
// G4String titl = fTitle[ih];
|
||||
G4double vmin = valmin, vmax = valmax;
|
||||
|
||||
if (unit != "none") {
|
||||
fUnit1[ih] = G4UnitDefinition::GetValueOf(unit);
|
||||
}
|
||||
vmin = valmin/fUnit1[ih];
|
||||
vmax = valmax/fUnit1[ih];
|
||||
|
||||
fExist[ih] = true;
|
||||
fNbins[ih] = nbins;
|
||||
fVmin[ih] = vmin;
|
||||
fVmax[ih] = vmax;
|
||||
fWidth[ih] = (valmax-valmin)/nbins;
|
||||
|
||||
if(fTitle[ih].substr(0,5)=="dummy") fExist[ih]=false;
|
||||
if(fTitle[ih].substr(0,5)=="Dummy") fExist[ih]=false;
|
||||
fActive[ih]=fExist[ih];
|
||||
|
||||
G4cout << "----> SetHisto " << ih << ": " << fTitle[ih] << "; "
|
||||
<< nbins << " bins from "
|
||||
<< vmin << " " << unit << " to " << vmax << " " << fUnit1[ih] << " - "
|
||||
<<fExist[ih]<<G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::FillHisto(G4int ih, G4double e, G4double weight)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::FillHisto() : histo " << ih
|
||||
<< "does not exist; e= " << e << " w= " << weight << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!fExist[ih]) return;
|
||||
G4AnalysisManager::Instance()->FillH1( fHistoId[ih], e/fUnit1[ih], weight);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Scale(G4int ih, G4double fac)
|
||||
{
|
||||
if (ih > MaxHisto) {
|
||||
G4cout << "---> warning from HistoManager::Scale() : histo " << ih
|
||||
<< "does not exist. (fac = " << fac << ")" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!fExist[ih]) return;
|
||||
G4AnalysisManager::Instance()->GetH1(fHistoId[ih])->scale(fac);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -33,21 +33,16 @@
|
||||
|
||||
#include "Run.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4EmCalculator.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Run::Run(DetectorConstruction* det, PrimaryGeneratorAction* prim,
|
||||
HistoManager* histoMgr)
|
||||
:fDetector(det), fPrimary(prim), fHistoManager(histoMgr)
|
||||
Run::Run(DetectorConstruction* det, PrimaryGeneratorAction* prim)
|
||||
:fDetector(det), fPrimary(prim)
|
||||
{
|
||||
fAnalysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
@@ -57,18 +52,13 @@ Run::Run(DetectorConstruction* det, PrimaryGeneratorAction* prim,
|
||||
fVerboseLevel = 1;
|
||||
fNevt = 0;
|
||||
fProjRange = fProjRange2 = 0.;
|
||||
|
||||
fHistoManager->Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Run::~Run()
|
||||
{
|
||||
{}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Run::Merge(const G4Run* run)
|
||||
@@ -110,7 +100,7 @@ void Run::EndOfRun(double binLength)
|
||||
<< G4BestUnit(fDetector->GetAbsorSizeX(),"Length") << " of "
|
||||
<< matName << " (density: "
|
||||
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
G4cout<<"Proj "<<fProjRange<<" "<<fProjRange2<<G4endl;
|
||||
//G4cout<<"Proj "<<fProjRange<<" "<<fProjRange2<<G4endl;
|
||||
};
|
||||
|
||||
//compute projected range and straggling
|
||||
@@ -122,14 +112,14 @@ void Run::EndOfRun(double binLength)
|
||||
|
||||
if(GetVerbose() > 0){
|
||||
G4cout.precision(5);
|
||||
G4cout << "\n projected Range= " << G4BestUnit(fProjRange, "Length")
|
||||
G4cout << " Projected Range= " << G4BestUnit(fProjRange, "Length")
|
||||
<< " rms= " << G4BestUnit(rms, "Length")
|
||||
<< G4endl;
|
||||
<< "\n" << G4endl;
|
||||
};
|
||||
|
||||
G4double ekin[100], dedxproton[100], dedxmp[100];
|
||||
G4EmCalculator calc;
|
||||
calc.SetVerbose(2);
|
||||
//calc.SetVerbose(2);
|
||||
G4int i;
|
||||
for(i = 0; i < 100; ++i) {
|
||||
ekin[i] = std::pow(10., 0.1*G4double(i)) * keV;
|
||||
@@ -141,9 +131,9 @@ void Run::EndOfRun(double binLength)
|
||||
|
||||
if(GetVerbose() > 0){
|
||||
G4cout << "### Stopping Powers" << G4endl;
|
||||
for(i=0; i<100; i++) {
|
||||
G4cout << " E(MeV)= " << ekin[i] << " dedxp= " << dedxproton[i]
|
||||
<< " dedxmp= " << dedxmp[i]
|
||||
for(i=0; i<100; ++i) {
|
||||
G4cout << " E(MeV)= " << ekin[i] << " dedxp(MeV/mm)= " << dedxproton[i]
|
||||
<< " dedxmp(MeV/mm)= " << dedxmp[i]
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +141,7 @@ void Run::EndOfRun(double binLength)
|
||||
|
||||
// normalize histogram
|
||||
G4double fac = (mm/MeV) / (nEvents * binLength);
|
||||
fHistoManager->Scale(1,fac);
|
||||
fAnalysisManager->ScaleH1(1,fac);
|
||||
|
||||
if(GetVerbose() > 0){
|
||||
G4cout << "Range table for " << matName << G4endl;
|
||||
@@ -159,35 +149,13 @@ void Run::EndOfRun(double binLength)
|
||||
|
||||
for(i=0; i<100; ++i) {
|
||||
G4double e = std::log10(ekin[i] / MeV) + 0.05;
|
||||
fHistoManager->FillHisto(2, e, dedxproton[i]);
|
||||
fHistoManager->FillHisto(3, e, dedxmp[i]);
|
||||
fHistoManager->FillHisto(4, e,
|
||||
fAnalysisManager->FillH1(2, e, dedxproton[i]);
|
||||
fAnalysisManager->FillH1(3, e, dedxmp[i]);
|
||||
fAnalysisManager->FillH1(4, e,
|
||||
std::log10(calc.GetRange(ekin[i],"proton",matName)/mm));
|
||||
fHistoManager->FillHisto(5, e,
|
||||
fAnalysisManager->FillH1(5, e,
|
||||
std::log10(calc.GetRange(ekin[i],"monopole",matName)/mm));
|
||||
}
|
||||
|
||||
|
||||
if(fAnalysisManager) {
|
||||
|
||||
if(fAnalysisManager->IsActive()) {
|
||||
|
||||
// Write histogram file
|
||||
if(!fAnalysisManager->Write()) {
|
||||
G4Exception ("Histo::Save()", "hist01", FatalException,
|
||||
"Cannot write ROOT file.");
|
||||
}
|
||||
G4cout << "### Histo::Save: Histograms are saved" << G4endl;
|
||||
if(fAnalysisManager->CloseFile() && fVerboseLevel) {
|
||||
G4cout << " File is closed" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
delete fAnalysisManager;
|
||||
fAnalysisManager = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -195,8 +163,7 @@ void Run::EndOfRun(double binLength)
|
||||
|
||||
void Run::FillHisto(G4int histoId, G4double v1, G4double v2)
|
||||
{
|
||||
if(fAnalysisManager)
|
||||
fHistoManager->FillHisto(histoId, v1, v2);
|
||||
fAnalysisManager->FillH1(histoId, v1, v2);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file exoticphysics/monopole/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
// $Id: RunAction.cc 104872 2017-06-23 14:19:16Z gcosmo $
|
||||
// $Id: RunAction.cc 107534 2017-11-21 13:13:36Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "RunActionMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
@@ -51,11 +50,11 @@ RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin)
|
||||
:fDetector(det),fKinematic(kin)
|
||||
{
|
||||
fMessenger = new RunActionMessenger(this);
|
||||
|
||||
fBinLength = 5 * CLHEP::mm;
|
||||
|
||||
// Book predefined histograms
|
||||
fHistoManager = new HistoManager(det, fBinLength);
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetFileName("monopole");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetActivation(true);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -66,14 +65,13 @@ RunAction::~RunAction()
|
||||
if(isMaster) delete fKinematic;
|
||||
#endif
|
||||
delete fMessenger;
|
||||
delete fHistoManager;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Run* RunAction::GenerateRun()
|
||||
{
|
||||
fRun = new Run(fDetector,fKinematic,fHistoManager);
|
||||
fRun = new Run(fDetector,fKinematic);
|
||||
return fRun;
|
||||
}
|
||||
|
||||
@@ -82,23 +80,14 @@ G4Run* RunAction::GenerateRun()
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
// save Rndm status
|
||||
//
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
//histograms
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->IsActive() ) {
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
void RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
// print Run summary
|
||||
//
|
||||
@@ -110,22 +99,36 @@ void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
|
||||
// show Rndm status
|
||||
if (isMaster) G4Random::showEngineStatus();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::SetBinSize(G4double size)
|
||||
{
|
||||
fBinLength = size;
|
||||
|
||||
fBinLength = size;
|
||||
if(fBinLength > fDetector->GetMaxStepSize()) {
|
||||
fBinLength = fDetector->GetMaxStepSize();
|
||||
}
|
||||
|
||||
// fHistoManager->SetBinLength(fBinLength);
|
||||
fHistoManager->Update(fBinLength);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::Book()
|
||||
{
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetFirstHistoId(1);
|
||||
|
||||
G4double length = fDetector->GetAbsorSizeX();
|
||||
G4int nbBins = G4lrint(length / fBinLength);
|
||||
|
||||
// Create histograms
|
||||
analysisManager->CreateH1("h1","Edep (MeV/mm) along absorber (mm)",
|
||||
nbBins, 0, length);
|
||||
analysisManager->CreateH1("h2","DEDX (MeV/mm) of proton", 100, -3., 7.);
|
||||
analysisManager->CreateH1("h3","DEDX (MeV/mm) of monopole", 100, -3., 7.);
|
||||
analysisManager->CreateH1("h4","Range(mm) of proton", 100, -3., 7., "mm");
|
||||
analysisManager->CreateH1("h5","Range(mm) of monopole", 100, -3., 7., "mm");
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user