Import Geant4 4.0.0 source tree
This commit is contained in:
+108
-75
@@ -38,6 +38,12 @@
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
//
|
||||
// 07.12.2001 A.Pfeiffer
|
||||
// - merged with Guy Barrand's AIDA 2.2 port
|
||||
//
|
||||
// 22.11.2001 G.Barrand
|
||||
// - Adaptation to AIDA
|
||||
//
|
||||
// 30.11.2000 M.G. Pia, R. Nartallo
|
||||
// - Simplification of code: removal of non-Lizard specific code
|
||||
// - Inheritance directly from the base class G4VAnalysisManager instead
|
||||
@@ -62,116 +68,143 @@
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4VAnalysisSystem.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include <IHistogramFactory.h>
|
||||
#include <AIDA/IAnalysisFactory.h>
|
||||
#include <AIDA/ITreeFactory.h>
|
||||
#include <AIDA/ITree.h>
|
||||
#include <AIDA/IHistogramFactory.h>
|
||||
#include <AIDA/IHistogram1D.h>
|
||||
#include <AIDA/IHistogram2D.h>
|
||||
#include <AIDA/IPlotterFactory.h>
|
||||
#include <AIDA/IPlotter.h>
|
||||
#endif
|
||||
|
||||
#ifdef G4ANALYSIS_USE_LIZARD
|
||||
#include <IHistogram1D.h>
|
||||
#include <IHistogram2D.h>
|
||||
#include "G4LizardSystem.hh"
|
||||
#endif
|
||||
#include "XrayTelAnalysis.hh"
|
||||
|
||||
#include "XrayTelAnalysisManager.hh"
|
||||
XrayTelAnalysis* XrayTelAnalysis::instance = 0;
|
||||
|
||||
#ifndef G4ANALYSIS_USE
|
||||
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
|
||||
XrayTelAnalysis::XrayTelAnalysis(int argc,char** argv)
|
||||
:analysisFactory(0)
|
||||
,tree(0)
|
||||
,enteringEnergyHistogram(0)
|
||||
,yzHistogram(0)
|
||||
{
|
||||
}
|
||||
XrayTelAnalysisManager::~XrayTelAnalysisManager()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
|
||||
:
|
||||
enteringEnergyHistogram(0),
|
||||
yzHistogram(0)
|
||||
{
|
||||
// The Lizard analysis system is provided here as default
|
||||
// other analysis systems will be implemented at a later stage
|
||||
analysisSystem = new G4LizardSystem;
|
||||
IHistogramFactory* hFactory = analysisSystem->GetHistogramFactory();
|
||||
// Hooking an AIDA compliant analysis system.
|
||||
analysisFactory = AIDA_createAnalysisFactory();
|
||||
if(analysisFactory) {
|
||||
|
||||
if(hFactory) {
|
||||
// Histogram creation :
|
||||
enteringEnergyHistogram = hFactory->create1D("Entering energy",100,0,0.5);
|
||||
// Book the histogram for the 2D position.
|
||||
// Instead of using a scatter plot, just book enough bins ...
|
||||
yzHistogram = hFactory->create2D("YZ",200, -50, 50, 200, -50, 50);
|
||||
ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
||||
if(treeFactory) {
|
||||
// tree = treeFactory->create(); // Tree in memory.
|
||||
tree = treeFactory->create("XrayTel.root",false,false,"ROOT");
|
||||
if(tree) {
|
||||
IHistogramFactory* hFactory =
|
||||
analysisFactory->createHistogramFactory(*tree);
|
||||
if(hFactory) {
|
||||
// Histogram creation (the below has a name and a label) :
|
||||
enteringEnergyHistogram =
|
||||
hFactory->create1D("ekin.vop","Entering energy",100,0,0.5);
|
||||
// Book the histogram for the 2D position.
|
||||
// Instead of using a scatter plot, just book enough bins ...
|
||||
yzHistogram =
|
||||
hFactory->create2D("position.vop","YZ",200, -50, 50, 200, -50, 50);
|
||||
delete hFactory;
|
||||
}
|
||||
}
|
||||
delete treeFactory; // Will not delete the ITree.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
The following lines set the plotter that is
|
||||
needed in this example for a multiple histograms
|
||||
visualization. Please see the README for more information
|
||||
*/
|
||||
IPlotterFactory* plotterFactory =
|
||||
analysisFactory->createPlotterFactory(argc,argv);
|
||||
if(plotterFactory) {
|
||||
plotter = plotterFactory->create();
|
||||
if(plotter) {
|
||||
// Map the plotter on screen :
|
||||
plotter->show();
|
||||
// Set the page title :
|
||||
plotter->setParameter("pageTitle","XrayTel");
|
||||
// Have two plotting regions (one column, two rows).
|
||||
plotter->createRegions(1,2);
|
||||
// Attach histograms to plotter regions :
|
||||
if(enteringEnergyHistogram) {
|
||||
plotter->plot(*enteringEnergyHistogram);
|
||||
plotter->next();
|
||||
}
|
||||
if(yzHistogram) {
|
||||
plotter->plot(*yzHistogram);
|
||||
}
|
||||
}
|
||||
delete plotterFactory;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
XrayTelAnalysisManager::~XrayTelAnalysisManager()
|
||||
XrayTelAnalysis::~XrayTelAnalysis()
|
||||
{
|
||||
// delete hFactory;
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete plotter;
|
||||
delete enteringEnergyHistogram;
|
||||
delete yzHistogram;
|
||||
delete analysisSystem;
|
||||
delete analysisFactory;
|
||||
#endif
|
||||
}
|
||||
|
||||
G4bool XrayTelAnalysisManager::RegisterAnalysisSystem(
|
||||
G4VAnalysisSystem* )
|
||||
XrayTelAnalysis* XrayTelAnalysis::getInstance(G4int argc, char** argv)
|
||||
{
|
||||
return true;
|
||||
if (instance == 0) instance = new XrayTelAnalysis(argc, argv);
|
||||
return instance;
|
||||
}
|
||||
|
||||
IHistogramFactory* XrayTelAnalysisManager::GetHistogramFactory(
|
||||
const G4String& aSystem)
|
||||
{
|
||||
return hFactory;
|
||||
|
||||
void XrayTelAnalysis::book(){
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(enteringEnergyHistogram) enteringEnergyHistogram->reset();
|
||||
if(yzHistogram) yzHistogram->reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void XrayTelAnalysisManager::Store(IHistogram* aHistogram,const G4String& aSID)
|
||||
{
|
||||
analysisSystem->Store(aHistogram,aSID);
|
||||
}
|
||||
void XrayTelAnalysisManager::Plot(IHistogram* aHistogram)
|
||||
{
|
||||
analysisSystem->Plot(aHistogram);
|
||||
}
|
||||
|
||||
void XrayTelAnalysisManager::BeginOfRun(){
|
||||
if(enteringEnergyHistogram)
|
||||
enteringEnergyHistogram->reset();
|
||||
if(yzHistogram)
|
||||
yzHistogram->reset();
|
||||
}
|
||||
void XrayTelAnalysisManager::EndOfRun(){
|
||||
void XrayTelAnalysis::finish(){
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// the following things cannot be done in Run::EndOfRun()
|
||||
// only now plot the energy of the particles
|
||||
if(enteringEnergyHistogram) {
|
||||
Plot(enteringEnergyHistogram);
|
||||
}
|
||||
// and store the histograms
|
||||
if(enteringEnergyHistogram) {
|
||||
Store(enteringEnergyHistogram,"ekin.vop");
|
||||
}
|
||||
if(yzHistogram) {
|
||||
Store(yzHistogram,"position.vop");
|
||||
}
|
||||
|
||||
if(tree) tree->commit(); // Write histos in file.
|
||||
|
||||
// Give control to the GUI so that someone
|
||||
// can play with the plotter. The plotter
|
||||
// should be equipped with an "escape" (button)
|
||||
// to return of the "interact" method.
|
||||
G4cout << "Click the escape button to continue..." << G4endl;
|
||||
if(plotter) plotter->interact();
|
||||
#endif
|
||||
}
|
||||
|
||||
void XrayTelAnalysisManager::Step(const G4SteppingManager* aSteppingManager) {
|
||||
if(!aSteppingManager) return;
|
||||
void XrayTelAnalysis::analyseStepping(const G4Track& track, G4bool entering) {
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
G4Track* track = aSteppingManager->GetTrack();
|
||||
G4ThreeVector pos = track->GetPosition();
|
||||
G4ThreeVector pos = track.GetPosition();
|
||||
|
||||
if(enteringEnergyHistogram) {
|
||||
enteringEnergyHistogram->fill(track->GetKineticEnergy());
|
||||
enteringEnergyHistogram->fill(track.GetKineticEnergy());
|
||||
}
|
||||
if(yzHistogram) {
|
||||
yzHistogram->fill(pos.y(), pos.z());
|
||||
Plot(yzHistogram);
|
||||
}
|
||||
if(plotter) plotter->refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: XrayTelAnalysis.cc-Anaphe,v 1.1 2001/12/10 16:06:37 pfeiffer Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
// Author: A. Pfeiffer (Andreas.Pfeiffer@cern.ch)
|
||||
// (copied from his UserAnalyser class)
|
||||
//
|
||||
// History:
|
||||
// -----------
|
||||
// 7 Nov 2001 MGP Implementation
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "XrayTelAnalysis.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
XrayTelAnalysis* XrayTelAnalysis::instance = 0;
|
||||
|
||||
XrayTelAnalysis::XrayTelAnalysis()
|
||||
{
|
||||
histoManager = createIHistoManager();
|
||||
ntFactory = Lizard::createNTupleFactory();
|
||||
vectorFactory = createIVectorFactory();
|
||||
plotter = createIPlotter();
|
||||
}
|
||||
|
||||
XrayTelAnalysis::~XrayTelAnalysis()
|
||||
{
|
||||
delete ntFactory;
|
||||
ntFactory = 0;
|
||||
|
||||
delete histoManager;
|
||||
histoManager = 0;
|
||||
|
||||
delete vectorFactory;
|
||||
vectorFactory = 0;
|
||||
|
||||
delete plotter;
|
||||
plotter = 0;
|
||||
}
|
||||
|
||||
XrayTelAnalysis* XrayTelAnalysis::getInstance()
|
||||
{
|
||||
if (instance == 0) instance = new XrayTelAnalysis;
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
void XrayTelAnalysis::book()
|
||||
{
|
||||
histoManager->selectStore("XrayTel.his");
|
||||
|
||||
// Book histograms
|
||||
histoManager->create1D("1","Energy, all", 20,0.,10.);
|
||||
histoManager->create2D("2","y-z, all", 100,-500.,500.,100,-500.,500.);
|
||||
histoManager->create1D("3","Energy, entering detector", 10,0.,1.);
|
||||
histoManager->create2D("4","y-z, entering detector", 200,-50.,50.,200,-50.,50.);
|
||||
|
||||
// Divide the plot into 4 zones to show the 4 histograms during execution
|
||||
plotter->zone(2,2,0,0);
|
||||
|
||||
// Book ntuples
|
||||
ntuple = ntFactory->createC("XrayTel.his::1");
|
||||
|
||||
// Add and bind the attributes to the ntuple
|
||||
if ( !( ntuple->addAndBind( "energy", eKin) &&
|
||||
ntuple->addAndBind( "y" , y ) &&
|
||||
ntuple->addAndBind( "z" , z ) &&
|
||||
ntuple->addAndBind( "dirx" , dirX) &&
|
||||
ntuple->addAndBind( "diry" , dirY) &&
|
||||
ntuple->addAndBind( "dirz" , dirZ) ) )
|
||||
{
|
||||
delete ntuple;
|
||||
G4Exception(" XrayTelAnalysis::book - Could not addAndBind ntuple");
|
||||
}
|
||||
}
|
||||
|
||||
void XrayTelAnalysis::finish()
|
||||
{
|
||||
// Store histograms
|
||||
|
||||
// Because of a Lizard feature, ntuples must be deleted at this stage,
|
||||
// not in the destructor (otherwise the ntuples are not stored)
|
||||
|
||||
histoManager->store("1");
|
||||
histoManager->store("3");
|
||||
histoManager->store("2");
|
||||
histoManager->store("4");
|
||||
|
||||
delete ntuple;
|
||||
ntuple = 0;
|
||||
G4cout << "Deleted ntuple" << G4endl;
|
||||
}
|
||||
|
||||
void XrayTelAnalysis::analyseStepping(const G4Track& track, G4bool entering)
|
||||
{
|
||||
eKin = track.GetKineticEnergy();
|
||||
G4ThreeVector pos = track.GetPosition();
|
||||
y = pos.y();
|
||||
z = pos.z();
|
||||
G4ThreeVector dir = track.GetMomentumDirection();
|
||||
dirX = dir.x();
|
||||
dirY = dir.y();
|
||||
dirZ = dir.z();
|
||||
|
||||
// Fill histograms, all tracks
|
||||
IHistogram1D* h1 = histoManager->retrieveHisto1D("1");
|
||||
h1->fill(eKin);
|
||||
IHistogram2D* h2 = histoManager->retrieveHisto2D("2");
|
||||
h2->fill(y,z);
|
||||
|
||||
// Fill histograms and ntuple, tracks entering the detector
|
||||
if (entering)
|
||||
{
|
||||
// Fill and plot histograms
|
||||
IHistogram1D* h3 = histoManager->retrieveHisto1D("3");
|
||||
h3->fill(eKin);
|
||||
plot1D(h1);
|
||||
plot1D(h3);
|
||||
IHistogram2D* h4 = histoManager->retrieveHisto2D("4");
|
||||
h4->fill(y,z);
|
||||
plot2D(h2);
|
||||
plot2D(h4);
|
||||
|
||||
// Fill ntuple
|
||||
ntuple->addRow();
|
||||
}
|
||||
}
|
||||
|
||||
void XrayTelAnalysis::plot1D(IHistogram1D* histo)
|
||||
{
|
||||
IVector* v = vectorFactory->from1D(histo);
|
||||
plotter->plot(v,0);
|
||||
plotter->refresh();
|
||||
delete v;
|
||||
}
|
||||
|
||||
void XrayTelAnalysis::plot2D(IHistogram2D* histo)
|
||||
{
|
||||
IVector* v = vectorFactory->from2D(histo);
|
||||
plotter->plot(v,0);
|
||||
plotter->refresh();
|
||||
delete v;
|
||||
}
|
||||
@@ -38,6 +38,9 @@
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
//
|
||||
// 05.12.2001 R.Nartallo
|
||||
// - Implement "Update" function as in LowEnTest
|
||||
//
|
||||
// 06.11.2000 R.Nartallo
|
||||
// - First implementation of xray_telescope event action
|
||||
// - Based on Chandra and XMM models
|
||||
@@ -58,33 +61,29 @@
|
||||
#include "XrayTelEventAction.hh"
|
||||
#include "XrayTelEventActionMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelEventAction::XrayTelEventAction(G4bool* dEvent)
|
||||
: drawFlag("all"),eventMessenger(NULL), drawEvent(dEvent)
|
||||
XrayTelEventAction::XrayTelEventAction()
|
||||
: drawFlag("all"),eventMessenger(0),drawEvent(false)
|
||||
{
|
||||
eventMessenger = new XrayTelEventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelEventAction::~XrayTelEventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayTelEventAction::BeginOfEventAction(const G4Event* Ev)
|
||||
{
|
||||
*drawEvent=false;
|
||||
drawEvent = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayTelEventAction::EndOfEventAction(const G4Event* Ev)
|
||||
{
|
||||
if (*drawEvent){
|
||||
if (drawEvent){
|
||||
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
|
||||
|
||||
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
@@ -106,7 +105,11 @@ void XrayTelEventAction::EndOfEventAction(const G4Event* Ev)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void XrayTelEventAction::Update()
|
||||
{
|
||||
// Update the flag identifying the event to be visualised
|
||||
drawEvent = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
// * MODULE: XrayTelRunAction.cc *
|
||||
// * ------- *
|
||||
// * *
|
||||
// * Version: 0.4 *
|
||||
// * Date: 06/11/00 *
|
||||
// * Version: 0.5 *
|
||||
// * Date: 16/10/01 *
|
||||
// * Author: R Nartallo *
|
||||
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
|
||||
// * *
|
||||
@@ -38,6 +38,14 @@
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
//
|
||||
// 07.11.2001 M.G. Pia
|
||||
// - Modified the analysis management
|
||||
// - Small design iteration
|
||||
//
|
||||
// 16.10.2001 R. Nartallo
|
||||
// - Updated "/vis" commands to new versions
|
||||
// - Clean up code to avoid 'pedantic' and 'ANSI' compiler warnings
|
||||
//
|
||||
// 30.11.2000 R. Nartallo
|
||||
// - Add pre-processor directives to compile without analysis option
|
||||
//
|
||||
@@ -54,89 +62,62 @@
|
||||
#include "G4Run.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "g4std/fstream"
|
||||
#include "g4std/vector"
|
||||
|
||||
#include "XrayTelRunAction.hh"
|
||||
#include "XrayTelAnalysisManager.hh"
|
||||
#include "XrayTelAnalysis.hh"
|
||||
#include "SystemOfUnits.h"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelRunAction::XrayTelRunAction(G4std::vector<G4double*> *enEnergy,
|
||||
G4std::vector<G4ThreeVector*> *enDirect,
|
||||
G4bool* dEvent,
|
||||
XrayTelAnalysisManager* aAnalysisManager)
|
||||
:enteringEnergy(enEnergy),
|
||||
enteringDirection(enDirect),drawEvent(dEvent),
|
||||
fAnalysisManager(aAnalysisManager)
|
||||
{;}
|
||||
XrayTelRunAction::XrayTelRunAction()
|
||||
:nEnteringTracks(0), totEnteringEnergy(0.)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelRunAction::~XrayTelRunAction()
|
||||
{;}
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayTelRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int RunN = aRun->GetRunID();
|
||||
if ( RunN % 1000 == 0 )
|
||||
G4cout << "### Run : " << RunN << G4endl;
|
||||
G4int runN = aRun->GetRunID();
|
||||
if ( runN % 1000 == 0 )
|
||||
G4cout << "### Run : " << runN << G4endl;
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance()) {
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
UI->ApplyCommand("/vis/clear/view");
|
||||
UI->ApplyCommand("/vis/draw/current");
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
|
||||
enteringEnergy->clear();
|
||||
enteringDirection->clear();
|
||||
nEnteringTracks = 0;
|
||||
totEnteringEnergy = 0.;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->BeginOfRun();
|
||||
#endif
|
||||
// Book histograms and ntuples
|
||||
XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance();
|
||||
analysis->book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayTelRunAction::EndOfRunAction(const G4Run* )
|
||||
{
|
||||
|
||||
G4int i;
|
||||
XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance();
|
||||
analysis->finish();
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
|
||||
|
||||
G4std::ofstream outscat("detector.hist", ios::app);
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
|
||||
G4cout << "End of Run summary" << G4endl << G4endl;
|
||||
|
||||
G4double totEnteringEnergy = 0.0;
|
||||
G4cout << "Total Entering Detector : " << nEnteringTracks << G4endl;
|
||||
G4cout << "Total Entering Detector Energy : "
|
||||
<< totEnteringEnergy/MeV
|
||||
<< " MeV"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for (i=0;i< enteringEnergy->size();i++)
|
||||
totEnteringEnergy += *(*enteringEnergy)[i];
|
||||
G4cout << "Total Entering Detector : " << enteringEnergy->size() << G4endl;
|
||||
G4cout << "Total Entering Detector Energy : " << totEnteringEnergy << G4endl;
|
||||
|
||||
for (i=0;i<enteringEnergy->size();i++) {
|
||||
outscat << " "
|
||||
<< *(*enteringEnergy)[i]
|
||||
<< " "
|
||||
<< (*enteringDirection)[i]->x()
|
||||
<< " "
|
||||
<< (*enteringDirection)[i]->y()
|
||||
<< " "
|
||||
<< (*enteringDirection)[i]->z()
|
||||
<< G4endl;
|
||||
}
|
||||
outscat.close();
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->EndOfRun();
|
||||
#endif
|
||||
void XrayTelRunAction::Update(G4double energy)
|
||||
{
|
||||
nEnteringTracks++;
|
||||
totEnteringEnergy += energy;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,9 +139,6 @@ void XrayTelRunAction::EndOfRunAction(const G4Run* )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,14 @@
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
//
|
||||
// 05.12.2001 R. Nartallo
|
||||
// - Return condition for entering detector (cf LowEnTest)
|
||||
// - Remove line to kill track if too many steps
|
||||
//
|
||||
// 07.11.2001 M.G. Pia
|
||||
// - Modified the analysis management
|
||||
// - Small design iteration
|
||||
//
|
||||
// 30.11.2000 R. Nartallo
|
||||
// - Add pre-processor directives to compile without analysis option
|
||||
//
|
||||
@@ -48,84 +56,61 @@
|
||||
// - First implementation of xray_telescope Physics list
|
||||
// - Based on Chandra and XMM models
|
||||
//
|
||||
//
|
||||
// **********************************************************************
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include <assert.h>
|
||||
#include "g4std/fstream"
|
||||
#include "g4std/iomanip"
|
||||
#include "g4std/iostream"
|
||||
#include "g4std/vector"
|
||||
|
||||
#include "XrayTelSteppingAction.hh"
|
||||
#include "XrayTelAnalysisManager.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "XrayTelEventAction.hh"
|
||||
#include "XrayTelRunAction.hh"
|
||||
#include "XrayTelAnalysis.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
#include "Randomize.hh"
|
||||
|
||||
XrayTelSteppingAction::XrayTelSteppingAction(
|
||||
G4std::vector<G4double*>* enEnergy,
|
||||
G4std::vector<G4ThreeVector*>* enDirect,
|
||||
G4bool* dEvent,
|
||||
XrayTelAnalysisManager* aAnalysisManager)
|
||||
: enteringEnergy(enEnergy),
|
||||
enteringDirection(enDirect),drawEvent(dEvent),
|
||||
fAnalysisManager(aAnalysisManager)
|
||||
{;}
|
||||
XrayTelSteppingAction::XrayTelSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelSteppingAction::~XrayTelSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void XrayTelSteppingAction::UserSteppingAction(const G4Step*)
|
||||
void XrayTelSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
const G4SteppingManager* pSM = fpSteppingManager;
|
||||
G4Track* fTrack = pSM->GetTrack();
|
||||
G4Step* fStep = pSM->GetStep();
|
||||
G4int TrackID = fTrack->GetTrackID();
|
||||
G4int StepNo = fTrack->GetCurrentStepNumber();
|
||||
G4bool entering = false;
|
||||
G4Track* track = step->GetTrack();
|
||||
|
||||
if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill);
|
||||
G4int stepNo = track->GetCurrentStepNumber();
|
||||
|
||||
G4String volName;
|
||||
if ( fTrack->GetVolume() )
|
||||
volName = fTrack->GetVolume()->GetName();
|
||||
if (track->GetVolume()) volName = track->GetVolume()->GetName();
|
||||
G4String nextVolName;
|
||||
if ( fTrack->GetNextVolume() )
|
||||
nextVolName = fTrack->GetNextVolume()->GetName();
|
||||
|
||||
G4ThreeVector pos = fTrack->GetPosition();
|
||||
if (track->GetNextVolume()) nextVolName = track->GetNextVolume()->GetName();
|
||||
|
||||
//--- Entering Detector
|
||||
if(volName != "Detector_P" && nextVolName == "Detector_P") {
|
||||
// Entering Detector
|
||||
if (volName != "Detector_P" && nextVolName == "Detector_P")
|
||||
{
|
||||
entering = true;
|
||||
|
||||
enteringEnergy->push_back ( new G4double (fTrack->GetKineticEnergy()) );
|
||||
enteringDirection->push_back (new G4ThreeVector (pos));
|
||||
// Notify the corresponding UserAction that the event must be visualised
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
// Casting is safe here: one knows the RTTI of the UserActions
|
||||
// in the current application (otherwise one could dynamic_cast)
|
||||
XrayTelEventAction* eventAction = (XrayTelEventAction*) runManager->GetUserEventAction();
|
||||
eventAction->Update();
|
||||
|
||||
// now we want to do some analysis at this step ...
|
||||
// call back to the analysis-manger to do the analysis ...
|
||||
// Notify the corresponding UserAction to update the run counters
|
||||
XrayTelRunAction* runAction = (XrayTelRunAction*) runManager->GetUserRunAction();
|
||||
runAction->Update(track->GetKineticEnergy());
|
||||
}
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fAnalysisManager) fAnalysisManager->Step(fpSteppingManager);
|
||||
#endif
|
||||
|
||||
*drawEvent = true;
|
||||
}
|
||||
// Do the analysis related to this step
|
||||
XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance();
|
||||
analysis->analyseStepping(*track,entering);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,18 +51,21 @@
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
#ifdef G4VIS_USE_ASCIITREE
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh"
|
||||
#endif
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4HepRepFile.hh"
|
||||
#include "G4RayTracer.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
|
||||
// Needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
#include "G4DAWNFILE.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
#include "G4Wo.hh"
|
||||
#include "G4Xo.hh"
|
||||
@@ -91,20 +94,11 @@
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER
|
||||
#include "G4RayTracer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
XrayTelVisManager::XrayTelVisManager () {}
|
||||
@@ -113,18 +107,21 @@ XrayTelVisManager::XrayTelVisManager () {}
|
||||
|
||||
void XrayTelVisManager::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_ASCIITREE
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
RegisterGraphicsSystem (new G4ASCIITree);
|
||||
#endif
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4GAGTree);
|
||||
RegisterGraphicsSystem (new G4HepRepFile);
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
RegisterGraphicsSystem (new G4Wo);
|
||||
RegisterGraphicsSystem (new G4Xo);
|
||||
@@ -153,20 +150,11 @@ void XrayTelVisManager::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem (new G4OpenInventorWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
#endif
|
||||
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
|
||||
Reference in New Issue
Block a user