test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ME0NumberingScheme.cc
Go to the documentation of this file.
7 
8 #include <iostream>
9 
10 //#define LOCAL_DEBUG
11 
13  initMe(muonConstants);
14 }
15 
17  MuonDDDConstants muonConstants(cpv);
18  initMe(muonConstants);
19 }
20 
21 void ME0NumberingScheme::initMe ( const MuonDDDConstants& muonConstants ) {
22  int theLevelPart= muonConstants.getValue("level");
23  theRegionLevel = muonConstants.getValue("m0_region")/theLevelPart;
24  theLayerLevel = muonConstants.getValue("m0_layer")/theLevelPart;
25  theSectorLevel = muonConstants.getValue("m0_sector")/theLevelPart;
26  theRollLevel = muonConstants.getValue("m0_roll")/theLevelPart;
27  theNEtaPart = muonConstants.getValue("m0_nroll");
28 
29  // Debug using LOCAL_DEBUG
30  #ifdef LOCAL_DEBUG
31  std::cout << "Initialize ME0NumberingScheme" <<std::endl;
32  std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
33  std::cout << "theLayerLevel " << theLayerLevel <<std::endl;
34  std::cout << "theSectorLevel " << theSectorLevel <<std::endl;
35  std::cout << "theRollLevel " << theRollLevel <<std::endl;
36  std::cout << "theNEtaPart " << theNEtaPart <<std::endl;
37  #endif
38  // -----------------------
39 
40  // Debug using LogDebug
41  std::stringstream DebugStringStream;
42  DebugStringStream << "Initialize ME0NumberingScheme" <<std::endl;
43  DebugStringStream << "theRegionLevel " << theRegionLevel <<std::endl;
44  DebugStringStream << "theLayerLevel " << theLayerLevel <<std::endl;
45  DebugStringStream << "theSectorLevel " << theSectorLevel <<std::endl;
46  DebugStringStream << "theRollLevel " << theRollLevel <<std::endl;
47  DebugStringStream << "theNEtaPart " << theNEtaPart <<std::endl;
48  std::string DebugString = DebugStringStream.str();
49  edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
50  // --------------------
51 }
52 
54 
55  edm::LogVerbatim("ME0NumberingScheme")<<"ME0NumberingScheme::baseNumberToUnitNumber BEGIN "<<std::endl;
56  // Debug using LOCAL_DEBUG
57  #ifdef LOCAL_DEBUG
58  std::cout << "ME0Numbering "<<num.getLevels()<<std::endl;
59  for (int level=1;level<=num.getLevels();level++) {
60  std::cout << "level "<<level << " " << num.getSuperNo(level)
61  << " " << num.getBaseNo(level) << std::endl;
62  }
63  #endif
64  // -----------------------
65 
66  // Debug using LogDebug
67  std::stringstream DebugStringStream;
68  DebugStringStream << "ME0Numbering :: number of levels = "<<num.getLevels()<<std::endl;
69  DebugStringStream << "Level \t SuperNo \t BaseNo"<<std::endl;
70  for (int level=1;level<=num.getLevels();level++) {
71  DebugStringStream <<level << " \t " << num.getSuperNo(level)
72  << " \t " << num.getBaseNo(level) << std::endl;
73  }
74  std::string DebugString = DebugStringStream.str();
75  edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
76  // -----------------------
77 
78 
79 
80  int maxLevel = 0;
81  if(theNEtaPart==1) maxLevel = theLayerLevel;
82  else maxLevel = theRollLevel;
83  if (num.getLevels()!=maxLevel) {
84  throw cms::Exception("MuonNumbering") << "MuonME0NS::BNToUN "
85  << "BaseNumber has " << num.getLevels() << " levels,"
86  << "need "<<maxLevel<<std::endl;
87  return 0;
88  }
89 
90  int region(0), layer(0), chamber(0), roll(0);
91 
92  //decode significant ME0 levels
93 
94  if (num.getBaseNo(theRegionLevel) == 0)
95  region = 1;
96  else
97  region =-1;
98  layer = num.getBaseNo(theLayerLevel)+1;
99  chamber = num.getBaseNo(theSectorLevel) + 1;
100 
101  if(theNEtaPart==1) roll = 0;
102  else roll = num.getBaseNo(theRollLevel)+1;
103 
104  // collect all info
105 
106  // Debug using LOCAL_DEBUG
107  #ifdef LOCAL_DEBUG
108  std::cout << "ME0NumberingScheme: Region " << region
109  << " Layer " << layer
110  << " Chamber " << chamber << " Roll " << roll << std::endl;
111  #endif
112  // -----------------------
113 
114  // Debug using LogDebug
115  edm::LogVerbatim("ME0NumberingScheme") << "ME0NumberingScheme: Region " << region
116  << " Layer " << layer
117  << " Chamber " << chamber << " Roll " << roll << std::endl;
118  // -----------------------
119 
120  // Build the actual numbering
121  ME0DetId id(region,layer,chamber,roll);
122 
123  // Debug using LOCAL_DEBUG
124  #ifdef LOCAL_DEBUG
125  std::cout << " DetId " << id << std::endl;
126  #endif
127  // ---------------------
128 
129  // Debug using LogDebug
130  edm::LogVerbatim("ME0NumberingScheme")<< " DetId " << id << std::endl;
131  // -----------------------
132 
133  return id.rawId();
134 }
135 
136 
137 
138 
int getBaseNo(int level) const
ME0NumberingScheme(const DDCompactView &cpv)
type of data representation of DDCompactView
Definition: DDCompactView.h:90
int getValue(const std::string &name) const
virtual int baseNumberToUnitNumber(const MuonBaseNumber &)
int getLevels() const
int getSuperNo(int level) const
tuple cout
Definition: gather_cfg.py:145
tuple level
Definition: testEve_cfg.py:34
void initMe(const MuonDDDConstants &muonConstants)