GEMC  2.3
Geant4 Monte-Carlo Framework
gdml_det_factory.h
Go to the documentation of this file.
1 #ifndef GDML_DET_FACTORY_H
2 #define GDML_DET_FACTORY_H 1
3 
4 // gemc headers
5 #include "detector_factory.h"
6 
7 // Qt4 headers
8 #include <QDomDocument>
9 #include <QtWidgets>
10 #include <QString>
11 
12 #include <map>
13 #include <string>
14 #include <iostream>
15 using namespace std;
16 
17 class gphysV
18 {
19  public:
21  {
22  positionRef = "";
23  rotationRef = "";
24  }
25  gphysV(string m, string s)
26  {
27  positionRef = m;
28  rotationRef = s;
29  }
30 
31  public:
32  string positionRef;
33  string rotationRef;
34 
35 };
36 //ostream &operator<<(ostream &stream,map<string, gphysV> gphysVMap );
37 
38 
39 class glogicV
40 {
41  public:
43  {
44  materialRef = "";
45  solidRef = "";
46  }
47  glogicV(string m, string s)
48  {
49  materialRef = m;
50  solidRef = s;
51  }
52 
53  public:
54  string materialRef;
55  string solidRef;
56 
57 };
58 
59 //ostream &operator<<(ostream &stream, map<string, glogicV> glogicVMap);
60 
61 class gposition
62 {
63  public:
64  gposition(){;}
65  gposition(double a, double b, double c, string l)
66  {
67  x = a;
68  y = b;
69  z = c;
70  unit = l;
71  }
72 
73  public:
74  double x, y, z;
75  string unit;
76 
77  inline string get_dimensions()
78  {
79 
80  return stringify(x) + "*" + unit + " " + stringify(y) + "*" + unit + " " + stringify(z) + "*" + unit;
81  }
82 
83 
84 
85 };
86 
87 //ostream &operator<<(ostream &stream, map<string, gposition> gpositionsMap);
88 
89 
90 class grotation
91 {
92  public:
93  grotation(){;}
94  grotation(string a, string b, string c, string u)
95  {
96  x = a;
97  y = b;
98  z = c;
99  unit = u;
100 
101  }
102  public:
103  string x, y, z;
104  string unit;
105 
106  inline string get_dimensions()
107  {
108 
109  return x + "*" +unit + " " + y + "*" + unit + " " + z + "*" + unit;
110  }
111 
112 };
113 
114 //ostream &operator<<(ostream &stream,map<string, grotation> grotationsMap );
115 
116 
117 
118 
119 class gsolid
120 {
121  public:
123  {
124  type = "na";
125  dimension = "0";
126  }
127  gsolid(string t, string d)
128  {
129 
130  type = t;
131  dimension = d;
132  }
133 
134  public:
135  // dimension follow the same order
136  // as in the genat4 documentation
137  // each number is multiplied by the unit
138  // default units are length=mm angle=rad
139  // example for box w/o units:
140  // name="b100" x="10.0" y="10.0" z="10.0"
141  // dimension = "10.0*mm 10.0*mm 10.0*mm"
142  // example for tube
143  // z="1000.0" rmax="100.0" deltaphi="TWOPI" aunit="rad"
144  // rmin is not defined so it's zero
145  // lunit is not defined so it's the default (mm)
146  // startphi is not defined so it's 0
147  // deltaphi is defined as 2pi so I put 360 degrees
148  // dimension = "0*mm 100.0*mm 1000.0*mm 0*deg 360*deg"
149 
150 
151  string type;
152  string dimension;
153 
154 };
155 
157 {
158  public:
159 
161  {
162  first = "";
163  second = "";
164  renamed_second = "";
165  pos = "";
166  rot = "";
167 
168  }
169 
170  goperation(string f, string s,string u, string p, string r)
171  {
172  first = f;
173  second = s;
174  renamed_second = u;
175  pos = p;
176  rot = r;
177  }
178 
179  public:
180  string first;
181  string second;
183  string pos;
184  string rot;
185 };
186 
187 
188 //ostream &operator<<(ostream &stream,map<string, gsolid> gsolidsMap );
189 
190 
191 // you want to create a mpa<string, glogicV> and a map<string, gposition>
192 // where the key is the name of the objects
194 {
195  public:
197 
198  // load all detectors that matches factorytype
199  map<string, detector> loadDetectors();
200 
201  // initialize factorytype, option and runcondition classes
202  void initFactory(goptions, runConditions, string);
203 
205  {
206  return new gdml_det_factory;
207  }
208 };
209 
210 
211 string get_dimensions(QDomNode solidNode, map<string, double> gconstantMap);
212 
213 string togType(string);
214 string rad_to_deg (string radValue);
215 string rad_to_deg_u (string radValue, string radUnit);
216 double resolve_strings(string constant_name, string v, map<string, double> gconstantMap);
217 //map<string, double> resolve_strings(map<string, string> stringConstantMap);
218 double resolve_string(string constString, map<string, double> gconstantMap);
219 string p_calculation(vector<string> paren_calculation);
220 
221 #endif
glogicV(string m, string s)
string solidRef
goperation(string f, string s, string u, string p, string r)
string positionRef
string rad_to_deg(string radValue)
Definition: gdml_solids.cc:13
string get_dimensions(QDomNode solidNode, map< string, double > gconstantMap)
Definition: gdml_solids.cc:56
gsolid(string t, string d)
STL namespace.
string get_dimensions()
grotation(string a, string b, string c, string u)
string rotationRef
string dimension
double resolve_string(string constString, map< string, double > gconstantMap)
string type
string get_dimensions()
string stringify(double x)
string renamed_second
string rad_to_deg_u(string radValue, string radUnit)
converts the unit radian to degree if there is radian value.
Definition: gdml_solids.cc:38
static detectorFactory * createFactory()
string materialRef
double resolve_strings(string constant_name, string v, map< string, double > gconstantMap)
gphysV(string m, string s)
gposition(double a, double b, double c, string l)
string togType(string)
string p_calculation(vector< string > paren_calculation)