Ignore:
Timestamp:
Jan 8, 2010, 3:02:48 PM (14 years ago)
Author:
garnier
Message:

update to geant4.9.3

Location:
trunk/examples/extended/radioactivedecay/exrdm
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/radioactivedecay/exrdm/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.4 2006/12/21 17:52:39 flei Exp $
     1# $Id: GNUmakefile,v 1.9 2008/12/05 09:57:30 flei Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module
     
    1212endif
    1313
    14 ifdef G4ANALYSIS_USE_ROOT
    15 CPPFLAGS += -DG4ANALYSIS_USE_ROOT
    16 CPPFLAGS += -D_REENTRANT -I$(ROOTSYS)/include
    17 
    18 EXTRALIBS += -L$(ROOTSYS)/lib \
    19 -lCore -lCint \
    20 -lHist -lGraf -lGraf3d -lGpad \
    21 -lTree -lRint -lPostscript \
    22 -lMatrix -lPhysics \
    23 -lm -ldl -lpthread -rdynamic
    24 
    25 endif
    26 
    27 ifdef G4ANALYSIS_USE_AIDA
    28    CPPFLAGS += -DG4ANALYSIS_USE_AIDA
    29    CPPFLAGS += `aida-config --include`
    30    LDLIBS += `aida-config --lib`
    31 endif
    32 
    3314.PHONY: all
    3415all: lib bin
    3516
     17ifdef G4ANALYSIS_USE_ROOT
     18  CPPFLAGS += -DG4ANALYSIS_USE_ROOT
     19endif
     20
     21include $(G4INSTALL)/config/architecture.gmk
     22
     23ifdef G4ANALYSIS_USE_ROOT
     24  CPPFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags)
     25  LDFLAGS  += $(shell $(ROOTSYS)/bin/root-config --glibs)
     26endif
     27
    3628include $(G4INSTALL)/config/binmake.gmk
    3729
     30anaclean:
     31        rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/exrdmHisto*
     32        rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/exrdmAnalysis*
     33        rm -f $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)/exrdmStepping*
  • trunk/examples/extended/radioactivedecay/exrdm/History

    r807 r1230  
    1 $Id: History,v 1.17 2007/11/15 16:10:09 vnivanch Exp $
     1$Id: History,v 1.27 2009/09/22 16:50:06 gunter Exp $
    22-------------------------------------------------------------------
    33
     
    1515     * Reverse chronological order (last date on top), please *
    1616     ----------------------------------------------------------
     17
     1822/09/2009 G.Folger (exrdm-V09-02-00)
     19-  remove trivial compilation warning when compiled without G4ANALYSIS_USE in
     20   src/src/exrdmHisto.cc
     21
     2205/12/2008 F.Lei (exrdm-V09-01-04)
     23- exrdmAnalysisManager.cc, exrdmSteppingAction.cc
     24   - better G4ANALYSIS_USE and G4ANALYSIS_USE_ROOT logic
     25- GNUMakefile
     26
     2704/12/2008 F.Lei (exrdm-V09-01-03)
     28- exrdmHisto: delete hfileROOT in save();
     29- exrdmAnalysisManager.cc, exrdmSteppingAction.cc
     30   - used || login between G4ANALYSIS_USE and G4ANALYSIS_USE_ROOT
     31- Updated README, macro/f24.mac
     32
     3304/12/2008 G.Barrand
     34- exrdmAnalyisManager : dispose() : cstor, dstor private.
     35- exrdmHisto : revisit the AIDA sector, mainly creation/deletion of things.
     36  Now the program holds in case of multiple /run/beamOn.
     37  NOTE : someone should do the same with the ROOT sector...
     38  I have let a //FIXME in exrdmHisto::~exrdmHisto and ~exrdmAnalysisManager().
     39- EventAction, RunAction : have some #ifdef G4VIS_USE to be able to
     40  disconnect properly the G4/vis.
     41
     4202/12/2008 F.Lei (exrdm-V09-01-02)
     43- exrdmHisto,exrdmHistoMessenger & exrdmAnalysisManager: updated the usage
     44  of AIDA analysis package.
     45 
     46August 10th, 2008 V.Ivanchenko (exrdm-V09-01-01)
     47--------------------------------------------------
     48- exdrmMatarialMessenger - fix units of density
     49- exdrmPhysicsList - fix definition of cuts; simplify logic
     50                     of setting of hadronic physics;
     51                     remove double instantiation of radioactive decay
     52- removed compillation warnings in several places
     53- replace flag G4ANALYSIS_USE_AIDA by G4ANALYSIS_USE
     54- remove AIDA setup from GNUmakefile (use one from central scripts)
     55
     5601 May 2008, Fan Lei (exrdm-V09-01-00)
     57--------------------------------------------------
     58- Removed "," from the Ntuple header definition
     59- All energy depositions are collected, apart from that of the primary track. 
    1760
    1861November 15th, 2007 V.Ivanchenko (exrdm-V09-00-02)
  • trunk/examples/extended/radioactivedecay/exrdm/README

    r807 r1230  
    77                       --------------------
    88
    9   The exRDM is created to show how to use the G4RadioactiveDecay process to simulate the decays of radioactive
    10   isotopes as well as the induced radioactivity resulted from nuclear interactions. In the example a simple
    11   geometry consists of a cylindric target placed in the centre of a tube shaped detector is used. Various primary event
    12   generation and tallying options are available. More documentations are available at
     9  The exRDM is created to show how to use the G4RadioactiveDecay process to simulate the decays of
     10  radioactive isotopes as well as the induced radioactivity resulted from nuclear interactions.
     11
     12  In this example a simple geometry consists of a cylindric target placed in the centre of a tube detector
     13  is constructed. Various primary event generation and tallying options are available. Further documentations
     14  are available at
    1315
    1416          http://reat.space.qinetiq.com/septimess/exrdm
     
    3133                  5 cm long. The default material is "Germanium".
    3234
    33      The user can change the target/detector size and material at the at the "PreIni" state, using the commands under
     35     The user can change the target/detector size and material at the at the "PreIni" state, using the
     36     commands in the directory
    3437                 
    3538                /exrdm/det
    36 
    3739
    3840  2. PHYSICS
     
    5860                /grdm/selectVolume Target
    5961
    60 
    61 
    6262       - Hadronic processes:
    6363          Hadronic processes are not invoked by default. They can be activated by the user at the "PreIni"
    64           state of the execution via the command
     64          state via the command
    6565
    6666                /exrdm/phys/SelectPhysics
     
    7272                "QGSP_BERT", "QGSP_BIC", "QGSP_HP", "LHEP_BERT", "LHEP_BERT_HP", "LHEP_BIC",
    7373                "LHEP_BIC_HP".
    74 
    7574
    7675  3. EVENT:
     
    8483  4. DETECTOR RESPONSE:
    8584
    86      No Geant4 HITS and SD are defined in this example. All the relevant information of the simulation is extracted
    87      at the "UserSteppingAction" stage, if the variable "G4ANALYSIS_USE" is defined. These include:
     85     No Geant4 HITS and SD are defined in this example. If the variable "G4ANALYSIS_USE" is defined, all
     86     the relevant information of the simulation is collected  at the "UserSteppingAction" stage. These
     87     include:
    8888
    8989       - Emission particles in the RadioactiveDecay process:
     
    112112  6. ANALYSIS:
    113113
    114      This example implements an AIDA-compliant analysis system as well as the ROOT file format for
    115      histograms and ntuples. If the the user has an AIDA-compliant tool such as
    116      AIDAJNI, ANAPHE, or PI installed on his/her system, the analysis part of this example can
     114     This example implements an AIDA-compliant analysis system as well as the ROOT system, for accumulating
     115     and output histograms and ntuples. If the the user has an AIDA-compliant tool such as
     116     AIDAJNI, ANAPHE, OpenScientist or PI installed, the analysis part of this example can
    117117     be activated by
    118118       
    119         setenv G4ANALYSIS_USE_AIDA 1
    120 
    121      before building the executable.  The user can also add the "root" file format option by define
     119        setenv G4ANALYSIS_USE 1
     120
     121     before building the executable. 
     122
     123     The user can also use the executable with the ROOT system, if it is available. This is done by
    122124     
    123        setenv G4ANALYSIS_USE_RROT 1
     125       setenv G4ANALYSIS_USE_ROOT 1
    124126       
    125      before the compilation.
    126 
    127      At the completion of a simulation run a file "exrdm.root" by default is produced which contains
    128      these data structures. The user can change the name of this output file with the command
     127     again before the compilation. The AIDA and ROOT systems can be used individually, or in parallel
     128     at the same time!
     129
     130     If no analysis system is activated, there is no output file produced apart from the screen dump.
     131     A file called "exrdm.aida" is produced by default for AIDA system and "exrdm.root" if the ROOT
     132     system is selected.
     133 
     134     The user can change the name of this output file with the command
    129135
    130136        /histo/fileName new-filename
    131137
    132      The output file by default is in "root" format and can be analysed offline using the ROOT tool,
    133      which allows the histograms and ntuples to examined, manipulated, saved and printed.
    134 
    135      User can also change the output file format to "hbook"  or "xml" using the commands
     138     The output AIDA file by default is in xml format. The AIDA system allows the use of other file format
     139     such as "root" and "hbook". User can change the output format to "hbook"  or "root" using the command
     140     /histo/fileType.e.g.
    136141       
    137142        /histo/fileType hbook 
    138         /histo/fileType xml
     143        /histo/fileType root
    139144     
    140      The output file, in "xml" or "hbook" or "root" format, conatins the 3 ntuples (100,200,300) whose details have been
    141      described in section 4. In addition, there are 7 histograms in the file:
     145     When "root" format is selected for the AIDA system, the output AIDA file name is changed to
     146     fileName_aida.root. This is to separate it from the the ROOT system output file fileName.root, in case
     147     both systems are used.
     148   
     149     The output file, in "aida" or "hbook" or "root" format, conatins the 3 ntuples (100,200,300) which have
     150     been described in section 4. In addition, there are 7 histograms in the file:
    142151
    143152        histogram 10: The Pulse Height Spectrum (PHS) of the target.
     
    153162        /histo/setHisto
    154163
    155      It is assumed the detector and target pulses both have an integration time of 1 micro-second, and the
    156      coincidence gate is 2 microsecond wide. The target and detctor have a threshold of 10 keV in the
    157      anti-/coincidence modes.       
     164     It is assumed the detector and target pulses both have an integration time of 1 microsecond, and the
     165     gate is 2 microsecond for the coincidence spectrum. The target and detctor have a threshold of 10 keV
     166     in the anti-/coincidence modes.       
    158167
    159168     Histograms 10-15 were derived from the same data stored in ntuple-300(the energy depositions), while
    160169     Histogram 16 is obtained with data in ntuple-100 (the emission particles). The user should be able to
    161      reproduce these histograms, or new histograms, with the ntuple data in an analyis tool such as JAS3.
    162        
     170     reproduce these histograms, or new histograms, with the ntuple data in an off-line analyis tool.
    163171
    164172  7. GETTING STARTED:
     
    167175     example by
    168176
    169         setenv G4ANALYSIS_USE_AIDA 1
    170  
    171      in addition if you want to add the ROOT file format, do
     177        setenv G4ANALYSIS_USE 1
     178 
     179     in addition if you want to add the ROOT link to the ROOT system, do
    172180       
    173181        setenv G4ANALYSIS_USE_ROOT 1
    174182
    175      otherwise make sure the G4ANALYSIS_USE_AIDA and G4ANALYSIS_USE_ROOT are not definded
    176  
    177         unsetenv G4ANALYSIS_USE_AIDA
     183     Otherwise make sure the G4ANALYSIS_USE and G4ANALYSIS_USE_ROOT are not definded
     184 
     185        unsetenv G4ANALYSIS_USE
    178186        unsetenv G4ANALYSIS_USE_ROOT
    179187         
     
    184192         gmake
    185193
    186      gmake will create tmp and bin directories in your $G4TMP and $G4BIN directories.
     194     Depends on the setup, gmake will create tmp and bin directories in your $G4TMP and $G4BIN directories.
    187195     The executable, named exRDM, will be in $G4BIN/$G4SYSTEM/ directory.
    188196
     
    191199         $G4BIN/$G4SYSTEM/exRDM exrdm.in
    192200
    193      If all goes well, the execution shall be terminated in a few seconds. If G4ANALYSIS_USE_ROOT is
    194      defined, there will be a proton.root file in the current directory.
    195 
    196      One can use ROOT to exam the file.
     201     If all goes well, the execution shall be terminated in a few seconds. If G4ANALYSIS_USE is defined, one
     202     should see a "proton.aida" file created. If G4ANALYSIS_USE_ROOT is defined, there will be
     203     a proton.root file in the same directory.
    197204
    198205 8. FURTHER EXAMPLES:
    199206
    200     There are a number of g4mac files in the ./macros subdirectory, to show the features of the G4RadioactiveDecay
    201     process. Most of them will lead to the creation of an aida file in the same name of the micro file, which can
    202     be examed and analysed with an analysis tool such as ROOT.
     207    There are a number of g4mac files in the ./macros subdirectory, to show the features of the
     208    G4RadioactiveDecay process. Most of them will lead to the creation of an aida file in the same name
     209    of the micro file, which can be examed and analysed with an analysis tool such as OpenScientist ,or JAS3.
    203210 
    204211        vrml.mac:  to visulise the geometry and the incident of one 100 MeV Cf240 isotope and its decay. A vrml
  • trunk/examples/extended/radioactivedecay/exrdm/exRDM.cc

    r807 r1230  
    5858
    5959  // Creation of the analysis manager
    60   exrdmAnalysisManager* analysis = exrdmAnalysisManager::getInstance();
     60  exrdmAnalysisManager::getInstance();
    6161
    6262  // set mandatory initialization classes
     
    116116  delete visManager;
    117117#endif
    118   delete analysis;
     118  exrdmAnalysisManager::dispose();
    119119  delete runManager;
    120120
  • trunk/examples/extended/radioactivedecay/exrdm/exrdm.in

    r807 r1230  
    1 /control/saveHistory
     1#/control/saveHistory
    22/exrdm/phys/SelectPhysics QGSP_BIC_HP
    33#/exrdm/phys/SelectPhysics Hadron
     
    2020/gps/energy 1 GeV
    2121/tracking/verbose 0
    22 /run/beamOn 10
     22/run/beamOn 1000
    2323
    2424
  • trunk/examples/extended/radioactivedecay/exrdm/include/exrdmAnalysisManager.hh

    r807 r1230  
    5858
    5959  static exrdmAnalysisManager* getInstance();
     60  static void dispose();
    6061
    6162private:
    6263
    6364  exrdmAnalysisManager();
     65  ~exrdmAnalysisManager();
    6466
    6567public: // Without description
    66 
    67   ~exrdmAnalysisManager();
    6868
    6969  void bookHisto();
  • trunk/examples/extended/radioactivedecay/exrdm/include/exrdmHisto.hh

    r807 r1230  
    3939#include <vector>
    4040
    41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    42 
    43 class exrdmHistoMessenger;
    44 
    45 #ifdef G4ANALYSIS_USE_AIDA
     41#ifdef G4ANALYSIS_USE
    4642namespace AIDA {
     43 class IAnalysisFactory;
    4744 class ITree;
    4845 class ITuple;
     
    5148#endif
    5249
     50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     51
    5352#ifdef G4ANALYSIS_USE_ROOT
     53// Root classes
    5454class TFile;
    5555class TH1D;
     
    5757#endif
    5858
     59class exrdmHistoMessenger;
    5960
    6061class exrdmHisto
     
    9293  void fillTuple(G4int, G4int, G4double);
    9394  // Fill nTuple at a given col with a double
    94   void fillTuple(G4int, const G4String&, G4String);
     95  void fillTuple(G4int, const G4String&, G4String&);
    9596  // Fill nTuple parameter with a string
    9697
     
    115116  G4int    verbose;
    116117  G4int    defaultAct;
    117 
    118 #ifdef G4ANALYSIS_USE_AIDA
     118#ifdef G4ANALYSIS_USE
    119119  std::vector<AIDA::IHistogram1D*> histo;
    120120  std::vector<AIDA::ITuple*>   ntup;
     121  AIDA::IAnalysisFactory* aida;
    121122  AIDA::ITree*    tree;
    122123#endif
  • trunk/examples/extended/radioactivedecay/exrdm/macros/f24.mac

    r807 r1230  
    3333#
    3434# complete chain decays
    35 /histo/fileName f24c.aida
     35/histo/fileName f24c
    3636/run/beamOn 1000
    3737#
    3838# complete chain decays in VR mode
    3939/grdm/analogueMC 0
    40 /histo/fileName f24c-b.aida
     40/histo/fileName f24c-b
    4141/run/beamOn 1000
    4242#
  • trunk/examples/extended/radioactivedecay/exrdm/macros/neutron-10ev.mac

    r807 r1230  
    11#################################################################################
    22#                                                                               #
    3 
    43# THIS TEST TO DEMONSTRATE THAT ISOTOPES GENERATED IN HADRONIC                  #
    54# PROCESSES CAN BE TREATED BY THE RDM.                                          #
     
    87#
    98#
    10 /exrdm/phys/SelectPhysics Hadron
    119/geometry/material/add NaI Na-I 3.67
    1210/exrdm/det/setTargetMate NaI
     11
    1312# material definitions has to be done before /run/initilalize
    1413/histo/fileName neutron-10ev
     14/exrdm/phys/SelectPhysics Hadron
    1515/run/initialize
     16
    1617/run/setCutForRegion Target 10 cm
    1718/run/setCutForRegion Detector 50 cm
     
    2425/gps/energy 10 eV
    2526/run/beamOn 1000
    26 
    27 
    28 
    29 
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmAnalysisManager.cc

    r807 r1230  
    4646  return fManager;
    4747}
     48void exrdmAnalysisManager::dispose()
     49{
     50  delete fManager;
     51  fManager = 0;
     52}
    4853
    4954//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    5863  pulseWidth = 1.*microsecond;
    5964  histo   = new exrdmHisto();
    60 #if defined G4ANALYSIS_USE_AIDA || defined G4ANALYSIS_USE_ROOT
    61    bookHisto();
     65  bookHisto();
     66}
     67
     68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     69
     70exrdmAnalysisManager::~exrdmAnalysisManager()
     71{
     72#ifdef G4ANALYSIS_USE
     73#define HISTDELETE
    6274#endif
    63 }
    64 
    65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    66 
    67 exrdmAnalysisManager::~exrdmAnalysisManager()
    68 {
    69 //  delete histo;
     75#ifdef G4ANALYSIS_USE_ROOT
     76#define HISTDELETE
     77#endif
     78#ifdef HISTDELETE
     79  delete histo;
     80#endif
    7081}
    7182
     
    94105  // in aida these histos are indiced from 0-6
    95106  //
    96   histo->addTuple( "100", "Emitted Particles","float PID, Energy, Time, Weight" );
    97   histo->addTuple( "200", "RadioIsotopes","float PID, Time, Weight" );
    98   histo->addTuple( "300", "Energy Depositions","float Energy, Time, Weight" );
     107  histo->addTuple( "1", "Emitted Particles","double PID, Energy, Time, Weight" );
     108  histo->addTuple( "2", "RadioIsotopes","double PID, Time, Weight" );
     109  histo->addTuple( "3", "Energy Depositions","double Energy, Time, Weight" );
    99110
    100111}
     
    104115void exrdmAnalysisManager::BeginOfRun()
    105116{
    106 #if defined G4ANALYSIS_USE_AIDA || G4ANALYSIS_USE_ROOT
    107117  histo->book();
    108 #endif
    109   if(verbose > 0) {
    110     G4cout << "exrdmAnalysisManager: Histograms are booked and the run has been started"
    111            << G4endl;
    112   }
     118  G4cout << "exrdmAnalysisManager: Histograms are booked and the run has been started" << G4endl;
    113119}
    114120
     
    117123void exrdmAnalysisManager::EndOfRun()
    118124{
    119 #if defined G4ANALYSIS_USE_AIDA || G4ANALYSIS_USE_ROOT
    120125  histo->save(); 
    121 #endif
    122126}
    123127
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmEventAction.cc

    r807 r1230  
    6767void exrdmEventAction::EndOfEventAction(const G4Event* evt)
    6868{
    69   G4int event_id       = evt->GetEventID();
    7069  //analysis
    7170  exrdmAnalysisManager::getInstance()->EndOfEvent();
    7271  // visualisation
     72#ifdef G4VIS_USE
     73  G4int event_id       = evt->GetEventID();
    7374  if (event_id < 100 && G4VVisManager::GetConcreteInstance()) {
    7475    G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
     
    8586    }
    8687  }
     88#endif
    8789}
    8890
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmHisto.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 
    27 #include "exrdmHisto.hh"
    28 #include "exrdmHistoMessenger.hh"
    29 #include "G4ParticleTable.hh"
    30 
    31 #include "G4Tokenizer.hh"
    32 
    33 #ifdef G4ANALYSIS_USE_AIDA
     26#ifdef G4ANALYSIS_USE
    3427#include <AIDA/AIDA.h>
    3528#endif
     
    4740#include "TNtuple.h"
    4841#endif
     42
     43#include "exrdmHisto.hh"
     44#include "exrdmHistoMessenger.hh"
     45#include "G4ParticleTable.hh"
     46
     47#include "G4Tokenizer.hh"
     48
    4949//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    5050exrdmHisto::exrdmHisto()
    5151{
    52   verbose    = 0;
     52  verbose    = 1;
    5353  histName   = "exrdm";
    54   histType   = "root";
     54  histType   = "aida";
     55  //histType   = "root";
    5556  nHisto     = 0;
    5657  nTuple     = 0;
    5758  defaultAct = 1;
    5859  //
    59 #ifdef G4ANALYSIS_USE_AIDA
    60   histo.clear();
    61   ntup.clear();
    62 #endif
     60#ifdef G4ANALYSIS_USE
     61  aida = 0;
     62  tree = 0;
     63#endif
     64
    6365#ifdef G4ANALYSIS_USE_ROOT
    6466  ROOThisto.clear();
     
    6769  Rcol.clear();
    6870#endif
     71
    6972  active.clear();
    7073  bins.clear();
     
    7881  tupleList.clear();
    7982  tupleListROOT.clear();
    80   messenger  = 0;
    8183
    8284  messenger = new exrdmHistoMessenger(this);
     
    8789exrdmHisto::~exrdmHisto()
    8890{
    89 #ifdef G4ANALYSIS_USE_AIDA
    90   for(G4int i=0; i<nHisto; i++) {
    91     if(histo[i]) delete histo[i];
    92   }
    93 #endif
    94 #ifdef G4ANALYSIS_USE_ROOT
    95   for(G4int i=0; i<nHisto; i++) {
    96     if(ROOThisto[i]) delete ROOThisto[i];
    97   }
     91#ifdef G4ANALYSIS_USE
     92  histo.clear();
     93  ntup.clear();
     94#endif
     95#ifdef G4ANALYSIS_USE_ROOT
     96  //FIXME : G.Barrand : the below is crashy.
     97  //        In principle the TH are deleted
     98  //        when doing the TFile::Close !
     99  //         In fact the hfileROOT should
     100  //        be deleted in save(). And I am pretty
     101  //        sure that the TApplication is not needed.
     102  //
     103  // removed by F.Lei
     104  //  for(G4int i=0; i<nHisto; i++) {
     105  //   if(ROOThisto[i]) delete ROOThisto[i];
     106  // }
    98107#endif
    99108  delete messenger;
     
    104113void exrdmHisto::book()
    105114{
     115#ifdef G4ANALYSIS_USE
    106116  G4cout << "### exrdmHisto books " << nHisto << " histograms " << G4endl;
    107 #ifdef G4ANALYSIS_USE_AIDA
    108117  // Creating the analysis factory
    109   AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
     118  aida = AIDA_createAnalysisFactory();
     119  if(!aida) {
     120    G4cout << "ERROR: can't get AIDA." << G4endl;
     121    return;
     122  }
    110123  // Creating the tree factory
    111   AIDA::ITreeFactory* tf = af->createTreeFactory();
     124 {AIDA::ITreeFactory* tf = aida->createTreeFactory();
    112125  // Creating a tree mapped to a new aida file.
    113   G4String aidaFileName;
    114   if (fileType == "hbook")
    115     aidaFileName = histName +G4String(".hbook");
    116   else
    117     aidaFileName = histName +G4String(".aida");
    118   tree = tf->create(aidaFileName,histType,false,true,"uncompress");
    119   if(tree)
    120     G4cout << "Tree store  : " << tree->storeName() << G4endl;
    121   else
    122     G4cout << "ERROR: Tree store " << histName  << " is not created!" << G4endl;
    123 
     126  G4String fileName = histName + "." + histType;
     127  if (histType == "root") fileName = histName + "_aida." + histType;
     128  tree = tf->create(fileName,histType,false,true,"compress=yes");
     129  delete tf;
     130  if(!tree) {
     131    G4cout << "ERROR: Tree store " << histName  << " is not created!" << G4endl;
     132    return;
     133  }
     134  G4cout << "Tree store  : " << tree->storeName() << G4endl;}
    124135  // Creating a histogram factory, whose histograms will be handled by the tree
    125   AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
     136 {AIDA::IHistogramFactory* hf = aida->createHistogramFactory(*tree);
    126137  // Creating an 1-dimensional histograms in the root directory of the tree
    127138  for(G4int i=0; i<nHisto; i++) {
    128139    if(active[i]) {
    129       histo[i] = hf->createHistogram1D(ids[i], titles[i], bins[i], xmin[i], xmax[i]);
     140      if(verbose>1)
     141        G4cout<<"book: histogram "<< i << " id= " << ids[i] <<G4endl;
     142      G4String tit = ids[i];
     143      if(histType == "root") tit = "h" + ids[i];
     144      histo[i] = hf->createHistogram1D(tit, titles[i], bins[i], xmin[i], xmax[i]);
    130145    }
    131146  }
     147  delete hf;
     148  G4cout << "AIDA histograms are booked" << G4endl;}
     149
    132150  // Creating a tuple factory, whose tuples will be handled by the tree 
    133   AIDA::ITupleFactory* tpf =  af->createTupleFactory( *tree );
     151 {AIDA::ITupleFactory* tpf =  aida->createTupleFactory( *tree );
     152  G4cout << "AIDA will book " << nTuple << " ntuples" << G4endl;
    134153  for(G4int i=0; i<nTuple; i++) {
    135154    if(tupleList[i] != "") {
    136       G4cout << "Creating Ntuple: " << tupleName[i] << G4endl;
    137       ntup[i] = tpf->create(tupleId[i], tupleName[i], tupleList[i]);
     155      G4cout << "Creating Ntuple: " << tupleName[i] <<":" <<tupleList[i] <<G4endl;
     156      ntup[i] = tpf->create(tupleId[i], tupleName[i], tupleList[i],"");
    138157    }
    139158  }
    140 #endif
    141 
    142 #ifdef G4ANALYSIS_USE_ROOT
    143   new TApplication("App", ((int *)0), ((char **)0));
     159  delete tpf;
     160  G4cout << "AIDA ntuples are booked" << G4endl;}
     161#endif
     162
     163#ifdef G4ANALYSIS_USE_ROOT
     164//  new TApplication("App", ((int *)0), ((char **)0));
    144165  G4String fileNameROOT = histName + G4String(".root");
    145166  hfileROOT = new TFile(fileNameROOT.c_str() ,"RECREATE","ROOT file for exRDM");
    146  
     167  G4cout << "Root file: " << fileNameROOT << G4endl;
    147168  // Creating an 1-dimensional histograms in the root directory of the tree
    148169  for(G4int i=0; i<nHisto; i++) {
     
    157178    if(tupleListROOT[i] != "") {
    158179      G4String id = G4String("t")+tupleId[i];
    159       G4cout << "Creating Ntuple "<<tupleId[i] << " in ROOT file: " << tupleName[i] << G4endl;
     180      G4cout << "Creating Ntuple "<<tupleId[i] << " in ROOT file: "
     181             << tupleName[i] << G4endl;
    160182      ROOTntup[i] = new TNtuple(id, tupleName[i], tupleListROOT[i]);
     183      G4cout << "ROOT Ntuple " << id << " " << tupleName[i] <<" "<< tupleListROOT[i]<< " booked " << G4endl;
    161184    }
    162185  }
     
    169192void exrdmHisto::save()
    170193{
    171 #ifdef G4ANALYSIS_USE_AIDA
     194#ifdef G4ANALYSIS_USE
    172195  // Write histogram file
    173196  tree->commit();
     
    175198  tree->close();
    176199  G4cout << "Histograms and Ntuples are saved" << G4endl;
     200  delete tree;
     201  tree = 0;
     202  delete aida;
     203  aida = 0;
     204  {for(G4int i=0; i<nHisto; i++) histo[i] = 0;}
     205  {for(G4int i=0; i<nTuple; i++) ntup[i] = 0;}
    177206#endif
    178207#ifdef G4ANALYSIS_USE_ROOT
     
    181210  G4cout << "ROOT: files closing..." << G4endl;
    182211  hfileROOT->Close();
     212  //
     213  // F.Lei added following Guy's suggestion!
     214  delete hfileROOT;
     215
    183216#endif
    184217}
     
    205238  ids.push_back(id);
    206239  titles.push_back(name);
    207 #ifdef G4ANALYSIS_USE_AIDA
     240#ifdef G4ANALYSIS_USE
    208241  histo.push_back(0);
    209242#endif
     
    241274           << G4endl;   
    242275  }
    243 #ifdef G4ANALYSIS_USE_AIDA 
     276#ifdef G4ANALYSIS_USE
    244277  if(i>=0 && i<nHisto) {
    245     histo[i]->fill((float)(x/unit[i]), (float)w);
     278    histo[i]->fill(x/unit[i], w);
    246279  } else {
    247280    G4cout << "exrdmHisto::fill: WARNING! wrong AIDA histogram index " << i << G4endl;
     
    264297    G4cout << "Scale histogram: #" << i << " by factor " << x << G4endl;   
    265298  }
    266 #ifdef G4ANALYSIS_USE_AIDA 
     299#ifdef G4ANALYSIS_USE
    267300  if(i>=0 && i<nHisto) {
    268301    histo[i]->scale(x);
     
    281314//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    282315
    283 void exrdmHisto::addTuple(const G4String& w1, const G4String& w2, const G4String& w3)
    284 {
    285 //  G4cout << w1 << " " << w2 << " " << w3 << G4endl;
     316#ifdef G4ANALYSIS_USE
     317void exrdmHisto::addTuple(const G4String& w1, const G4String& w2, const G4String& w3 )
     318#else
     319void exrdmHisto::addTuple(const G4String& w1, const G4String& w2, const G4String& )
     320#endif
     321
     322{
     323  //G4cout << w1 << " " << w2 << " " << w3 << G4endl;
     324  nTuple++;
     325  tupleId.push_back(w1);
     326  tupleName.push_back(w2) ;
     327#ifdef G4ANALYSIS_USE
     328  tupleList.push_back(w3);
     329  ntup.push_back(0);
     330#endif
     331
     332#ifdef G4ANALYSIS_USE_ROOT
    286333  std::vector<float> ar;
    287334  ar.clear();
    288335  for (size_t i = 0; i < 20; i++) ar.push_back(0.);
    289   nTuple++;
    290 #ifdef G4ANALYSIS_USE_ROOT
    291336  Rarray.push_back(ar);
    292 #endif
    293   tupleId.push_back(w1);
    294   tupleName.push_back(w2) ;
    295337  // convert AIDA header to ROOT header for ntuple
    296338  G4Tokenizer next(w3);
     
    300342  while ( token != "") {
    301343   token = next();
    302    ROOTList1 = ROOTList1 + token +G4String(":");
     344   if (token == ",") token = next();
     345   if (token.contains(",")) token.remove(token.size()-1);
     346   ROOTList1 = ROOTList1 + token + G4String(":");
    303347   col++;
    304348  }
     
    306350//  G4cout << ROOTList << G4endl;
    307351  tupleListROOT.push_back(ROOTList);
    308   //
    309 #ifdef G4ANALYSIS_USE_AIDA 
    310   ntup.push_back(0);
    311 #endif
    312 #ifdef G4ANALYSIS_USE_ROOT
    313352  ROOTntup.push_back(0);
    314353  Rcol.push_back(col-1);
     
    323362    G4cout << "fill tuple # " << i
    324363           <<" with  parameter <" << parname << "> = " << x << G4endl;
    325 #ifdef G4ANALYSIS_USE_AIDA 
    326   if(ntup[i]) ntup[i]->fill(ntup[i]->findColumn(parname), (float)x);
     364#ifdef G4ANALYSIS_USE
     365  if(ntup[i]) ntup[i]->fill(ntup[i]->findColumn(parname), x);
    327366#endif
    328367}
     
    336375           <<" in column < " << col << "> = " << x << G4endl;
    337376  }
    338 #ifdef G4ANALYSIS_USE_AIDA 
    339   if(ntup[i]) ntup[i]->fill(col, (float)x);
     377#ifdef G4ANALYSIS_USE
     378  if(ntup[i]) ntup[i]->fill(col,double(x));
    340379#endif
    341380
     
    348387//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    349388
    350 void exrdmHisto::fillTuple(G4int i, const G4String& parname, G4String x)
     389void exrdmHisto::fillTuple(G4int i, const G4String& parname, G4String& x)
    351390{
    352391  if(verbose > 1) {
     
    354393           <<" with  parameter <" << parname << "> = " << x << G4endl;
    355394  }
    356 #ifdef G4ANALYSIS_USE_AIDA 
     395#ifdef G4ANALYSIS_USE
    357396  if(ntup[i]) ntup[i]->fill(ntup[i]->findColumn(parname), x);
    358397#endif
     398
    359399}
    360400
     
    363403void exrdmHisto::addRow(G4int i)
    364404{
    365 #ifdef G4ANALYSIS_USE_AIDA
     405  if(verbose > 1) G4cout << "Added a raw #" << i << " to tuple" << G4endl;
     406#ifdef G4ANALYSIS_USE
    366407  if(ntup[i]) ntup[i]->addRow();
    367408#endif
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmHistoMessenger.cc

    r807 r1230  
    4949
    5050  fileCmd = new G4UIcmdWithAString("/histo/fileType",this);
    51   fileCmd->SetGuidance("set type (hbook, XML) for the histograms file");
     51  fileCmd->SetGuidance("set type (aida, hbook or root) for the histograms file");
    5252  fileCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    5353
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmMaterial.cc

    r807 r1230  
    115115
    116116  G4Material* aMaterial = 0;
    117   //  G4cout << name <<" "<< formula << " " << density/(g/cm3) << " " << tem <<" " <<pres << G4endl;
     117  G4cout << name <<" "<< formula << " " << density/(g/cm3) << " " << tem <<" " <<pres << G4endl;
    118118 
    119119  if (state == "") {
     
    237237      } else {
    238238        if (natoms>0) {
    239           aMaterial->AddElement( G4Element::GetElement(isotopename) , natoms);
     239          aMaterial->AddElement( G4Element::GetElement(isotopename,false) , natoms);
    240240        } else {
    241           aMaterial->AddElement( G4Element::GetElement(isotopename) , fatoms);
     241          aMaterial->AddElement( G4Element::GetElement(isotopename,false) , fatoms);
    242242        }
    243243      }     
    244244    } else {
    245       if ( G4Element::GetElement(element) == NULL) {
     245      if ( G4Element::GetElement(element,false) == NULL) {
    246246        G4Element* aElement = new G4Element(element, element, Z, A[Z-1]*g/mole);
    247247        if (natoms>0) {
     
    253253      } else {
    254254        if (natoms>0) {
    255           aMaterial->AddElement( G4Element::GetElement(element) , natoms);
     255          aMaterial->AddElement( G4Element::GetElement(element,false) , natoms);
    256256        } else {
    257           aMaterial->AddElement( G4Element::GetElement(element) , fatoms);
     257          aMaterial->AddElement( G4Element::GetElement(element,false) , fatoms);
    258258        }
    259259      }
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmMaterialMessenger.cc

    r807 r1230  
    130130    //    G4cout<< "stat = " <<state<< "tem = " << tem<< " pre = " << pres << G4endl;
    131131    //     tick *= G4UIcommand::ValueOf(unt);
    132     materialsManager->AddMaterial(material,formula,den,state,tem,pres);
     132    materialsManager->AddMaterial(material,formula,den*g/cm3,state,tem,pres);
    133133  }
    134134}
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmPhysListHadron.cc

    r807 r1230  
    253253  theAlphaInelasticProcess->RegisterMe(theTheoModel);
    254254  pManager->AddDiscreteProcess(theAlphaInelasticProcess);
     255
    255256  // GenericIon
    256257  pManager = G4GenericIon::GenericIon()->GetProcessManager();
     
    266267  theIonInelasticProcess->RegisterMe(theIonBC);
    267268  theIonInelasticProcess->RegisterMe(theTheoModel);
    268   pManager->AddDiscreteProcess(theIonInelasticProcess);
    269 
    270   // Add RadioactiveDecay Process
    271 
    272   G4RadioactiveDecay*  theRadioactiveDecay = new G4RadioactiveDecay();
    273   G4GenericIon* ion = G4GenericIon::GenericIon();
    274   pManager->AddProcess(theRadioactiveDecay, 0, -1, 3);
    275  
     269  pManager->AddDiscreteProcess(theIonInelasticProcess);
    276270}
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmPhysicsList.cc

    r807 r1230  
    7575  pMessenger = new exrdmPhysicsListMessenger(this);
    7676
    77   SetVerboseLevel(2);
     77  SetVerboseLevel(1);
    7878
    7979  //default physics
     
    8787 
    8888  // Had physics
    89   hadPhysicsList = new exrdmPhysListHadron("hadron");
     89  hadPhysicsList = 0;
    9090  nhadcomp = 0;
    9191
     
    131131  }
    132132  if (hadPhysicsList) hadPhysicsList->ConstructProcess();
     133  G4cout << "### exrdmPhysicsList::ConstructProcess is done" << G4endl;
     134
    133135}
    134136
     
    141143  }
    142144  // default  Had physics
    143   if (name == "Hadron" && nhadcomp == 0) {
    144     if (hadPhysicsList) delete hadPhysicsList;
     145  if (name == "Hadron" && !hadPhysicsList) {
    145146    hadPhysicsList = new exrdmPhysListHadron("hadron");
    146147  } else if (name == "QGSP_BERT") {
    147148    AddExtraBuilders(false);
    148149    hadPhysicsList = new HadronPhysicsQGSP_BERT("std-hadron");
    149   } else if (name == "QGSP_BIC" && nhadcomp == 0) {
     150  } else if (name == "QGSP_BIC" && !hadPhysicsList) {
    150151    AddExtraBuilders(false);
    151152    hadPhysicsList = new HadronPhysicsQGSP_BIC("std-hadron");
    152   } else if (name == "QGSP_BERT_HP"  && nhadcomp == 0) {
     153  } else if (name == "QGSP_BERT_HP"  && !hadPhysicsList) {
    153154    AddExtraBuilders(true);
    154155    hadPhysicsList = new HadronPhysicsQGSP_BERT_HP("std-hadron");
    155   } else if (name == "QGSP_BIC_HP"  && nhadcomp == 0) {
     156  } else if (name == "QGSP_BIC_HP"  && !hadPhysicsList) {
    156157    AddExtraBuilders(true);
    157158    hadPhysicsList = new HadronPhysicsQGSP_BIC_HP("std-hadron");
    158159  } else if (name == "LowEnergy_EM") {
    159     if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) {
    160       if (emPhysicsList) delete emPhysicsList;
     160      delete emPhysicsList;
    161161      emPhysicsList = new exrdmPhysListEmLowEnergy("lowe-em");
    162     } else {
    163       G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;
    164     }     
    165162  } else if (name == "Standard_EM") {
    166     if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) {
    167       if (emPhysicsList) delete emPhysicsList;
     163      delete emPhysicsList;
    168164      emPhysicsList = new G4EmStandardPhysics();
    169     } else {
    170       G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;
    171     }
    172165  } else {
    173166      G4cout << "exrdmPhysicsList WARNING wrong or unkonwn <"
     
    180173void exrdmPhysicsList::AddExtraBuilders(G4bool flagHP)
    181174{
    182   if (emPhysicsList) delete emPhysicsList;
    183   emPhysicsList = new G4EmStandardPhysics();
    184 
    185   if (hadPhysicsList) {
    186     delete hadPhysicsList;
    187     hadPhysicsList = 0;
    188   }
    189   nhadcomp = 6;
    190 
     175  nhadcomp = 5;
    191176  hadronPhys.push_back( new G4EmExtraPhysics("extra EM"));
    192177  hadronPhys.push_back( new G4HadronElasticPhysics("elastic",verboseLevel,
     
    194179  hadronPhys.push_back( new G4QStoppingPhysics("stopping",verboseLevel));
    195180  hadronPhys.push_back( new G4IonBinaryCascadePhysics("ionBIC"));
    196   hadronPhys.push_back( new G4RadioactiveDecayPhysics("radioactiveDecay"));
    197181  hadronPhys.push_back( new G4NeutronTrackingCut("Neutron tracking cut"));
    198182}
     
    202186void exrdmPhysicsList::SetCuts()
    203187{
    204 
    205188  SetCutValue(cutForGamma, "gamma");
    206189  SetCutValue(cutForElectron, "e-");
     
    226209{
    227210  cutForGamma = cut;
     211  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
    228212}
    229213
     
    233217{
    234218  cutForElectron = cut;
     219  SetParticleCuts(cutForElectron, G4Electron::Electron());
    235220}
    236221
     
    240225{
    241226  cutForPositron = cut;
     227  SetParticleCuts(cutForPositron, G4Positron::Positron());
    242228}
    243229
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmRunAction.cc

    r807 r1230  
    5858    G4cout << "### Run : " << RunN << G4endl;
    5959
     60#ifdef G4VIS_USE
    6061  if (G4VVisManager::GetConcreteInstance())
    6162    {
     
    6465      UI->ApplyCommand("/vis/draw/current");
    6566    }
     67#endif
    6668}
    6769
     
    7476  analysis->EndOfRun();
    7577 
     78#ifdef G4VIS_USE
    7679  if (G4VVisManager::GetConcreteInstance())
    7780    G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
     81#endif
    7882}
    7983
  • trunk/examples/extended/radioactivedecay/exrdm/src/exrdmSteppingAction.cc

    r807 r1230  
    4646void exrdmSteppingAction::UserSteppingAction(const G4Step* fStep)
    4747{
    48 #ifdef G4ANALYSIS_USE
    4948  G4Track* fTrack = fStep->GetTrack();
    5049  G4int StepNo = fTrack->GetCurrentStepNumber();
    5150  if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill);
     51
     52#ifdef G4ANALYSIS_USE
     53#define COLLECT
     54#endif
     55#ifdef G4ANALYSIS_USE_ROOT
     56#ifndef COLLECT
     57#define COLLECT
     58#endif
     59#endif
     60
     61#ifdef COLLECT
    5262  if (StepNo == 1) {
    5363    if ( (fTrack->GetDefinition()->GetParticleType() == "nucleus") &&
     
    8090    }
    8191  }
    82   // energy deposition: collect energy deposited by decay products only
     92  // energy deposition
    8393  if (fTrack->GetTrackID() != 1 ) {
    84     if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { 
     94    //    if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") {   
    8595      if (fStep->GetTotalEnergyDeposit() ) {
    8696        G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ;
     
    92102        exrdmAnalysisManager::getInstance()->AddEnergy(edep,weight,time);
    93103      }
    94     }
     104      //    }
    95105  }
    96 #endif  
     106#endif
    97107}
    98108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracChangeset for help on using the changeset viewer.