Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalTopologyIdealEP
0004 // Class:      HcalTopologyIdealEP
0005 //
0006 /**\class HcalTopologyIdealEP HcalTopologyIdealEP.h tmp/HcalTopologyIdealEP/interface/HcalTopologyIdealEP.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/HcalTopologyIdealEP.h"
0020 #include "Geometry/CaloTopology/interface/HcalTopologyRestrictionParser.h"
0021 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0022 #include "FWCore/Utilities/interface/Exception.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0026 
0027 //#define DebugLog
0028 
0029 HcalTopologyIdealEP::HcalTopologyIdealEP(const edm::ParameterSet& conf)
0030     : m_hdcToken{setWhatProduced(this, &HcalTopologyIdealEP::produce).consumes<HcalDDDRecConstants>(edm::ESInputTag{})},
0031       m_restrictions(conf.getUntrackedParameter<std::string>("Exclude")),
0032       m_mergePosition(conf.getUntrackedParameter<bool>("MergePosition")) {
0033 #ifdef DebugLog
0034   std::cout << "HcalTopologyIdealEP::HcalTopologyIdealEP with Exclude: " << m_restrictions
0035             << " MergePosition: " << m_mergePosition << std::endl;
0036   edm::LogInfo("HCAL") << "HcalTopologyIdealEP::HcalTopologyIdealEP";
0037 #endif
0038 }
0039 
0040 void HcalTopologyIdealEP::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0041   edm::ParameterSetDescription desc;
0042   desc.addUntracked<std::string>("Exclude", "");
0043   desc.addUntracked<bool>("MergePosition", false);
0044   descriptions.add("hcalTopologyIdealBase", desc);
0045 }
0046 
0047 // ------------ method called to produce the data  ------------
0048 HcalTopologyIdealEP::ReturnType HcalTopologyIdealEP::produce(const HcalRecNumberingRecord& iRecord) {
0049 #ifdef DebugLog
0050   std::cout << "HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)" << std::endl;
0051   edm::LogInfo("HCAL") << "HcalTopologyIdealEP::produce(const HcalGeometryRecord& iRecord)";
0052 #endif
0053   const HcalDDDRecConstants& hdc = iRecord.get(m_hdcToken);
0054 
0055 #ifdef DebugLog
0056   std::cout << "mode = " << hdc.getTopoMode() << ", maxDepthHB = " << hdc.getMaxDepth(0)
0057             << ", maxDepthHE = " << hdc.getMaxDepth(1) << ", maxDepthHF = " << hdc.getMaxDepth(2) << std::endl;
0058   edm::LogInfo("HCAL") << "mode = " << hdc.getTopoMode() << ", maxDepthHB = " << hdc.getMaxDepth(0)
0059                        << ", maxDepthHE = " << hdc.getMaxDepth(1) << ", maxDepthHF = " << hdc.getMaxDepth(2);
0060 #endif
0061   ReturnType myTopo(new HcalTopology(&hdc, m_mergePosition));
0062 
0063   HcalTopologyRestrictionParser parser(*myTopo);
0064   if (!m_restrictions.empty()) {
0065     std::string error = parser.parse(m_restrictions);
0066     if (!error.empty()) {
0067       throw cms::Exception("Parse Error", "Parse error on Exclude " + error);
0068     }
0069   }
0070   return myTopo;
0071 }