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,
5  int logSegment):
6 RPCPacBase(tower, logSector, logSegment)
7 {
8 
9  m_pacData = pacData;
10 
11 }
12 
20 RPCPacMuon RPCPac::run(const RPCLogCone & cone) const
21 { //symualcja
22 
23  RPCPacMuon bestMuon;
24  //track
26  bestMuon = runTrackPatternsGroup(cone);
27 
28  //energetic
30  {
31  RPCPacMuon bufMuon = runEnergeticPatternsGroups(cone);
32  if(bufMuon > bestMuon)
33  bestMuon = bufMuon;
34  }
35 
37 
38 
39  //bestMuon.setConeCrdnts(cone.);
40  bestMuon.setLogConeIdx(cone.getIdx());
41  /*
42  int refStripNum = m_pacData->getPattern(bestMuon.getPatternNum())
43  .getStripFrom(RPCConst::m_REF_PLANE[abs(m_CurrConeCrdnts.m_Tower)])
44  + m_CurrConeCrdnts.m_LogSector * 96
45  + m_CurrConeCrdnts.m_LogSegment * 8;
46  bestMuon.setRefStripNum(refStripNum);*/
47  return bestMuon;
48 }
49 
50 
52 {
53  RPCPacMuon bestMuon;
54 
55  for(unsigned int vecNum = 0;
56  vecNum < m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size(); vecNum++)
57  {
58  RPCMuon::TDigiLinkVec digiIdx;
59  unsigned short firedPlanes = 0;
60  int firedPlanesCount = 0;
61  unsigned short one = 1;
62  const RPCPattern & pattern =
64  for(int logPlane = RPCConst::m_FIRST_PLANE;
66  logPlane++)
67  {
68  if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
69  {
70  //firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
71  continue;
72  }
73  int fromBit = pattern.getStripFrom(logPlane);
74  int toBit = pattern.getStripTo(logPlane);
75  for(int bitNumber = fromBit; bitNumber < toBit; bitNumber++)
76  {
77  if(cone.getLogStripState(logPlane, bitNumber) == true)
78  {
79  firedPlanes = firedPlanes | one;
80  firedPlanesCount++;
81  std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
82  if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin()) );
83 
84  break;
85  }
86  }
87 
88  if((RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)] -
89  logPlane) == 3)
90  if(firedPlanesCount == 0)
91  break;
92 
93  one = one << 1;
94  }
95 
96  if(firedPlanesCount >= 3)
97  {
98  short quality =
99  m_pacData->m_QualityTabsVec[pattern.getQualityTabNumber()][firedPlanes];
100  if(quality != -1)
101  {
102  if(quality >= bestMuon.getQuality())
103  {
104  RPCPacMuon bufMuon(pattern, quality, firedPlanes);
105  if(bufMuon > bestMuon)
106  {
107  bestMuon = bufMuon;
108  bestMuon.setDigiIdxVec(digiIdx);
109  }
110  }
111  }
112  }
113  }
114  return bestMuon;
115 }
116 
117 
118 
121 {
122  RPCPacMuon bestMuon;
123  unsigned short firedPlanes = 0;
124  int firedPlanesCount = 0;
125  RPCPacData::TEPatternsGroupList::const_iterator iEGroup =
127  for(; iEGroup != m_pacData->m_EnergeticPatternsGroupList.end(); iEGroup++)
128  {
129  firedPlanes = 0;
130  firedPlanesCount = 0;
131  unsigned short one = 1;
132  for(int logPlane = RPCConst::m_FIRST_PLANE;
134  logPlane++)
135  { //or po paskach ze stozka
136 
137  if (cone.getHitsCnt(logPlane)>0 ) {
138  RPCLogCone::TLogPlane lp = cone.getLogPlane(logPlane);
139  RPCLogCone::TLogPlane::const_iterator itLP = lp.begin();
140  RPCLogCone::TLogPlane::const_iterator itLPE = lp.end();
141  for(; itLP!=itLPE; ++itLP){
142  int strip=itLP->first;
143  if(iEGroup->m_GroupShape.getLogStripState(logPlane, strip)){
144  firedPlanes = firedPlanes | one;
145  firedPlanesCount++;
146  break;
147  }
148  }
149 
150  }
151  /*
152  for(unsigned int bitNum = 0;
153  bitNum <
154  RPCConst::
155  m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane];
156  bitNum++)
157  {
158  if(iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum)
159  && cone.getLogStripState(logPlane, bitNum))
160  {
161  firedPlanes = firedPlanes | one;
162  firedPlanesCount++;
163  break;
164  }
165  }
166  */
167  one = one << 1;
168  }
169 
170  short quality =
171  m_pacData->m_QualityTabsVec[iEGroup->m_QualityTabNumber][firedPlanes];
172  if(quality == -1)
173  continue;
174 
175  RPCPacMuon bufMuon;
176  for(unsigned int vecNum = 0; vecNum < iEGroup->m_PatternsItVec.size();
177  vecNum++)
178  {
179  RPCMuon::TDigiLinkVec digiIdx;
180  const RPCPattern::RPCPatVec::const_iterator patternIt =
181  iEGroup->m_PatternsItVec[vecNum];
182  const RPCPattern & pattern = *patternIt;
183  bool wasHit = false;
184  unsigned short one1 = 1;
185  for(int logPlane = RPCConst::m_FIRST_PLANE;
186  logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
187  logPlane++, one1 = one1 << 1)
188  {
189  if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
190  {
191 // firedPlanes[logPlane] = false; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
192  continue;
193  }
194  if((firedPlanes & one1) != 0)
195  {
196  int fromBit = pattern.getStripFrom(logPlane);
197  int toBit = pattern.getStripTo(logPlane);
198  wasHit = false;
199  for(int bitNumber = fromBit; bitNumber < toBit;
200  bitNumber++)
201  {
202  wasHit = wasHit || cone.getLogStripState(logPlane, bitNumber);
203  if (wasHit) { // no sense to check more
204  std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
205  if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin()) );
206  break;
207  }
208  }
209 
210  if(!wasHit){
211  break;
212  }
213  }
214  }
215  if(wasHit)
216  {
217  bufMuon.setAll(pattern, quality, firedPlanes);
218  bufMuon.setDigiIdxVec(digiIdx);
219  break; //if one pattern fits, thers no point to check other patterns from group
220  }
221  } //end of patterns loop
222  if(bufMuon > bestMuon){
223  bestMuon = bufMuon;
224  }
225  //if(bestMuon.getQuality() == m_pacData->m_MaxQuality)
226  // return bestMuon;
227  } //end of EGroup loop
228  return bestMuon;
229 }
void setDigiIdxVec(const TDigiLinkVec &d)
Definition: RPCMuon.h:80
static const int m_USED_PLANES_COUNT[m_TOWER_COUNT]
m_Number of Logic Planes existing in each m_Tower.
Definition: RPCConst.h:88
int getStripTo(int logPlane) const
Next-to-last strip in range.
Definition: RPCPattern.cc:57
std::map< int, std::vector< int > > TLogPlane
Definition: RPCLogCone.h:34
int getQuality() const
Definition: RPCMuon.cc:70
bool getLogStripState(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:211
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:17
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:51
int getStripFrom(int logPlane) const
First strip in range.
Definition: RPCPattern.cc:52
TLogPlane getLogPlane(int logPlane) const
Definition: RPCLogCone.cc:169
int getIdx() const
Definition: RPCLogCone.cc:198
RPCConst::l1RpcConeCrdnts m_CurrConeCrdnts
Definition: RPCPacBase.h:33
RPCConst::TQualityTabsVec m_QualityTabsVec
Definition: RPCPacData.h:84
int getHitsCnt(int logPlane) const
Gets fired strips count in given logPlane.
Definition: RPCLogCone.cc:174
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setConeCrdnts(const RPCConst::l1RpcConeCrdnts &coneCrdnts)
Definition: RPCMuon.cc:54
static const int m_FIRST_PLANE
Use ase a first index in loops.
Definition: RPCConst.h:56
int getQualityTabNumber() const
Definition: RPCPattern.cc:75
void setLogConeIdx(int logConeIdx)
Definition: RPCMuon.cc:80
RPCPacMuon runEnergeticPatternsGroups(const RPCLogCone &cone) const
Definition: RPCPac.cc:120
TEPatternsGroupList m_EnergeticPatternsGroupList
Definition: RPCPacData.h:88
const RPCPacData * m_pacData
Definition: RPCPac.h:27
std::vector< TDigiLink > TDigiLinkVec
Definition: RPCMuon.h:77
RPCPac(const RPCPacData *, int tower, int logSector, int logSegment)
Definition: RPCPac.cc:4
RPCPacMuon run(const RPCLogCone &cone) const
Definition: RPCPac.cc:20
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:29
std::vector< int > getLogStripDigisIdxs(int logPlane, unsigned int logStripNum) const
Definition: RPCLogCone.cc:235
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:95