test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTopologyIdealEP.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTopologyIdealEP
4 // Class: HcalTopologyIdealEP
5 //
13 //
14 // Original Author: Jeremiah Mans
15 // Created: Mon Oct 3 11:35:27 CDT 2005
16 //
17 //
18 
25 
26 //
27 // constants, enums and typedefs
28 //
29 
30 //
31 // static data member definitions
32 //
33 
34 //
35 // constructors and destructor
36 //
38  : m_restrictions(conf.getUntrackedParameter<std::string>("Exclude")),
39  m_pSet( conf )
40 {
41  //std::cout << "HcalTopologyIdealEP::HcalTopologyIdealEP" << std::endl;
42  edm::LogInfo("HCAL") << "HcalTopologyIdealEP::HcalTopologyIdealEP";
43 
44  // copied from HcalHitRelabeller, input like {1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4}
45  m_segmentation.resize(29);
46  std::vector<int> segmentation;
47  for (int iring=1; iring<=29; ++iring) {
48  char name[10];
49  snprintf(name,10,"Eta%d",iring);
50  if(conf.existsAs<std::vector<int> >(name, false)) {
51  RingSegmentation entry;
52  entry.ring = iring;
53  entry.segmentation = conf.getUntrackedParameter<std::vector<int> >(name);
54  m_segmentation.push_back(entry);
55  }
56  }
57  setWhatProduced(this);
58 }
59 
60 
62 {
63 }
64 
65 void
67 {
69  hcalTopologyConstants.add<std::string>( "mode", "HcalTopologyMode::LHC" );
70  hcalTopologyConstants.add<int>( "maxDepthHB", 2 );
71  hcalTopologyConstants.add<int>( "maxDepthHE", 3 );
72 
73  edm::ParameterSetDescription hcalSLHCTopologyConstants;
74  hcalSLHCTopologyConstants.add<std::string>( "mode", "HcalTopologyMode::SLHC" );
75  hcalSLHCTopologyConstants.add<int>( "maxDepthHB", 7 );
76  hcalSLHCTopologyConstants.add<int>( "maxDepthHE", 7 );
77 
79  desc.addUntracked<std::string>( "Exclude", "" );
80  desc.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalTopologyConstants );
81  descriptions.add( "hcalTopologyIdeal", desc );
82 
84  descSLHC.addUntracked<std::string>( "Exclude", "" );
85  descSLHC.addOptional<edm::ParameterSetDescription>( "hcalTopologyConstants", hcalSLHCTopologyConstants );
86  descriptions.add( "hcalTopologyIdealSLHC", descSLHC );
87 }
88 
89 //
90 // member functions
91 //
92 
93 // ------------ method called to produce the data ------------
96 {
97  // std::cout << "HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)" << std::endl;
98  edm::LogInfo("HCAL") << "HcalTopologyIdealEP::produce(const IdealGeometryRecord& iRecord)";
99 
100  using namespace edm::es;
101 
103  int maxDepthHB = 2;
104  int maxDepthHE = 3;
105  if( m_pSet.exists( "hcalTopologyConstants" ))
106  {
107  const edm::ParameterSet hcalTopoConsts( m_pSet.getParameter<edm::ParameterSet>( "hcalTopologyConstants" ));
109  mode = (HcalTopologyMode::Mode) eparser.parseString(hcalTopoConsts.getParameter<std::string>("mode"));
110  maxDepthHB = hcalTopoConsts.getParameter<int>("maxDepthHB");
111  maxDepthHE = hcalTopoConsts.getParameter<int>("maxDepthHE");
112  }
113  // std::cout << "mode = " << mode << ", maxDepthHB = " << maxDepthHB << ", maxDepthHE = " << maxDepthHE << std::endl;
114  edm::LogInfo("HCAL") << "mode = " << mode << ", maxDepthHB = " << maxDepthHB << ", maxDepthHE = " << maxDepthHE;
115 
117 
119  if (!m_restrictions.empty()) {
121  if (!error.empty()) {
122  throw cms::Exception("Parse Error","Parse error on Exclude "+error);
123  }
124  }
125 
126  // see if any depth segmentation needs to be added
127  for(std::vector<RingSegmentation>::const_iterator ringSegItr = m_segmentation.begin();
128  ringSegItr != m_segmentation.end(); ++ringSegItr) {
129  myTopo->setDepthSegmentation(ringSegItr->ring, ringSegItr->segmentation);
130  }
131  return myTopo ;
132 }
133 
134 
T getParameter(std::string const &) const
const edm::ParameterSet m_pSet
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::string parse(const std::string &line)
int maxDepthHE() const
Definition: HcalTopology.h:119
bool exists(std::string const &parameterName) const
checks if a parameter exists
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
boost::shared_ptr< HcalTopology > ReturnType
HcalTopology(HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::tm_LHC_PreLS1)
Definition: HcalTopology.cc:13
HcalTopologyIdealEP(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
tuple conf
Definition: dbtoconf.py:185
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int maxDepthHB() const
Definition: HcalTopology.h:118
ReturnType produce(const IdealGeometryRecord &)
std::vector< RingSegmentation > m_segmentation
T parseString(const std::string &value)