CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/Geometry/HcalEventSetup/src/HcalAlignmentEP.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    HcalAlignmentEP
00004 // Class:      HcalAlignmentEP
00005 // 
00006 //
00007 // Original Author:  Brian Heltsley
00008 //
00009 //
00010 
00011 #include "Geometry/HcalEventSetup/interface/HcalAlignmentEP.h"
00012 
00013 HcalAlignmentEP::HcalAlignmentEP(const edm::ParameterSet&) {
00014   setWhatProduced( this, &HcalAlignmentEP::produceHcalAli    ) ;
00015 }
00016 
00017 HcalAlignmentEP::~HcalAlignmentEP() {}
00018  
00019 HcalAlignmentEP::ReturnAli HcalAlignmentEP::produceHcalAli( const HcalAlignmentRcd& iRecord ) {
00020 
00021   HcalAlignmentEP::ReturnAli ali ( new Alignments ) ;
00022   std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00023   const unsigned int nA ( HcalGeometry::numberOfAlignments() ) ; 
00024   vtr.resize( nA ) ;
00025 
00026   edm::ESHandle<Alignments> hb ;
00027   edm::ESHandle<Alignments> he ;
00028   edm::ESHandle<Alignments> hf ;
00029   edm::ESHandle<Alignments> ho ;
00030   iRecord.getRecord<HBAlignmentRcd>().get( hb ) ;
00031   iRecord.getRecord<HEAlignmentRcd>().get( he ) ;
00032   iRecord.getRecord<HFAlignmentRcd>().get( hf ) ;
00033   iRecord.getRecord<HOAlignmentRcd>().get( ho ) ;
00034 
00035   assert( hb.isValid() && // require valid alignments and expected size
00036           ( hb->m_align.size() == HcalGeometry::numberOfBarrelAlignments() ) ) ;
00037   assert( he.isValid() && // require valid alignments and expected size
00038           ( he->m_align.size() == HcalGeometry::numberOfEndcapAlignments() ) ) ;
00039   assert( hf.isValid() && // require valid alignments and expected size
00040           ( hf->m_align.size() == HcalGeometry::numberOfForwardAlignments() ) ) ;
00041   assert( ho.isValid() && // require valid alignments and expected size
00042           ( ho->m_align.size() == HcalGeometry::numberOfOuterAlignments() ) ) ;
00043   const std::vector<AlignTransform>& hbt = hb->m_align ;
00044   const std::vector<AlignTransform>& het = he->m_align ;
00045   const std::vector<AlignTransform>& hft = hf->m_align ;
00046   const std::vector<AlignTransform>& hot = ho->m_align ;
00047 
00048   copy( hbt.begin(), hbt.end(), vtr.begin() ) ;
00049   copy( het.begin(), het.end(), vtr.begin()+hbt.size() ) ;
00050   copy( hft.begin(), hft.end(), vtr.begin()+hbt.size()+het.size() ) ;
00051   copy( hot.begin(), hot.end(), vtr.begin()+hbt.size()+het.size()+hft.size() ) ;
00052   
00053   return ali ;
00054 }