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, Exception, align_tpl::filter, DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), runTheMatrix::msg, DDSpecificsFilter::not_equals, DDSpecificsFilter::setCriteria(), and relativeConstraints::value.

                                                             {
  //  std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
  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());
  //std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
  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]) );
      //        std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
    }
    //    std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl;
  }
  
}
MuonDDDConstants::~MuonDDDConstants ( )

Definition at line 55 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 59 of file MuonDDDConstants.cc.

References gather_cfg::cout, Exception, and namesAndValues_.

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

                                                            {
  //  std::cout << "about to look for ... " << name << std::endl;

  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().