Belle II Software  release-08-01-10
shapes.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 <string>
11 #include <vector>
12 #include <G4VSolid.hh>
13 #include <G4Transform3D.hh>
14 #include "ecl/dbobjects/ECLCrystalsShapeAndPosition.h"
15 
16 namespace Belle2 {
21  namespace ECL {
22  double cosd(double);
23  double sind(double);
24  double tand(double);
25 
26 #define UNUSED __attribute__((unused))
27 
29  struct shape_t {
30  int nshape;
31  shape_t(): nshape(0) {}
32  virtual ~shape_t() {}
33 
35  G4VSolid* get_solid(const std::string& prefix, double wrapthick, G4Translate3D& shift) const;
37  virtual G4VSolid* get_tesselatedsolid(const std::string& prefix, double wrapthick, G4Translate3D& shift) const = 0;
39  virtual G4VSolid* get_trapezoid(const std::string& prefix, double wrapthick, G4Translate3D& shift) const = 0;
41  virtual G4VSolid* get_extrudedsolid(const std::string& prefix, double wrapthick, G4Translate3D& shift) const = 0;
43  virtual G4VSolid* get_bellecrystal(const std::string& prefix, double wrapthick, G4Translate3D& shift) const = 0;
45  virtual bool istrap() const = 0;
46  };
47 
49  struct cplacement_t {
50  int nshape;
51  double Rphi1;
52  double Rtheta;
53  double Rphi2;
54  double Pr;
55  double Ptheta;
56  double Pphi;
57  };
58 
59  std::vector<shape_t*> load_shapes(const std::string& fname);
60  std::vector<cplacement_t> load_placements(const std::string& fname);
61 
62  struct Point_t;
63  Point_t centerofgravity(Point_t*, const Point_t*);
64  G4Transform3D get_transform(const cplacement_t& t);
65 
66  inline std::string suf(const std::string& s, int indx)
67  {
68  std::string r(s);
69  r += "_" + std::to_string(indx);
70  return r;
71  }
72 
73  enum ECLParts { forward, barrel, backward };
74  Belle2::ECLCrystalsShapeAndPosition loadCrystalsShapeAndPosition();
75 
76  std::vector<shape_t*> load_shapes(const Belle2::ECLCrystalsShapeAndPosition*, enum ECLParts);
77  std::vector<cplacement_t> load_placements(const Belle2::ECLCrystalsShapeAndPosition*, enum ECLParts);
78 
79  }
81 }
Abstract base class for different kinds of events.
struct for Point
Definition: BelleCrystal.h:31
placement struct
Definition: shapes.h:49
double Rphi1
Eulers' angle phi 1.
Definition: shapes.h:51
double Ptheta
polar angle of origin position
Definition: shapes.h:55
double Rphi2
Eulers' angle phi 2.
Definition: shapes.h:53
double Pphi
azimuthal angle of origin position
Definition: shapes.h:56
double Rtheta
Eulers' angle theta.
Definition: shapes.h:52
double Pr
radius of origin position
Definition: shapes.h:54
int nshape
shapes
Definition: shapes.h:30
virtual G4VSolid * get_trapezoid(const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
get trapezoid
virtual G4VSolid * get_extrudedsolid(const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
get extruded solid
virtual G4VSolid * get_bellecrystal(const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
get Belle crystal
G4VSolid * get_solid(const std::string &prefix, double wrapthick, G4Translate3D &shift) const
get solid
Definition: shapes.cc:73
virtual bool istrap() const =0
is trapped
virtual G4VSolid * get_tesselatedsolid(const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
get tesselated solid