Belle II Software  release-05-01-25
tessellatedSolidStr.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Leonid Burmistrov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #include <framework/logging/Logger.h>
13 
14 #include <iostream>
15 #include <iomanip>
16 #include <vector>
17 
18 namespace Belle2 {
28  struct tessellatedSolidStr {
29  int tessellatedSolidID;
30  unsigned int nCells;
31  unsigned int nApexPerCell;
32  // Tessellated solid represented by the array (vector) of triangles
33  std::vector<std::vector<double>> posV1; // x, y, z of apex1
34  std::vector<std::vector<double>> posV2; // x, y, z of apex2
35  std::vector<std::vector<double>> posV3; // x, y, z of apex3
37  {
38  tessellatedSolidID = 0;
39  nCells = 0;
40  nApexPerCell = 0;
41  }
42  ~tessellatedSolidStr() {;}
43  void defineDummyApex()
44  {
45  std::vector<double> apex;
46  for (unsigned int i = 0; i < 3; i++)
47  apex.push_back(i);
48  posV1.push_back(apex);
49  posV2.push_back(apex);
50  posV3.push_back(apex);
51  }
52  void pushBackApexesCoordinates(const std::vector<double>& apex1x, const std::vector<double>& apex1y,
53  const std::vector<double>& apex1z,
54  const std::vector<double>& apex2x, const std::vector<double>& apex2y, const std::vector<double>& apex2z,
55  const std::vector<double>& apex3x, const std::vector<double>& apex3y, const std::vector<double>& apex3z)
56  {
57  if (nCells != apex1x.size())
58  B2ERROR("tessellatedSolidStr: apex1x.size() != nCells");
59  if (nCells != apex1y.size())
60  B2ERROR("tessellatedSolidStr: apex1y.size() != nCells");
61  if (nCells != apex1z.size())
62  B2ERROR("tessellatedSolidStr: apex1z.size() != nCells");
63  if (nCells != apex2x.size())
64  B2ERROR("tessellatedSolidStr: apex2x.size() != nCells");
65  if (nCells != apex2y.size())
66  B2ERROR("tessellatedSolidStr: apex2y.size() != nCells");
67  if (nCells != apex2z.size())
68  B2ERROR("tessellatedSolidStr: apex2z.size() != nCells");
69  if (nCells != apex3x.size())
70  B2ERROR("tessellatedSolidStr: apex3x.size() != nCells");
71  if (nCells != apex3y.size())
72  B2ERROR("tessellatedSolidStr: apex3y.size() != nCells");
73  if (nCells != apex3z.size())
74  B2ERROR("tessellatedSolidStr: apex3z.size() != nCells");
75  for (unsigned int i = 0; i < nCells; i++) {
76  std::vector<double> apex1;
77  std::vector<double> apex2;
78  std::vector<double> apex3;
79  apex1.push_back(apex1x.at(i));
80  apex1.push_back(apex1y.at(i));
81  apex1.push_back(apex1z.at(i));
82  apex2.push_back(apex2x.at(i));
83  apex2.push_back(apex2y.at(i));
84  apex2.push_back(apex2z.at(i));
85  apex3.push_back(apex3x.at(i));
86  apex3.push_back(apex3y.at(i));
87  apex3.push_back(apex3z.at(i));
88  posV1.push_back(apex1);
89  posV2.push_back(apex2);
90  posV3.push_back(apex3);
91  }
92  }
93  void printInfo(int verboseLevel = 0)
94  {
95  std::cout << "tessellatedSolidID " << tessellatedSolidID << std::endl
96  << "nCells " << nCells << std::endl
97  << "nApexPerCell " << nApexPerCell << std::endl;
98  if (verboseLevel > 0) {
99  for (unsigned int i = 0; i < posV1.size(); i++) {
100  std::cout << std::setw(20) << "apex1 : x y z " << " " << posV1[i][0] << " " << posV1[i][1] << " " << posV1[i][2] << std::endl
101  << std::setw(20) << "apex2 : x y z " << " " << posV2[i][0] << " " << posV2[i][1] << " " << posV2[i][2] << std::endl
102  << std::setw(20) << "apex3 : x y z " << " " << posV3[i][0] << " " << posV3[i][1] << " " << posV3[i][2] << std::endl;
103  }
104  }
105  }
106  };//struct tessellatedSolidStr {
107 
109 }//namespace Belle2 {
Belle2::tessellatedSolidStr
Structure which holds apexes of the tessellation volumes.
Definition: tessellatedSolidStr.h:36
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19