Changeset 1230 for trunk/examples/extended/radioactivedecay/exrdm
- Timestamp:
- Jan 8, 2010, 3:02:48 PM (15 years ago)
- 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:39flei Exp $1 # $Id: GNUmakefile,v 1.9 2008/12/05 09:57:30 flei Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module … … 12 12 endif 13 13 14 ifdef G4ANALYSIS_USE_ROOT15 CPPFLAGS += -DG4ANALYSIS_USE_ROOT16 CPPFLAGS += -D_REENTRANT -I$(ROOTSYS)/include17 18 EXTRALIBS += -L$(ROOTSYS)/lib \19 -lCore -lCint \20 -lHist -lGraf -lGraf3d -lGpad \21 -lTree -lRint -lPostscript \22 -lMatrix -lPhysics \23 -lm -ldl -lpthread -rdynamic24 25 endif26 27 ifdef G4ANALYSIS_USE_AIDA28 CPPFLAGS += -DG4ANALYSIS_USE_AIDA29 CPPFLAGS += `aida-config --include`30 LDLIBS += `aida-config --lib`31 endif32 33 14 .PHONY: all 34 15 all: lib bin 35 16 17 ifdef G4ANALYSIS_USE_ROOT 18 CPPFLAGS += -DG4ANALYSIS_USE_ROOT 19 endif 20 21 include $(G4INSTALL)/config/architecture.gmk 22 23 ifdef G4ANALYSIS_USE_ROOT 24 CPPFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags) 25 LDFLAGS += $(shell $(ROOTSYS)/bin/root-config --glibs) 26 endif 27 36 28 include $(G4INSTALL)/config/binmake.gmk 37 29 30 anaclean: 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 vnivanchExp $1 $Id: History,v 1.27 2009/09/22 16:50:06 gunter Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 15 15 * Reverse chronological order (last date on top), please * 16 16 ---------------------------------------------------------- 17 18 22/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 22 05/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 27 04/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 33 04/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 42 02/12/2008 F.Lei (exrdm-V09-01-02) 43 - exrdmHisto,exrdmHistoMessenger & exrdmAnalysisManager: updated the usage 44 of AIDA analysis package. 45 46 August 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 56 01 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. 17 60 18 61 November 15th, 2007 V.Ivanchenko (exrdm-V09-00-02) -
trunk/examples/extended/radioactivedecay/exrdm/README
r807 r1230 7 7 -------------------- 8 8 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 13 15 14 16 http://reat.space.qinetiq.com/septimess/exrdm … … 31 33 5 cm long. The default material is "Germanium". 32 34 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 34 37 35 38 /exrdm/det 36 37 39 38 40 2. PHYSICS … … 58 60 /grdm/selectVolume Target 59 61 60 61 62 62 - Hadronic processes: 63 63 Hadronic processes are not invoked by default. They can be activated by the user at the "PreIni" 64 state of the executionvia the command64 state via the command 65 65 66 66 /exrdm/phys/SelectPhysics … … 72 72 "QGSP_BERT", "QGSP_BIC", "QGSP_HP", "LHEP_BERT", "LHEP_BERT_HP", "LHEP_BIC", 73 73 "LHEP_BIC_HP". 74 75 74 76 75 3. EVENT: … … 84 83 4. DETECTOR RESPONSE: 85 84 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: 88 88 89 89 - Emission particles in the RadioactiveDecay process: … … 112 112 6. ANALYSIS: 113 113 114 This example implements an AIDA-compliant analysis system as well as the ROOT file format for115 histograms and ntuples. If the the user has an AIDA-compliant tool such as116 AIDAJNI, ANAPHE, or PI installed on his/her system, the analysis part of this example can114 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 117 117 be activated by 118 118 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 122 124 123 setenv G4ANALYSIS_USE_R ROT 1125 setenv G4ANALYSIS_USE_ROOT 1 124 126 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 129 135 130 136 /histo/fileName new-filename 131 137 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. 136 141 137 142 /histo/fileType hbook 138 /histo/fileType xml143 /histo/fileType root 139 144 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: 142 151 143 152 histogram 10: The Pulse Height Spectrum (PHS) of the target. … … 153 162 /histo/setHisto 154 163 155 It is assumed the detector and target pulses both have an integration time of 1 micro -second, and the156 coincidence gate is 2 microsecond wide. The target and detctor have a threshold of 10 keV in the157 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. 158 167 159 168 Histograms 10-15 were derived from the same data stored in ntuple-300(the energy depositions), while 160 169 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. 163 171 164 172 7. GETTING STARTED: … … 167 175 example by 168 176 169 setenv G4ANALYSIS_USE _AIDA1170 171 in addition if you want to add the ROOT file format, do177 setenv G4ANALYSIS_USE 1 178 179 in addition if you want to add the ROOT link to the ROOT system, do 172 180 173 181 setenv G4ANALYSIS_USE_ROOT 1 174 182 175 otherwise make sure the G4ANALYSIS_USE_AIDAand G4ANALYSIS_USE_ROOT are not definded176 177 unsetenv G4ANALYSIS_USE _AIDA183 Otherwise make sure the G4ANALYSIS_USE and G4ANALYSIS_USE_ROOT are not definded 184 185 unsetenv G4ANALYSIS_USE 178 186 unsetenv G4ANALYSIS_USE_ROOT 179 187 … … 184 192 gmake 185 193 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. 187 195 The executable, named exRDM, will be in $G4BIN/$G4SYSTEM/ directory. 188 196 … … 191 199 $G4BIN/$G4SYSTEM/exRDM exrdm.in 192 200 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. 197 204 198 205 8. FURTHER EXAMPLES: 199 206 200 There are a number of g4mac files in the ./macros subdirectory, to show the features of the G4RadioactiveDecay201 process. Most of them will lead to the creation of an aida file in the same name of the micro file, which can202 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. 203 210 204 211 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 58 58 59 59 // Creation of the analysis manager 60 exrdmAnalysisManager * analysis = exrdmAnalysisManager::getInstance();60 exrdmAnalysisManager::getInstance(); 61 61 62 62 // set mandatory initialization classes … … 116 116 delete visManager; 117 117 #endif 118 delete analysis;118 exrdmAnalysisManager::dispose(); 119 119 delete runManager; 120 120 -
trunk/examples/extended/radioactivedecay/exrdm/exrdm.in
r807 r1230 1 /control/saveHistory1 #/control/saveHistory 2 2 /exrdm/phys/SelectPhysics QGSP_BIC_HP 3 3 #/exrdm/phys/SelectPhysics Hadron … … 20 20 /gps/energy 1 GeV 21 21 /tracking/verbose 0 22 /run/beamOn 10 22 /run/beamOn 1000 23 23 24 24 -
trunk/examples/extended/radioactivedecay/exrdm/include/exrdmAnalysisManager.hh
r807 r1230 58 58 59 59 static exrdmAnalysisManager* getInstance(); 60 static void dispose(); 60 61 61 62 private: 62 63 63 64 exrdmAnalysisManager(); 65 ~exrdmAnalysisManager(); 64 66 65 67 public: // Without description 66 67 ~exrdmAnalysisManager();68 68 69 69 void bookHisto(); -
trunk/examples/extended/radioactivedecay/exrdm/include/exrdmHisto.hh
r807 r1230 39 39 #include <vector> 40 40 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 43 class exrdmHistoMessenger; 44 45 #ifdef G4ANALYSIS_USE_AIDA 41 #ifdef G4ANALYSIS_USE 46 42 namespace AIDA { 43 class IAnalysisFactory; 47 44 class ITree; 48 45 class ITuple; … … 51 48 #endif 52 49 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 51 53 52 #ifdef G4ANALYSIS_USE_ROOT 53 // Root classes 54 54 class TFile; 55 55 class TH1D; … … 57 57 #endif 58 58 59 class exrdmHistoMessenger; 59 60 60 61 class exrdmHisto … … 92 93 void fillTuple(G4int, G4int, G4double); 93 94 // Fill nTuple at a given col with a double 94 void fillTuple(G4int, const G4String&, G4String );95 void fillTuple(G4int, const G4String&, G4String&); 95 96 // Fill nTuple parameter with a string 96 97 … … 115 116 G4int verbose; 116 117 G4int defaultAct; 117 118 #ifdef G4ANALYSIS_USE_AIDA 118 #ifdef G4ANALYSIS_USE 119 119 std::vector<AIDA::IHistogram1D*> histo; 120 120 std::vector<AIDA::ITuple*> ntup; 121 AIDA::IAnalysisFactory* aida; 121 122 AIDA::ITree* tree; 122 123 #endif -
trunk/examples/extended/radioactivedecay/exrdm/macros/f24.mac
r807 r1230 33 33 # 34 34 # complete chain decays 35 /histo/fileName f24c .aida35 /histo/fileName f24c 36 36 /run/beamOn 1000 37 37 # 38 38 # complete chain decays in VR mode 39 39 /grdm/analogueMC 0 40 /histo/fileName f24c-b .aida40 /histo/fileName f24c-b 41 41 /run/beamOn 1000 42 42 # -
trunk/examples/extended/radioactivedecay/exrdm/macros/neutron-10ev.mac
r807 r1230 1 1 ################################################################################# 2 2 # # 3 4 3 # THIS TEST TO DEMONSTRATE THAT ISOTOPES GENERATED IN HADRONIC # 5 4 # PROCESSES CAN BE TREATED BY THE RDM. # … … 8 7 # 9 8 # 10 /exrdm/phys/SelectPhysics Hadron11 9 /geometry/material/add NaI Na-I 3.67 12 10 /exrdm/det/setTargetMate NaI 11 13 12 # material definitions has to be done before /run/initilalize 14 13 /histo/fileName neutron-10ev 14 /exrdm/phys/SelectPhysics Hadron 15 15 /run/initialize 16 16 17 /run/setCutForRegion Target 10 cm 17 18 /run/setCutForRegion Detector 50 cm … … 24 25 /gps/energy 10 eV 25 26 /run/beamOn 1000 26 27 28 29 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmAnalysisManager.cc
r807 r1230 46 46 return fManager; 47 47 } 48 void exrdmAnalysisManager::dispose() 49 { 50 delete fManager; 51 fManager = 0; 52 } 48 53 49 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 58 63 pulseWidth = 1.*microsecond; 59 64 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 70 exrdmAnalysisManager::~exrdmAnalysisManager() 71 { 72 #ifdef G4ANALYSIS_USE 73 #define HISTDELETE 62 74 #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 70 81 } 71 82 … … 94 105 // in aida these histos are indiced from 0-6 95 106 // 96 histo->addTuple( "1 00", "Emitted Particles","floatPID, Energy, Time, Weight" );97 histo->addTuple( "2 00", "RadioIsotopes","floatPID, Time, Weight" );98 histo->addTuple( "3 00", "Energy Depositions","floatEnergy, 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" ); 99 110 100 111 } … … 104 115 void exrdmAnalysisManager::BeginOfRun() 105 116 { 106 #if defined G4ANALYSIS_USE_AIDA || G4ANALYSIS_USE_ROOT107 117 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; 113 119 } 114 120 … … 117 123 void exrdmAnalysisManager::EndOfRun() 118 124 { 119 #if defined G4ANALYSIS_USE_AIDA || G4ANALYSIS_USE_ROOT120 125 histo->save(); 121 #endif122 126 } 123 127 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmEventAction.cc
r807 r1230 67 67 void exrdmEventAction::EndOfEventAction(const G4Event* evt) 68 68 { 69 G4int event_id = evt->GetEventID();70 69 //analysis 71 70 exrdmAnalysisManager::getInstance()->EndOfEvent(); 72 71 // visualisation 72 #ifdef G4VIS_USE 73 G4int event_id = evt->GetEventID(); 73 74 if (event_id < 100 && G4VVisManager::GetConcreteInstance()) { 74 75 G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer(); … … 85 86 } 86 87 } 88 #endif 87 89 } 88 90 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmHisto.cc
r807 r1230 24 24 // ******************************************************************** 25 25 // 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 34 27 #include <AIDA/AIDA.h> 35 28 #endif … … 47 40 #include "TNtuple.h" 48 41 #endif 42 43 #include "exrdmHisto.hh" 44 #include "exrdmHistoMessenger.hh" 45 #include "G4ParticleTable.hh" 46 47 #include "G4Tokenizer.hh" 48 49 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 50 50 exrdmHisto::exrdmHisto() 51 51 { 52 verbose = 0;52 verbose = 1; 53 53 histName = "exrdm"; 54 histType = "root"; 54 histType = "aida"; 55 //histType = "root"; 55 56 nHisto = 0; 56 57 nTuple = 0; 57 58 defaultAct = 1; 58 59 // 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 63 65 #ifdef G4ANALYSIS_USE_ROOT 64 66 ROOThisto.clear(); … … 67 69 Rcol.clear(); 68 70 #endif 71 69 72 active.clear(); 70 73 bins.clear(); … … 78 81 tupleList.clear(); 79 82 tupleListROOT.clear(); 80 messenger = 0;81 83 82 84 messenger = new exrdmHistoMessenger(this); … … 87 89 exrdmHisto::~exrdmHisto() 88 90 { 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 // } 98 107 #endif 99 108 delete messenger; … … 104 113 void exrdmHisto::book() 105 114 { 115 #ifdef G4ANALYSIS_USE 106 116 G4cout << "### exrdmHisto books " << nHisto << " histograms " << G4endl; 107 #ifdef G4ANALYSIS_USE_AIDA108 117 // 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 } 110 123 // Creating the tree factory 111 AIDA::ITreeFactory* tf = af->createTreeFactory();124 {AIDA::ITreeFactory* tf = aida->createTreeFactory(); 112 125 // 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;} 124 135 // 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); 126 137 // Creating an 1-dimensional histograms in the root directory of the tree 127 138 for(G4int i=0; i<nHisto; i++) { 128 139 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]); 130 145 } 131 146 } 147 delete hf; 148 G4cout << "AIDA histograms are booked" << G4endl;} 149 132 150 // 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; 134 153 for(G4int i=0; i<nTuple; i++) { 135 154 if(tupleList[i] != "") { 136 G4cout << "Creating Ntuple: " << tupleName[i] << 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],""); 138 157 } 139 158 } 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)); 144 165 G4String fileNameROOT = histName + G4String(".root"); 145 166 hfileROOT = new TFile(fileNameROOT.c_str() ,"RECREATE","ROOT file for exRDM"); 146 167 G4cout << "Root file: " << fileNameROOT << G4endl; 147 168 // Creating an 1-dimensional histograms in the root directory of the tree 148 169 for(G4int i=0; i<nHisto; i++) { … … 157 178 if(tupleListROOT[i] != "") { 158 179 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; 160 182 ROOTntup[i] = new TNtuple(id, tupleName[i], tupleListROOT[i]); 183 G4cout << "ROOT Ntuple " << id << " " << tupleName[i] <<" "<< tupleListROOT[i]<< " booked " << G4endl; 161 184 } 162 185 } … … 169 192 void exrdmHisto::save() 170 193 { 171 #ifdef G4ANALYSIS_USE _AIDA194 #ifdef G4ANALYSIS_USE 172 195 // Write histogram file 173 196 tree->commit(); … … 175 198 tree->close(); 176 199 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;} 177 206 #endif 178 207 #ifdef G4ANALYSIS_USE_ROOT … … 181 210 G4cout << "ROOT: files closing..." << G4endl; 182 211 hfileROOT->Close(); 212 // 213 // F.Lei added following Guy's suggestion! 214 delete hfileROOT; 215 183 216 #endif 184 217 } … … 205 238 ids.push_back(id); 206 239 titles.push_back(name); 207 #ifdef G4ANALYSIS_USE _AIDA240 #ifdef G4ANALYSIS_USE 208 241 histo.push_back(0); 209 242 #endif … … 241 274 << G4endl; 242 275 } 243 #ifdef G4ANALYSIS_USE _AIDA276 #ifdef G4ANALYSIS_USE 244 277 if(i>=0 && i<nHisto) { 245 histo[i]->fill( (float)(x/unit[i]), (float)w);278 histo[i]->fill(x/unit[i], w); 246 279 } else { 247 280 G4cout << "exrdmHisto::fill: WARNING! wrong AIDA histogram index " << i << G4endl; … … 264 297 G4cout << "Scale histogram: #" << i << " by factor " << x << G4endl; 265 298 } 266 #ifdef G4ANALYSIS_USE _AIDA299 #ifdef G4ANALYSIS_USE 267 300 if(i>=0 && i<nHisto) { 268 301 histo[i]->scale(x); … … 281 314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 282 315 283 void exrdmHisto::addTuple(const G4String& w1, const G4String& w2, const G4String& w3) 284 { 285 // G4cout << w1 << " " << w2 << " " << w3 << G4endl; 316 #ifdef G4ANALYSIS_USE 317 void exrdmHisto::addTuple(const G4String& w1, const G4String& w2, const G4String& w3 ) 318 #else 319 void 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 286 333 std::vector<float> ar; 287 334 ar.clear(); 288 335 for (size_t i = 0; i < 20; i++) ar.push_back(0.); 289 nTuple++;290 #ifdef G4ANALYSIS_USE_ROOT291 336 Rarray.push_back(ar); 292 #endif293 tupleId.push_back(w1);294 tupleName.push_back(w2) ;295 337 // convert AIDA header to ROOT header for ntuple 296 338 G4Tokenizer next(w3); … … 300 342 while ( token != "") { 301 343 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(":"); 303 347 col++; 304 348 } … … 306 350 // G4cout << ROOTList << G4endl; 307 351 tupleListROOT.push_back(ROOTList); 308 //309 #ifdef G4ANALYSIS_USE_AIDA310 ntup.push_back(0);311 #endif312 #ifdef G4ANALYSIS_USE_ROOT313 352 ROOTntup.push_back(0); 314 353 Rcol.push_back(col-1); … … 323 362 G4cout << "fill tuple # " << i 324 363 <<" with parameter <" << parname << "> = " << x << G4endl; 325 #ifdef G4ANALYSIS_USE _AIDA326 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); 327 366 #endif 328 367 } … … 336 375 <<" in column < " << col << "> = " << x << G4endl; 337 376 } 338 #ifdef G4ANALYSIS_USE _AIDA339 if(ntup[i]) ntup[i]->fill(col, (float)x);377 #ifdef G4ANALYSIS_USE 378 if(ntup[i]) ntup[i]->fill(col,double(x)); 340 379 #endif 341 380 … … 348 387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 349 388 350 void exrdmHisto::fillTuple(G4int i, const G4String& parname, G4String x)389 void exrdmHisto::fillTuple(G4int i, const G4String& parname, G4String& x) 351 390 { 352 391 if(verbose > 1) { … … 354 393 <<" with parameter <" << parname << "> = " << x << G4endl; 355 394 } 356 #ifdef G4ANALYSIS_USE _AIDA395 #ifdef G4ANALYSIS_USE 357 396 if(ntup[i]) ntup[i]->fill(ntup[i]->findColumn(parname), x); 358 397 #endif 398 359 399 } 360 400 … … 363 403 void exrdmHisto::addRow(G4int i) 364 404 { 365 #ifdef G4ANALYSIS_USE_AIDA 405 if(verbose > 1) G4cout << "Added a raw #" << i << " to tuple" << G4endl; 406 #ifdef G4ANALYSIS_USE 366 407 if(ntup[i]) ntup[i]->addRow(); 367 408 #endif -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmHistoMessenger.cc
r807 r1230 49 49 50 50 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"); 52 52 fileCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 53 53 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmMaterial.cc
r807 r1230 115 115 116 116 G4Material* aMaterial = 0; 117 //G4cout << name <<" "<< formula << " " << density/(g/cm3) << " " << tem <<" " <<pres << G4endl;117 G4cout << name <<" "<< formula << " " << density/(g/cm3) << " " << tem <<" " <<pres << G4endl; 118 118 119 119 if (state == "") { … … 237 237 } else { 238 238 if (natoms>0) { 239 aMaterial->AddElement( G4Element::GetElement(isotopename ) , natoms);239 aMaterial->AddElement( G4Element::GetElement(isotopename,false) , natoms); 240 240 } else { 241 aMaterial->AddElement( G4Element::GetElement(isotopename ) , fatoms);241 aMaterial->AddElement( G4Element::GetElement(isotopename,false) , fatoms); 242 242 } 243 243 } 244 244 } else { 245 if ( G4Element::GetElement(element ) == NULL) {245 if ( G4Element::GetElement(element,false) == NULL) { 246 246 G4Element* aElement = new G4Element(element, element, Z, A[Z-1]*g/mole); 247 247 if (natoms>0) { … … 253 253 } else { 254 254 if (natoms>0) { 255 aMaterial->AddElement( G4Element::GetElement(element ) , natoms);255 aMaterial->AddElement( G4Element::GetElement(element,false) , natoms); 256 256 } else { 257 aMaterial->AddElement( G4Element::GetElement(element ) , fatoms);257 aMaterial->AddElement( G4Element::GetElement(element,false) , fatoms); 258 258 } 259 259 } -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmMaterialMessenger.cc
r807 r1230 130 130 // G4cout<< "stat = " <<state<< "tem = " << tem<< " pre = " << pres << G4endl; 131 131 // tick *= G4UIcommand::ValueOf(unt); 132 materialsManager->AddMaterial(material,formula,den ,state,tem,pres);132 materialsManager->AddMaterial(material,formula,den*g/cm3,state,tem,pres); 133 133 } 134 134 } -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmPhysListHadron.cc
r807 r1230 253 253 theAlphaInelasticProcess->RegisterMe(theTheoModel); 254 254 pManager->AddDiscreteProcess(theAlphaInelasticProcess); 255 255 256 // GenericIon 256 257 pManager = G4GenericIon::GenericIon()->GetProcessManager(); … … 266 267 theIonInelasticProcess->RegisterMe(theIonBC); 267 268 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); 276 270 } -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmPhysicsList.cc
r807 r1230 75 75 pMessenger = new exrdmPhysicsListMessenger(this); 76 76 77 SetVerboseLevel( 2);77 SetVerboseLevel(1); 78 78 79 79 //default physics … … 87 87 88 88 // Had physics 89 hadPhysicsList = new exrdmPhysListHadron("hadron");89 hadPhysicsList = 0; 90 90 nhadcomp = 0; 91 91 … … 131 131 } 132 132 if (hadPhysicsList) hadPhysicsList->ConstructProcess(); 133 G4cout << "### exrdmPhysicsList::ConstructProcess is done" << G4endl; 134 133 135 } 134 136 … … 141 143 } 142 144 // default Had physics 143 if (name == "Hadron" && nhadcomp == 0) { 144 if (hadPhysicsList) delete hadPhysicsList; 145 if (name == "Hadron" && !hadPhysicsList) { 145 146 hadPhysicsList = new exrdmPhysListHadron("hadron"); 146 147 } else if (name == "QGSP_BERT") { 147 148 AddExtraBuilders(false); 148 149 hadPhysicsList = new HadronPhysicsQGSP_BERT("std-hadron"); 149 } else if (name == "QGSP_BIC" && nhadcomp == 0) {150 } else if (name == "QGSP_BIC" && !hadPhysicsList) { 150 151 AddExtraBuilders(false); 151 152 hadPhysicsList = new HadronPhysicsQGSP_BIC("std-hadron"); 152 } else if (name == "QGSP_BERT_HP" && nhadcomp == 0) {153 } else if (name == "QGSP_BERT_HP" && !hadPhysicsList) { 153 154 AddExtraBuilders(true); 154 155 hadPhysicsList = new HadronPhysicsQGSP_BERT_HP("std-hadron"); 155 } else if (name == "QGSP_BIC_HP" && nhadcomp == 0) {156 } else if (name == "QGSP_BIC_HP" && !hadPhysicsList) { 156 157 AddExtraBuilders(true); 157 158 hadPhysicsList = new HadronPhysicsQGSP_BIC_HP("std-hadron"); 158 159 } else if (name == "LowEnergy_EM") { 159 if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) { 160 if (emPhysicsList) delete emPhysicsList; 160 delete emPhysicsList; 161 161 emPhysicsList = new exrdmPhysListEmLowEnergy("lowe-em"); 162 } else {163 G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;164 }165 162 } else if (name == "Standard_EM") { 166 if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) { 167 if (emPhysicsList) delete emPhysicsList; 163 delete emPhysicsList; 168 164 emPhysicsList = new G4EmStandardPhysics(); 169 } else {170 G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;171 }172 165 } else { 173 166 G4cout << "exrdmPhysicsList WARNING wrong or unkonwn <" … … 180 173 void exrdmPhysicsList::AddExtraBuilders(G4bool flagHP) 181 174 { 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; 191 176 hadronPhys.push_back( new G4EmExtraPhysics("extra EM")); 192 177 hadronPhys.push_back( new G4HadronElasticPhysics("elastic",verboseLevel, … … 194 179 hadronPhys.push_back( new G4QStoppingPhysics("stopping",verboseLevel)); 195 180 hadronPhys.push_back( new G4IonBinaryCascadePhysics("ionBIC")); 196 hadronPhys.push_back( new G4RadioactiveDecayPhysics("radioactiveDecay"));197 181 hadronPhys.push_back( new G4NeutronTrackingCut("Neutron tracking cut")); 198 182 } … … 202 186 void exrdmPhysicsList::SetCuts() 203 187 { 204 205 188 SetCutValue(cutForGamma, "gamma"); 206 189 SetCutValue(cutForElectron, "e-"); … … 226 209 { 227 210 cutForGamma = cut; 211 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); 228 212 } 229 213 … … 233 217 { 234 218 cutForElectron = cut; 219 SetParticleCuts(cutForElectron, G4Electron::Electron()); 235 220 } 236 221 … … 240 225 { 241 226 cutForPositron = cut; 227 SetParticleCuts(cutForPositron, G4Positron::Positron()); 242 228 } 243 229 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmRunAction.cc
r807 r1230 58 58 G4cout << "### Run : " << RunN << G4endl; 59 59 60 #ifdef G4VIS_USE 60 61 if (G4VVisManager::GetConcreteInstance()) 61 62 { … … 64 65 UI->ApplyCommand("/vis/draw/current"); 65 66 } 67 #endif 66 68 } 67 69 … … 74 76 analysis->EndOfRun(); 75 77 78 #ifdef G4VIS_USE 76 79 if (G4VVisManager::GetConcreteInstance()) 77 80 G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view"); 81 #endif 78 82 } 79 83 -
trunk/examples/extended/radioactivedecay/exrdm/src/exrdmSteppingAction.cc
r807 r1230 46 46 void exrdmSteppingAction::UserSteppingAction(const G4Step* fStep) 47 47 { 48 #ifdef G4ANALYSIS_USE49 48 G4Track* fTrack = fStep->GetTrack(); 50 49 G4int StepNo = fTrack->GetCurrentStepNumber(); 51 50 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 52 62 if (StepNo == 1) { 53 63 if ( (fTrack->GetDefinition()->GetParticleType() == "nucleus") && … … 80 90 } 81 91 } 82 // energy deposition : collect energy deposited by decay products only92 // energy deposition 83 93 if (fTrack->GetTrackID() != 1 ) { 84 if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") {94 // if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { 85 95 if (fStep->GetTotalEnergyDeposit() ) { 86 96 G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; … … 92 102 exrdmAnalysisManager::getInstance()->AddEnergy(edep,weight,time); 93 103 } 94 }104 // } 95 105 } 96 #endif 106 #endif 97 107 } 98 108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracChangeset
for help on using the changeset viewer.