Belle II Software development
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
16namespace Belle2 {
28 unsigned int nCells;
29 unsigned int nApexPerCell;
31 /* Tessellated solid represented by the array (vector) of triangles. */
32
34 std::vector<std::vector<double>> posV1;
35
37 std::vector<std::vector<double>> posV2;
38
40 std::vector<std::vector<double>> posV3;
41
43 {
45 nCells = 0;
46 nApexPerCell = 0;
47 }
49
54 {
55 std::vector<double> apex;
56 for (unsigned int i = 0; i < 3; i++)
57 apex.push_back(i);
58 posV1.push_back(apex);
59 posV2.push_back(apex);
60 posV3.push_back(apex);
61 }
62
66 void pushBackApexesCoordinates(const std::vector<double>& apex1x, const std::vector<double>& apex1y,
67 const std::vector<double>& apex1z,
68 const std::vector<double>& apex2x, const std::vector<double>& apex2y, const std::vector<double>& apex2z,
69 const std::vector<double>& apex3x, const std::vector<double>& apex3y, const std::vector<double>& apex3z)
70 {
71 if (nCells != apex1x.size())
72 B2ERROR("tessellatedSolidStr: apex1x.size() != nCells");
73 if (nCells != apex1y.size())
74 B2ERROR("tessellatedSolidStr: apex1y.size() != nCells");
75 if (nCells != apex1z.size())
76 B2ERROR("tessellatedSolidStr: apex1z.size() != nCells");
77 if (nCells != apex2x.size())
78 B2ERROR("tessellatedSolidStr: apex2x.size() != nCells");
79 if (nCells != apex2y.size())
80 B2ERROR("tessellatedSolidStr: apex2y.size() != nCells");
81 if (nCells != apex2z.size())
82 B2ERROR("tessellatedSolidStr: apex2z.size() != nCells");
83 if (nCells != apex3x.size())
84 B2ERROR("tessellatedSolidStr: apex3x.size() != nCells");
85 if (nCells != apex3y.size())
86 B2ERROR("tessellatedSolidStr: apex3y.size() != nCells");
87 if (nCells != apex3z.size())
88 B2ERROR("tessellatedSolidStr: apex3z.size() != nCells");
89 for (unsigned int i = 0; i < nCells; i++) {
90 std::vector<double> apex1;
91 std::vector<double> apex2;
92 std::vector<double> apex3;
93 apex1.push_back(apex1x.at(i));
94 apex1.push_back(apex1y.at(i));
95 apex1.push_back(apex1z.at(i));
96 apex2.push_back(apex2x.at(i));
97 apex2.push_back(apex2y.at(i));
98 apex2.push_back(apex2z.at(i));
99 apex3.push_back(apex3x.at(i));
100 apex3.push_back(apex3y.at(i));
101 apex3.push_back(apex3z.at(i));
102 posV1.push_back(apex1);
103 posV2.push_back(apex2);
104 posV3.push_back(apex3);
105 }
106 }
107
111 void printInfo(int verboseLevel = 0)
112 {
113 std::cout << "tessellatedSolidID " << tessellatedSolidID << std::endl
114 << "nCells " << nCells << std::endl
115 << "nApexPerCell " << nApexPerCell << std::endl;
116 if (verboseLevel > 0) {
117 for (unsigned int i = 0; i < posV1.size(); i++) {
118 std::cout << std::setw(20) << "apex1 : x y z " << " " << posV1[i][0] << " " << posV1[i][1] << " " << posV1[i][2] << std::endl
119 << std::setw(20) << "apex2 : x y z " << " " << posV2[i][0] << " " << posV2[i][1] << " " << posV2[i][2] << std::endl
120 << std::setw(20) << "apex3 : x y z " << " " << posV3[i][0] << " " << posV3[i][1] << " " << posV3[i][2] << std::endl;
121 }
122 }
123 }
124 };//struct tessellatedSolidStr {
125
127}//namespace Belle2 {
Abstract base class for different kinds of events.
Structure which holds apexes of the tessellation volumes.
void defineDummyApex()
Define dummy apex.
void printInfo(int verboseLevel=0)
Print info about tessellation volumes.
std::vector< std::vector< double > > posV1
x, y, z of apex1.
std::vector< std::vector< double > > posV3
x, y, z of apex3.
int tessellatedSolidID
tessellated solid ID
std::vector< std::vector< double > > posV2
x, y, z of apex2.
unsigned int nApexPerCell
number of apexes per cell
unsigned int nCells
number of cells
void pushBackApexesCoordinates(const std::vector< double > &apex1x, const std::vector< double > &apex1y, const std::vector< double > &apex1z, const std::vector< double > &apex2x, const std::vector< double > &apex2y, const std::vector< double > &apex2z, const std::vector< double > &apex3x, const std::vector< double > &apex3y, const std::vector< double > &apex3z)
Fill coordinates of apexes.