CMS 3D CMS Logo

HcalAlignmentEP.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalAlignmentEP
4 // Class: HcalAlignmentEP
5 //
6 //
7 // Original Author: Brian Heltsley
8 //
9 //
10 
12 
15  hbToken_ = cc.consumesFrom<Alignments, HBAlignmentRcd>(edm::ESInputTag{});
16  heToken_ = cc.consumesFrom<Alignments, HEAlignmentRcd>(edm::ESInputTag{});
17  hfToken_ = cc.consumesFrom<Alignments, HFAlignmentRcd>(edm::ESInputTag{});
18  hoToken_ = cc.consumesFrom<Alignments, HOAlignmentRcd>(edm::ESInputTag{});
19 }
20 
22 
24  auto ali = std::make_unique<Alignments>();
25 
26  std::vector<AlignTransform>& vtr(ali->m_align);
27  const unsigned int nA(HcalGeometry::numberOfAlignments());
28  vtr.resize(nA);
29 
30  const auto& hb = iRecord.get(hbToken_);
31  const auto& he = iRecord.get(heToken_);
32  const auto& hf = iRecord.get(hfToken_);
33  const auto& ho = iRecord.get(hoToken_);
34 
35  // require valid alignments and expected size
36  assert(hb.m_align.size() == HcalGeometry::numberOfBarrelAlignments());
37  assert(he.m_align.size() == HcalGeometry::numberOfEndcapAlignments());
38  assert(hf.m_align.size() == HcalGeometry::numberOfForwardAlignments());
39  assert(ho.m_align.size() == HcalGeometry::numberOfOuterAlignments());
40  const std::vector<AlignTransform>& hbt = hb.m_align;
41  const std::vector<AlignTransform>& het = he.m_align;
42  const std::vector<AlignTransform>& hft = hf.m_align;
43  const std::vector<AlignTransform>& hot = ho.m_align;
44 
45  copy(hbt.begin(), hbt.end(), vtr.begin());
46  copy(het.begin(), het.end(), vtr.begin() + hbt.size());
47  copy(hft.begin(), hft.end(), vtr.begin() + hbt.size() + het.size());
48  copy(hot.begin(), hot.end(), vtr.begin() + hbt.size() + het.size() + hft.size());
49 
50  return ali;
51 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:65
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ReturnAli produceHcalAli(const HcalAlignmentRcd &iRecord)
edm::ESGetToken< Alignments, HEAlignmentRcd > heToken_
edm::ESGetToken< Alignments, HFAlignmentRcd > hfToken_
#define hbt
Definition: AMPTWrapper.h:60
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< Alignments > ReturnAli
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:71
~HcalAlignmentEP() override
edm::ESGetToken< Alignments, HOAlignmentRcd > hoToken_
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:67
HcalAlignmentEP(const edm::ParameterSet &)
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:69
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:75
edm::ESGetToken< Alignments, HBAlignmentRcd > hbToken_