CMS 3D CMS Logo

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 
19  const TrackerTopology& ttopo,
20  std::unique_ptr<mkfit::TrackerInfo> trackerInfo,
21  const mkfit::LayerNumberConverter& layNConv)
22  : ttopo_(&ttopo),
23  lnc_{std::make_unique<mkfit::LayerNumberConverter>(layNConv)},
24  trackerInfo_(std::move(trackerInfo)) {
25  if (lnc_->getEra() != mkfit::TkLayout::phase1 && lnc_->getEra() != mkfit::TkLayout::phase2)
26  throw cms::Exception("Assert") << "This code works only with phase1 and phase2 tracker, you have something else";
27 
28  // Create DetLayer structure
29  dets_.resize(lnc_->nLayers(), nullptr);
30  auto setDet = [this](const int subdet, const int layer, const int isStereo, const DetId& detId, const DetLayer* lay) {
31  const int index = lnc_->convertLayerNumber(subdet, layer, false, isStereo, isPlusSide(*ttopo_, detId));
32  if (index < 0 or static_cast<unsigned>(index) >= dets_.size()) {
33  throw cms::Exception("LogicError") << "Invalid mkFit layer index " << index << " for DetId " << detId.rawId()
34  << " subdet " << subdet << " layer " << layer << " isStereo " << isStereo;
35  }
36  dets_[index] = lay;
37  };
38  constexpr int monoLayer = 0;
39  constexpr int stereoLayer = 1;
40  for (const DetLayer* lay : tracker.allLayers()) {
41  const auto& comp = lay->basicComponents();
42  if (UNLIKELY(comp.empty())) {
43  throw cms::Exception("LogicError") << "Got a tracker layer (subdet " << lay->subDetector()
44  << ") with empty basicComponents.";
45  }
46  // First component is enough for layer and side information
47  const auto& detId = comp.front()->geographicalId();
48  const auto subdet = detId.subdetId();
49  const auto layer = ttopo.layer(detId);
50 
51  setDet(subdet, layer, monoLayer, detId, lay);
52  if (lnc_->doesHaveStereo(subdet, layer))
53  setDet(subdet, layer, stereoLayer, detId, lay);
54  }
55 }
56 
57 // Explicit out-of-line because of the mkfit::LayerNumberConverter is
58 // only forward declared in the header
60 
62  return lnc_->convertLayerNumber(
63  detId.subdetId(), ttopo_->layer(detId), false, ttopo_->isStereo(detId), isPlusSide(*ttopo_, detId));
64 }
std::unique_ptr< mkfit::LayerNumberConverter > lnc_
Definition: MkFitGeometry.h:43
bool isStereo(const DetId &id) const
unsigned int side(const DetId &id) const
unsigned int layer(const DetId &id) const
const TrackerTopology * ttopo_
Definition: MkFitGeometry.h:42
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Definition: DetId.h:17
int mkFitLayerNumber(DetId detId) const
MkFitGeometry(const TrackerGeometry &geom, const GeometricSearchTracker &tracker, const TrackerTopology &ttopo, std::unique_ptr< mkfit::TrackerInfo > trackerInfo, const mkfit::LayerNumberConverter &layNConv)
#define UNLIKELY(x)
Definition: Likely.h:21
def move(src, dest)
Definition: eostools.py:511