CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

RPCPacData Class Reference

#include <RPCPacData.h>

List of all members.

Public Member Functions

bool getEPatternsGroupShape (int groupNum, int logPlane, int logStripNum)
RPCPattern getPattern (int patNum) const
int getPatternsCount ()
int getPatternsGroupCount ()
std::string getPatternsGroupDescription (int patternGroupNum)
bool getTPatternsGroupShape (int logPlane, int logStripNum)
void init (const RPCPatternsParser &parser, const RPCConst::l1RpcConeCrdnts &coneCrdnts)
 RPCPacData (std::string patFilesDir, int m_tower, int logSector, int logSegment)
 RPCPacData (const L1RPCConfig *patConf, const int tower, const int sector, const int segment)
 RPCPacData (const RPCPattern::RPCPatVec &patVec, const RPCPattern::TQualityVec &qualVec)

Private Types

typedef std::list
< TEPatternsGroup
TEPatternsGroupList

Private Member Functions

void insertPatterns (const RPCPattern::RPCPatVec &pattern, const int tower=99, const int sector=99, const int segment=99)
void insertQualityRecord (unsigned int qualityTabNumber, unsigned short firedPlanes, short quality)

Private Attributes

TEPatternsGroupList m_EnergeticPatternsGroupList
short m_MaxQuality
RPCPattern::RPCPatVec m_PatternsVec
RPCConst::TQualityTabsVec m_QualityTabsVec
short m_RefGroupCount
 From pac file - TT_REF_GROUP_NUMBERS.
TTPatternsGroup m_TrackPatternsGroup
 Here patters used in "baseline" algorith are stored.

Friends

class RPCPac

Detailed Description

Performes Pattern Comparator algorithm for one LogCone. Returns one muon candidate. The algorithm details i.e. patterns list, algorthm type for each pattern, qaulity definition, are set from m_PAC definition file.

Author:
Karol Bunkowski (Warsaw),
Tomasz Fruboes (Warsaw) - porting to CMSSW

Definition at line 33 of file RPCPacData.h.


Member Typedef Documentation

typedef std::list<TEPatternsGroup> RPCPacData::TEPatternsGroupList [private]

Definition at line 64 of file RPCPacData.h.


Constructor & Destructor Documentation

RPCPacData::RPCPacData ( std::string  patFilesDir,
int  tower,
int  logSector,
int  logSegment 
)

Constructor required by RPCPacManager.

Parameters:
patFilesDir- the directory conataing m_PAC definition file. It should containe file for this m_PAC, defined by tower, logSector, logSegment, named pacPat_t<tower>sc<logSector>sg<logSegment>.vhd Containers: m_EnergeticPatternsGroupList and m_TrackPatternsGroup are filled with patterns from file (the method ParsePatternFile() is called).

Definition at line 30 of file RPCPacData.cc.

References init(), RPCConst::intToString(), RPCConst::l1RpcConeCrdnts::m_LogSector, RPCConst::l1RpcConeCrdnts::m_LogSegment, m_MaxQuality, RPCConst::l1RpcConeCrdnts::m_Tower, m_TrackPatternsGroup, RPCPatternsParser::parse(), geometryXMLtoCSV::parser, and TPatternsGroup::setGroupDescription().

                                                                                     {
  
 //: RPCPacBase(tower, logSector, logSegment) { 
  m_MaxQuality=0;
  std::string patFileName;
  
  RPCConst rpcconst;


  patFileName = patFilesDir 
      + "pacPat_t" + rpcconst.intToString(tower) 
      + "sc" + rpcconst.intToString(logSector) 
      + "sg" + rpcconst.intToString(logSegment) 
      + ".xml";

  RPCConst::l1RpcConeCrdnts coneCrds;
  coneCrds.m_Tower=tower;
  coneCrds.m_LogSector=logSector;
  coneCrds.m_LogSegment=logSegment;
        
  RPCPatternsParser parser;
  parser.parse(patFileName);
  init(parser, coneCrds);

  m_TrackPatternsGroup.setGroupDescription("Track PatternsGroup");
    
}
RPCPacData::RPCPacData ( const RPCPattern::RPCPatVec patVec,
const RPCPattern::TQualityVec qualVec 
)

Construct from given qualities and patterns

