#include <L1TriggerConfig/RPCConeBuilder/interface/RPCStripsRing.h>
Usage: <usage>
Definition at line 39 of file RPCStripsRing.h.
typedef std::map<int, RPCStripsRing> RPCStripsRing::TIdToRindMap |
Definition at line 44 of file RPCStripsRing.h.
typedef std::vector<TOtherConnStruct> RPCStripsRing::TOtherConnStructVec |
Definition at line 54 of file RPCStripsRing.h.
RPCStripsRing::RPCStripsRing | ( | const RPCRoll * | roll | ) |
Definition at line 36 of file RPCStripsRing.cc.
References funct::abs(), addRoll(), calculateHwPlane(), detId, RPCGeomServ::eta_partition(), getRingId(), RPCRoll::id(), m_etaPartition, m_hwPlane, m_isReferenceRing, m_region, RPCDetId::region(), and RPCDetId::ring().
00036 : 00037 m_didVirtuals(false), 00038 m_didFiltering(false) 00039 { 00040 00041 RPCDetId detId = roll->id(); 00042 RPCGeomServ grs(detId); 00043 00044 m_etaPartition = grs.eta_partition(); 00045 m_hwPlane = calculateHwPlane(roll); 00046 00047 m_isReferenceRing = false; 00048 00049 m_region = detId.region(); 00050 00051 int ring = detId.ring(); 00052 00053 if (m_region == 0 && std::abs(ring)<2 && m_hwPlane == 2) // for barell wheel -1,0,1 refplane is hwPlane=2 00054 m_isReferenceRing = true; 00055 else if (m_region == 0 && std::abs(ring)==2 && m_hwPlane == 6) // for barell wheel -2,2 refplane is hwPlane=6 00056 m_isReferenceRing = true; 00057 else if (m_region != 0 && m_hwPlane == 2) // for endcaps 00058 m_isReferenceRing = true; 00059 00060 00061 if( getRingId() == 2008 || getRingId() == 2108) //exception: endcaps;hwplane 2;farest roll from beam 00062 m_isReferenceRing = false; 00063 00064 addRoll(roll); 00065 }
RPCStripsRing::RPCStripsRing | ( | ) |
Definition at line 25 of file RPCStripsRing.cc.
00025 : 00026 m_hwPlane(-1), 00027 m_etaPartition(99), 00028 m_region(-2), 00029 m_isReferenceRing(false), 00030 m_didVirtuals(false), 00031 m_didFiltering(false) 00032 { 00033 00034 }
virtual RPCStripsRing::~RPCStripsRing | ( | ) | [inline, virtual] |
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().
00068 { 00069 00070 // RPCDetId detId = roll->id(); 00071 00072 if (getRingId() != getRingId(roll) ){ 00073 throw cms::Exception("RPCInternal") << "RPCStripsRing::addRoll ringsIds dont match \n"; 00074 } 00075 00076 //iterate over the strips of this roll 00077 for (int i=1; i<=roll->nstrips(); i++ ) { 00078 00079 LocalPoint lStripCentre = roll->centreOfStrip(i); 00080 GlobalPoint gStripCentre = roll->toGlobal(lStripCentre); 00081 float phiRaw = gStripCentre.phi(); 00082 00083 TStrip newStrip(roll->id().rawId(), i); 00084 (*this)[phiRaw] = newStrip; 00085 00086 } 00087 00088 }
Calculate ringId for any given RPCRoll.
Definition at line 123 of file RPCStripsRing.cc.
References detId, Exception, RPCRoll::id(), RPCDetId::layer(), RPCDetId::region(), and RPCDetId::station().
Referenced by getRingId(), and RPCStripsRing().
00123 { 00124 00125 int hwPlane = -1; 00126 RPCDetId detId = roll->id(); 00127 int station = detId.station(); 00128 int layer = detId.layer(); 00129 int region = detId.region(); 00130 00131 if (region != 0){ // endcaps 00132 hwPlane = station; 00133 } 00134 // Now comes the barell 00135 else if ( station > 2 ){ 00136 hwPlane = station; 00137 } 00138 else if ( station == 1 && layer == 1) { 00139 hwPlane = 1; 00140 } 00141 else if ( station == 1 && layer == 2) { 00142 hwPlane = 5; 00143 } 00144 else if ( station == 2 && layer == 1) { 00145 hwPlane = 2; 00146 } 00147 else if ( station == 2 && layer == 2) { 00148 hwPlane = 6; 00149 } 00150 00151 /*if (hwPlane < 1) 00152 std::cout << "prb: " << hwPlane << " " 00153 << region << " " 00154 << station << " " 00155 << layer << std::endl;*/ 00156 if (hwPlane < 0) { 00157 throw cms::Exception("RPCInternal") << "Calculated negative hwplane \n"; 00158 } 00159 00160 00161 return hwPlane; 00162 00163 }
void RPCStripsRing::createOtherConnections | ( | int | tower, | |
int | PACno, | |||
int | logplane, | |||
int | logplanesize, | |||
float | angle | |||
) |
Definition at line 419 of file RPCStripsRing.cc.
References Exception, i, it, m_connectionsMap, L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, and L1RPCConeBuilder::TStripCon::m_tower.
00419 { 00420 00421 //std::cout << " OtherCon for " << getRingId() << std::endl; 00422 00423 if(this->isReferenceRing()){ 00424 throw cms::Exception("RPCInternal") << " RPCStripsRing::createOtherConnections " 00425 << " called for reference ring \n"; 00426 } 00427 00428 00429 RPCStripsRing::const_iterator it = this->lower_bound(angle); 00430 00431 00432 if (it == this->end()) 00433 it = this->begin(); 00434 00435 for (int i=0; i < logplaneSize/2; i++){ 00436 00437 if (it==this->begin()) 00438 it=this->end(); // (m_stripPhiMap.end()--) is ok. 00439 00440 --it; 00441 } 00442 00443 00444 for (int i=0; i < logplaneSize; i++){ 00445 00446 if (! it->second.isVirtual() ){ 00447 L1RPCConeBuilder::TStripCon newCon; 00448 newCon.m_tower = tower; 00449 newCon.m_PAC = PACno; 00450 newCon.m_logplane = logplane; 00451 newCon.m_logstrip= i; 00452 m_connectionsMap[it->second.m_detRawId][it->second.m_strip].push_back(newCon); 00453 //std::cout << " Adding other connection " << std::endl; 00454 } 00455 00456 ++it; 00457 if (it==this->end()) 00458 it=this->begin(); 00459 } 00460 00461 }
void RPCStripsRing::createRefConnections | ( | TOtherConnStructVec & | otherRings, | |
int | logplane, | |||
int | logplaneSize | |||
) |
Definition at line 304 of file RPCStripsRing.cc.
References funct::abs(), angle(), begin, Exception, first, getTowerForRefRing(), i, it, m_connectionsMap, L1RPCConeBuilder::TStripCon::m_logplane, L1RPCConeBuilder::TStripCon::m_logstrip, L1RPCConeBuilder::TStripCon::m_PAC, L1RPCConeBuilder::TStripCon::m_tower, offset, phi, and pi.
00305 { 00306 //* 00307 /*std::cout << "RefCon for " << getRingId() 00308 << " (" << getEtaPartition()<< ")" 00309 << " tower: " << getTowerForRefRing() 00310 << " ; connected: " 00311 << otherRings.size() 00312 << std::endl 00313 << std::endl; 00314 //*/ 00315 00316 // XXX - TODO: warning on wrong logplaneSize 00317 00318 if(!this->isReferenceRing()){ 00319 throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections " 00320 << " called for non-reference ring \n"; 00321 } 00322 00323 if (logplaneSize!=8) { 00324 throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections " 00325 << " called for lpSize " << logplaneSize << " \n"; 00326 00327 } 00328 const float pi = 3.141592654; 00329 const float offset = (5./360.)*2*pi; // XXX 00330 00331 //find first reference strip of first PAC (the strip with phi ~= 5deg) 00332 RPCStripsRing::iterator starEndIt = this->begin(); 00333 while ( (++starEndIt)->first < offset ); 00334 00335 RPCStripsRing::iterator it = starEndIt; 00336 --starEndIt; 00337 00338 float angle = 0; 00339 int curPACno = -1; 00340 int curStripNo = 0; 00341 int curBegStripNo=0; 00342 00343 while(it!=starEndIt) { // iterate over strips 00344 00345 // New PAC 00346 if(curStripNo%logplaneSize==0){ 00347 ++curPACno; 00348 curBegStripNo=curStripNo; 00349 RPCStripsRing::iterator plus8 = it; 00350 bool skipOccured = false; 00351 for (int i=0;i<7;++i){ 00352 ++plus8; 00353 if (plus8==this->end()){ 00354 plus8=this->begin(); 00355 skipOccured = true; 00356 } 00357 } 00358 00359 // calculate angle 00360 float phi= it->first; 00361 float phiP8= plus8->first; 00362 if (skipOccured){ 00363 // phiP8 is negative 00364 // phi is positive 00365 // xcheck 00366 if (phi*phiP8 > 0){ 00367 throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections phi/phi8 error \n"; 00368 } 00369 angle = (2*pi+phiP8+phi)/2; 00370 if(angle > pi){ // should land on positive side 00371 angle -= 2*pi; 00372 } 00373 00374 if (std::abs(angle) > pi) { 00375 throw cms::Exception("RPCInternal") << " RPCStripsRing::createRefConnections " 00376 << " problem with angle calc \n"; 00377 } 00378 } 00379 else { 00380 angle = (phiP8+phi)/2; 00381 } 00382 //std::cout << curPACno << " " << phiP8 << " " << phi << " " << angle << std::endl; 00383 00384 00385 TOtherConnStructVec::iterator itOt = otherRings.begin(); 00386 for (;itOt!=otherRings.end();++itOt){ 00387 itOt->m_it->second.createOtherConnections(getTowerForRefRing(), 00388 curPACno, 00389 itOt->m_logplane, 00390 itOt->m_logplaneSize, 00391 angle); 00392 } 00393 } 00394 00395 00396 if ( !it->second.isVirtual() ){ 00397 L1RPCConeBuilder::TStripCon newCon; 00398 newCon.m_tower = getTowerForRefRing(); 00399 newCon.m_PAC = curPACno; 00400 newCon.m_logplane = logplane; 00401 newCon.m_logstrip=curStripNo-curBegStripNo; 00402 //std::cout << " Adding con for " << it->second.m_detRawId << std::endl; 00403 m_connectionsMap[it->second.m_detRawId][it->second.m_strip].push_back(newCon); 00404 //std::cout << " Adding ref connection " << std::endl; 00405 } 00406 ++curStripNo; 00407 ++it; 00408 if (it==this->end()){ 00409 it=this->begin(); 00410 } 00411 00412 } // iteration over strips ends 00413 00414 //std::cout << " refcon: " << curPACno << " PACs" << std::endl; 00415 //std::cout << "After refCon: " << m_connectionsMap.size() << std::endl; 00416 00417 }
void RPCStripsRing::fillWithVirtualStrips | ( | ) |
Definition at line 248 of file RPCStripsRing.cc.
References begin, end, i, edm::eventsetup::heterocontainer::insert(), int, isReferenceRing(), it, m_didVirtuals, m_hwPlane, and pi.
00249 { 00250 00251 00252 if(m_didVirtuals) return; 00253 m_didVirtuals = true; 00254 00255 const float pi = 3.141592654; 00256 double dphi=2.0*pi/1152; // defines angular granulation of strips. 00257 00258 RPCStripsRing stripsToInsert; 00259 00260 00261 float delta = 0; 00262 int stripsToAdd = 0; 00263 00264 00265 RPCStripsRing::iterator it = this->begin(); 00266 RPCStripsRing::iterator itLast = this->begin(); 00267 for (; it!=this->end(); ++it){ 00268 00269 /*std::cout << it->first << " " 00270 << it->second.m_detRawId << " " 00271 << (int)it->second.m_strip << std::endl; 00272 */ 00273 00274 delta = it->first - itLast->first; 00275 if (it == itLast || // skip first loop iteration 00276 itLast->second.m_detRawId == it->second.m_detRawId || // insert strips between two chambers only 00277 delta < 0) 00278 { 00279 itLast = it; 00280 continue; 00281 } 00282 00283 00284 stripsToAdd = (int)std::floor(delta/dphi)-1; 00285 //std::cout << delta << " " << stripsToAdd << std::endl; 00286 00287 if ( isReferenceRing() && m_hwPlane==6) ++stripsToAdd; 00288 00289 for (int i = 0;i<stripsToAdd;++i){ 00290 00291 stripsToInsert[itLast->first+dphi*(i+1)]=TStrip(); 00292 00293 } 00294 00295 itLast = it; 00296 } 00297 // TODO: check delta between first and last strip in map 00298 00299 this->insert(stripsToInsert.begin(),stripsToInsert.end()); 00300 00301 00302 00303 }
void RPCStripsRing::filterOverlapingChambers | ( | ) |
Definition at line 165 of file RPCStripsRing.cc.
References begin, end, Exception, it, m_didFiltering, m_hwPlane, and m_region.
00165 { 00166 00167 if(m_didFiltering) return; 00168 m_didFiltering = true; 00169 00170 if (m_region != 0 || m_hwPlane != 4) 00171 return; 00172 00173 typedef std::map<uint32_t,int> TDetId2StripNo; 00174 TDetId2StripNo det2stripNo; 00175 00176 00177 //std::cout << "--------------------- " << getRingId() << std::endl; 00178 00179 00180 // Note: we begin in middle of first chamber (ch1), we have to handle that 00181 int ch1BegStrips = 0; 00182 int ch1EndStrips = 0; 00183 00184 // How many strips has each chamber? 00185 RPCStripsRing::iterator it = this->begin(); 00186 uint32_t ch1Det = it->second.m_detRawId; 00187 for (; it!=this->end(); ++it){ 00188 00189 if ( det2stripNo.find(it->second.m_detRawId) == det2stripNo.end()){ 00190 det2stripNo[it->second.m_detRawId]=1; 00191 //std::cout << it->second.m_detRawId << std::endl; 00192 } else { 00193 ++det2stripNo[it->second.m_detRawId]; 00194 } 00195 00196 if (det2stripNo.size() == 1 && ch1Det == it->second.m_detRawId) { 00197 ++ch1BegStrips; 00198 } else if (ch1Det == it->second.m_detRawId){ 00199 ++ch1EndStrips; 00200 } 00201 00202 } 00203 00204 det2stripNo[ch1Det]-=ch1EndStrips; 00205 00206 // std::cout << ch1BegStrips << " " << ch1EndStrips << std::endl; 00207 00208 //TDetId2StripNo::iterator itIds = det2stripNo.begin(); 00209 //for(;itIds!=det2stripNo.end();++itIds){ 00210 // std::cout << itIds->first << " " << itIds->second << std::endl; 00211 // } 00212 00213 00214 00215 it = this->begin(); 00216 uint32_t lastDet = it->second.m_detRawId; 00217 while ( it!=this->end() ){ 00218 00219 if (det2stripNo[it->second.m_detRawId] < 0) { 00220 throw cms::Exception("RPCInternal") << " RPCStripsRing::filterOverlapingChambers() - no strips left \n"; 00221 } 00222 if ( it->second.m_detRawId == lastDet) { 00223 --det2stripNo[lastDet]; 00224 ++it; 00225 } else if (det2stripNo[lastDet] == 0) { // no more strips left in lastDet, proceed to new det 00226 00227 if (lastDet == ch1Det) { 00228 det2stripNo[ch1Det]+=ch1EndStrips; 00229 } 00230 00231 lastDet = it->second.m_detRawId; 00232 --det2stripNo[lastDet]; 00233 ++it; 00234 } else { // there are still strips in last det, delete current strip 00235 --det2stripNo[it->second.m_detRawId]; 00236 RPCStripsRing::iterator itErase = it; 00237 ++it; 00238 //std::cout << "Removing strip " << it->second.m_detRawId << " " << (int)it->second.m_strip << std::endl; 00239 this->erase(itErase); 00240 } 00241 00242 } 00243 00244 00245 00246 }
L1RPCConeBuilder::TConMap& RPCStripsRing::getConnectionsMap | ( | ) | [inline] |
int RPCStripsRing::getEtaPartition | ( | ) | [inline] |
Definition at line 80 of file RPCStripsRing.h.
References m_etaPartition.
Referenced by getTowerForRefRing().
00080 {return m_etaPartition;};
int RPCStripsRing::getHwPlane | ( | ) | [inline] |
Calculate ringId for this ring.
Definition at line 109 of file RPCStripsRing.cc.
References calculateHwPlane(), detId, RPCGeomServ::eta_partition(), getRingId(), and RPCRoll::id().
00109 { 00110 00111 00112 RPCDetId detId = roll->id(); 00113 RPCGeomServ grs(detId); 00114 int etaPartition = grs.eta_partition(); 00115 int hwPlane = calculateHwPlane(roll); 00116 00117 return getRingId(etaPartition, hwPlane); 00118 00119 }
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().
00103 { 00104 00105 return getRingId(m_etaPartition, m_hwPlane); 00106 00107 }
Definition at line 90 of file RPCStripsRing.cc.
References funct::abs().
00090 { 00091 00092 int sign = 1; // positive 00093 if (etaPart < 0){ 00094 sign = 0; 00095 } 00096 00097 return 1000*(hwPlane) + //1...6 00098 100*( sign ) + // 00099 1*( std::abs(etaPart) ); //-17...17 00100 00101 }
int RPCStripsRing::getTowerForRefRing | ( | ) |
Definition at line 464 of file RPCStripsRing.cc.
References funct::abs(), Exception, and getEtaPartition().
Referenced by createRefConnections().
00464 { 00465 00466 int ret = 0; 00467 00468 if(!this->isReferenceRing()){ 00469 throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() " 00470 << " called for non reference ring \n"; 00471 } 00472 00473 int etaAbs = std::abs(getEtaPartition()); 00474 if (etaAbs < 8) { 00475 ret = getEtaPartition(); 00476 } else if (etaAbs > 8) { 00477 int sign = (getEtaPartition() > 0 ? 1 : -1); 00478 ret = getEtaPartition()-sign; 00479 } else { 00480 throw cms::Exception("RPCInternal") << " RPCStripsRing::getTowerForRefRing() " 00481 << " called for etaPartition 8 \n"; 00482 } 00483 00484 00485 00486 return ret; 00487 00488 }
bool RPCStripsRing::isReferenceRing | ( | ) | [inline] |
Definition at line 81 of file RPCStripsRing.h.
References m_isReferenceRing.
Referenced by fillWithVirtualStrips().
00081 {return m_isReferenceRing;};
L1RPCConeBuilder::TConMap RPCStripsRing::m_connectionsMap = L1RPCConeBuilder::TConMap() [static, private] |
Definition at line 97 of file RPCStripsRing.h.
Referenced by createOtherConnections(), and createRefConnections().
bool RPCStripsRing::m_didFiltering [private] |
bool RPCStripsRing::m_didVirtuals [private] |
int RPCStripsRing::m_etaPartition [private] |
Definition at line 90 of file RPCStripsRing.h.
Referenced by getEtaPartition(), getRingId(), and RPCStripsRing().
int RPCStripsRing::m_hwPlane [private] |
Definition at line 84 of file RPCStripsRing.h.
Referenced by fillWithVirtualStrips(), filterOverlapingChambers(), getHwPlane(), getRingId(), and RPCStripsRing().
bool RPCStripsRing::m_isReferenceRing [private] |
Definition at line 93 of file RPCStripsRing.h.
Referenced by isReferenceRing(), and RPCStripsRing().
int RPCStripsRing::m_region [private] |
Definition at line 91 of file RPCStripsRing.h.
Referenced by filterOverlapingChambers(), and RPCStripsRing().