CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonDDDNumbering Class Reference

#include <MuonDDDNumbering.h>

List of all members.

Public Member Functions

MuonBaseNumber geoHistoryToBaseNumber (const DDGeoHistory &history)
 MuonDDDNumbering (const MuonDDDConstants &muonConstants)
 ~MuonDDDNumbering ()

Private Member Functions

int getInt (const std::string &s, const DDLogicalPart &part)

Private Attributes

int theBasePart
int theLevelPart
int theStartCopyNo
int theSuperPart

Detailed Description

class to handle the conversion to MuonBaseNumber from tree of DDD GeoHistory;

in the xml muon constant section one has to define level, super and base constants (eg. 1000,100,1) and the start value of the copy numbers (0 or 1)

Date:
2006/10/12 19:54:05
Revision:
1.2
Author:
Arno Straessner, CERN <arno.straessner@cern.ch>

Definition at line 25 of file MuonDDDNumbering.h.


Constructor & Destructor Documentation

MuonDDDNumbering::MuonDDDNumbering ( const MuonDDDConstants muonConstants)

Definition at line 9 of file MuonDDDNumbering.cc.

References gather_cfg::cout, MuonDDDConstants::getValue(), theBasePart, theLevelPart, theStartCopyNo, and theSuperPart.

                                                                         {
  //  MuonDDDConstants muonConstants;
  theLevelPart=muonConstants.getValue("level");
  theSuperPart=muonConstants.getValue("super");
  theBasePart=muonConstants.getValue("base");
  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");

  // some consistency checks

  if (theBasePart!=1) {
    std::cout << "MuonDDDNumbering finds unusual base constant:"
         <<theBasePart<<std::endl;
  }
  if (theSuperPart<100) {
    std::cout << "MuonDDDNumbering finds unusual super constant:"
         <<theSuperPart<<std::endl;
  }
  if (theLevelPart<10*theSuperPart) {
    std::cout << "MuonDDDNumbering finds unusual level constant:"
         <<theLevelPart<<std::endl;
  }
  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
    std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
         <<theStartCopyNo<<std::endl;
  }

#ifdef LOCAL_DEBUG
  std::cout << "MuonDDDNumbering configured with"<<std::endl;
  std::cout << "Level = "<<theLevelPart<<" ";
  std::cout << "Super = "<<theSuperPart<<" ";
  std::cout << "Base = "<<theBasePart<<" ";
  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
#endif

}
MuonDDDNumbering::~MuonDDDNumbering ( ) [inline]

Definition at line 29 of file MuonDDDNumbering.h.

{};

Member Function Documentation

MuonBaseNumber MuonDDDNumbering::geoHistoryToBaseNumber ( const DDGeoHistory history)

Definition at line 45 of file MuonDDDNumbering.cc.

References MuonBaseNumber::addBase(), gather_cfg::cout, end, MuonBaseNumber::getBaseNo(), getInt(), MuonBaseNumber::getLevels(), MuonBaseNumber::getSuperNo(), i, evf::evtn::offset(), GlobalPosition_Frontier_DevDB_cff::tag, theLevelPart, theStartCopyNo, and theSuperPart.

Referenced by CSCGeometryParsFromDD::build(), DTGeometryBuilderFromDDD::buildChamber(), RPCGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), MuonRPCDetLayerGeometryBuilder::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), DTGeometryBuilderFromDDD::buildSuperLayer(), DTGeometryParsFromDD::insertChamber(), DTGeometryParsFromDD::insertLayer(), and DTGeometryParsFromDD::insertSuperLayer().

                                                                                   {
  MuonBaseNumber num;

#ifdef LOCAL_DEBUG
  std::cout << "MuonDDDNumbering create MuonBaseNumber for"<<std::endl;
  std::cout << history <<std::endl;
#endif

  //loop over all parents and check
  DDGeoHistory::const_iterator cur=history.begin();
  DDGeoHistory::const_iterator end=history.end();
  while (cur!=end) {
    const DDLogicalPart & ddlp = cur->logicalPart();
    const int tag=getInt("CopyNoTag",ddlp)/theLevelPart;
    if (tag>0) {
      const int offset=getInt("CopyNoOffset",ddlp);
      const int copyno=(cur->copyno())+offset%theSuperPart;
      const int super=offset/theSuperPart;
      num.addBase(tag,super,copyno-theStartCopyNo);
    }
    cur++;
  }

#ifdef LOCAL_DEBUG
  std::cout << num.getLevels() <<std::endl;
  for (int i=1;i<=num.getLevels();i++) {
    std::cout << num.getSuperNo(i)<<" "<<num.getBaseNo(i)<<std::endl;
  }
#endif
 
  return num;
}
int MuonDDDNumbering::getInt ( const std::string &  s,
const DDLogicalPart part 
) [private]

Definition at line 78 of file MuonDDDNumbering.cc.

References gather_cfg::cout, DDfetch(), DDValue::doubles(), DDBase< N, C >::name(), query::result, DDLogicalPart::specifics(), and cond::rpcobtemp::temp.

Referenced by geoHistoryToBaseNumber().

{
    DDValue val(s);
    std::vector<const DDsvalues_type *> result = part.specifics();
    std::vector<const DDsvalues_type *>::iterator it = result.begin();
    bool foundIt = false;
    for (; it != result.end(); ++it)
    {
        foundIt = DDfetch(*it,val);
        if (foundIt) break;
    }    
    if (foundIt)
    { 
      std::vector<double> temp = val.doubles();
      if (temp.size() != 1)
      {
        std::cout << " ERROR: I need only 1 " << s << " in DDLogicalPart " << part.name() << std::endl;
         abort();
      }      
      return int(temp[0]);
    }
    else return 0;
}

Member Data Documentation

Definition at line 39 of file MuonDDDNumbering.h.

Referenced by MuonDDDNumbering().

Definition at line 37 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().

Definition at line 40 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().

Definition at line 38 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().