CMS 3D CMS Logo

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

#include <RPCNumberingScheme.h>

Inheritance diagram for RPCNumberingScheme:
MuonNumberingScheme

Public Member Functions

int baseNumberToUnitNumber (const MuonBaseNumber &) override
 
 RPCNumberingScheme (const DDCompactView &cpv)
 
 RPCNumberingScheme (const MuonDDDConstants &muonConstants)
 
 ~RPCNumberingScheme () override
 
- Public Member Functions inherited from MuonNumberingScheme
 MuonNumberingScheme ()
 
virtual ~MuonNumberingScheme ()
 

Private Member Functions

void initMe (const MuonDDDConstants &muonConstants)
 

Private Attributes

int theBChamberLevel
 
int theBPlaneLevel
 
int theBStationLevel
 
int theBWheelLevel
 
int theEPlaneLevel
 
int theERollLevel
 
int theESectorLevel
 
int theRegionLevel
 

Detailed Description

implementation of MuonNumberingScheme for muon rpc, converts the MuonBaseNumber to a unit id

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

Definition at line 19 of file RPCNumberingScheme.h.

Constructor & Destructor Documentation

RPCNumberingScheme::RPCNumberingScheme ( const DDCompactView cpv)

Definition at line 13 of file RPCNumberingScheme.cc.

References initMe().

13  {
14  MuonDDDConstants muonConstants(cpv);
15  initMe(muonConstants);
16 }
void initMe(const MuonDDDConstants &muonConstants)
RPCNumberingScheme::RPCNumberingScheme ( const MuonDDDConstants muonConstants)

Definition at line 9 of file RPCNumberingScheme.cc.

References initMe().

9  {
10  initMe(muonConstants);
11 }
void initMe(const MuonDDDConstants &muonConstants)
RPCNumberingScheme::~RPCNumberingScheme ( )
inlineoverride

Definition at line 25 of file RPCNumberingScheme.h.

References baseNumberToUnitNumber(), and initMe().

25 {};

Member Function Documentation

int RPCNumberingScheme::baseNumberToUnitNumber ( const MuonBaseNumber num)
overridevirtual

Reimplemented from MuonNumberingScheme.

Definition at line 40 of file RPCNumberingScheme.cc.

References Reference_intrackfit_cff::barrel, gather_cfg::cout, MuonBaseNumber::getBaseNo(), MuonBaseNumber::getLevels(), MuonBaseNumber::getSuperNo(), triggerObjects_cff::id, hcalDigis_cfi::level, theBChamberLevel, theBPlaneLevel, theBStationLevel, theBWheelLevel, theEPlaneLevel, theERollLevel, theESectorLevel, and theRegionLevel.

Referenced by RPCGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), and ~RPCNumberingScheme().