Definition at line 62 of file RPCPacData.cc.

References i, insertPatterns(), insertQualityRecord(), RPCPattern::TQuality::m_FiredPlanes, RPCPattern::TQuality::m_QualityTabNumber, and RPCPattern::TQuality::m_QualityValue.

                                                             :
  m_MaxQuality(0)
{
  for(unsigned int i = 0; i < qualVec.size(); ++i) {    
    RPCPattern::TQuality quality = qualVec[i];
    std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
    unsigned short firedPlanes = qualBits.to_ulong();

    insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);  
  }

  
  insertPatterns(patVec);

   
}
RPCPacData::RPCPacData ( const L1RPCConfig patConf,
const int  tower,
const int  sector,
const int  segment 
)

Definition at line 82 of file RPCPacData.cc.

References insertPatterns(), insertQualityRecord(), RPCPattern::TQuality::m_FiredPlanes, L1RPCConfig::m_pats, RPCPattern::TQuality::m_QualityTabNumber, RPCPattern::TQuality::m_QualityValue, and L1RPCConfig::m_quals.

                                                                                                       :
  m_MaxQuality(0)
{

    for (unsigned int iqual=0; iqual<rpcconf->m_quals.size(); iqual++){

      if (rpcconf->m_quals[iqual].m_tower != tower ||  
          rpcconf->m_quals[iqual].m_logsector != sector ||
          rpcconf->m_quals[iqual].m_logsegment != segment )  continue;

      RPCPattern::TQuality quality =rpcconf->m_quals[iqual];
      std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
      unsigned short firedPlanes = qualBits.to_ulong();
      insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);

    }

  insertPatterns(rpcconf->m_pats,tower,sector,segment);

}

Member Function Documentation

bool RPCPacData::getEPatternsGroupShape ( int  groupNum,
int  logPlane,
int  bitNum 
)
Returns:
true, if logStrip defined by logStripNum and logPlane belongs to the EPatternsGroup from m_EnergeticPatternsGroupList defined by groupNum.

Definition at line 154 of file RPCPacData.cc.

References i, and m_EnergeticPatternsGroupList.

                                                                              {
  TEPatternsGroupList::const_iterator iEGroup = m_EnergeticPatternsGroupList.begin();
  int i = 0;
  for(; iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++, i++) {
    if(i == groupNum)
      return iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum);
  }
  throw RPCException("getEPatternsGroupShape(): groupNum to big!");
  //edm::LogError("RPCTrigger")<< "getEPatternsGroupShape(): groupNum to big!";
  return false; // XXX - TMF
}
RPCPattern RPCPacData::getPattern ( int  patNum) const
Returns:
pattern stored in m_PatternsVec. Needed for patterns explorer.

Definition at line 121 of file RPCPacData.cc.

References m_PatternsVec.

                                                  {
  if(m_PatternsVec.size() == 0) {
  
    throw RPCException("GetPattren(): Patterns vec is empty, mayby it was not filled!");
    //edm::LogError("RPCTrigger") << "GetPattren(): Patterns vec is empty, mayby it was not filled!";
    
  }
  return m_PatternsVec[patNum];
  
}
int RPCPacData::getPatternsCount ( )
Returns:
the count of patterns stored in m_PatternsVec.

Definition at line 136 of file RPCPacData.cc.

References m_PatternsVec.

                                 {
  return m_PatternsVec.size();
}
int RPCPacData::getPatternsGroupCount ( )
Returns:
the count af all patterns gropu, i.e. 1 + m_EnergeticPatternsGroupList.size().

Definition at line 112 of file RPCPacData.cc.

References m_EnergeticPatternsGroupList.

                                      {
  return(1 + m_EnergeticPatternsGroupList.size()); //1 = track pattrens group
}
std::string RPCPacData::getPatternsGroupDescription ( int  patternGroupNum)

Definition at line 166 of file RPCPacData.cc.

