ATLAS Offline Software
Loading...
Searching...
No Matches
MuonRegionHough.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8namespace MuonHough {
10 MuonSectorHough::MuonSectorHough(int sector, const MuonDetectorDescription& regionDescriptions) {
12
13 // loop over regions and layers of the detector and build the transforms
14 constexpr int detRegMax = static_cast<int>(DetRegIdx::DetectorRegionIndexMax);
15 constexpr int layIdxMax = static_cast<int>(LayIdx::LayerIndexMax);
16 for (int reg = 0; reg < detRegMax; ++reg) {
17 const auto region = static_cast<DetRegIdx>(reg);
18 for (int lay = 0; lay < layIdxMax; ++lay) {
19 const auto layer = static_cast<LayIdx>(lay);
20
21 // skip the few empty slots in the hash
22 RegionDescriptor descriptor = regionDescriptions.getDescriptor(sector, region, layer);
23 if (descriptor.chIndex == ChIdx::ChUnknown) {
24 continue;
25 }
27 m_transforms[index] = std::make_unique<MuonLayerHough>(descriptor);
28 }
29 }
30 }
31
33
35 for (auto& transform : m_transforms) {
36 if (transform) transform->reset();
37 }
38 }
39
41 for (auto& sector : m_sectors) sector->reset();
42 for (auto& transform : m_phiTransforms) transform->reset();
43 }
44
46
49
51 MuonDetectorDescription detectorDescription; // initialize all the regions
52 for (unsigned int i = 1; i <= 16; ++i) { m_sectors.push_back(std::make_unique<MuonSectorHough>(i, detectorDescription)); }
53 using namespace Muon::MuonStationIndex;
54 for (int i = 0; i < toInt(DetRegIdx::DetectorRegionIndexMax); ++i) {
55 m_phiTransforms.push_back(std::make_unique<MuonPhiLayerHough>(60, -M_PI, M_PI, static_cast<DetRegIdx>(i)));
56 }
57 }
58
60
62 bool isSmall = (sector % 2 == 0);
63 using namespace Muon::MuonStationIndex;
64 ChIdx chIndex = toChamberIndex(region, layer, isSmall);
65 if (chIndex == ChIdx::ChUnknown || chIndex == ChIdx::ChIndexMax) {
66 return RegionDescriptor{};
67 }
68
70 descriptor.sector = sector;
71 // exceptions for a few barrel regions
72 if (region == DetRegIdx::Barrel) {
73 if ((sector == 10 || sector == 14) && layer == LayIdx::Inner)
74 descriptor.referencePosition = 5400.;
75 else if ((sector == 11 || sector == 13) && layer == LayIdx::Outer)
76 descriptor.referencePosition = 10650.;
77 } else if (region == DetRegIdx::EndcapC) { // multiply reference position by -1 for C side
78 descriptor.region = region;
79 if (layer == LayIdx::BarrelExtended) {
80 descriptor.yMinRange *= -1;
81 descriptor.yMaxRange *= -1;
82 std::swap(descriptor.yMinRange, descriptor.yMaxRange);
83 } else {
84 descriptor.referencePosition *= -1;
85 }
86 }
87 return descriptor;
88 }
89
91 double scalefactor = 1.0; // can be used to tune the steps in theta variation!
92 int inner_step = 3; // default is 3
93 int middle_step = 5 * scalefactor; // default is 5--range is 0.25
94 int outer_step = 7 * scalefactor; // default is 7--range is 0.35
95 double inner_gap = 0.05; // default is 0.05
96 double middle_gap = 0.1 / scalefactor; // default is 0.1
97 double outer_gap = middle_gap; // default is 0.1
98 int ystep = 30; // default is 30
99 m_regionDescriptions.resize(static_cast<int>(ChIdx::ChIndexMax));
100 m_regionDescriptions[static_cast<int>(ChIdx::BIS)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BIS,
101 4560, -7500, 7500, ystep, middle_gap, inner_step);
102 m_regionDescriptions[static_cast<int>(ChIdx::BIL)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BIL,
103 4950, -7000, 7000, ystep, middle_gap, inner_step);
104 m_regionDescriptions[static_cast<int>(ChIdx::BMS)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BMS,
105 8096, -9500, 9500, ystep, middle_gap, middle_step);
106 m_regionDescriptions[static_cast<int>(ChIdx::BML)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BML,
107 7153, -9500, 9500, ystep, middle_gap, middle_step);
108 m_regionDescriptions[static_cast<int>(ChIdx::BOS)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BOS,
109 10570, -13500, 13500, ystep, outer_gap, outer_step);
110 m_regionDescriptions[static_cast<int>(ChIdx::BOL)] = RegionDescriptor(1, DetRegIdx::Barrel, ChIdx::BOL,
111 9500, -13500, 13500, ystep, outer_gap, outer_step);
112 m_regionDescriptions[static_cast<int>(ChIdx::BEE)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::BEE,
113 4415, 7500, 13000, ystep, middle_gap, middle_step);
114 m_regionDescriptions[static_cast<int>(ChIdx::EIS)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EIS,
115 7270, 1000, 7000, ystep, inner_gap, inner_step); // 7
116 m_regionDescriptions[static_cast<int>(ChIdx::EIL)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EIL,
117 7675, 1000, 8000, ystep, inner_gap, inner_step);
118 m_regionDescriptions[static_cast<int>(ChIdx::EES)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EES,
119 10800, 4000, 10000, ystep, middle_gap, middle_step);
120 m_regionDescriptions[static_cast<int>(ChIdx::EEL)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EEL,
121 11330, 4000, 10000, ystep, middle_gap, middle_step);
122 m_regionDescriptions[static_cast<int>(ChIdx::EMS)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EMS,
123 13872, 1500, 13000, ystep, middle_gap, middle_step);
124 m_regionDescriptions[static_cast<int>(ChIdx::EML)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EML,
125 14310, 1500, 13000, ystep, middle_gap, middle_step);
126 m_regionDescriptions[static_cast<int>(ChIdx::EOS)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EOS,
127 21841, 2000, 13500, ystep, outer_gap, outer_step);
128 m_regionDescriptions[static_cast<int>(ChIdx::EOL)] = RegionDescriptor(1, DetRegIdx::EndcapA, ChIdx::EOL,
129 21421, 2000, 13500, ystep, outer_gap, outer_step);
130 }
131
132} // namespace MuonHough
#define M_PI
class managing geometry of the Hough spaces
RegionDescriptor getDescriptor(int sector, DetRegIdx region, LayIdx layer) const
RegionDescriptionVec m_regionDescriptions
cached geometry
Muon::MuonStationIndex::LayerIndex LayIdx
Muon::MuonStationIndex::DetectorRegionIndex DetRegIdx
void initDefaultRegions()
initialize default geometry
Muon::MuonStationIndex::DetectorRegionIndex DetRegIdx
std::vector< std::unique_ptr< MuonPhiLayerHough > > m_phiTransforms
sector transforms
std::vector< std::unique_ptr< MuonSectorHough > > m_sectors
void reset()
reset histograms
MuonDetectorHough()
constructor using default region definitions
void reset()
reset histograms
Muon::MuonStationIndex::DetectorRegionIndex DetRegIdx
std::vector< std::unique_ptr< MuonLayerHough > > m_transforms
MuonSectorHough(int sector, const MuonDetectorDescription &regionDescriptions)
constructor for a given sector using the default geometry
Muon::MuonStationIndex::LayerIndex LayIdx
Muon::MuonStationIndex::ChIndex ChIdx
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
constexpr int toInt(const EnumType enumVal)
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
ChIndex toChamberIndex(DetectorRegionIndex region, LayerIndex layer, bool isSmall)
convert DetectorRegionIndex + LayerIndex + isSmall into ChIndex
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition index.py:1
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
struct containing all information to build a Hough transform for a given chamber index