40  {
41 
42 #ifdef LOCAL_DEBUG
43  std::cout << "RPCNumbering "<<num.getLevels()<<std::endl;
44  for (int level=1;level<=num.getLevels();level++) {
45  std::cout << level << " " << num.getSuperNo(level)
46  << " " << num.getBaseNo(level) << std::endl;
47  }
48 #endif
49 
50  const int barrel = num.getSuperNo(theRegionLevel);
51  bool barrel_muon=(barrel == 1);
52  int maxLevel;
53  if (barrel_muon) {
54  maxLevel=theBChamberLevel;
55  } else {
56  maxLevel=theERollLevel;
57  }
58 
59  if (num.getLevels()!=maxLevel) {
60  std::cout << "MuonRpcNS::BNToUN "
61  << "BaseNumber has " << num.getLevels() << " levels,"
62  << "need "<<maxLevel<<std::endl;
63  return 0;
64  }
65 
66  int plane_id=0;
67  int sector_id=0;
68  int copy_id=0;
69  int roll_id=0;
70  int eta_id=0;
71  int rr12_id=0;
72  bool forward=false;
73 
74  int sector_copy=0;
75 
76  //decode significant rpc levels
77 
78  for (int level=1;level<=maxLevel;level++) {
79 
80  //decode
81  if (level==theRegionLevel) {
82  if (barrel_muon) {
83  roll_id=0;
84  } else {
85  copy_id=1;
86  }
87  }
88  if (barrel_muon) {
89  if (level==theBWheelLevel) {
90  const int copyno = num.getBaseNo(level);
91  eta_id = 4 + copyno; //copyno= [0,4]
92  } else if (level==theBStationLevel) {
93  //- const int station_tag = num.getSuperNo(level);
94  const int copyno = num.getBaseNo(level);
95 
96  sector_id=copyno+1;
97  if( sector_id == 13 ) {
98  sector_id = 4;
99  sector_copy = 1;
100  }else if( sector_id == 14 ) {
101  sector_id = 10;
102  sector_copy = 1;
103  }
104  // mltiply by 3 to merge with endcaps
105  sector_id*=3;
106 
107  } else if (level==theBPlaneLevel) {
108  const int plane_tag = num.getSuperNo(level);
109  // const int copyno = num.getBaseNo(level);
110  if (plane_tag == 1) {
111  plane_id=1;
112  } else if (plane_tag == 2) {
113  plane_id=5;
114  } else if (plane_tag == 3) {
115  // if(copyno == 1) {
116  //if(eta_id == 4 || eta_id == 8) {
117  // plane_id=6;
118 
119  plane_id=2;
120  // }
121 
122 // std::cout<<" KONTROLA w RPCNumberingScheme: eta_id: "<<eta_id<<", plane_tag: "<<plane_tag<<", plane_id: "<<plane_id<<std::endl;
123  } else if (plane_tag == 4) {
124 // if(copyno == 1) {
125  // if(eta_id == 4 || eta_id == 8) {
126  // plane_id=2;
127  //} else {
128  plane_id=6;
129  //}
130 // std::cout<<" KONTROLA w RPCNumberingScheme: eta_id: "<<eta_id<<", plane_tag: "<<plane_tag<<", plane_id: "<<plane_id<<std::endl;
131  } else if (plane_tag == 5) {
132  plane_id=3;
133  } else {
134  plane_id=4;
135  }
136 
137  } else if (level==theBChamberLevel) {
138  const int copyno = num.getBaseNo(level);
139  if ((plane_id == 4) && (sector_id == 4*3)) {
140  copy_id=sector_copy*2+copyno+1;
141  } else if ((plane_id == 4) && (sector_id == 10*3)) {
142  copy_id=sector_copy+1;
143  } else {
144  copy_id=copyno+1;
145  }
146  const int rollno = num.getSuperNo(level);
147  roll_id = rollno;
148  }
149 
150  } else {
151 
152  if (level==theRegionLevel) {
153  const int copyno = num.getBaseNo(level);
154  forward=(copyno == 0);
155  } else if (level==theEPlaneLevel) {
156  const int plane_tag = num.getSuperNo(level);
157  const int rr12_tag = num.getBaseNo(level);
158  plane_id = plane_tag;
159  rr12_id = rr12_tag;
160  } else if (level==theESectorLevel) {
161  const int copyno = num.getBaseNo(level);
162  sector_id = copyno+1;
163  if (rr12_id==1) {
164  sector_id = sector_id*2-1;
165  }else if(rr12_id==2){
166  sector_id = sector_id*2;
167  }
168  } else if (level==theERollLevel) {
169  const int copyno = num.getBaseNo(level);
170  const int eta_tag = num.getSuperNo(level);
171 
172  if ((eta_tag == 1) || (eta_tag == 4) ||
173  (eta_tag == 7) || (eta_tag == 8)) {
174  eta_id=1;
175  } else if ((eta_tag == 2) || (eta_tag == 5)) {
176  eta_id=2;
177  } else if ((eta_tag == 3) || (eta_tag == 6)) {
178  eta_id=3;
179  }
180 
181  if (forward) eta_id=12-eta_id;
182 
183  // increase sector id for 20 degree chambers
184 
185  if ((eta_tag == 4) || (eta_tag == 7) ||
186  (eta_tag == 8)) {
187  sector_id*=2;
188  }
189 
190  roll_id = copyno+1;
191 
192  }
193 
194  }
195  }
196 
197  // collect all info
198 
199  int trIndex=(eta_id*10000+plane_id*1000+sector_id*10+copy_id)*10+
200  roll_id;
201 
202 #ifdef LOCAL_DEBUG
203  if (barrel_muon) {
204  std::cout << "RPCNumberingScheme (barrel): ";
205  } else {
206  if (forward) {
207  std::cout << "RPCNumberingScheme (forward): ";
208  } else {
209  std::cout << "RPCNumberingScheme (backward): ";
210  }
211  }
212  std::cout << " roll " << roll_id;
213  std::cout << " copy " << copy_id;
214  std::cout << " sector " << sector_id;
215  std::cout << " plane " << plane_id;
216  std::cout << " eta " << eta_id;
217  std::cout << " rr12 " << rr12_id;
218 #endif
219 
220  // Build the actual numbering
221  RPCDetId id;
222  id.buildfromTrIndex(trIndex);
223 
224 
225 #ifdef LOCAL_DEBUG
226  std::cout << " DetId " << id;
227  std::cout << std::endl;
228 #endif
229 
230  return id.rawId();
231 }
int getBaseNo(int level) const
int getLevels() const
int getSuperNo(int level) const
void RPCNumberingScheme::initMe ( const MuonDDDConstants muonConstants)
private

