CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MkFitGeometry.cc
Go to the documentation of this file.
7 
10 
11 namespace {
12  bool isPlusSide(const TrackerTopology& ttopo, DetId detid) {
13  return ttopo.side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap);
14  }
15 } // namespace
16 
18  const GeometricSearchTracker& tracker,
19  const TrackerTopology& ttopo,
20  std::unique_ptr<mkfit::TrackerInfo> trackerInfo)
21  : ttopo_(&ttopo),
22  lnc_{std::make_unique<mkfit::LayerNumberConverter>(mkfit::TkLayout::phase1)},
23  trackerInfo_(std::move(trackerInfo)) {
26  throw cms::Exception("Assert") << "For now this code works only with phase1 tracker, you have something else";
27  }
28 
29  // Create DetLayer structure
30  dets_.resize(lnc_->nLayers(), nullptr);
31  auto setDet = [this](const int subdet, const int layer, const int isStereo, const DetId& detId, const DetLayer* lay) {
32  const int index = lnc_->convertLayerNumber(subdet, layer, false, isStereo, isPlusSide(*ttopo_, detId));
33  if (index < 0 or static_cast<unsigned>(index) >= dets_.size()) {
34  throw cms::Exception("LogicError") << "Invalid mkFit layer index " << index << " for DetId " << detId.rawId()
35  << " subdet " << subdet << " layer " << layer << " isStereo " << isStereo;
36  }
37  dets_[index] = lay;
38  };
39  constexpr int monoLayer = 0;
40  constexpr int stereoLayer = 1;
41  for (const DetLayer* lay : tracker.allLayers()) {
42  const auto& comp = lay->basicComponents();
43  if (UNLIKELY(comp.empty())) {
44  throw cms::Exception("LogicError") << "Got a tracker layer (subdet " << lay->subDetector()
45  << ") with empty basicComponents.";
46  }
47  // First component is enough for layer and side information
48  const auto& detId = comp.front()->geographicalId();
49  const auto subdet = detId.subdetId();
50  const auto layer = ttopo.layer(detId);
51 
52  // TODO: mono/stereo structure is still hardcoded for phase0/1 strip tracker
53  setDet(subdet, layer, monoLayer, detId, lay);
54  if (((subdet == StripSubdetector::TIB or subdet == StripSubdetector::TOB) and (layer == 1 or layer == 2)) or
55  subdet == StripSubdetector::TID or subdet == StripSubdetector::TEC) {
56  setDet(subdet, layer, stereoLayer, detId, lay);
57  }
58  }
59 
60  // Create "short id" aka "unique id within layer"
61  detIdToShortId_.resize(lnc_->nLayers());
62  for (const auto& detId : geom.detIds()) {
63  const auto ilay = mkFitLayerNumber(detId);
64  auto& map = detIdToShortId_[ilay];
65  const unsigned int ind = map.size();
66  // Make sure the short id fits in the 12 bits...
67  assert(ind < (int)1 << 11);
68  map[detId.rawId()] = ind;
69  }
70 }
71 
72 // Explicit out-of-line because of the mkfit::LayerNumberConverter is
73 // only forward declared in the header
75 
77  return lnc_->convertLayerNumber(
78  detId.subdetId(), ttopo_->layer(detId), false, ttopo_->isStereo(detId), isPlusSide(*ttopo_, detId));
79 }
static constexpr auto TEC
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< DetLayer const * > const & allLayers() const
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
unsigned int side(const DetId &id) const
std::unique_ptr< mkfit::LayerNumberConverter > lnc_
Definition: MkFitGeometry.h:40
bool isStereo(const DetId &id) const
assert(be >=bs)
unsigned int numberOfLayers(int subdet) const
constexpr std::array< uint8_t, layerIndexSize > layer
const TrackerTopology * ttopo_
Definition: MkFitGeometry.h:39
def move
Definition: eostools.py:511
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: DetId.h:17
static constexpr auto TIB
int mkFitLayerNumber(DetId detId) const
std::unique_ptr< mkfit::TrackerInfo > trackerInfo_
Definition: MkFitGeometry.h:41
unsigned int layer(const DetId &id) const
MkFitGeometry(const TrackerGeometry &geom, const GeometricSearchTracker &tracker, const TrackerTopology &ttopo, std::unique_ptr< mkfit::TrackerInfo > trackerInfo)
#define UNLIKELY(x)
Definition: Likely.h:21
std::vector< std::unordered_map< unsigned int, unsigned int > > detIdToShortId_
Definition: MkFitGeometry.h:43
std::vector< const DetLayer * > dets_
Definition: MkFitGeometry.h:42
static constexpr auto TID