CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
RPCPacData Class Reference

#include <RPCPacData.h>

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 RPCPattern::RPCPatVec &patVec, const RPCPattern::TQualityVec &qualVec)
 
 RPCPacData (const L1RPCConfig *patConf, const int tower, const int sector, const int segment)
 

Private Types

typedef std::list< TEPatternsGroupTEPatternsGroupList
 

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. More...
 
TTPatternsGroup m_TrackPatternsGroup
 Here patters used in "baseline" algorith are stored. More...
 

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

◆ TEPatternsGroupList

Definition at line 63 of file RPCPacData.h.

Constructor & Destructor Documentation

◆ RPCPacData() [1/3]

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 29 of file RPCPacData.cc.

References init(), RPCConst::intToString(), RPCConst::l1RpcConeCrdnts::m_LogSector, RPCConst::l1RpcConeCrdnts::m_LogSegment, m_MaxQuality, RPCConst::l1RpcConeCrdnts::m_Tower, m_TrackPatternsGroup, writedatasetfile::parser, TPatternsGroup::setGroupDescription(), AlCaHLTBitMon_QueryRunRegistry::string, and hgcalTowerProducer_cfi::tower.

29  {
30  //: RPCPacBase(tower, logSector, logSegment) {
31  m_MaxQuality = 0;
32  std::string patFileName;
33 
34  RPCConst rpcconst;
35 
36  patFileName = patFilesDir + "pacPat_t" + rpcconst.intToString(tower) + "sc" + rpcconst.intToString(logSector) + "sg" +
37  rpcconst.intToString(logSegment) + ".xml";
38 
40  coneCrds.m_Tower = tower;
41  coneCrds.m_LogSector = logSector;
42  coneCrds.m_LogSegment = logSegment;
43 
45  parser.parse(patFileName);
46  init(parser, coneCrds);
47 
48  m_TrackPatternsGroup.setGroupDescription("Track PatternsGroup");
49 }
The coordinates of Logic Cone: m_Tower, m_LogSector, m_LogSegment.
Definition: RPCConst.h:118
TTPatternsGroup m_TrackPatternsGroup
Here patters used in "baseline" algorith are stored.
Definition: RPCPacData.h:91
void setGroupDescription(std::string groupDescription)
std::string intToString(int number)
Converts inteager number to string.
Definition: RPCConst.cc:264
short m_MaxQuality
Definition: RPCPacData.h:69
void init(const RPCPatternsParser &parser, const RPCConst::l1RpcConeCrdnts &coneCrdnts)
Definition: RPCPacData.cc:222

◆ RPCPacData() [2/3]

RPCPacData::RPCPacData ( const RPCPattern::RPCPatVec patVec,
const RPCPattern::TQualityVec qualVec 
)

Construct from given qualities and patterns

Definition at line 55 of file RPCPacData.cc.

References mps_fire::i, insertPatterns(), insertQualityRecord(), and quality.

55  : m_MaxQuality(0) {
56  for (unsigned int i = 0; i < qualVec.size(); ++i) {
57  RPCPattern::TQuality quality = qualVec[i];
58  std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
59  unsigned short firedPlanes = qualBits.to_ulong();
60 
61  insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);
62  }
63 
64  insertPatterns(patVec);
65 }
void insertPatterns(const RPCPattern::RPCPatVec &pattern, const int tower=99, const int sector=99, const int segment=99)
Definition: RPCPacData.cc:177
void insertQualityRecord(unsigned int qualityTabNumber, unsigned short firedPlanes, short quality)
Definition: RPCPacData.cc:160
short m_MaxQuality
Definition: RPCPacData.h:69
string quality

◆ RPCPacData() [3/3]

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

Definition at line 67 of file RPCPacData.cc.

References insertPatterns(), insertQualityRecord(), quality, L1RPCConfig_cff::rpcconf, and hgcalTowerProducer_cfi::tower.

68  : m_MaxQuality(0) {
69  for (unsigned int iqual = 0; iqual < rpcconf->m_quals.size(); iqual++) {
70  if (rpcconf->m_quals[iqual].m_tower != tower || rpcconf->m_quals[iqual].m_logsector != sector ||
71  rpcconf->m_quals[iqual].m_logsegment != segment)
72  continue;
73 
74  RPCPattern::TQuality quality = rpcconf->m_quals[iqual];
75  std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
76  unsigned short firedPlanes = qualBits.to_ulong();
77  insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);
78  }
79 
80  insertPatterns(rpcconf->m_pats, tower, sector, segment);
81 }
void insertPatterns(const RPCPattern::RPCPatVec &pattern, const int tower=99, const int sector=99, const int segment=99)
Definition: RPCPacData.cc:177
void insertQualityRecord(unsigned int qualityTabNumber, unsigned short firedPlanes, short quality)
Definition: RPCPacData.cc:160
short m_MaxQuality
Definition: RPCPacData.h:69
string quality

Member Function Documentation

◆ getEPatternsGroupShape()

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 125 of file RPCPacData.cc.

References mps_fire::i, and m_EnergeticPatternsGroupList.

