Belle II Software  release-08-01-10
ARICHGeoSupport.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 #include <framework/logging/Logger.h>
11 
12 #include <arich/dbobjects/ARICHGeoBase.h>
13 #include <string>
14 
15 namespace Belle2 {
25  class ARICHGeoSupport: public ARICHGeoBase {
26  public:
27 
32  {}
33 
37  struct tube {
38  double innerR;
39  double outerR;
40  double length;
41  double zPosition;
42  std::string material;
43  std::string name;
44  };
45 
49  struct wedge {
50  int type;
51  double r;
52  double phi;
53  double z;
54  std::string material;
55  };
56 
60  struct box {
61  double size[3];
62  double position[3];
63  double rotation[3];
64  std::string name;
65  std::string material;
66  };
67 
68 
73  bool isConsistent() const override;
74 
79  void print(const std::string& title = "Parameters of ARICH support structure and neutron shield") const override;
80 
86  void setWedge(unsigned i, const std::vector<double>& par) {if (i > m_nWedgeType || i == 0) { B2ERROR("invalid wedge number"); return;}; m_wedgePar[i - 1] = par;};
87 
96  void addWedge(int type, double r, double phi, double z, const std::string& material)
97  {
98  m_wedges.push_back({type, r, phi, z, material});
99  }
100 
105  void setMaterial(const std::string& material) { m_material = material;};
106 
114  void addTube(double inR, double outR, double length, double zPosition, const std::string& material, const std::string& name)
115  {
116  m_tubes.push_back({inR, outR, length, zPosition, material, name});
117  }
118 
123  unsigned getNTubes() const {return m_tubes.size();};
124 
130  double getTubeInnerR(unsigned i) const {return m_tubes.at(i).innerR / s_unit;}
131 
137  double getTubeOuterR(unsigned i) const {return m_tubes.at(i).outerR / s_unit;}
138 
144  double getTubeLength(unsigned i) const {return m_tubes.at(i).length / s_unit;}
145 
151  double getTubeZPosition(unsigned i) const {return m_tubes.at(i).zPosition / s_unit;}
152 
157  unsigned getNWedges() const {return m_wedges.size();};
158 
164  int getWedgeType(unsigned i) const {return m_wedges.at(i).type;}
165 
171  double getWedgeR(unsigned i) const {return m_wedges.at(i).r / s_unit;}
172 
178  double getWedgePhi(unsigned i) const {return m_wedges.at(i).phi;}
179 
185  double getWedgeZ(unsigned i) const {return m_wedges.at(i).z / s_unit;}
186 
192  const std::string& getTubeMaterial(unsigned i) const {return m_tubes.at(i).material;}
193 
199  const std::string& getWedgeMaterial(unsigned i) const {return m_wedges.at(i).material;}
200 
206  const std::string& getTubeName(unsigned i) const {return m_tubes.at(i).name;}
207 
212  const std::string& getMaterial() const {return m_material;}
213 
219  const std::vector<double> getWedge(unsigned i) const {std::vector<double> pars; if (i > m_nWedgeType || i == 0) { B2ERROR("invalid wedge number"); return pars;}; for (auto par : m_wedgePar[i - 1]) pars.push_back(par / s_unit); return pars;}
220 
229  void addBox(const std::string& name, const std::string& material, double size[3], double position[3], double rotation[3])
230  {
231  m_boxes.push_back({{size[0], size[1], size[2]}, {position[0], position[1], position[2]}, {rotation[0], rotation[1], rotation[2]}, name, material});
232  }
233 
243  void setBox(int i, const std::string& name, const std::string& material, double size[3], double position[3], double rotation[3])
244  {
245  m_boxes[i] = {{size[0], size[1], size[2]}, {position[0], position[1], position[2]}, {rotation[0], rotation[1], rotation[2]}, name, material};
246  }
247 
252  unsigned getNBoxes() const
253  {
254  return m_boxes.size();
255  }
256 
262  box getBox(unsigned i) const
263  {
264  return m_boxes[i];
265  }
266 
270  void clearBoxes()
271  {
272  m_boxes.clear();
273  }
274 
275 
276 
277  private:
278 
279  std::vector<tube> m_tubes;
280  std::string m_material;
281  static const unsigned m_nWedgeType = 3;
282  std::vector<double> m_wedgePar[m_nWedgeType];
283  std::vector<wedge> m_wedges;
284  std::vector<box> m_boxes;
288  };
289 
291 } // end namespace Belle2
Base class for geometry parameters.
Definition: ARICHGeoBase.h:24
static double s_unit
conversion unit for length
Definition: ARICHGeoBase.h:83
Geometry parameters of ARICH support structures and neutron shield.
double getWedgeR(unsigned i) const
Get radius at which i-th wedge is placed.
bool isConsistent() const override
Consistency check of geometry parameters.
double getWedgePhi(unsigned i) const
Get phi angle at which i-th wedge is placed.
ClassDefOverride(ARICHGeoSupport, 1)
ClassDef.
void clearBoxes()
Clear container of boxes.
const std::string & getWedgeMaterial(unsigned i) const
Get material of i-th wedge.
void addTube(double inR, double outR, double length, double zPosition, const std::string &material, const std::string &name)
Add volume of cylindrical shape (tube)
void setWedge(unsigned i, const std::vector< double > &par)
Set parameters of support wedge volumes.
std::string m_material
default material of support structure
void setMaterial(const std::string &material)
Set default material of support structures.
std::vector< double > m_wedgePar[m_nWedgeType]
parameters of support wedges (joints)
const std::string & getTubeMaterial(unsigned i) const
Get material of i-th tube.
double getTubeInnerR(unsigned i) const
Get tube inner radius.
double getTubeLength(unsigned i) const
Get tube length.
void addBox(const std::string &name, const std::string &material, double size[3], double position[3], double rotation[3])
Add box volume.
std::vector< tube > m_tubes
vector of tube volumes to be placed
ARICHGeoSupport()
Default constructor.
double getTubeOuterR(unsigned i) const
Get tube outer radius.
std::vector< box > m_boxes
vector of box volumes to be places
double getWedgeZ(unsigned i) const
Get Z position of i-th wedge.
unsigned getNTubes() const
Get number of tube volumes to be placed.
std::vector< wedge > m_wedges
vector of wedge volumes to be placed
const std::vector< double > getWedge(unsigned i) const
Get parameters of wedge.
int getWedgeType(unsigned i) const
Get type of i-th wedge.
const std::string & getTubeName(unsigned i) const
Get name of i-th tube.
const std::string & getMaterial() const
Get default material of support structures.
unsigned getNWedges() const
Get number of wedges to be placed.
double getTubeZPosition(unsigned i) const
Get tube Z position.
static const unsigned m_nWedgeType
number of wedge types
box getBox(unsigned i) const
Get box paramaters.
void addWedge(int type, double r, double phi, double z, const std::string &material)
Add wedge (all added wedges are placed)
void print(const std::string &title="Parameters of ARICH support structure and neutron shield") const override
Print the content of the class.
void setBox(int i, const std::string &name, const std::string &material, double size[3], double position[3], double rotation[3])
Re-set parameters of existing box.
unsigned getNBoxes() const
Get number of box volumes.
Abstract base class for different kinds of events.
Struct to hold parameters of box volumes (examples, scintilators for cosmic test)
Struct to hold tube parameters.
Struct to hold wedge parameters.