ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analysis.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Analysis.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 //
29 
30 //#include "TFile.h"
31 //#include "TH1.h"
32 //#include "TH2.h"
33 //#include "TROOT.h"
34 #include "G4AutoDelete.hh"
35 #include "G4SystemOfUnits.hh"
36 #include "Analysis.hh"
37 
38 //Select format of output here
39 #include "g4root.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 Analysis*
46 {
47  if (!the_analysis)
48  {
49  the_analysis = new Analysis();
51  }
52  return the_analysis;
53 }
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57  fincident_x_hist(0), fincident_map(0), fdose_hist(0), fdose_map(0),
58  fdose_prof(0), fdose_map_prof(0), fdose_map3d(0)
59 {
60 }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 void
65 {
67  //mgr->SetVerboseLevel(1);
68  fincident_x_hist = mgr->CreateH1("incident_x", "Incident X", 100, -5 * cm,
69  5 * cm, "cm");
70  fincident_map = mgr->CreateH2("incident_map", "Incident Map", 50, -5 * cm,
71  5 * cm, 50, -5 * cm, 5 * cm, "cm", "cm");
73  = mgr->CreateH1("dose", "Dose distribution", 500, 0, 50 * cm, "cm");
74  fdose_map = mgr->CreateH2("dose_map", "Dose distribution", 500, 0, 50 * cm,
75  200, -10 * cm, 10 * cm, "cm", "cm");
76  fdose_map3d = mgr->CreateH3("dose_map_3d", "Dose distribution", 30, 0,
77  50 * cm, 20, -10 * cm, 10 * cm, 20, -10 * cm, 10 * cm, "cm", "cm", "cm");
78  fdose_prof = mgr->CreateP1("dose_prof", "Dose distribution", 300, 0, 30 * cm,
79  0, 100 * MeV, "cm", "MeV");
80  fdose_map_prof = mgr->CreateP2("dose_map_prof", "Dose distribution", 300, 0,
81  30 * cm, 80, -4 * cm, 4 * cm, 0, 100 * MeV, "cm", "cm", "MeV");
82 
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 {
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 void
93 {
94  return;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 void
100 {
101  return;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105 void
107 {
109  mgr->OpenFile(fname.c_str());
110  mgr->Write();
111  return;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 void
117 {
119  mgr->CloseFile(reset);
120  return;
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 void
126 {
127  if (!fincidentFlag)
128  {
130  mgr->FillH2(fincident_map, p.x(), p.y());
131  mgr->FillH1(fincident_x_hist, p.x());
132  fincidentFlag = true;
133  }
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 void
139 {
140  const G4double dxy = 10. * mm;
141  if (std::abs(p.y()) < dxy)
142  {
144  const G4double Z0 = 25. * cm;
145 
146  mgr->FillH2(fdose_map, p.z() + Z0, p.x(), dedx / GeV);
147  mgr->FillP2(fdose_map_prof, p.z() + Z0, p.x(), dedx);
148  mgr->FillH3(fdose_map3d, p.z() + Z0, p.x(), p.y(), dedx / GeV);
149  if (std::abs(p.x()) < dxy)
150  {
151  mgr->FillH1(fdose_hist, p.z() + Z0, dedx / GeV);
152  mgr->FillP1(fdose_prof, p.z() + Z0, dedx);
153  }
154  }
155 
156 }