125  {
126  TEPatternsGroupList::const_iterator iEGroup = m_EnergeticPatternsGroupList.begin();
127  int i = 0;
128  for (; iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++, i++) {
129  if (i == groupNum)
130  return iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum);
131  }
132  throw RPCException("getEPatternsGroupShape(): groupNum to big!");
133  //edm::LogError("RPCTrigger")<< "getEPatternsGroupShape(): groupNum to big!";
134  return false; // XXX - TMF
135 }
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88

◆ getPattern()

RPCPattern RPCPacData::getPattern ( int  patNum) const
Returns
pattern stored in m_PatternsVec. Needed for patterns explorer.

Definition at line 97 of file RPCPacData.cc.

References m_PatternsVec.

97  {
98  if (m_PatternsVec.empty()) {
99  throw RPCException("GetPattren(): Patterns vec is empty, mayby it was not filled!");
100  //edm::LogError("RPCTrigger") << "GetPattren(): Patterns vec is empty, mayby it was not filled!";
101  }
102  return m_PatternsVec[patNum];
103 }
RPCPattern::RPCPatVec m_PatternsVec
Definition: RPCPacData.h:74

◆ getPatternsCount()

int RPCPacData::getPatternsCount ( )
Returns
the count of patterns stored in m_PatternsVec.

Definition at line 109 of file RPCPacData.cc.

References m_PatternsVec.

109 { return m_PatternsVec.size(); }
RPCPattern::RPCPatVec m_PatternsVec
Definition: RPCPacData.h:74

◆ getPatternsGroupCount()

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

Definition at line 88 of file RPCPacData.cc.

References m_EnergeticPatternsGroupList.

88  {
89  return (1 + m_EnergeticPatternsGroupList.size()); //1 = track pattrens group
90 }
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88

◆ getPatternsGroupDescription()

std::string RPCPacData::getPatternsGroupDescription ( int  patternGroupNum)

Definition at line 137 of file RPCPacData.cc.

References TPatternsGroup::getGroupDescription(), mps_fire::i, RPCConst::intToString(), m_EnergeticPatternsGroupList, m_TrackPatternsGroup, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

137  {
138  RPCConst rpcconst;
139 
141  if (patternGroupNum == -1)
143  else {
144  TEPatternsGroupList::iterator iEGroup = m_EnergeticPatternsGroupList.begin();
145  int i = 0;
146  for (; iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++, i++) {
147  if (i == patternGroupNum)
148  ret = "EGroup #" + rpcconst.intToString(i) + iEGroup->getGroupDescription();
149  }
150  }
151 
152  if (ret.empty()) {
153  throw RPCException("getEPatternsGroupShape(): groupNum to big!");
154  //edm::LogError("RPCTrigger")<< "getEPatternsGroupShape(): groupNum to big!";
155  }
156 
157  return ret;
158 }
ret
prodAgent to be discontinued
TTPatternsGroup m_TrackPatternsGroup
Here patters used in "baseline" algorith are stored.
Definition: RPCPacData.h:91
std::string intToString(int number)
Converts inteager number to string.
Definition: RPCConst.cc:264
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88
std::string getGroupDescription() const

◆ getTPatternsGroupShape()

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

Definition at line 116 of file RPCPacData.cc.

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

