Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019 #include "Geometry/HcalEventSetup/interface/HcalTopologyIdealEP.h"
00020 #include "Geometry/CaloTopology/interface/HcalTopologyRestrictionParser.h"
00021 #include "FWCore/Utilities/interface/Exception.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 HcalTopologyIdealEP::HcalTopologyIdealEP(const edm::ParameterSet& conf)
00038 : m_restrictions(conf.getUntrackedParameter<std::string>("Exclude")),
00039 m_pSet( conf )
00040 {
00041
00042 edm::LogInfo("HCAL") << "HcalTopologyIdealEP::HcalTopologyIdealEP";
00043
00044
00045 m_segmentation.resize(29);
00046 std::vector<int> segmentation;
00047 for (int iring=1; iring<=29; ++iring) {
00048 char name[10];
00049 snprintf(name,10,"Eta%d",iring);
00050 if(conf.existsAs<std::vector<int> >(name, false)) {
00051 RingSegmentation entry;
00052 entry.ring = iring;
00053 entry.segmentation = conf.getUntrackedParameter<std::vector<int> >(name);
00054 m_segmentation.push_back(entry);
00055 }
00056 }
00057 setWhatProduced(this);
00058 }
00059
00060
00061 HcalTopologyIdealEP::~HcalTopologyIdealEP()
00062 {
00063 }
00064
00065 void
00066 HcalTopologyIdealEP::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
00067 {
00068 edm::ParameterSetDescription hcalTopologyConstants;
00069 hcalTopologyConstants.add<std::string>( "mode", "HcalTopologyMode::LHC" );
00070 hcalTopologyConstants.add<int>( "maxDepthHB", 2 );
00071 hcalTopologyConstants.add<int>( "maxDepthHE", 3 );
00072
00073 edm::ParameterSetDescription hcalSLHCTopologyConstants;
00074 hcalSLHCTopologyConstants.add<std::string>( "mode", "HcalTopologyMode::SLHC" );
00075 hcalSLHCTopologyConstants.add<int>( "maxDepthHB", 7 );
00076 hcalSLHCTopologyConstants.add<int>( "maxDepthHE", 7 );
00077
00078 edm::ParameterSetDescription desc;
00079 desc.addUntracked<std::string>( "Exclude", "" );
00080 desc.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalTopologyConstants );
00081 descriptions.add( "hcalTopologyIdeal", desc );
00082
00083 edm::ParameterSetDescription descSLHC;
00084 descSLHC.addUntracked<std::string>( "Exclude", "" );
00085 descSLHC.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalSLHCTopologyConstants );
00086 descriptions.add( "hcalTopologyIdealSLHC", descSLHC );
00087 }
00088
00089
00090
00091
00092
00093
00094 HcalTopologyIdealEP::ReturnType
00095 HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)
00096 {
00097
00098 edm::LogInfo("HCAL") << "HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)";
00099
00100 using namespace edm::es;
00101
00102 HcalTopologyMode::Mode mode = HcalTopologyMode::LHC;
00103 int maxDepthHB = 2;
00104 int maxDepthHE = 3;
00105 if( m_pSet.exists( "hcalTopologyConstants" ))
00106 {
00107 const edm::ParameterSet hcalTopoConsts( m_pSet.getParameter<edm::ParameterSet>( "hcalTopologyConstants" ));
00108 StringToEnumParser<HcalTopologyMode::Mode> eparser;
00109 mode = (HcalTopologyMode::Mode) eparser.parseString(hcalTopoConsts.getParameter<std::string>("mode"));
00110 maxDepthHB = hcalTopoConsts.getParameter<int>("maxDepthHB");
00111 maxDepthHE = hcalTopoConsts.getParameter<int>("maxDepthHE");
00112 }
00113
00114 edm::LogInfo("HCAL") << "mode = " << mode << ", maxDepthHB = " << maxDepthHB << ", maxDepthHE = " << maxDepthHE;
00115
00116 ReturnType myTopo(new HcalTopology( mode, maxDepthHB, maxDepthHE ));
00117
00118 HcalTopologyRestrictionParser parser(*myTopo);
00119 if (!m_restrictions.empty()) {
00120 std::string error=parser.parse(m_restrictions);
00121 if (!error.empty()) {
00122 throw cms::Exception("Parse Error","Parse error on Exclude "+error);
00123 }
00124 }
00125
00126
00127 for(std::vector<RingSegmentation>::const_iterator ringSegItr = m_segmentation.begin();
00128 ringSegItr != m_segmentation.end(); ++ringSegItr) {
00129 myTopo->setDepthSegmentation(ringSegItr->ring, ringSegItr->segmentation);
00130 }
00131 return myTopo ;
00132 }
00133
00134