27 m_isReferenceRing(
false),
35 std::shared_ptr<L1RPCConeBuilder::TConMap > cmap) :
37 m_didFiltering(
false),
38 m_connectionsMap(cmap)
73 throw cms::Exception(
"RPCInternal") <<
"RPCStripsRing::addRoll ringsIds dont match \n";
81 float phiRaw = gStripCentre.
phi();
84 (*this)[phiRaw] = newStrip;
97 return 1000*(hwPlane) +
129 int layer = detId.
layer();
136 else if ( station > 2 ){
139 else if ( station == 1 && layer == 1) {
142 else if ( station == 1 && layer == 2) {
145 else if ( station == 2 && layer == 1) {
148 else if ( station == 2 && layer == 2) {
158 throw cms::Exception(
"RPCInternal") <<
"Calculated negative hwplane \n";
174 typedef std::map<uint32_t,int> TDetId2StripNo;
175 TDetId2StripNo det2stripNo;
178 int ch1BegStrips = 0;
179 int ch1EndStrips = 0;
182 RPCStripsRing::iterator it = this->
begin();
183 uint32_t ch1Det = it->second.m_detRawId;
184 for (; it!=this->
end(); ++it){
186 if ( det2stripNo.find(it->second.m_detRawId) == det2stripNo.end()){
187 det2stripNo[it->second.m_detRawId]=1;
189 ++det2stripNo[it->second.m_detRawId];
192 if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) {
194 }
else if (ch1Det == it->second.m_detRawId){
200 det2stripNo[ch1Det]-=ch1EndStrips;
212 uint32_t lastDet = it->second.m_detRawId;
213 while ( it!=this->
end() ){
215 if (det2stripNo[it->second.m_detRawId] < 0) {
216 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::filterOverlapingChambers() - no strips left \n";
218 if ( it->second.m_detRawId == lastDet) {
219 --det2stripNo[lastDet];
221 }
else if (det2stripNo[lastDet] == 0) {
223 if (lastDet == ch1Det) {
224 det2stripNo[ch1Det]+=ch1EndStrips;
227 lastDet = it->second.m_detRawId;
228 --det2stripNo[lastDet];
231 --det2stripNo[it->second.m_detRawId];
232 RPCStripsRing::iterator itErase = it;
235 this->erase(itErase);
251 const float pi = 3.141592654;
252 double dphi=2.0*pi/1152;
261 RPCStripsRing::iterator it = this->
begin();
262 RPCStripsRing::iterator itLast = this->
begin();
263 for (; it!=this->
end(); ++it){
270 delta = it->first - itLast->first;
272 itLast->second.m_detRawId == it->second.m_detRawId ||
280 stripsToAdd = (int)std::floor(delta/dphi)-1;
285 for (
int i = 0;
i<stripsToAdd;++
i){
287 stripsToInsert[itLast->first+dphi*(
i+1)]=
TStrip();
295 this->
insert(stripsToInsert.begin(),stripsToInsert.end());
315 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections "
316 <<
" called for non-reference ring \n";
325 const float pi = 3.141592654;
326 const float offset = (5./360.)*2*
pi;
329 RPCStripsRing::iterator starEndIt = this->
begin();
330 while ( (++starEndIt)->
first < offset );
332 RPCStripsRing::iterator it = starEndIt;
340 bool firstIter =
true;
342 while(it!=starEndIt || firstIter ) {
347 if(curStripNo%logplaneSize==0){
349 curBegStripNo=curStripNo;
350 RPCStripsRing::iterator plus8 = it;
351 bool skipOccured =
false;
352 for (
int i=0;
i<7;++
i){
354 if (plus8==this->
end()){
361 float phi= it->first;
362 float phiP8= plus8->first;
368 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections phi/phi8 error \n";
370 angle = (2*pi+phiP8+
phi)/2;
376 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections "
377 <<
" problem with angle calc \n";
381 angle = (phiP8+
phi)/2;
386 TOtherConnStructVec::iterator itOt = otherRings.begin();
387 for (;itOt!=otherRings.end();++itOt){
391 itOt->m_logplaneSize,
397 if ( !it->second.isVirtual() ){
400 newCon.
m_PAC = curPACno;
404 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
409 if (it==this->
end()){
425 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createOtherConnections "
426 <<
" called for reference ring \n";
430 RPCStripsRing::const_iterator it = this->lower_bound(angle);
433 if (it == this->
end())
436 for (
int i=0;
i < logplaneSize/2;
i++){
438 if (it==this->
begin())
445 for (
int i=0;
i < logplaneSize;
i++){
447 if (! it->second.isVirtual() ){
450 newCon.
m_PAC = PACno;
453 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
470 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() "
471 <<
" called for non reference ring \n";
477 }
else if (etaAbs > 8) {
481 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() "
482 <<
" called for etaPartition 8 \n";
519 auto uncompressedConsLeft = std::make_shared<L1RPCConeBuilder::TConMap>();
524 int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
530 uint32_t detId = itChamber->first;
532 for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
533 itStrip!=itChamber->second.end();
538 for(L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin();
539 itConn!=itStrip->second.end();
543 ++uncompressedConsBefore;
544 bool alreadyDone=
false;
545 if (m_compressedConnectionMap->find(detId)!=m_compressedConnectionMap->end()){
548 for(L1RPCConeBuilder::TCompressedConVec::iterator itCompConn=(*m_compressedConnectionMap)[detId].begin();
549 itCompConn!=(*m_compressedConnectionMap)[detId].end();
552 if (itCompConn->m_tower == itConn->m_tower
553 && itCompConn->m_PAC == itConn->m_PAC
554 && itCompConn->m_logplane == itConn->m_logplane)
558 int logStrip = itCompConn->m_mul*itStrip->first+itCompConn->m_offset;
559 if (logStrip != itConn->m_logstrip){
561 (*uncompressedConsLeft)[detId][itStrip->first].push_back(*itConn);
562 ++uncompressedConsAfter;
563 edm::LogWarning(
"RPCTriggerConfig") <<
" Compression failed for det " << detId
564 <<
" strip " << (int)itStrip->first
565 <<
" . Got " << (
int)logStrip
566 <<
" expected " << (int)itConn->m_logstrip
569 itCompConn->addStrip(itStrip->first);
580 L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
582 bool otherStripFound =
false;
584 for (;itStripOther!=itChamber->second.end() && !otherStripFound;
587 for(L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
588 itConnOther!=itStripOther->second.end();
591 if (itConnOther->m_tower == itConn->m_tower
592 && itConnOther->m_PAC == itConn->m_PAC
593 && itConnOther->m_logplane == itConn->m_logplane)
595 otherStripFound =
true;
596 if ( (itStripOther->first-itStrip->first)*(itConnOther->m_logstrip-itConn->m_logstrip) < 0 ){
617 nCompConn.
m_tower = itConn->m_tower;
618 nCompConn.
m_PAC = itConn->m_PAC;
620 nCompConn.
m_mul = mul;
621 nCompConn.
m_offset = itConn->m_logstrip - mul*(
signed short)(itStrip->first);
624 if (otherStripFound){
631 (*m_compressedConnectionMap)[detId].push_back(nCompConn);
void compressConnections()
tuple ret
prodAgent to be discontinued
LocalPoint centreOfStrip(int strip) const
void fillWithVirtualStrips()
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
void addStrip(unsigned char strip)
virtual int eta_partition()
uint32_t rawId() const
get the raw id
void createOtherConnections(int tower, int PACno, int logplane, int logplanesize, float angle)
void filterOverlapingChambers()
std::vector< TOtherConnStruct > TOtherConnStructVec
Abs< T >::type abs(const T &t)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
std::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
void addRoll(const RPCRoll *roll)
std::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
static int calculateHwPlane(const RPCRoll *roll)
Calculate ringId for any given RPCRoll.
void createRefConnections(TOtherConnStructVec &otherRings, int logplane, int logplaneSize)
volatile std::atomic< bool > shutdown_flag false
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.