CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonDDDConstants Class Reference

#include <MuonDDDConstants.h>

Public Member Functions

void addValue (const std::string &name, const int &value)
 
int getValue (const std::string &name) const
 
 MuonDDDConstants (const DDCompactView &cpv)
 
 ~MuonDDDConstants ()
 

Private Member Functions

 MuonDDDConstants ()
 

Private Attributes

std::map< std::string, int > namesAndValues_
 

Detailed Description

this class reads the constant section of the muon-numbering xml-file

Date:
2007/12/04 00:06:50
Revision:
1.4
Author
Arno Straessner, CERN arno..nosp@m.stra.nosp@m.essne.nosp@m.r@ce.nosp@m.rn.ch modified by: Michael Case, micha.nosp@m.el.c.nosp@m.ase@c.nosp@m.ern..nosp@m.ch, 2006/10/05

Definition at line 23 of file MuonDDDConstants.h.

Constructor & Destructor Documentation

MuonDDDConstants::MuonDDDConstants ( const DDCompactView cpv)

Definition at line 13 of file MuonDDDConstants.cc.

References DDFilteredView::addFilter(), addValue(), DDSpecificsFilter::AND, edm::hlt::Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), lumiQueryAPI::msg, DDSpecificsFilter::not_equals, DDSpecificsFilter::setCriteria(), and relativeConstraints::value.

13  {
14  // std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
15  std::string attribute = "OnlyForMuonNumbering";
16  std::string value = "any";
17  DDValue val(attribute, value, 0.0);
18 
20  filter.setCriteria(val,
23  true, // compare strings otherwise doubles
24  true // use merged-specifics or simple-specifics
25  );
26  DDFilteredView fview(cpv);
27  fview.addFilter(filter);
28 
29  DDValue val2("level");
30  const DDsvalues_type params(fview.mergedSpecifics());
31 
32  fview.firstChild();
33 
34  const DDsvalues_type mySpecs (fview.mergedSpecifics());
35  //std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
36  if ( mySpecs.size() < 25 ) {
37  edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl;
38  std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated";
39  msg+= " with the part //MUON.";
40  throw cms::Exception("GeometryBuildFailure", msg);
41  }
42 
43  DDsvalues_type::const_iterator bit = mySpecs.begin();
44  DDsvalues_type::const_iterator eit = mySpecs.end();
45  for ( ; bit != eit; ++bit ) {
46  if ( bit->second.isEvaluated() ) {
47  this->addValue( bit->second.name(), int(bit->second.doubles()[0]) );
48  // std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
49  }
50  // std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl;
51  }
52 
53 }
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
void addValue(const std::string &name, const int &value)
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
MuonDDDConstants::~MuonDDDConstants ( )

Definition at line 55 of file MuonDDDConstants.cc.

55  {
56  // std::cout << "destructed!!!" << std::endl;
57 }
MuonDDDConstants::MuonDDDConstants ( )
private

Member Function Documentation

void MuonDDDConstants::addValue ( const std::string &  name,
const int &  value 
)
int MuonDDDConstants::getValue ( const std::string &  name) const

Definition at line 59 of file MuonDDDConstants.cc.

References gather_cfg::cout, edm::hlt::Exception, and namesAndValues_.

Referenced by CSCNumberingScheme::initMe(), RPCNumberingScheme::initMe(), DTNumberingScheme::initMe(), MuonDDDNumbering::MuonDDDNumbering(), MuonG4Numbering::MuonG4Numbering(), and MuonRpcFrameRotation::MuonRpcFrameRotation().

59  {
60  // std::cout << "about to look for ... " << name << std::endl;
61 
62  if ( namesAndValues_.size() == 0 ) {
63  std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl;
64  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
65  }
66 
67  std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name);
68 
69  if ( findIt == namesAndValues_.end() ) {
70  std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl;
71  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
72  }
73 
74  return findIt->second;
75 }
std::map< std::string, int > namesAndValues_
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::map<std::string, int> MuonDDDConstants::namesAndValues_
private

Definition at line 34 of file MuonDDDConstants.h.

Referenced by addValue(), and getValue().