Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:12

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalAlignmentEP
0004 // Class:      HcalAlignmentEP
0005 //
0006 //
0007 // Original Author:  Brian Heltsley
0008 //
0009 //
0010 
0011 #include "Geometry/HcalEventSetup/interface/HcalAlignmentEP.h"
0012 
0013 HcalAlignmentEP::HcalAlignmentEP(const edm::ParameterSet&) {
0014   auto cc = setWhatProduced(this, &HcalAlignmentEP::produceHcalAli);
0015   hbToken_ = cc.consumesFrom<Alignments, HBAlignmentRcd>(edm::ESInputTag{});
0016   heToken_ = cc.consumesFrom<Alignments, HEAlignmentRcd>(edm::ESInputTag{});
0017   hfToken_ = cc.consumesFrom<Alignments, HFAlignmentRcd>(edm::ESInputTag{});
0018   hoToken_ = cc.consumesFrom<Alignments, HOAlignmentRcd>(edm::ESInputTag{});
0019 }
0020 
0021 HcalAlignmentEP::~HcalAlignmentEP() {}
0022 
0023 HcalAlignmentEP::ReturnAli HcalAlignmentEP::produceHcalAli(const HcalAlignmentRcd& iRecord) {
0024   auto ali = std::make_unique<Alignments>();
0025 
0026   std::vector<AlignTransform>& vtr(ali->m_align);
0027   const unsigned int nA(HcalGeometry::numberOfAlignments());
0028   vtr.resize(nA);
0029 
0030   const auto& hb = iRecord.get(hbToken_);
0031   const auto& he = iRecord.get(heToken_);
0032   const auto& hf = iRecord.get(hfToken_);
0033   const auto& ho = iRecord.get(hoToken_);
0034 
0035   // require valid alignments and expected size
0036   assert(hb.m_align.size() == HcalGeometry::numberOfBarrelAlignments());
0037   assert(he.m_align.size() == HcalGeometry::numberOfEndcapAlignments());
0038   assert(hf.m_align.size() == HcalGeometry::numberOfForwardAlignments());
0039   assert(ho.m_align.size() == HcalGeometry::numberOfOuterAlignments());
0040   const std::vector<AlignTransform>& hbt = hb.m_align;
0041   const std::vector<AlignTransform>& het = he.m_align;
0042   const std::vector<AlignTransform>& hft = hf.m_align;
0043   const std::vector<AlignTransform>& hot = ho.m_align;
0044 
0045   copy(hbt.begin(), hbt.end(), vtr.begin());
0046   copy(het.begin(), het.end(), vtr.begin() + hbt.size());
0047   copy(hft.begin(), hft.end(), vtr.begin() + hbt.size() + het.size());
0048   copy(hot.begin(), hot.end(), vtr.begin() + hbt.size() + het.size() + hft.size());
0049 
0050   return ali;
0051 }