Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file HistoManager.cc 26 /// \file HistoManager.cc 27 /// \brief Implementation of the HistoManager 27 /// \brief Implementation of the HistoManager class 28 // 28 // 29 // << 29 // $Id: HistoManager.cc 83882 2014-09-22 11:09:30Z maire $ >> 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "HistoManager.hh" 34 #include "HistoManager.hh" 34 << 35 #include "G4UnitsTable.hh" 35 #include "G4UnitsTable.hh" 36 36 37 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 38 39 HistoManager::HistoManager() 39 HistoManager::HistoManager() >> 40 : fFileName("rdecay02") 40 { 41 { 41 Book(); 42 Book(); 42 } 43 } 43 44 44 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 46 >> 47 HistoManager::~HistoManager() >> 48 { >> 49 delete G4AnalysisManager::Instance(); >> 50 } >> 51 >> 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 53 46 void HistoManager::Book() 54 void HistoManager::Book() 47 { 55 { 48 // Create or get analysis manager 56 // Create or get analysis manager >> 57 // The choice of analysis technology is done via selection of a namespace >> 58 // in HistoManager.hh 49 // 59 // 50 G4AnalysisManager* analysis = G4AnalysisMana 60 G4AnalysisManager* analysis = G4AnalysisManager::Instance(); 51 << 61 52 analysis->SetDefaultFileType("root"); << 53 analysis->SetFileName(fFileName); 62 analysis->SetFileName(fFileName); 54 analysis->SetVerboseLevel(1); 63 analysis->SetVerboseLevel(1); 55 analysis->SetActivation(true); // enable in << 64 analysis->SetActivation(true); //enable inactivation of histos, nTuples 56 << 65 57 // Default values (to be reset via /analysis << 66 // Default values (to be reset via /analysis/h1/set command) 58 G4int nbins = 100; 67 G4int nbins = 100; 59 G4double vmin = 0.; 68 G4double vmin = 0.; 60 G4double vmax = 100.; 69 G4double vmax = 100.; 61 70 62 // Create all histograms as inactivated << 71 // Create all histograms as inactivated 63 // as we have not yet set nbins, vmin, vmax 72 // as we have not yet set nbins, vmin, vmax 64 // 73 // 65 ////analysis->SetHistoDirectoryName("histo") << 74 ////analysis->SetHistoDirectoryName("histo"); 66 ////analysis->SetFirstHistoId(1); 75 ////analysis->SetFirstHistoId(1); 67 << 76 68 G4int id = analysis->CreateH1("H10", "Energy << 77 G4int id = analysis->CreateH1("H10","Energy deposit (MeV) in the target", >> 78 nbins, vmin, vmax); 69 analysis->SetH1Activation(id, false); 79 analysis->SetH1Activation(id, false); 70 << 80 71 id = analysis->CreateH1("H11", "Energy depos << 81 id = analysis->CreateH1("H11","Energy deposit (MeV) in the detector", >> 82 nbins, vmin, vmax); 72 analysis->SetH1Activation(id, false); 83 analysis->SetH1Activation(id, false); 73 84 74 id = analysis->CreateH1("H12", "Total energy << 85 id = analysis->CreateH1("H12","Total energy (MeV) in target and detector", >> 86 nbins, vmin, vmax); 75 analysis->SetH1Activation(id, false); 87 analysis->SetH1Activation(id, false); 76 88 77 id = analysis->CreateH1("H13", "Coincidence << 89 id = analysis->CreateH1("H13", 78 nbins, vmin, vmax); << 90 "Coincidence spectrum (MeV) between the target and detector", 79 analysis->SetH1Activation(id, false); << 91 nbins, vmin, vmax); >> 92 analysis->SetH1Activation(id, false); 80 93 81 id = << 94 id = analysis->CreateH1("H14", 82 analysis->CreateH1("H14", "Anti-coincidenc << 95 "Anti-coincidence spectrum (MeV) in the traget", >> 96 nbins, vmin, vmax); 83 analysis->SetH1Activation(id, false); 97 analysis->SetH1Activation(id, false); 84 98 85 id = << 99 id = analysis->CreateH1("H15", 86 analysis->CreateH1("H15", "Anti-coincidenc << 100 "Anti-coincidence spectrum (MeV) in the detector", 87 analysis->SetH1Activation(id, false); << 101 nbins, vmin, vmax); 88 << 102 analysis->SetH1Activation(id, false); 89 id = analysis->CreateH1("H16", "Decay emissi << 90 analysis->SetH1Activation(id, false); << 91 << 92 id = analysis->CreateH1("H17", "Decay emissi << 93 analysis->SetH1Activation(id, false); << 94 << 95 id = analysis->CreateH1("H18", "Decay emissi << 96 analysis->SetH1Activation(id, false); << 97 103 >> 104 id = analysis->CreateH1("H16","Decay emission spectrum (MeV)", >> 105 nbins, vmin, vmax); >> 106 analysis->SetH1Activation(id, false); >> 107 98 // nTuples 108 // nTuples 99 // 109 // 100 ////analysis->SetNtupleDirectoryName("ntuple 110 ////analysis->SetNtupleDirectoryName("ntuple"); 101 ////analysis->SetFirstNtupleId(1); 111 ////analysis->SetFirstNtupleId(1); 102 // << 112 // 103 analysis->CreateNtuple("T1", "Emitted Partic 113 analysis->CreateNtuple("T1", "Emitted Particles"); 104 analysis->CreateNtupleDColumn("PID"); // co << 114 analysis->CreateNtupleDColumn("PID"); //column 0 105 analysis->CreateNtupleDColumn("Energy"); // << 115 analysis->CreateNtupleDColumn("Energy"); //column 1 106 analysis->CreateNtupleDColumn("Time"); // c << 116 analysis->CreateNtupleDColumn("Time"); //column 2 107 analysis->CreateNtupleDColumn("Weight"); // << 117 analysis->CreateNtupleDColumn("Weight"); //column 3 108 analysis->FinishNtuple(); 118 analysis->FinishNtuple(); 109 << 119 110 analysis->CreateNtuple("T2", "RadioIsotopes" 120 analysis->CreateNtuple("T2", "RadioIsotopes"); 111 analysis->CreateNtupleDColumn("PID"); // co << 121 analysis->CreateNtupleDColumn("PID"); //column 0 112 analysis->CreateNtupleDColumn("Time"); // c << 122 analysis->CreateNtupleDColumn("Time"); //column 1 113 analysis->CreateNtupleDColumn("Weight"); // << 123 analysis->CreateNtupleDColumn("Weight"); //column 2 114 analysis->FinishNtuple(); 124 analysis->FinishNtuple(); 115 << 125 116 analysis->CreateNtuple("T3", "Energy deposit 126 analysis->CreateNtuple("T3", "Energy depositions"); 117 analysis->CreateNtupleDColumn("Energy"); // << 127 analysis->CreateNtupleDColumn("Energy"); //column 0 118 analysis->CreateNtupleDColumn("Time"); // c << 128 analysis->CreateNtupleDColumn("Time"); //column 1 119 analysis->CreateNtupleDColumn("Weight"); // << 129 analysis->CreateNtupleDColumn("Weight"); //column 2 120 analysis->FinishNtuple(); 130 analysis->FinishNtuple(); 121 << 131 122 analysis->CreateNtuple("RDecayProducts", "Al 132 analysis->CreateNtuple("RDecayProducts", "All Products of RDecay"); 123 analysis->CreateNtupleDColumn("PID"); // co << 133 analysis->CreateNtupleDColumn("PID"); //column 0 124 analysis->CreateNtupleDColumn("Z"); // colu << 134 analysis->CreateNtupleDColumn("Z"); //column 1 125 analysis->CreateNtupleDColumn("A"); // colu << 135 analysis->CreateNtupleDColumn("A"); //column 2 126 analysis->CreateNtupleDColumn("Energy"); // << 136 analysis->CreateNtupleDColumn("Energy"); //column 3 127 analysis->CreateNtupleDColumn("Time"); // c << 137 analysis->CreateNtupleDColumn("Time"); //column 4 128 analysis->CreateNtupleDColumn("Weight"); // << 138 analysis->CreateNtupleDColumn("Weight"); //column 5 129 analysis->FinishNtuple(); 139 analysis->FinishNtuple(); 130 << 140 131 analysis->SetNtupleActivation(false); << 141 analysis->SetNtupleActivation(false); 132 } 142 } 133 143 134 //....oooOO0OOooo........oooOO0OOooo........oo 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 145