CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

RPCLogCone Class Reference

#include <RPCLogCone.h>

List of all members.

Public Types

typedef std::map< int,
std::vector< int > > 
TLogPlane

Public Member Functions

bool addLogHit (const RPCLogHit &logHit)
 Adds next logHit .
unsigned long long getCompressedCone ()
 Compresses cone. Throws exception, if there is more than one hit in any logplane.
RPCConst::l1RpcConeCrdnts getConeCrdnts () const
int getFiredPlanesCnt () const
int getHitsCnt (int logPlane) const
 Gets fired strips count in given logPlane.
int getIdx () const
TLogPlane getLogPlane (int logPlane) const
int getLogSector () const
int getLogSegment () const
std::vector< int > getLogStripDigisIdxs (int logPlane, unsigned int logStripNum) const
bool getLogStripState (int logPlane, unsigned int logStripNum) const
int getMuonCode () const
int getMuonSign () const
int getTower () const
bool isPlaneFired (int logPlane) const
int possibleTrigger () const
 RPCLogCone ()
 Default constructor. No hits, no muon.
 RPCLogCone (const unsigned long long &pat, int tower, int logSector, int logSegment)
 Constructor. The cone is built from unsigned long long.
 RPCLogCone (int m_tower, int logSector, int logSegment)
 Constructor. Cone coordinates are set.
 RPCLogCone (const RPCLogHit &logHit)
 Constructor. One hit is added, cone coordinates are set from logHit.
void setIdx (int index)
void setLogStrip (int logPlane, int logStripNum, int m_digiIdx)
 Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg.
void setLogStrip (int logPlane, int logStripNum)
 Set logic strip as fired.
void setMuonCode (int code)
 sets pt code of muon that fired the strips */
void setMuonSign (int sign)
void shift (int pos)
 Changes fired LogStrips: from "stripNum" to "stripNum + pos".
std::string toString () const

Private Attributes

RPCConst::l1RpcConeCrdnts m_ConeCrdnts
std::vector< std::vector< int > > m_DigisIdx
int m_Index
 m_Index in LogConesVec stored by L1RpcTrigg
std::vector< TLogPlanem_LogPlanesVec
 Logic Planes.
int m_MuonCode
int m_MuonSign

Detailed Description

The input for m_PAC. State of strips in smalest unit of volum in RPC trigger system (Logic Cone), defined by 8 strips of reference plane.

Author:
Karol Bunkowski (Warsaw),
Porting to CMSSW - Tomasz Frueboes

Definition at line 25 of file RPCLogCone.h.


Member Typedef Documentation

typedef std::map<int, std::vector<int> > RPCLogCone::TLogPlane

Hits in one Logic Plane, if strips is fired, its number is added to the map as a key. Vector stores the indexes in DigisVec (stored in L1RpcTrigg) of Digis that formed log hits Logic m_Strips are diferent from RPC strips - Logic m_Strips it is usaly OR of 2 RPC strips with diferent eta (but the same phi).

See also:
RPCLogHit

Definition at line 34 of file RPCLogCone.h.


Constructor & Destructor Documentation

RPCLogCone::RPCLogCone ( )

Default constructor. No hits, no muon.

Definition at line 19 of file RPCLogCone.cc.

References RPCConst::m_LOGPLANES_COUNT, m_LogPlanesVec, m_MuonCode, and m_MuonSign.

RPCLogCone::RPCLogCone ( int  tower,
int  logSector,
int  logSegment 
)

Constructor. Cone coordinates are set.

Definition at line 32 of file RPCLogCone.cc.

References RPCConst::m_LOGPLANES_COUNT, m_LogPlanesVec, m_MuonCode, and m_MuonSign.

                                                              :
    m_ConeCrdnts(tower, logSector, logSegment)
{
  m_LogPlanesVec.assign(RPCConst::m_LOGPLANES_COUNT, TLogPlane());
  m_MuonCode = 0;
  m_MuonSign = 0;
}
RPCLogCone::RPCLogCone ( const RPCLogHit logHit)
RPCLogCone::RPCLogCone ( const unsigned long long &  pat,
int  tower,
int  logSector,
int  logSegment 
)

Constructor. The cone is built from unsigned long long.

Definition at line 56 of file RPCLogCone.cc.

