ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonSectorMapping Class Reference

#include <MuonSectorMapping.h>

Collaboration diagram for Muon::MuonSectorMapping:

Public Member Functions

bool insideSector (int sector, double phi) const
 checks whether the phi position is consistent with sector
int getSector (double phi) const
 returns the sector corresponding to the phi position
void getSectors (double phi, std::vector< int > &sectors) const
 returns the main sector plus neighboring if the phi position is in an overlap region
double sectorPhi (int sector) const
 returns the centeral phi position of a sector in radians
double transformPhiToSector (double phi, int sector, bool toSector=true) const
 transforms a phi position from and to the sector coordinate system in radians
double transformRToSector (double r, double phi, int sector, bool toSector=true) const
 expresses a radial position from and to the sector coordinate frame, the phi position should always be global in mm
double sectorOverlapPhi (int sector1, int sector2) const
 returns the phi position of the overlap between the two sectors (which have to be neighboring) in radians
bool closeToSectorBoundary (double phi) const
 checks whether the phi position is close to a sector boundary
double transformRToNeighboringSector (double r, int sectorHit, int sectorTarget) const
 transform a radial position from one sector frame into another
double sectorSize (int sector) const
 sector size (exclusive) in radians
double sectorWidth (int sector) const
 sector width (with overlap) in radians

Static Public Member Functions

static bool isSmall (int sector)

Static Private Attributes

static constexpr double s_oneEightsOfPi {M_PI / 8.}
static constexpr double s_inverseOneEightsOfPi {8. / M_PI}
static constexpr std::array< double, 2 > s_sectorSize {0.4 * s_oneEightsOfPi, 0.6 * s_oneEightsOfPi}
static constexpr double s_sectorOverlap {0.1 * s_oneEightsOfPi}
static bool s_debug ATLAS_THREAD_SAFE

Detailed Description

Definition at line 20 of file MuonSectorMapping.h.

Member Function Documentation

◆ closeToSectorBoundary()

bool Muon::MuonSectorMapping::closeToSectorBoundary ( double phi) const
inline

checks whether the phi position is close to a sector boundary

Definition at line 106 of file MuonSectorMapping.h.

106 {
107 std::vector<int> sectors;
108 getSectors(phi, sectors);
109 return sectors.size() > 1;
110 }
Scalar phi() const
phi method
void getSectors(double phi, std::vector< int > &sectors) const
returns the main sector plus neighboring if the phi position is in an overlap region

◆ getSector()

int Muon::MuonSectorMapping::getSector ( double phi) const
inline

returns the sector corresponding to the phi position

Definition at line 86 of file MuonSectorMapping.h.

86 {
87 // remap phi onto sector structure
88 double val = (phi + sectorSize(1)) * s_inverseOneEightsOfPi; // convert to value between -8 and 8, shift by width first sector
89 if (val < 0) val += 16;
90 int sliceIndex = static_cast<int>(val / 2); // large/small wedge
91 double valueInSlice = val - 2 * sliceIndex;
92 int sector = 2 * sliceIndex + 1;
93 if (valueInSlice > 1.2) ++sector;
94 return sector;
95 }
static constexpr double s_inverseOneEightsOfPi
double sectorSize(int sector) const
sector size (exclusive) in radians

◆ getSectors()

void Muon::MuonSectorMapping::getSectors ( double phi,
std::vector< int > & sectors ) const
inline

returns the main sector plus neighboring if the phi position is in an overlap region

Definition at line 97 of file MuonSectorMapping.h.

97 {
98 int sector = getSector(phi);
99 int sectorNext = sector != 16 ? sector + 1 : 1;
100 int sectorBefore = sector != 1 ? sector - 1 : 16;
101 if (insideSector(sectorBefore, phi)) sectors.push_back(sectorBefore);
102 if (insideSector(sector, phi)) sectors.push_back(sector);
103 if (insideSector(sectorNext, phi)) sectors.push_back(sectorNext);
104 }
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
int getSector(double phi) const
returns the sector corresponding to the phi position

◆ insideSector()

bool Muon::MuonSectorMapping::insideSector ( int sector,
double phi ) const
inline

checks whether the phi position is consistent with sector

Definition at line 74 of file MuonSectorMapping.h.

74 {
75 double phiInSec = transformPhiToSector(phi, sector);
76 if (phiInSec < -sectorWidth(sector)) return false;
77 if (phiInSec > sectorWidth(sector)) return false;
78 return true;
79 }
double transformPhiToSector(double phi, int sector, bool toSector=true) const
transforms a phi position from and to the sector coordinate system in radians
double sectorWidth(int sector) const
sector width (with overlap) in radians

◆ isSmall()

bool Muon::MuonSectorMapping::isSmall ( int sector)
inlinestatic

Definition at line 34 of file MuonSectorMapping.h.

34 {
35 return sector % 2 == 0;
36 }

◆ sectorOverlapPhi()

double Muon::MuonSectorMapping::sectorOverlapPhi ( int sector1,
int sector2 ) const
inline

returns the phi position of the overlap between the two sectors (which have to be neighboring) in radians

Definition at line 120 of file MuonSectorMapping.h.

