CMS 3D CMS Logo

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

#include <MuonGeometryNumbering.h>

Public Member Functions

MuonBaseNumber geoHistoryToBaseNumber (const DDGeoHistory &history) const
 
MuonBaseNumber geoHistoryToBaseNumber (const cms::ExpandedNodes &) const
 
 MuonGeometryNumbering (const MuonGeometryConstants &muonConstants)
 
 ~MuonGeometryNumbering ()
 

Private Member Functions

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

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)

Author
Arno Straessner, CERN arno..nosp@m.stra.nosp@m.essne.nosp@m.r@ce.nosp@m.rn.ch

Definition at line 24 of file MuonGeometryNumbering.h.

Constructor & Destructor Documentation

MuonGeometryNumbering::MuonGeometryNumbering ( const MuonGeometryConstants muonConstants)

Definition at line 8 of file MuonGeometryNumbering.cc.

References MuonGeometryConstants::getValue(), theBasePart, theLevelPart, theStartCopyNo, and theSuperPart.

8  {
9  // Get constant values from muonConstants
10  theLevelPart = muonConstants.getValue("level");
11  theSuperPart = muonConstants.getValue("super");
12  theBasePart = muonConstants.getValue("base");
13  theStartCopyNo = muonConstants.getValue("xml_starts_with_copyno");
14 
15  // some consistency checks
16 
17  if (theBasePart != 1) {
18  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual base constant:" << theBasePart;
19  }
20  if (theSuperPart < 100) {
21  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual super constant:" << theSuperPart;
22  }
23  if (theLevelPart < 10 * theSuperPart) {
24  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual level constant:" << theLevelPart;
25  }
26  if ((theStartCopyNo != 0) && (theStartCopyNo != 1)) {
27  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual start value for copy numbers:"
28  << theStartCopyNo;
29  }
30 
31 #ifdef EDM_ML_DEBUG
32  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering configured with"
33  << " Level = " << theLevelPart << " Super = " << theSuperPart
34  << " Base = " << theBasePart << " StartCopyNo = " << theStartCopyNo;
35 #endif
36 }
Log< level::Info, true > LogVerbatim
int getValue(const std::string &name) const
Log< level::Warning, false > LogWarning
MuonGeometryNumbering::~MuonGeometryNumbering ( )
inline

Definition at line 27 of file MuonGeometryNumbering.h.

27 {};

Member Function Documentation

MuonBaseNumber MuonGeometryNumbering::geoHistoryToBaseNumber ( const DDGeoHistory history) const

Definition at line 38 of file MuonGeometryNumbering.cc.

References MuonBaseNumber::addBase(), dataset::end, MuonBaseNumber::getBaseNo(), getInt(), MuonBaseNumber::getLevels(), MuonBaseNumber::getSuperNo(), isotrackTrainRegressor::history, mps_fire::i, pileupDistInMC::num, hltrates_dqm_sourceclient-live_cfg::offset, GlobalPosition_Frontier_DevDB_cff::tag, theLevelPart, theStartCopyNo, and theSuperPart.

Referenced by CSCGeometryParsFromDD::build(), GEMGeometryBuilder::build(), DTGeometryBuilderFromDDD::buildChamber(), DTGeometryBuilderFromDD4hep::buildChamber(), cms::DTGeometryBuilder::buildChamber(), ME0GeometryParsFromDD::buildGeometry(), RPCGeometryBuilder::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), ME0GeometryBuilder::buildGeometry(), DTGeometryParserFromDDD::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), DTGeometryBuilderFromDD4hep::buildLayer(), cms::DTGeometryBuilder::buildLayer(), DTGeometryBuilderFromDDD::buildSuperLayer(), DTGeometryBuilderFromDD4hep::buildSuperLayer(), cms::DTGeometryBuilder::buildSuperLayer(), DTGeometryParsFromDD::insertChamber(), DTGeometryParsFromDD::insertLayer(), and DTGeometryParsFromDD::insertSuperLayer().

