CMS 3D CMS Logo

MkFitGeometry.cc
Go to the documentation of this file.
7 
8 #include "LayerNumberConverter.h"
9 #include "TrackerInfo.h"
10 #include "mkFit/IterationConfig.h"
11 
12 namespace {
13  bool isPlusSide(const TrackerTopology& ttopo, DetId detid) {
14  return ttopo.side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap);
15  }
16 } // namespace
17 
20  const TrackerTopology& ttopo,
21  std::unique_ptr<mkfit::TrackerInfo> trackerInfo,
22  std::unique_ptr<mkfit::IterationsInfo> iterationsInfo)
23  : ttopo_(&ttopo),
24  lnc_{std::make_unique<mkfit::LayerNumberConverter>(mkfit::TkLayout::phase1)},
25  trackerInfo_(std::move(trackerInfo)),
26  iterationsInfo_(std::move(iterationsInfo)) {
27  if (geom.numberOfLayers(PixelSubdetector::PixelBarrel) != 4 ||
28  geom.numberOfLayers(PixelSubdetector::PixelEndcap) != 3) {
29  throw cms::Exception("Assert") << "For now this code works only with phase1 tracker, you have something else";
30  }
31 
32  // Create DetLayer structure
33  dets_.resize(lnc_->nLayers(), nullptr);
34  auto setDet = [this](const int subdet, const int layer, const int isStereo, const DetId& detId, const DetLayer* lay) {
35  const int index = lnc_->convertLayerNumber(subdet, layer, false, isStereo, isPlusSide(*ttopo_, detId));
36  if (index < 0 or static_cast<unsigned>(index) >= dets_.size()) {
37  throw cms::Exception("LogicError") << "Invalid mkFit layer index " << index << " for DetId " << detId.rawId()
38  << " subdet " << subdet << " layer " << layer << " isStereo " << isStereo;
39  }
40  dets_[index] = lay;
41  };
42  constexpr int monoLayer = 0;
43  constexpr int stereoLayer = 1;
44  for (const DetLayer* lay : tracker.allLayers()) {
45  const auto& comp = lay->basicComponents();
46  if (UNLIKELY(comp.empty())) {
47  throw cms::Exception("LogicError") << "Got a tracker layer (subdet " << lay->subDetector()
48  << ") with empty basicComponents.";
49  }
50  // First component is enough for layer and side information
51  const auto& detId = comp.front()->geographicalId();
52  const auto subdet = detId.subdetId();
53  const auto layer = ttopo.layer(detId);
54 
55  // TODO: mono/stereo structure is still hardcoded for phase0/1 strip tracker
56  setDet(subdet, layer, monoLayer, detId, lay);
57  if (((subdet == StripSubdetector::TIB or subdet == StripSubdetector::TOB) and (layer == 1 or layer == 2)) or
58  subdet == StripSubdetector::TID or subdet == StripSubdetector::TEC) {
59  setDet(subdet, layer, stereoLayer, detId, lay);
60  }
61  }
62 
63  // Create "short id" aka "unique id within layer"
64  detIdToShortId_.resize(lnc_->nLayers());
65  for (const auto& detId : geom.detIds()) {
66  const auto ilay = mkFitLayerNumber(detId);
67  auto& map = detIdToShortId_[ilay];
68  const unsigned int ind = map.size();
69  // Make sure the short id fits in the 12 bits...
70  assert(ind < (int)1 << 11);
71  map[detId.rawId()] = ind;
72  }
73 }
74 
75 // Explicit out-of-line because of the mkfit::LayerNumberConverter is
76 // only forward declared in the header
78 
80  return lnc_->convertLayerNumber(
81  detId.subdetId(), ttopo_->layer(detId), false, ttopo_->isStereo(detId), isPlusSide(*ttopo_, detId));
82 }
TrackerTopology::side
unsigned int side(const DetId &id) const
Definition: TrackerTopology.cc:28
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
MkFitGeometry::mkFitLayerNumber
int mkFitLayerNumber(DetId detId) const
Definition: MkFitGeometry.cc:79
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
TrackerGeometry.h
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
DetLayer
Definition: DetLayer.h:21
TrackerTopology
Definition: TrackerTopology.h:16
cms::cuda::assert
assert(be >=bs)
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
PVValHelper::phase1
Definition: PVValidationHelpers.h:80
DetId
Definition: DetId.h:17
GeometricSearchTracker.h
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
TrackerTopology.h
MkFitGeometry::~MkFitGeometry
~MkFitGeometry()
Definition: MkFitGeometry.cc:77
TrackerTopology::isStereo
bool isStereo(const DetId &id) const
Definition: TrackerTopology.cc:158
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
MkFitGeometry::MkFitGeometry
MkFitGeometry(const TrackerGeometry &geom, const GeometricSearchTracker &tracker, const TrackerTopology &ttopo, std::unique_ptr< mkfit::TrackerInfo > trackerInfo, std::unique_ptr< mkfit::IterationsInfo > iterationsInfo)
Definition: MkFitGeometry.cc:18
TrackerDetSide.h
MkFitGeometry::ttopo_
const TrackerTopology * ttopo_
Definition: MkFitGeometry.h:42
TrackerDetSide::PosEndcap
eostools.move
def move(src, dest)
Definition: eostools.py:511
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
MkFitGeometry::lnc_
std::unique_ptr< mkfit::LayerNumberConverter > lnc_
Definition: MkFitGeometry.h:43
Exception
Definition: hltDiff.cc:245
GeometricSearchTracker
Definition: GeometricSearchTracker.h:15
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
or
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
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
genParticles_cff.map
map
Definition: genParticles_cff.py:11
StripSubdetector.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
MkFitGeometry.h
TrackerGeometry
Definition: TrackerGeometry.h:14