Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
PurgMagAnalysisManager.cc
이 파일의 문서화 페이지로 가기
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 //
26 // Code developed by:
27 // S.Larsson
28 //
29 // ************************************
30 // * *
31 // * PurgMagAnalysisManager.cc *
32 // * *
33 // ************************************
34 //
35 // $Id: PurgMagAnalysisManager.cc 84477 2014-10-16 08:44:04Z gcosmo $
36 //
38 
39 
41 
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 
46 {;}
47 
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
52 {;}
53 
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
58 {
60  return instance;
61 }
62 
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65 
67 {
68  // Get/create analysis manager
69  G4AnalysisManager* man = G4AnalysisManager::Instance();
70 
71  // Open an output file
72  man->OpenFile("purgmag");
73  man->SetFirstNtupleId(1);
74 
75  // Create 1st ntuple (id = 1)
76  //
77  man->CreateNtuple("n101", "Electron");
78  man->CreateNtupleDColumn("ex");
79  man->CreateNtupleDColumn("ey");
80  man->CreateNtupleDColumn("ez");
81  man->CreateNtupleDColumn("ee");
82  man->CreateNtupleDColumn("epx");
83  man->CreateNtupleDColumn("epy");
84  man->CreateNtupleDColumn("epz");
85  man->FinishNtuple();
86  G4cout << "Ntuple-1 created" << G4endl;
87 
88  // Create 2nd ntuple (id = 2)
89  //
90  man->CreateNtuple("n102", "Gamma");
91  man->CreateNtupleDColumn("gx");
92  man->CreateNtupleDColumn("gy");
93  man->CreateNtupleDColumn("gz");
94  man->CreateNtupleDColumn("ge");
95  man->CreateNtupleDColumn("gpx");
96  man->CreateNtupleDColumn("gpy");
97  man->CreateNtupleDColumn("gpz");
98  man->FinishNtuple();
99  G4cout << "Ntuple-2 created" << G4endl;
100 
101  // Create 3rd ntuple (id = 3)
102  //
103  man->CreateNtuple("n103", "Positron");
104  man->CreateNtupleDColumn("px");
105  man->CreateNtupleDColumn("py");
106  man->CreateNtupleDColumn("pz");
107  man->CreateNtupleDColumn("pe");
108  man->CreateNtupleDColumn("ppx");
109  man->CreateNtupleDColumn("ppy");
110  man->CreateNtupleDColumn("ppz");
111  man->FinishNtuple();
112  G4cout << "Ntuple-3 created" << G4endl;
113 
114  return;
115 }
116 
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
119 // This function fills a N-tuple with position, energy and momentum of
120 // electrons entering the measurement volume.
122  G4double ee, // Energy
123  G4double epx, G4double epy, G4double epz) // Momentum
124 {
125  // Get/create analysis manager
126  G4AnalysisManager* man = G4AnalysisManager::Instance();
127 
128  // Fill 1st ntuple ( id = 1)
129  man->FillNtupleDColumn(1,0, ex);
130  man->FillNtupleDColumn(1,1, ey);
131  man->FillNtupleDColumn(1,2, ez);
132  man->FillNtupleDColumn(1,3, ee);
133  man->FillNtupleDColumn(1,4, epx);
134  man->FillNtupleDColumn(1,5, epy);
135  man->FillNtupleDColumn(1,6, epz);
136  man->AddNtupleRow(1);
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
140 // This function fills a N-tuple with position, energy and momentum of
141 // photons entering the measurement volume.
143  G4double ge, // Energy
144  G4double gpx, G4double gpy, G4double gpz) // Momentum
145 {
146  // Get/create analysis manager
147  G4AnalysisManager* man = G4AnalysisManager::Instance();
148 
149  // Fill 2nd ntuple ( id = 2)
150  man->FillNtupleDColumn(2,0, gx);
151  man->FillNtupleDColumn(2,1, gy);
152  man->FillNtupleDColumn(2,2, gz);
153  man->FillNtupleDColumn(2,3, ge);
154  man->FillNtupleDColumn(2,4, gpx);
155  man->FillNtupleDColumn(2,5, gpy);
156  man->FillNtupleDColumn(2,6, gpz);
157  man->AddNtupleRow(2);
158 
159 }
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
162 // This function fills a N-tuple with position, energy and momentum of
163 // positrons entering the measurement volume.
165  G4double pe, // Energy
166  G4double ppx, G4double ppy, G4double ppz) // Momentum
167 {
168  // Get/create analysis manager
169  G4AnalysisManager* man = G4AnalysisManager::Instance();
170 
171  // Fill 3rd ntuple ( id = 3)
172  man->FillNtupleDColumn(3,0, px);
173  man->FillNtupleDColumn(3,1, py);
174  man->FillNtupleDColumn(3,2, pz);
175  man->FillNtupleDColumn(3,3, pe);
176  man->FillNtupleDColumn(3,4, ppx);
177  man->FillNtupleDColumn(3,5, ppy);
178  man->FillNtupleDColumn(3,6, ppz);
179  man->AddNtupleRow(3);
180 
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
185 {
186  // Save histograms
187  G4AnalysisManager* man = G4AnalysisManager::Instance();
188  man->Write();
189  man->CloseFile();
190  // Complete clean-up
191  delete G4AnalysisManager::Instance();
192 }
193 
194 
void fill_Tuple_Positrons(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
#define G4endl
Definition: G4ios.hh:61
G4bool OpenFile(const G4String &fileName="")
static PurgMagAnalysisManager * instance
void fill_Tuple_Gamma(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
void fill_Tuple_Electrons(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
G4bool FillNtupleDColumn(G4int id, G4double value)
Uncomment #include to switch to ROOT or XML output file.
double G4double
Definition: G4Types.hh:76
G4int CreateNtupleDColumn(const G4String &name)
static PurgMagAnalysisManager * getInstance()
G4GLOB_DLL std::ostream G4cout
G4int CreateNtuple(const G4String &name, const G4String &title)
G4bool SetFirstNtupleId(G4int firstId)