27 m_isReferenceRing(
false),
29 m_didFiltering(
false) {}
32 : m_didVirtuals(
false), m_didFiltering(
false), m_connectionsMap(cmap) {
62 throw cms::Exception(
"RPCInternal") <<
"RPCStripsRing::addRoll ringsIds dont match \n";
69 float phiRaw = gStripCentre.
phi();
72 (*this)[phiRaw] = newStrip;
82 return 1000 * (hwPlane) +
129 throw cms::Exception(
"RPCInternal") <<
"Calculated negative hwplane \n";
143 typedef std::map<uint32_t, int> TDetId2StripNo;
144 TDetId2StripNo det2stripNo;
147 int ch1BegStrips = 0;
148 int ch1EndStrips = 0;
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;
157 ++det2stripNo[it->second.m_detRawId];
160 if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) {
162 }
else if (ch1Det == it->second.m_detRawId) {
167 det2stripNo[ch1Det] -= ch1EndStrips;
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";
182 if (it->second.m_detRawId == lastDet) {
183 --det2stripNo[lastDet];
185 }
else if (det2stripNo[lastDet] == 0) {
187 if (lastDet == ch1Det) {
188 det2stripNo[ch1Det] += ch1EndStrips;
191 lastDet = it->second.m_detRawId;
192 --det2stripNo[lastDet];
195 --det2stripNo[it->second.m_detRawId];
196 RPCStripsRing::iterator itErase = it;
199 this->erase(itErase);
209 const float pi = 3.141592654;
210 double dphi = 2.0 *
pi / 1152;
217 RPCStripsRing::iterator it = this->begin();
218 RPCStripsRing::iterator itLast = this->begin();
219 for (; it != this->
end(); ++it) {
225 delta = it->first - itLast->first;
227 itLast->second.m_detRawId == it->second.m_detRawId ||
233 stripsToAdd = (
int)std::floor(
delta / dphi) - 1;
239 for (
int i = 0;
i < stripsToAdd; ++
i) {
240 stripsToInsert[itLast->first + dphi * (
i + 1)] =
TStrip();
247 this->
insert(stripsToInsert.begin(), stripsToInsert.end());
263 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections " 264 <<
" called for non-reference ring \n";
273 const float pi = 3.141592654;
274 const float offset = (5. / 360.) * 2 *
pi;
277 RPCStripsRing::iterator starEndIt = this->begin();
281 RPCStripsRing::iterator it = starEndIt;
287 int curBegStripNo = 0;
289 bool firstIter =
true;
291 while (it != starEndIt || firstIter) {
295 if (curStripNo % logplaneSize == 0) {
297 curBegStripNo = curStripNo;
298 RPCStripsRing::iterator plus8 = it;
299 bool skipOccured =
false;
300 for (
int i = 0;
i < 7; ++
i) {
302 if (plus8 == this->
end()) {
303 plus8 = this->begin();
309 float phi = it->first;
310 float phiP8 = plus8->first;
315 if (
phi * phiP8 > 0) {
316 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections phi/phi8 error \n";
324 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections " 325 <<
" problem with angle calc \n";
332 TOtherConnStructVec::iterator itOt = otherRings.begin();
333 for (; itOt != otherRings.end(); ++itOt) {
334 itOt->m_it->second.createOtherConnections(
339 if (!it->second.isVirtual()) {
342 newCon.
m_PAC = curPACno;
344 newCon.
m_logstrip = curStripNo - curBegStripNo;
346 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
351 if (it == this->
end()) {
365 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createOtherConnections " 366 <<
" called for reference ring \n";
369 RPCStripsRing::const_iterator it = this->
lower_bound(angle);
371 if (it == this->
end())
374 for (
int i = 0;
i < logplaneSize / 2;
i++) {
375 if (it == this->begin())
381 for (
int i = 0;
i < logplaneSize;
i++) {
382 if (!it->second.isVirtual()) {
385 newCon.
m_PAC = PACno;
388 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
393 if (it == this->
end())
403 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() " 404 <<
" called for non reference ring \n";
410 }
else if (etaAbs > 8) {
414 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() " 415 <<
" called for etaPartition 8 \n";
446 auto uncompressedConsLeft = std::make_shared<L1RPCConeBuilder::TConMap>();
450 int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
455 uint32_t detId = itChamber->first;
457 for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
458 itStrip != itChamber->second.end();
461 for (L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin(); itConn != itStrip->second.end();
464 ++uncompressedConsBefore;
465 bool alreadyDone =
false;
469 itCompConn != (*m_compressedConnectionMap)[detId].end();
471 if (itCompConn->m_tower == itConn->m_tower && itCompConn->m_PAC == itConn->m_PAC &&
472 itCompConn->m_logplane == itConn->m_logplane)
476 int logStrip = itCompConn->m_mul * itStrip->first + itCompConn->m_offset;
477 if (logStrip != itConn->m_logstrip) {
479 (*uncompressedConsLeft)[detId][itStrip->first].push_back(*itConn);
480 ++uncompressedConsAfter;
482 <<
" Compression failed for det " << detId <<
" strip " << (
int)itStrip->first <<
" . Got " 483 << (
int)logStrip <<
" expected " << (
int)itConn->m_logstrip << std::endl;
485 itCompConn->addStrip(itStrip->first);
494 L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
496 bool otherStripFound =
false;
498 for (; itStripOther != itChamber->second.end() && !otherStripFound; ++itStripOther) {
499 for (L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
500 itConnOther != itStripOther->second.end();
502 if (itConnOther->m_tower == itConn->m_tower && itConnOther->m_PAC == itConn->m_PAC &&
503 itConnOther->m_logplane == itConn->m_logplane)
505 otherStripFound =
true;
506 if ((itStripOther->first - itStrip->first) * (itConnOther->m_logstrip - itConn->m_logstrip) < 0) {
527 nCompConn.
m_tower = itConn->m_tower;
528 nCompConn.
m_PAC = itConn->m_PAC;
530 nCompConn.
m_mul = mul;
531 nCompConn.
m_offset = itConn->m_logstrip - mul * (
signed short)(itStrip->first);
534 if (otherStripFound) {
539 (*m_compressedConnectionMap)[detId].push_back(nCompConn);
550 edm::LogInfo(
"RPCTriggerConfig") <<
" Compressed: " << compressedCons <<
" " 552 <<
" Uncompressed before: " << uncompressedConsBefore <<
" " 554 <<
" Uncompressed after: " << uncompressedConsAfter <<
" "
std::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
void compressConnections()
void fillWithVirtualStrips()
ret
prodAgent to be discontinued
Geom::Phi< T > phi() const
void addStrip(unsigned char strip)
virtual int eta_partition()
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
void addRoll(const RPCRoll *roll)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
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)
Log< level::Warning, false > LogWarning
LocalPoint centreOfStrip(int strip) const
T angle(T x1, T y1, T z1, T x2, T y2, T z2)