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
@@ -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 ];
}
}
}
*/