CMS 3D CMS Logo

RPCRingFromRolls Class Reference

Class describng 2PI "rings" constructed from RpcDetId's of the same eta (same as L1RpcRoll in ORCA). More...

#include <L1Trigger/RPCTrigger/interface/RPCRingFromRolls.h>

List of all members.

Public Types

enum  { IROLL_MAX = 17, NPOS = 3, NHPLANES = 6, TOWERMAX = 16 }
typedef std::vector
< RPCConnection
RPCConnectionsVec
typedef std::map< stripCords,
RPCConnectionsVec,
stripCordsOp
RPCLinks

Public Member Functions

bool addDetId (RPCDetInfo detInfo)
 Adds detId tu the curl.
int getMaxTower () const
 Returns value of max m_tower.
int getMinTower () const
 Returns value of min m_tower.
int getRingFromRollsId () const
 Returns value of max m_tower.
RPCLinks giveConnections ()
bool isRefPlane () const
 Returns value of m_isReferencePlane.
int makeOtherConnections (float phiCenter, int m_tower, int m_PAC)
 Makes connections for Rings not beeing a refernce ones.
int makeRefConnections (RPCRingFromRolls *)
 Makes connections for reference rings.
void printContents ()
 prints the contents of a RPCRingFromRolls.
 RPCRingFromRolls ()
 Default constructor.
 ~RPCRingFromRolls ()

Private Types

typedef std::map< float,
stripCords, phiMapCompare
GlobalStripPhiMap
typedef std::map< uint32_t,
RPCDetInfo
RPCDetInfoMap
typedef std::map< float, uint32_t > RPCDetInfoPhiMap

Private Member Functions

void doVirtualStrips ()
 Fills strip map with virtual strips.
void filterMixedStrips ()
 Filters strip.
int giveLogPlaneForTower (int m_tower)
 Calculates m_logplane.
void setRefPlane ()
 Checks and sets value of m_isReferencePlane.
void updatePhiStripsMap (RPCDetInfo detInfo)
 Updates m_stripPhiMap.

Private Attributes

int m_curlId
 this curlId
bool m_didFiltering
bool m_didVirtuals
int m_globRoll
int m_hwPlane
 Hardware plane no.
bool m_isDataFresh
 Defines if data has real world contents.
bool m_isRefPlane
 tells if detIds from this curl form a reference plane
RPCLinks m_links
int m_physStripsInRingFromRolls
 m_Number of existing strips in curl;
int m_region
 Region no - 0 for barell +-1 for endcaps.
int m_ring
 Wheel number for barell, ring number for endcaps.
int m_roll
 roll no
RPCDetInfoMap m_RPCDetInfoMap
 Stores all DetId`s of a curl.
RPCDetInfoPhiMap m_RPCDetPhiMap
 Stores DetId`s rawId in a phi order.
GlobalStripPhiMap m_stripPhiMap
int m_towerMax
 The highest m_tower no. to which curl contributes.
int m_towerMin
 The lowest m_tower no. to which curl contributes.
int m_virtStripsInRingFromRolls
 m_Number of virtual strips in curl;

Static Private Attributes

static const unsigned int m_LOGPLANE_SIZE [17][6]
static const int m_mrlogp [RPCRingFromRolls::IROLL_MAX+1][RPCRingFromRolls::NHPLANES][RPCRingFromRolls::NPOS]
static const int m_mrtow [RPCRingFromRolls::IROLL_MAX+1][RPCRingFromRolls::NHPLANES][RPCRingFromRolls::NPOS]

Friends

class RPCVHDLConeMaker

Classes

struct  phiMapCompare
struct  RPCConnection
struct  stripCords
struct  stripCordsOp


Detailed Description

Class describng 2PI "rings" constructed from RpcDetId's of the same eta (same as L1RpcRoll in ORCA).

Author:
Tomasz Fruboes

Definition at line 17 of file RPCRingFromRolls.h.


Member Typedef Documentation

typedef std::map<float, stripCords, phiMapCompare> RPCRingFromRolls::GlobalStripPhiMap [private]

Definition at line 126 of file RPCRingFromRolls.h.

typedef std::vector<RPCConnection> RPCRingFromRolls::RPCConnectionsVec

Definition at line 49 of file RPCRingFromRolls.h.

typedef std::map<uint32_t, RPCDetInfo> RPCRingFromRolls::RPCDetInfoMap [private]

Definition at line 98 of file RPCRingFromRolls.h.

typedef std::map<float, uint32_t> RPCRingFromRolls::RPCDetInfoPhiMap [private]

Definition at line 102 of file RPCRingFromRolls.h.

typedef std::map<stripCords, RPCConnectionsVec, stripCordsOp> RPCRingFromRolls::RPCLinks

Definition at line 50 of file RPCRingFromRolls.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
IROLL_MAX 
NPOS 
NHPLANES 
TOWERMAX 

Definition at line 22 of file RPCRingFromRolls.h.

00022 { IROLL_MAX = 17, NPOS = 3, NHPLANES  = 6, TOWERMAX = 16 };  


Constructor & Destructor Documentation

RPCRingFromRolls::RPCRingFromRolls (  ) 

Default constructor.

Definition at line 19 of file RPCRingFromRolls.cc.

References m_curlId, m_didFiltering, m_didVirtuals, m_globRoll, m_hwPlane, m_isDataFresh, m_isRefPlane, m_physStripsInRingFromRolls, m_region, m_ring, m_roll, m_towerMax, m_towerMin, and m_virtStripsInRingFromRolls.

00020 { 
00021   m_towerMin = 0;
00022   m_towerMax = 0;
00023   m_hwPlane = 0;
00024   m_region = 0;
00025   m_ring = 0;
00026   m_roll = 0;
00027   m_curlId = 0;
00028   m_globRoll = 0;
00029   
00030   m_physStripsInRingFromRolls = 0;
00031   m_virtStripsInRingFromRolls = 0;
00032   
00033   m_isRefPlane = false;
00034   m_isDataFresh = true;
00035   m_didVirtuals = false; 
00036   m_didFiltering = false;
00037   
00038 }

