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 38 of file RPCStripsRing.h.

Member Typedef Documentation

Definition at line 43 of file RPCStripsRing.h.

Definition at line 53 of file RPCStripsRing.h.

Constructor & Destructor Documentation

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

Definition at line 34 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(), relativeConstraints::ring, and RPCDetId::ring().

35  :
36  m_didVirtuals(false),
37  m_didFiltering(false),
38  m_connectionsMap(cmap)
39 {
40 
41  RPCDetId detId = roll->id();
42  RPCGeomServ grs(detId);
43 
44  m_etaPartition = grs.eta_partition();
46 
47  m_isReferenceRing = false;
48 
49  m_region = detId.region();
50 
51  int ring = detId.ring();
52 
53  if (m_region == 0 && std::abs(ring)<2 && m_hwPlane == 2) // for barell wheel -1,0,1 refplane is hwPlane=2
54  m_isReferenceRing = true;
55  else if (m_region == 0 && std::abs(ring)==2 && m_hwPlane == 6) // for barell wheel -2,2 refplane is hwPlane=6
56  m_isReferenceRing = true;
57  else if (m_region != 0 && m_hwPlane == 2) // for endcaps
58  m_isReferenceRing = true;
59 
60 
61  if( getRingId() == 2008 || getRingId() == 2108) //exception: endcaps;hwplane 2;farest roll from beam
62  m_isReferenceRing = false;
63 
64  addRoll(roll);
65 }
RPCDetId id() const
Definition: RPCRoll.cc:24
int ring() const
Definition: RPCDetId.h:72
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:63
RPCStripsRing::RPCStripsRing ( )

Definition at line 23 of file RPCStripsRing.cc.

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

Definition at line 60 of file RPCStripsRing.h.

60 {};

Member Function Documentation

void RPCStripsRing::addRoll ( const RPCRoll roll)

Definition at line 68 of file RPCStripsRing.cc.

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

Referenced by RPCStripsRing().

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

Calculate ringId for any given RPCRoll.

Definition at line 124 of file RPCStripsRing.cc.

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

Referenced by getRingId(), and RPCStripsRing().

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

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

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

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

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

References funct::abs(), angle(), begin, end, Exception, plotBeamSpotDB::first, getTowerForRefRing(), 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.

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

Definition at line 244 of file RPCStripsRing.cc.

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

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

Definition at line 166 of file RPCStripsRing.cc.

References begin, end, Exception, m_didFiltering, m_hwPlane, and m_region.

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

Definition at line 89 of file RPCStripsRing.h.

References m_compressedConnectionMap.

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

Definition at line 86 of file RPCStripsRing.h.

References m_connectionsMap.

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

Definition at line 81 of file RPCStripsRing.h.

References m_etaPartition.

Referenced by getTowerForRefRing().

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

Definition at line 79 of file RPCStripsRing.h.

References m_hwPlane.

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

Definition at line 90 of file RPCStripsRing.cc.

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

90  {
91 
92  int sign = 1; // positive
93  if (etaPart < 0){
94  sign = 0;
95  }
96 
97  return 1000*(hwPlane) + //1...6
98  100*( sign ) + //
99  1*( std::abs(etaPart) ); //-17...17
100 
101 }
double sign(double x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int RPCStripsRing::getRingId ( )

Definition at line 103 of file RPCStripsRing.cc.

References m_etaPartition, and m_hwPlane.

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

103  {
104 
106 
107 }
int RPCStripsRing::getRingId ( const RPCRoll roll)
static

Calculate ringId for this ring.

Definition at line 109 of file RPCStripsRing.cc.

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

109  {
110 
111 
112  RPCDetId detId = roll->id();
113  RPCGeomServ grs(detId);
114  int etaPartition = grs.eta_partition();
115  int hwPlane = calculateHwPlane(roll);
116 
117  return getRingId(etaPartition, hwPlane);
118 
119 }
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 465 of file RPCStripsRing.cc.

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

Referenced by createRefConnections().

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

Member Data Documentation

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

Definition at line 106 of file RPCStripsRing.h.

Referenced by compressConnections(), and getCompressedConnectionsMap().

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

Definition at line 105 of file RPCStripsRing.h.

Referenced by compressConnections(), and getConnectionsMap().

bool RPCStripsRing::m_didFiltering
private

Definition at line 103 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers().

bool RPCStripsRing::m_didVirtuals
private

Definition at line 102 of file RPCStripsRing.h.

Referenced by fillWithVirtualStrips().

int RPCStripsRing::m_etaPartition
private

Definition at line 98 of file RPCStripsRing.h.

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

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

Definition at line 101 of file RPCStripsRing.h.

Referenced by isReferenceRing(), and RPCStripsRing().

int RPCStripsRing::m_region
private

Definition at line 99 of file RPCStripsRing.h.

Referenced by filterOverlapingChambers(), and RPCStripsRing().