Definition at line 18 of file RPCNumberingScheme.cc.

References gather_cfg::cout, MuonDDDConstants::getValue(), theBChamberLevel, theBPlaneLevel, theBStationLevel, theBWheelLevel, theEPlaneLevel, theERollLevel, theESectorLevel, and theRegionLevel.

Referenced by RPCNumberingScheme(), and ~RPCNumberingScheme().

18  {
19  int theLevelPart=muonConstants.getValue("level");
20  theRegionLevel=muonConstants.getValue("mr_region")/theLevelPart;
21  theBWheelLevel=muonConstants.getValue("mr_bwheel")/theLevelPart;
22  theBStationLevel=muonConstants.getValue("mr_bstation")/theLevelPart;
23  theBPlaneLevel=muonConstants.getValue("mr_bplane")/theLevelPart;
24  theBChamberLevel=muonConstants.getValue("mr_bchamber")/theLevelPart;
25  theEPlaneLevel=muonConstants.getValue("mr_eplane")/theLevelPart;
26  theESectorLevel=muonConstants.getValue("mr_esector")/theLevelPart;
27  theERollLevel=muonConstants.getValue("mr_eroll")/theLevelPart;
28 #ifdef LOCAL_DEBUG
29  std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
30  std::cout << "theBWheelLevel " << theBWheelLevel <<std::endl;
31  std::cout << "theBStationLevel " << theBStationLevel <<std::endl;
32  std::cout << "theBPlaneLevel " << theBPlaneLevel <<std::endl;
33  std::cout << "theBChamberLevel " << theBChamberLevel <<std::endl;
34  std::cout << "theEPlaneLevel " << theEPlaneLevel <<std::endl;
35  std::cout << "theESectorLevel " << theESectorLevel <<std::endl;
36  std::cout << "theERollLevel " << theERollLevel <<std::endl;
37 #endif
38 }
int getValue(const std::string &name) const

Member Data Documentation

int RPCNumberingScheme::theBChamberLevel
private

Definition at line 36 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theBPlaneLevel
private

Definition at line 35 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theBStationLevel
private

Definition at line 34 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theBWheelLevel
private

Definition at line 33 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theEPlaneLevel
private

Definition at line 37 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theERollLevel
private

Definition at line 39 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theESectorLevel
private

Definition at line 38 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().

int RPCNumberingScheme::theRegionLevel
private

Definition at line 32 of file RPCNumberingScheme.h.

Referenced by baseNumberToUnitNumber(), and initMe().