9#include "GeoModelKernel/throwExcept.h"
11#include "Acts/Utilities/Helpers.hpp"
12#include "Acts/Utilities/UnitVectors.hpp"
13#include "Acts/Definitions/Units.hpp"
16using namespace Acts::UnitLiterals;
24 inline std::tuple<unsigned, SectorProjector> msSectorAndProj(
const std::int8_t expandSector) {
25 assert (expandSector >= 0 && expandSector <= nExpanded);
26 if (expandSector == 0) {
28 }
else if (expandSector == 1) {
29 return std::make_tuple(
numberOfSectors(), SectorProjector::rightOverlap);
31 const int regSector = expandSector / 2;
32 const int backConv = expandSector - 2*regSector;
34 case 1:
return std::make_tuple(regSector, SectorProjector::rightOverlap);
35 case 0:
return std::make_tuple(regSector, SectorProjector::center);
36 case -1:
return std::make_tuple(regSector, SectorProjector::leftOverlap);
54 std::vector<int> sectors{};
56 assert(!sectors.empty());
57 if (sectors.size() == 1) {
61 assert(std::abs(dS) == 1);
68 return std::get<1>(msSectorAndProj(
sector()));
71 return std::get<0>(msSectorAndProj(
sector()));
77 const auto [msSec, proj] = msSectorAndProj(
sector());
83 return msSec + Acts::toUnderlying(proj);
90 if (sector1 == sector2) {
97 return sector() < other.sector();
100 return sector() == other.sector();
103 return sector() != other.sector();
109 return Acts::makeDirectionFromPhiTheta(
phi(), 90._degree);
112 return Acts::makeDirectionFromPhiTheta(
phi() + 90._degree, 90._degree);
115 const int dS = std::abs(other.sector() -
sector());
116 return std::min(dS, nExpanded - dS) <= 1;
123 case center:
return "center";
129 ostr<<
"Expanded sector: "<<
static_cast<int>(
sector()) <<
" -> "
double phi() const
Returns the phi angle of the expanded sector.
Amg::Vector3D normalDir() const
Returns the vector that is normal to the plane spanned by the expanded sector.
std::int8_t m_sector
the sector number stored
bool operator==(const ExpandedSector &other) const
Define the equal operator.
SectorProjector
Enumeration to select the sector projection of the regular MS sector.
@ rightOverlap
Project the segment onto the sector centre.
@ center
Project the segment onto the overlap with the previous sector.
ExpandedSector(const unsigned msSector, const SectorProjector proj)
Constructor of the expanded sector taking the regular MS sector number and the projector.
double sectorSize() const
Return the expanded sector (half) size.
unsigned msSector() const
Returns the ms sector corresponding to the expanded sector.
std::int8_t sector() const
Returns the expanded sector number.
SectorProjector projector() const
Returns the projector in the corresponding MS sector.
bool isNeighbour(const ExpandedSector &other) const
Returns true if the expanded sector is a neighbour of the other.
bool operator!=(const ExpandedSector &other) const
Define the unequal operator.
unsigned adjacentMsSector() const
Returns the neighbouring msSector number constructed from the primary sector and the sector overlap p...
Amg::Vector3D radialDir() const
Returns the vector pointing radially along the sector plane.
static std::string toString(const SectorProjector proj)
Return the projector as a string.
bool operator<(const ExpandedSector &other) const
Define the ordering operator.
double sectorOverlapPhi(int sector1, int sector2) const
returns the phi position of the overlap between the two sectors (which have to be neighboring) in rad...
double sectorWidth(int sector) const
sector width (with overlap) in radians
void getSectors(double phi, std::vector< int > §ors) const
returns the main sector plus neighboring if the phi position is in an overlap region
double sectorSize(int sector) const
sector size (exclusive) in radians
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
constexpr unsigned numberOfSectors()
return total number of sectors
#define THROW_EXCEPTION(MESSAGE)