CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
boost::shared_ptr
< L1RPCConeBuilder::TCompressedConMap
getCompressedConnectionsMap ()
 
boost::shared_ptr
< L1RPCConeBuilder::TConMap
getConnectionsMap ()
 
int getEtaPartition ()
 
int getHwPlane ()
 
int getRingId ()
 
int getTowerForRefRing ()
 
bool isReferenceRing ()
 
 RPCStripsRing (const RPCRoll *roll, boost::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

boost::shared_ptr
< L1RPCConeBuilder::TCompressedConMap
m_compressedConnectionMap
 
boost::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 39 of file RPCStripsRing.h.

Member Typedef Documentation

Definition at line 44 of file RPCStripsRing.h.

Definition at line 54 of file RPCStripsRing.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file RPCStripsRing.cc.

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

36  :
37  m_didVirtuals(false),
38  m_didFiltering(false),
39  m_connectionsMap(cmap)
40 {
41 
42  RPCDetId detId = roll->id();
43  RPCGeomServ grs(detId);
44 
45  m_etaPartition = grs.eta_partition();
47 
48  m_isReferenceRing = false;
49 
50  m_region = detId.region();
51 
52  int ring = detId.ring();
53 
54  if (m_region == 0 && std::abs(ring)<2 && m_hwPlane == 2) // for barell wheel -1,0,1 refplane is hwPlane=2
55  m_isReferenceRing = true;
56  else if (m_region == 0 && std::abs(ring)==2 && m_hwPlane == 6) // for barell wheel -2,2 refplane is hwPlane=6
57  m_isReferenceRing = true;
58  else if (m_region != 0 && m_hwPlane == 2) // for endcaps
59  m_isReferenceRing = true;
60 
61 
62  if( getRingId() == 2008 || getRingId() == 2108) //exception: endcaps;hwplane 2;farest roll from beam
63  m_isReferenceRing = false;
64 
65  addRoll(roll);
66 }
#define abs(x)
Definition: mlp_lapack.h:159
RPCDetId id() const
Definition: RPCRoll.cc:24
int ring() const
Definition: RPCDetId.h:76
bool m_isReferenceRing
void addRoll(const RPCRoll *roll)
static int calculateHwPlane(const RPCRoll *roll)
Calculate ringId for any given RPCRoll.
boost::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
RPCStripsRing::RPCStripsRing ( )

Definition at line 24 of file RPCStripsRing.cc.

24  :
25  m_hwPlane(-1),
26  m_etaPartition(99),
27  m_region(-2),
28  m_isReferenceRing(false),
29  m_didVirtuals(false),
30  m_didFiltering(false)
31 {
32 
33 }
bool m_isReferenceRing
virtual RPCStripsRing::~RPCStripsRing ( )
inlinevirtual

Definition at line 61 of file RPCStripsRing.h.

61 {};

Member Function Documentation

void RPCStripsRing::addRoll ( const RPCRoll roll)

Definition at line 69 of file RPCStripsRing.cc.

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

Referenced by RPCStripsRing().

69  {
70 
71 // RPCDetId detId = roll->id();
72 
73  if (getRingId() != getRingId(roll) ){
74  throw cms::Exception("RPCInternal") << "RPCStripsRing::addRoll ringsIds dont match \n";
75  }
76 
77  //iterate over the strips of this roll
78  for (int i=1; i<=roll->nstrips(); i++ ) {
79 
80  LocalPoint lStripCentre = roll->centreOfStrip(i);
81  GlobalPoint gStripCentre = roll->toGlobal(lStripCentre);
82  float phiRaw = gStripCentre.phi();
83 
84  TStrip newStrip(roll->id().rawId(), i);
85  (*this)[phiRaw] = newStrip;
86 
87  }
88 
89 }
int i
Definition: DBlmapReader.cc:9
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
int nstrips() const
Definition: RPCRoll.cc:46
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
RPCDetId id() const
Definition: RPCRoll.cc:24
int RPCStripsRing::calculateHwPlane ( const RPCRoll roll)
static

Calculate ringId for any given RPCRoll.

Definition at line 125 of file RPCStripsRing.cc.

References edm::hlt::Exception, RPCRoll::id(), RPCDetId::layer(), RPCDetId::region(), relativeConstraints::station, and RPCDetId::station().

Referenced by getRingId(), and RPCStripsRing().

125  {
126 
127  int hwPlane = -1;
128  RPCDetId detId = roll->id();
129  int station = detId.station();
130  int layer = detId.layer();
131  int region = detId.region();
132 
133  if (region != 0){ // endcaps
134  hwPlane = station;
135  }
136  // Now comes the barell
137  else if ( station > 2 ){
138  hwPlane = station;
139  }
140  else if ( station == 1 && layer == 1) {
141  hwPlane = 1;
142  }
143  else if ( station == 1 && layer == 2) {
144  hwPlane = 5;
145  }
146  else if ( station == 2 && layer == 1) {
147  hwPlane = 2;
148  }
149  else if ( station == 2 && layer == 2) {
150  hwPlane = 6;
151  }
152 
153  /*if (hwPlane < 1)
154  std::cout << "prb: " << hwPlane << " "
155  << region << " "
156  << station << " "
157  << layer << std::endl;*/
158  if (hwPlane < 0) {
159  throw cms::Exception("RPCInternal") << "Calculated negative hwplane \n";
160  }
161 
162 
163  return hwPlane;
164 
165 }
RPCDetId id() const
Definition: RPCRoll.cc:24
int layer() const
Definition: RPCDetId.h:112
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
int station() const
Definition: RPCDetId.h:100
void RPCStripsRing::compressConnections ( )

Definition at line 515 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.

515  {
516 
517 
518  L1RPCConeBuilder::TConMap::iterator itChamber = m_connectionsMap->begin();
519 
520  boost::shared_ptr<L1RPCConeBuilder::TConMap > uncompressedConsLeft
521  = boost::shared_ptr<L1RPCConeBuilder::TConMap >(new L1RPCConeBuilder::TConMap());
522 
524  boost::shared_ptr<L1RPCConeBuilder::TCompressedConMap >
526 
527 
528  int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
529 
530 // int offsetMin =0, offsetMax =0;
531 
532  for( ;itChamber!=m_connectionsMap->end(); ++itChamber ){
533 
534  uint32_t detId = itChamber->first;
535 
536  for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
537  itStrip!=itChamber->second.end();
538  ++itStrip)
539  {
540 
541  // Iterate over strip Connections
542  for(L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin();
543  itConn!=itStrip->second.end();
544  ++itConn)
545  {
546  // Check if this connection isn't allready present in the compressed map
547  ++uncompressedConsBefore;
548  bool alreadyDone=false;
549  if (m_compressedConnectionMap->find(detId)!=m_compressedConnectionMap->end()){
550 
551  // iterate over the vec, check element by element
552  for(L1RPCConeBuilder::TCompressedConVec::iterator itCompConn=(*m_compressedConnectionMap)[detId].begin();
553  itCompConn!=(*m_compressedConnectionMap)[detId].end();
554  ++itCompConn)
555  {
556  if (itCompConn->m_tower == itConn->m_tower
557  && itCompConn->m_PAC == itConn->m_PAC
558  && itCompConn->m_logplane == itConn->m_logplane) // connection allready compressed
559  {
560  alreadyDone=true;
561 
562  int logStrip = itCompConn->m_mul*itStrip->first+itCompConn->m_offset;
563  if (logStrip != itConn->m_logstrip){
564  //copy the problematic connection to the "safe" map
565  (*uncompressedConsLeft)[detId][itStrip->first].push_back(*itConn);
566  ++uncompressedConsAfter;
567  edm::LogWarning("RPCTriggerConfig") << " Compression failed for det " << detId
568  << " strip " << (int)itStrip->first
569  << " . Got " << (int)logStrip
570  << " expected " << (int)itConn->m_logstrip
571  << std::endl;
572  } else {
573  itCompConn->addStrip(itStrip->first);
574  }
575 
576  }
577  } // compressed connection iteration end
578  }
579  //if (detId==637569977) std::cout << " Buld cons for strip " << (int)itStrip->first << std::endl;
580 
581 
582  if (!alreadyDone){
583  // find another strip contributing to the same PAC,tower,logplane
584  L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
585  ++itStripOther;
586  bool otherStripFound = false;
587  signed char mul = 1;
588  for (;itStripOther!=itChamber->second.end() && !otherStripFound;
589  ++itStripOther)
590  {
591  for(L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
592  itConnOther!=itStripOther->second.end();
593  ++itConnOther)
594  {
595  if (itConnOther->m_tower == itConn->m_tower
596  && itConnOther->m_PAC == itConn->m_PAC
597  && itConnOther->m_logplane == itConn->m_logplane) // connection to same PAC,logplane
598  {
599  otherStripFound = true;
600  if ( (itStripOther->first-itStrip->first)*(itConnOther->m_logstrip-itConn->m_logstrip) < 0 ){
601  mul = -1;
602  }
603  break;
604  }
605  } // otherConnections iter ends
606  } // otherStrip iter ends
607 
608  /*
609  if (itConn->m_tower==3 && itConn->m_PAC==73 && itConn->m_logplane==4 && detId==637569977){
610  std::cout << " Buld cons for strip " << (int)itStrip->first;
611  if (otherStripFound)
612  std::cout << " other strip " << itStrip->first;
613  else
614  std::cout << " no other strip ";
615 
616  std::cout << std::endl;
617 
618  }*/
619 
621  nCompConn.m_tower = itConn->m_tower;
622  nCompConn.m_PAC = itConn->m_PAC;
623  nCompConn.m_logplane = itConn->m_logplane;
624  nCompConn.m_mul = mul;
625  nCompConn.m_offset = itConn->m_logstrip - mul*(signed short)(itStrip->first);
626  nCompConn.addStrip(itStrip->first);
627 
628  if (otherStripFound){
629 
630  } else {
631 
632  // uncompressedConsLeft[detId][itStrip->first].push_back(*itConn);
633  // ++uncompressedConsAfter;
634  }
635  (*m_compressedConnectionMap)[detId].push_back(nCompConn);
636  ++compressedCons;
637 
638 
639  } // if(!allreadyDone)
640  }// iterate on connections
641  }// iterate on strips
642  } // iterate on chambers
643 
644  // 159 -87
645  //std::cout << offsetMax << " TT " << offsetMin << std::endl;
646 
647  edm::LogInfo("RPCTriggerConfig")
648  << " Compressed: " << compressedCons<< " " << sizeof(L1RPCConeBuilder::TCompressedCon)
649  << " Uncompressed before: " << uncompressedConsBefore<< " " << sizeof(L1RPCConeBuilder::TStripCon)
650  << " Uncompressed after: " << uncompressedConsAfter << " " << sizeof(L1RPCConeBuilder::TStripCon);
651  m_connectionsMap = uncompressedConsLeft;
652 
653 }
void addStrip(unsigned char strip)
std::map< uint32_t, TStrip2ConVec > TConMap
std::map< uint32_t, TCompressedConVec > TCompressedConMap
boost::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
boost::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
void RPCStripsRing::createOtherConnections ( int  tower,
int  PACno,
int  logplane,
int  logplanesize,
float  angle 
)