References TPatternsGroup::getGroupDescription(), i, RPCConst::intToString(), m_EnergeticPatternsGroupList, m_TrackPatternsGroup, and run_regression::ret.

                                                                     {
  
  RPCConst rpcconst;
  
  std::string ret;
  if(patternGroupNum == -1)
    ret =  m_TrackPatternsGroup.getGroupDescription();
  else  {
    TEPatternsGroupList::iterator iEGroup = m_EnergeticPatternsGroupList.begin();
    int i = 0;
    for(; iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++, i++) {
      if(i == patternGroupNum)
        ret = "EGroup #"+ rpcconst.intToString(i)+iEGroup->getGroupDescription();
    }
    
  }
  
  if(ret.empty()){
      throw RPCException("getEPatternsGroupShape(): groupNum to big!");
      //edm::LogError("RPCTrigger")<< "getEPatternsGroupShape(): groupNum to big!";
  }

  return ret;
}
bool RPCPacData::getTPatternsGroupShape ( int  logPlane,
int  logStripNum 
)
Returns:
true, if logStrip defined by logStripNum and logPlane belongs to the m_TrackPatternsGroup.

Definition at line 145 of file RPCPacData.cc.

References RPCLogCone::getLogStripState(), TPatternsGroup::m_GroupShape, and m_TrackPatternsGroup.

                                                                     {
  return m_TrackPatternsGroup.m_GroupShape.getLogStripState(logPlane, logStripNum);
}
void RPCPacData::init ( const RPCPatternsParser parser,
const RPCConst::l1RpcConeCrdnts coneCrdnts 
)

Definition at line 264 of file RPCPacData.cc.

References RPCPatternsParser::getPatternsVec(), RPCPatternsParser::getQualityVec(), i, insertPatterns(), insertQualityRecord(), RPCPattern::TQuality::m_FiredPlanes, m_PatternsVec, RPCPattern::TQuality::m_QualityTabNumber, and RPCPattern::TQuality::m_QualityValue.

Referenced by RPCPacData().

                                                                                                {
  for(unsigned int i = 0; i < parser.getQualityVec().size(); i++) {    
    RPCPattern::TQuality quality = parser.getQualityVec()[i];
    std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
    unsigned short firedPlanes = qualBits.to_ulong();

    insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);  
  }

  m_PatternsVec = parser.getPatternsVec(coneCrdnts);
  insertPatterns(m_PatternsVec);
}
void RPCPacData::insertPatterns ( const RPCPattern::RPCPatVec pattern,
const int  tower = 99,
const int  sector = 99,
const int  segment = 99 
) [private]

Adds pattern to m_TrackPatternsGroup or appropriate group from m_EnergeticPatternsGroupList. If the appropriate TEPatternsGroup does not exist, it is created.

Definition at line 213 of file RPCPacData.cc.

References TPatternsGroup::addPattern(), RPCConst::intToString(), m_EnergeticPatternsGroupList, m_TrackPatternsGroup, RPCPattern::PAT_TYPE_E, RPCPattern::PAT_TYPE_T, and TPatternsGroup::setGroupDescription().

Referenced by init(), and RPCPacData().

                                                                                                                            {
   
  bool ignorePos = false;
  if ( tower == 99 || sector == 99 || segment == 99) ignorePos = true; 
  
  RPCConst rpcconst;
  
  for(RPCPattern::RPCPatVec::const_iterator patIt = patternsVec.begin();
      patIt != patternsVec.end();
      patIt++)
  {
    if (!ignorePos &&
         (patIt->getTower() != tower  
          || patIt->getLogSector() != sector  
          || patIt->getLogSegment() != segment) ) continue;
    
    if(patIt->getPatternType() == RPCPattern::PAT_TYPE_T)
      m_TrackPatternsGroup.addPattern(patIt);
    else if(patIt->getPatternType() == RPCPattern::PAT_TYPE_E) {
      TEPatternsGroupList::iterator iEGroup;
      for(iEGroup = m_EnergeticPatternsGroupList.begin();
          iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++)
        if(iEGroup->check(patIt))
          break;
      if(iEGroup == m_EnergeticPatternsGroupList.end()) {
        TEPatternsGroup newEGroup(patIt);
        newEGroup.setGroupDescription(
        //"EGroup #"+ rpcconst.intToString(m_EnergeticPatternsGroupList.size())+
        ", code: " + rpcconst.intToString(patIt->getCode()) +
        ", dir: " + rpcconst.intToString(patIt->getSign()) +
        ", refGroup: " + rpcconst.intToString(patIt->getRefGroup()) +
        ", qualityTabNumber: " + rpcconst.intToString(patIt->getQualityTabNumber()));
        m_EnergeticPatternsGroupList.push_back(newEGroup);
      }
      else
       iEGroup->addPattern(patIt);
    }
    else
      throw RPCException("InsertPattern(): unsupported pattern type");
      //edm::LogError("RPCTrigger") << "InsertPattern(): unsupported pattern type";
  }  

  if(m_EnergeticPatternsGroupList.size() != 0) {
     
    m_EnergeticPatternsGroupList.sort();  //to jest potrzebne, bo w run() przechodzi
                                          //pierwszy paettern, ktory ma Maxymalna quality, wiec
                                          //grupy musza byc
    m_EnergeticPatternsGroupList.reverse();
  } 
}
void RPCPacData::insertQualityRecord ( unsigned int  qualityTabNumber,
unsigned short  firedPlanes,
short  quality 
) [private]

