CMS 3D CMS Logo

RPCPac.cc
Go to the documentation of this file.
2 //#include "L1Trigger/RPCTrigger/interface/TEPatternsGroup.h"
3 
4 RPCPac::RPCPac(const RPCPacData* pacData, int tower, int logSector, int logSegment)
5  : RPCPacBase(tower, logSector, logSegment) {
6  m_pacData = pacData;
7 }
8 
16 RPCPacMuon RPCPac::run(const RPCLogCone& cone) const { //symualcja
17 
18  RPCPacMuon bestMuon;
19  //track
21  bestMuon = runTrackPatternsGroup(cone);
22 
23  //energetic
25  RPCPacMuon bufMuon = runEnergeticPatternsGroups(cone);
26  if (bufMuon > bestMuon)
27  bestMuon = bufMuon;
28  }
29 
31 
32  //bestMuon.setConeCrdnts(cone.);
33  bestMuon.setLogConeIdx(cone.getIdx());
34  /*
35  int refStripNum = m_pacData->getPattern(bestMuon.getPatternNum())
36  .getStripFrom(RPCConst::m_REF_PLANE[abs(m_CurrConeCrdnts.m_Tower)])
37  + m_CurrConeCrdnts.m_LogSector * 96
38  + m_CurrConeCrdnts.m_LogSegment * 8;
39  bestMuon.setRefStripNum(refStripNum);*/
40  return bestMuon;
41 }
42 
44  RPCPacMuon bestMuon;
45 
46  for (unsigned int vecNum = 0; vecNum < m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size(); vecNum++) {
47  RPCMuon::TDigiLinkVec digiIdx;
48  unsigned short firedPlanes = 0;
49  int firedPlanesCount = 0;
50  unsigned short one = 1;
52  for (int logPlane = RPCConst::m_FIRST_PLANE;
54  logPlane++) {
55  if (pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED) {
56  //firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
57  continue;
58  }
59  int fromBit = pattern.getStripFrom(logPlane);
60  int toBit = pattern.getStripTo(logPlane);
61  for (int bitNumber = fromBit; bitNumber < toBit; bitNumber++) {
62  if (cone.getLogStripState(logPlane, bitNumber) == true) {
63  firedPlanes = firedPlanes | one;
64  firedPlanesCount++;
65  std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
66  if (!dIVec.empty())
67  digiIdx.push_back(RPCMuon::TDigiLink(logPlane, *dIVec.begin()));
68 
69  break;
70  }
71  }
72 
73  if ((RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)] - logPlane) == 3)
74  if (firedPlanesCount == 0)
75  break;
76 
77  one = one << 1;
78  }
79 
80  if (firedPlanesCount >= 3) {
81  short quality = m_pacData->m_QualityTabsVec[pattern.getQualityTabNumber()][firedPlanes];
82  if (quality != -1) {
83  if (quality >= bestMuon.getQuality()) {
84  RPCPacMuon bufMuon(pattern, quality, firedPlanes);
85  if (bufMuon > bestMuon) {
86  bestMuon = bufMuon;
87  bestMuon.setDigiIdxVec(digiIdx);
88  }
89  }
90  }
91  }
92  }
93  return bestMuon;
94 }
95 
97  RPCPacMuon bestMuon;
98  unsigned short firedPlanes = 0;
99  int firedPlanesCount = 0;
100  RPCPacData::TEPatternsGroupList::const_iterator iEGroup = m_pacData->m_EnergeticPatternsGroupList.begin();
101  for (; iEGroup != m_pacData->m_EnergeticPatternsGroupList.end(); iEGroup++) {
102  firedPlanes = 0;
103  firedPlanesCount = 0;
104  unsigned short one = 1;
105  for (int logPlane = RPCConst::m_FIRST_PLANE;
107  logPlane++) { //or po paskach ze stozka
108 
109  if (cone.getHitsCnt(logPlane) > 0) {
110  RPCLogCone::TLogPlane lp = cone.getLogPlane(logPlane);
111  RPCLogCone::TLogPlane::const_iterator itLP = lp.begin();
112  RPCLogCone::TLogPlane::const_iterator itLPE = lp.end();
113  for (; itLP != itLPE; ++itLP) {
114  int strip = itLP->first;
115  if (iEGroup->m_GroupShape.getLogStripState(logPlane, strip)) {
116  firedPlanes = firedPlanes | one;
117  firedPlanesCount++;
118  break;
119  }
120  }
121  }
122  /*
123  for(unsigned int bitNum = 0;
124  bitNum <
125  RPCConst::
126  m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane];
127  bitNum++)
128  {
129  if(iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum)
130  && cone.getLogStripState(logPlane, bitNum))
131  {
132  firedPlanes = firedPlanes | one;
133  firedPlanesCount++;
134  break;
135  }
136  }
137  */
138  one = one << 1;
139  }
140 
141  short quality = m_pacData->m_QualityTabsVec[iEGroup->m_QualityTabNumber][firedPlanes];
142  if (quality == -1)
143  continue;
144 
145  RPCPacMuon bufMuon;
146  for (unsigned int vecNum = 0; vecNum < iEGroup->m_PatternsItVec.size(); vecNum++) {
147  RPCMuon::TDigiLinkVec digiIdx;
148  const RPCPattern::RPCPatVec::const_iterator patternIt = iEGroup->m_PatternsItVec[vecNum];
149  const RPCPattern& pattern = *patternIt;
150  bool wasHit = false;
151  unsigned short one1 = 1;
152  for (int logPlane = RPCConst::m_FIRST_PLANE;
153  logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
154  logPlane++, one1 = one1 << 1) {
155  if (pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED) {
156  // firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
157  continue;
158  }
159  if ((firedPlanes & one1) != 0) {
160  int fromBit = pattern.getStripFrom(logPlane);
161  int toBit = pattern.getStripTo(logPlane);
162  wasHit = false;
163  for (int bitNumber = fromBit; bitNumber < toBit; bitNumber++) {
164  wasHit = wasHit || cone.getLogStripState(logPlane, bitNumber);
165  if (wasHit) { // no sense to check more
166  std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
167  if (!dIVec.empty())
168  digiIdx.push_back(RPCMuon::TDigiLink(logPlane, *dIVec.begin()));
169  break;
170  }
171  }
172 
173  if (!wasHit) {
174  break;
175  }
176  }
177  }
178  if (wasHit) {
179  bufMuon.setAll(pattern, quality, firedPlanes);
180  bufMuon.setDigiIdxVec(digiIdx);
181  break; //if one pattern fits, thers no point to check other patterns from group
182  }
183  } //end of patterns loop
184  if (bufMuon > bestMuon) {
185  bestMuon = bufMuon;
186  }
187  //if(bestMuon.getQuality() == m_pacData->m_MaxQuality)
188  // return bestMuon;
189  } //end of EGroup loop
190  return bestMuon;
191 }
void setDigiIdxVec(const TDigiLinkVec &d)
Definition: RPCMuon.h:83
static const int m_USED_PLANES_COUNT[m_TOWER_COUNT]
m_Number of Logic Planes existing in each m_Tower.
Definition: RPCConst.h:87
int getStripTo(int logPlane) const
Next-to-last strip in range.
Definition: RPCPattern.cc:55
std::map< int, std::vector< int > > TLogPlane
Definition: RPCLogCone.h:30
int getQuality() const
Definition: RPCMuon.cc:69
bool getLogStripState(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:184
TTPatternsGroup m_TrackPatternsGroup
Here patters used in "baseline" algorith are stored.
Definition: RPCPacData.h:91
void setAll(const RPCPattern &pattern, int quality, unsigned short firedPlanes)
Definition: RPCPacMuon.cc:16
std::vector< RPCPattern::RPCPatVec::const_iterator > m_PatternsItVec
< Vector of itereator on m_PatternsVec in Pac.
RPCPacMuon runTrackPatternsGroup(const RPCLogCone &cone) const
Definition: RPCPac.cc:43
int getStripFrom(int logPlane) const
First strip in range.
Definition: RPCPattern.cc:50
TLogPlane getLogPlane(int logPlane) const
Definition: RPCLogCone.cc:147
int getIdx() const
Definition: RPCLogCone.cc:172
RPCConst::l1RpcConeCrdnts m_CurrConeCrdnts
Definition: RPCPacBase.h:32
RPCConst::TQualityTabsVec m_QualityTabsVec
Definition: RPCPacData.h:84
int getHitsCnt(int logPlane) const
Gets fired strips count in given logPlane.
Definition: RPCLogCone.cc:150
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setConeCrdnts(const RPCConst::l1RpcConeCrdnts &coneCrdnts)
Definition: RPCMuon.cc:55
static const int m_FIRST_PLANE
Use ase a first index in loops.
Definition: RPCConst.h:55
int getQualityTabNumber() const
Definition: RPCPattern.cc:73
void setLogConeIdx(int logConeIdx)
Definition: RPCMuon.cc:79
std::vector< TDigiLink > TDigiLinkVec
Definition: RPCMuon.h:80
RPCPacMuon runEnergeticPatternsGroups(const RPCLogCone &cone) const
Definition: RPCPac.cc:96
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88
const RPCPacData * m_pacData
Definition: RPCPac.h:24
RPCPac(const RPCPacData *, int tower, int logSector, int logSegment)
Definition: RPCPac.cc:4
RPCPacMuon run(const RPCLogCone &cone) const
Definition: RPCPac.cc:16
RPCConst::l1RpcConeCrdnts m_ConeCrdnts
Coordinates of LogCone.The coordinates, with which m_PAC is created - the same as in pac file name...
Definition: RPCPacBase.h:28
std::vector< int > getLogStripDigisIdxs(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:202
static const int m_NOT_CONECTED
Denotes Logic m_Strips that is not valid (f.e. in Patterns denotes, that in given plane the pattern i...
Definition: RPCConst.h:94