Definition at line 421 of file RPCStripsRing.cc.

References begin, end, edm::hlt::Exception, i, isReferenceRing(), L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, and L1RPCConeBuilder::TStripCon::m_tower.

421  {
422 
423  //std::cout << " OtherCon for " << getRingId() << std::endl;
424 
425  if(this->isReferenceRing()){
426  throw cms::Exception("RPCInternal") << " RPCStripsRing::createOtherConnections "
427  << " called for reference ring \n";
428  }
429 
430 
431  RPCStripsRing::const_iterator it = this->lower_bound(angle);
432 
433 
434  if (it == this->end())
435  it = this->begin();
436 
437  for (int i=0; i < logplaneSize/2; i++){
438 
439  if (it==this->begin())
440  it=this->end(); // (m_stripPhiMap.end()--) is ok.
441 
442  --it;
443  }
444 
445 
446  for (int i=0; i < logplaneSize; i++){
447 
448  if (! it->second.isVirtual() ){
450  newCon.m_tower = tower;
451  newCon.m_PAC = PACno;
452  newCon.m_logplane = logplane;
453  newCon.m_logstrip= i;
454  (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
455  //std::cout << " Adding other connection " << std::endl;
456  }
457 
458  ++it;
459  if (it==this->end())
460  it=this->begin();
461  }
462 
463 }
int i
Definition: DBlmapReader.cc:9
bool isReferenceRing()
Definition: RPCStripsRing.h:83
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
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 301 of file RPCStripsRing.cc.

References abs, angle(), begin, end, edm::hlt::Exception, first, getTowerForRefRing(), i, isReferenceRing(), L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, L1RPCConeBuilder::TStripCon::m_tower, evf::evtn::offset(), phi, and pi.

302 {
303  //*
304  /*std::cout << "RefCon for " << getRingId()
305  << " (" << getEtaPartition()<< ")"
306  << " tower: " << getTowerForRefRing()
307  << " ; connected: "
308  << otherRings.size()
309  << std::endl
310  << std::endl;
311  //*/
312 
313  // XXX - TODO: warning on wrong logplaneSize
314 
315  if(!this->isReferenceRing()){
316  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
317  << " called for non-reference ring \n";
318  }
319 
320  /*
321  if (logplaneSize!=8) {
322  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
323  << " called for lpSize " << logplaneSize << " \n";
324 
325  }*/
326  const float pi = 3.141592654;
327  const float offset = (5./360.)*2*pi; // XXX
328 
329  //find first reference strip of first PAC (the strip with phi ~= 5deg)
330  RPCStripsRing::iterator starEndIt = this->begin();
331  while ( (++starEndIt)->first < offset );
332 
333  RPCStripsRing::iterator it = starEndIt;
334  //--starEndIt;
335 
336  float angle = 0;
337  int curPACno = -1;
338  int curStripNo = 0;
339  int curBegStripNo=0;
340 
341  bool firstIter = true;
342 
343  while(it!=starEndIt || firstIter ) { // iterate over strips
344 
345 
346  firstIter = false;
347  // New PAC
348  if(curStripNo%logplaneSize==0){
349  ++curPACno;
350  curBegStripNo=curStripNo;
351  RPCStripsRing::iterator plus8 = it;
352  bool skipOccured = false;
353  for (int i=0;i<7;++i){
354  ++plus8;
355  if (plus8==this->end()){
356  plus8=this->begin();
357  skipOccured = true;
358  }
359  }
360 
361  // calculate angle
362  float phi= it->first;
363  float phiP8= plus8->first;
364  if (skipOccured){
365  // phiP8 is negative
366  // phi is positive
367  // xcheck
368  if (phi*phiP8 > 0){
369  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections phi/phi8 error \n";
370  }
371  angle = (2*pi+phiP8+phi)/2;
372  if(angle > pi){ // should land on positive side
373  angle -= 2*pi;
374  }
375 
376  if (std::abs(angle) > pi) {
377  throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections "
378  << " problem with angle calc \n";
379  }
380  }
381  else {
382  angle = (phiP8+phi)/2;
383  }
384  //std::cout << curPACno << " " << phiP8 << " " << phi << " " << angle << std::endl;
385 
386 
387  TOtherConnStructVec::iterator itOt = otherRings.begin();
388  for (;itOt!=otherRings.end();++itOt){
389  itOt->m_it->second.createOtherConnections(getTowerForRefRing(),
390  curPACno,
391  itOt->m_logplane,
392  itOt->m_logplaneSize,
393  angle);
394  }
395  }
396 
397 
398  if ( !it->second.isVirtual() ){
400  newCon.m_tower = getTowerForRefRing();
401  newCon.m_PAC = curPACno;
402  newCon.m_logplane = logplane;
403  newCon.m_logstrip=curStripNo-curBegStripNo;
404  //std::cout << " Adding con for " << it->second.m_detRawId << std::endl;
405  (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
406  //std::cout << " Adding ref connection " << std::endl;
407  }
408  ++curStripNo;
409  ++it;
410  if (it==this->end()){
411  it=this->begin();
412  }
413 
414  } // iteration over strips ends
415 
416  //std::cout << " refcon: " << curPACno << " PACs" << std::endl;
417  //std::cout << "After refCon: " << m_connectionsMap.size() << std::endl;
418 
419 }
int i
Definition: DBlmapReader.cc:9
int getTowerForRefRing()
#define abs(x)
Definition: mlp_lapack.h:159
const Double_t pi
bool isReferenceRing()
Definition: RPCStripsRing.h:83
#define end
Definition: vmac.h:38
unsigned int offset(bool)
bool first
Definition: L1TdeRCT.cc:94
#define begin
Definition: vmac.h:31
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
Definition: DDAxes.h:10
void RPCStripsRing::fillWithVirtualStrips ( )

Definition at line 245 of file RPCStripsRing.cc.

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

246 {
247 
248 
249  if(m_didVirtuals) return;
250  m_didVirtuals = true;
251 
252  const float pi = 3.141592654;
253  double dphi=2.0*pi/1152; // defines angular granulation of strips.
254 
255  RPCStripsRing stripsToInsert;
256 
257 
258  float delta = 0;
259  int stripsToAdd = 0;
260 
261 
262  RPCStripsRing::iterator it = this->begin();
263  RPCStripsRing::iterator itLast = this->begin();
264  for (; it!=this->end(); ++it){
265 
266  /*std::cout << it->first << " "
267  << it->second.m_detRawId << " "
268  << (int)it->second.m_strip << std::endl;
269  */
270 
271  delta = it->first - itLast->first;
272  if (it == itLast || // skip first loop iteration
273  itLast->second.m_detRawId == it->second.m_detRawId || // insert strips between two chambers only
274  delta < 0)
275  {
276  itLast = it;
277  continue;
278  }
279 
280 
281  stripsToAdd = (int)std::floor(delta/dphi)-1;
282  //std::cout << delta << " " << stripsToAdd << std::endl;
283 
284  if ( isReferenceRing() && m_hwPlane==6) ++stripsToAdd;
285 
286  for (int i = 0;i<stripsToAdd;++i){
287 
288  stripsToInsert[itLast->first+dphi*(i+1)]=TStrip();
289 
290  }
291 
292  itLast = it;
293  }
294  // TODO: check delta between first and last strip in map
295 
296  this->insert(stripsToInsert.begin(),stripsToInsert.end());
297 
298 
299 
300 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
const Double_t pi
bool isReferenceRing()
Definition: RPCStripsRing.h:83
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
bool insert(Storage &, ItemType *, const IdTag &)
void RPCStripsRing::filterOverlapingChambers ( )

Definition at line 167 of file RPCStripsRing.cc.

References begin, end, edm::hlt::Exception, m_didFiltering, m_hwPlane, and m_region.

167  {
168 
169  if(m_didFiltering) return;
170  m_didFiltering = true;
171 
172  if (m_region != 0 || m_hwPlane != 4)
173  return;
174 
175  typedef std::map<uint32_t,int> TDetId2StripNo;
176  TDetId2StripNo det2stripNo;
177 
178  // Note: we begin in middle of first chamber (ch1), we have to handle that
179  int ch1BegStrips = 0; // no of strips on the begining of the map (first=last chamber of map)
180  int ch1EndStrips = 0; // no of strips on the end of the map (first=last chamber of map)
181 
182  // How many strips has each chamber?
183  RPCStripsRing::iterator it = this->begin();
184  uint32_t ch1Det = it->second.m_detRawId;
185  for (; it!=this->end(); ++it){
186 
187  if ( det2stripNo.find(it->second.m_detRawId) == det2stripNo.end()){
188  det2stripNo[it->second.m_detRawId]=1; // Add new chamber to a map, set strip cnt to 1
189  } else {
190  ++det2stripNo[it->second.m_detRawId]; // Increase strip count of a chamber
191  }
192 
193  if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) {
194  ++ch1BegStrips;
195  } else if (ch1Det == it->second.m_detRawId){
196  ++ch1EndStrips;
197  }
198 
199  }
200 
201  det2stripNo[ch1Det]-=ch1EndStrips;
202 
203  // std::cout << ch1BegStrips << " " << ch1EndStrips << std::endl;
204 
205  //TDetId2StripNo::iterator itIds = det2stripNo.begin();
206  //for(;itIds!=det2stripNo.end();++itIds){
207 // std::cout << itIds->first << " " << itIds->second << std::endl;
208 // }
209 
210 
211 
212  it = this->begin();
213  uint32_t lastDet = it->second.m_detRawId;
214  while ( it!=this->end() ){
215 
216  if (det2stripNo[it->second.m_detRawId] < 0) {
217  throw cms::Exception("RPCInternal") << " RPCStripsRing::filterOverlapingChambers() - no strips left \n";
218  }
219  if ( it->second.m_detRawId == lastDet) {
220  --det2stripNo[lastDet];
221  ++it;
222  } else if (det2stripNo[lastDet] == 0) { // no more strips left in lastDet, proceed to new det
223 
224  if (lastDet == ch1Det) {
225  det2stripNo[ch1Det]+=ch1EndStrips;
226  }
227 
228  lastDet = it->second.m_detRawId;
229  --det2stripNo[lastDet];
230  ++it;
231  } else { // there are still strips in last det, delete current strip
232  --det2stripNo[it->second.m_detRawId];
233  RPCStripsRing::iterator itErase = it;
234  ++it;
235  //std::cout << "Removing strip " << it->second.m_detRawId << " " << (int)it->second.m_strip << std::endl;
236  this->erase(itErase);
237  }
238 
239  }
240 
241 
242 
243 }
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
boost::shared_ptr<L1RPCConeBuilder::TCompressedConMap> RPCStripsRing::getCompressedConnectionsMap ( )
inline

Definition at line 90 of file RPCStripsRing.h.

References m_compressedConnectionMap.

91  {
93  };
boost::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
boost::shared_ptr<L1RPCConeBuilder::TConMap > RPCStripsRing::getConnectionsMap ( )
inline

Definition at line 87 of file RPCStripsRing.h.

References m_connectionsMap.

88  { return m_connectionsMap;};
boost::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
int RPCStripsRing::getEtaPartition ( )
inline

Definition at line 82 of file RPCStripsRing.h.

References m_etaPartition.

Referenced by getTowerForRefRing().

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

Definition at line 80 of file RPCStripsRing.h.

References m_hwPlane.

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

Definition at line 91 of file RPCStripsRing.cc.

References abs.

91  {
92 
93  int sign = 1; // positive
94  if (etaPart < 0){
95  sign = 0;
96  }
97 
98  return 1000*(hwPlane) + //1...6
99  100*( sign ) + //
100  1*( std::abs(etaPart) ); //-17...17
101 
102 }
#define abs(x)
Definition: mlp_lapack.h:159
int RPCStripsRing::getRingId ( )

Definition at line 104 of file RPCStripsRing.cc.

References m_etaPartition, and m_hwPlane.

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

104  {
105 
107 
108 }
int RPCStripsRing::getRingId ( const RPCRoll roll)
static

Calculate ringId for this ring.

Definition at line 110 of file RPCStripsRing.cc.

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

110  {
111 
112 
113  RPCDetId detId = roll->id();
114  RPCGeomServ grs(detId);
115  int etaPartition = grs.eta_partition();
116  int hwPlane = calculateHwPlane(roll);
117 
118  return getRingId(etaPartition, hwPlane);
119 
120 }
RPCDetId id() const
Definition: RPCRoll.cc:24
static int calculateHwPlane(const RPCRoll *roll)
Calculate ringId for any given RPCRoll.
int RPCStripsRing::getTowerForRefRing ( )

Definition at line 466 of file RPCStripsRing.cc.

References abs, edm::hlt::Exception, getEtaPartition(), isReferenceRing(), and run_regression::ret.

Referenced by createRefConnections().

466  {
467 
468  int ret = 0;
469 
470  if(!this->isReferenceRing()){
471  throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() "
472  << " called for non reference ring \n";
473  }
474 
475  int etaAbs = std::abs(getEtaPartition());
476  if (etaAbs < 8) {
477  ret = getEtaPartition();
478  } else if (etaAbs > 8) {
479  int sign = (getEtaPartition() > 0 ? 1 : -1);
480  ret = getEtaPartition()-sign;
481  } else {
482  throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() "
483  << " called for etaPartition 8 \n";
484  }
485 
486 
487 
488  return ret;
489 
490 }
#define abs(x)
Definition: mlp_lapack.h:159
bool isReferenceRing()
Definition: RPCStripsRing.h:83
int getEtaPartition()
Definition: RPCStripsRing.h:82
bool RPCStripsRing::isReferenceRing ( )
inline

Member Data Documentation

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

Definition at line 107 of file RPCStripsRing.h.

Referenced by compressConnections(), and getCompressedConnectionsMap().

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

Definition at line 106 of file RPCStripsRing.h.

Referenced by compressConnections(), and getConnectionsMap().

bool RPCStripsRing::m_didFiltering
private

Definition at line 104 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers().

bool RPCStripsRing::m_didVirtuals
private

Definition at line 103 of file RPCStripsRing.h.

Referenced by fillWithVirtualStrips().

int RPCStripsRing::m_etaPartition
private

Definition at line 99 of file RPCStripsRing.h.

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

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

Definition at line 102 of file RPCStripsRing.h.

Referenced by isReferenceRing(), and RPCStripsRing().

int RPCStripsRing::m_region
private

Definition at line 100 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers(), and RPCStripsRing().