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