12#define BOOST_TEST_MODULE midBaseMapping
13#define BOOST_TEST_DYN_LINK
14#include <boost/test/unit_test.hpp>
17#include <boost/test/data/monomorphic.hpp>
18#include <boost/test/data/monomorphic/generators/xrange.hpp>
19#include <boost/test/data/test_case.hpp>
25namespace bdata = boost::unit_test::data;
43 return (sameColStrip && strip1.
line == strip2.
line);
49 for (
auto const& neigh : neighbours) {
50 if (
areEqual(refStrip, neigh, cathode)) {
54 std::cerr <<
"Cannot find " << refStrip.
strip <<
" line " << refStrip.
line <<
" column " << refStrip.
column
60 const std::vector<Mapping::MpStripIndex>& neighbours,
const Mapping& mapping)
63 float delta = checkUpDown ? 0.1 : 0;
76 if (!
areEqual(refStrip, upRef, cathode)) {
87 const Mapping& mapping,
int cathode,
int deId)
93 ss <<
"Strip " << stripIndex.
strip <<
" cathode " << cathode <<
" line " << stripIndex.
line <<
" column "
102 bool checkUpDown =
false;
103 for (
int ix = 0; ix < 3; ++ix) {
104 for (
int iy = 0; iy < 3; ++iy) {
105 if ((ix - 1) * (iy - 1) != 0 || ix == iy) {
109 checkUpDown = (ix == 1) ?
false :
true;
110 }
else if (iy != 1) {
114 int nFound =
findInNeighbours(xPos[ix], yPos[iy], cathode, deId, checkUpDown, neighbours, mapping);
116 ss <<
" err: (" << ix - 1 <<
", " << iy - 1 <<
")";
124 if (nMatched != neighbours.size()) {
126 ss <<
" matched " << nMatched <<
" != " << neighbours.size();
130 std::cerr << ss.str() <<
". Neighbours: " << std::endl;
131 for (
auto const& neigh : neighbours) {
132 std::cerr <<
" strip " << neigh.strip <<
" line " << neigh.line <<
" column " << neigh.column << std::endl;
139BOOST_DATA_TEST_CASE_F(MyFixture, MID_Mapping_NeighboursNBP, boost::unit_test::data::xrange(72))
142 for (
int icolumn = mapping.getFirstColumn(deId); icolumn < 7; ++icolumn) {
143 int firstLineBP = mapping.getFirstBoardBP(icolumn, deId);
144 int lastLineBP = mapping.getLastBoardBP(icolumn, deId);
145 for (
int icathode = 0; icathode < 2; ++icathode) {
146 int firstLine = firstLineBP;
147 int lastLine = lastLineBP;
157 firstLine = lastLine = (firstLine + lastLine) / 2;
159 int nStrips = (icathode == 0) ? 16 : mapping.getNStripsNBP(icolumn, deId);
160 for (
int iline = firstLine; iline <= lastLine; ++iline) {
161 for (
int istrip = 0; istrip < nStrips; ++istrip) {
162 Mapping::MpStripIndex stripIndex;
163 stripIndex.column = icolumn;
164 stripIndex.line = iline;
165 stripIndex.strip = istrip;
166 std::vector<Mapping::MpStripIndex> neighbours = mapping.getNeighbours(stripIndex, icathode, deId);
MpStripIndex stripByPosition(double xPos, double yPos, int cathode, int deId, bool warn=true) const
MpArea stripByLocation(int strip, int cathode, int line, int column, int deId, bool warn=true) const
double getXmax() const
Get x max.
double getCenterY() const
double getYmin() const
Get y min.
double getYmax() const
Get y max.
double getCenterX() const
double getXmin() const
Get x min.
bool findInNeighbours(const Mapping::MpStripIndex &refStrip, const std::vector< Mapping::MpStripIndex > &neighbours, int cathode)
bool areEqual(const Mapping::MpStripIndex &strip1, const Mapping::MpStripIndex &strip2, int cathode)
BOOST_TEST(clusters.size()==clusterizer.getClusters().size())
bool areNeighboursOk(const Mapping::MpStripIndex &stripIndex, const std::vector< Mapping::MpStripIndex > &neighbours, const Mapping &mapping, int cathode, int deId)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Indexes required to define a strip in the detection element.
int strip
Line of the local board in the column.
bool isValid()
Check if Strip is Valid.
int line
Column in the DE.