RPCRingFromRolls::~RPCRingFromRolls (  ) 

Definition at line 40 of file RPCRingFromRolls.cc.

00040 { }


Member Function Documentation

bool RPCRingFromRolls::addDetId ( RPCDetInfo  detInfo  ) 

Adds detId tu the curl.

Todo:
Implement check if added detInfo _does_ belong to this RPCRingFromRolls
Todo:
check if added detInfo is allready in map
Todo:
Implement xcheck if towers are calculated properly

Definition at line 51 of file RPCRingFromRolls.cc.

References funct::abs(), RPCDetInfo::getGlobRollNo(), RPCDetInfo::getHwPlane(), RPCDetInfo::getPhi(), RPCDetInfo::getRegion(), RPCDetInfo::getRing(), RPCDetInfo::getRingFromRollsId(), RPCDetInfo::getRoll(), i, m_curlId, m_globRoll, m_hwPlane, m_isDataFresh, m_mrtow, m_region, m_ring, m_roll, m_RPCDetInfoMap, m_RPCDetPhiMap, m_towerMax, m_towerMin, RPCDetInfo::rawId(), setRefPlane(), pyDBSRunClass::temp, and updatePhiStripsMap().

Referenced by RPCTriggerGeo::addDet().

00051                                                  {
00052   
00053   if(m_isDataFresh) { // should be done in constructor...
00054     
00055 //    m_towerMin=detInfo.getMinTower();
00056     //m_towerMax=detInfo.getMaxTower();
00057     
00058     m_hwPlane = detInfo.getHwPlane();
00059     m_region = detInfo.getRegion();
00060     m_ring = detInfo.getRing();
00061     m_roll = detInfo.getRoll();
00062     m_curlId = detInfo.getRingFromRollsId();
00063     m_globRoll = detInfo.getGlobRollNo();
00064     
00065     setRefPlane();
00066     
00067     m_towerMin=-1;
00068     m_towerMax=-1;
00069     
00070     for (int i=0; i < 3; i++){
00071       int ttemp = m_mrtow [std::abs(m_globRoll)] [m_hwPlane-1][i];
00072       if (  ((m_towerMin < 0)||(m_towerMax < 0)) && (ttemp >= 0)   ){ 
00073         m_towerMin = ttemp;
00074         m_towerMax = ttemp;
00075       }
00076       if (ttemp >= 0) {
00077         if (ttemp < m_towerMin)
00078           m_towerMin = ttemp;
00079         if (ttemp > m_towerMax)
00080           m_towerMax = ttemp;
00081       }
00082     }
00083     
00084     if (m_globRoll < 0){
00085       int temp = m_towerMin;
00086       m_towerMin = -m_towerMax;
00087       m_towerMax = -temp; // swap is needed (!)
00088     }
00089     
00090     m_isDataFresh=false;
00091   } 
00092   /*
00093   else 
00094   {
00095     int min = detInfo.getMinTower();
00096     int max = detInfo.getMinTower();
00097     if (min < m_towerMin)
00098       min = m_towerMin;
00099     if (max > m_towerMax)
00100       max = m_towerMax;
00101   }
00102   */
00103   
00104   updatePhiStripsMap(detInfo);
00105   
00106   m_RPCDetInfoMap[detInfo.rawId()]=detInfo; 
00107   m_RPCDetPhiMap[detInfo.getPhi()]=detInfo.rawId();
00108  
00109   
00110   return true;
00111 }

void RPCRingFromRolls::doVirtualStrips (  )  [private]

Fills strip map with virtual strips.

Bug:
RingFromRolls 4102 has diffrent no. of virtuals than 4002.
Todo:
Improve this function. Some curls seem to have wrong number of virtuals
Todo:
Possible xcheck - check if virtual and physical strips sum to 1152 or more - only for ref curl
Todo:
Implement check if we have symetry (x1xx vs x0xx; whell +y vs -y)

Definition at line 530 of file RPCRingFromRolls.cc.

References cmssw-higgs-4mu::firstRun, RPCDetInfo::getMaxPhi(), RPCDetInfo::getMinPhi(), getRingFromRollsId(), i, int, isRefPlane(), it, RPCRingFromRolls::stripCords::m_detRawId, m_didVirtuals, m_hwPlane, RPCRingFromRolls::stripCords::m_isVirtual, m_physStripsInRingFromRolls, m_RPCDetInfoMap, m_RPCDetPhiMap, RPCRingFromRolls::stripCords::m_stripNo, m_stripPhiMap, m_virtStripsInRingFromRolls, and pi.

Referenced by makeOtherConnections(), and makeRefConnections().

00530                                       {
00531   
00532   if (m_didVirtuals){ // run once
00533     return;
00534   }
00535   m_didVirtuals=true;
00536   
00537   const float pi = 3.141592654;
00538 
00539   bool firstRun=true;
00540   GlobalStripPhiMap newVirtualStrips;
00541   
00542   double dphi=2.0*pi/1152;  // defines angular granulation of strips.
00543   
00544   float phiMinNext=0, phiMaxNext=0, phiMinLast=0,phiMaxLast=0;
00545   uint32_t rawDetIDLast=0,rawDetIDNext=0;
00546   
00547   //now we iterate over all dets adding virtual strips begining from phiMax+dphi
00548   RPCDetInfoPhiMap::const_iterator it;
00549   for (it=m_RPCDetPhiMap.begin(); it != m_RPCDetPhiMap.end(); it++){
00550     
00551     RPCDetInfo *det = &m_RPCDetInfoMap[it->second];
00552     
00553     /*
00554       In first iteration we dont have *Last and *Next values. We must suck them
00555       in 'artificial' way
00556     */
00557     if(firstRun){
00558       phiMinNext = det->getMinPhi();
00559       phiMaxNext = det->getMaxPhi();
00560       rawDetIDNext=it->second; // not really needed
00561       
00562       RPCDetInfoPhiMap::const_reverse_iterator itTemp = m_RPCDetPhiMap.rbegin();
00563       RPCDetInfo *detTemp = &m_RPCDetInfoMap[itTemp->second];
00564       phiMinLast=detTemp->getMinPhi();
00565       phiMaxLast=detTemp->getMaxPhi();
00566       rawDetIDLast= itTemp->second;
00567       firstRun=false;
00568     }
00569     else {
00570       rawDetIDLast=rawDetIDNext;
00571       rawDetIDNext=it->second;
00572       phiMinLast = phiMinNext;
00573       phiMaxLast = phiMaxNext;
00574       phiMinNext = det->getMinPhi();
00575       phiMaxNext = det->getMaxPhi();
00576     }
00577     
00578     float delta = phiMinNext - phiMaxLast;
00579     delta += 2*pi*(delta<-5);// (-5) Fixes problem of overlaping chambers
00580     
00581     if (delta<0)
00582       continue;
00583 
00584     int stripsToAdd = (int)std::floor(delta/dphi)-1;
00585     if ( isRefPlane() && m_hwPlane==6)
00586        stripsToAdd++; 
00587     
00588     stripCords sc;
00589     sc.m_detRawId = rawDetIDLast;
00590     sc.m_stripNo = 0;
00591     sc.m_isVirtual = true;
00592     for (int i = 0;i<stripsToAdd;i++){
00593         sc.m_stripNo--;
00594         newVirtualStrips[phiMaxLast+dphi*(i+1)]=sc;
00595         m_virtStripsInRingFromRolls++;
00596     }
00597   } // loop over dets end 
00598   
00599   
00600   if ( (isRefPlane()) && (m_virtStripsInRingFromRolls+m_physStripsInRingFromRolls!=1152)){
00601     
00602     edm::LogError("RPCTrigger")<<"Trouble. Reference curl " << getRingFromRollsId() 
00603         << " has " << m_virtStripsInRingFromRolls+m_physStripsInRingFromRolls << " strips."
00604         << " (v=" << m_virtStripsInRingFromRolls 
00605         << ";p=" << m_physStripsInRingFromRolls <<")";         
00606   }
00607   
00608   m_stripPhiMap.insert(newVirtualStrips.begin(),newVirtualStrips.end() );
00609 }

void RPCRingFromRolls::filterMixedStrips (  )  [private]

Filters strip.

Definition at line 436 of file RPCRingFromRolls.cc.

References find(), cmssw-higgs-4mu::firstRun, it, m_didFiltering, m_hwPlane, m_region, m_RPCDetInfoMap, m_stripPhiMap, and phi.

Referenced by makeOtherConnections().

00436                                         {
00437 
00438   if (m_didFiltering){ // run once
00439     return;
00440   }
00441   
00442   m_didFiltering=true;
00443   
00444   if (m_region != 0 || m_hwPlane != 4) 
00445     return;
00446   
00447 //  std::cout << "Another filtering" << std::endl;
00448   
00449   RPCRingFromRolls::phiMapCompare compare;
00450   /*
00451                   // compare(a,b) <=>  (a<b)
00452   if (compare(lowestPhiMap[scTemp.m_detRawId],it->first))
00453   {
00454     lowestPhiMap[scTemp.m_detRawId]=it->first;
00455   }
00456   */
00457   /*  
00458   std::map<uint32_t,float> phiCutMap;
00459   //Iterate over the chambers. For each chamber calculate a cut in phi
00460   RPCDetInfoPhiMap::const_iterator it = m_RPCDetPhiMap.begin();
00461   for(;it!=m_RPCDetPhiMap.end();it++){
00462   
00463   
00464 }*/
00465   
00466   // filter strips
00467   
00468   uint32_t curRawID = 0, firstRawID = 0;
00469   bool firstRun=true;
00470   float phiCut = 0;
00471   
00472   std::vector<uint32_t> procChambers; // Stores rawIds of chambers that were processed
00473     
00474   GlobalStripPhiMap::iterator it = m_stripPhiMap.begin();
00475   for(;it!=m_stripPhiMap.end();it++){
00476     
00477     if(firstRun){
00478       firstRun=false;
00479       curRawID = it->second.m_detRawId;
00480       phiCut = m_RPCDetInfoMap[curRawID].getMaxPhi();
00481       firstRawID = curRawID; // First chamber is processed twice - at begin at the end of processing
00482     } 
00483     else {
00484       float phi = it->first;
00485       uint32_t rawID = it->second.m_detRawId;
00486   //    std::cout << rawID << " " << phi << " " << phiCut << std::endl;
00487       if (rawID!=curRawID){ // Region of mixed strips
00488         //if (procChambers.find(rawID)!=procChambers.end()){
00489         if (std::find(procChambers.begin(),procChambers.end(),rawID)!=procChambers.end()){
00490           if (rawID == firstRawID && procChambers.size() != 1) {} //do nothing for first processed chamber when  
00491                                                                   // proccesing it second time at the end
00492           else
00493             throw RPCException("The chamber should be allready processed");
00494         }
00495         if (compare(phi,phiCut)){  // compare(a,b) <=>  (a<b)
00496           //GlobalStripPhiMap::iterator ittemp = it;
00497           m_stripPhiMap.erase(it++);// delete strip pointed by it (not by it++ !)
00498           //ittemp--; // 
00499           //it=ittemp; 
00500           it--; // go to prev. element - loop will inc. it for us
00501         } 
00502         else { // Strip is ok - start new chamber
00503           procChambers.push_back(curRawID); // Store info, that the chamber was proccessd
00504           curRawID=rawID; // save new chamber id
00505           phiCut = m_RPCDetInfoMap[curRawID].getMaxPhi(); // get new cut
00506         }
00507       
00508       }
00509         
00510         
00511     }
00512   
00513   
00514   }
00515   
00516   
00517 
00518 }

int RPCRingFromRolls::getMaxTower (  )  const

Returns value of max m_tower.

Definition at line 639 of file RPCRingFromRolls.cc.

References m_towerMax.

Referenced by makeOtherConnections().

int RPCRingFromRolls::getMinTower (  )  const

Returns value of min m_tower.

Definition at line 638 of file RPCRingFromRolls.cc.

References m_towerMin.

Referenced by makeOtherConnections().

int RPCRingFromRolls::getRingFromRollsId (  )  const

Returns value of max m_tower.

Definition at line 640 of file RPCRingFromRolls.cc.

References m_curlId.

Referenced by doVirtualStrips(), and makeOtherConnections().

RPCRingFromRolls::RPCLinks RPCRingFromRolls::giveConnections (  ) 

Definition at line 260 of file RPCRingFromRolls.cc.

References m_links.

00260                                                           {
00261   
00262   return m_links;
00263 }

int RPCRingFromRolls::giveLogPlaneForTower ( int  tower  )  [private]

Calculates m_logplane.

Todo:
Clean this method

Definition at line 370 of file RPCRingFromRolls.cc.

References funct::abs(), i, m_globRoll, m_hwPlane, m_mrlogp, and m_mrtow.

Referenced by makeOtherConnections(), and makeRefConnections().

00370                                                    {
00371     
00372   int logplane = -1;
00373   for (int i=0;i<3;i++){
00374     int ttemp = m_mrtow [std::abs(m_globRoll)] [m_hwPlane-1][i];
00375     if ( ttemp == std::abs(tower) )
00376       logplane = m_mrlogp [std::abs(m_globRoll)] [m_hwPlane-1][i];
00377   }
00378 
00379   return logplane;
00380 }

bool RPCRingFromRolls::isRefPlane (  )  const

Returns value of m_isReferencePlane.

Definition at line 637 of file RPCRingFromRolls.cc.

References m_isRefPlane.

Referenced by doVirtualStrips(), makeOtherConnections(), makeRefConnections(), and printContents().

int RPCRingFromRolls::makeOtherConnections ( float  phiCenter,
int  m_tower,
int  m_PAC 
)

Makes connections for Rings not beeing a refernce ones.

Definition at line 120 of file RPCRingFromRolls.cc.

References funct::abs(), doVirtualStrips(), filterMixedStrips(), getMaxTower(), getMinTower(), getRingFromRollsId(), giveLogPlaneForTower(), i, isRefPlane(), it, LogDebug, m_curlId, m_links, RPCRingFromRolls::RPCConnection::m_logplane, m_LOGPLANE_SIZE, RPCRingFromRolls::RPCConnection::m_PAC, RPCRingFromRolls::RPCConnection::m_posInCone, m_stripPhiMap, and RPCRingFromRolls::RPCConnection::m_tower.

Referenced by makeRefConnections().

00120                                                                                  {
00121   
00122   if (isRefPlane()){
00123     edm::LogError("RPCTrigger") << "Trouble. RingFromRolls " << m_curlId
00124         << " is a reference curl. makeOtherConnections() is not good for reference curls";
00125     return -1;
00126   }
00127 
00128   if ( (m_tower < getMinTower()) || (m_tower > getMaxTower()))  // This curl not contributes to this m_tower.
00129     return 0;
00130 
00131   doVirtualStrips();
00132   filterMixedStrips(); // Fixes overlaping chambers problem
00133   
00134   RPCConnection newConnection;
00135   newConnection.m_PAC = m_PAC;
00136   newConnection.m_tower = m_tower; 
00137   newConnection.m_logplane = giveLogPlaneForTower(newConnection.m_tower);
00138     
00139   if (newConnection.m_logplane < 0){
00140     
00141     LogDebug("RPCTrigger") << "Trouble. RingFromRolls "<< getRingFromRollsId()
00142         << " wants to contribute to m_tower " << m_tower;
00143        
00144     return -1;
00145   }
00146   
00147   int logplaneSize = m_LOGPLANE_SIZE[std::abs(newConnection.m_tower)][newConnection.m_logplane-1];
00148   //int logplaneSize = m_LOGPLANE_SIZE[std::abs(newConnection.m_tower)][m_hwPlane-1];
00149   
00150   if ((logplaneSize > 72)||(logplaneSize < 1)){
00151     LogDebug("RPCTrigger") << "Trouble. RingFromRolls "<< getRingFromRollsId()
00152         << " wants to have wrong strips number (" << logplaneSize<< ")"
00153         << " in plane " << newConnection.m_logplane
00154         << " in m_tower " << newConnection.m_tower;
00155         
00156     return -1;
00157   }
00158   
00159       
00160   // \note The  m_stripPhiMap is sorted in a special way (see header)
00161   GlobalStripPhiMap::const_iterator it = m_stripPhiMap.lower_bound(phiCentre);
00162   if (it==m_stripPhiMap.end()){
00163       it == m_stripPhiMap.begin();
00164   }
00165     
00166   
00167   for (int i=0; i < logplaneSize/2; i++){ 
00168     if (it==m_stripPhiMap.begin())
00169       it=m_stripPhiMap.end();  // (m_stripPhiMap.end()--) is ok.
00170     it--;
00171   }
00172   
00173   // In barell station 4 (farrest station) chambers overlap in phi.
00174   // This is the q&d method to avoid mixing of strips in logplanes
00175   /*
00176   if (m_region == 0 && m_hwPlane == 4){
00177                
00178       std::map<uint32_t,GlobalStripPhiMap> chambersMap;
00179       std::map<uint32_t,float> lowestPhiMap; // For finding lowest phi in each chamber
00180       
00181       for (int i=0; i < logplaneSize; i++){
00182           stripCords scTemp = it->second;
00183           (chambersMap[scTemp.m_detRawId])[it->first]=it->second;
00184           //aMap[it->first]=it->second;
00185           
00186           if (lowestPhiMap.find(scTemp.m_detRawId)==lowestPhiMap.end())// New detID
00187             {
00188                lowestPhiMap[scTemp.m_detRawId]=it->first;                                               
00189             } 
00190           else // detId allready in map
00191             {
00192                RPCRingFromRolls::phiMapCompare compare;
00193                   // compare(a,b) <=>  (a<b)
00194                if (compare(lowestPhiMap[scTemp.m_detRawId],it->first))
00195                  {
00196                    lowestPhiMap[scTemp.m_detRawId]=it->first;
00197                  }
00198             }
00199         it++;
00200         if (it==m_stripPhiMap.end())
00201           it=m_stripPhiMap.begin();
00202       } // for (int i=0; i < logplaneSize; i++) ends
00203       
00204 
00205       
00206       // sort chambers in phi
00207       std::map<float,uint32_t,phiMapCompare> chambersIds;
00208       
00209       std::map<uint32_t,float>::const_iterator phiIt =  lowestPhiMap.begin();
00210       for (;phiIt!=lowestPhiMap.end();phiIt++){
00211           chambersIds[phiIt->second]=phiIt->first;
00212       }
00213       
00214       // Now we can iterate over the strips in each chamber      
00215       std::map<float,uint32_t,phiMapCompare>::const_iterator chambersIt = chambersIds.begin();
00216       int curStripInConeNo = 0;
00217       for (;chambersIt!=chambersIds.end();chambersIt++){
00218           GlobalStripPhiMap aMap = chambersMap[chambersIt->second];
00219           
00220           GlobalStripPhiMap::const_iterator stripIt = aMap.begin();
00221           for(;stripIt!=aMap.end();stripIt++){
00222              //stripCords scTemp = stripIt->second;
00223              newConnection.m_posInCone = curStripInConeNo;
00224              m_links[stripIt->second].push_back(newConnection);
00225              curStripInConeNo++;
00226           }
00227       }
00228   
00229 }
00230   else // Normal, non overlaping chamber
00231   {
00232       for (int i=0; i < logplaneSize; i++){
00233         stripCords scTemp = it->second;
00234         newConnection.m_posInCone = i;
00235         m_links[it->second].push_back(newConnection);
00236     
00237         it++;
00238         if (it==m_stripPhiMap.end())
00239           it=m_stripPhiMap.begin();
00240       }
00241   }
00242   */
00243   
00244   // 
00245   for (int i=0; i < logplaneSize; i++){
00246     stripCords scTemp = it->second;
00247     newConnection.m_posInCone = i;
00248     m_links[it->second].push_back(newConnection);
00249     
00250     it++;
00251     if (it==m_stripPhiMap.end())
00252       it=m_stripPhiMap.begin();
00253   }
00254 
00255     
00256   return 0;
00257   
00258 }

int RPCRingFromRolls::makeRefConnections ( RPCRingFromRolls otherRingFromRolls  ) 

Makes connections for reference rings.

Todo:
Calculate centrePhi in more elegant way
Note:
Conevention: first strip in m_logplane is no. 0

Definition at line 273 of file RPCRingFromRolls.cc.

References doVirtualStrips(), giveLogPlaneForTower(), i, isRefPlane(), it, m_curlId, m_links, RPCRingFromRolls::RPCConnection::m_logplane, RPCRingFromRolls::RPCConnection::m_PAC, RPCRingFromRolls::RPCConnection::m_posInCone, m_stripPhiMap, RPCRingFromRolls::RPCConnection::m_tower, m_towerMin, makeOtherConnections(), max, min, and pi.

00273                                                                             {
00274   
00275   if (!isRefPlane()){
00276     
00277     edm::LogError("RPCTrigger") << "Trouble. RingFromRolls " << m_curlId 
00278         << " is not a reference curl. makeRefConnections() is good only for reference curls";
00279         
00280     return -1;
00281   }
00282   
00283   doVirtualStrips();
00284   
00285   int curPacNo=-1;  // pacs are numbered from 0 to 143 (there is curPacNo++ in first iteration)
00286   int curStripNo=0;
00287   int curBegStripNo=0;
00288   
00289   
00290   GlobalStripPhiMap::const_iterator it;    
00291   // \note The  m_stripPhiMap is sorted in a special way (see header)
00292   for (it=m_stripPhiMap.begin(); it != m_stripPhiMap.end(); it++){
00293     
00294     if (curStripNo%8==0)    // new pac
00295     {
00296       curPacNo++;
00297       curBegStripNo=curStripNo;
00298       
00299       GlobalStripPhiMap::const_iterator plus8 = it;    
00300       for (int i=0;i<7;i++){  // i<7 (!) - there are 8 strips in ref plane !! i<8 would be wrong
00301         plus8++;
00302         if (plus8==m_stripPhiMap.end()){ // \note The  m_stripPhiMap is sorted in a special way (see header)
00303           plus8--;
00304           break;
00305         }
00306       }
00307       
00308       float phi1 = it->first;
00309       float phi2 = plus8->first;
00310       float centrePhi = (phi1+phi2)/2;
00311       
00312       if (std::min(phi1,phi2) < 1 && std::max(phi1,phi2) > 5)// to avoid (0+2pi)/2 = pi (should be = 0 )
00313       {
00314         const float pi = 3.141592654;
00315         centrePhi -= pi;
00316         if (centrePhi<0)
00317           centrePhi += 2*pi;
00318       }
00319       otherRingFromRolls->makeOtherConnections(centrePhi, m_towerMin, curPacNo);// Make Connections within the other curl
00320     } // new pac end
00321     
00322     RPCConnection newConnection;
00323     newConnection.m_PAC = curPacNo;
00324     newConnection.m_tower = m_towerMin; // For refRingFromRolls m_towerMin and m_towerMax are equal
00325     newConnection.m_posInCone = curStripNo-curBegStripNo;  // Conevention: first strip in m_logplane is no. 0 
00326     
00327     newConnection.m_logplane = giveLogPlaneForTower(newConnection.m_tower);
00328   
00329     if (newConnection.m_logplane < 0){
00330       
00331       edm::LogError("RPCTrigger") << "Trouble. Strip " << it->second.m_stripNo
00332           << " of det " << it->second.m_detRawId
00333           << " has negative m_logplane";
00334       
00335     }
00336     
00337     if (m_links.find(it->second)==m_links.end() ){// new strip in map
00338       m_links[it->second].push_back(newConnection);
00339     } 
00340     else {  // strip allready in map, we should have the same connections
00341       
00342       RPCConnectionsVec existingConnection = m_links[it->second];
00343       if ( (existingConnection[0].m_PAC != newConnection.m_PAC ) ||  
00344             (existingConnection[0].m_tower != newConnection.m_tower ) ||
00345             (existingConnection[0].m_logplane != newConnection.m_logplane ) ||
00346             (existingConnection[0].m_posInCone != newConnection.m_posInCone ) )
00347       {
00348         
00349         edm::LogError("RPCTrigger") << "Trouble. Strip " << it->second.m_stripNo
00350             << " of reference det " << it->second.m_detRawId
00351             << " has multiple connections";
00352             
00353       }
00354       
00355     } // end check if strip allready in map
00356     curStripNo++;
00357   }// end loop over strips
00358   
00359   
00360   return 0;    
00361 }

void RPCRingFromRolls::printContents (  ) 

prints the contents of a RPCRingFromRolls.

Definition at line 732 of file RPCRingFromRolls.cc.

References isRefPlane(), LogDebug, m_globRoll, m_hwPlane, m_links, m_physStripsInRingFromRolls, m_RPCDetInfoMap, m_towerMax, m_towerMin, and m_virtStripsInRingFromRolls.

00732                                      {
00733 
00734   /*
00735   if (getRingFromRollsId()==71001){
00736 
00737     GlobalStripPhiMap::const_iterator it;
00738     for (it=m_stripPhiMap.begin(); it != m_stripPhiMap.end(); it++){
00739       LogDebug("RPCTrigger") << "phi" << it->first
00740           << " m_stripNo=" << (it->second).m_stripNo
00741           << " m_isVirtual=" << (it->second).m_isVirtual
00742     }
00743   }//*/
00744 
00745   if (isRefPlane())
00746     LogDebug("RPCTrigger") << " Reference plane:";
00747   else
00748     LogDebug("RPCTrigger") << " Normal plane:";
00749   
00750   LogDebug("RPCTrigger") << "No. of DetInfo's " << m_RPCDetInfoMap.size()
00751       << "; towers: min= " << m_towerMin 
00752       << " max= " << m_towerMax 
00753       << "|globRoll= " << m_globRoll
00754       << " hwPlane= " << m_hwPlane
00755       << "|strips:"
00756       << " phys= " << m_physStripsInRingFromRolls
00757       << " virt= " << m_virtStripsInRingFromRolls
00758       << " all= " << m_virtStripsInRingFromRolls+m_physStripsInRingFromRolls
00759       << "|strips conneced: " << m_links.size(); // with or without virtual strips. check it, it may have changed
00760   
00761   
00762   /*
00763   RPCDetInfoPhiMap::const_iterator it;
00764   for (it = m_RPCDetPhiMap.begin(); it != m_RPCDetPhiMap.end(); it++){
00765   
00766     //LogDebug("RPCTrigger")
00767     //    << "Phi: " << it->first << " "
00768     //   << "detId: " << it->second  <<
00769   
00770     
00771     m_RPCDetInfoMap[it->second].printContents();
00772         
00773   }
00774   //*/
00775   /*
00776   GlobalStripPhiMap::const_iterator it;
00777   for (it = m_stripPhiMap.begin(); it != m_stripPhiMap.end(); it++){
00778   LogDebug("RPCTrigger")
00779         << "Phi: " << it->first 
00780         << " detId: " << it->second.m_detRawId 
00781         << " m_stripNo: " << it->second.m_stripNo  << 
00782   }//*/
00783 
00784 }

void RPCRingFromRolls::setRefPlane (  )  [private]

Checks and sets value of m_isReferencePlane.

Note:
hwPlane numbering is non trivial

Definition at line 618 of file RPCRingFromRolls.cc.

References funct::abs(), m_curlId, m_hwPlane, m_isRefPlane, m_region, and m_ring.

Referenced by addDetId().

00618                                    {
00619   
00620   m_isRefPlane = false;
00621   if (m_region == 0 && std::abs(m_ring)<2 && m_hwPlane == 2) // for barell wheel -1,0,1 refplane is hwPlane=2
00622     m_isRefPlane = true;
00623   else if (m_region == 0 && std::abs(m_ring)==2 && m_hwPlane == 6) // for barell wheel -2,2 refplane is hwPlane=6
00624     m_isRefPlane = true;
00625   else if (m_region != 0 && m_hwPlane == 2) // for endcaps
00626     m_isRefPlane = true;
00627   
00628   if( m_curlId == 2008 || m_curlId == 2108) //exception: endcaps;hwplane 2;farest roll from beam
00629     m_isRefPlane = false;
00630 }

