28 m_isReferenceRing(
false),
36 boost::shared_ptr<L1RPCConeBuilder::TConMap > cmap) :
38 m_didFiltering(
false),
39 m_connectionsMap(cmap)
74 throw cms::Exception(
"RPCInternal") <<
"RPCStripsRing::addRoll ringsIds dont match \n";
82 float phiRaw = gStripCentre.
phi();
85 (*this)[phiRaw] = newStrip;
98 return 1000*(hwPlane) +
130 int layer = detId.
layer();
131 int region = detId.
region();
137 else if ( station > 2 ){
140 else if ( station == 1 && layer == 1) {
143 else if ( station == 1 && layer == 2) {
146 else if ( station == 2 && layer == 1) {
149 else if ( station == 2 && layer == 2) {
159 throw cms::Exception(
"RPCInternal") <<
"Calculated negative hwplane \n";
175 typedef std::map<uint32_t,int> TDetId2StripNo;
176 TDetId2StripNo det2stripNo;
179 int ch1BegStrips = 0;
180 int ch1EndStrips = 0;
183 RPCStripsRing::iterator it = this->
begin();
184 uint32_t ch1Det = it->second.m_detRawId;
185 for (; it!=this->
end(); ++it){
187 if ( det2stripNo.find(it->second.m_detRawId) == det2stripNo.end()){
188 det2stripNo[it->second.m_detRawId]=1;
190 ++det2stripNo[it->second.m_detRawId];
193 if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) {
195 }
else if (ch1Det == it->second.m_detRawId){
201 det2stripNo[ch1Det]-=ch1EndStrips;
213 uint32_t lastDet = it->second.m_detRawId;
214 while ( it!=this->
end() ){
216 if (det2stripNo[it->second.m_detRawId] < 0) {
217 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::filterOverlapingChambers() - no strips left \n";
219 if ( it->second.m_detRawId == lastDet) {
220 --det2stripNo[lastDet];
222 }
else if (det2stripNo[lastDet] == 0) {
224 if (lastDet == ch1Det) {
225 det2stripNo[ch1Det]+=ch1EndStrips;
228 lastDet = it->second.m_detRawId;
229 --det2stripNo[lastDet];
232 --det2stripNo[it->second.m_detRawId];
233 RPCStripsRing::iterator itErase = it;
236 this->erase(itErase);
252 const float pi = 3.141592654;
253 double dphi=2.0*pi/1152;
262 RPCStripsRing::iterator it = this->
begin();
263 RPCStripsRing::iterator itLast = this->
begin();
264 for (; it!=this->
end(); ++it){
271 delta = it->first - itLast->first;
273 itLast->second.m_detRawId == it->second.m_detRawId ||
281 stripsToAdd = (int)std::floor(delta/dphi)-1;
286 for (
int i = 0;
i<stripsToAdd;++
i){
288 stripsToInsert[itLast->first+dphi*(
i+1)]=
TStrip();
296 this->
insert(stripsToInsert.begin(),stripsToInsert.end());
316 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections "
317 <<
" called for non-reference ring \n";
326 const float pi = 3.141592654;
327 const float offset = (5./360.)*2*
pi;
330 RPCStripsRing::iterator starEndIt = this->
begin();
331 while ( (++starEndIt)->
first < offset );
333 RPCStripsRing::iterator it = starEndIt;
341 bool firstIter =
true;
343 while(it!=starEndIt || firstIter ) {
348 if(curStripNo%logplaneSize==0){
350 curBegStripNo=curStripNo;
351 RPCStripsRing::iterator plus8 = it;
352 bool skipOccured =
false;
353 for (
int i=0;
i<7;++
i){
355 if (plus8==this->
end()){
362 float phi= it->first;
363 float phiP8= plus8->first;
369 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections phi/phi8 error \n";
371 angle = (2*pi+phiP8+
phi)/2;
377 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createRefConnections "
378 <<
" problem with angle calc \n";
382 angle = (phiP8+
phi)/2;
387 TOtherConnStructVec::iterator itOt = otherRings.begin();
388 for (;itOt!=otherRings.end();++itOt){
392 itOt->m_logplaneSize,
398 if ( !it->second.isVirtual() ){
401 newCon.
m_PAC = curPACno;
405 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
410 if (it==this->
end()){
426 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::createOtherConnections "
427 <<
" called for reference ring \n";
431 RPCStripsRing::const_iterator it = this->lower_bound(angle);
434 if (it == this->
end())
437 for (
int i=0;
i < logplaneSize/2;
i++){
439 if (it==this->
begin())
446 for (
int i=0;
i < logplaneSize;
i++){
448 if (! it->second.isVirtual() ){
451 newCon.
m_PAC = PACno;
454 (*m_connectionsMap)[it->second.m_detRawId][it->second.m_strip].push_back(newCon);
471 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() "
472 <<
" called for non reference ring \n";
478 }
else if (etaAbs > 8) {
482 throw cms::Exception(
"RPCInternal") <<
" RPCStripsRing::getTowerForRefRing() "
483 <<
" called for etaPartition 8 \n";
520 boost::shared_ptr<L1RPCConeBuilder::TConMap > uncompressedConsLeft
524 boost::shared_ptr<L1RPCConeBuilder::TCompressedConMap >
528 int compressedCons = 0, uncompressedConsBefore = 0, uncompressedConsAfter = 0;
534 uint32_t detId = itChamber->first;
536 for (L1RPCConeBuilder::TStrip2ConVec::iterator itStrip = itChamber->second.begin();
537 itStrip!=itChamber->second.end();
542 for(L1RPCConeBuilder::TStripConVec::iterator itConn = itStrip->second.begin();
543 itConn!=itStrip->second.end();
547 ++uncompressedConsBefore;
548 bool alreadyDone=
false;
549 if (m_compressedConnectionMap->find(detId)!=m_compressedConnectionMap->end()){
552 for(L1RPCConeBuilder::TCompressedConVec::iterator itCompConn=(*m_compressedConnectionMap)[detId].begin();
553 itCompConn!=(*m_compressedConnectionMap)[detId].end();
556 if (itCompConn->m_tower == itConn->m_tower
557 && itCompConn->m_PAC == itConn->m_PAC
558 && itCompConn->m_logplane == itConn->m_logplane)
562 int logStrip = itCompConn->m_mul*itStrip->first+itCompConn->m_offset;
563 if (logStrip != itConn->m_logstrip){
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
573 itCompConn->addStrip(itStrip->first);
584 L1RPCConeBuilder::TStrip2ConVec::iterator itStripOther = itStrip;
586 bool otherStripFound =
false;
588 for (;itStripOther!=itChamber->second.end() && !otherStripFound;
591 for(L1RPCConeBuilder::TStripConVec::iterator itConnOther = itStripOther->second.begin();
592 itConnOther!=itStripOther->second.end();
595 if (itConnOther->m_tower == itConn->m_tower
596 && itConnOther->m_PAC == itConn->m_PAC
597 && itConnOther->m_logplane == itConn->m_logplane)
599 otherStripFound =
true;
600 if ( (itStripOther->first-itStrip->first)*(itConnOther->m_logstrip-itConn->m_logstrip) < 0 ){
621 nCompConn.
m_tower = itConn->m_tower;
622 nCompConn.
m_PAC = itConn->m_PAC;
624 nCompConn.
m_mul = mul;
625 nCompConn.
m_offset = itConn->m_logstrip - mul*(
signed short)(itStrip->first);
628 if (otherStripFound){
635 (*m_compressedConnectionMap)[detId].push_back(nCompConn);
void compressConnections()
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
unsigned int offset(bool)
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)
bool insert(Storage &, ItemType *, const IdTag &)
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.