CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

RPCPac Class Reference

#include <RPCPac.h>

Inheritance diagram for RPCPac:
RPCPacBase

List of all members.

Public Member Functions

 RPCPac (const RPCPacData *, int tower, int logSector, int logSegment)
RPCPacMuon run (const RPCLogCone &cone) const

Private Member Functions

RPCPacMuon runEnergeticPatternsGroups (const RPCLogCone &cone) const
RPCPacMuon runTrackPatternsGroup (const RPCLogCone &cone) const

Private Attributes

const RPCPacDatam_pacData

Detailed Description

Definition at line 14 of file RPCPac.h.


Constructor & Destructor Documentation

RPCPac::RPCPac ( const RPCPacData pacData,
int  tower,
int  logSector,
int  logSegment 
)

Definition at line 4 of file RPCPac.cc.

References m_pacData.

                               :
RPCPacBase(tower, logSector, logSegment)
{

  m_pacData = pacData;

}

Member Function Documentation

RPCPacMuon RPCPac::run ( const RPCLogCone cone) const

Runs Pattern Comparator algorithm for hits from the cone. Calls the runTrackPatternsGroup() and runEnergeticPatternsGroups().

Returns:
found track candidate (empty if hits does not fit to eny pattern)

Definition at line 20 of file RPCPac.cc.

References RPCLogCone::getIdx(), RPCPacBase::m_CurrConeCrdnts, RPCPacData::m_EnergeticPatternsGroupList, m_pacData, TPatternsGroup::m_PatternsItVec, RPCPacData::m_TrackPatternsGroup, runEnergeticPatternsGroups(), runTrackPatternsGroup(), RPCMuon::setConeCrdnts(), and RPCMuon::setLogConeIdx().

{                               //symualcja
  
  RPCPacMuon bestMuon;
  //track  
  if(m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size() > 0)
    bestMuon = runTrackPatternsGroup(cone);

  //energetic
  if(m_pacData->m_EnergeticPatternsGroupList.size() > 0)
    {
      RPCPacMuon bufMuon = runEnergeticPatternsGroups(cone);
      if(bufMuon > bestMuon)
        bestMuon = bufMuon;
    }

  bestMuon.setConeCrdnts(m_CurrConeCrdnts);
  

  //bestMuon.setConeCrdnts(cone.);
  bestMuon.setLogConeIdx(cone.getIdx());
  /*
  int refStripNum = m_pacData->getPattern(bestMuon.getPatternNum())
                             .getStripFrom(RPCConst::m_REF_PLANE[abs(m_CurrConeCrdnts.m_Tower)])
                              +  m_CurrConeCrdnts.m_LogSector * 96
                              + m_CurrConeCrdnts.m_LogSegment * 8;
  bestMuon.setRefStripNum(refStripNum);*/
  return bestMuon;
}
RPCPacMuon RPCPac::runEnergeticPatternsGroups ( const RPCLogCone cone) const [private]

Definition at line 120 of file RPCPac.cc.

References abs, RPCLogCone::getHitsCnt(), RPCLogCone::getLogPlane(), RPCLogCone::getLogStripDigisIdxs(), RPCLogCone::getLogStripState(), RPCPattern::getStripFrom(), RPCPattern::getStripTo(), RPCPacBase::m_ConeCrdnts, RPCPacData::m_EnergeticPatternsGroupList, RPCConst::m_FIRST_PLANE, RPCConst::m_NOT_CONECTED, m_pacData, RPCPacData::m_QualityTabsVec, RPCConst::l1RpcConeCrdnts::m_Tower, RPCConst::m_USED_PLANES_COUNT, listBenchmarks::pattern, RPCPacMuon::setAll(), RPCMuon::setDigiIdxVec(), and strip().

Referenced by run().