120 {
121 if (sector1 == sector2) return sectorPhi(sector1);
122
123 int s1 = std::min(sector1, sector2);
124 int s2 = std::max(sector1, sector2);
125 if (s2 == 16 && s1 == 1) {
126 s1 = 16;
127 s2 = 1;
128 } else if (std::abs(s1 - s2) > 1) {
129 if (s_debug) std::cout << " bad sector combination: not neighbouring " << s1 << " " << s2 << std::endl;
130 return 0;
131 }
132
133 double phi1 = sectorPhi(s1);
134 double phio1 = phi1 + sectorSize(s1);
135 if (phio1 > M_PI) phio1 -= 2 * M_PI;
136
137 return phio1;
138 }
#define M_PI
double sectorPhi(int sector) const
returns the centeral phi position of a sector in radians

◆ sectorPhi()

double Muon::MuonSectorMapping::sectorPhi ( int sector) const
inline

returns the centeral phi position of a sector in radians

Definition at line 81 of file MuonSectorMapping.h.

81 {
82 if (sector < 10) return M_PI * (sector - 1) / 8.;
83 return -M_PI * (2 - (sector - 1) / 8.);
84 }

◆ sectorSize()

double Muon::MuonSectorMapping::sectorSize ( int sector) const
inline

sector size (exclusive) in radians

Definition at line 67 of file MuonSectorMapping.h.

67 {
68 const int idx = sector % 2;
69 return s_sectorSize[idx];
70 }
static constexpr std::array< double, 2 > s_sectorSize

◆ sectorWidth()

double Muon::MuonSectorMapping::sectorWidth ( int sector) const
inline

sector width (with overlap) in radians

Definition at line 72 of file MuonSectorMapping.h.

72{ return sectorSize(sector) + s_sectorOverlap; }
static constexpr double s_sectorOverlap

◆ transformPhiToSector()

double Muon::MuonSectorMapping::transformPhiToSector ( double phi,
int sector,
bool toSector = true ) const
inline

transforms a phi position from and to the sector coordinate system in radians

Definition at line 112 of file MuonSectorMapping.h.

112 {
113 double sign = toSector ? -1 : 1;
114 double dphi = phi + sign * sectorPhi(sector);
115 if (dphi > M_PI) dphi -= 2 * M_PI;
116 if (dphi < -M_PI) dphi += 2 * M_PI;
117 return dphi;
118 }
int sign(int a)

◆ transformRToNeighboringSector()

double Muon::MuonSectorMapping::transformRToNeighboringSector ( double r,
int sectorHit,
int sectorTarget ) const
inline

transform a radial position from one sector frame into another

Definition at line 152 of file MuonSectorMapping.h.

152 {
153 double phi = sectorPhi(sectorHit);
154 double phio = sectorOverlapPhi(sectorHit, sector);
155 double dphio = phi - phio;
156 if (dphio < -M_PI) dphio += 2 * M_PI;
157 double redge = r / std::cos(dphio);
158 double phi_sec = sectorPhi(sector);
159 double dphi = phio - phi_sec;
160 if (dphi < -M_PI) dphi += 2 * M_PI;
161 if (std::abs(dphi) > 0.3 && s_debug) {
162 std::cout << " large dphi detected!!: sector " << sector << " of hit " << sectorHit << " phi ref sector " << phi_sec << " hit "
163 << phi << " dphi " << dphi << std::endl;
164 }
165 return redge * std::cos(dphi);
166 }
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...
int r
Definition globals.cxx:22

◆ transformRToSector()

double Muon::MuonSectorMapping::transformRToSector ( double r,
double phi,
int sector,
bool toSector = true ) const
inline

expresses a radial position from and to the sector coordinate frame, the phi position should always be global in mm

Definition at line 140 of file MuonSectorMapping.h.

140 {
141 double dphi = transformPhiToSector(phi, sector);
142 if (std::abs(dphi) > 0.3 && s_debug) {
143 std::cout << " large dphi detected!!: phi " << phi << " sector " << sector << " phi " << sectorPhi(sector) << " " << phi
144 << " dphi " << dphi << std::endl;
145 }
146 if (toSector)
147 return r * std::cos(dphi);
148 else
149 return r / std::cos(dphi);
150 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

bool s_debug Muon::MuonSectorMapping::ATLAS_THREAD_SAFE
staticprivate

Definition at line 64 of file MuonSectorMapping.h.

◆ s_inverseOneEightsOfPi

double Muon::MuonSectorMapping::s_inverseOneEightsOfPi {8. / M_PI}
staticconstexprprivate

Definition at line 61 of file MuonSectorMapping.h.

61{8. / M_PI}; // 8/pi

◆ s_oneEightsOfPi

double Muon::MuonSectorMapping::s_oneEightsOfPi {M_PI / 8.}
staticconstexprprivate

Definition at line 60 of file MuonSectorMapping.h.

60{M_PI / 8.}; // pi/8

◆ s_sectorOverlap

double Muon::MuonSectorMapping::s_sectorOverlap {0.1 * s_oneEightsOfPi}
staticconstexprprivate

Definition at line 63 of file MuonSectorMapping.h.

63{0.1 * s_oneEightsOfPi}; // size of the overlap between small and large sectors
static constexpr double s_oneEightsOfPi

◆ s_sectorSize

std::array<double, 2> Muon::MuonSectorMapping::s_sectorSize {0.4 * s_oneEightsOfPi, 0.6 * s_oneEightsOfPi}
staticconstexprprivate

Definition at line 62 of file MuonSectorMapping.h.

62{0.4 * s_oneEightsOfPi, 0.6 * s_oneEightsOfPi}; // side of a sector in radiants

The documentation for this class was generated from the following file: