CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
RPCStripsRing Class Reference

#include <L1Trigger/RPCTrigger/interface/RPCStripsRing.h>

Inheritance diagram for RPCStripsRing:

Classes

struct  TOtherConnStruct
 

Public Types

typedef std::map< int,
RPCStripsRing
TIdToRindMap
 
typedef std::vector
< TOtherConnStruct
TOtherConnStructVec
 

Public Member Functions

void addRoll (const RPCRoll *roll)
 
void compressConnections ()
 
void createOtherConnections (int tower, int PACno, int logplane, int logplanesize, float angle)
 
void createRefConnections (TOtherConnStructVec &otherRings, int logplane, int logplaneSize)
 
void fillWithVirtualStrips ()
 
void filterOverlapingChambers ()
 
std::shared_ptr
< L1RPCConeBuilder::TCompressedConMap
getCompressedConnectionsMap ()
 
std::shared_ptr
< L1RPCConeBuilder::TConMap
getConnectionsMap ()
 
int getEtaPartition ()
 
int getHwPlane ()
 
int getRingId ()
 
int getTowerForRefRing ()
 
bool isReferenceRing ()
 
 RPCStripsRing (const RPCRoll *roll, std::shared_ptr< L1RPCConeBuilder::TConMap > cmap)
 
 RPCStripsRing ()
 
virtual ~RPCStripsRing ()
 

Static Public Member Functions

static int calculateHwPlane (const RPCRoll *roll)
 Calculate ringId for any given RPCRoll. More...
 
static int getRingId (int etaPart, int hwPlane)
 
static int getRingId (const RPCRoll *roll)
 Calculate ringId for this ring. More...
 

Private Attributes

std::shared_ptr
< L1RPCConeBuilder::TCompressedConMap
m_compressedConnectionMap
 
std::shared_ptr
< L1RPCConeBuilder::TConMap
m_connectionsMap
 
bool m_didFiltering
 
bool m_didVirtuals
 
int m_etaPartition
 
int m_hwPlane
 
bool m_isReferenceRing
 
int m_region
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 36 of file RPCStripsRing.h.

Member Typedef Documentation

Definition at line 39 of file RPCStripsRing.h.

Definition at line 48 of file RPCStripsRing.h.

Constructor & Destructor Documentation

RPCStripsRing::RPCStripsRing ( const RPCRoll roll,
std::shared_ptr< L1RPCConeBuilder::TConMap cmap 
)

Definition at line 31 of file RPCStripsRing.cc.

References funct::abs(), addRoll(), calculateHwPlane(), RPCGeomServ::eta_partition(), getRingId(), RPCRoll::id(), m_etaPartition, m_hwPlane, m_isReferenceRing, m_region, RPCDetId::region(), RPCDetId::ring(), and relativeConstraints::ring.

32  : m_didVirtuals(false), m_didFiltering(false), m_connectionsMap(cmap) {
33  RPCDetId detId = roll->id();
34  RPCGeomServ grs(detId);
35 
36  m_etaPartition = grs.eta_partition();
38 
39  m_isReferenceRing = false;
40 
41  m_region = detId.region();
42 
43  int ring = detId.ring();
44 
45  if (m_region == 0 && std::abs(ring) < 2 && m_hwPlane == 2) // for barell wheel -1,0,1 refplane is hwPlane=2
46  m_isReferenceRing = true;
47  else if (m_region == 0 && std::abs(ring) == 2 && m_hwPlane == 6) // for barell wheel -2,2 refplane is hwPlane=6
48  m_isReferenceRing = true;
49  else if (m_region != 0 && m_hwPlane == 2) // for endcaps
50  m_isReferenceRing = true;
51 
52  if (getRingId() == 2008 || getRingId() == 2108) //exception: endcaps;hwplane 2;farest roll from beam
53  m_isReferenceRing = false;
54 
55  addRoll(roll);
56 }
std::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
Definition: RPCStripsRing.h:92
RPCDetId id() const
Definition: RPCRoll.cc:16
int ring() const
Definition: RPCDetId.h:59
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool m_isReferenceRing
Definition: RPCStripsRing.h:88
void addRoll(const RPCRoll *roll)
static int calculateHwPlane(const RPCRoll *roll)
Calculate ringId for any given RPCRoll.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
RPCStripsRing::RPCStripsRing ( )

Definition at line 23 of file RPCStripsRing.cc.

24  : m_hwPlane(-1),
25  m_etaPartition(99),
26  m_region(-2),
27  m_isReferenceRing(false),
28  m_didVirtuals(false),
29  m_didFiltering(false) {}
bool m_isReferenceRing
Definition: RPCStripsRing.h:88
virtual RPCStripsRing::~RPCStripsRing ( )
inlinevirtual

Definition at line 53 of file RPCStripsRing.h.

53 {};

Member Function Documentation

void RPCStripsRing::addRoll ( const RPCRoll roll)

Definition at line 58 of file RPCStripsRing.cc.

References RPCRoll::centreOfStrip(), Exception, getRingId(), mps_fire::i, RPCRoll::id(), RPCRoll::nstrips(), PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), and GeomDet::toGlobal().

Referenced by RPCStripsRing().

58  {
59  // RPCDetId detId = roll->id();
60 
61  if (getRingId() != getRingId(roll)) {
62  throw cms::Exception("RPCInternal") << "RPCStripsRing::addRoll ringsIds dont match \n";
63  }
64 
65  //iterate over the strips of this roll
66  for (int i = 1; i <= roll->nstrips(); i++) {
67  LocalPoint lStripCentre = roll->centreOfStrip(i);
68  GlobalPoint gStripCentre = roll->toGlobal(lStripCentre);
69  float phiRaw = gStripCentre.phi();
70 
71  TStrip newStrip(roll->id().rawId(), i);
72  (*this)[phiRaw] = newStrip;
73  }
74 }
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
int nstrips() const
Definition: RPCRoll.cc:24
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RPCDetId id() const
Definition: RPCRoll.cc:16
int RPCStripsRing::calculateHwPlane ( const RPCRoll roll)
static

Calculate ringId for any given RPCRoll.

Definition at line 100 of file RPCStripsRing.cc.

References Exception, RPCRoll::id(), RPCDetId::layer(), phase1PixelTopology::layer, RPCDetId::region(), HLT_FULL_cff::region, relativeConstraints::station, and RPCDetId::station().

Referenced by getRingId(), and RPCStripsRing().

100  {
101  int hwPlane = -1;
102  RPCDetId detId = roll->id();
103  int station = detId.station();
104  int layer = detId.layer();
105  int region = detId.region();
106 
107  if (region != 0) { // endcaps
108  hwPlane = station;
109  }
110  // Now comes the barell
111  else if (station > 2) {
112  hwPlane = station;
113  } else if (station == 1 && layer == 1) {
114  hwPlane = 1;
115  } else if (station == 1 && layer == 2) {
116  hwPlane = 5;
117  } else if (station == 2 && layer == 1) {
118  hwPlane = 2;
119  } else if (station == 2 && layer == 2) {
120  hwPlane = 6;
121  }
122 
123  /*if (hwPlane < 1)
124  std::cout << "prb: " << hwPlane << " "
125  << region << " "
126  << station << " "
127  << layer << std::endl;*/
128  if (hwPlane < 0) {
129  throw cms::Exception("RPCInternal") << "Calculated negative hwplane \n";
130  }
131 
132  return hwPlane;
133 }
constexpr std::array< uint8_t, layerIndexSize > layer
RPCDetId id() const
Definition: RPCRoll.cc:16
int layer() const
Definition: RPCDetId.h:85
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
int station() const
Definition: RPCDetId.h:78
void RPCStripsRing::compressConnections ( )

Definition at line 443 of file RPCStripsRing.cc.

References L1RPCConeBuilder::TCompressedCon::addStrip(), m_compressedConnectionMap, m_connectionsMap, L1RPCConeBuilder::TCompressedCon::m_logplane, L1RPCConeBuilder::TCompressedCon::m_mul, L1RPCConeBuilder::TCompressedCon::m_offset, L1RPCConeBuilder::TCompressedCon::m_PAC, and L1RPCConeBuilder::TCompressedCon::m_tower.

443  {
444  L1RPCConeBuilder::TConMap::iterator itChamber = m_connectionsMap->begin();
445 
446  auto uncompressedConsLeft = std::make_shared<L1RPCConeBuilder::TConMap>();
447 
448  m_compressedConnectionMap = std::make_shared<L1RPCConeBuilder::TCompressedConMap>();
449 
450  int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
451 
452  // int offsetMin =0, offsetMax =0;
453 
454  for (; itChamber != m_connectionsMap->end(); ++itChamber) {
455  uint32_t detId = itChamber->first;
456 
457  for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
458  itStrip != itChamber->second.end();
459  ++itStrip) {
460  // Iterate over strip Connections
461  for (L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin(); itConn != itStrip->second.end();
462  ++itConn) {
463  // Check if this connection isn't allready present in the compressed map
464  ++uncompressedConsBefore;
465  bool alreadyDone = false;
466  if (m_compressedConnectionMap->find(detId) != m_compressedConnectionMap->end()) {
467  // iterate over the vec, check element by element
468  for (L1RPCConeBuilder::TCompressedConVec::iterator itCompConn = (*m_compressedConnectionMap)[detId].begin();
469  itCompConn != (*m_compressedConnectionMap)[detId].end();
470  ++itCompConn) {
471  if (itCompConn->m_tower == itConn->m_tower && itCompConn->m_PAC == itConn->m_PAC &&
472  itCompConn->m_logplane == itConn->m_logplane) // connection allready compressed
473  {
474  alreadyDone = true;
475 
476  int logStrip = itCompConn->m_mul * itStrip->first + itCompConn->m_offset;
477  if (logStrip != itConn->m_logstrip) {
478  //copy the problematic connection to the "safe" map
479  (*uncompressedConsLeft)[detId][itStrip->first].push_back(*itConn);
480  ++uncompressedConsAfter;
481  edm::LogWarning("RPCTriggerConfig")
482  << " Compression failed for det " << detId << " strip " << (int)itStrip->first << " . Got "
483  << (int)logStrip << " expected " << (int)itConn->m_logstrip << std::endl;
484  } else {
485  itCompConn->addStrip(itStrip->first);
486  }
487  }
488  } // compressed connection iteration end
489  }
490  //if (detId==637569977) std::cout << " Buld cons for strip " << (int)itStrip->first << std::endl;
491 
492  if (!alreadyDone) {
493  // find another strip contributing to the same PAC,tower,logplane
494  L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
495  ++itStripOther;
496  bool otherStripFound = false;
497  signed char mul = 1;
498  for (; itStripOther != itChamber->second.end() && !otherStripFound; ++itStripOther) {
499  for (L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
500  itConnOther != itStripOther->second.end();
501  ++itConnOther) {
502  if (itConnOther->m_tower == itConn->m_tower && itConnOther->m_PAC == itConn->m_PAC &&
503  itConnOther->m_logplane == itConn->m_logplane) // connection to same PAC,logplane
504  {
505  otherStripFound = true;
506  if ((itStripOther->first - itStrip->first) * (itConnOther->m_logstrip - itConn->m_logstrip) < 0) {
507  mul = -1;
508  }
509  break;
510  }
511  } // otherConnections iter ends
512  } // otherStrip iter ends
513 
514  /*
515  if (itConn->m_tower==3 && itConn->m_PAC==73 && itConn->m_logplane==4 && detId==637569977){
516  std::cout << " Buld cons for strip " << (int)itStrip->first;
517  if (otherStripFound)
518  std::cout << " other strip " << itStrip->first;
519  else
520  std::cout << " no other strip ";
521 
522  std::cout << std::endl;
523 
524  }*/
525 
527  nCompConn.m_tower = itConn->m_tower;
528  nCompConn.m_PAC = itConn->m_PAC;
529  nCompConn.m_logplane = itConn->m_logplane;
530  nCompConn.m_mul = mul;
531  nCompConn.m_offset = itConn->m_logstrip - mul * (signed short)(itStrip->first);
532  nCompConn.addStrip(itStrip->first);
533 
534  if (otherStripFound) {
535  } else {
536  // uncompressedConsLeft[detId][itStrip->first].push_back(*itConn);
537  // ++uncompressedConsAfter;
538  }
539  (*m_compressedConnectionMap)[detId].push_back(nCompConn);
540  ++compressedCons;
541 
542  } // if(!allreadyDone)
543  } // iterate on connections
544  } // iterate on strips
545  } // iterate on chambers
546 
547  // 159 -87
548  //std::cout << offsetMax << " TT " << offsetMin << std::endl;
549 
550  edm::LogInfo("RPCTriggerConfig") << " Compressed: " << compressedCons << " "
552  << " Uncompressed before: " << uncompressedConsBefore << " "
553  << sizeof(L1RPCConeBuilder::TStripCon)
554  << " Uncompressed after: " << uncompressedConsAfter << " "
555  << sizeof(L1RPCConeBuilder::TStripCon);
556  m_connectionsMap = uncompressedConsLeft;
557 }
std::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
Definition: RPCStripsRing.h:92
void addStrip(unsigned char strip)
Log< level::Info, false > LogInfo
std::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
Definition: RPCStripsRing.h:93
Log< level::Warning, false > LogWarning
void RPCStripsRing::createOtherConnections ( int  tower,
int  PACno,
int  logplane,
int  logplanesize,
float  angle 
)