38  {
40 
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering create MuonBaseNumber for " << history;
43 #endif
44 
45  //loop over all parents and check
46  DDGeoHistory::const_iterator cur = history.begin();
47  DDGeoHistory::const_iterator end = history.end();
48  while (cur != end) {
49  const DDLogicalPart &ddlp = cur->logicalPart();
50  const int tag = getInt("CopyNoTag", ddlp) / theLevelPart;
51  if (tag > 0) {
52  const int offset = getInt("CopyNoOffset", ddlp);
53  const int copyno = (cur->copyno()) + offset % theSuperPart;
54  const int super = offset / theSuperPart;
55  num.addBase(tag, super, copyno - theStartCopyNo);
56  }
57  cur++;
58  }
59 
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering::" << num.getLevels();
62  for (int i = 1; i <= num.getLevels(); i++) {
63  edm::LogVerbatim("MuonGeom") << "[" << i << "] " << num.getSuperNo(i) << " " << num.getBaseNo(i);
64  }
65 #endif
66 
67  return num;
68 }
Log< level::Info, true > LogVerbatim
void addBase(const int level, const int super, const int base)
int getBaseNo(int level) const
int getInt(const std::string &s, const DDLogicalPart &part) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
int getLevels() const
int getSuperNo(int level) const
string end
Definition: dataset.py:937
MuonBaseNumber MuonGeometryNumbering::geoHistoryToBaseNumber ( const cms::ExpandedNodes nodes) const

Definition at line 70 of file MuonGeometryNumbering.cc.

References MuonBaseNumber::addBase(), cms::ExpandedNodes::copyNos, dqmiodatasetharvest::ctr, pileupDistInMC::num, hltrates_dqm_sourceclient-live_cfg::offset, cms::ExpandedNodes::offsets, GlobalPosition_Frontier_DevDB_cff::tag, cms::ExpandedNodes::tags, theLevelPart, theStartCopyNo, and theSuperPart.

70  {
72 
73  int ctr(0);
74  for (auto const &it : nodes.tags) {
75  int tag = it / theLevelPart;
76  if (tag > 0) {
77  int offset = nodes.offsets[ctr];
78  int copyno = nodes.copyNos[ctr] + offset % theSuperPart;
79  int super = offset / theSuperPart;
80  num.addBase(tag, super, copyno - theStartCopyNo);
81  }
82  ++ctr;
83  }
84  return num;
85 }
void addBase(const int level, const int super, const int base)
std::vector< int > copyNos
Definition: ExpandedNodes.h:29
std::vector< double > offsets
Definition: ExpandedNodes.h:28
std::vector< double > tags
Definition: ExpandedNodes.h:27
int MuonGeometryNumbering::getInt ( const std::string &  s,
const DDLogicalPart part 
) const
private

Definition at line 87 of file MuonGeometryNumbering.cc.

References DDfetch(), DDValue::doubles(), DDBase< N, C >::name(), mps_fire::result, DDLogicalPart::specifics(), groupFilesInBlocks::temp, and hgcalPerformanceValidation::val.

Referenced by geoHistoryToBaseNumber().

87  {
88  DDValue val(s);
89  std::vector<const DDsvalues_type *> result = part.specifics();
90  std::vector<const DDsvalues_type *>::iterator it = result.begin();
91  bool foundIt = false;
92  for (; it != result.end(); ++it) {
93  foundIt = DDfetch(*it, val);
94  if (foundIt)
95  break;
96  }
97  if (foundIt) {
98  std::vector<double> temp = val.doubles();
99  if (temp.size() != 1) {
100  edm::LogError("MuonGeom") << "MuonGeometryNumbering:: ERROR: I need only 1 " << s << " in DDLogicalPart "
101  << part.name();
102  abort();
103  }
104  return int(temp[0]);
105  } else
106  return 0;
107 }
const N & name() const
Definition: DDBase.h:59
Log< level::Error, false > LogError
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...
tuple result
Definition: mps_fire.py:311

Member Data Documentation

int MuonGeometryNumbering::theBasePart
private

Definition at line 37 of file MuonGeometryNumbering.h.

Referenced by MuonGeometryNumbering().

int MuonGeometryNumbering::theLevelPart
private

Definition at line 35 of file MuonGeometryNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonGeometryNumbering().

int MuonGeometryNumbering::theStartCopyNo
private

Definition at line 38 of file MuonGeometryNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonGeometryNumbering().

int MuonGeometryNumbering::theSuperPart
private

Definition at line 36 of file MuonGeometryNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonGeometryNumbering().