CMS 3D CMS Logo

StubFEWindows.cc
Go to the documentation of this file.
5 
6 #include <algorithm>
7 #include <utility>
8 
9 using namespace std;
10 
11 namespace tmtt {
12 
13  //=== Initialize stub window sizes from TTStubProducer cfg.
14 
15  StubFEWindows::StubFEWindows(const edm::ParameterSet& pSetStubAlgo) {
16  numTiltedLayerRings_ = pSetStubAlgo.getParameter<vector<double>>("NTiltedRings");
17  windowSizeBarrelLayers_ = pSetStubAlgo.getParameter<vector<double>>("BarrelCut");
18  const auto& pSetTiltedLayer = pSetStubAlgo.getParameter<vector<edm::ParameterSet>>("TiltedBarrelCutSet");
19  const auto& pSetEncapDisks = pSetStubAlgo.getParameter<vector<edm::ParameterSet>>("EndcapCutSet");
20  windowSizeTiltedLayersRings_.reserve(pSetTiltedLayer.size());
21  for (const auto& pSet : pSetTiltedLayer) {
22  windowSizeTiltedLayersRings_.emplace_back(pSet.getParameter<vector<double>>("TiltedCut"));
23  }
24  windowSizeEndcapDisksRings_.reserve(pSetEncapDisks.size());
25  for (const auto& pSet : pSetEncapDisks) {
26  windowSizeEndcapDisksRings_.emplace_back(pSet.getParameter<vector<double>>("EndcapCut"));
27  }
28  }
29 
30  //=== Set all FE stub bend windows to zero.
31 
32  void StubFEWindows::setZero() {
33  std::fill(windowSizeBarrelLayers_.begin(), windowSizeBarrelLayers_.end(), 0.);
34  for (auto& x : windowSizeEndcapDisksRings_)
35  std::fill(x.begin(), x.end(), 0.);
36  for (auto& y : windowSizeTiltedLayersRings_)
37  std::fill(y.begin(), y.end(), 0.);
38  }
39 
40  //=== Const/non-const access to element of array giving window size for specific module.
41 
42  const double* StubFEWindows::storedWindowSize(const TrackerTopology* trackerTopo, const DetId& detId) const {
43  // Code accessing geometry inspired by L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc
44 
45  const double* storedHalfWindow = nullptr;
46  if (detId.subdetId() == StripSubdetector::TOB) {
47  unsigned int layer = trackerTopo->layer(detId);
48  unsigned int ladder = trackerTopo->tobRod(detId);
49  int type = 2 * trackerTopo->tobSide(detId) - 3; // -1 for tilted-, 1 for tilted+, 3 for flat
50  double corr = 0;
51 
52  if (type != TrackerModule::BarrelModuleType::flat) {
53  // Tilted barrel
54  corr = (numTiltedLayerRings_.at(layer) + 1) / 2.;
55  // Corrected ring number, between 0 and barrelNTilt.at(layer), in ascending |z|
56  ladder = corr - (corr - ladder) * type;
57  storedHalfWindow = &(windowSizeTiltedLayersRings_.at(layer).at(ladder));
58  } else {
59  // Flat barrel
60  storedHalfWindow = &(windowSizeBarrelLayers_.at(layer));
61  }
62 
63  } else if (detId.subdetId() == StripSubdetector::TID) {
64  // Endcap
65  unsigned int wheel = trackerTopo->tidWheel(detId);
66  unsigned int ring = trackerTopo->tidRing(detId);
67  storedHalfWindow = &(windowSizeEndcapDisksRings_.at(wheel).at(ring));
68  }
69  return storedHalfWindow;
70  }
71 
72  double* StubFEWindows::storedWindowSize(const TrackerTopology* trackerTopo, const DetId& detId) {
73  // Code accessing geometry inspired by L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc
74  // Non-const version of operator, without needing to duplicate code.
75  // (Scott Meyers trick).
76  return const_cast<double*>(std::as_const(*this).storedWindowSize(trackerTopo, detId));
77  }
78 } // namespace tmtt
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int tobSide(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int layer(const DetId &id) const
dictionary corr
static constexpr auto TOB
Definition: DetId.h:17
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
unsigned int tobRod(const DetId &id) const
float x
unsigned int tidRing(const DetId &id) const
static constexpr auto TID