CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 9 of file MuonDDDNumbering.cc.

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

9  {
10  // MuonDDDConstants muonConstants;
11  theLevelPart=muonConstants.getValue("level");
12  theSuperPart=muonConstants.getValue("super");
13  theBasePart=muonConstants.getValue("base");
14  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");
15 
16  // some consistency checks
17 
18  if (theBasePart!=1) {
19  std::cout << "MuonDDDNumbering finds unusual base constant:"
20  <<theBasePart<<std::endl;
21  }
22  if (theSuperPart<100) {
23  std::cout << "MuonDDDNumbering finds unusual super constant:"
24  <<theSuperPart<<std::endl;
25  }
26  if (theLevelPart<10*theSuperPart) {
27  std::cout << "MuonDDDNumbering finds unusual level constant:"
28  <<theLevelPart<<std::endl;
29  }
30  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
31  std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
32  <<theStartCopyNo<<std::endl;
33  }
34 
35 #ifdef LOCAL_DEBUG
36  std::cout << "MuonDDDNumbering configured with"<<std::endl;
37  std::cout << "Level = "<<theLevelPart<<" ";
38  std::cout << "Super = "<<theSuperPart<<" ";
39  std::cout << "Base = "<<theBasePart<<" ";
40  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
41 #endif
42 
43 }
int getValue(const std::string &name) const
tuple cout
Definition: gather_cfg.py:121
MuonDDDNumbering::~MuonDDDNumbering ( )
inline

Definition at line 27 of file MuonDDDNumbering.h.

27 {};

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, pileupDistInMC::num, unpackBuffers-CaloStage2::offset, GlobalPosition_Frontier_DevDB_cff::tag, theLevelPart, theStartCopyNo, and theSuperPart.

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

45  {
47 
48 #ifdef LOCAL_DEBUG
49  std::cout << "MuonDDDNumbering create MuonBaseNumber for"<<std::endl;
50  std::cout << history <<std::endl;
51 #endif
52 
53  //loop over all parents and check
54  DDGeoHistory::const_iterator cur=history.begin();
55  DDGeoHistory::const_iterator end=history.end();
56  while (cur!=end) {
57  const DDLogicalPart & ddlp = cur->logicalPart();
58  const int tag=getInt("CopyNoTag",ddlp)/theLevelPart;
59  if (tag>0) {
60  const int offset=getInt("CopyNoOffset",ddlp);
61  const int copyno=(cur->copyno())+offset%theSuperPart;
62  const int super=offset/theSuperPart;
63  num.addBase(tag,super,copyno-theStartCopyNo);
64  }
65  cur++;
66  }
67 
68 #ifdef LOCAL_DEBUG
69  std::cout << num.getLevels() <<std::endl;
70  for (int i=1;i<=num.getLevels();i++) {
71  std::cout << num.getSuperNo(i)<<" "<<num.getBaseNo(i)<<std::endl;
72  }
73 #endif
74 
75  return num;
76 }
int i
Definition: DBlmapReader.cc:9
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:88
#define end
Definition: vmac.h:37
int getInt(const std::string &s, const DDLogicalPart &part)
int getLevels() const
int getSuperNo(int level) const
tuple cout
Definition: gather_cfg.py:121
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 groupFilesInBlocks::temp.

Referenced by geoHistoryToBaseNumber().

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  std::cout << " ERROR: I need only 1 " << s << " in DDLogicalPart " << part.name() << std::endl;
95  abort();
96  }
97  return int(temp[0]);
98  }
99  else return 0;
100 }
const N & name() const
Definition: DDBase.h:78
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121

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