Definition at line 361 of file RPCStripsRing.cc.

References SplitLinear::begin, dataset::end, Exception, mps_fire::i, isReferenceRing(), cuda_std::lower_bound(), L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, L1RPCConeBuilder::TStripCon::m_tower, and hgcalTowerProducer_cfi::tower.

361  {
362  //std::cout << " OtherCon for " << getRingId() << std::endl;
363 
364  if (this->isReferenceRing()) {
365  throw cms::Exception("RPCInternal") << " RPCStripsRing::createOtherConnections "
366  << " called for reference ring \n";
367  }
368 
369  RPCStripsRing::const_iterator it = this->lower_bound(angle);
370 
371  if (it == this->end())
372  it = this->begin();
373 
374  for (int i = 0; i < logplaneSize / 2; i++) {
375  if (it == this->begin())
376  it = this->end(); // (m_stripPhiMap.end()--) is ok.
377 
378  --it;
379  }
380 
381  for (int i = 0; i < logplaneSize; i++) {
382  if (!it->second.isVirtual()) {
384  newCon.m_tower = tower;
385  newCon.m_PAC = PACno;
386  newCon.m_logplane = logplane;
387  newCon.m_logstrip = i;
388  (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
389  //std::cout << " Adding other connection " << std::endl;
390  }
391 
392  ++it;
393  if (it == this->end())
394  it = this->begin();
395  }
396 }
bool isReferenceRing()
Definition: RPCStripsRing.h:73
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
string end
Definition: dataset.py:937
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void RPCStripsRing::createRefConnections ( TOtherConnStructVec otherRings,
int  logplane,
int  logplaneSize 
)

Definition at line 249 of file RPCStripsRing.cc.

References funct::abs(), angle(), SplitLinear::begin, dataset::end, Exception, first, getTowerForRefRing(), mps_fire::i, isReferenceRing(), L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, L1RPCConeBuilder::TStripCon::m_tower, hltrates_dqm_sourceclient-live_cfg::offset, phi, and pi.

249  {
250  //*
251  /*std::cout << "RefCon for " << getRingId()
252  << " (" << getEtaPartition()<< ")"
253  << " tower: " << getTowerForRefRing()
254  << " ; connected: "
255  << otherRings.size()
256  << std::endl
257  << std::endl;
258  //*/
259 
260  // XXX - TODO: warning on wrong logplaneSize
261 
262  if (!this->isReferenceRing()) {
263  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
264  << " called for non-reference ring \n";
265  }
266 
267  /*
268  if (logplaneSize!=8) {
269  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
270  << " called for lpSize " << logplaneSize << " \n";
271 
272  }*/
273  const float pi = 3.141592654;
274  const float offset = (5. / 360.) * 2 * pi; // XXX
275 
276  //find first reference strip of first PAC (the strip with phi ~= 5deg)
277  RPCStripsRing::iterator starEndIt = this->begin();
278  while ((++starEndIt)->first < offset)
279  ;
280 
281  RPCStripsRing::iterator it = starEndIt;
282  //--starEndIt;
283 
284  float angle = 0;
285  int curPACno = -1;
286  int curStripNo = 0;
287  int curBegStripNo = 0;
288 
289  bool firstIter = true;
290 
291  while (it != starEndIt || firstIter) { // iterate over strips
292 
293  firstIter = false;
294  // New PAC
295  if (curStripNo % logplaneSize == 0) {
296  ++curPACno;
297  curBegStripNo = curStripNo;
298  RPCStripsRing::iterator plus8 = it;
299  bool skipOccured = false;
300  for (int i = 0; i < 7; ++i) {
301  ++plus8;
302  if (plus8 == this->end()) {
303  plus8 = this->begin();
304  skipOccured = true;
305  }
306  }
307 
308  // calculate angle
309  float phi = it->first;
310  float phiP8 = plus8->first;
311  if (skipOccured) {
312  // phiP8 is negative
313  // phi is positive
314  // xcheck
315  if (phi * phiP8 > 0) {
316  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections phi/phi8 error \n";
317  }
318  angle = (2 * pi + phiP8 + phi) / 2;
319  if (angle > pi) { // should land on positive side
320  angle -= 2 * pi;
321  }
322 
323  if (std::abs(angle) > pi) {
324  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
325  << " problem with angle calc \n";
326  }
327  } else {
328  angle = (phiP8 + phi) / 2;
329  }
330  //std::cout << curPACno << " " << phiP8 << " " << phi << " " << angle << std::endl;
331 
332  TOtherConnStructVec::iterator itOt = otherRings.begin();
333  for (; itOt != otherRings.end(); ++itOt) {
334  itOt->m_it->second.createOtherConnections(
335  getTowerForRefRing(), curPACno, itOt->m_logplane, itOt->m_logplaneSize, angle);
336  }
337  }
338 
339  if (!it->second.isVirtual()) {
341  newCon.m_tower = getTowerForRefRing();
342  newCon.m_PAC = curPACno;
343  newCon.m_logplane = logplane;
344  newCon.m_logstrip = curStripNo - curBegStripNo;
345  //std::cout << " Adding con for " << it->second.m_detRawId << std::endl;
346  (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
347  //std::cout << " Adding ref connection " << std::endl;
348  }
349  ++curStripNo;
350  ++it;
351  if (it == this->end()) {
352  it = this->begin();
353  }
354 
355  } // iteration over strips ends
356 
357  //std::cout << " refcon: " << curPACno << " PACs" << std::endl;
358  //std::cout << "After refCon: " << m_connectionsMap.size() << std::endl;
359 }
int getTowerForRefRing()
const Double_t pi
bool isReferenceRing()
Definition: RPCStripsRing.h:73
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
string end
Definition: dataset.py:937
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void RPCStripsRing::fillWithVirtualStrips ( )

Definition at line 204 of file RPCStripsRing.cc.

References SplitLinear::begin, CommonMethods::delta(), dataset::end, mps_fire::i, edm::eventsetup::heterocontainer::insert(), isReferenceRing(), m_didVirtuals, m_hwPlane, and pi.

204  {
205  if (m_didVirtuals)
206  return;
207  m_didVirtuals = true;
208 
209  const float pi = 3.141592654;
210  double dphi = 2.0 * pi / 1152; // defines angular granulation of strips.
211 
212  RPCStripsRing stripsToInsert;
213 
214  float delta = 0;
215  int stripsToAdd = 0;
216 
217  RPCStripsRing::iterator it = this->begin();
218  RPCStripsRing::iterator itLast = this->begin();
219  for (; it != this->end(); ++it) {
220  /*std::cout << it->first << " "
221  << it->second.m_detRawId << " "
222  << (int)it->second.m_strip << std::endl;
223  */
224 
225  delta = it->first - itLast->first;
226  if (it == itLast || // skip first loop iteration
227  itLast->second.m_detRawId == it->second.m_detRawId || // insert strips between two chambers only
228  delta < 0) {
229  itLast = it;
230  continue;
231  }
232 
233  stripsToAdd = (int)std::floor(delta / dphi) - 1;
234  //std::cout << delta << " " << stripsToAdd << std::endl;
235 
236  if (isReferenceRing() && m_hwPlane == 6)
237  ++stripsToAdd;
238 
239  for (int i = 0; i < stripsToAdd; ++i) {
240  stripsToInsert[itLast->first + dphi * (i + 1)] = TStrip();
241  }
242 
243  itLast = it;
244  }
245  // TODO: check delta between first and last strip in map
246 
247  this->insert(stripsToInsert.begin(), stripsToInsert.end());
248 }
const Double_t pi
bool isReferenceRing()
Definition: RPCStripsRing.h:73
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
string end
Definition: dataset.py:937
void RPCStripsRing::filterOverlapingChambers ( )

Definition at line 135 of file RPCStripsRing.cc.

References SplitLinear::begin, dataset::end, Exception, m_didFiltering, m_hwPlane, and m_region.

135  {
136  if (m_didFiltering)
137  return;
138  m_didFiltering = true;
139 
140  if (m_region != 0 || m_hwPlane != 4)
141  return;
142 
143  typedef std::map<uint32_t, int> TDetId2StripNo;
144  TDetId2StripNo det2stripNo;
145 
146  // Note: we begin in middle of first chamber (ch1), we have to handle that
147  int ch1BegStrips = 0; // no of strips on the begining of the map (first=last chamber of map)
148  int ch1EndStrips = 0; // no of strips on the end of the map (first=last chamber of map)
149 
150  // How many strips has each chamber?
151  RPCStripsRing::iterator it = this->begin();
152  uint32_t ch1Det = it->second.m_detRawId;
153  for (; it != this->end(); ++it) {
154  if (det2stripNo.find(it->second.m_detRawId) == det2stripNo.end()) {
155  det2stripNo[it->second.m_detRawId] = 1; // Add new chamber to a map, set strip cnt to 1
156  } else {
157  ++det2stripNo[it->second.m_detRawId]; // Increase strip count of a chamber
158  }
159 
160  if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) {
161  ++ch1BegStrips;
162  } else if (ch1Det == it->second.m_detRawId) {
163  ++ch1EndStrips;
164  }
165  }
166 
167  det2stripNo[ch1Det] -= ch1EndStrips;
168 
169  // std::cout << ch1BegStrips << " " << ch1EndStrips << std::endl;
170 
171  //TDetId2StripNo::iterator itIds = det2stripNo.begin();
172  //for(;itIds!=det2stripNo.end();++itIds){
173  // std::cout << itIds->first << " " << itIds->second << std::endl;
174  // }
175 
176  it = this->begin();
177  uint32_t lastDet = it->second.m_detRawId;
178  while (it != this->end()) {
179  if (det2stripNo[it->second.m_detRawId] < 0) {
180  throw cms::Exception("RPCInternal") << " RPCStripsRing::filterOverlapingChambers() - no strips left \n";
181  }
182  if (it->second.m_detRawId == lastDet) {
183  --det2stripNo[lastDet];
184  ++it;
185  } else if (det2stripNo[lastDet] == 0) { // no more strips left in lastDet, proceed to new det
186 
187  if (lastDet == ch1Det) {
188  det2stripNo[ch1Det] += ch1EndStrips;
189  }
190 
191  lastDet = it->second.m_detRawId;
192  --det2stripNo[lastDet];
193  ++it;
194  } else { // there are still strips in last det, delete current strip
195  --det2stripNo[it->second.m_detRawId];
196  RPCStripsRing::iterator itErase = it;
197  ++it;
198  //std::cout << "Removing strip " << it->second.m_detRawId << " " << (int)it->second.m_strip << std::endl;
199  this->erase(itErase);
200  }
201  }
202 }
string end
Definition: dataset.py:937
std::shared_ptr<L1RPCConeBuilder::TCompressedConMap> RPCStripsRing::getCompressedConnectionsMap ( )
inline

Definition at line 79 of file RPCStripsRing.h.

References m_compressedConnectionMap.

79  {
81  };
std::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
Definition: RPCStripsRing.h:93
std::shared_ptr<L1RPCConeBuilder::TConMap> RPCStripsRing::getConnectionsMap ( )
inline

Definition at line 77 of file RPCStripsRing.h.

References m_connectionsMap.

77 { return m_connectionsMap; };
std::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
Definition: RPCStripsRing.h:92
int RPCStripsRing::getEtaPartition ( )
inline

Definition at line 72 of file RPCStripsRing.h.

References m_etaPartition.

Referenced by getTowerForRefRing().

72 { return m_etaPartition; };
int RPCStripsRing::getHwPlane ( )
inline

Definition at line 70 of file RPCStripsRing.h.

References m_hwPlane.

70 { return m_hwPlane; };
int RPCStripsRing::getRingId ( int  etaPart,
int  hwPlane 
)
static

Definition at line 76 of file RPCStripsRing.cc.

References funct::abs(), and jetcorrextractor::sign().

76  {
77  int sign = 1; // positive
78  if (etaPart < 0) {
79  sign = 0;
80  }
81 
82  return 1000 * (hwPlane) + //1...6
83  100 * (sign) + //
84  1 * (std::abs(etaPart)); //-17...17
85 }
double sign(double x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int RPCStripsRing::getRingId ( )

Definition at line 87 of file RPCStripsRing.cc.

References m_etaPartition, and m_hwPlane.

Referenced by addRoll(), RPCConeBuilder::buildCones(), getRingId(), and RPCStripsRing().

int RPCStripsRing::getRingId ( const RPCRoll roll)
static

Calculate ringId for this ring.

Definition at line 89 of file RPCStripsRing.cc.

References calculateHwPlane(), RPCGeomServ::eta_partition(), getRingId(), and RPCRoll::id().

89  {
90  RPCDetId detId = roll->id();
91  RPCGeomServ grs(detId);
92  int etaPartition = grs.eta_partition();
93  int hwPlane = calculateHwPlane(roll);
94 
95  return getRingId(etaPartition, hwPlane);
96 }
RPCDetId id() const
Definition: RPCRoll.cc:16
static int calculateHwPlane(const RPCRoll *roll)
Calculate ringId for any given RPCRoll.
int RPCStripsRing::getTowerForRefRing ( )

Definition at line 399 of file RPCStripsRing.cc.

References funct::abs(), Exception, getEtaPartition(), isReferenceRing(), runTheMatrix::ret, and jetcorrextractor::sign().

Referenced by createRefConnections().

399  {
400  int ret = 0;
401 
402  if (!this->isReferenceRing()) {
403  throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() "
404  << " called for non reference ring \n";
405  }
406 
407  int etaAbs = std::abs(getEtaPartition());
408  if (etaAbs < 8) {
409  ret = getEtaPartition();
410  } else if (etaAbs > 8) {
411  int sign = (getEtaPartition() > 0 ? 1 : -1);
412  ret = getEtaPartition() - sign;
413  } else {
414  throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() "
415  << " called for etaPartition 8 \n";
416  }
417 
418  return ret;
419 }
tuple ret
prodAgent to be discontinued
double sign(double x)
bool isReferenceRing()
Definition: RPCStripsRing.h:73
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getEtaPartition()
Definition: RPCStripsRing.h:72
bool RPCStripsRing::isReferenceRing ( )
inline

Member Data Documentation

std::shared_ptr<L1RPCConeBuilder::TCompressedConMap> RPCStripsRing::m_compressedConnectionMap
private

Definition at line 93 of file RPCStripsRing.h.

Referenced by compressConnections(), and getCompressedConnectionsMap().

std::shared_ptr<L1RPCConeBuilder::TConMap> RPCStripsRing::m_connectionsMap
private

Definition at line 92 of file RPCStripsRing.h.

Referenced by compressConnections(), and getConnectionsMap().

bool RPCStripsRing::m_didFiltering
private

Definition at line 90 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers().

bool RPCStripsRing::m_didVirtuals
private

Definition at line 89 of file RPCStripsRing.h.

Referenced by fillWithVirtualStrips().

int RPCStripsRing::m_etaPartition
private

Definition at line 85 of file RPCStripsRing.h.

Referenced by getEtaPartition(), getRingId(), and RPCStripsRing().

int RPCStripsRing::m_hwPlane
private
bool RPCStripsRing::m_isReferenceRing
private

Definition at line 88 of file RPCStripsRing.h.

Referenced by isReferenceRing(), and RPCStripsRing().

int RPCStripsRing::m_region
private

Definition at line 86 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers(), and RPCStripsRing().