Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalHardcodeGeometryEP
0004 // Class:      HcalHardcodeGeometryEP
0005 //
0006 /**\class HcalHardcodeGeometryEP HcalHardcodeGeometryEP.h tmp/HcalHardcodeGeometryEP/interface/HcalHardcodeGeometryEP.h
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Jeremiah Mans
0015 //         Created:  Mon Oct  3 11:35:27 CDT 2005
0016 //
0017 //
0018 
0019 #include "Geometry/HcalEventSetup/interface/HcalHardcodeGeometryEP.h"
0020 
0021 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0022 #include "Geometry/Records/interface/HcalGeometryRecord.h"
0023 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0024 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0025 #include "Geometry/HcalTowerAlgo/interface/HcalFlexiHardcodeGeometryLoader.h"
0026 #include "Geometry/HcalTowerAlgo/interface/HcalHardcodeGeometryLoader.h"
0027 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0029 
0030 class HcalTopology;
0031 
0032 HcalHardcodeGeometryEP::HcalHardcodeGeometryEP(const edm::ParameterSet& ps) {
0033   useOld_ = ps.getParameter<bool>("UseOldLoader");
0034   //the following line is needed to tell the framework what
0035   // data is being produced
0036   auto cc = setWhatProduced(this, &HcalHardcodeGeometryEP::produceAligned, edm::es::Label(HcalGeometry::producerTag()));
0037   if (not useOld_) {
0038     consToken_ = cc.consumesFrom<HcalDDDRecConstants, HcalRecNumberingRecord>(edm::ESInputTag{});
0039   }
0040   topologyToken_ = cc.consumesFrom<HcalTopology, HcalRecNumberingRecord>(edm::ESInputTag{});
0041 }
0042 
0043 HcalHardcodeGeometryEP::ReturnType HcalHardcodeGeometryEP::produceAligned(const HcalGeometryRecord& iRecord) {
0044   edm::LogInfo("HCAL") << "Using default HCAL topology";
0045   const auto& topology = iRecord.get(topologyToken_);
0046   if (useOld_) {
0047     HcalHardcodeGeometryLoader loader;
0048     return ReturnType(loader.load(topology));
0049   } else {
0050     const auto& cons = iRecord.get(consToken_);
0051     HcalFlexiHardcodeGeometryLoader loader;
0052     return ReturnType(loader.load(topology, cons));
0053   }
0054 }