Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRActionInitialization.hh
|
||||
// Action initialization class
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRActionInitialization_h
|
||||
#define GRActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
#include "GRAnalysis.hh"
|
||||
#include "G4TScoreHistFiller.hh"
|
||||
#include "G4Types.hh"
|
||||
|
||||
class G4GenericMessenger;
|
||||
|
||||
class GRActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
GRActionInitialization();
|
||||
virtual ~GRActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
|
||||
private:
|
||||
G4GenericMessenger* generatorMsg;
|
||||
G4bool useParticleGun = false;
|
||||
G4bool useParticleSource = true;
|
||||
G4TScoreHistFiller<G4AnalysisManager>* filler;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRAnalysis.hh
|
||||
// Defining the file format of output histogram/n-tuple
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRAnalysis_h
|
||||
#define GRAnalysis_h 1
|
||||
|
||||
//#include "g4root.hh"
|
||||
#include "g4csv.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRBiasingRegionInfo.hh
|
||||
// Header file of Region Information class to hold parameters of
|
||||
// geometry importance biasing.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRBiasingRegionInfo_h
|
||||
#define GRBiasingRegionInfo_h 1
|
||||
|
||||
#include "G4VUserRegionInformation.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GRBiasingRegionInfo : public G4VUserRegionInformation
|
||||
{
|
||||
public:
|
||||
GRBiasingRegionInfo()
|
||||
{;}
|
||||
virtual ~GRBiasingRegionInfo()
|
||||
{;}
|
||||
|
||||
public:
|
||||
virtual void Print() const
|
||||
{
|
||||
G4cout << "GRBiasingRegionInfo : biasing factor " << factor
|
||||
<< " bias probability : " << probability << G4endl;
|
||||
}
|
||||
|
||||
public:
|
||||
void SetBiasingFactor(G4int val)
|
||||
{
|
||||
if(val>0)
|
||||
{
|
||||
factor = val;
|
||||
if(val>4)
|
||||
{
|
||||
G4Exception("G4GRBiasingRegionInfo::SetBiasingFactor","Gorad0005",JustWarning,
|
||||
"Biasing factor maybe too large. Results should be carefully checked.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{ G4Exception("G4GRBiasingRegionInfo::SetBiasingFactor","Gorad0005",JustWarning,"Invalid value"); }
|
||||
}
|
||||
inline G4int GetBiasingFactor() const
|
||||
{ return factor; }
|
||||
void SetProbability(G4double val)
|
||||
{
|
||||
if(val>=0.&&val<=1.)
|
||||
{ probability = val; }
|
||||
else
|
||||
{ G4Exception("G4GRBiasingRegionInfo::SetProbability","Gorad0006",JustWarning,"Invalid value"); }
|
||||
}
|
||||
inline G4double GetProbability() const
|
||||
{ return probability; }
|
||||
|
||||
private:
|
||||
G4int factor = 2;
|
||||
G4double probability = 1.;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRDetectorConstruction.hh
|
||||
// Header file of the detector construction. It reads a GDML file.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRDetectorConstruction_H
|
||||
#define GRDetectorConstruction_H 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4GDMLParser;
|
||||
class GRDetectorConstructionMessenger;
|
||||
class GRGeomImpBiasWorld;
|
||||
|
||||
class GRDetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
friend class GRGeomImpBiasWorld;
|
||||
|
||||
public:
|
||||
GRDetectorConstruction();
|
||||
virtual ~GRDetectorConstruction();
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
virtual void ConstructSDAndField();
|
||||
|
||||
private:
|
||||
GRDetectorConstructionMessenger* messenger;
|
||||
G4GDMLParser* parser;
|
||||
G4String gdmlFile;
|
||||
G4VPhysicalVolume* fWorld;
|
||||
G4bool initialized;
|
||||
|
||||
static G4double worldSize;
|
||||
|
||||
public:
|
||||
G4bool SetGDMLFile(G4String&);
|
||||
const G4String& GetGDMLFile()
|
||||
{ return gdmlFile; }
|
||||
|
||||
static G4double GetWorldSize()
|
||||
{ return worldSize; }
|
||||
|
||||
private:
|
||||
void Read();
|
||||
|
||||
public:
|
||||
void ListSolids(G4int);
|
||||
void ListLogVols(G4int);
|
||||
void ListPhysVols(G4int);
|
||||
void ListRegions(G4int);
|
||||
G4bool CreateRegion(G4String&,G4String&);
|
||||
G4bool CheckOverlap(G4String&,G4int,G4int,G4double);
|
||||
|
||||
public:
|
||||
void ListAllMaterial();
|
||||
G4bool ListMaterial(G4String&);
|
||||
void DumpNistMaterials();
|
||||
G4bool CreateMaterial(G4String&);
|
||||
G4bool GetMaterial(G4String&);
|
||||
G4int SetMaterial(G4String&,G4String&);
|
||||
|
||||
private:
|
||||
G4bool applyGeomImpBias = false;
|
||||
GRGeomImpBiasWorld* geomImpBiasWorld = nullptr;
|
||||
struct GeomImpParameters
|
||||
{
|
||||
G4double radius = -1.;
|
||||
G4ThreeVector pos0;
|
||||
G4int nLayer = 0;
|
||||
G4double radiusT = -1.;
|
||||
G4ThreeVector posT;
|
||||
G4int factor = 2;
|
||||
G4double prob = 1.;
|
||||
} geoImpP;
|
||||
|
||||
public:
|
||||
void GeomImp(G4int n,G4double r)
|
||||
{
|
||||
applyGeomImpBias = true;
|
||||
geoImpP.nLayer = n;
|
||||
geoImpP.radius = r;
|
||||
}
|
||||
G4bool ApplyGeomImpBias() const
|
||||
{ return applyGeomImpBias; }
|
||||
void GeomImpLocate(G4ThreeVector p0)
|
||||
{ geoImpP.pos0 = p0; }
|
||||
G4double GeomImpInnerRadius(G4double rt)
|
||||
{
|
||||
if(rt>geoImpP.radius)
|
||||
{ return -rt; }
|
||||
geoImpP.radiusT = rt;
|
||||
return rt;
|
||||
}
|
||||
G4double GeomImpLocateTgt(G4ThreeVector pT)
|
||||
{
|
||||
G4ThreeVector dp = geoImpP.pos0 - pT;
|
||||
G4double rt = geoImpP.radiusT;
|
||||
if(rt<0.)
|
||||
{ rt = geoImpP.radius / geoImpP.nLayer; }
|
||||
if(dp.mag() >= (geoImpP.radius - rt))
|
||||
{ return (geoImpP.radius - rt); }
|
||||
geoImpP.posT = pT;
|
||||
return 0.;
|
||||
}
|
||||
void GeomImpFactor(G4int f)
|
||||
{ geoImpP.factor = f; }
|
||||
void GeomImpProb(G4double p)
|
||||
{ geoImpP.prob = p; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRDetectorConstructionMessenger.hh
|
||||
// Headter file of a messenger class that handles geometry configuration.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRDetectorConstructionMessenger_H
|
||||
#define GRDetectorConstructionMessenger_H 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GRDetectorConstruction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
class GRDetectorConstructionMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
GRDetectorConstructionMessenger(GRDetectorConstruction*);
|
||||
virtual ~GRDetectorConstructionMessenger();
|
||||
virtual void SetNewValue(G4UIcommand*,G4String);
|
||||
virtual G4String GetCurrentValue(G4UIcommand*);
|
||||
|
||||
private:
|
||||
GRDetectorConstruction* pDC;
|
||||
|
||||
G4UIdirectory* geomDir;
|
||||
G4UIcmdWithAString* selectCmd;
|
||||
G4UIcmdWithAnInteger* listSolidCmd;
|
||||
G4UIcmdWithAnInteger* listLogVolCmd;
|
||||
G4UIcmdWithAnInteger* listPhysVolCmd;
|
||||
G4UIcmdWithAnInteger* listRegionCmd;
|
||||
G4UIcommand* createRegionCmd;
|
||||
////G4UIcommand* checkOverlapCmd;
|
||||
|
||||
G4UIdirectory* materialDir;
|
||||
G4UIcmdWithAString* listMatCmd;
|
||||
G4UIcmdWithoutParameter* dumpMatCmd;
|
||||
G4UIcmdWithAString* createMatCmd;
|
||||
G4UIcmdWithAString* getMatCmd;
|
||||
G4UIcommand* setMatCmd;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRGeomBiasMessenger.hh
|
||||
// Header file of a messenger class that handles the UI commands for
|
||||
// geometry imprtance biasing.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRGeomBiasMessenger_h
|
||||
#define GRGeomBiasMessenger_h 1
|
||||
|
||||
class G4ScoringManager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADouble;
|
||||
|
||||
class GRDetectorConstruction;
|
||||
class GRPhysicsList;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class GRGeomBiasMessenger: public G4UImessenger
|
||||
{
|
||||
|
||||
public:
|
||||
GRGeomBiasMessenger(GRDetectorConstruction*,GRPhysicsList*,G4int verboseLvl = 0);
|
||||
~GRGeomBiasMessenger();
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
private:
|
||||
GRDetectorConstruction* detector;
|
||||
GRPhysicsList* physics;
|
||||
G4int verboseLevel;
|
||||
|
||||
G4UIdirectory* biasDir;
|
||||
G4UIcommand* geoBiasCmd;
|
||||
G4UIcmdWith3VectorAndUnit* geoBiasLocCmd;
|
||||
G4UIcmdWithADoubleAndUnit* geoBiasInRadCmd;
|
||||
G4UIcmdWith3VectorAndUnit* geoBiasLocTgtCmd;
|
||||
G4UIcmdWithAnInteger* geoBiasFucCmd;
|
||||
G4UIcmdWithADouble* geoBiasProbCmd;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRGeomImpBiasWorld.hh
|
||||
// Header file of a parallel world class that defines the geometry
|
||||
// of the geometry improtance biasing.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRGeomImpBiasWorld_H
|
||||
#define GRGeomImpBiasWorld_H 1
|
||||
|
||||
#include "G4VUserParallelWorld.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class GRDetectorConstruction;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Region;
|
||||
class GRGeomImpBiasWorldStateNotifier;
|
||||
|
||||
class GRGeomImpBiasWorld : public G4VUserParallelWorld
|
||||
{
|
||||
friend class GRGeomImpBiasWorldStateNotifier;
|
||||
|
||||
public:
|
||||
GRGeomImpBiasWorld(G4String&,GRDetectorConstruction*);
|
||||
virtual ~GRGeomImpBiasWorld();
|
||||
virtual void Construct();
|
||||
virtual void ConstructSD();
|
||||
|
||||
private:
|
||||
GRDetectorConstruction* detector;
|
||||
G4VPhysicalVolume* fWorld = nullptr;
|
||||
G4Region* biasingRegion = nullptr;
|
||||
GRGeomImpBiasWorldStateNotifier* stateNotifier;
|
||||
G4bool constructed = false;
|
||||
|
||||
private:
|
||||
void Update();
|
||||
};
|
||||
|
||||
#include "G4VStateDependent.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
|
||||
class GRGeomImpBiasWorldStateNotifier : public G4VStateDependent
|
||||
{
|
||||
public:
|
||||
GRGeomImpBiasWorldStateNotifier(GRGeomImpBiasWorld* bw)
|
||||
: biasWorld(bw)
|
||||
{;}
|
||||
virtual ~GRGeomImpBiasWorldStateNotifier()
|
||||
{;}
|
||||
virtual G4bool Notify(G4ApplicationState newState)
|
||||
{
|
||||
if(previousState == G4State_Idle && newState == G4State_GeomClosed)
|
||||
{ biasWorld->Update(); }
|
||||
previousState = newState;
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
GRGeomImpBiasWorld* biasWorld;
|
||||
G4ApplicationState previousState = G4State_PreInit;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRInitialization.hh
|
||||
// Defines the initialization procedure of Gorad and Geant4
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRInitialization_h
|
||||
#define GRInitialization_h 1
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
class GRDetectorConstruction;
|
||||
class GRPhysicsList;
|
||||
class GRPrimGenActionMessenger;
|
||||
class GRActionInitialization;
|
||||
class G4GenericMessenger;
|
||||
class GRGeomBiasMessenger;
|
||||
class G4UIExecutive;
|
||||
|
||||
class GRInitialization
|
||||
{
|
||||
public:
|
||||
GRInitialization(G4int verboseLvl=0);
|
||||
~GRInitialization();
|
||||
void Initialize();
|
||||
void SetWindowText(G4UIExecutive*);
|
||||
|
||||
private:
|
||||
GRDetectorConstruction* detector;
|
||||
GRPhysicsList* physics;
|
||||
GRActionInitialization* actionInitialization;
|
||||
|
||||
GRPrimGenActionMessenger* sourceMessenger;
|
||||
G4GenericMessenger* messenger;
|
||||
GRGeomBiasMessenger* geomBiasMessenger;
|
||||
|
||||
G4int verboseLevel;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRParallelWorldBiasingProcess.hh
|
||||
// Header file of a process that takes care of the geometry
|
||||
// importance biasing
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRParallelWorldBiasingProcess_h
|
||||
#define GRParallelWorldBiasingProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
class G4Step;
|
||||
class G4Track;
|
||||
class G4VParticleChange;
|
||||
class G4ParticleChange;
|
||||
class G4ParticleChangeForNothing;
|
||||
#include "G4ParallelWorldProcess.hh"
|
||||
|
||||
// Class Description:
|
||||
|
||||
class GRParallelWorldBiasingProcess : public G4ParallelWorldProcess
|
||||
{
|
||||
public:
|
||||
GRParallelWorldBiasingProcess(const G4String& processName = "ParaWorld",
|
||||
G4ProcessType theType = fParallel);
|
||||
virtual ~GRParallelWorldBiasingProcess();
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track&,const G4Step&);
|
||||
|
||||
private:
|
||||
G4ParticleChange* particleChange;
|
||||
G4ParticleChangeForNothing* emptyParticleChange;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRParallelWorldPhysics.hh
|
||||
// Utility class that adds GRParallelWorldBiasingProcess to the
|
||||
// process managers of particles
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRParallelWorldPhysics_h
|
||||
#define GRParallelWorldPhysics_h 1
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GRParallelWorldPhysics : public G4VPhysicsConstructor
|
||||
{
|
||||
public:
|
||||
|
||||
GRParallelWorldPhysics(const G4String& name = "ParallelWP", G4bool layerdMass = false);
|
||||
virtual ~GRParallelWorldPhysics();
|
||||
|
||||
public:
|
||||
|
||||
// This method is dummy for physics
|
||||
virtual void ConstructParticle();
|
||||
|
||||
// This method will be invoked in the Construct() method.
|
||||
// each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type
|
||||
virtual void ConstructProcess();
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
GRParallelWorldPhysics & operator=(const GRParallelWorldPhysics &right);
|
||||
GRParallelWorldPhysics(const GRParallelWorldPhysics&);
|
||||
|
||||
G4bool fLayeredMass;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRPhysicsList.hh
|
||||
// Header file of the Gorad Physics List
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRPhysicsList_H
|
||||
#define GRPhysicsList_H 1
|
||||
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
class G4PhysListFactory;
|
||||
class GRPhysicsListMessenger;
|
||||
class G4Region;
|
||||
class G4ProductionCuts;
|
||||
|
||||
#include <map>
|
||||
|
||||
class GRPhysicsList : public G4VModularPhysicsList
|
||||
{
|
||||
public:
|
||||
GRPhysicsList();
|
||||
virtual ~GRPhysicsList();
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
virtual void SetCuts();
|
||||
|
||||
private:
|
||||
G4String PLName;
|
||||
G4VModularPhysicsList* physList;
|
||||
G4PhysListFactory* factory;
|
||||
GRPhysicsListMessenger* messenger;
|
||||
|
||||
public:
|
||||
const G4String& GetPLName()
|
||||
{ return PLName; }
|
||||
|
||||
private:
|
||||
G4String EM_opt; // EM physics option
|
||||
G4String Had_opt; // Hadronic physics option
|
||||
G4bool addHP; // add Neutron_HP
|
||||
G4bool addRDM; // add Radioactive Decay Module
|
||||
G4bool addRMC; // add Reverse Monte Calro
|
||||
G4bool addOptical; // add optical physics
|
||||
G4int stepLimit_opt; // Step limiter option (0:charged, 1:neutral, 2:all, 3:e+/e-)
|
||||
std::map<G4Region*,G4double> localStepLimits; // map of region name and limit value
|
||||
G4double globalCuts[4]; // for e-, e+ gamma, proton
|
||||
std::map<G4Region*,G4ProductionCuts*> localCuts; // map of region name and cuts
|
||||
|
||||
public:
|
||||
void SetEM(G4String& val) { EM_opt = val; }
|
||||
const G4String& GetEM() const { return EM_opt; }
|
||||
void SetHad(G4String& val) { Had_opt = val; }
|
||||
const G4String& GetHad() const { return Had_opt; }
|
||||
void AddHP(G4bool val = true) { addHP = val; }
|
||||
G4bool IfHP() const { return addHP; }
|
||||
void AddRDM(G4bool val = true) { addRDM = val; }
|
||||
G4bool IfRDM() const { return addRDM; }
|
||||
void AddRMC(G4bool val = true) { addRMC = val; }
|
||||
G4bool IfRMC() const { return addRMC; }
|
||||
void AddOptical(G4bool val = true) { addOptical = val; }
|
||||
G4bool IfOptical() const { return addOptical; }
|
||||
void AddStepLimit(G4int val = 0) { stepLimit_opt = val; }
|
||||
G4int IfStepLimit() const { return stepLimit_opt; }
|
||||
void SetGlobalStepLimit(G4double);
|
||||
G4double GetGlobalStepLimit() const;
|
||||
G4Region* SetLocalStepLimit(const G4String&,G4double);
|
||||
G4double GetLocalStepLimit(const G4String&) const;
|
||||
void SetGlobalCuts(G4double);
|
||||
G4double GetGlobalCuts() const { return GetGlobalCut(0); }
|
||||
void SetGlobalCut(G4int, G4double);
|
||||
G4double GetGlobalCut(G4int i) const { return globalCuts[i]; }
|
||||
G4Region* SetLocalCuts(const G4String& reg,G4double val)
|
||||
{
|
||||
G4Region* regPtr = nullptr;
|
||||
for(G4int i=0; i<4; i++)
|
||||
{
|
||||
regPtr = SetLocalCut(reg,i,val);
|
||||
if(!regPtr) return regPtr;
|
||||
}
|
||||
return regPtr;
|
||||
}
|
||||
G4double GetLocalCuts(const G4String& reg) const { return GetLocalCut(reg,0); }
|
||||
G4Region* SetLocalCut(const G4String&,G4int,G4double);
|
||||
G4double GetLocalCut(const G4String&,G4int) const;
|
||||
|
||||
private:
|
||||
void GeneratePLName();
|
||||
void GeneratePL();
|
||||
G4Region* FindRegion(const G4String&) const;
|
||||
|
||||
private:
|
||||
G4bool applyGeomImpBias = false;
|
||||
|
||||
public:
|
||||
void ApplyGeomImpBias(G4bool val = true)
|
||||
{ applyGeomImpBias = val; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRPhysicsListMessenger.hh
|
||||
// Header file of a messenger class that handles Gorad physics list
|
||||
// options.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRPhysicsListMessenger_H
|
||||
#define GRPhysicsListMessenger_H 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GRPhysicsList;
|
||||
class G4UIcommand;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
class GRPhysicsListMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
GRPhysicsListMessenger(GRPhysicsList*);
|
||||
virtual ~GRPhysicsListMessenger();
|
||||
virtual void SetNewValue(G4UIcommand*,G4String);
|
||||
virtual G4String GetCurrentValue(G4UIcommand*);
|
||||
|
||||
private:
|
||||
GRPhysicsList* pPL;
|
||||
G4UIdirectory* physDir;
|
||||
G4UIcmdWithAString* selectEMCmd;
|
||||
G4UIcmdWithAString* selectHadCmd;
|
||||
G4UIcmdWithoutParameter* addHPCmd;
|
||||
G4UIcmdWithoutParameter* addRDMCmd;
|
||||
G4UIcmdWithoutParameter* addRMCCmd;
|
||||
G4UIcmdWithoutParameter* addOpticalCmd;
|
||||
G4UIcmdWithAString* addStepLimitCmd;
|
||||
|
||||
G4UIdirectory* physLimitDir;
|
||||
G4UIcmdWithADoubleAndUnit* setStepLimitCmd;
|
||||
G4UIcommand* setRegionStepLimitCmd;
|
||||
|
||||
G4UIdirectory* physCutDir;
|
||||
G4UIcmdWithADoubleAndUnit* setCutCmd;
|
||||
G4UIcommand* setCutParticleCmd;
|
||||
G4UIcommand* setCutRegionCmd;
|
||||
G4UIcommand* setCutRegionParticleCmd;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRPrimGenActionMessenger.hh
|
||||
// Header file of a messenger that handles primary
|
||||
// generator action class.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRPrimGenActionMessenger_h
|
||||
#define GRPrimGenActionMessenger_h 1
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcommand;
|
||||
class G4UIparameter;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class GRPrimGenActionMessenger: public G4UImessenger
|
||||
{
|
||||
|
||||
public:
|
||||
GRPrimGenActionMessenger(G4int verboseLvl = 0);
|
||||
~GRPrimGenActionMessenger();
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
public:
|
||||
void UpdateParticleList();
|
||||
|
||||
private:
|
||||
G4int verboseLevel;
|
||||
G4UIdirectory* srcDir;
|
||||
G4UIcommand* defCmd;
|
||||
G4UIparameter* particlePara;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRPrimaryGeneratorAction.hh
|
||||
// Header file of Gorad primary generator action class
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRPrimaryGeneratorAction_h
|
||||
#define GRPrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4GeneralParticleSource;
|
||||
class G4Event;
|
||||
class G4ParticleDefinition;
|
||||
|
||||
class GRPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
GRPrimaryGeneratorAction(G4bool,G4bool);
|
||||
virtual ~GRPrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
G4GeneralParticleSource* fParticleSource;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRRun.hh
|
||||
// Header file of Gorad Run class
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRRun_h
|
||||
#define GRRun_h 1
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4THitsMap.hh"
|
||||
#include <vector>
|
||||
|
||||
class GRRunAction;
|
||||
|
||||
class GRRun : public G4Run {
|
||||
|
||||
public:
|
||||
GRRun(GRRunAction*);
|
||||
virtual ~GRRun();
|
||||
|
||||
public:
|
||||
virtual void RecordEvent(const G4Event*);
|
||||
virtual void Merge(const G4Run*);
|
||||
|
||||
private:
|
||||
GRRunAction* pRA;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRRunAction.hh
|
||||
// Header file of Gorad Run Action class that takes care of
|
||||
// handling histograms and n-tuple.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRRunAction_h
|
||||
#define GRRunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
class GRRunActionMessenger;
|
||||
class GRRunAction;
|
||||
#include "GRRun.hh"
|
||||
|
||||
#include <map>
|
||||
class G4VPrimitivePlotter;
|
||||
|
||||
class GRHistoType
|
||||
{
|
||||
friend class GRRunAction;
|
||||
friend class GRRun;
|
||||
private:
|
||||
GRHistoType()
|
||||
{;}
|
||||
private:
|
||||
G4int histID = -1;
|
||||
G4int histType = -1;
|
||||
G4int histDup = 1;
|
||||
|
||||
G4int collID = -1;
|
||||
G4String meshName = "dummy";
|
||||
G4String primName = "dummy";
|
||||
G4int idx = -1;
|
||||
|
||||
G4int collID2 = -1;
|
||||
G4String meshName2 = "dummy";
|
||||
G4String primName2 = "dummy";
|
||||
G4int idx2 = -1;
|
||||
|
||||
G4int biasf = 0;
|
||||
G4double fuct = 1.;
|
||||
G4VPrimitivePlotter* pplotter = nullptr;
|
||||
};
|
||||
|
||||
class GRRunAction : public G4UserRunAction
|
||||
{
|
||||
friend class GRRun;
|
||||
public:
|
||||
GRRunAction();
|
||||
virtual ~GRRunAction();
|
||||
|
||||
virtual G4Run* GenerateRun()
|
||||
{ return new GRRun(this); }
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
|
||||
private:
|
||||
GRRunActionMessenger* messenger;
|
||||
|
||||
public:
|
||||
void SetVerbose(G4int);
|
||||
void ListHistograms();
|
||||
G4bool Open(G4int);
|
||||
G4bool SetAllPlotting(G4bool val=true);
|
||||
G4bool SetPlotting(G4int,G4bool val=true);
|
||||
void Flush();
|
||||
void Reset();
|
||||
|
||||
G4int Create1D(G4String&,G4String&,G4int);
|
||||
G4int Create1DForPrimary(G4String&,G4bool);
|
||||
G4int Create1DForPlotter(G4String&,G4String&,G4bool);
|
||||
G4bool Set1D(G4int,G4int,G4double,G4double,G4String&,G4String&,G4bool);
|
||||
G4bool Set1DTitle(G4int,G4String&,G4String&,G4String&);
|
||||
G4bool Set1DYAxisLog(G4int,G4bool);
|
||||
|
||||
G4int Create1P(G4String&,G4String&,G4int);
|
||||
G4bool Set1P(G4int,G4double,G4double,G4String&,G4String&,G4String&,G4String&);
|
||||
G4bool Set1PTitle(G4int,G4String&,G4String&,G4String&);
|
||||
|
||||
G4int NtupleColumn(G4String&,G4String&,G4String&,G4int);
|
||||
|
||||
private:
|
||||
void OpenFile();
|
||||
void DefineNTColumn();
|
||||
void MergeNtuple();
|
||||
|
||||
public:
|
||||
inline void SetFileName(G4String& fn)
|
||||
{ fileName = fn; }
|
||||
inline const G4String& GetFileName() const
|
||||
{ return fileName; }
|
||||
inline G4int GetVerbose() const
|
||||
{ return verbose; }
|
||||
inline void SetCarry(G4bool val = true)
|
||||
{ ifCarry = val; }
|
||||
inline G4bool GetCarry() const
|
||||
{ return ifCarry; }
|
||||
inline void SetOffset(G4int offset,G4int factor)
|
||||
{
|
||||
id_offset = offset;
|
||||
id_factor = factor;
|
||||
}
|
||||
inline void GetOffset(G4int& offset,G4int& factor) const
|
||||
{
|
||||
offset = id_offset;
|
||||
factor = id_factor;
|
||||
}
|
||||
|
||||
private:
|
||||
G4String fileName;
|
||||
G4bool fileOpen;
|
||||
G4int verbose;
|
||||
G4bool ifCarry;
|
||||
G4int id_offset;
|
||||
G4int id_factor;
|
||||
|
||||
private:
|
||||
std::map<G4int,GRHistoType*> IDMap;
|
||||
std::map<G4int,GRHistoType*> NTMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRRunActionMessenger.hh
|
||||
// Header file of a messenger class that handles histograms and
|
||||
// n-tuple in GRRunAction.
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRRunActionMessenger_H
|
||||
#define GRRunActionMessenger_H 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GRRunAction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
class GRRunActionMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
GRRunActionMessenger(GRRunAction*);
|
||||
virtual ~GRRunActionMessenger();
|
||||
virtual void SetNewValue(G4UIcommand*,G4String);
|
||||
virtual G4String GetCurrentValue(G4UIcommand*);
|
||||
|
||||
private:
|
||||
void Define1D();
|
||||
void Define1P();
|
||||
|
||||
private:
|
||||
GRRunAction* pRA;
|
||||
|
||||
G4UIdirectory* anaDir;
|
||||
G4UIcmdWithAString* fileCmd;
|
||||
G4UIcmdWithAnInteger* verboseCmd;
|
||||
G4UIcmdWithoutParameter* listCmd;
|
||||
G4UIcmdWithAnInteger* openCmd;
|
||||
G4UIcmdWithAnInteger* plotCmd;
|
||||
G4UIcmdWithABool* carryCmd;
|
||||
G4UIcmdWithoutParameter* flushCmd;
|
||||
G4UIcmdWithoutParameter* resetCmd;
|
||||
G4UIcommand* idOffsetCmd;
|
||||
|
||||
G4UIdirectory* oneDDir;
|
||||
G4UIcommand* create1DCmd;
|
||||
G4UIcommand* create1DPrimPCmd;
|
||||
G4UIcommand* create1DPlotPCmd;
|
||||
G4UIcmdWithoutParameter* set1DCmd;
|
||||
G4UIcommand* config1DCmd;
|
||||
G4UIcommand* title1DCmd;
|
||||
G4UIcmdWithABool* set1DYaxisLogCmd;
|
||||
|
||||
G4UIdirectory* onePDir;
|
||||
G4UIcommand* create1PCmd;
|
||||
G4UIcommand* set1PCmd;
|
||||
G4UIcommand* title1PCmd;
|
||||
|
||||
G4UIdirectory* ntupleDir;
|
||||
G4UIcommand* addColumnCmd;
|
||||
|
||||
private:
|
||||
G4int currentID;
|
||||
|
||||
private:
|
||||
inline G4bool CheckID(G4UIcommand* cmd)
|
||||
{
|
||||
if(currentID<0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "There is no currently opened histogram. Create or open one.";
|
||||
cmd->CommandFailed(ed);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
inline G4bool CheckOpenID(G4UIcommand* /*cmd*/)
|
||||
{
|
||||
if(currentID>=0)
|
||||
{
|
||||
G4cout << "Previously opened histogram <" << currentID << "> is closed." << G4endl;
|
||||
currentID = -1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Gorad (Geant4 Open-source Radiation Analysis and Design)
|
||||
//
|
||||
// Author : Makoto Asai (SLAC National Accelerator Laboratory)
|
||||
//
|
||||
// Development of Gorad is funded by NASA Johnson Space Center (JSC)
|
||||
// under the contract NNJ15HK11B.
|
||||
//
|
||||
// ********************************************************************
|
||||
//
|
||||
// GRScoreWriter.hh
|
||||
// Defines the printout format of primitive scorer
|
||||
//
|
||||
// History
|
||||
// September 8th, 2020 : first implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#ifndef GRScoreWriter_h
|
||||
#define GRScoreWriter_h 1
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4VScoreWriter.hh"
|
||||
|
||||
class GRScoreWriter : public G4VScoreWriter
|
||||
{
|
||||
public:
|
||||
GRScoreWriter();
|
||||
~GRScoreWriter();
|
||||
|
||||
public:
|
||||
// store a quantity into a file
|
||||
virtual void DumpQuantityToFile(const G4String& psName,
|
||||
const G4String& fileName,
|
||||
const G4String& option);
|
||||
// store all quantities into a file
|
||||
virtual void DumpAllQuantitiesToFile(const G4String& fileName,
|
||||
const G4String& option);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user