Belle II Software  release-08-01-10
tessellatedSolidStr.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 <iostream>
13 #include <iomanip>
14 #include <vector>
15 
16 namespace Belle2 {
27  int tessellatedSolidID;
28  unsigned int nCells;
29  unsigned int nApexPerCell;
30  // Tessellated solid represented by the array (vector) of triangles
31  std::vector<std::vector<double>> posV1; // x, y, z of apex1
32  std::vector<std::vector<double>> posV2; // x, y, z of apex2
33  std::vector<std::vector<double>> posV3; // x, y, z of apex3
35  {
36  tessellatedSolidID = 0;
37  nCells = 0;
38  nApexPerCell = 0;
39  }
40  ~tessellatedSolidStr() {;}
41  void defineDummyApex()
42  {
43  std::vector<double> apex;
44  for (unsigned int i = 0; i < 3; i++)
45  apex.push_back(i);
46  posV1.push_back(apex);
47  posV2.push_back(apex);
48  posV3.push_back(apex);
49  }
50  void pushBackApexesCoordinates(const std::vector<double>& apex1x, const std::vector<double>& apex1y,
51  const std::vector<double>& apex1z,
52  const std::vector<double>& apex2x, const std::vector<double>& apex2y, const std::vector<double>& apex2z,
53  const std::vector<double>& apex3x, const std::vector<double>& apex3y, const std::vector<double>& apex3z)
54  {
55  if (nCells != apex1x.size())
56  B2ERROR("tessellatedSolidStr: apex1x.size() != nCells");
57  if (nCells != apex1y.size())
58  B2ERROR("tessellatedSolidStr: apex1y.size() != nCells");
59  if (nCells != apex1z.size())
60  B2ERROR("tessellatedSolidStr: apex1z.size() != nCells");
61  if (nCells != apex2x.size())
62  B2ERROR("tessellatedSolidStr: apex2x.size() != nCells");
63  if (nCells != apex2y.size())
64  B2ERROR("tessellatedSolidStr: apex2y.size() != nCells");
65  if (nCells != apex2z.size())
66  B2ERROR("tessellatedSolidStr: apex2z.size() != nCells");
67  if (nCells != apex3x.size())
68  B2ERROR("tessellatedSolidStr: apex3x.size() != nCells");
69  if (nCells != apex3y.size())
70  B2ERROR("tessellatedSolidStr: apex3y.size() != nCells");
71  if (nCells != apex3z.size())
72  B2ERROR("tessellatedSolidStr: apex3z.size() != nCells");
73  for (unsigned int i = 0; i < nCells; i++) {
74  std::vector<double> apex1;
75  std::vector<double> apex2;
76  std::vector<double> apex3;
77  apex1.push_back(apex1x.at(i));
78  apex1.push_back(apex1y.at(i));
79  apex1.push_back(apex1z.at(i));
80  apex2.push_back(apex2x.at(i));
81  apex2.push_back(apex2y.at(i));
82  apex2.push_back(apex2z.at(i));
83  apex3.push_back(apex3x.at(i));
84  apex3.push_back(apex3y.at(i));
85  apex3.push_back(apex3z.at(i));
86  posV1.push_back(apex1);
87  posV2.push_back(apex2);
88  posV3.push_back(apex3);
89  }
90  }
91  void printInfo(int verboseLevel = 0)
92  {
93  std::cout << "tessellatedSolidID " << tessellatedSolidID << std::endl
94  << "nCells " << nCells << std::endl
95  << "nApexPerCell " << nApexPerCell << std::endl;
96  if (verboseLevel > 0) {
97  for (unsigned int i = 0; i < posV1.size(); i++) {
98  std::cout << std::setw(20) << "apex1 : x y z " << " " << posV1[i][0] << " " << posV1[i][1] << " " << posV1[i][2] << std::endl
99  << std::setw(20) << "apex2 : x y z " << " " << posV2[i][0] << " " << posV2[i][1] << " " << posV2[i][2] << std::endl
100  << std::setw(20) << "apex3 : x y z " << " " << posV3[i][0] << " " << posV3[i][1] << " " << posV3[i][2] << std::endl;
101  }
102  }
103  }
104  };//struct tessellatedSolidStr {
105 
107 }//namespace Belle2 {
Abstract base class for different kinds of events.
Structure which holds apexes of the tessellation volumes.