CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonDDDNumbering Class Reference

#include <MuonDDDNumbering.h>

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)

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

Definition at line 23 of file MuonDDDNumbering.h.

Constructor & Destructor Documentation

MuonDDDNumbering::MuonDDDNumbering ( const MuonDDDConstants muonConstants)

Definition at line 8 of file MuonDDDNumbering.cc.

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

8  {
9  // MuonDDDConstants 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("Geometry")
19  << "MuonDDDNumbering finds unusual base constant:" << theBasePart;
20  }
21  if (theSuperPart<100) {
22  edm::LogWarning("Geometry")
23  << "MuonDDDNumbering finds unusual super constant:" << theSuperPart;
24  }
25  if (theLevelPart<10*theSuperPart) {
26  edm::LogWarning("Geometry")
27  << "MuonDDDNumbering finds unusual level constant:" << theLevelPart;
28  }
29  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
30  edm::LogWarning("Geometry")
31  << "MuonDDDNumbering finds unusual start value for copy numbers:"
32  << theStartCopyNo;
33  }
34 
35 #ifdef LOCAL_DEBUG
36  edm::LogVerbatim("Geometry")
37  << "MuonDDDNumbering configured with"
38  << " Level = " << theLevelPart << " Super = " << theSuperPart
39  << " Base = " << theBasePart << " StartCopyNo = " << theStartCopyNo;
40 #endif
41 
42 }
int getValue(const std::string &name) const
MuonDDDNumbering::~MuonDDDNumbering ( )
inline

Member Function Documentation

MuonBaseNumber MuonDDDNumbering::geoHistoryToBaseNumber ( const DDGeoHistory history)

Definition at line 44 of file MuonDDDNumbering.cc.

References MuonBaseNumber::addBase(), end, MuonBaseNumber::getBaseNo(), getInt(), MuonBaseNumber::getLevels(), MuonBaseNumber::getSuperNo(), mps_fire::i, pileupDistInMC::num, PFRecoTauDiscriminationByIsolation_cfi::offset, GlobalPosition_Frontier_DevDB_cff::tag, theLevelPart, theStartCopyNo, and theSuperPart.

Referenced by CSCGeometryParsFromDD::build(), GEMGeometryBuilderFromDDD::build(), DTGeometryBuilderFromDDD::buildChamber(), ME0GeometryParsFromDD::buildGeometry(), ME0GeometryBuilderFromDDD::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), DTGeometryParserFromDDD::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), DTGeometryBuilderFromDDD::buildSuperLayer(), DTGeometryParsFromDD::insertChamber(), DTGeometryParsFromDD::insertLayer(), DTGeometryParsFromDD::insertSuperLayer(), and ~MuonDDDNumbering().

44  {
46 
47 #ifdef LOCAL_DEBUG
48  edm::LogVerbatim("Geometry")
49  << "MuonDDDNumbering create MuonBaseNumber for " << history;
50 #endif
51 
52  //loop over all parents and check
53  DDGeoHistory::const_iterator cur=history.begin();
54  DDGeoHistory::const_iterator end=history.end();
55  while (cur!=end) {
56  const DDLogicalPart & ddlp = cur->logicalPart();
57  const int tag=getInt("CopyNoTag",ddlp)/theLevelPart;
58  if (tag>0) {
59  const int offset=getInt("CopyNoOffset",ddlp);
60  const int copyno=(cur->copyno())+offset%theSuperPart;
61  const int super=offset/theSuperPart;
62  num.addBase(tag,super,copyno-theStartCopyNo);
63  }
64  cur++;
65  }
66 
67 #ifdef LOCAL_DEBUG
68  edm::LogVerbatim("Geometry") << "MuonDDDNumbering::" << num.getLevels();
69  for (int i=1;i<=num.getLevels();i++) {
70  edm::LogVerbatim("Geometry")
71  << "[" << i << "] " << num.getSuperNo(i) << " " << num.getBaseNo(i);
72  }
73 #endif
74 
75  return num;
76 }
void addBase(const int level, const int super, const int base)
int getBaseNo(int level) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
#define end
Definition: vmac.h:39
int getInt(const std::string &s, const DDLogicalPart &part)
int getLevels() const
int getSuperNo(int level) const
int MuonDDDNumbering::getInt ( const std::string &  s,
const DDLogicalPart part 
)
private

Definition at line 78 of file MuonDDDNumbering.cc.

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

Referenced by geoHistoryToBaseNumber(), and ~MuonDDDNumbering().

79 {
80  DDValue val(s);
81  std::vector<const DDsvalues_type *> result = part.specifics();
82  std::vector<const DDsvalues_type *>::iterator it = result.begin();
83  bool foundIt = false;
84  for (; it != result.end(); ++it)
85  {
86  foundIt = DDfetch(*it,val);
87  if (foundIt) break;
88  }
89  if (foundIt)
90  {
91  std::vector<double> temp = val.doubles();
92  if (temp.size() != 1)
93  {
94  edm::LogError("Geometry")
95  << "MuonDDDNumbering:: ERROR: I need only 1 " << s
96  << " in DDLogicalPart " << part.name();
97  abort();
98  }
99  return int(temp[0]);
100  }
101  else return 0;
102 }
const N & name() const
Definition: DDBase.h:74
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...

Member Data Documentation

int MuonDDDNumbering::theBasePart
private

Definition at line 37 of file MuonDDDNumbering.h.

Referenced by MuonDDDNumbering().

int MuonDDDNumbering::theLevelPart
private

Definition at line 35 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().

int MuonDDDNumbering::theStartCopyNo
private

Definition at line 38 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().

int MuonDDDNumbering::theSuperPart
private

Definition at line 36 of file MuonDDDNumbering.h.

Referenced by geoHistoryToBaseNumber(), and MuonDDDNumbering().