Adds one qaulity record to m_QualityTabsVec.

Parameters:
qualityTabNumber- index of QualityTab (index in m_QualityTabsVec), to which new record should be add.
qualityBitset- definition of plnaes in coincidance. (qualityBitset[0] == true means, that LogPlane1 should be fired).
quality- quality value assigned to given coincidance.

Definition at line 191 of file RPCPacData.cc.

References RPCConst::m_LOGPLANES_COUNT, m_MaxQuality, m_QualityTabsVec, and funct::pow().

Referenced by init(), and RPCPacData().

                                                                         {
  
  if(quality > m_MaxQuality)
    m_MaxQuality = quality;
  if(qualityTabNumber < m_QualityTabsVec.size()) {
    m_QualityTabsVec[qualityTabNumber][firedPlanes] = quality;                   
  }
  else if(qualityTabNumber == m_QualityTabsVec.size()) {
    // XXX - added cast(int)

    //= new TQualityTab();
    RPCConst::TQualityTab qualityTab((int)std::pow(2.0,RPCConst::m_LOGPLANES_COUNT), -1); 
    m_QualityTabsVec.push_back(qualityTab);
    m_QualityTabsVec[qualityTabNumber][firedPlanes] = quality; 
  }
  else
    throw RPCException("insertQualityRecord(): wrong qualityTabNumber");
    //edm::LogError("RPCTrigger") << "insertQualityRecord(): wrong qualityTabNumber";
}

Friends And Related Function Documentation

friend class RPCPac [friend]

Definition at line 34 of file RPCPacData.h.


Member Data Documentation

Container containig EPatternsGroups. Is filled by InsertPattern() during parsing the pac file ParsePatternFile().

Definition at line 88 of file RPCPacData.h.

Referenced by getEPatternsGroupShape(), getPatternsGroupCount(), getPatternsGroupDescription(), insertPatterns(), RPCPac::run(), and RPCPac::runEnergeticPatternsGroups().

short RPCPacData::m_MaxQuality [private]

Definition at line 69 of file RPCPacData.h.

Referenced by insertQualityRecord(), and RPCPacData().

filled only if in constructor RPCPacData() createPatternsVec == true. Contains all patterns from pac file. Needed for patterns expolorer, does not used in trigger algorithm.

Definition at line 74 of file RPCPacData.h.

Referenced by getPattern(), getPatternsCount(), and init().

The definiton of allowed coincidence of hits in planes and quality values assigned to them. There can be few quality tables in one m_PAC, to every pattern one of those quality table is asigned. (In barrel usualy 2 quality tables are used: one for high pt (4/6) and one for low pt (3/4). One qaulity table is multimap<biteset, int>, bitset defines allowed coincidance, int defines the quality value. m_QualityTabsVec is a vector of these maps, the index in vector correspondes to the m_QualityTabNumber in pattern.

See also:
TQualityBitset, TQualityTab, TQualityTabsVec.

Definition at line 84 of file RPCPacData.h.

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

short RPCPacData::m_RefGroupCount [private]

From pac file - TT_REF_GROUP_NUMBERS.

Definition at line 67 of file RPCPacData.h.

Here patters used in "baseline" algorith are stored.

Definition at line 91 of file RPCPacData.h.

Referenced by getPatternsGroupDescription(), getTPatternsGroupShape(), insertPatterns(), RPCPacData(), RPCPac::run(), and RPCPac::runTrackPatternsGroup().