ATLAS Offline Software
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 namespace MuonHough {
8 
9  MuonSectorHough::MuonSectorHough(int sector, const MuonDetectorDescription& regionDescriptions) {
11 
12  // loop over regions and layers of the detector and build the transforms
15  for (int lay = 0; lay < Muon::MuonStationIndex::LayerIndexMax; ++lay) {
17 
18  // skip the few empty slots in the hash
19  RegionDescriptor descriptor = regionDescriptions.getDescriptor(sector, region, layer);
20  if (descriptor.chIndex == Muon::MuonStationIndex::ChUnknown) continue;
21 
23  // std::cout << " creating transform: sector " << sector << " " << Muon::MuonStationIndex::regionName(region)
24  // << " " << Muon::MuonStationIndex::layerName(layer)
25  // << " " << Muon::MuonStationIndex::stName(Muon::MuonStationIndex::toStationIndex(region,layer))
26  // << " " << Muon::MuonStationIndex::chName(descriptor.chIndex)
27  // << " index " << index << " max " << m_transforms.size() << std::endl;
28  // if( index >= m_transforms.size() ) std::cout << " index out of bound creating hough " <<
29  // Muon::MuonStationIndex::regionName(region)
30  // << " " << Muon::MuonStationIndex::layerName(layer) << std::endl;
31  m_transforms[index] = new MuonLayerHough(descriptor);
32  }
33  }
34  }
35 
37  for (auto& transform : m_transforms) delete transform;
38  }
39 
41  for (auto& transform : m_transforms) {
42  if (transform) transform->reset();
43  }
44  }
45 
47  for (auto& sector : m_sectors) sector->reset();
48  for (auto& transform : m_phiTransforms) transform->reset();
49  }
50 
52 
55  for (auto& sector : m_sectors) delete sector;
56  for (auto& transform : m_phiTransforms) delete transform;
57  }
58 
60  MuonDetectorDescription detectorDescription; // initialize all the regions
61  for (unsigned int i = 1; i <= 16; ++i) { m_sectors.push_back(new MuonSectorHough(i, detectorDescription)); }
62  for (unsigned int i = 0; i < Muon::MuonStationIndex::DetectorRegionIndexMax; ++i) {
64  }
65  }
66 
68 
71  bool isSmall = (sector % 2 == 0);
73  // std::cout << "chamberIndex " << chIndex << " region " << region << " layer " << layer << " isSmall " << isSmall << std::endl ;
74  // if (region%2 != 1 && layer == 4 && !isSmall){//fix bee chamber in the endcap, add them back in for larger chambers//possible bug
75  // in chamber to index
76  // chIndex = Muon::MuonStationIndex::BEE;
77  // }
78 
79  if (chIndex < 0 || chIndex >= Muon::MuonStationIndex::ChIndexMax) {
80  RegionDescriptor descriptor;
81  return descriptor;
82  }
83 
84  RegionDescriptor descriptor = m_regionDescriptions[chIndex];
85  descriptor.sector = sector;
86  // exceptions for a few barrel regions
87  if (region == Muon::MuonStationIndex::Barrel) {
88  if ((sector == 10 || sector == 14) && layer == Muon::MuonStationIndex::Inner)
89  descriptor.referencePosition = 5400.;
90  else if ((sector == 11 || sector == 13) && layer == Muon::MuonStationIndex::Outer)
91  descriptor.referencePosition = 10650.;
92  } else if (region == Muon::MuonStationIndex::EndcapC) { // multiply reference position by -1 for C side
93  descriptor.region = region;
95  descriptor.yMinRange *= -1;
96  descriptor.yMaxRange *= -1;
97  std::swap(descriptor.yMinRange, descriptor.yMaxRange);
98  } else {
99  descriptor.referencePosition *= -1;
100  }
101  }
102 
103  if (descriptor.chIndex < 0 || descriptor.chIndex >= Muon::MuonStationIndex::ChIndexMax) {
104  std::cout << " bad descriptor!!!! " << Muon::MuonStationIndex::regionName(region) << " "
105  << Muon::MuonStationIndex::layerName(layer) << " " << isSmall << " " << chIndex << std::endl;
106  }
107  return descriptor;
108  }
109 
111  double scalefactor = 1.0; // can be used to tune the steps in theta variation!
112  int inner_step = 3; // default is 3
113  int middle_step = 5 * scalefactor; // default is 5--range is 0.25
114  int outer_step = 7 * scalefactor; // default is 7--range is 0.35
115  double inner_gap = 0.05; // default is 0.05
116  double middle_gap = 0.1 / scalefactor; // default is 0.1
117  double outer_gap = middle_gap; // default is 0.1
118  int ystep = 30; // default is 30
121  4560, -7500, 7500, ystep, middle_gap, inner_step);
123  4950, -7000, 7000, ystep, middle_gap, inner_step);
125  8096, -9500, 9500, ystep, middle_gap, middle_step);
127  7153, -9500, 9500, ystep, middle_gap, middle_step);
129  10570, -13500, 13500, ystep, outer_gap, outer_step);
131  9500, -13500, 13500, ystep, outer_gap, outer_step);
133  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::BEE, 4415, 7500, 13000, ystep, middle_gap, middle_step);
135  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EIS, 7270, 1000, 7000, ystep, inner_gap, inner_step); // 7
137  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EIL, 7675, 1000, 8000, ystep, inner_gap, inner_step);
139  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EES, 10800, 4000, 10000, ystep, middle_gap, middle_step);
141  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EEL, 11330, 4000, 10000, ystep, middle_gap, middle_step);
143  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EMS, 13872, 1500, 13000, ystep, middle_gap, middle_step);
145  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EML, 14310, 1500, 13000, ystep, middle_gap, middle_step);
147  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EOS, 21841, 2000, 13500, ystep, outer_gap, outer_step);
149  1, Muon::MuonStationIndex::EndcapA, Muon::MuonStationIndex::EOL, 21421, 2000, 13500, ystep, outer_gap, outer_step);
150  }
151 
152 } // namespace MuonHough
Muon::MuonStationIndex::BIS
@ BIS
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::toChamberIndex
static ChIndex toChamberIndex(DetectorRegionIndex region, LayerIndex layer, bool isSmall)
convert DetectorRegionIndex + LayerIndex + isSmall into ChIndex
Definition: MuonStationIndex.cxx:98
Muon::MuonStationIndex::CSS
@ CSS
Definition: MuonStationIndex.h:18
MuonRegionHough.h
Muon::MuonStationIndex::LayerIndexMax
@ LayerIndexMax
BEE.
Definition: MuonStationIndex.h:43
Muon::MuonStationIndex::BarrelExtended
@ BarrelExtended
EE.
Definition: MuonStationIndex.h:42
MuonHough::RegionDescriptor::region
Muon::MuonStationIndex::DetectorRegionIndex region
Definition: MuonLayerHough.h:41
Muon::MuonStationIndex::EndcapA
@ EndcapA
Definition: MuonStationIndex.h:49
Muon::MuonStationIndex::Inner
@ Inner
Definition: MuonStationIndex.h:40
Muon::MuonStationIndex::Outer
@ Outer
Definition: MuonStationIndex.h:40
Muon::MuonStationIndex::EEL
@ EEL
Definition: MuonStationIndex.h:18
index
Definition: index.py:1
Muon::MuonStationIndex::BML
@ BML
Definition: MuonStationIndex.h:17
Muon::MuonStationIndex::sectorLayerHashMax
static unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
Definition: MuonStationIndex.cxx:231
MuonHough::RegionDescriptor::yMinRange
float yMinRange
Definition: MuonLayerHough.h:44
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
Muon::MuonStationIndex::sectorLayerHash
static unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
Definition: MuonStationIndex.cxx:226
M_PI
#define M_PI
Definition: ActiveFraction.h:11
MuonHough::MuonSectorHough::reset
void reset()
reset histograms
Definition: MuonRegionHough.cxx:40
MuonHough::MuonLayerHough
Definition: MuonLayerHough.h:54
Muon::MuonStationIndex::BOS
@ BOS
Definition: MuonStationIndex.h:17
MuonHough::RegionDescriptor::yMaxRange
float yMaxRange
Definition: MuonLayerHough.h:45
MuonHough::MuonDetectorDescription::initDefaultRegions
void initDefaultRegions()
initialize default geometry
Definition: MuonRegionHough.cxx:110
Muon::MuonStationIndex::BMS
@ BMS
Definition: MuonStationIndex.h:17
MuonHough::RegionDescriptor::referencePosition
float referencePosition
Definition: MuonLayerHough.h:43
MuonHough::RegionDescriptor
struct containing all information to build a Hough transform for a given chamber index
Definition: MuonLayerHough.h:25
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
Muon::MuonStationIndex::EIS
@ EIS
Definition: MuonStationIndex.h:18
MuonHough::MuonSectorHough::MuonSectorHough
MuonSectorHough(int sector, const MuonDetectorDescription &regionDescriptions)
constructor for a given sector using the default geometry
Definition: MuonRegionHough.cxx:9
Muon::MuonStationIndex::EOS
@ EOS
Definition: MuonStationIndex.h:18
MuonHough::MuonPhiLayerHough
Definition: MuonPhiLayerHough.h:22
MuonHough::RegionDescriptor::sector
int sector
Definition: MuonLayerHough.h:40
Muon::MuonStationIndex::regionName
static const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
Definition: MuonStationIndex.cxx:176
MuonHough::MuonDetectorHough::~MuonDetectorHough
~MuonDetectorHough()
destructor
Definition: MuonRegionHough.cxx:54
lumiFormat.i
int i
Definition: lumiFormat.py:92
MuonHough::MuonDetectorDescription
class managing geometry of the Hough spaces
Definition: MuonRegionHough.h:19
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MuonStationIndex::Barrel
@ Barrel
Definition: MuonStationIndex.h:49
MuonHough
Definition: MuonLayerHoughTool.h:42
MuonHough::RegionDescriptor::chIndex
Muon::MuonStationIndex::ChIndex chIndex
Definition: MuonLayerHough.h:42
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
MuonHough::MuonDetectorHough::reset
void reset()
reset histograms
Definition: MuonRegionHough.cxx:46
Muon::MuonStationIndex::layerName
static const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:192
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
Muon::MuonStationIndex::EES
@ EES
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::ChUnknown
@ ChUnknown
Definition: MuonStationIndex.h:16
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
MuonHough::MuonDetectorHough::MuonDetectorHough
MuonDetectorHough()
constructor using default region definitions
Definition: MuonRegionHough.cxx:51
MuonHough::MuonDetectorDescription::m_regionDescriptions
RegionDescriptionVec m_regionDescriptions
cached geometry
Definition: MuonRegionHough.h:32
MuonHough::MuonDetectorDescription::MuonDetectorDescription
MuonDetectorDescription()
constructor
Definition: MuonRegionHough.cxx:67
Muon::MuonStationIndex::DetectorRegionIndexMax
@ DetectorRegionIndexMax
Definition: MuonStationIndex.h:50
MuonHough::MuonSectorHough::~MuonSectorHough
~MuonSectorHough()
destructor
Definition: MuonRegionHough.cxx:36
Muon::MuonStationIndex::ChIndexMax
@ ChIndexMax
Definition: MuonStationIndex.h:19
Muon::MuonStationIndex::EML
@ EML
Definition: MuonStationIndex.h:18
MuonHough::MuonDetectorHough::m_sectors
std::vector< MuonSectorHough * > m_sectors
Definition: MuonRegionHough.h:79
DeMoScan.index
string index
Definition: DeMoScan.py:362
Muon::MuonStationIndex::BIL
@ BIL
Definition: MuonStationIndex.h:17
MuonHough::MuonDetectorHough::init
void init()
Definition: MuonRegionHough.cxx:59
Muon::MuonStationIndex::EndcapC
@ EndcapC
Definition: MuonStationIndex.h:49
Muon::MuonStationIndex::BEE
@ BEE
Definition: MuonStationIndex.h:17
MuonHough::MuonDetectorHough::m_phiTransforms
std::vector< MuonPhiLayerHough * > m_phiTransforms
sector transforms
Definition: MuonRegionHough.h:80
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
MuonHough::MuonSectorHough
class managing all precision Hough transforms in a sector
Definition: MuonRegionHough.h:36
Muon::MuonStationIndex::EMS
@ EMS
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::EOL
@ EOL
Definition: MuonStationIndex.h:18
Muon::MuonStationIndex::BOL
@ BOL
Definition: MuonStationIndex.h:17
MuonHough::MuonSectorHough::m_transforms
std::vector< MuonLayerHough * > m_transforms
Definition: MuonRegionHough.h:51
MuonHough::MuonDetectorDescription::getDescriptor
RegionDescriptor getDescriptor(int sector, Muon::MuonStationIndex::DetectorRegionIndex region, Muon::MuonStationIndex::LayerIndex layer) const
Definition: MuonRegionHough.cxx:69
Muon::MuonStationIndex::EIL
@ EIL
Definition: MuonStationIndex.h:18