Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 2004/04/13 12:10:02 cirrone Exp $
# $Id: GNUmakefile,v 1.5 2004/11/30 09:06:18 guatelli Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -15,3 +15,9 @@ endif
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
ifdef G4ANALYSIS_USE
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
LOADLIBS += `aida-config --lib`
endif
+8 -1
View File
@@ -8,7 +8,14 @@ $Id: History, v 1.6 2004/02/27 G.A.P. Cirrone
Category History file
---------------------
28.05.2005 - S. Guatelli
30.11.2004 - S. Guatelli,
correct analysis, tag: hadrontherapy-V06-02-00
16.07.2004 - G.A.P. Cirrone
AIDA classes inserted. Generation of an .hbk file
containing the depth dose distribution.
28.05.2004 - S. Guatelli
Update of the README, code review for public release.
27.02.2004 - G.A.P. Cirrone
+10 -4
View File
@@ -185,13 +185,19 @@ particle interacting with the plane representing the radiographic film.
x direction is along the beam direction,
y and z directions are orthogonal to the beam direction.
Alternatively, if the variable G4ANALYSIS_USE is set, an hbk file
is produced containig the Bragg peak in a histogram and in a ntuple.
Setup for analysis: AIDA 3.2.1, PI 1.2.1
Users can download the analysis tools from:
http://aida.freehep.org/
http://www.cern.ch/PI
------------------------------------------------------------------------
----> 6. FUTURE PLANS
Next planned improvements will be:
** Use of AIDA and PI analysis tools to store the results of the
simulation in .xml/.hbk files
** Addition of messengers to interactively change position, dimension
and composition of all the beam line elements and of the
@@ -207,5 +213,5 @@ Next planned improvements will be:
for comments, advices, doubts and questions please contact:
cirrone@lns.infn.it, giorgiorusso@lns.infn.it
last modified: Susanna Guatelli, 28/5/2004
last modified: Susanna Guatelli, 30/11/2004
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifdef G4ANALYSIS_USE
#ifndef HADRONTHERAPYANALYSISMANAGER_HH
#define HADRONTHERAPYANALYSISMANAGER_HH
#include "globals.hh"
#include <vector>
#include "G4ThreeVector.hh"
# include <AIDA/AIDA.h>
namespace AIDA{
class ITree;
class IDataPoint;
class IAnalysisFactory;
class ITreeFactory;
};
class HadrontherapyAnalysisManager
{
private:
HadrontherapyAnalysisManager();
public:
~HadrontherapyAnalysisManager();
static HadrontherapyAnalysisManager* getInstance();
void book();
void Energy_Dep(G4double, G4double);
void Energy_Event(G4int, G4double);
void finish();
private:
static HadrontherapyAnalysisManager* instance;
private:
AIDA::IAnalysisFactory* aFact;
AIDA::ITree* theTree;
// AIDA::ITreeFactory *treeFact;
AIDA::IHistogramFactory *histFact;
AIDA::ITupleFactory *tupFact;
AIDA::IHistogram1D *h1;
AIDA::ITuple *ntuple;
};
#endif
#endif
@@ -38,29 +38,55 @@
#include "globals.hh"
#include <iostream.h>
// -------------------------------------------------------------
class G4Run;
#ifndef G4NOHIST
namespace AIDA {
class ITree;
class IHistogram1D;
}
#endif
// -------------------------------------------------------------
class HadrontherapyRunAction : public G4UserRunAction
{
public:
HadrontherapyRunAction();
~HadrontherapyRunAction();
public:
HadrontherapyRunAction();
~HadrontherapyRunAction();
G4double energy[50000];
G4double energy[50000];
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
G4int GetProva();
G4int GetProva();
void EnergyTotSlice(G4int, G4double);
void EnergyTotMarkus();
private:
G4int NbOfLayer;
G4int slice;
G4double energy_dep;
};
#ifndef G4NOHIST
AIDA::IHistogram1D* GetHisto(G4int id) {return histo[id];}
#endif
private:
void bookHisto();
private:
G4String histName;
#ifndef G4NOHIST
AIDA::ITree* tree;
AIDA::IHistogram1D* histo[10];
#endif
G4int NbOfLayer;
G4int slice;
private:
G4int prova;
G4double energy_dep;
};
#endif
@@ -0,0 +1,142 @@
//
// ********************************************************************
// * 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: HadrontherapyAnalysisManager.cc,v 1.0
//
// --------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// --------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone, G. Russo
// Laboratori Nazionali del Sud - INFN, Catania, Italy
// --------------------------------------------------------------
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include <fstream>
#include "HadrontherapyAnalysisManager.hh"
#include "G4ios.hh"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IManagedObject.h"
#include "AIDA/IAnalysisFactory.h"
#include "AIDA/IHistogramFactory.h"
#include "AIDA/ITupleFactory.h"
#include "AIDA/ITreeFactory.h"
#include "AIDA/ITree.h"
#include "AIDA/ITuple.h"
HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::instance = 0;
HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() :
aFact(0), theTree(0), histFact(0), tupFact(0), h1(0), ntuple(0)
{
//build up the factories
aFact = AIDA_createAnalysisFactory();
AIDA::ITreeFactory *treeFact = aFact->createTreeFactory();
//parameters for the TreeFactory
G4String fileName="protontherapy.hbk";
theTree = treeFact->create(fileName,"hbook",false, true);
delete treeFact;
histFact = aFact->createHistogramFactory( *theTree );
tupFact = aFact->createTupleFactory ( *theTree );
}
HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager()
{
delete ntuple;
ntuple=0;
delete h1;
h1=0;
delete tupFact;
tupFact=0;
delete histFact;
histFact=0;
delete theTree;
theTree=0;
delete aFact;
aFact = 0;
}
HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::getInstance()
{
if (instance == 0) instance = new HadrontherapyAnalysisManager;
return instance;
}
void HadrontherapyAnalysisManager::book()
{
h1 = histFact -> createHistogram1D("10","slice, energy",
40*4 ,-2.,40. );
G4String columnNames = "int slice; double En;";
G4String options = "";
if (tupFact) ntuple = tupFact->create("1","1",columnNames, options);
}
void HadrontherapyAnalysisManager::Energy_Dep(G4double slice, G4double En)
{
if (ntuple)
{
G4int islice = ntuple -> findColumn("slice" );
G4int iEn = ntuple -> findColumn("En" );
ntuple -> fill(islice,slice);
ntuple -> fill(iEn, En);
}
ntuple -> addRow();
}
void HadrontherapyAnalysisManager::Energy_Event(G4int slice, G4double En)
{
h1 -> fill(slice,En);
}
void HadrontherapyAnalysisManager::finish()
{
// write all histograms to file
theTree -> commit();
G4cout<<" commit done"<<G4endl;
// close (will again commit)
theTree ->close();
G4cout<<" close() done"<<G4endl;
}
#endif
@@ -85,7 +85,7 @@ G4bool HadrontherapyCalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory*
{
G4int j = aStep -> GetPreStepPoint() -> GetPhysicalVolume() -> GetCopyNo();
G4double edep = aStep->GetTotalEnergyDeposit();
G4double edep = aStep -> GetTotalEnergyDeposit();
if (edep ==0) return false;
if(sliceID[j]== -1)
{
@@ -20,6 +20,28 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// ********************************************************************
// * DISCLSSMER *
// * *
// * 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: HadrontherapyDetectorConstruction.cc,v 1.0
// --------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
@@ -39,6 +39,10 @@
#include <iomanip.h>
#include "Randomize.hh"
#ifdef G4ANALYSIS_USE
#include "HadrontherapyAnalysisManager.hh"
#endif
// ---------------------------------------------------------------
HadrontherapyRunAction::HadrontherapyRunAction()
:NbOfLayer(20000)
@@ -48,6 +52,7 @@ HadrontherapyRunAction::HadrontherapyRunAction()
// ---------------------------------------------------------------
HadrontherapyRunAction::~HadrontherapyRunAction()
{
// delete runMessenger;
}
// ---------------------------------------------------------------
@@ -58,11 +63,18 @@ void HadrontherapyRunAction::BeginOfRunAction(const G4Run* aRun)
energy[i] = 0.0;
};
// ---------- Analysis preliminary implentation ------------------
// for the registration of the Bragg curve file in a .xml file
#ifdef G4ANALYSIS_USE
HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance();
analysis->book();
#endif
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager() -> SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
HepRandom::showEngineStatus();
}
@@ -70,7 +82,8 @@ HepRandom::showEngineStatus();
void HadrontherapyRunAction::EndOfRunAction(const G4Run*)
{
// WRITE ASCII FILE FOR THE REGISTRATION OF THE BRAGG PEAK
// The a two column file (piccoXX.dat) is registered. The first column represents
// The a two column file (BraggPeak.out) is registered.
//The first column represents
// the ionization chamber position (in mm of water); the second
// is the energy deposited for each position of the chamber
@@ -87,7 +100,27 @@ depth = i*0.002; //the number represents the thickness of the ionization chamber
}
}
#ifdef G4ANALYSIS_USE
HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance();
//histogram fill
analysis -> Energy_Event( slice, energy[ slice ]);
for (slice = 0; slice < 200; slice++)
// It is necessary to set here the Number of slice
{
//G4cout << "%%%%%%%" << slice << "%%%%%" <<
//energy[ slice ] << "%%%%%" << G4endl;
//n-tuple fill
analysis -> Energy_Dep( slice + 0.2, energy[ slice ]);
}
analysis -> finish();
#endif
// show Rndm status
HepRandom::showEngineStatus();
}
@@ -95,5 +128,36 @@ depth = i*0.002; //the number represents the thickness of the ionization chamber
// -----------------------------------------------------------------------------
void HadrontherapyRunAction::EnergyTotSlice(G4int slice, G4double energy_dep)
{
energy[ slice ] = energy [ slice ] + energy_dep;
energy[ slice ] = energy [ slice ] + energy_dep;
//G4cout << "energy dalla funzione EnergyTotSlice" << energy[slice]
//<< "slice" << slice << G4endl;
}
/*void HadrontherapyRunAction::EnergyTotMarkus()
{
for (G4int i = 0; i < 250; i++) {
energyMarkus[i] = 0;
}
for (i = 0; i < 191; i++) {
for (G4int j = 0; j < 10; j++) {
energyMarkus[ i ] = energy[ i+j ] + energyMarkus[ i ];
}
}
}
*/