116  {
117  return m_TrackPatternsGroup.m_GroupShape.getLogStripState(logPlane, logStripNum);
118 }
RPCLogCone m_GroupShape
TTPatternsGroup m_TrackPatternsGroup
Here patters used in "baseline" algorith are stored.
Definition: RPCPacData.h:91
bool getLogStripState(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:184

◆ init()

void RPCPacData::init ( const RPCPatternsParser parser,
const RPCConst::l1RpcConeCrdnts coneCrdnts 
)

Definition at line 222 of file RPCPacData.cc.

References mps_fire::i, insertPatterns(), insertQualityRecord(), m_PatternsVec, writedatasetfile::parser, and quality.

Referenced by RPCPacData().

222  {
223  for (unsigned int i = 0; i < parser.getQualityVec().size(); i++) {
224  RPCPattern::TQuality quality = parser.getQualityVec()[i];
225  std::bitset<RPCConst::m_LOGPLANES_COUNT> qualBits(quality.m_FiredPlanes);
226  unsigned short firedPlanes = qualBits.to_ulong();
227 
228  insertQualityRecord(quality.m_QualityTabNumber, firedPlanes, quality.m_QualityValue);
229  }
230 
231  m_PatternsVec = parser.getPatternsVec(coneCrdnts);
233 }
void insertPatterns(const RPCPattern::RPCPatVec &pattern, const int tower=99, const int sector=99, const int segment=99)
Definition: RPCPacData.cc:177
void insertQualityRecord(unsigned int qualityTabNumber, unsigned short firedPlanes, short quality)
Definition: RPCPacData.cc:160
RPCPattern::RPCPatVec m_PatternsVec
Definition: RPCPacData.h:74
string quality

◆ insertPatterns()

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 177 of file RPCPacData.cc.

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

Referenced by init(), and RPCPacData().

180  {
181  bool ignorePos = false;
182  if (tower == 99 || sector == 99 || segment == 99)
183  ignorePos = true;
184 
185  RPCConst rpcconst;
186 
187  for (RPCPattern::RPCPatVec::const_iterator patIt = patternsVec.begin(); patIt != patternsVec.end(); patIt++) {
188  if (!ignorePos &&
189  (patIt->getTower() != tower || patIt->getLogSector() != sector || patIt->getLogSegment() != segment))
190  continue;
191 
192  if (patIt->getPatternType() == RPCPattern::PAT_TYPE_T)
194  else if (patIt->getPatternType() == RPCPattern::PAT_TYPE_E) {
195  TEPatternsGroupList::iterator iEGroup;
196  for (iEGroup = m_EnergeticPatternsGroupList.begin(); iEGroup != m_EnergeticPatternsGroupList.end(); iEGroup++)
197  if (iEGroup->check(patIt))
198  break;
199  if (iEGroup == m_EnergeticPatternsGroupList.end()) {
200  TEPatternsGroup newEGroup(patIt);
201  newEGroup.setGroupDescription(
202  //"EGroup #"+ rpcconst.intToString(m_EnergeticPatternsGroupList.size())+
203  ", code: " + rpcconst.intToString(patIt->getCode()) + ", dir: " + rpcconst.intToString(patIt->getSign()) +
204  ", refGroup: " + rpcconst.intToString(patIt->getRefGroup()) +
205  ", qualityTabNumber: " + rpcconst.intToString(patIt->getQualityTabNumber()));
206  m_EnergeticPatternsGroupList.push_back(newEGroup);
207  } else
208  iEGroup->addPattern(patIt);
209  } else
210  throw RPCException("InsertPattern(): unsupported pattern type");
211  //edm::LogError("RPCTrigger") << "InsertPattern(): unsupported pattern type";
212  }
213 
214  if (!m_EnergeticPatternsGroupList.empty()) {
215  m_EnergeticPatternsGroupList.sort(); //to jest potrzebne, bo w run() przechodzi
216  //pierwszy paettern, ktory ma Maxymalna quality, wiec
217  //grupy musza byc
219  }
220 }
void addPattern(const RPCPattern::RPCPatVec::const_iterator &pattern)
TTPatternsGroup m_TrackPatternsGroup
Here patters used in "baseline" algorith are stored.
Definition: RPCPacData.h:91
static const TPatternType PAT_TYPE_T
Definition: RPCPattern.h:55
std::string intToString(int number)
Converts inteager number to string.
Definition: RPCConst.cc:264
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88
static const TPatternType PAT_TYPE_E
Definition: RPCPattern.h:56
Group of paterns for "improved"("energetic") algorithm. In current implementation all patterns in giv...

◆ insertQualityRecord()

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 160 of file RPCPacData.cc.

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

Referenced by init(), and RPCPacData().

160  {
161  if (quality > m_MaxQuality)
163  if (qualityTabNumber < m_QualityTabsVec.size()) {
164  m_QualityTabsVec[qualityTabNumber][firedPlanes] = quality;
165  } else if (qualityTabNumber == m_QualityTabsVec.size()) {
166  // XXX - added cast(int)
167 
168  //= new TQualityTab();
170  m_QualityTabsVec.push_back(qualityTab);
171  m_QualityTabsVec[qualityTabNumber][firedPlanes] = quality;
172  } else
173  throw RPCException("insertQualityRecord(): wrong qualityTabNumber");
174  //edm::LogError("RPCTrigger") << "insertQualityRecord(): wrong qualityTabNumber";
175 }
RPCConst::TQualityTabsVec m_QualityTabsVec
Definition: RPCPacData.h:84
static const int m_LOGPLANES_COUNT
Max Logic Planes Count in trigger towers.
Definition: RPCConst.h:45
std::vector< short > TQualityTab
Definition: RPCConst.h:113
short m_MaxQuality
Definition: RPCPacData.h:69
string quality
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Friends And Related Function Documentation

◆ RPCPac

friend class RPCPac
friend

Definition at line 34 of file RPCPacData.h.

Member Data Documentation

◆ m_EnergeticPatternsGroupList

TEPatternsGroupList RPCPacData::m_EnergeticPatternsGroupList
private

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().

◆ m_MaxQuality

short RPCPacData::m_MaxQuality
private

Definition at line 69 of file RPCPacData.h.

Referenced by insertQualityRecord(), and RPCPacData().

◆ m_PatternsVec

RPCPattern::RPCPatVec RPCPacData::m_PatternsVec
private

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().

◆ m_QualityTabsVec

RPCConst::TQualityTabsVec RPCPacData::m_QualityTabsVec
private

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().

◆ m_RefGroupCount

short RPCPacData::m_RefGroupCount
private

From pac file - TT_REF_GROUP_NUMBERS.

Definition at line 67 of file RPCPacData.h.

◆ m_TrackPatternsGroup

TTPatternsGroup RPCPacData::m_TrackPatternsGroup
private

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().