9 #include <cdc/dbobjects/CDCGeometry.h>
10 #include <framework/gearbox/GearDir.h>
11 #include <boost/format.hpp>
15 using namespace boost;
19 m_rmin.push_back(rmin);
20 m_rmax.push_back(rmax);
37 m_globalOffsetX = content.getLength(
"OffsetX");
38 m_globalOffsetY = content.getLength(
"OffsetY");
39 m_globalOffsetZ = content.getLength(
"OffsetZ");
40 m_globalPhiRotation = content.getAngle(
"GlobalPhiRotation");
41 m_globalOffsetA = content.getAngle(
"OffsetA");
42 m_globalOffsetB = content.getAngle(
"OffsetB");
43 m_globalOffsetC = content.getAngle(
"OffsetC");
46 const int nBound = content.getNumberNodes(
"MomVol/ZBound");
47 for (
int iBound = 0; iBound < nBound; iBound++) {
48 const double rmin = content.getLength((format(
"MomVol/ZBound[%1%]/Rmin") % (iBound + 1)).str()) /
Unit::mm;
49 const double rmax = content.getLength((format(
"MomVol/ZBound[%1%]/Rmax") % (iBound + 1)).str()) /
Unit::mm;
50 const double z = content.getLength((format(
"MomVol/ZBound[%1%]/Z") % (iBound + 1)).str()) /
Unit::mm;
51 m_mother.appendNode(rmin, rmax, z);
56 const int nSLayer = content.getNumberNodes(
"SLayers/SLayer");
58 for (
int iSLayer = 0; iSLayer < nSLayer; ++iSLayer) {
60 layerContent.
append((format(
"/SLayers/SLayer[%1%]/") % (iSLayer + 1)).str());
61 const double r = layerContent.
getLength(
"Radius");
62 const double zfwd = layerContent.
getLength(
"ForwardZ");
63 const double zbwd = layerContent.
getLength(
"BackwardZ");
64 const double dzfwd = layerContent.
getLength(
"FwdDeltaZ");
65 const double dzbwd = layerContent.
getLength(
"BwdDeltaZ");
66 const double offset = atof((layerContent.
getString(
"Offset")).c_str());
67 const int nWires = atoi((layerContent.
getString(
"NHoles")).c_str()) / 2;
68 const double nShifts = atof((layerContent.
getString(
"NShift")).c_str());
71 dzfwd, dzbwd, offset, nWires, nShifts);
73 m_senseLayers.push_back(sense);
77 const int nFLayer = content.getNumberNodes(
"FLayers/FLayer");
79 for (
int iFLayer = 0; iFLayer < nFLayer; ++iFLayer) {
81 layerContent.
append((format(
"/FLayers/FLayer[%1%]/") % (iFLayer + 1)).str());
82 const double r = layerContent.
getLength(
"Radius");
83 const double zfwd = layerContent.
getLength(
"ForwardZ");
84 const double zbwd = layerContent.
getLength(
"BackwardZ");
86 m_fieldLayers.push_back(field);
90 const int nEndplates = content.getNumberNodes(
"Endplates/Endplate");
91 for (
int i = 0; i < nEndplates; ++i) {
96 epContent.
append((format(
"/Endplates/Endplate[%1%]/") % (i + 1)).str());
99 for (
int iEPLayer = 0; iEPLayer < nEPLayer; ++iEPLayer) {
100 GearDir epLayerContent(epContent);
101 epLayerContent.
append((format(
"/EndplateLayer[%1%]/") % (iEPLayer + 1)).str());
102 string epName = epLayerContent.
getString(
"Name");
103 double rmin = epLayerContent.
getLength(
"InnerR");
104 double rmax = epLayerContent.
getLength(
"OuterR");
105 double zfwd = epLayerContent.
getLength(
"ForwardZ");
106 double zbwd = epLayerContent.
getLength(
"BackwardZ");
107 std::string name =
"Layer" + to_string(i) + epName + to_string(iEPLayer);
109 ep.appendNew(name, iEPLayer, rmin, rmax, zfwd, zbwd);
111 m_endplates.push_back(ep);
115 const int nInnerWall = content.getNumberNodes(
"InnerWalls/InnerWall");
116 for (
int i = 0; i < nInnerWall; ++i) {
117 GearDir innerWallContent(content);
118 innerWallContent.
append((format(
"/InnerWalls/InnerWall[%1%]/") % (i + 1)).str());
120 string sInnerWallID = innerWallContent.
getString(
"@id");
121 const string name =
"InnerWall_" + sInnerWallID +
"_" + innerWallContent.
getString(
"Name");
122 const double rmin = innerWallContent.
getLength(
"InnerR");
123 const double rmax = innerWallContent.
getLength(
"OuterR");
124 const double zfwd = innerWallContent.
getLength(
"ForwardZ");
125 const double zbwd = innerWallContent.
getLength(
"BackwardZ");
126 const InnerWall wall(name, i, rmin, rmax, zfwd, zbwd);
127 m_innerWalls.push_back(wall);
128 if (innerWallContent.
getString(
"Name") ==
"Shield") {
129 m_fiducialRmin = rmax;
135 const int nOuterWall = content.getNumberNodes(
"OuterWalls/OuterWall");
136 for (
int i = 0; i < nOuterWall; ++i) {
137 GearDir outerWallContent(content);
138 outerWallContent.
append((format(
"/OuterWalls/OuterWall[%1%]/") % (i + 1)).str());
140 string sOuterWallID = outerWallContent.
getString(
"@id");
141 const string name =
"OuterWall_" + sOuterWallID +
"_" + outerWallContent.
getString(
"Name");
142 const double rmin = outerWallContent.
getLength(
"InnerR");
143 const double rmax = outerWallContent.
getLength(
"OuterR");
144 const double zfwd = outerWallContent.
getLength(
"ForwardZ");
145 const double zbwd = outerWallContent.
getLength(
"BackwardZ");
146 const OuterWall wall(name, i, rmin, rmax, zfwd, zbwd);
147 m_outerWalls.push_back(wall);
148 if (outerWallContent.
getString(
"Name") ==
"Shield") {
149 m_fiducialRmax = rmin;
155 const int nEB = content.getNumberNodes(
"ElectronicsBoards/ElectronicsBoard");
156 for (
int iEB = 0; iEB < nEB; ++iEB) {
158 ebContent.
append((format(
"/ElectronicsBoards/ElectronicsBoard[%1%]/") % (iEB + 1)).str());
160 const double rmin = ebContent.
getLength(
"EBInnerR");
161 const double rmax = ebContent.
getLength(
"EBOuterR");
162 const double zfwd = ebContent.
getLength(
"EBForwardZ");
163 const double zbwd = ebContent.
getLength(
"EBBackwardZ");
164 Frontend frontend(iEB, rmin, rmax, zfwd, zbwd);
165 m_frontends.push_back(frontend);
169 const int nShields = content.getNumberNodes(
"Shields/Shield");
170 for (
int i = 0; i < nShields; ++i) {
172 neuContent.
append((format(
"/Shields/Shield[%1%]/") % (i + 1)).str());
174 const double rmin1 = neuContent.
getLength(
"InnerR1");
175 const double rmin2 = neuContent.
getLength(
"InnerR2");
176 const double rmax1 = neuContent.
getLength(
"OuterR1");
177 const double rmax2 = neuContent.
getLength(
"OuterR2");
178 const double thick = neuContent.
getLength(
"Thickness");
179 const double z = neuContent.
getLength(
"PosZ");
180 NeutronShield shield(i, rmin1, rmin2, rmax1, rmax2, thick, z);
181 m_neutronShields.push_back(shield);
185 const int nCovers = content.getNumberNodes(
"Covers/Cover");
186 for (
int i = 0; i < nCovers; ++i) {
188 coverContent.
append((format(
"/Covers/Cover[%1%]/") % (i + 1)).str());
190 const int coverID = atoi((coverContent.
getString(
"@id")).c_str());
191 const double rmin1 = coverContent.
getLength(
"InnerR1");
192 const double rmin2 = coverContent.
getLength(
"InnerR2");
193 const double rmax1 = coverContent.
getLength(
"OuterR1");
194 const double rmax2 = coverContent.
getLength(
"OuterR2");
195 const double thick = coverContent.
getLength(
"Thickness");
196 const double z = coverContent.
getLength(
"PosZ");
197 Cover cover(coverID, rmin1, rmin2, rmax1, rmax2, thick, z);
198 m_covers.push_back(cover);
201 const int nCover2s = content.getNumberNodes(
"Covers/Cover2");
202 for (
int i = 0; i < nCover2s; ++i) {
203 GearDir cover2Content(content);
204 cover2Content.
append((format(
"/Covers/Cover2[%1%]/") % (i + 1)).str());
206 const int cover2ID = atoi((cover2Content.
getString(
"@id")).c_str());
207 const double rmin = cover2Content.
getLength(
"InnerR");
208 const double rmax = cover2Content.
getLength(
"OuterR");
209 const double phis = cover2Content.
getLength(
"StartPhi");
210 const double dphi = cover2Content.
getLength(
"DeltaPhi");
211 const double thick = cover2Content.
getLength(
"Thickness");
212 const double z = cover2Content.
getLength(
"PosZ");
213 Cover2 cover2(cover2ID, rmin, rmax, phis, dphi, thick, z);
214 m_cover2s.push_back(cover2);
217 const int nRibs = content.getNumberNodes(
"Covers/Rib");
218 for (
int i = 0; i < nRibs; ++i) {
220 ribContent.
append((format(
"/Covers/Rib[%1%]/") % (i + 1)).str());
222 const int ribID = atoi((ribContent.
getString(
"@id")).c_str());
223 const double length = ribContent.
getLength(
"Length");
224 const double width = ribContent.
getLength(
"Width");
225 const double thick = ribContent.
getLength(
"Thickness");
226 const double rotx = ribContent.
getLength(
"RotX");
227 const double roty = ribContent.
getLength(
"RotY");
228 const double rotz = ribContent.
getLength(
"RotZ");
229 const double x = ribContent.
getLength(
"PosX");
230 const double y = ribContent.
getLength(
"PosY");
231 const double z = ribContent.
getLength(
"PosZ");
232 const int offset = atoi((ribContent.
getString(
"Offset")).c_str());
233 const int ndiv = atoi((ribContent.
getString(
"NDiv")).c_str());
234 Rib rib(ribID, length, width, thick, rotx, roty, rotz, x, y, z, offset, ndiv);
235 m_ribs.push_back(rib);
238 const int nRib2s = content.getNumberNodes(
"Covers/Rib2");
239 for (
int i = 0; i < nRib2s; ++i) {
241 rib2Content.
append((format(
"/Covers/Rib2[%1%]/") % (i + 1)).str());
243 const int rib2ID = atoi((rib2Content.
getString(
"@id")).c_str());
244 const double length = rib2Content.
getLength(
"Length");
245 const double width = rib2Content.
getLength(
"Width");
246 const double thick = rib2Content.
getLength(
"Thickness");
247 const double width2 = rib2Content.
getLength(
"Width2");
248 const double thick2 = rib2Content.
getLength(
"Thickness2");
249 const double rotx = rib2Content.
getLength(
"RotX");
250 const double roty = rib2Content.
getLength(
"RotY");
251 const double rotz = rib2Content.
getLength(
"RotZ");
252 const double x = rib2Content.
getLength(
"PosX");
253 const double y = rib2Content.
getLength(
"PosY");
254 const double z = rib2Content.
getLength(
"PosZ");
255 const int ndiv = atoi((rib2Content.
getString(
"NDiv")).c_str());
256 Rib2 rib2(rib2ID, length, width, thick, width2, thick2, rotx, roty, rotz,
258 m_rib2s.push_back(rib2);
261 const int nRib3s = content.getNumberNodes(
"Covers/Rib3");
262 for (
int i = 0; i < nRib3s; ++i) {
264 rib3Content.
append((format(
"/Covers/Rib3[%1%]/") % (i + 1)).str());
266 const int rib3ID = atoi((rib3Content.
getString(
"@id")).c_str());
267 const double length = rib3Content.
getLength(
"Length");
268 const double width = rib3Content.
getLength(
"Width");
269 const double thick = rib3Content.
getLength(
"Thickness");
270 const double r = rib3Content.
getLength(
"HoleR");
271 const double x = rib3Content.
getLength(
"PosX");
272 const double y = rib3Content.
getLength(
"PosY");
273 const double z = rib3Content.
getLength(
"PosZ");
274 const double rx = rib3Content.
getLength(
"HoleX");
275 const double ry = rib3Content.
getLength(
"HoleY");
276 const double rz = rib3Content.
getLength(
"HoleZ");
277 const int offset = atoi((rib3Content.
getString(
"Offset")).c_str());
278 const int ndiv = atoi((rib3Content.
getString(
"NDiv")).c_str());
279 Rib3 rib3(rib3ID, length, width, thick, r, x, y, z, rx, ry, rz, offset, ndiv);
280 m_rib3s.push_back(rib3);
283 const int nRib4s = content.getNumberNodes(
"Covers/Rib4");
284 for (
int i = 0; i < nRib4s; ++i) {
286 rib4Content.
append((format(
"/Covers/Rib4[%1%]/") % (i + 1)).str());
288 const int rib4ID = atoi((rib4Content.
getString(
"@id")).c_str());
289 const double length = rib4Content.
getLength(
"Length");
290 const double width = rib4Content.
getLength(
"Width");
291 const double thick = rib4Content.
getLength(
"Thickness");
292 const double length2 = rib4Content.
getLength(
"Length2");
293 const double width2 = rib4Content.
getLength(
"Width2");
294 const double thick2 = rib4Content.
getLength(
"Thickness2");
295 const double x = rib4Content.
getLength(
"PosX");
296 const double y = rib4Content.
getLength(
"PosY");
297 const double z = rib4Content.
getLength(
"PosZ");
298 const double x2 = rib4Content.
getLength(
"HoleX");
299 const double y2 = rib4Content.
getLength(
"HoleY");
300 const double z2 = rib4Content.
getLength(
"HoleZ");
301 const int offset = atoi((rib4Content.
getString(
"Offset")).c_str());
302 const int ndiv = atoi((rib4Content.
getString(
"NDiv")).c_str());
303 Rib4 rib4(rib4ID, length, width, thick, length2, width2, thick2, x, y, z, x2, y2, z2, offset, ndiv);
304 m_rib4s.push_back(rib4);
307 const int nRib5s = content.getNumberNodes(
"Covers/Rib5");
308 for (
int i = 0; i < nRib5s; ++i) {
310 rib5Content.
append((format(
"/Covers/Rib5[%1%]/") % (i + 1)).str());
312 const int rib5ID = atoi((rib5Content.
getString(
"@id")).c_str());
313 const double dr = rib5Content.
getLength(
"DR");
314 const double dz = rib5Content.
getLength(
"DZ");
315 const double width = rib5Content.
getLength(
"Width");
316 const double thick = rib5Content.
getLength(
"Thickness");
317 const double rin = rib5Content.
getLength(
"Rin");
318 const double x = rib5Content.
getLength(
"PosX");
319 const double y = rib5Content.
getLength(
"PosY");
320 const double z = rib5Content.
getLength(
"PosZ");
321 const double rotx = rib5Content.
getLength(
"RotX");
322 const double roty = rib5Content.
getLength(
"RotY");
323 const double rotz = rib5Content.
getLength(
"RotZ");
324 const int offset = atoi((rib5Content.
getString(
"Offset")).c_str());
325 const int ndiv = atoi((rib5Content.
getString(
"NDiv")).c_str());
326 Rib5 rib5(rib5ID, dr, dz, width, thick, rin, x, y, z,
327 rotx, roty, rotz, offset, ndiv);
328 m_rib5s.push_back(rib5);
334 senseWire.
append(
"/SenseWire/");
335 m_senseWireDiameter = senseWire.
getLength(
"Diameter");
337 m_senseWireNumbers = atoi((senseWire.
getString(
"Number")).c_str());
341 fieldWire.
append(
"/FieldWire/");
342 m_fieldWireDiameter = fieldWire.
getLength(
"Diameter");
344 m_fieldWireNumbers = atoi((fieldWire.
getString(
"Number")).c_str());
348 m_feedThroughLength = content.getLength(
"/FeedThrough/Length");
352 m_clockFrequency = content.getDouble(
"ClockFrequencyForTDC");
353 m_nominalSpaceResolution = content.getLength(
"SenseWire/SpaceResol");
Cover2 structure geometry parameters.
Cover structure geometry parameters.
Endplate geometry parameters.
Field layer geometry parameters.
Frontend layer geometry parameters.
Inner wall geometry parameters.
void appendNode(double rmin, double rmax, double z)
Append a new node.
Neutron shield geometry parameters.
Outer wall geometry parameters.
Rib2 structure geometry parameters.
Rib3 structure geometry parameters.
Rib4 structure geometry parameters.
Rib5 structure geometry parameters.
Rib structure geometry parameters.
Sense layer geometry parameters.
~CDCGeometry()
Destructor.
CDCGeometry()
Default constructor.
void read(const GearDir &)
Get geometry parameters from Gearbox.
GearDir is the basic class used for accessing the parameter store.
void append(const std::string &path)
Append something to the current path, modifying the GearDir in place.
virtual int getNumberNodes(const std::string &path="") const override
Return the number of nodes a given path will expand to.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
static const double mm
[millimeters]
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
Abstract base class for different kinds of events.