References abs, getTower(), RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_LOGPLANES_COUNT, m_LogPlanesVec, m_MuonCode, m_MuonSign, RPCConst::m_USED_PLANES_COUNT, setLogStrip(), and shift().

                                                                                             :
      m_ConeCrdnts(tower, logSector, logSegment)
{
  m_LogPlanesVec.assign(RPCConst::m_LOGPLANES_COUNT, TLogPlane());
  m_MuonCode = 0;
  m_MuonSign = 0;

  unsigned long long int mask = 255; // (first 8 bits)
  int shift = 0;

  //std::cout << "Decompressing pattern: " << pat << std::endl;
  for (int logplane = RPCConst::m_FIRST_PLANE;
           logplane != RPCConst::m_USED_PLANES_COUNT[std::abs(getTower())];
         ++logplane  )
  {
      unsigned int strip = (pat & (mask<<shift) ) >> shift;
      //std::cout << logplane << " " << strip << std::endl;
      shift += 8;
      // We should prob. use m_NOT_CONNECTED value
      if (strip != RPCConst::m_LOGPLANE_SIZE[std::abs(getTower())][logplane])
        setLogStrip(logplane,strip);
  }
}

Member Function Documentation

bool RPCLogCone::addLogHit ( const RPCLogHit logHit)
unsigned long long RPCLogCone::getCompressedCone ( )

Compresses cone. Throws exception, if there is more than one hit in any logplane.

Definition at line 80 of file RPCLogCone.cc.

References abs, getHitsCnt(), getLogPlane(), getTower(), RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_USED_PLANES_COUNT, listBenchmarks::pattern, and shift().

                                                {

    unsigned long long int pattern = 0;
    int shift = 0;

    for (int logplane = RPCConst::m_FIRST_PLANE;
             logplane != RPCConst::m_USED_PLANES_COUNT[std::abs(getTower())];
             logplane++  )
     {
       unsigned long long int strip;
       if (getHitsCnt(logplane)==0) {
          // We need to mark somehow, that plane is empty (strip 0 is not fired)
          strip = RPCConst::m_LOGPLANE_SIZE[std::abs(getTower())][logplane];
       }
       else if (getHitsCnt(logplane)==1) {
          RPCLogCone::TLogPlane lp = getLogPlane(logplane);
          strip = lp.begin()->first;
       }
       else {
          throw RPCException("To many hits in logcone");
       }
          pattern = pattern | (strip << shift);
          shift += 8;
     }

   //std::cout << " Compressed cone: "   << pattern << std::endl;
   return pattern;
}
RPCConst::l1RpcConeCrdnts RPCLogCone::getConeCrdnts ( ) const

Definition at line 194 of file RPCLogCone.cc.

References m_ConeCrdnts.

Referenced by RPCTriggerCrate::runCone().

{ return m_ConeCrdnts; }
int RPCLogCone::getFiredPlanesCnt ( ) const

Definition at line 251 of file RPCLogCone.cc.

References abs, isPlaneFired(), m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::l1RpcConeCrdnts::m_Tower, and RPCConst::m_USED_PLANES_COUNT.

                                       {
  int firedPlanes = 0;
  for(int logPlane = RPCConst::m_FIRST_PLANE;
      logPlane < RPCConst::m_USED_PLANES_COUNT[abs(m_ConeCrdnts.m_Tower)];
      logPlane++)
  {
    firedPlanes = firedPlanes + isPlaneFired(logPlane);
  }
  return firedPlanes;
}
int RPCLogCone::getHitsCnt ( int  logPlane) const

Gets fired strips count in given logPlane.

Definition at line 174 of file RPCLogCone.cc.

References m_LogPlanesVec.

Referenced by getCompressedCone(), and RPCPac::runEnergeticPatternsGroups().

                                             {
  return m_LogPlanesVec[logPlane].size();
}
int RPCLogCone::getIdx ( ) const

Definition at line 198 of file RPCLogCone.cc.

References m_Index.

Referenced by RPCPac::run().

{ return m_Index; }
RPCLogCone::TLogPlane RPCLogCone::getLogPlane ( int  logPlane) const

Definition at line 169 of file RPCLogCone.cc.

References m_LogPlanesVec.

Referenced by getCompressedCone(), and RPCPac::runEnergeticPatternsGroups().

                                                              { 
  return m_LogPlanesVec[logPlane]; 
}
int RPCLogCone::getLogSector ( ) const

Definition at line 190 of file RPCLogCone.cc.

References m_ConeCrdnts, and RPCConst::l1RpcConeCrdnts::m_LogSector.

int RPCLogCone::getLogSegment ( ) const

Definition at line 192 of file RPCLogCone.cc.

References m_ConeCrdnts, and RPCConst::l1RpcConeCrdnts::m_LogSegment.

Referenced by RPCTriggerBoard::runCone().

std::vector< int > RPCLogCone::getLogStripDigisIdxs ( int  logPlane,
unsigned int  logStripNum 
) const

Get vector of didgis indexes (in digis vector stored by L1RpcTrigg) for given logic strip. If strip was not fired returns empty vector

Definition at line 235 of file RPCLogCone.cc.

References end, and m_LogPlanesVec.

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

                                                                                            {
  TLogPlane::const_iterator it = m_LogPlanesVec[logPlane].find(logStripNum); 
  if(it != m_LogPlanesVec[logPlane].end())
    return it->second;
  else
    return std::vector<int>();
}
bool RPCLogCone::getLogStripState ( int  logPlane,
unsigned int  logStripNum 
) const

Get logic strip state.

Returns:
true if fired

Definition at line 211 of file RPCLogCone.cc.

References m_LogPlanesVec.

Referenced by RPCPacData::getTPatternsGroupShape(), RPCPac::runEnergeticPatternsGroups(), RPCPac::runTrackPatternsGroup(), and toString().

                                                                               {
  return m_LogPlanesVec[logPlane].count(logStripNum);
}
int RPCLogCone::getMuonCode ( ) const
Returns:
pt code of muon that fired the strips

Definition at line 182 of file RPCLogCone.cc.

References m_MuonCode.

{ return m_MuonCode; }
int RPCLogCone::getMuonSign ( ) const

Definition at line 186 of file RPCLogCone.cc.

References m_MuonSign.

{ return m_MuonSign; }
int RPCLogCone::getTower ( ) const
bool RPCLogCone::isPlaneFired ( int  logPlane) const

Definition at line 244 of file RPCLogCone.cc.

References m_LogPlanesVec, and findQualityFiles::size.

Referenced by getFiredPlanesCnt(), and possibleTrigger().

                                                {
  if(m_LogPlanesVec[logPlane].size() == 0)
    return false; 
  else
    return true;  
}
int RPCLogCone::possibleTrigger ( ) const
Returns:
0 - trigger not possible, 1 - 3 inner planes fired, 2 - 4 or more planes fired

Definition at line 263 of file RPCLogCone.cc.

References abs, isPlaneFired(), m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_LOGPLANE4, RPCConst::l1RpcConeCrdnts::m_Tower, and RPCConst::m_USED_PLANES_COUNT.

                                      {
  int triggerType = 0; //0 - trigger not possible
                        //1 - 3/4 (3 inner planes fired)
                        //2 - 4/6 (four palnes fired)
  int firedPlanes = 0;

  int logPlane = RPCConst::m_FIRST_PLANE;
  for( ; logPlane <= RPCConst::m_LOGPLANE4; logPlane++) {
    firedPlanes = firedPlanes + isPlaneFired(logPlane);
  }
  if(firedPlanes >= 3)
    triggerType = 1;

  for( ;
      logPlane < RPCConst::m_USED_PLANES_COUNT[abs(m_ConeCrdnts.m_Tower)];
      logPlane++)
  {
    firedPlanes = firedPlanes + isPlaneFired(logPlane);
  }
  if(firedPlanes >= 4)
    triggerType = 2;

  return triggerType;
}
void RPCLogCone::setIdx ( int  index)

Definition at line 196 of file RPCLogCone.cc.

References getHLTprescales::index, and m_Index.

Referenced by RPCConeBuilderFromES::getConesFromES().

{ m_Index = index; }
void RPCLogCone::setLogStrip ( int  logPlane,
int  logStripNum,
int  m_digiIdx 
)

Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg.

Definition at line 200 of file RPCLogCone.cc.

References m_LogPlanesVec.

Referenced by addLogHit(), RPCLogCone(), and TPatternsGroup::updateShape().

                                                                         {
//m_LogPlanesVec[logPlane].insert(logStripNum);
//m_LogPlanesVec[logPlane].insert(TLogPlane::value_type(logStripNum, vector<int>()));
  m_LogPlanesVec[logPlane][logStripNum].push_back(m_digiIdx);
}
void RPCLogCone::setLogStrip ( int  logPlane,
int  logStripNum 
)

Set logic strip as fired.

Definition at line 206 of file RPCLogCone.cc.

