CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMNumberingScheme.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 //#define LOCAL_DEBUG
8 
10  initMe(muonConstants);
11 }
12 
14  MuonDDDConstants muonConstants(cpv);
15  initMe(muonConstants);
16 }
17 
18 void GEMNumberingScheme::initMe ( const MuonDDDConstants& muonConstants ) {
19  int theLevelPart= muonConstants.getValue("level");
20  theRegionLevel = muonConstants.getValue("mg_region")/theLevelPart;
21  theStationLevel = muonConstants.getValue("mg_station")/theLevelPart;
22  theRingLevel = muonConstants.getValue("mg_ring")/theLevelPart;
23  theSectorLevel = muonConstants.getValue("mg_sector")/theLevelPart;
24  theRollLevel = muonConstants.getValue("mg_roll")/theLevelPart;
25 #ifdef LOCAL_DEBUG
26  std::cout << "Initialize GEMNumberingScheme" <<std::endl;
27  std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
28  std::cout << "theStationLevel "<< theStationLevel<<std::endl;
29  std::cout << "theRingLevel " << theRingLevel <<std::endl;
30  std::cout << "theSectorLevel " << theSectorLevel <<std::endl;
31  std::cout << "theRollLevel " << theRollLevel <<std::endl;
32 #endif
33 }
34 
36 
37 #ifdef LOCAL_DEBUG
38  std::cout << "GEMNumbering "<<num.getLevels()<<std::endl;
39  for (int level=1;level<=num.getLevels();level++) {
40  std::cout << level << " " << num.getSuperNo(level)
41  << " " << num.getBaseNo(level) << std::endl;
42  }
43 #endif
44 
45  int maxLevel = theRollLevel;
46  if (num.getLevels()!=maxLevel) {
47  std::cout << "MuonGEMNS::BNToUN "
48  << "BaseNumber has " << num.getLevels() << " levels,"
49  << "need "<<maxLevel<<std::endl;
50  return 0;
51  }
52 
53  int region(0), ring(0), station(0), layer(0), chamber(0), roll(0);
54 
55  //decode significant GEM levels
56 
57  if (num.getBaseNo(theRegionLevel) == 0) region = 1;
58  else region =-1;
59 
60  // All GEM super chambers in stations 1 and 2 are on ring 1.
61  // The long super chambers in station 2 are assigned *station 3* due
62  // to the current limitation in the definition of the GEMDetId,
63  // i.e. only 2 layers available per station.
66  // GEM are only on the first ring
67  ring = 1;
68 
69  roll = num.getBaseNo(theRollLevel)+1;
70  const int copyno = num.getBaseNo(theSectorLevel) + 1;
71  if (copyno < 50) {
72  if (copyno%2 == 0) {
73  layer = 2;
74  chamber = copyno-1;
75  } else {
76  layer = 1;
77  chamber = copyno;
78  }
79  } else {
80  int copynp = copyno - 50;
81  if (copynp%2 != 0) {
82  layer = 2;
83  chamber = copynp-1;
84  } else {
85  layer = 1;
86  chamber = copynp;
87  }
88  }
89 
90  // collect all info
91 
92 #ifdef LOCAL_DEBUG
93  std::cout << "GEMNumberingScheme: Region " << region << " Ring "
94  << ring << " Station " << station << " Layer " << layer
95  << " Chamber " << chamber << " Roll " << roll << std::endl;
96 #endif
97 
98  // Build the actual numbering
99  GEMDetId id(region,ring,station,layer,chamber, roll);
100 
101 
102 #ifdef LOCAL_DEBUG
103  std::cout << id.rawId() << " DetId " << id << std::endl;
104 #endif
105 
106  return id.rawId();
107 }
108 
109 
110 
111 
void initMe(const MuonDDDConstants &muonConstants)
int getBaseNo(int level) const
type of data representation of DDCompactView
Definition: DDCompactView.h:77
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
GEMNumberingScheme(const DDCompactView &cpv)