Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -8,21 +8,18 @@
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module is going to be enhanced in future. Currently it provides
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
- Physics list classes
|
||||
- ExG4PhysicsList00 - physics list with geantino and chargedgeantino only
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
- User action classes:
|
||||
- event action and run action classes with messengers
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -15,6 +15,13 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
29/09/17 I. Hrivnacova (excommon-V10-03-00,01)
|
||||
- Removed generic class names prefix (ExG4) and introduced a meaningful one
|
||||
when appropriate
|
||||
- Removed event and run action classes which are now obsolete
|
||||
- Replaced explicit messengers with use of G4GenericMessenger
|
||||
- C++11 (nullptr, auto)
|
||||
|
||||
20/07/16 I. Hrivnacova (excommon-V10-02-01)
|
||||
- Coding guidelines (redundant empty lines)
|
||||
|
||||
|
||||
@@ -11,20 +11,17 @@ $Id$
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module is going to be enhanced in future. Currently it provides
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
- Physics list classes
|
||||
- ExG4PhysicsList00 - physics list with geantino and chargedgeantino only
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
- User action classes:
|
||||
- event action and run action classes with messengers
|
||||
|
||||
|
||||
|
||||
+17
-20
@@ -25,37 +25,33 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02.hh
|
||||
/// \brief Definition of the ExG4DetectorConstruction02 class
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
|
||||
#ifndef ExG4DetectorConstruction02_h
|
||||
#define ExG4DetectorConstruction02_h 1
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
#include "ExG4DetectorConstruction02Messenger.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "CLHEP/Units/SystemOfUnits.h"
|
||||
|
||||
class G4LogicalVolume;
|
||||
class G4Material;
|
||||
class DetectorMessenger;
|
||||
class G4GenericMessenger;
|
||||
|
||||
/// Simple detector construction with a box volume placed in a world
|
||||
|
||||
class ExG4DetectorConstruction02 : public G4VUserDetectorConstruction
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
ExG4DetectorConstruction02(
|
||||
DetectorConstruction(
|
||||
const G4String& boxMaterialName = "G4_AIR",
|
||||
G4double boxHx = 40*CLHEP::cm,
|
||||
G4double boxHy = 40*CLHEP::cm,
|
||||
G4double boxHz = 40*CLHEP::cm,
|
||||
const G4String& worldMaterialName = "G4_AIR",
|
||||
G4double worldSizeFactor = 1.25);
|
||||
~ExG4DetectorConstruction02();
|
||||
~DetectorConstruction();
|
||||
|
||||
public:
|
||||
// methods from base class
|
||||
@@ -64,18 +60,19 @@ class ExG4DetectorConstruction02 : public G4VUserDetectorConstruction
|
||||
// set methods
|
||||
void SetBoxMaterial(const G4String& materialName);
|
||||
void SetWorldMaterial(const G4String& materialName);
|
||||
void SetBoxDimensions(G4double hx, G4double hy, G4double hz);
|
||||
void SetBoxDimensions(G4ThreeVector dimensions);
|
||||
void SetWorldSizeFactor(G4double factor);
|
||||
|
||||
private:
|
||||
ExG4DetectorConstruction02Messenger fMessenger;
|
||||
void DefineCommands();
|
||||
|
||||
G4String fBoxMaterialName;
|
||||
G4String fWorldMaterialName;
|
||||
G4ThreeVector fBoxDimensions;
|
||||
G4double fWorldSizeFactor;
|
||||
G4LogicalVolume* fBoxVolume;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4String fBoxMaterialName;
|
||||
G4String fWorldMaterialName;
|
||||
G4ThreeVector fBoxDimensions;
|
||||
G4double fWorldSizeFactor;
|
||||
G4LogicalVolume* fBoxVolume;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+14
-17
@@ -25,35 +25,31 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction01.hh
|
||||
/// \brief Definition of the ExG4DetectorConstruction01 class
|
||||
/// \file DetectorConstruction0.hh
|
||||
/// \brief Definition of the DetectorConstruction0 class
|
||||
|
||||
#ifndef ExG4DetectorConstruction01_h
|
||||
#define ExG4DetectorConstruction01_h 1
|
||||
#ifndef DetectorConstruction0_h
|
||||
#define DetectorConstruction0_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
#include "ExG4DetectorConstruction01Messenger.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "CLHEP/Units/SystemOfUnits.h"
|
||||
|
||||
class G4LogicalVolume;
|
||||
class G4Material;
|
||||
class DetectorMessenger;
|
||||
class G4GenericMessenger;
|
||||
|
||||
/// Simple detector construction with only a world volume
|
||||
|
||||
class ExG4DetectorConstruction01 : public G4VUserDetectorConstruction
|
||||
class DetectorConstruction0 : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
ExG4DetectorConstruction01(
|
||||
DetectorConstruction0(
|
||||
const G4String& materialName = "G4_AIR",
|
||||
G4double hx = 50*CLHEP::cm,
|
||||
G4double hy = 50*CLHEP::cm,
|
||||
G4double hz = 50*CLHEP::cm);
|
||||
~ExG4DetectorConstruction01();
|
||||
~DetectorConstruction0();
|
||||
|
||||
public:
|
||||
// methods from base class
|
||||
@@ -61,14 +57,15 @@ class ExG4DetectorConstruction01 : public G4VUserDetectorConstruction
|
||||
|
||||
// set methods
|
||||
void SetMaterial(const G4String& materialName);
|
||||
void SetDimensions(G4double hx, G4double hy, G4double hz);
|
||||
void SetDimensions(G4ThreeVector dimensions);
|
||||
|
||||
private:
|
||||
ExG4DetectorConstruction01Messenger fMessenger;
|
||||
void DefineCommands();
|
||||
|
||||
G4String fMaterialName;
|
||||
G4ThreeVector fDimensions;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4String fMaterialName;
|
||||
G4ThreeVector fDimensions;
|
||||
G4LogicalVolume* fWorldVolume;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,70 +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: ExG4DetectorConstruction01Messenger.hh 85714 2014-11-04 14:30:40Z ihrivnac $
|
||||
//
|
||||
/// \file ExG4DetectorConstruction01Messenger.hh
|
||||
/// \brief Definition of the ExG4DetectorConstruction01Messenger class
|
||||
|
||||
#ifndef ExG4DetectorConstruction01Messenger_h
|
||||
#define ExG4DetectorConstruction01Messenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class ExG4DetectorConstruction01;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithADouble;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Messenger class that defines commands for ExG4DetectorConstruction01.
|
||||
///
|
||||
/// It implements commands:
|
||||
/// - /ExG4/det/setMaterialName name
|
||||
/// - /ExG4/det/setDimensions hx hy hz unit
|
||||
|
||||
class ExG4DetectorConstruction01Messenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
ExG4DetectorConstruction01Messenger(ExG4DetectorConstruction01* );
|
||||
virtual ~ExG4DetectorConstruction01Messenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
|
||||
private:
|
||||
ExG4DetectorConstruction01* fDetectorConstruction;
|
||||
G4UIdirectory* fTopDirectory;
|
||||
G4UIdirectory* fDirectory;
|
||||
G4UIcmdWithAString* fSetMaterialCmd;
|
||||
G4UIcmdWith3VectorAndUnit* fSetDimensionsCmd;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,74 +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: ExG4DetectorConstruction02Messenger.hh 85714 2014-11-04 14:30:40Z ihrivnac $
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02Messenger.hh
|
||||
/// \brief Definition of the ExG4DetectorConstruction02Messenger class
|
||||
|
||||
#ifndef ExG4DetectorConstruction02Messenger_h
|
||||
#define ExG4DetectorConstruction02Messenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class ExG4DetectorConstruction02;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithADouble;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
/// Messenger class that defines commands for ExG4DetectorConstruction02.
|
||||
///
|
||||
/// It implements commands:
|
||||
/// - /ExG4/det/setBoxMaterialName name
|
||||
/// - /ExG4/det/setWorldMaterialName name
|
||||
/// - /ExG4/det/setBoxDimensions hx hy hz unit
|
||||
/// - /ExG4/det/setWorldSizeFactor value
|
||||
|
||||
class ExG4DetectorConstruction02Messenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
ExG4DetectorConstruction02Messenger(ExG4DetectorConstruction02* );
|
||||
virtual ~ExG4DetectorConstruction02Messenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
|
||||
private:
|
||||
ExG4DetectorConstruction02* fDetectorConstruction;
|
||||
G4UIdirectory* fTopDirectory;
|
||||
G4UIdirectory* fDirectory;
|
||||
G4UIcmdWithAString* fSetBoxMaterialCmd;
|
||||
G4UIcmdWithAString* fSetWorldMaterialCmd;
|
||||
G4UIcmdWith3VectorAndUnit* fSetBoxDimensionsCmd;
|
||||
G4UIcmdWithADouble* fSetWorldSizeFactorCmd;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,82 +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$
|
||||
//
|
||||
/// \file ExG4EventAction01.hh
|
||||
/// \brief Definition of the ExG4EventAction01 class
|
||||
|
||||
#ifndef ExG4EventAction01_h
|
||||
#define ExG4EventAction01_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "ExG4EventAction01Messenger.hh"
|
||||
|
||||
/// Event action class
|
||||
///
|
||||
/// It provides:
|
||||
/// - setting verbose level and event modulo pronting
|
||||
/// - option to save random number status at the end of event
|
||||
|
||||
class ExG4EventAction01 : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
ExG4EventAction01();
|
||||
virtual ~ExG4EventAction01();
|
||||
|
||||
public:
|
||||
// methods from base class
|
||||
virtual void BeginOfEventAction(const G4Event* event);
|
||||
virtual void EndOfEventAction(const G4Event* event);
|
||||
|
||||
// set methods
|
||||
void SetVerboseLevel(G4int level);
|
||||
void SetSaveRndm(G4bool value);
|
||||
void SetDrawFlag(G4String value);
|
||||
|
||||
private:
|
||||
// static data members (constants)
|
||||
static const G4int fgkDefaultVerboseLevel;
|
||||
static const G4int fgkDefaultPrintModulo;
|
||||
|
||||
// data members
|
||||
ExG4EventAction01Messenger fMessenger;
|
||||
G4int fVerboseLevel;
|
||||
G4bool fSaveRndm;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void ExG4EventAction01::SetVerboseLevel(G4int level) {
|
||||
fVerboseLevel = level;
|
||||
}
|
||||
|
||||
inline void ExG4EventAction01::SetSaveRndm(G4bool value) {
|
||||
fSaveRndm = value;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,66 +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$
|
||||
//
|
||||
/// \file ExG4EventAction01Messenger.hh
|
||||
/// \brief Definition of the ExG4EventAction01Messenger class
|
||||
|
||||
#ifndef ExG4EventAction01Messenger_h
|
||||
#define ExG4EventAction01Messenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class ExG4EventAction01;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithABool;
|
||||
|
||||
/// Messenger class that defines commands for ExG4EventAction01
|
||||
///
|
||||
/// It implements commands:
|
||||
/// - /ExG4/event/verboseLevel level
|
||||
/// - /ExG4/event/printModulo modulo
|
||||
/// - /ExG4/event/saveRndm true|false
|
||||
|
||||
class ExG4EventAction01Messenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
ExG4EventAction01Messenger(ExG4EventAction01* eventAction);
|
||||
~ExG4EventAction01Messenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
|
||||
private:
|
||||
// data members
|
||||
ExG4EventAction01* fEventAction;
|
||||
G4UIdirectory* fTopDirectory;
|
||||
G4UIdirectory* fDirectory;
|
||||
G4UIcmdWithAnInteger* fSetVerboseLevelCmd;
|
||||
G4UIcmdWithABool* fSetSaveRndmCmd;
|
||||
};
|
||||
|
||||
#endif //ExG4EventAction01Messenger_h
|
||||
@@ -1,101 +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$
|
||||
//
|
||||
/// \file ExG4RunAction01.hh
|
||||
/// \brief Definition of the ExG4RunAction01 class
|
||||
|
||||
#ifndef ExG4RunAction01_h
|
||||
#define ExG4RunAction01_h 1
|
||||
|
||||
#include "ExG4RunAction01Messenger.hh"
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
/// Run action class
|
||||
///
|
||||
/// It provides:
|
||||
/// - setting verbose level
|
||||
/// - option to save random number status at begin and end of run
|
||||
/// - option to read random number from a file at begin of run
|
||||
/// - option for automatic (time-based) random seeds for each run
|
||||
|
||||
class ExG4RunAction01 : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
ExG4RunAction01();
|
||||
~ExG4RunAction01();
|
||||
|
||||
public:
|
||||
// methods
|
||||
virtual void BeginOfRunAction(const G4Run* run);
|
||||
virtual void EndOfRunAction(const G4Run* run);
|
||||
|
||||
// set methods
|
||||
void SetRndmFileName(const G4String& fileName);
|
||||
void SetVerboseLevel(G4int level);
|
||||
void SetSaveRndm(G4bool value);
|
||||
void SetReadRndm(G4bool value);
|
||||
void SetAutoSeed(G4bool value);
|
||||
|
||||
private:
|
||||
// static data members
|
||||
static const G4String fgkDefaultRndmFileName;
|
||||
|
||||
// data members
|
||||
ExG4RunAction01Messenger fMessenger;
|
||||
G4String fRndmFileName;
|
||||
G4int fVerboseLevel;
|
||||
G4bool fSaveRndm;
|
||||
G4bool fReadRndm;
|
||||
G4bool fAutoSeed;
|
||||
};
|
||||
// inline functions
|
||||
|
||||
inline void ExG4RunAction01::SetVerboseLevel(G4int level) {
|
||||
fVerboseLevel = level;
|
||||
}
|
||||
|
||||
inline void ExG4RunAction01::SetRndmFileName(const G4String& fileName) {
|
||||
fRndmFileName = fileName;
|
||||
}
|
||||
|
||||
inline void ExG4RunAction01::SetSaveRndm(G4bool value) {
|
||||
fSaveRndm = value;
|
||||
}
|
||||
|
||||
inline void ExG4RunAction01::SetReadRndm(G4bool value) {
|
||||
fReadRndm = value;
|
||||
}
|
||||
|
||||
inline void ExG4RunAction01::SetAutoSeed(G4bool value) {
|
||||
fAutoSeed = value;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,75 +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$
|
||||
//
|
||||
/// \file ExG4RunAction01Messenger.hh
|
||||
/// \brief Definition of the ExG4RunAction01Messenger class
|
||||
|
||||
#ifndef ExG4RunAction01Messenger_h
|
||||
#define ExG4RunAction01Messenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
class ExG4RunAction01;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
/// Messenger class that defines commands for ExG4RunAction01
|
||||
///
|
||||
/// It implements commands:
|
||||
/// - /ExG4/run/verboseLevel level
|
||||
/// - /ExG4/run/saveRndm true|false
|
||||
/// - /ExG4/run/readRndm true|false
|
||||
/// - /ExG4/run/rndmFileName fileName
|
||||
/// - /ExG4/run/autoSeed true|false
|
||||
|
||||
class ExG4RunAction01Messenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
ExG4RunAction01Messenger(ExG4RunAction01* );
|
||||
~ExG4RunAction01Messenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
|
||||
private:
|
||||
ExG4RunAction01* fRunAction;
|
||||
|
||||
G4UIdirectory* fTopDirectory;
|
||||
G4UIdirectory* fDirectory;
|
||||
G4UIcmdWithAnInteger* fSetVerboseLevelCmd;
|
||||
G4UIcmdWithABool* fSetSaveRndmCmd;
|
||||
G4UIcmdWithABool* fSetReadRndmCmd;
|
||||
G4UIcmdWithAString* fSetRndmFileNameCmd;
|
||||
G4UIcmdWithABool* fSetAutoSeedCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+7
-7
@@ -25,21 +25,21 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PhysicsList00.hh
|
||||
/// \brief Definition of the ExG4PhysicsList00 class
|
||||
/// \file GeantinoPhysicsList.hh
|
||||
/// \brief Definition of the GeantinoPhysicsList class
|
||||
|
||||
#ifndef ExG4PhysicsList00_h
|
||||
#define ExG4PhysicsList00_h 1
|
||||
#ifndef GeantinoPhysicsList_h
|
||||
#define GeantinoPhysicsList_h 1
|
||||
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
|
||||
/// Physics list with geantino and charged geantino only
|
||||
|
||||
class ExG4PhysicsList00: public G4VUserPhysicsList
|
||||
class GeantinoPhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
ExG4PhysicsList00();
|
||||
~ExG4PhysicsList00();
|
||||
GeantinoPhysicsList();
|
||||
~GeantinoPhysicsList();
|
||||
|
||||
protected:
|
||||
// Construct particle and physics process
|
||||
+8
-11
@@ -25,15 +25,12 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PrimaryGeneratorAction02.hh
|
||||
/// \brief Definition of the ExG4PrimaryGeneratorAction02 class
|
||||
/// \file GpsPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the GpsPrimaryGeneratorActionclass
|
||||
//
|
||||
|
||||
#ifndef ExG4PrimaryGeneratorAction02_h
|
||||
#define ExG4PrimaryGeneratorAction02_h 1
|
||||
|
||||
/// \file ExG4PrimaryGeneratorAction02.hh
|
||||
/// \brief Definition of the ExG4PrimaryGeneratorAction02 class
|
||||
#ifndef GpsPrimaryGeneratorAction_h
|
||||
#define GpsPrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
@@ -46,11 +43,11 @@ class G4Event;
|
||||
///
|
||||
/// \author I. Hrivnacova; IPN Orsay
|
||||
|
||||
class ExG4PrimaryGeneratorAction02 : public G4VUserPrimaryGeneratorAction
|
||||
class GpsPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
ExG4PrimaryGeneratorAction02();
|
||||
~ExG4PrimaryGeneratorAction02();
|
||||
GpsPrimaryGeneratorAction();
|
||||
~GpsPrimaryGeneratorAction();
|
||||
|
||||
// methods
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
@@ -61,7 +58,7 @@ class ExG4PrimaryGeneratorAction02 : public G4VUserPrimaryGeneratorAction
|
||||
static const G4double fgkDefaultEnergy;
|
||||
|
||||
// data members
|
||||
G4GeneralParticleSource* fGeneralParticleSource; //pointer a to G4 service class
|
||||
G4GeneralParticleSource* fGeneralParticleSource;
|
||||
};
|
||||
|
||||
#endif
|
||||
+8
-9
@@ -25,11 +25,11 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PrimaryGeneratorAction01.hh
|
||||
/// \brief Definition of the ExG4PrimaryGeneratorAction01 class
|
||||
/// \file GunPrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the GunPrimaryGeneratorAction class
|
||||
|
||||
#ifndef ExG4PrimaryGeneratorAction01_h
|
||||
#define ExG4PrimaryGeneratorAction01_h 1
|
||||
#ifndef GunPrimaryGeneratorAction_h
|
||||
#define GunPrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -45,23 +45,22 @@ class G4Event;
|
||||
///
|
||||
/// \author I. Hrivnacova; IPN Orsay
|
||||
|
||||
class ExG4PrimaryGeneratorAction01 : public G4VUserPrimaryGeneratorAction
|
||||
class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
ExG4PrimaryGeneratorAction01(
|
||||
GunPrimaryGeneratorAction(
|
||||
const G4String& particleName = "geantino",
|
||||
G4double energy = 1.*CLHEP::MeV,
|
||||
G4ThreeVector position= G4ThreeVector(0,0,0),
|
||||
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));
|
||||
~ExG4PrimaryGeneratorAction01();
|
||||
~GunPrimaryGeneratorAction();
|
||||
|
||||
// methods
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
// data members
|
||||
G4ParticleGun* fParticleGun; //pointer a to G4 service class
|
||||
G4ParticleGun* fParticleGun;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+71
-35
@@ -25,64 +25,62 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction02 class
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
#include "ExG4DetectorConstruction02.hh"
|
||||
#include "ExG4DetectorConstruction02Messenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02::ExG4DetectorConstruction02(
|
||||
DetectorConstruction::DetectorConstruction(
|
||||
const G4String& boxMaterialName,
|
||||
G4double boxHx, G4double boxHy, G4double boxHz,
|
||||
const G4String& worldMaterialName,
|
||||
G4double worldSizeFactor)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(this),
|
||||
fMessenger(nullptr),
|
||||
fBoxMaterialName(boxMaterialName),
|
||||
fWorldMaterialName(worldMaterialName),
|
||||
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
|
||||
fWorldSizeFactor(worldSizeFactor),
|
||||
fBoxVolume(0),
|
||||
fWorldVolume(0)
|
||||
fBoxVolume(nullptr),
|
||||
fWorldVolume(nullptr)
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02::~ExG4DetectorConstruction02()
|
||||
{
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Define materials via NIST manager
|
||||
//
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
G4Material* worldMaterial
|
||||
= nistManager->FindOrBuildMaterial(fWorldMaterialName);
|
||||
|
||||
G4Material* boxMaterial
|
||||
= nistManager->FindOrBuildMaterial(fBoxMaterialName);
|
||||
auto worldMaterial = nistManager->FindOrBuildMaterial(fWorldMaterialName);
|
||||
auto boxMaterial = nistManager->FindOrBuildMaterial(fBoxMaterialName);
|
||||
|
||||
// Geometry parameters
|
||||
//
|
||||
G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
|
||||
|
||||
|
||||
// World
|
||||
//
|
||||
G4Box* sWorld
|
||||
auto sWorld
|
||||
= new G4Box("World", //name
|
||||
worldDimensions.x(), //dimensions (half-lentghs)
|
||||
worldDimensions.y(),
|
||||
@@ -93,7 +91,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
|
||||
worldMaterial, //material
|
||||
"World"); //name
|
||||
|
||||
G4VPhysicalVolume* pWorld
|
||||
auto pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
@@ -104,7 +102,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
|
||||
|
||||
// Box
|
||||
//
|
||||
G4Box* sBox
|
||||
auto sBox
|
||||
= new G4Box("Box", //its name
|
||||
fBoxDimensions.x(), //dimensions (half-lengths)
|
||||
fBoxDimensions.y(),
|
||||
@@ -130,13 +128,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
|
||||
void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
G4Material* newMaterial
|
||||
= nistManager->FindOrBuildMaterial(materialName);
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
|
||||
if ( ! newMaterial ) {
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
@@ -149,13 +145,11 @@ void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
|
||||
void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
G4Material* newMaterial
|
||||
= nistManager->FindOrBuildMaterial(materialName);
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
|
||||
if ( ! newMaterial ) {
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
@@ -168,18 +162,17 @@ void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetBoxDimensions(
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
|
||||
{
|
||||
/// Set box dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fBoxDimensions = G4ThreeVector(hx, hy, hz);
|
||||
fBoxDimensions = dimensions;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
|
||||
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
|
||||
{
|
||||
/// Set the multiplication factor from box dimensions to world dimensions.
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
@@ -188,3 +181,46 @@ void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
"Detector control");
|
||||
|
||||
// setBoxMaterial command
|
||||
auto& setBoxMaterialCmd
|
||||
= fMessenger->DeclareMethod("setBoxMaterial",
|
||||
&DetectorConstruction::SetBoxMaterial,
|
||||
"Set box material name.");
|
||||
setBoxMaterialCmd.SetParameterName("boxMaterialName", false);
|
||||
setBoxMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
|
||||
// setWorldMaterial command
|
||||
auto& setWorldMaterialCmd
|
||||
= fMessenger->DeclareMethod("setWorldMaterial",
|
||||
&DetectorConstruction::SetWorldMaterial,
|
||||
"Set world material name.");
|
||||
setWorldMaterialCmd.SetParameterName("worldMaterialName", false);
|
||||
setWorldMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
|
||||
// setBoxDimensions command
|
||||
auto& setBoxDimensionsCmd
|
||||
= fMessenger->DeclareMethodWithUnit("setBoxDimensions", "mm",
|
||||
&DetectorConstruction::SetBoxDimensions,
|
||||
"Set box dimensions (in half lentgh).");
|
||||
setBoxDimensionsCmd.SetParameterName("boxDimensions", false);
|
||||
setBoxDimensionsCmd.SetStates(G4State_PreInit);
|
||||
|
||||
// setWorldSizeFactor command
|
||||
auto& setWorldSizeFactorCmd
|
||||
= fMessenger->DeclareMethod("setWorldSizeFactor",
|
||||
&DetectorConstruction::SetWorldSizeFactor,
|
||||
"Set the multiplication factor from box dimensions to world dimensions.");
|
||||
setWorldSizeFactorCmd.SetParameterName("worldSizeFactor", false);
|
||||
setWorldSizeFactorCmd.SetRange("WorldSizeFactor >= 1");
|
||||
setWorldSizeFactorCmd.SetStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+48
-23
@@ -25,51 +25,52 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction01.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction01 class
|
||||
/// \file DetectorConstruction0.cc
|
||||
/// \brief Implementation of the DetectorConstruction0 class
|
||||
|
||||
#include "ExG4DetectorConstruction01.hh"
|
||||
#include "ExG4DetectorConstruction01Messenger.hh"
|
||||
#include "DetectorConstruction0.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction01::ExG4DetectorConstruction01(
|
||||
DetectorConstruction0::DetectorConstruction0(
|
||||
const G4String& materialName,
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(this),
|
||||
fMessenger(nullptr),
|
||||
fMaterialName(materialName),
|
||||
fDimensions(hx, hy, hz),
|
||||
fWorldVolume(0)
|
||||
fWorldVolume(nullptr)
|
||||
{
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction01::~ExG4DetectorConstruction01()
|
||||
{
|
||||
DetectorConstruction0::~DetectorConstruction0()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction0::Construct()
|
||||
{
|
||||
// Define materials via NIST manager
|
||||
//
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
G4Material* material
|
||||
= nistManager->FindOrBuildMaterial(fMaterialName);
|
||||
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
|
||||
|
||||
// World
|
||||
//
|
||||
G4Box* sWorld
|
||||
auto sWorld
|
||||
= new G4Box("World", //name
|
||||
fDimensions.x(), //dimensions (half-lentghs)
|
||||
fDimensions.y(),
|
||||
@@ -80,7 +81,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
|
||||
material, //material
|
||||
"World"); //name
|
||||
|
||||
G4VPhysicalVolume* pWorld
|
||||
auto pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
@@ -96,13 +97,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
|
||||
void DetectorConstruction0::SetMaterial(const G4String& materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
G4Material* newMaterial
|
||||
= nistManager->FindOrBuildMaterial(materialName);
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
|
||||
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
|
||||
if ( ! newMaterial ) {
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
@@ -115,13 +114,39 @@ void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction01::SetDimensions(
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
|
||||
{
|
||||
/// Set world dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fDimensions = G4ThreeVector(hx, hy, hz);
|
||||
fDimensions = dimensions;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction0::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/detector/",
|
||||
"Detector control");
|
||||
|
||||
// setMaterial command
|
||||
auto& setMaterialCmd
|
||||
= fMessenger->DeclareMethod("setMaterial",
|
||||
&DetectorConstruction0::SetMaterial,
|
||||
"Set world material name.");
|
||||
setMaterialCmd.SetParameterName("materialName", false);
|
||||
setMaterialCmd.SetDefaultValue("G4_AIR");
|
||||
setMaterialCmd.SetStates(G4State_PreInit);
|
||||
|
||||
// setDimensions command
|
||||
auto& setDimensionsCmd
|
||||
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
|
||||
&DetectorConstruction0::SetDimensions,
|
||||
"Set world dimensions (in half lentgh).");
|
||||
setDimensionsCmd.SetParameterName("dimensions", false);
|
||||
setDimensionsCmd.SetStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,100 +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: ExG4DetectorConstruction01Messenger.cc 85714 2014-11-04 14:30:40Z ihrivnac $
|
||||
//
|
||||
/// \file ExG4DetectorConstruction01Messenger.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction01Messenger class
|
||||
|
||||
#include "ExG4DetectorConstruction01Messenger.hh"
|
||||
#include "ExG4DetectorConstruction01.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWith3VectorAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction01Messenger::ExG4DetectorConstruction01Messenger(
|
||||
ExG4DetectorConstruction01* detectorConstruction)
|
||||
: G4UImessenger(),
|
||||
fDetectorConstruction(detectorConstruction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetMaterialCmd(0),
|
||||
fSetDimensionsCmd(0)
|
||||
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/det/");
|
||||
fDirectory->SetGuidance("Detector control");
|
||||
|
||||
fSetMaterialCmd
|
||||
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
|
||||
fSetMaterialCmd->SetGuidance("Select material of the box.");
|
||||
fSetMaterialCmd->SetParameterName("BoxMaterial", false);
|
||||
fSetMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetDimensionsCmd
|
||||
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
|
||||
fSetDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
|
||||
fSetDimensionsCmd->SetParameterName(
|
||||
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
|
||||
false);
|
||||
//fSetDimensionsCmd->SetUnitCategory("Length");
|
||||
fSetDimensionsCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction01Messenger::~ExG4DetectorConstruction01Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetMaterialCmd;
|
||||
delete fSetDimensionsCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction01Messenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == fSetMaterialCmd ) {
|
||||
fDetectorConstruction->SetMaterial(newValue);
|
||||
}
|
||||
else if( command == fSetDimensionsCmd ) {
|
||||
G4ThreeVector newDimensions
|
||||
= fSetDimensionsCmd->GetNew3VectorValue(newValue);
|
||||
fDetectorConstruction
|
||||
->SetDimensions(
|
||||
newDimensions.x(), newDimensions.y(), newDimensions.z());
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,125 +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$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02Messenger.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction02Messenger class
|
||||
|
||||
#include "ExG4DetectorConstruction02Messenger.hh"
|
||||
#include "ExG4DetectorConstruction02.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWith3VectorAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02Messenger::ExG4DetectorConstruction02Messenger(
|
||||
ExG4DetectorConstruction02* detectorConstruction)
|
||||
: G4UImessenger(),
|
||||
fDetectorConstruction(detectorConstruction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetBoxMaterialCmd(0),
|
||||
fSetWorldMaterialCmd(0),
|
||||
fSetBoxDimensionsCmd(0),
|
||||
fSetWorldSizeFactorCmd(0)
|
||||
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/det/");
|
||||
fDirectory->SetGuidance("Detector control");
|
||||
|
||||
fSetBoxMaterialCmd
|
||||
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
|
||||
fSetBoxMaterialCmd->SetGuidance("Select material of the box.");
|
||||
fSetBoxMaterialCmd->SetParameterName("BoxMaterial", false);
|
||||
fSetBoxMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetWorldMaterialCmd
|
||||
= new G4UIcmdWithAString("/ExG4/det/setWorldMaterial",this);
|
||||
fSetWorldMaterialCmd->SetGuidance("Select material of the world.");
|
||||
fSetWorldMaterialCmd->SetParameterName("WorldMaterial", false);
|
||||
fSetWorldMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetBoxDimensionsCmd
|
||||
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
|
||||
fSetBoxDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
|
||||
fSetBoxDimensionsCmd->SetParameterName(
|
||||
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
|
||||
false);
|
||||
//fSetBoxDimensionsCmd->SetUnitCategory("Length");
|
||||
fSetBoxDimensionsCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
fSetWorldSizeFactorCmd
|
||||
= new G4UIcmdWithADouble("/ExG4/det/setWorldSizeFactor",this);
|
||||
fSetWorldSizeFactorCmd->SetGuidance(
|
||||
"Set the multiplication factor from box dimensions to world dimensions.");
|
||||
fSetWorldSizeFactorCmd->SetParameterName("WorldSizeFactor", false);
|
||||
fSetWorldSizeFactorCmd->SetRange("WorldSizeFactor >= 1");
|
||||
fSetWorldSizeFactorCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02Messenger::~ExG4DetectorConstruction02Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetBoxMaterialCmd;
|
||||
delete fSetWorldMaterialCmd;
|
||||
delete fSetBoxDimensionsCmd;
|
||||
delete fSetWorldSizeFactorCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02Messenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == fSetBoxMaterialCmd ) {
|
||||
fDetectorConstruction->SetBoxMaterial(newValue);
|
||||
}
|
||||
else if( command == fSetWorldMaterialCmd ) {
|
||||
fDetectorConstruction->SetWorldMaterial(newValue);
|
||||
}
|
||||
else if( command == fSetBoxDimensionsCmd ) {
|
||||
G4ThreeVector newDimensions
|
||||
= fSetBoxDimensionsCmd->GetNew3VectorValue(newValue);
|
||||
fDetectorConstruction
|
||||
->SetBoxDimensions(
|
||||
newDimensions.x(), newDimensions.y(), newDimensions.z());
|
||||
}
|
||||
else if ( command == fSetWorldSizeFactorCmd ) {
|
||||
fDetectorConstruction
|
||||
->SetWorldSizeFactor(fSetWorldSizeFactorCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,103 +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$
|
||||
//
|
||||
/// \file ExG4EventAction01.cc
|
||||
/// \brief Implementation of the ExG4EventAction01 class
|
||||
|
||||
#include "ExG4EventAction01.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const G4int ExG4EventAction01::fgkDefaultVerboseLevel = 1;
|
||||
const G4int ExG4EventAction01::fgkDefaultPrintModulo = 10000;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4EventAction01::ExG4EventAction01()
|
||||
: G4UserEventAction(),
|
||||
fMessenger(this),
|
||||
fVerboseLevel(fgkDefaultVerboseLevel),
|
||||
fSaveRndm(false)
|
||||
{
|
||||
/// Standard constructor
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4EventAction01::~ExG4EventAction01()
|
||||
{
|
||||
/// Destructor
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4EventAction01::BeginOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Print event info
|
||||
//
|
||||
G4int eventNumber = event->GetEventID();
|
||||
|
||||
// Print verbose info
|
||||
//
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "<<< Event " << eventNumber << " started." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4EventAction01::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Print verbose info
|
||||
//
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "<<< Event " << event->GetEventID() << " ended." << G4endl;
|
||||
}
|
||||
|
||||
// Save rndm status
|
||||
//
|
||||
if ( fSaveRndm ) {
|
||||
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
|
||||
G4int runNumber = run->GetRunID();
|
||||
G4int eventNumber = event->GetEventID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << "event" << eventNumber << ".rndm";
|
||||
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,93 +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$
|
||||
//
|
||||
/// \file ExG4EventAction01Messenger.cc
|
||||
/// \brief Implementation of the ExG4EventAction01Messenger class
|
||||
|
||||
#include "ExG4EventAction01Messenger.hh"
|
||||
#include "ExG4EventAction01.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4EventAction01Messenger::ExG4EventAction01Messenger(
|
||||
ExG4EventAction01* eventAction)
|
||||
: G4UImessenger(),
|
||||
fEventAction(eventAction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetVerboseLevelCmd(0),
|
||||
fSetSaveRndmCmd(0)
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/event/");
|
||||
fDirectory->SetGuidance("Event control");
|
||||
|
||||
fSetVerboseLevelCmd
|
||||
= new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
|
||||
fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
|
||||
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
|
||||
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
|
||||
|
||||
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
|
||||
fSetSaveRndmCmd
|
||||
->SetGuidance("Activate saving random number at endOfEvent.");
|
||||
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
|
||||
fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4EventAction01Messenger::~ExG4EventAction01Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetVerboseLevelCmd;
|
||||
delete fSetSaveRndmCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4EventAction01Messenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if(command == fSetVerboseLevelCmd) {
|
||||
fEventAction
|
||||
->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
else if ( command == fSetSaveRndmCmd ) {
|
||||
fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,129 +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$
|
||||
//
|
||||
/// \file ExG4RunAction01.cc
|
||||
/// \brief Implementation of the ExG4RunAction01 class
|
||||
|
||||
#include "ExG4RunAction01.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
//#include "G4ios.hh"
|
||||
//#include <iomanip>
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
const G4String ExG4RunAction01::fgkDefaultRndmFileName = "run0.rndm";
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4RunAction01::ExG4RunAction01()
|
||||
: G4UserRunAction(),
|
||||
fMessenger(this),
|
||||
fRndmFileName(fgkDefaultRndmFileName),
|
||||
fVerboseLevel(1),
|
||||
fSaveRndm(false),
|
||||
fReadRndm(false),
|
||||
fAutoSeed(false)
|
||||
{
|
||||
/// Standard constructor
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4RunAction01::~ExG4RunAction01()
|
||||
{
|
||||
/// Destructor
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4RunAction01::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
if ( fVerboseLevel > 0 ) {
|
||||
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
// read Rndm status
|
||||
if ( fReadRndm ) {
|
||||
G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
|
||||
G4Random::restoreEngineStatus(fRndmFileName);
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
// automatic (time-based) random seeds for each run
|
||||
if ( fAutoSeed ) {
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
|
||||
|
||||
G4cout << "*******************" << G4endl;
|
||||
G4cout << "*** AUTOSEED ON ***" << G4endl;
|
||||
G4cout << "*******************" << G4endl;
|
||||
|
||||
long seeds[2];
|
||||
time_t systime = time(NULL);
|
||||
seeds[0] = (long) systime;
|
||||
seeds[1] = (long) (systime*G4UniformRand());
|
||||
G4Random::setTheSeeds(seeds);
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
// save Rndm status
|
||||
if ( fSaveRndm ) {
|
||||
G4int runNumber = run->GetRunID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << ".rndm";
|
||||
G4Random::saveEngineStatus(fileName.str().c_str());
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
if ( G4VVisManager::GetConcreteInstance() ) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4RunAction01::EndOfRunAction(const G4Run* run)
|
||||
{
|
||||
// save Rndm status
|
||||
if ( fSaveRndm ) {
|
||||
G4int runNumber = run->GetRunID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << "end.rndm";
|
||||
G4Random::saveEngineStatus(fileName.str().c_str());
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
if ( G4VVisManager::GetConcreteInstance() ) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,122 +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$
|
||||
//
|
||||
/// \file ExG4RunAction01Messenger.cc
|
||||
/// \brief Implementation of the ExG4RunAction01Messenger class
|
||||
|
||||
#include "ExG4RunAction01Messenger.hh"
|
||||
#include "ExG4RunAction01.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
ExG4RunAction01Messenger::ExG4RunAction01Messenger(ExG4RunAction01* runAction)
|
||||
: G4UImessenger(),
|
||||
fRunAction (runAction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetVerboseLevelCmd(0),
|
||||
fSetSaveRndmCmd(0),
|
||||
fSetReadRndmCmd(0),
|
||||
fSetRndmFileNameCmd(0),
|
||||
fSetAutoSeedCmd(0)
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/event/");
|
||||
fDirectory->SetGuidance("Event control");
|
||||
|
||||
fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/run/verboseLevel",this);
|
||||
fSetVerboseLevelCmd->SetGuidance("Set run verbose level ." );
|
||||
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
|
||||
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
|
||||
|
||||
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/run/saveRndm",this);
|
||||
fSetSaveRndmCmd
|
||||
->SetGuidance("Activate saving random number at beginOfRun and endOfRun .");
|
||||
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
|
||||
fSetSaveRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetReadRndmCmd = new G4UIcmdWithABool("/ExG4/run/readRndm",this);
|
||||
fSetReadRndmCmd->SetGuidance("Get rndm status from an external file at beginOfRun.");
|
||||
fSetReadRndmCmd->SetParameterName("ReadRndm",false);
|
||||
fSetReadRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetRndmFileNameCmd = new G4UIcmdWithAString("/ExG4/run/rndmFileName",this);
|
||||
fSetRndmFileNameCmd->SetGuidance("Set rndm file name (to read from).");
|
||||
fSetRndmFileNameCmd->SetParameterName("RndmFileName",false);
|
||||
fSetRndmFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetAutoSeedCmd = new G4UIcmdWithABool("/ExG4/run/autoSeed",this);
|
||||
fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
|
||||
fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
|
||||
fSetAutoSeedCmd->SetGuidance(" false: use command 'random/resetEngineFrom'");
|
||||
fSetAutoSeedCmd->SetParameterName("AutoSeed",false);
|
||||
fSetAutoSeedCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
ExG4RunAction01Messenger::~ExG4RunAction01Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetVerboseLevelCmd;
|
||||
delete fSetSaveRndmCmd;
|
||||
delete fSetReadRndmCmd;
|
||||
delete fSetRndmFileNameCmd;
|
||||
delete fSetAutoSeedCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void ExG4RunAction01Messenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
{
|
||||
if ( command == fSetVerboseLevelCmd ) {
|
||||
fRunAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
else if ( command == fSetSaveRndmCmd ) {
|
||||
fRunAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
else if ( command == fSetReadRndmCmd ) {
|
||||
fRunAction->SetReadRndm(fSetReadRndmCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
else if (command == fSetRndmFileNameCmd) {
|
||||
fRunAction->SetRndmFileName(newValues);
|
||||
}
|
||||
else if ( command == fSetAutoSeedCmd ) {
|
||||
fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
+7
-7
@@ -25,27 +25,27 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PhysicsList00.cc
|
||||
/// \brief Implementation of the ExG4PhysicsList00 class
|
||||
/// \file GeantinoPhysicsList.cc
|
||||
/// \brief Implementation of the GeantinoPhysicsList class
|
||||
|
||||
#include "ExG4PhysicsList00.hh"
|
||||
#include "GeantinoPhysicsList.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PhysicsList00::ExG4PhysicsList00()
|
||||
GeantinoPhysicsList::GeantinoPhysicsList()
|
||||
: G4VUserPhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PhysicsList00::~ExG4PhysicsList00()
|
||||
GeantinoPhysicsList::~GeantinoPhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4PhysicsList00::ConstructParticle()
|
||||
void GeantinoPhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
@@ -58,7 +58,7 @@ void ExG4PhysicsList00::ConstructParticle()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4PhysicsList00::ConstructProcess()
|
||||
void GeantinoPhysicsList::ConstructProcess()
|
||||
{
|
||||
// Define transportation process
|
||||
|
||||
+9
-9
@@ -25,37 +25,37 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PrimaryGeneratorAction02.cc
|
||||
/// \brief Implementation of the ExG4PrimaryGeneratorAction02 class
|
||||
/// \file GpsPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the GpsPrimaryGeneratorActionclass
|
||||
|
||||
#include "ExG4PrimaryGeneratorAction02.hh"
|
||||
#include "GpsPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
const G4String ExG4PrimaryGeneratorAction02::fgkDefaultParticleName = "e-";
|
||||
const G4double ExG4PrimaryGeneratorAction02::fgkDefaultEnergy = 1*MeV;
|
||||
const G4String GpsPrimaryGeneratorAction::fgkDefaultParticleName = "e-";
|
||||
const G4double GpsPrimaryGeneratorAction::fgkDefaultEnergy = 1.*MeV;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction02::ExG4PrimaryGeneratorAction02()
|
||||
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fGeneralParticleSource(0)
|
||||
fGeneralParticleSource(nullptr)
|
||||
{
|
||||
fGeneralParticleSource = new G4GeneralParticleSource();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction02::~ExG4PrimaryGeneratorAction02()
|
||||
GpsPrimaryGeneratorAction::~GpsPrimaryGeneratorAction()
|
||||
{
|
||||
delete fGeneralParticleSource;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4PrimaryGeneratorAction02::GeneratePrimaries(G4Event* anEvent)
|
||||
void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// this function is called at the begining of event
|
||||
|
||||
+7
-7
@@ -25,10 +25,10 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PrimaryGeneratorAction01.cc
|
||||
/// \brief Implementation of the ExG4PrimaryGeneratorAction01 class
|
||||
/// \file GunPrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the GunPrimaryGeneratorAction class
|
||||
|
||||
#include "ExG4PrimaryGeneratorAction01.hh"
|
||||
#include "GunPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
@@ -37,13 +37,13 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
|
||||
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
|
||||
const G4String& particleName,
|
||||
G4double energy,
|
||||
G4ThreeVector position,
|
||||
G4ThreeVector momentumDirection)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
fParticleGun(nullptr)
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
@@ -60,14 +60,14 @@ ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction01::~ExG4PrimaryGeneratorAction01()
|
||||
GunPrimaryGeneratorAction::~GunPrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4PrimaryGeneratorAction01::GeneratePrimaries(G4Event* anEvent)
|
||||
void GunPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// this function is called at the begining of event
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
/// \file testCommon.cc
|
||||
/// \brief Test program for the common classes
|
||||
|
||||
#include "ExG4DetectorConstruction01.hh"
|
||||
#include "ExG4DetectorConstruction02.hh"
|
||||
#include "ExG4PhysicsList00.hh"
|
||||
#include "ExG4PrimaryGeneratorAction01.hh"
|
||||
#include "ExG4PrimaryGeneratorAction02.hh"
|
||||
#include "ExG4EventAction01.hh"
|
||||
#include "ExG4RunAction01.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorConstruction0.hh"
|
||||
#include "GeantinoPhysicsList.hh"
|
||||
#include "GpsPrimaryGeneratorAction.hh"
|
||||
#include "GunPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Test program which only instantiates classes defined in
|
||||
// examples/common
|
||||
|
||||
@@ -47,38 +47,27 @@ int main()
|
||||
{
|
||||
// First construct necessary classes
|
||||
//
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
auto runManager = new G4RunManager;
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
// Instantiate all detector construction classes
|
||||
ExG4DetectorConstruction01* detectorConstruction01
|
||||
= new ExG4DetectorConstruction01;
|
||||
ExG4DetectorConstruction02* detectorConstruction02
|
||||
= new ExG4DetectorConstruction02;
|
||||
auto detectorConstruction = new DetectorConstruction;
|
||||
auto detectorConstruction0 = new DetectorConstruction0;
|
||||
|
||||
// Instantiate all physics list classes
|
||||
ExG4PhysicsList00* physicsList00 = new ExG4PhysicsList00();
|
||||
auto geantinoPhysicsList = new GeantinoPhysicsList();
|
||||
|
||||
// Instantiate all primary generator actions classes
|
||||
ExG4PrimaryGeneratorAction01* primaryGeneratorAction01
|
||||
= new ExG4PrimaryGeneratorAction01();
|
||||
ExG4PrimaryGeneratorAction02* primaryGeneratorAction02
|
||||
= new ExG4PrimaryGeneratorAction02();
|
||||
|
||||
// Instantiate all user actions classes
|
||||
ExG4EventAction01* eventAction01 = new ExG4EventAction01();
|
||||
ExG4RunAction01* runAction01 = new ExG4RunAction01();
|
||||
auto gpsPrimaryGeneratorAction = new GpsPrimaryGeneratorAction();
|
||||
auto gunPrimaryGeneratorAction = new GunPrimaryGeneratorAction();
|
||||
|
||||
// delete all
|
||||
delete detectorConstruction01;
|
||||
delete detectorConstruction02;
|
||||
delete physicsList00;
|
||||
delete primaryGeneratorAction01;
|
||||
delete primaryGeneratorAction02;
|
||||
delete eventAction01;
|
||||
delete runAction01;
|
||||
|
||||
return 0;
|
||||
delete detectorConstruction;
|
||||
delete detectorConstruction0;
|
||||
delete geantinoPhysicsList;
|
||||
delete gpsPrimaryGeneratorAction;
|
||||
delete gunPrimaryGeneratorAction;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user