Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
//$Id$
|
||||
|
||||
///\file "analysis/AnaEx03/.README.AIDA.txt"
|
||||
///\brief Example AnaEx03 README.AIDA page
|
||||
|
||||
/*! \page ExampleAnaEx03AIDA Example AnaEx03 - Install AIDA
|
||||
|
||||
|
||||
To use histograms, at least one of the AIDA implementations should be
|
||||
available.
|
||||
|
||||
You can use various file formats to write histograms (hbook, root, AIDA-XML).
|
||||
|
||||
\section ExampleAnaEx03AIDA_s1 OpenScientist (lal/in2p3)
|
||||
|
||||
OpenScientist is available at http://OpenScientist.lal.in2p3.fr.
|
||||
|
||||
osc_batch is a small package ( ~ 6MB), easy to install.
|
||||
It provides an AIDA interface to write files in ROOT or HBOOK formats.
|
||||
|
||||
See the specific \link ExampleAnaEx03OpenScientist README.OpenScientist \endlink
|
||||
page for more.
|
||||
|
||||
\section ExampleAnaEx03AIDA_s2 RAIDA (desy)
|
||||
|
||||
It is a ROOT based AIDA interface. It can be downloaded from
|
||||
http://ilcsoft.desy.de/portal/software_packages/raida/index_eng.html
|
||||
|
||||
|
||||
\section ExampleAnaEx03AIDA_s3 iAIDA
|
||||
|
||||
Another package including AIDA (an evolution of the former cern PI project)
|
||||
is the iAIDA package: http://iaida.dynalias.net
|
||||
|
||||
Once you have installed iAIDA in a specified local area $MYIAIDA, it is
|
||||
required to add the installation path to $PATH, i.e. for example, for
|
||||
release 1.0.11 of iAIDA:
|
||||
\verbatim
|
||||
setenv PATH ${PATH}:$MYIAIDA/bin
|
||||
\endverbatim
|
||||
|
||||
Before running the example the command should be issued:
|
||||
\verbatim
|
||||
eval `aida-config --runtime csh`
|
||||
\endverbatim
|
||||
|
||||
|
||||
\section ExampleAnaEx03AIDA_s4 JAIDA (slac)
|
||||
|
||||
JAIDA is an implementation of AIDA in Java. To use it, one needs Java
|
||||
as well as AIDAJNI, a connector between AIDA-C++ and AIDA-Java.
|
||||
|
||||
Available for: Linux-g++2, Linux-g++3, WIN32-VC, SUN-CC,
|
||||
Darwin-g++2, Darwin-g++3
|
||||
To compile and link with JAIDA using AIDAJNI, make sure you have:
|
||||
|
||||
-# JAIDA: see http://java.freehep.org/jaida
|
||||
-# set enviroment variable JAIDA_HOME to your JAIDA installation
|
||||
-# source the aida-setup script $JAIDA_HOME/bin/aida-setup.[sh|csh|win32] \n\n
|
||||
-# AIDAJNI: see http://java.freehep.org/aidajni
|
||||
-# set environment variable AIDAJNI_HOME to your AIDAJNI installation
|
||||
-# set environment variable JDK_HOME to your Java Standard Development Kit (1.4.x or up).
|
||||
-# source the aidajni-setup script $AIDAJNI_HOME/bin/$G4SYSTEM/aidajni-setup.[sh|csh|win32]
|
||||
|
||||
Last tested versions (with Geant4 examples): JAIDA 3.2.0, AIDAJNI 3.2.0.
|
||||
|
||||
Now execute:
|
||||
\verbatim
|
||||
source setup-analysis (.csh, .sh, .win32)
|
||||
gmake clean
|
||||
gmake
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,56 @@
|
||||
//$Id$
|
||||
|
||||
///\file "analysis/AnaEx03/.README.OpenScientist.txt"
|
||||
///\brief Example AnaEx03 README.OpenScientist page
|
||||
|
||||
/*! \page ExampleAnaEx03OpenScientist Example AnaEx03 - Working with the OpenScientist packages
|
||||
|
||||
To create the analysis file, you can install the light "osc_batch"
|
||||
binary kit (See http://OpenScientist.lal.in2p3.fr ). For example
|
||||
from a UNIX sh flavoured shell :
|
||||
\verbatim
|
||||
sh> cd /usr/local
|
||||
sh> <arrange to be su>
|
||||
sh> <get an osc_batch binary kit>
|
||||
sh> unzip -q osc_batch<platform>.zip
|
||||
sh> cd osc_batch/<version>
|
||||
sh> ./install
|
||||
\endverbatim
|
||||
|
||||
Then before building the example you have to source the OpenScientist
|
||||
environment with :
|
||||
\verbatim
|
||||
<create another terminal>
|
||||
sh> . /usr/local/osc_batch/<version>/aida-setup.sh
|
||||
or
|
||||
csh> source /usr/local/osc_batch/<version>/aida-setup.csh
|
||||
\endverbatim
|
||||
|
||||
Depending of the file format, you can visualize the produced
|
||||
file with various interactive tools (CERN/PAW, CERN/ROOT, jas).
|
||||
But if installing also an OpenScientist osc_vis binary kit,
|
||||
you shall be able to visualize all formats by using
|
||||
the osc-plot program. To install an osc_vis kit :
|
||||
\verbatim
|
||||
sh> cd /usr/local
|
||||
sh> <arrange to be su>
|
||||
sh> <get an osc_vis binary kit>
|
||||
sh> unzip -q osc_vis<platform>.zip
|
||||
sh> cd osc_vis/<version>
|
||||
sh> ./install
|
||||
\endverbatim
|
||||
Then to browse the AnaEx03.<format> file (for exa from an UNIX sh shell) :
|
||||
\verbatim
|
||||
<create another terminal>
|
||||
sh> . /usr/local/osc_vis/<version>/setup.sh
|
||||
sh> <setenv DISPLAY if needed>
|
||||
sh> osc-plot AnaEx03.[aida,root,hbook]
|
||||
\endverbatim
|
||||
|
||||
The OpenScientist URL is :
|
||||
- http://OpenScientist.lal.in2p3.fr.
|
||||
|
||||
Note that OpenScientist is installed on CERN/lxplus under :
|
||||
- /afs/cern.ch/sw/contrib/[osc_batch,osc_vis].
|
||||
|
||||
*/
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
//$Id$
|
||||
|
||||
///\file "analysis/AnaEx03/.README"
|
||||
///\file "analysis/AnaEx03/.README.txt"
|
||||
///\brief Example AnaEx03 README page
|
||||
|
||||
/*! \page ExampleAnaEx03 Example AnaEx03
|
||||
@@ -84,15 +84,15 @@
|
||||
|
||||
AnaEx03 can produce 4 histograms :
|
||||
|
||||
- histo 1 : total energy deposit in absorber per event
|
||||
- histo 2 : total energy deposit in gap per event
|
||||
- histo 3 : total track length of charged particles in absorber per event
|
||||
- histo 4 : total track length of charged particles in gap per event
|
||||
- EAbs : total energy deposit in absorber per event
|
||||
- EGap : total energy deposit in gap per event
|
||||
- LAbs : total track length of charged particles in absorber per event
|
||||
- LGap : total track length of charged particles in gap per event
|
||||
|
||||
And 2 Ntuples :
|
||||
- ntuple 1:
|
||||
- Ntuple1:
|
||||
- one row per event : EnergyAbs EnergyGap
|
||||
- ntuple 1:
|
||||
- Ntuple2:
|
||||
- one row per event : TrackLAbs TrackLGap
|
||||
|
||||
These histos and ntuples are booked in HistoManager and filled from
|
||||
@@ -95,11 +95,6 @@ int main(int argc,char** argv)
|
||||
//
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
#endif
|
||||
|
||||
if (argc!=1) // batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
@@ -108,11 +103,16 @@ int main(int argc,char** argv)
|
||||
}
|
||||
else
|
||||
{ // interactive mode : define visualization and UI terminal
|
||||
#ifdef G4VIS_USE
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
#ifdef G4UI_USE
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
#ifdef G4VIS_USE
|
||||
#endif
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
#endif
|
||||
|
||||
#ifdef G4UI_USE
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,12 @@ include(${Geant4_USE_FILE})
|
||||
# Find AIDA (required package)
|
||||
#
|
||||
find_package(AIDA REQUIRED)
|
||||
add_definitions(-DG4ANALYSIS_USE)
|
||||
|
||||
# Following lines should not be needed
|
||||
if(NOT AIDA_FOUND)
|
||||
message(STATUS "G4 Examples: AIDA package not found. AnaEx03 disabled.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 85991 2014-11-06 15:41:42Z gcosmo $
|
||||
$Id: History 92373 2015-08-31 08:51:33Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -14,7 +14,21 @@ track of all tags.
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
30-08-15 I. Hrivnacova (AnaEx03-V10-01-02)
|
||||
- Corrected previous update which caused compilation error
|
||||
|
||||
28-08-15 I. Hrivnacova (AnaEx03-V10-01-01)
|
||||
- Fixed compilation on Windows
|
||||
|
||||
27-08-15 I. Hrivnacova (AnaEx03-V10-01-00)
|
||||
- Introduced meaningful histograms and ntuple names instead of numbers
|
||||
in all AnaEx0N examples and use histogram ids starting from 0
|
||||
- Simplified HistoManager classes and fixed function names to follow
|
||||
coding guidelines
|
||||
- Removed G4ANALYSIS_USE ifdefs from AnaEx03, as this example is now build
|
||||
only with AIDA
|
||||
|
||||
06-11-14 I. Hrivnacova (AnaEx03-V10-00-04)
|
||||
- Updated for moving script in shared (analysisShared-V10-00-01)
|
||||
- Updated README - commented special compilation (via make setup)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file analysis/AnaEx03/include/HistoManager.hh
|
||||
/// \brief Definition of the HistoManager class
|
||||
//
|
||||
// $Id: HistoManager.hh 74272 2013-10-02 14:48:50Z gcosmo $
|
||||
// $Id: HistoManager.hh 92321 2015-08-27 14:53:09Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -44,19 +44,19 @@ namespace AIDA {
|
||||
class IHistogram1D;
|
||||
class ITuple;
|
||||
}
|
||||
const G4int MaxHisto = 5;
|
||||
|
||||
const G4int MaxHisto = 4;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class HistoManager
|
||||
{
|
||||
public:
|
||||
|
||||
HistoManager();
|
||||
~HistoManager();
|
||||
|
||||
void book();
|
||||
void save();
|
||||
void Book();
|
||||
void Save();
|
||||
|
||||
void FillHisto(G4int id, G4double bin, G4double weight = 1.0);
|
||||
void Normalize(G4int id, G4double fac);
|
||||
@@ -67,7 +67,6 @@ class HistoManager
|
||||
void PrintStatistic();
|
||||
|
||||
private:
|
||||
|
||||
AIDA::IAnalysisFactory* fAF;
|
||||
AIDA::ITree* fTree;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 85991 2014-11-06 15:41:42Z gcosmo $
|
||||
$Id: History 92321 2015-08-27 14:53:09Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -15,6 +15,10 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
27-08-15 I. Hrivnacova (analysisShared-V10-01-00)
|
||||
- Updated histogram ids in FillHiso (now starting from 0);
|
||||
updated for changed function names in HistoManager classes
|
||||
|
||||
06-11-14 I. Hrivnacova (analysisShared-V10-00-01)
|
||||
- Moved scripts from upper directory in shared
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: DetectorConstruction.hh 77206 2013-11-22 01:33:52Z adotti $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: DetectorMessenger.hh 77206 2013-11-22 01:33:52Z adotti $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: EventAction.hh 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: PrimaryGeneratorAction.hh 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: RunAction.hh 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.hh 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: SteppingAction.hh 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: DetectorConstruction.cc 77206 2013-11-22 01:33:52Z adotti $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: DetectorMessenger.cc 77206 2013-11-22 01:33:52Z adotti $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: EventAction.cc 92321 2015-08-27 14:53:09Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -80,10 +80,10 @@ void EventAction::EndOfEventAction(const G4Event*)
|
||||
|
||||
//fill histograms
|
||||
//
|
||||
fHistoManager->FillHisto(1, fEnergyAbs);
|
||||
fHistoManager->FillHisto(2, fEnergyGap);
|
||||
fHistoManager->FillHisto(3, fTrackLAbs);
|
||||
fHistoManager->FillHisto(4, fTrackLGap);
|
||||
fHistoManager->FillHisto(0, fEnergyAbs);
|
||||
fHistoManager->FillHisto(1, fEnergyGap);
|
||||
fHistoManager->FillHisto(2, fTrackLAbs);
|
||||
fHistoManager->FillHisto(3, fTrackLGap);
|
||||
|
||||
//fill ntuple
|
||||
//
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: PrimaryGeneratorAction.cc 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: RunAction.cc 92321 2015-08-27 14:53:09Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -68,7 +68,7 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
|
||||
//histograms
|
||||
//
|
||||
fHistoManager->book();
|
||||
fHistoManager->Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -131,7 +131,7 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
//save histograms
|
||||
//
|
||||
fHistoManager->PrintStatistic();
|
||||
fHistoManager->save();
|
||||
fHistoManager->Save();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.cc 85906 2014-11-06 08:52:54Z gcosmo $
|
||||
// $Id: SteppingAction.cc 67226 2013-02-08 12:07:18Z ihrivnac $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file analysis/AnaEx03/src/HistoManager.cc
|
||||
/// \brief Implementation of the HistoManager class
|
||||
//
|
||||
// $Id: HistoManager.cc 74272 2013-10-02 14:48:50Z gcosmo $
|
||||
// $Id: HistoManager.cc 92373 2015-08-31 08:51:33Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -35,16 +35,13 @@
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AIDA/AIDA.h"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
:fAF(0),fTree(0), fNtuple1(0), fNtuple2(0)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
// Creating the analysis factory
|
||||
//
|
||||
fAF = AIDA_createAnalysisFactory();
|
||||
@@ -53,7 +50,6 @@ HistoManager::HistoManager()
|
||||
<< " problem creating the AIDA analysis factory."
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) fHisto[k] = 0;
|
||||
@@ -63,99 +59,97 @@ HistoManager::HistoManager()
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
delete fAF;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::book()
|
||||
void HistoManager::Book()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(!fAF) return;
|
||||
if (! fAF) return;
|
||||
|
||||
// Creating a tree container to handle histograms and ntuples.
|
||||
// This tree is associated to an output file.
|
||||
//
|
||||
G4String fileName = "AnaEx03";
|
||||
G4String fileType = "root"; // hbook root xml
|
||||
G4String fileOption = " ";
|
||||
//// G4String fileOption = "uncompress compress=no"; //for xml
|
||||
//// G4String fileOption = "--noErrors"; //for hbook
|
||||
// Creating a tree container to handle histograms and ntuples.
|
||||
// This tree is associated to an output file.
|
||||
//
|
||||
G4String fileName = "AnaEx03";
|
||||
G4String fileType = "root"; // hbook root xml
|
||||
G4String fileOption = " ";
|
||||
//// G4String fileOption = "uncompress compress=no"; //for xml
|
||||
//// G4String fileOption = "--noErrors"; //for hbook
|
||||
|
||||
fileName = fileName + "." + fileType;
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
AIDA::ITreeFactory* tf = fAF->createTreeFactory();
|
||||
fTree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
|
||||
delete tf;
|
||||
if(!fTree) {
|
||||
G4cout << " HistoManager::book :"
|
||||
<< " problem creating the AIDA tree with "
|
||||
<< " storeName = " << fileName
|
||||
<< " storeType = " << fileType
|
||||
<< " readOnly = " << readOnly
|
||||
<< " createNew = " << createNew
|
||||
<< " options = " << fileOption
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
//
|
||||
AIDA::IHistogramFactory* hf = fAF->createHistogramFactory(*fTree);
|
||||
|
||||
// create histos in subdirectory "histograms"
|
||||
//
|
||||
fTree->mkdir("histograms");
|
||||
fTree->cd("histograms");
|
||||
|
||||
fHisto[1] = hf->createHistogram1D("1", "Edep in absorber", 100, 0., 800*MeV);
|
||||
if (!fHisto[1]) G4cout << "\n can't create histo 1" << G4endl;
|
||||
fHisto[2] = hf->createHistogram1D("2", "Edep in gap", 100, 0., 100*MeV);
|
||||
if (!fHisto[2]) G4cout << "\n can't create histo 2" << G4endl;
|
||||
fHisto[3] = hf->createHistogram1D("3", "trackL in absorber", 100, 0., 1*m);
|
||||
if (!fHisto[3]) G4cout << "\n can't create histo 3" << G4endl;
|
||||
fHisto[4] = hf->createHistogram1D("4", "trackL in gap", 100, 0., 50*cm);
|
||||
if (!fHisto[4]) G4cout << "\n can't create histo 4" << G4endl;
|
||||
|
||||
delete hf;
|
||||
fTree->cd("..");
|
||||
|
||||
// Creating a ntuple factory, handled by the tree
|
||||
//
|
||||
AIDA::ITupleFactory* ntf = fAF->createTupleFactory(*fTree);
|
||||
|
||||
// create 1 ntuple in subdirectory "tuples"
|
||||
//
|
||||
fTree->mkdir("tuples");
|
||||
fTree->cd("tuples");
|
||||
|
||||
fNtuple1 = ntf->create("101", "Edep", "double Eabs, Egap");
|
||||
fNtuple2 = ntf->create("102", "TrackL", "double Labs, Lgap");
|
||||
|
||||
delete ntf;
|
||||
fTree->cd("..");
|
||||
|
||||
G4cout << "\n----> Histogram Tree is opened in " << fileName << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::save()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (fAF && fTree) {
|
||||
fTree->commit(); // Writing the histograms to the file
|
||||
fTree->close(); // and closing the tree (and the file)
|
||||
G4cout << "\n----> Histogram Tree is saved \n" << G4endl;
|
||||
|
||||
delete fTree;
|
||||
fTree = 0;
|
||||
fileName = fileName + "." + fileType;
|
||||
G4bool readOnly = false;
|
||||
G4bool createNew = true;
|
||||
AIDA::ITreeFactory* tf = fAF->createTreeFactory();
|
||||
fTree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
|
||||
delete tf;
|
||||
if(!fTree) {
|
||||
G4cout << " HistoManager::book :"
|
||||
<< " problem creating the AIDA tree with "
|
||||
<< " storeName = " << fileName
|
||||
<< " storeType = " << fileType
|
||||
<< " readOnly = " << readOnly
|
||||
<< " createNew = " << createNew
|
||||
<< " options = " << fileOption
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Creating a histogram factory, whose histograms will be handled by the tree
|
||||
//
|
||||
AIDA::IHistogramFactory* hf = fAF->createHistogramFactory(*fTree);
|
||||
|
||||
// create histos in subdirectory "histograms"
|
||||
//
|
||||
fTree->mkdir("histograms");
|
||||
fTree->cd("histograms");
|
||||
|
||||
// id = 0
|
||||
fHisto[0] = hf->createHistogram1D("EAbs", "EAbs: Edep in absorber", 100, 0., 800*MeV);
|
||||
// id = 1
|
||||
fHisto[1] = hf->createHistogram1D("EGap", "EGap: Edep in gap", 100, 0., 100*MeV);
|
||||
// id = 2
|
||||
fHisto[2] = hf->createHistogram1D("LAbs", "LAbs: trackL in absorber", 100, 0., 1*m);
|
||||
// id = 3
|
||||
fHisto[3] = hf->createHistogram1D("LGap", "LGap: trackL in gap", 100, 0., 50*cm);
|
||||
|
||||
for ( G4int i=0; i<MaxHisto; ++i ) {
|
||||
if (! fHisto[i]) G4cout << "\n can't create histo " << i << G4endl;
|
||||
}
|
||||
|
||||
delete hf;
|
||||
fTree->cd("..");
|
||||
|
||||
// Creating a ntuple factory, handled by the tree
|
||||
//
|
||||
AIDA::ITupleFactory* ntf = fAF->createTupleFactory(*fTree);
|
||||
|
||||
// create 1 ntuple in subdirectory "tuples"
|
||||
//
|
||||
fTree->mkdir("tuples");
|
||||
fTree->cd("tuples");
|
||||
|
||||
fNtuple1 = ntf->create("Ntuple1", "Edep", "double Eabs, Egap");
|
||||
fNtuple2 = ntf->create("Ntuple2", "TrackL", "double Labs, Lgap");
|
||||
|
||||
delete ntf;
|
||||
fTree->cd("..");
|
||||
|
||||
G4cout << "\n----> Output file is open in " << fileName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Save()
|
||||
{
|
||||
if (! (fAF && fTree)) return;
|
||||
|
||||
fTree->commit(); // Writing the histograms to the file
|
||||
fTree->close(); // and closing the tree (and the file)
|
||||
G4cout << "\n----> Histograms and ntuples are saved\n" << G4endl;
|
||||
|
||||
delete fTree;
|
||||
fTree = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -168,9 +162,8 @@ void HistoManager::FillHisto(G4int ih, G4double xbin, G4double weight)
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (fHisto[ih]) fHisto[ih]->fill(xbin, weight);
|
||||
#endif
|
||||
|
||||
if (fHisto[ih]) fHisto[ih]->fill(xbin, weight);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -182,14 +175,12 @@ void HistoManager::Normalize(G4int ih, G4double fac)
|
||||
<< " does not exist. (fac=" << fac << ")" << G4endl;
|
||||
return;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if (fHisto[ih]) fHisto[ih]->scale(fac);
|
||||
#endif
|
||||
|
||||
if (fHisto[ih]) fHisto[ih]->scale(fac);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
|
||||
G4double trackLAbs, G4double trackLGap)
|
||||
{
|
||||
@@ -204,34 +195,26 @@ void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
|
||||
fNtuple2->addRow();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void HistoManager::FillNtuple(G4double, G4double, G4double, G4double)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void HistoManager::PrintStatistic()
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE
|
||||
if(fHisto[1]) {
|
||||
G4cout << "\n ----> print histograms statistic \n" << G4endl;
|
||||
|
||||
G4cout
|
||||
<< " EAbs : mean = " << G4BestUnit(fHisto[1]->mean(), "Energy")
|
||||
<< " rms = " << G4BestUnit(fHisto[1]->rms(), "Energy") << G4endl;
|
||||
G4cout
|
||||
<< " EGap : mean = " << G4BestUnit(fHisto[2]->mean(), "Energy")
|
||||
<< " rms = " << G4BestUnit(fHisto[2]->rms(), "Energy") << G4endl;
|
||||
G4cout
|
||||
<< " LAbs : mean = " << G4BestUnit(fHisto[3]->mean(), "Length")
|
||||
<< " rms = " << G4BestUnit(fHisto[3]->rms(), "Length") << G4endl;
|
||||
G4cout
|
||||
<< " LGap : mean = " << G4BestUnit(fHisto[4]->mean(), "Length")
|
||||
<< " rms = " << G4BestUnit(fHisto[4]->rms(), "Length") << G4endl;
|
||||
G4cout << "\n ----> print histograms statistic \n" << G4endl;
|
||||
for ( G4int i=0; i<MaxHisto; ++i ) {
|
||||
AIDA::IHistogram1D* h1 = fHisto[i];
|
||||
G4String title = h1->title();
|
||||
// extract name as first 4 characters from title, as aida seems not to keep
|
||||
// histogram name
|
||||
const G4String name = title(0,4);
|
||||
|
||||
G4String unitCategory;
|
||||
if (name[0] == 'E' ) unitCategory = "Energy";
|
||||
if (name[0] == 'L' ) unitCategory = "Length";
|
||||
|
||||
G4cout << name
|
||||
<< ": mean = " << G4BestUnit(h1->mean(), unitCategory)
|
||||
<< " rms = " << G4BestUnit(h1->rms(), unitCategory )
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user