References m_LogPlanesVec.

                                                          {
  m_LogPlanesVec[logPlane].insert(TLogPlane::value_type(logStripNum, std::vector<int>()));
}
void RPCLogCone::setMuonCode ( int  code)

sets pt code of muon that fired the strips */

Definition at line 179 of file RPCLogCone.cc.

References m_MuonCode.

{ m_MuonCode = code; }
void RPCLogCone::setMuonSign ( int  sign)

Definition at line 184 of file RPCLogCone.cc.

References m_MuonSign.

{ m_MuonSign = sign; }
void RPCLogCone::shift ( int  pos)

Changes fired LogStrips: from "stripNum" to "stripNum + pos".

Definition at line 145 of file RPCLogCone.cc.

References abs, begin, m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_LAST_PLANE, RPCConst::m_LOGPLANE_SIZE, m_LogPlanesVec, RPCConst::l1RpcConeCrdnts::m_Tower, and pos.

Referenced by getCompressedCone(), and RPCLogCone().

                              {
  int shiftPos;
  for(int logPlane = RPCConst::m_FIRST_PLANE; logPlane <= RPCConst::m_LAST_PLANE; logPlane++) {
    TLogPlane shifted;
    for(TLogPlane::iterator it = m_LogPlanesVec[logPlane].begin();
        it != m_LogPlanesVec[logPlane].end();
        it++)
    {
      shiftPos = it->first + pos;
 /*     std::cout << shiftPos << " "
                << RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)] 
                << std::endl;*/
      if ( shiftPos >= 0 && shiftPos < (int)RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane])
        shifted.insert(TLogPlane::value_type(shiftPos, it->second));
    }
    m_LogPlanesVec[logPlane] = shifted;
  }
}
std::string RPCLogCone::toString ( ) const

Definition at line 110 of file RPCLogCone.cc.

References abs, getLogStripState(), i, m_ConeCrdnts, RPCConst::m_FIRST_PLANE, RPCConst::m_LAST_PLANE, RPCConst::m_LOGPLANE_SIZE, RPCConst::m_LOGPLANE_STR, RPCConst::l1RpcConeCrdnts::m_LogSector, RPCConst::l1RpcConeCrdnts::m_LogSegment, RPCConst::l1RpcConeCrdnts::m_Tower, and AlCaHLTBitMon_QueryRunRegistry::string.

                                     {
  std::ostringstream ostr;
  ostr << "\n       ======================> TOWER = ";
  ostr<<std::setw(2)
      <<m_ConeCrdnts.m_Tower
      <<", m_LogSector = "
      <<m_ConeCrdnts.m_LogSector
      <<",  m_LogSegment = "
      <<m_ConeCrdnts.m_LogSegment
      <<" <======================="<< std::endl;

  std::string spacer;

  for (int logPlane = RPCConst::m_LAST_PLANE; logPlane >= RPCConst::m_FIRST_PLANE; logPlane--) {
    ostr<<RPCConst::m_LOGPLANE_STR[logPlane]<<" ";
    spacer.assign((72 - RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane])/2, ' ');
    ostr<<spacer;
  
    for(int i = RPCConst::m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane]-1; i >=0; i--) {
      if(getLogStripState(logPlane, i))
         ostr<<"X";
      else {
        if(i%8 == 0)
          ostr<<i%10;
        else
    ostr<<"."; 
      }  
    }  

    ostr<<std::endl;
  }
 
  ostr<< std::endl;
  return ostr.str();
}

Member Data Documentation

std::vector<std::vector<int> > RPCLogCone::m_DigisIdx [private]

Digis that formed log hits in this LogCone, m_DigisIdx[logPlaneNum][i] gets the index in DigisVec stored in L1RpcTrigg

Definition at line 114 of file RPCLogCone.h.

int RPCLogCone::m_Index [private]

m_Index in LogConesVec stored by L1RpcTrigg

Definition at line 123 of file RPCLogCone.h.

Referenced by getIdx(), and setIdx().

std::vector<TLogPlane> RPCLogCone::m_LogPlanesVec [private]
int RPCLogCone::m_MuonCode [private]

Definition at line 118 of file RPCLogCone.h.

Referenced by getMuonCode(), RPCLogCone(), and setMuonCode().

int RPCLogCone::m_MuonSign [private]

Definition at line 120 of file RPCLogCone.h.

Referenced by getMuonSign(), RPCLogCone(), and setMuonSign().