CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonDDDConstants Class Reference

#include <MuonDDDConstants.h>

List of all members.

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.straessner@cern.ch> modified by: Michael Case, <michael.case@cern.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, gather_cfg::cout, Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), lumiQueryAPI::msg, DDSpecificsFilter::not_equals, DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

                                                             {
#ifdef LOCAL_DEBUG
  std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
#endif
  std::string attribute = "OnlyForMuonNumbering"; 
  std::string value     = "any";
  DDValue val(attribute, value, 0.0);
  
  DDSpecificsFilter filter;
  filter.setCriteria(val,
                     DDSpecificsFilter::not_equals,
                     DDSpecificsFilter::AND, 
                     true, // compare strings otherwise doubles
                     true  // use merged-specifics or simple-specifics
                     );
  DDFilteredView fview(cpv);
  fview.addFilter(filter);
  
  DDValue val2("level");
  const DDsvalues_type params(fview.mergedSpecifics());
  
  fview.firstChild();
  
  const DDsvalues_type mySpecs (fview.mergedSpecifics());
#ifdef LOCAL_DEBUG
  std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
#endif
  if ( mySpecs.size() < 25 ) {
    edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl;
    std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated";
    msg+= " with the part //MUON.";
    throw cms::Exception("GeometryBuildFailure", msg);
  }

  DDsvalues_type::const_iterator bit = mySpecs.begin();
  DDsvalues_type::const_iterator eit = mySpecs.end();
  for ( ; bit != eit; ++bit ) {
    if ( bit->second.isEvaluated() ) {
      this->addValue( bit->second.name(), int(bit->second.doubles()[0]) );
#ifdef LOCAL_DEBUG
      std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
#endif
    }
    //    std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl;
  }
  
}
MuonDDDConstants::~MuonDDDConstants ( )

Definition at line 61 of file MuonDDDConstants.cc.

                                    { 
  //  std::cout << "destructed!!!" << std::endl;
}
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 65 of file MuonDDDConstants.cc.

References gather_cfg::cout, Exception, and namesAndValues_.

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

                                                            {
#ifdef LOCAL_DEBUG
  std::cout << "about to look for ... " << name << std::endl;
#endif
  if ( namesAndValues_.size() == 0 ) {
    std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl;
    throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
  }

  std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name);

  if ( findIt == namesAndValues_.end() ) {
    std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl;
    throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
  }

  return findIt->second;
}

Member Data Documentation

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

Definition at line 34 of file MuonDDDConstants.h.

Referenced by addValue(), and getValue().