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 descriptions.add( "hcalTopologyConstants", hcalTopologyConstants );
00073
00074 edm::ParameterSetDescription hcalSLHCTopologyConstants;
00075 hcalSLHCTopologyConstants.add<std::string>( "mode", "HcalTopologyMode::SLHC" );
00076 hcalSLHCTopologyConstants.add<int>( "maxDepthHB", 7 );
00077 hcalSLHCTopologyConstants.add<int>( "maxDepthHE", 7 );
00078 descriptions.add( "hcalSLHCTopologyConstants", hcalSLHCTopologyConstants );
00079
00080 edm::ParameterSetDescription desc;
00081 desc.addUntracked<std::string>( "Exclude", "" );
00082 desc.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalTopologyConstants );
00083 descriptions.add( "hcalTopologyIdeal", desc );
00084
00085 edm::ParameterSetDescription descSLHC;
00086 descSLHC.addUntracked<std::string>( "Exclude", "" );
00087 descSLHC.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalSLHCTopologyConstants );
00088 descriptions.add( "hcalTopologyIdealSLHC", descSLHC );
00089 }
00090
00091
00092
00093
00094
00095
00096 HcalTopologyIdealEP::ReturnType
00097 HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)
00098 {
00099
00100 edm::LogInfo("HCAL") << "HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)";
00101
00102 using namespace edm::es;
00103
00104 HcalTopologyMode::Mode mode = HcalTopologyMode::LHC;
00105 int maxDepthHB = 2;
00106 int maxDepthHE = 3;
00107 if( m_pSet.exists( "hcalTopologyConstants" ))
00108 {
00109 const edm::ParameterSet hcalTopoConsts( m_pSet.getParameter<edm::ParameterSet>( "hcalTopologyConstants" ));
00110 StringToEnumParser<HcalTopologyMode::Mode> eparser;
00111 mode = (HcalTopologyMode::Mode) eparser.parseString(hcalTopoConsts.getParameter<std::string>("mode"));
00112 maxDepthHB = hcalTopoConsts.getParameter<int>("maxDepthHB");
00113 maxDepthHE = hcalTopoConsts.getParameter<int>("maxDepthHE");
00114 }
00115
00116 edm::LogInfo("HCAL") << "mode = " << mode << ", maxDepthHB = " << maxDepthHB << ", maxDepthHE = " << maxDepthHE;
00117
00118 ReturnType myTopo(new HcalTopology( mode, maxDepthHB, maxDepthHE ));
00119
00120 HcalTopologyRestrictionParser parser(*myTopo);
00121 if (!m_restrictions.empty()) {
00122 std::string error=parser.parse(m_restrictions);
00123 if (!error.empty()) {
00124 throw cms::Exception("Parse Error","Parse error on Exclude "+error);
00125 }
00126 }
00127
00128
00129 for(std::vector<RingSegmentation>::const_iterator ringSegItr = m_segmentation.begin();
00130 ringSegItr != m_segmentation.end(); ++ringSegItr) {
00131 myTopo->setDepthSegmentation(ringSegItr->ring, ringSegItr->segmentation);
00132 }
00133 return myTopo ;
00134 }
00135
00136