Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,529 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplication.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplication.cc,v 1.12.2.2 2006/06/29 16:08:29 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplication.hh"
#include "RadmonApplicationOptions.hh"
#include "RadmonDetectorLayout.hh"
#include "RadmonDetectorConstruction.hh"
#include "RadmonDetectorLabelledEntitiesConstructorsFactory.hh"
#include "RadmonDetectorMessenger.hh"
#include "RadmonGeneratorLayout.hh"
#include "RadmonPrimaryGeneratorAction.hh"
#include "RadmonGeneratorsWithLabelFactory.hh"
#include "RadmonGeneratorMessenger.hh"
#include "RadmonPhysicsLayout.hh"
#include "RadmonPhysicsList.hh"
#include "RadmonSubPhysicsListWithLabelFactory.hh"
#include "RadmonPhysicsMessenger.hh"
#ifdef G4ANALYSIS_USE
#include "RadmonAnalysisLayout.hh"
#include "RadmonAnalysis.hh"
#include "RadmonDataAnalysisWithLabelFactory.hh"
#include "RadmonAnalysisMessenger.hh"
#endif /* G4ANALYSIS_USE */
#include "RadmonEventAction.hh"
#include "RadmonSteppingAction.hh"
#include "RadmonApplicationMessenger.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIdirectory.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif /* G4VIS_USE */
RadmonApplication :: RadmonApplication(const RadmonApplicationOptions & options)
:
RadmonApplicationDetectorSetup(options),
RadmonApplicationGeneratorSetup(options),
RadmonApplicationPhysicsSetup(options),
#ifdef G4ANALYSIS_USE
RadmonApplicationAnalysisSetup(options),
#endif /* G4ANALYSIS_USE */
valid(false),
runManager(0),
detectorLayout(0),
generatorLayout(0),
physicsLayout(0),
#ifdef G4ANALYSIS_USE
analysisLayout(0),
#endif /* G4ANALYSIS_USE */
detectorsFactory(0),
generatorsFactory(0),
physicsFactory(0),
#ifdef G4ANALYSIS_USE
analysisFactory(0),
analysis(0),
#endif /* G4ANALYSIS_USE */
#ifdef G4VIS_USE
visManager(0),
#endif /* G4VIS_USE */
uiManager(0),
detectorMessenger(0),
generatorMessenger(0),
physicsMessenger(0),
#ifdef G4ANALYSIS_USE
analysisMessenger(0),
#endif /* G4ANALYSIS_USE */
applicationMessenger(0),
session(0),
directory(0)
{
// Construct the default run manager
runManager=new G4RunManager();
if (runManager==0)
{
G4cerr << options.ApplicationName() << ": Run manager not allocated." << G4endl;
return;
}
// Construct the detector layout
detectorLayout=new RadmonDetectorLayout;
if (detectorLayout==0)
{
G4cerr << options.ApplicationName() << ": Detector layout not allocated." << G4endl;
return;
}
// Construct the generator layout
generatorLayout=new RadmonGeneratorLayout;
if (generatorLayout==0)
{
G4cerr << options.ApplicationName() << ": Generator layout not allocated." << G4endl;
return;
}
// Construct the physics list layout
physicsLayout=new RadmonPhysicsLayout;
if (physicsLayout==0)
{
G4cerr << options.ApplicationName() << ": Physics list layout not allocated." << G4endl;
return;
}
// Construct the analysis list layout
#ifdef G4ANALYSIS_USE
analysisLayout=new RadmonAnalysisLayout;
if (analysisLayout==0)
{
G4cerr << options.ApplicationName() << ": Analysis layout not allocated." << G4endl;
return;
}
#endif /* G4ANALYSIS_USE */
// Construct the detectors factory
detectorsFactory=new RadmonDetectorLabelledEntitiesConstructorsFactory;
if (detectorsFactory==0)
{
G4cerr << options.ApplicationName() << ": Detectors factory not allocated." << G4endl;
return;
}
// Construct the entity constructors
if (!CreateDetectorEntityConstructors(detectorsFactory))
{
G4cerr << options.ApplicationName() << ": Entity constructors not allocated." << G4endl;
return;
}
// Construct the generators factory
generatorsFactory=new RadmonGeneratorsWithLabelFactory;
if (generatorsFactory==0)
{
G4cerr << options.ApplicationName() << ": Generators factory not allocated." << G4endl;
return;
}
// Construct the generators algorithms
if (!CreateGenerators(generatorsFactory))
{
G4cerr << options.ApplicationName() << ": Generator algorithms not allocated." << G4endl;
return;
}
// Construct the physics list factory
physicsFactory=new RadmonSubPhysicsListWithLabelFactory;
if (physicsFactory==0)
{
G4cerr << options.ApplicationName() << ": Physics list factory not allocated." << G4endl;
return;
}
// Construct the sub physics lists
if (!CreateSubPhysicsList(physicsFactory))
{
G4cerr << options.ApplicationName() << ": Sub physics lists not allocated." << G4endl;
return;
}
// Construct the analysis list factory
#ifdef G4ANALYSIS_USE
analysisFactory=new RadmonDataAnalysisWithLabelFactory;
if (analysisFactory==0)
{
G4cerr << options.ApplicationName() << ": Analysis factory not allocated." << G4endl;
return;
}
// Construct the data analyses
if (!CreateDataAnalysis(analysisFactory))
{
G4cerr << options.ApplicationName() << ": Data analyses not allocated." << G4endl;
return;
}
#endif /* G4ANALYSIS_USE */
// Construct the physics list
RadmonPhysicsList * physicsList(new RadmonPhysicsList(physicsLayout, physicsFactory));
if (physicsList==0)
{
G4cerr << options.ApplicationName() << ": Physics list not allocated." << G4endl;
return;
}
// The subphysics list factory will be owned by the physicsList
physicsFactory=0;
runManager->SetUserInitialization(physicsList);
// Construct the detector construction
RadmonDetectorConstruction * detectorConstruction(new RadmonDetectorConstruction(detectorLayout, detectorsFactory));
if (detectorConstruction==0)
{
G4cerr << options.ApplicationName() << ": Detector construction not allocated." << G4endl;
return;
}
// The detectors factory will be owned by the detectorConstruction
detectorsFactory=0;
runManager->SetUserInitialization(detectorConstruction);
// Construct the primary generator
RadmonPrimaryGeneratorAction * primaryGenerator(new RadmonPrimaryGeneratorAction(generatorLayout, generatorsFactory));
if (detectorConstruction==0)
{
G4cerr << options.ApplicationName() << ": Primary generator not allocated." << G4endl;
return;
}
// The primary generators factory will be owned by the primaryGenerator
generatorsFactory=0;
runManager->SetUserAction(primaryGenerator);
// Construct the analysis
#ifdef G4ANALYSIS_USE
AIDA::IAnalysisFactory * aida(AIDA_createAnalysisFactory());
if (aida==0)
{
G4cerr << options.ApplicationName() << ": AIDA_createAnalysisFactory returned 0." << G4endl;
return;
}
analysis=new RadmonAnalysis(analysisLayout, analysisFactory, aida);
if (analysis==0)
{
delete aida;
G4cerr << options.ApplicationName() << ": Analysis not allocated." << G4endl;
return;
}
// The data analyses factory will be owned by the analysis
analysisFactory=0;
RadmonEventAction * eventAction(RadmonEventAction::Instance());
eventAction->AttachObserver(analysis);
#endif /* G4ANALYSIS_USE */
// Initialize the run manager (disabled in order to have UI physics list)
// runManager->Initialize();
// Construct the visualization manager
#ifdef G4VIS_USE
G4VisManager * visManager(new G4VisExecutive);
if (visManager==0)
{
G4cerr << options.ApplicationName() << ": Vis manager not allocated." << G4endl;
return;
}
visManager->Initialize();
#endif /* G4VIS_USE */
// Gets the user interface
uiManager = G4UImanager::GetUIpointer();
if (uiManager==0)
{
G4cerr << options.ApplicationName() << ": UI manager not allocated." << G4endl;
return;
}
// Construct the Radmon directory
directory = new G4UIdirectory("/radmon/");
if (directory==0)
{
G4cerr << options.ApplicationName() << ": Radmon directory not allocated." << G4endl;
return;
}
directory->SetGuidance("Radmon application directory.");
// Construct the messenger to modify the detector layout
detectorMessenger=new RadmonDetectorMessenger(detectorLayout);
if (detectorMessenger==0)
{
G4cerr << options.ApplicationName() << ": Detector layout messenger not allocated." << G4endl;
return;
}
// Construct the messenger to modify the generator layout
generatorMessenger=new RadmonGeneratorMessenger(generatorLayout);
if (generatorMessenger==0)
{
G4cerr << options.ApplicationName() << ": Generator layout messenger not allocated." << G4endl;
return;
}
// Construct the messenger to modify the physics list layout
physicsMessenger=new RadmonPhysicsMessenger(physicsLayout);
if (physicsMessenger==0)
{
G4cerr << options.ApplicationName() << ": Physics list layout messenger not allocated." << G4endl;
return;
}
// Construct the messenger to modify the analysis layout
#ifdef G4ANALYSIS_USE
analysisMessenger=new RadmonAnalysisMessenger(analysisLayout);
if (analysisMessenger==0)
{
G4cerr << options.ApplicationName() << ": Analysis layout messenger not allocated." << G4endl;
return;
}
#endif /* G4ANALYSIS_USE */
// Construct the messenger to modify applications options
applicationMessenger=new RadmonApplicationMessenger;
if (applicationMessenger==0)
{
G4cerr << options.ApplicationName() << ": Application messenger not allocated." << G4endl;
return;
}
// Construct the interactive session
if (options.Interactive())
{
session=new G4UIterminal(new G4UItcsh);
if (session==0)
{
G4cerr << options.ApplicationName() << ": Interactive session not allocated." << G4endl;
return;
}
}
// Runs startup macros
RunMacro(options, options.StartupFileName());
if (options.FileName())
if (!RunMacro(options, options.FileName()))
{
G4cerr << options.ApplicationName() << ": File \"" << options.FileName() << "\" not found." << G4endl;
return;
}
// Runs the interactive session
if (options.Interactive())
{
if (options.Verbose())
G4cout << options.ApplicationName() << ": Interactive session starts ..." << G4endl;
session->SessionStart();
}
valid=true;
}
RadmonApplication :: ~RadmonApplication()
{
// Desctruct the interactive session
delete session;
// Destruct the messenger to modify applications options
delete applicationMessenger;
// Destruct the analysis messenger to modify the layout
#ifdef G4ANALYSIS_USE
delete analysisMessenger;
#endif /* G4ANALYSIS_USE */
// Destruct the physics list messenger to modify the layout
delete physicsMessenger;
// Destruct the generator messenger to modify the layout
delete generatorMessenger;
// Destruct the detector messenger to modify the layout
delete detectorMessenger;
// Destruct the Radmon directory
delete directory;
// Destruct the visualization manager
#ifdef G4VIS_USE
delete visManager;
#endif /* G4VIS_USE */
// Destruct the analysis
#ifdef G4ANALYSIS_USE
delete analysis;
// Destruct the analyses factory
delete analysisFactory;
#endif /* G4ANALYSIS_USE */
// Destruct the sub physics list factory
delete physicsFactory;
// Destruct the generators factory
delete generatorsFactory;
// Destruct the detectors factory
delete detectorsFactory;
// Destruct the default run manager
delete runManager;
// Destruct the analysis layout
#ifdef G4ANALYSIS_USE
delete analysisLayout;
#endif /* G4ANALYSIS_USE */
// Destruct the physics list layout
delete physicsLayout;
// Destruct the generator layout
delete generatorLayout;
// Destruct the detector layout
delete detectorLayout;
}
G4bool RadmonApplication :: RunMacro(const RadmonApplicationOptions & options, const char * fileName)
{
std::ifstream test(fileName);
if (!test.good())
return false;
test.close();
if (options.Verbose())
G4cout << options.ApplicationName() << ": Running macro \"" << fileName << "\" ..." << G4endl;
G4String command("/control/execute ");
command+=fileName;
uiManager->ApplyCommand(command);
return true;
}
@@ -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. *
// ********************************************************************
//
//
// File name: RadmonApplicationAnalysisSetup.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationAnalysisSetup.cc,v 1.3.2.2 2006/06/29 16:08:31 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationAnalysisSetup.hh"
#include "RadmonApplicationOptions.hh"
#ifdef G4ANALYSIS_USE
#include "RadmonDataAnalysisDepositedEnergy.hh"
#include "RadmonDataAnalysisWithLabelFactory.hh"
#define DECLARE_ANALYSIS_CONSTRUCTOR(name) constructor=new name(); \
if (constructor==0) \
{ \
G4cerr << currentOptions.ApplicationName() << ": Cannot allocate " #name "." << G4endl; \
return false; \
} \
factory->AppendDataAnalysisWithLabel(constructor)
G4bool RadmonApplicationAnalysisSetup :: CreateDataAnalysis(RadmonDataAnalysisWithLabelFactory * factory)
{
RadmonVDataAnalysisWithLabel * constructor;
DECLARE_ANALYSIS_CONSTRUCTOR(RadmonDataAnalysisDepositedEnergy);
return true;
}
#else /* G4ANALYSIS_USE */
G4bool RadmonApplicationAnalysisSetup :: CreateDataAnalysis(RadmonDataAnalysisWithLabelFactory * /* factory */)
{
return false;
}
#endif /* G4ANALYSIS_USE */
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationDetectorSetup.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationDetectorSetup.cc,v 1.1.2.2 2006/06/29 16:08:33 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationDetectorSetup.hh"
#include "RadmonApplicationOptions.hh"
#include "RadmonDetectorLabelledEntitiesConstructorsFactory.hh"
#include "RadmonDetectorFlatVolumeConstructor.hh"
#include "RadmonDetectorFlatVolumeWithHoleConstructor.hh"
#include "RadmonDetectorFlatVolumeWithGroundConstructor.hh"
#include "RadmonDetectorFlatVolumeWithGroundAndKeyMarksConstructor.hh"
#include "RadmonDetectorFlatVolumeWithGroundAndKeyMarksAndHoleConstructor.hh"
#include "RadmonDetectorFlatVolumeWithTracksConstructor.hh"
#include "RadmonDetectorFlatVolumeWithPinsConstructor.hh"
#include "RadmonDetectorFlatVolumeWithPadsConstructor.hh"
#include "RadmonDetectorFlatVolumeWithTracksAndHoleConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithHoleConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithGroundConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithGroundAndKeyMarksConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithGroundAndKeyMarksAndHoleConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithTracksConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithPinsConstructor.hh"
#include "RadmonDetectorCarvedFlatVolumeWithTracksAndHoleConstructor.hh"
#define DECLARE_DETECTOR_CONSTRUCTOR(name) constructor=new name(); \
if (constructor==0) \
{ \
G4cerr << currentOptions.ApplicationName() << ": Cannot allocate " #name "." << G4endl; \
return false; \
} \
factory->AppendLabelledEntityConstructor(constructor)
G4bool RadmonApplicationDetectorSetup :: CreateDetectorEntityConstructors(RadmonDetectorLabelledEntitiesConstructorsFactory * factory)
{
RadmonVDetectorLabelledEntityConstructor * constructor;
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithHoleConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithGroundConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithGroundAndKeyMarksConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithGroundAndKeyMarksAndHoleConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithTracksConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithPinsConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithTracksAndHoleConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorFlatVolumeWithPadsConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithHoleConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithTracksConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithPinsConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithTracksAndHoleConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithGroundConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithGroundAndKeyMarksConstructor);
DECLARE_DETECTOR_CONSTRUCTOR(RadmonDetectorCarvedFlatVolumeWithGroundAndKeyMarksAndHoleConstructor);
return true;
}
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationEventNumbering.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationEventNumbering.cc,v 1.3 2006/06/29 16:08:35 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationEventNumbering.hh"
#include "G4Event.hh"
void RadmonApplicationEventNumbering :: OnBeginOfEvent(const G4Event * event)
{
if (dumpEvery==0)
return;
G4int eventId(event->GetEventID());
if ((eventId%dumpEvery) == 0)
G4cout << "RadmonApplicationEventNumbering::OnBeginOfEvent: Begin of event " << eventId << '.' << G4endl;
}
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationEventTracks.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationEventTracks.cc,v 1.3 2006/06/29 16:08:37 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationEventTracks.hh"
#include "G4Event.hh"
#include "G4VVisManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4VTrajectory.hh"
void RadmonApplicationEventTracks :: OnEndOfEvent(const G4Event * event)
{
if (!G4VVisManager::GetConcreteInstance())
return;
G4TrajectoryContainer * trajectoryContainer(event->GetTrajectoryContainer());
if (!trajectoryContainer)
return;
G4int nTrajectories(trajectoryContainer->entries());
while (nTrajectories)
{
nTrajectories--;
(*trajectoryContainer)[nTrajectories]->DrawTrajectory(0);
}
}
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationGeneratorSetup.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationGeneratorSetup.cc,v 1.3 2006/06/29 16:08:39 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationGeneratorSetup.hh"
#include "RadmonApplicationOptions.hh"
#include "RadmonGeneratorFixedPosition.hh"
#include "RadmonGeneratorFixedDirection.hh"
#include "RadmonGeneratorFixedEnergy.hh"
#include "RadmonGeneratorFixedParticle.hh"
#include "RadmonGeneratorUniformSphere.hh"
#include "RadmonGeneratorUniformPlane.hh"
#include "RadmonGeneratorsWithLabelFactory.hh"
#define DECLARE_GENERATOR_CONSTRUCTOR(name) constructor=new name(); \
if (constructor==0) \
{ \
G4cerr << currentOptions.ApplicationName() << ": Cannot allocate " #name "." << G4endl; \
return false; \
} \
factory->AppendGenerator(constructor)
G4bool RadmonApplicationGeneratorSetup :: CreateGenerators(RadmonGeneratorsWithLabelFactory * factory)
{
RadmonVGeneratorWithLabel * constructor;
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorFixedPosition);
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorFixedDirection);
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorFixedEnergy);
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorFixedParticle);
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorUniformSphere);
DECLARE_GENERATOR_CONSTRUCTOR(RadmonGeneratorUniformPlane);
return true;
}
@@ -0,0 +1,185 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationMessenger.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationMessenger.cc,v 1.1.2.2 2006/06/29 16:08:41 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Messenger commands path
#define COMMANDS_PATH "/radmon/application/"
// Include files
#include "RadmonApplicationMessenger.hh"
#include "RadmonApplicationEventNumbering.hh"
#include "RadmonApplicationEventTracks.hh"
#include "RadmonApplicationRunNumbering.hh"
#include "RadmonEventAction.hh"
#include "RadmonRunAction.hh"
RadmonApplicationMessenger :: RadmonApplicationMessenger()
:
RadmonMessenger(COMMANDS_PATH, "Interactive application options."),
eventNumbering(new RadmonApplicationEventNumbering),
eventTracks(new RadmonApplicationEventTracks),
runNumbering(new RadmonApplicationRunNumbering),
RADMON_INITIALIZE_COMMAND(EnableRunsDump),
RADMON_INITIALIZE_COMMAND(DisableRunsDump),
RADMON_INITIALIZE_COMMAND(DumpEventsEvery),
RADMON_INITIALIZE_COMMAND(DisableEventsDump),
RADMON_INITIALIZE_COMMAND(EnableTracksVisualisation),
RADMON_INITIALIZE_COMMAND(DisableTracksVisualisation)
{
RadmonEventAction * eventAction(RadmonEventAction::Instance());
eventAction->AttachObserver(eventNumbering);
eventAction->AttachObserver(eventTracks);
RadmonRunAction * runAction(RadmonRunAction::Instance());
runAction->AttachObserver(runNumbering);
RADMON_CREATE_COMMAND_0ARGS(EnableRunsDump, "Disables the run number dump");
RADMON_CREATE_COMMAND_0ARGS(DisableRunsDump, "Enables the run number dump");
RADMON_CREATE_COMMAND_1ARG (DumpEventsEvery, "Enables the event number dump every n events", "nEvents");
RADMON_CREATE_COMMAND_0ARGS(DisableEventsDump, "Disables the event number dump");
#ifdef G4VIS_USE
RADMON_CREATE_COMMAND_0ARGS(EnableTracksVisualisation, "Enables the tracks plotting at the end of the event");
RADMON_CREATE_COMMAND_0ARGS(DisableTracksVisualisation, "Disables the tracks plotting at the end of the event");
#endif /* G4VIS_USE */
}
RadmonApplicationMessenger :: ~RadmonApplicationMessenger()
{
#ifdef G4VIS_USE
RADMON_DESTROY_COMMAND(DisableTracksVisualisation);
RADMON_DESTROY_COMMAND(EnableTracksVisualisation);
#endif /* G4VIS_USE */
RADMON_DESTROY_COMMAND(DisableEventsDump);
RADMON_DESTROY_COMMAND(DumpEventsEvery);
RADMON_DESTROY_COMMAND(DisableRunsDump);
RADMON_DESTROY_COMMAND(EnableRunsDump);
RadmonEventAction * eventAction(RadmonEventAction::Instance());
eventAction->DetachObserver(eventNumbering);
delete eventNumbering;
eventAction->DetachObserver(eventTracks);
delete eventTracks;
RadmonRunAction * runAction(RadmonRunAction::Instance());
runAction->DetachObserver(runNumbering);
delete runNumbering;
}
G4String RadmonApplicationMessenger :: GetCurrentValue(G4UIcommand * /* command */)
{
G4cout << "RadmonApplicationMessenger::GetCurrentValue(): Not supported" << G4endl;
return G4String();
}
void RadmonApplicationMessenger :: SetNewValue(G4UIcommand * command, G4String newValue)
{
RADMON_BEGIN_LIST_SET_COMMANDS
RADMON_SET_COMMAND(EnableRunsDump)
RADMON_SET_COMMAND(DisableRunsDump)
RADMON_SET_COMMAND(DumpEventsEvery)
RADMON_SET_COMMAND(DisableEventsDump)
RADMON_SET_COMMAND(EnableTracksVisualisation)
RADMON_SET_COMMAND(DisableTracksVisualisation)
RADMON_END_LIST_SET_COMMANDS
}
// Events
void RadmonApplicationMessenger :: OnEnableRunsDump(const G4String & /* value */)
{
runNumbering->Enable();
}
void RadmonApplicationMessenger :: OnDisableRunsDump(const G4String & /* value */)
{
runNumbering->Disable();
}
void RadmonApplicationMessenger :: OnDumpEventsEvery(const G4String & value)
{
G4String args;
if (!ProcessArguments(value, 1, & args))
return;
G4int every(G4UIcommand::ConvertToInt(args));
if (every<=0)
{
G4cout << "RadmonApplicationMessenger::OnDumpEventsEvery: nEvents must be positive." << G4endl;
return;
}
eventNumbering->SetDumpEvery(every);
}
void RadmonApplicationMessenger :: OnDisableEventsDump(const G4String & /* value */)
{
eventNumbering->SetDumpEvery(0);
}
void RadmonApplicationMessenger :: OnEnableTracksVisualisation(const G4String & /* value */)
{
eventTracks->Enable();
}
void RadmonApplicationMessenger :: OnDisableTracksVisualisation(const G4String & /* value */)
{
eventTracks->Disable();
}
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationOptions.cc
// Creation date: Sep 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationOptions.cc,v 1.5 2006/06/29 16:08:43 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationOptions.hh"
RadmonApplicationOptions :: RadmonApplicationOptions(int argc, char * * argv)
:
valid(true),
interactive(true),
verbose(false),
help(false),
applicationName(argv[0]),
fileName(0),
startupFileName(".startup.mac")
{
int i(1);
G4bool fileNameGiven(false);
while (i<argc)
{
if (argv[i][0]=='-' && argv[i][2]==0)
{
switch(argv[i][1])
{
case '?':
case 'H':
case 'h':
help=true;
return;
case 'b':
case 'B':
interactive=false;
break;
case 'v':
case 'V':
verbose=true;
break;
default:
G4cerr << applicationName << ": Command " << argv[i] << " unknown. Run \"" << applicationName << " -h\" for help." << G4endl;
valid=false;
return;
}
}
else
{
if (fileNameGiven)
{
G4cerr << applicationName << ": Bad syntax. Run \"" << applicationName << " -h\" for help." << G4endl;
valid=false;
return;
}
fileNameGiven=true;
fileName=argv[i];
}
i++;
}
}
void RadmonApplicationOptions :: DumpHelp(void) const
{
G4cout << "Usage: " << applicationName << " [-h|-H|-?] [-b] [-v] [<filename>]" << G4endl;
G4cout << G4endl;
G4cout << "-h -H -? Usage help" << G4endl;
G4cout << "-b Force non-interactive mode" << G4endl;
G4cout << "-v Verbose output" << G4endl;
G4cout << "<filename> Name of the macro to be run" << G4endl;
G4cout << G4endl;
G4cout << "If \"" << startupFileName << "\" is present, it will be run before anything else." << G4endl;
G4cout << G4endl;
}
@@ -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. *
// ********************************************************************
//
//
// File name: RadmonApplicationPhysicsSetup.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationPhysicsSetup.cc,v 1.4.2.2 2006/06/29 16:08:45 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationPhysicsSetup.hh"
#include "RadmonApplicationOptions.hh"
#include "RadmonSubPhysicsListWithLabelFactory.hh"
#include "RadmonPhysicsElectronEEDL.hh"
#include "RadmonPhysicsElectronStandard.hh"
#include "RadmonPhysicsPhotonEPDL.hh"
#include "RadmonPhysicsPhotonStandard.hh"
#include "RadmonPhysicsPositronStandard.hh"
#include "RadmonPhysicsMuonStandard.hh"
#include "RadmonPhysicsTauStandard.hh"
#include "RadmonPhysicsNuclear.hh"
#include "RadmonPhysicsDecay.hh"
#include "RadmonPhysicsNeutronBinary.hh"
#include "RadmonPhysicsNeutronBertini.hh"
#include "RadmonPhysicsHadronsBinary.hh"
#include "RadmonPhysicsHadronsBertini.hh"
#include "RadmonPhysicsICRUIonization.hh"
#include "RadmonPhysicsProductionCuts.hh"
#define DECLARE_SUBPHYSICS_LIST(name) subPhysicsList=new name(); \
if (subPhysicsList==0) \
{ \
G4cerr << currentOptions.ApplicationName() << ": Cannot allocate " #name "." << G4endl; \
return false; \
} \
factory->AppendSubPhysicsListWithLabel(subPhysicsList)
G4bool RadmonApplicationPhysicsSetup :: CreateSubPhysicsList(RadmonSubPhysicsListWithLabelFactory * factory)
{
RadmonVSubPhysicsListWithLabel * subPhysicsList;
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsElectronEEDL);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsElectronStandard);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsPhotonEPDL);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsPhotonStandard);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsPositronStandard);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsMuonStandard);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsTauStandard);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsNuclear);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsDecay);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsNeutronBinary);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsNeutronBertini);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsHadronsBinary);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsHadronsBertini);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsICRUIonization);
DECLARE_SUBPHYSICS_LIST(RadmonPhysicsProductionCuts);
return true;
}
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// File name: RadmonApplicationRunNumbering.cc
// Creation date: Nov 2005
// Main author: Riccardo Capra <capra@ge.infn.it>
//
// Id: $Id: RadmonApplicationRunNumbering.cc,v 1.3 2006/06/29 16:08:47 gunter Exp $
// Tag: $Name: geant4-08-01 $
//
// Include files
#include "RadmonApplicationRunNumbering.hh"
#include "G4Run.hh"
void RadmonApplicationRunNumbering :: OnBeginOfRun(const G4Run * run)
{
if (!enable)
return;
G4cout << "RadmonApplicationRunNumbering::OnBeginOfRun: Begin of run " << run->GetRunID() << '.' << G4endl;
}