27 m_isReferenceRing(
false),
35 boost::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 boost::shared_ptr<L1RPCConeBuilder::TConMap > uncompressedConsLeft
523 boost::shared_ptr<L1RPCConeBuilder::TCompressedConMap >
527 int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
533 uint32_t detId = itChamber->first;
535 for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
536 itStrip!=itChamber->second.end();
541 for(L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin();
542 itConn!=itStrip->second.end();
546 ++uncompressedConsBefore;
547 bool alreadyDone=
false;
548 if (m_compressedConnectionMap->find(detId)!=m_compressedConnectionMap->end()){
551 for(L1RPCConeBuilder::TCompressedConVec::iterator itCompConn=(*m_compressedConnectionMap)[detId].begin();
552 itCompConn!=(*m_compressedConnectionMap)[detId].end();
555 if (itCompConn->m_tower == itConn->m_tower
556 && itCompConn->m_PAC == itConn->m_PAC
557 && itCompConn->m_logplane == itConn->m_logplane)
561 int logStrip = itCompConn->m_mul*itStrip->first+itCompConn->m_offset;
562 if (logStrip != itConn->m_logstrip){
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
572 itCompConn->addStrip(itStrip->first);
583 L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
585 bool otherStripFound =
false;
587 for (;itStripOther!=itChamber->second.end() && !otherStripFound;
590 for(L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
591 itConnOther!=itStripOther->second.end();
594 if (itConnOther->m_tower == itConn->m_tower
595 && itConnOther->m_PAC == itConn->m_PAC
596 && itConnOther->m_logplane == itConn->m_logplane)
598 otherStripFound =
true;
599 if ( (itStripOther->first-itStrip->first)*(itConnOther->m_logstrip-itConn->m_logstrip) < 0 ){
620 nCompConn.
m_tower = itConn->m_tower;
621 nCompConn.
m_PAC = itConn->m_PAC;
623 nCompConn.
m_mul = mul;
624 nCompConn.
m_offset = itConn->m_logstrip - mul*(
signed short)(itStrip->first);
627 if (otherStripFound){
634 (*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::map< uint32_t, TStrip2ConVec > TConMap
std::map< uint32_t, TCompressedConVec > TCompressedConMap
void addRoll(const RPCRoll *roll)
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
boost::shared_ptr< L1RPCConeBuilder::TCompressedConMap > m_compressedConnectionMap
boost::shared_ptr< L1RPCConeBuilder::TConMap > m_connectionsMap
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.