CMS 3D CMS Logo

RPCPac.cc

Go to the documentation of this file.
00001 #include "L1Trigger/RPCTrigger/interface/RPCPac.h"
00002 //#include "L1Trigger/RPCTrigger/interface/TEPatternsGroup.h"
00003 
00004 RPCPac::RPCPac(const RPCPacData * pacData, int tower, int logSector,
00005                 int logSegment):
00006 RPCPacBase(tower, logSector, logSegment)
00007 {
00008 
00009   m_pacData = pacData;
00010 
00011 }
00012 
00020 RPCPacMuon RPCPac::run(const RPCLogCone & cone) const
00021 {                               //symualcja
00022   
00023   RPCPacMuon bestMuon;
00024   //track  
00025   if(m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size() > 0)
00026     bestMuon = runTrackPatternsGroup(cone);
00027 
00028   //energetic
00029   if(m_pacData->m_EnergeticPatternsGroupList.size() > 0)
00030     {
00031       RPCPacMuon bufMuon = runEnergeticPatternsGroups(cone);
00032       if(bufMuon > bestMuon)
00033         bestMuon = bufMuon;
00034     }
00035 
00036   bestMuon.setConeCrdnts(m_CurrConeCrdnts);
00037   
00038 
00039   //bestMuon.setConeCrdnts(cone.);
00040   bestMuon.setLogConeIdx(cone.getIdx());
00041   /*
00042   int refStripNum = m_pacData->getPattern(bestMuon.getPatternNum())
00043                              .getStripFrom(RPCConst::m_REF_PLANE[abs(m_CurrConeCrdnts.m_Tower)])
00044                               +  m_CurrConeCrdnts.m_LogSector * 96
00045                               + m_CurrConeCrdnts.m_LogSegment * 8;
00046   bestMuon.setRefStripNum(refStripNum);*/
00047   return bestMuon;
00048 }
00049 
00050 
00051 RPCPacMuon RPCPac::runTrackPatternsGroup(const RPCLogCone & cone) const
00052 {
00053   RPCPacMuon bestMuon;
00054 
00055   for(unsigned int vecNum = 0;
00056        vecNum < m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size(); vecNum++)
00057     {
00058       unsigned short firedPlanes = 0;
00059       int firedPlanesCount = 0;
00060       unsigned short one = 1;
00061       const RPCPattern & pattern =
00062           *(m_pacData->m_TrackPatternsGroup.m_PatternsItVec[vecNum]);
00063       for(int logPlane = RPCConst::m_FIRST_PLANE;
00064            logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00065            logPlane++)
00066         {
00067           if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
00068             {
00069               //firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
00070               continue;
00071             }
00072           int fromBit = pattern.getStripFrom(logPlane);
00073           int toBit = pattern.getStripTo(logPlane);
00074           for(int bitNumber = fromBit; bitNumber < toBit; bitNumber++)
00075             {
00076               if(cone.getLogStripState(logPlane, bitNumber) == true)
00077                 {
00078                   firedPlanes = firedPlanes | one;
00079                   firedPlanesCount++;
00080                   break;
00081                 }
00082             }
00083 
00084             if((RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)] -
00085                logPlane) == 3)
00086             if(firedPlanesCount == 0)
00087               break;
00088 
00089           one = one << 1;
00090         }
00091 
00092       if(firedPlanesCount >= 3)
00093         {
00094           short quality =
00095               m_pacData->m_QualityTabsVec[pattern.getQualityTabNumber()][firedPlanes];
00096           if(quality != -1)
00097             {
00098               if(quality >= bestMuon.getQuality())
00099                 {
00100                   RPCPacMuon bufMuon(pattern, quality, firedPlanes);
00101                   if(bufMuon > bestMuon)
00102                     {
00103                       bestMuon = bufMuon;
00104                     }
00105                 }
00106             }
00107         }
00108     }
00109   return bestMuon;
00110 }
00111 
00112 
00113 
00114 RPCPacMuon
00115 RPCPac::runEnergeticPatternsGroups(const RPCLogCone & cone) const
00116 {
00117   RPCPacMuon bestMuon;
00118   unsigned short firedPlanes = 0;
00119   int firedPlanesCount = 0;
00120   RPCPacData::TEPatternsGroupList::const_iterator iEGroup =
00121       m_pacData->m_EnergeticPatternsGroupList.begin();
00122   for(; iEGroup != m_pacData->m_EnergeticPatternsGroupList.end(); iEGroup++)
00123     {
00124       firedPlanes = 0;
00125       firedPlanesCount = 0;
00126       unsigned short one = 1;
00127       for(int logPlane = RPCConst::m_FIRST_PLANE;
00128            logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00129            logPlane++)
00130         {                       //or po paskach ze stozka
00131           for(unsigned int bitNum = 0;
00132                bitNum <
00133                RPCConst::
00134                m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane];
00135                bitNum++)
00136             {
00137               if(iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum)
00138                   && cone.getLogStripState(logPlane, bitNum))
00139                 {
00140                   firedPlanes = firedPlanes | one;
00141                   firedPlanesCount++;
00142                   break;
00143                 }
00144             }
00145           one = one << 1;
00146         }
00147 
00148       short quality =
00149           m_pacData->m_QualityTabsVec[iEGroup->m_QualityTabNumber][firedPlanes];
00150       if(quality == -1)
00151         continue;
00152 
00153       RPCPacMuon bufMuon;
00154       for(unsigned int vecNum = 0; vecNum < iEGroup->m_PatternsItVec.size();
00155            vecNum++)
00156         {
00157           const RPCPattern::RPCPatVec::const_iterator patternIt =
00158             iEGroup->m_PatternsItVec[vecNum];
00159           const RPCPattern & pattern = *patternIt;
00160           bool wasHit = false;
00161           unsigned short one1 = 1;
00162           for(int logPlane = RPCConst::m_FIRST_PLANE;
00163                logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00164                logPlane++, one1 = one1 << 1)
00165             {
00166               if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
00167                 {
00168 //          firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
00169                   continue;
00170                 }
00171               if((firedPlanes & one1) != 0)
00172                 {
00173                   int fromBit = pattern.getStripFrom(logPlane);
00174                   int toBit = pattern.getStripTo(logPlane);
00175                   wasHit = false;
00176                   for(int bitNumber = fromBit; bitNumber < toBit;
00177                        bitNumber++)
00178                     wasHit = wasHit
00179                       || cone.getLogStripState(logPlane, bitNumber);
00180                   if(!wasHit)
00181                     break;
00182                 }
00183             }
00184           if(wasHit)
00185             {
00186               bufMuon.setAll(pattern, quality, firedPlanes);
00187               break;            //if one pattern fits, thers no point to check other patterns from group
00188             }
00189         }                       //end of patterns loop
00190       if(bufMuon > bestMuon)
00191         bestMuon = bufMuon;
00192       if(bestMuon.getQuality() == m_pacData->m_MaxQuality)
00193         return bestMuon;
00194     }                           //end of EGroup loop
00195   return bestMuon;
00196 }

Generated on Tue Jun 9 17:40:23 2009 for CMSSW by  doxygen 1.5.4