{
  RPCPacMuon bestMuon;
  unsigned short firedPlanes = 0;
  int firedPlanesCount = 0;
  RPCPacData::TEPatternsGroupList::const_iterator iEGroup =
      m_pacData->m_EnergeticPatternsGroupList.begin();
  for(; iEGroup != m_pacData->m_EnergeticPatternsGroupList.end(); iEGroup++)
    {
      firedPlanes = 0;
      firedPlanesCount = 0;
      unsigned short one = 1;
      for(int logPlane = RPCConst::m_FIRST_PLANE;
           logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
           logPlane++)
        {                       //or po paskach ze stozka

          if (cone.getHitsCnt(logPlane)>0 ) {
            RPCLogCone::TLogPlane lp = cone.getLogPlane(logPlane);
            RPCLogCone::TLogPlane::const_iterator itLP = lp.begin();
            RPCLogCone::TLogPlane::const_iterator itLPE = lp.end();
            for(; itLP!=itLPE; ++itLP){
               int strip=itLP->first;
               if(iEGroup->m_GroupShape.getLogStripState(logPlane, strip)){
                  firedPlanes = firedPlanes | one;
                  firedPlanesCount++;
                  break;
               }
            }

          }
          /*
          for(unsigned int bitNum = 0;
               bitNum <
               RPCConst::
               m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane];
               bitNum++)
            {
              if(iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum)
                  && cone.getLogStripState(logPlane, bitNum))
                {
                  firedPlanes = firedPlanes | one;
                  firedPlanesCount++;
                  break;
                }
            }
           */
          one = one << 1;
        }

      short quality =
          m_pacData->m_QualityTabsVec[iEGroup->m_QualityTabNumber][firedPlanes];
      if(quality == -1)
        continue;

      RPCPacMuon bufMuon;
      for(unsigned int vecNum = 0; vecNum < iEGroup->m_PatternsItVec.size();
           vecNum++)
        {
          RPCMuon::TDigiLinkVec digiIdx; 
          const RPCPattern::RPCPatVec::const_iterator patternIt =
            iEGroup->m_PatternsItVec[vecNum];
          const RPCPattern & pattern = *patternIt;
          bool wasHit = false;
          unsigned short one1 = 1;
          for(int logPlane = RPCConst::m_FIRST_PLANE;
               logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
               logPlane++, one1 = one1 << 1)
            {
              if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
                {
//          firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                  continue;
                }
              if((firedPlanes & one1) != 0)
                {
                  int fromBit = pattern.getStripFrom(logPlane);
                  int toBit = pattern.getStripTo(logPlane);
                  wasHit = false;
                  for(int bitNumber = fromBit; bitNumber < toBit;
                       bitNumber++)
                  {
                    wasHit = wasHit || cone.getLogStripState(logPlane, bitNumber);
                    if (wasHit) { // no sense to check more
                      std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
                      if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin())  );
                      break;
                    }
                  }

                  if(!wasHit){
                    break;
                  } 
                }
            }
          if(wasHit)
            {
              bufMuon.setAll(pattern, quality, firedPlanes);
              bufMuon.setDigiIdxVec(digiIdx); 
              break;            //if one pattern fits, thers no point to check other patterns from group
            }
        }                       //end of patterns loop
      if(bufMuon > bestMuon){
        bestMuon = bufMuon;
      }
      //if(bestMuon.getQuality() == m_pacData->m_MaxQuality)
      //  return bestMuon;
    }                           //end of EGroup loop
  return bestMuon;
}
RPCPacMuon RPCPac::runTrackPatternsGroup ( const RPCLogCone cone) const [private]

Definition at line 51 of file RPCPac.cc.

References abs, RPCLogCone::getLogStripDigisIdxs(), RPCLogCone::getLogStripState(), RPCMuon::getQuality(), RPCPattern::getQualityTabNumber(), RPCPattern::getStripFrom(), RPCPattern::getStripTo(), RPCPacBase::m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_NOT_CONECTED, m_pacData, TPatternsGroup::m_PatternsItVec, RPCPacData::m_QualityTabsVec, RPCConst::l1RpcConeCrdnts::m_Tower, RPCPacData::m_TrackPatternsGroup, RPCConst::m_USED_PLANES_COUNT, listBenchmarks::pattern, and RPCMuon::setDigiIdxVec().

Referenced by run().

{
  RPCPacMuon bestMuon;

  for(unsigned int vecNum = 0;
       vecNum < m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size(); vecNum++)
    {
      RPCMuon::TDigiLinkVec digiIdx; 
      unsigned short firedPlanes = 0;
      int firedPlanesCount = 0;
      unsigned short one = 1;
      const RPCPattern & pattern =
          *(m_pacData->m_TrackPatternsGroup.m_PatternsItVec[vecNum]);
      for(int logPlane = RPCConst::m_FIRST_PLANE;
           logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
           logPlane++)
        {
          if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
            {
              //firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
              continue;
            }
          int fromBit = pattern.getStripFrom(logPlane);
          int toBit = pattern.getStripTo(logPlane);
          for(int bitNumber = fromBit; bitNumber < toBit; bitNumber++)
            {
              if(cone.getLogStripState(logPlane, bitNumber) == true)
                {
                  firedPlanes = firedPlanes | one;
                  firedPlanesCount++;
                  std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
                  if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin())  );
                                
                  break;
                }
            }

            if((RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)] -
               logPlane) == 3)
            if(firedPlanesCount == 0)
              break;

          one = one << 1;
        }

      if(firedPlanesCount >= 3)
        {
          short quality =
              m_pacData->m_QualityTabsVec[pattern.getQualityTabNumber()][firedPlanes];
          if(quality != -1)
            {
              if(quality >= bestMuon.getQuality())
                {
                  RPCPacMuon bufMuon(pattern, quality, firedPlanes);
                  if(bufMuon > bestMuon)
                    {
                      bestMuon = bufMuon;
                      bestMuon.setDigiIdxVec(digiIdx); 
                    }
                }
            }
        }
    }
  return bestMuon;
}

Member Data Documentation

const RPCPacData* RPCPac::m_pacData [private]

Definition at line 27 of file RPCPac.h.

Referenced by RPCPac(), run(), runEnergeticPatternsGroups(), and runTrackPatternsGroup().