void RPCRingFromRolls::updatePhiStripsMap ( RPCDetInfo  detInfo  )  [private]

Updates m_stripPhiMap.

Definition at line 388 of file RPCRingFromRolls.cc.

References RPCDetInfo::getRPCStripPhiMap(), it, RPCRingFromRolls::stripCords::m_detRawId, RPCRingFromRolls::stripCords::m_isVirtual, m_physStripsInRingFromRolls, RPCRingFromRolls::stripCords::m_stripNo, m_stripPhiMap, HLT_VtxMuL3::maxPhi, HLT_VtxMuL3::minPhi, phi, and RPCDetInfo::rawId().

Referenced by addDetId().

00388                                                            {
00389   
00390   uint32_t rawId = detInfo.rawId();
00391   
00392   RPCDetInfo::RPCStripPhiMap sourceMap = detInfo.getRPCStripPhiMap();
00393   RPCDetInfo::RPCStripPhiMap::const_iterator it;
00394   
00395   float maxPhi=0, minPhi=0;
00396   int maxStripNo=0;
00397   bool firstIt=true;
00398   
00399   for (it = sourceMap.begin(); it != sourceMap.end(); it++){
00400 
00401     float phi = it->second;
00402     stripCords sc;
00403     sc.m_stripNo = it->first;
00404     sc.m_detRawId = rawId;
00405     sc.m_isVirtual = false;
00406     m_stripPhiMap[phi]=sc;
00407     
00408     if(firstIt){
00409       maxPhi=phi;
00410       minPhi=phi;
00411       maxStripNo = sc.m_stripNo;
00412       firstIt=false;          
00413     } 
00414     
00415     if(phi < minPhi){
00416       minPhi=phi;
00417     }
00418     if(phi > maxPhi){
00419       maxPhi=phi;
00420     }
00421     
00422     if (maxStripNo<sc.m_stripNo)
00423       maxStripNo=sc.m_stripNo;
00424     
00425     m_physStripsInRingFromRolls++;
00426   }// loop end
00427   
00428 }


Friends And Related Function Documentation

friend class RPCVHDLConeMaker [friend]

Definition at line 20 of file RPCRingFromRolls.h.


Member Data Documentation

int RPCRingFromRolls::m_curlId [private]

this curlId

Definition at line 84 of file RPCRingFromRolls.h.

Referenced by addDetId(), getRingFromRollsId(), makeOtherConnections(), makeRefConnections(), RPCRingFromRolls(), and setRefPlane().

bool RPCRingFromRolls::m_didFiltering [private]

Definition at line 93 of file RPCRingFromRolls.h.

Referenced by filterMixedStrips(), and RPCRingFromRolls().

bool RPCRingFromRolls::m_didVirtuals [private]

Definition at line 92 of file RPCRingFromRolls.h.

Referenced by doVirtualStrips(), and RPCRingFromRolls().

int RPCRingFromRolls::m_globRoll [private]

Definition at line 88 of file RPCRingFromRolls.h.

Referenced by addDetId(), giveLogPlaneForTower(), printContents(), and RPCRingFromRolls().

int RPCRingFromRolls::m_hwPlane [private]

Hardware plane no.

Definition at line 80 of file RPCRingFromRolls.h.

Referenced by addDetId(), doVirtualStrips(), filterMixedStrips(), giveLogPlaneForTower(), printContents(), RPCRingFromRolls(), and setRefPlane().

bool RPCRingFromRolls::m_isDataFresh [private]

Defines if data has real world contents.

Definition at line 90 of file RPCRingFromRolls.h.

Referenced by addDetId(), and RPCRingFromRolls().

bool RPCRingFromRolls::m_isRefPlane [private]

tells if detIds from this curl form a reference plane

Definition at line 91 of file RPCRingFromRolls.h.

Referenced by isRefPlane(), RPCRingFromRolls(), and setRefPlane().

RPCLinks RPCRingFromRolls::m_links [private]

Definition at line 94 of file RPCRingFromRolls.h.

Referenced by giveConnections(), makeOtherConnections(), makeRefConnections(), and printContents().

const unsigned int RPCRingFromRolls::m_LOGPLANE_SIZE [static, private]

Initial value:

 {

 
           {72, 56,  8, 40, 40, 24}, 
           {72, 56,  8, 40, 40, 24}, 
           {72, 56,  8, 40, 40, 24}, 
           {72, 56,  8, 40, 40, 24}, 
           {72, 56,  8, 40, 40, 24}, 
           {72, 56, 40,  8, 40, 24}, 
           {56, 72, 40,  8, 24,  0}, 
           {72, 56, 40,  8, 24,  0}, 
           {72, 24, 40,  8,  0,  0}, 
           {72,  8, 40,  0,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}, 
           {72,  8, 40, 24,  0,  0}  

}

Definition at line 131 of file RPCRingFromRolls.h.

Referenced by makeOtherConnections(), RPCVHDLConeMaker::writeHeader(), RPCVHDLConeMaker::writePatternsDef(), and RPCVHDLConeMaker::writeXMLPatternsDef().

const int RPCRingFromRolls::m_mrlogp [static, private]

Initial value:


{


  {  {0,0,0},   {3,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,-1},  {3,0,0},   {5,5,0},   {6,6,0},   {2,2,-2},  {4,4,0} },  
  {  {1,1,1},   {3,0,0},   {5,5,0},   {6,6,0},   {2,2,2},   {4,4,0} },  
  {  {0,0,0},   {3,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,-5},  {3,0,0},   {5,5,5},   {6,6,0},   {2,2,0},   {4,4,0} },  
  {  {1,1,1},   {3,-3,3},  {5,5,0},   {6,0,0},   {2,2,2},   {4,0,0} },  
  {  {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {4,0,0} },  
  {  {1,1,0},   {3,-3,0},  {5,5,0},   {6,6,0},   {2,2,0},   {4,0,0} },  
  {  {0,5,0},   {0,0,0},   {3,-5,0},  {4,0,0},   {0,0,0},   {0,0,0} },  
  {  {5,3,0},   {4,0,0},   {3,-5,3},  {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {3,0,0},   {2,0,0},   {3,3,0},   {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {1,0,0},   {2,0,0},   {3,3,0},   {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,0},   {2,0,0},   {3,3,0},   {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,0},   {2,0,0},   {3,3,0},   {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,0},   {2,0,0},   {3,3,0},   {4,4,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,0},   {2,0,0},   {3,3,0},   {4,0,0},   {0,0,0},   {0,0,0} },  
  {  {1,1,0},   {2,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0} },  
  {  {1,0,0},   {2,0,0},   {0,0,0},   {0,0,0},   {0,0,0},   {0,0,0} }   
}

Definition at line 130 of file RPCRingFromRolls.h.

Referenced by giveLogPlaneForTower().

const int RPCRingFromRolls::m_mrtow [static, private]

Initial value:


{


  { {-1,-1,-1},{ 0,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1} },   
  { { 0, 1,-2},{ 1,-1,-1},{ 0, 1,-1},{ 0, 1,-1},{ 0, 1,-2},{ 0, 1,-1} },   
  { { 2, 3, 4},{ 2,-1,-1},{ 1, 2,-1},{ 1, 2,-1},{ 2, 3, 4},{ 2, 3,-1} },   
  { {-1,-1,-1},{ 3,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1} },   
  { { 4, 5,-6},{ 4,-1,-1},{ 2, 3, 4},{ 2, 3,-1},{ 4, 5,-1},{ 3, 4,-1} },   
  { { 6, 7, 8},{ 5,-6, 6},{ 4, 5,-1},{ 4,-1,-1},{ 5, 6, 7},{ 5,-1,-1} },   
  { {-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{ 6,-1,-1} },   
  { { 8, 9,-1},{ 7,-7,-1},{ 5, 6,-1},{ 4, 5,-1},{ 7, 8,-1},{ 7,-1,-1} },   
  { {-1, 7,-1},{-1,-1,-1},{ 9,-9,-1},{10,-1,-1},{-1,-1,-1},{-1,-1,-1} },   
  { { 7, 8,-1},{ 8,-1,-1},{ 9,-9,10},{10,11,-1},{-1,-1,-1},{-1,-1,-1} },   
  { { 8,-1,-1},{ 9,-1,-1},{10,11,-1},{11,12,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {10,-1,-1},{10,-1,-1},{11,12,-1},{12,13,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {10,11,-1},{11,-1,-1},{12,13,-1},{13,14,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {11,12,-1},{12,-1,-1},{13,14,-1},{14,15,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {13,14,-1},{13,-1,-1},{14,15,-1},{15,16,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {14,15,-1},{14,-1,-1},{15,16,-1},{16,-1,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {15,16,-1},{15,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1} },   
  { {16,-1,-1},{16,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1} }    
}

Definition at line 129 of file RPCRingFromRolls.h.

Referenced by addDetId(), and giveLogPlaneForTower().

int RPCRingFromRolls::m_physStripsInRingFromRolls [private]

m_Number of existing strips in curl;

Definition at line 85 of file RPCRingFromRolls.h.

Referenced by doVirtualStrips(), printContents(), RPCRingFromRolls(), and updatePhiStripsMap().

int RPCRingFromRolls::m_region [private]

Region no - 0 for barell +-1 for endcaps.

Definition at line 81 of file RPCRingFromRolls.h.

Referenced by addDetId(), filterMixedStrips(), RPCRingFromRolls(), and setRefPlane().

int RPCRingFromRolls::m_ring [private]

Wheel number for barell, ring number for endcaps.

Definition at line 82 of file RPCRingFromRolls.h.

Referenced by addDetId(), RPCRingFromRolls(), and setRefPlane().

int RPCRingFromRolls::m_roll [private]

roll no

Definition at line 83 of file RPCRingFromRolls.h.

Referenced by addDetId(), and RPCRingFromRolls().

RPCDetInfoMap RPCRingFromRolls::m_RPCDetInfoMap [private]

Stores all DetId`s of a curl.

Definition at line 99 of file RPCRingFromRolls.h.

Referenced by addDetId(), doVirtualStrips(), filterMixedStrips(), and printContents().

RPCDetInfoPhiMap RPCRingFromRolls::m_RPCDetPhiMap [private]

Stores DetId`s rawId in a phi order.

Definition at line 103 of file RPCRingFromRolls.h.

Referenced by addDetId(), and doVirtualStrips().

GlobalStripPhiMap RPCRingFromRolls::m_stripPhiMap [private]

Definition at line 127 of file RPCRingFromRolls.h.

Referenced by doVirtualStrips(), filterMixedStrips(), makeOtherConnections(), makeRefConnections(), and updatePhiStripsMap().

int RPCRingFromRolls::m_towerMax [private]

The highest m_tower no. to which curl contributes.

Definition at line 79 of file RPCRingFromRolls.h.

Referenced by addDetId(), getMaxTower(), printContents(), and RPCRingFromRolls().

int RPCRingFromRolls::m_towerMin [private]

The lowest m_tower no. to which curl contributes.

Definition at line 78 of file RPCRingFromRolls.h.

Referenced by addDetId(), getMinTower(), makeRefConnections(), printContents(), and RPCRingFromRolls().

int RPCRingFromRolls::m_virtStripsInRingFromRolls [private]

m_Number of virtual strips in curl;

Definition at line 86 of file RPCRingFromRolls.h.

Referenced by doVirtualStrips(), printContents(), and RPCRingFromRolls().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:07 2009 for CMSSW by  doxygen 1.5.4