Go to the documentation of this file.00001 #include "L1Trigger/RPCTrigger/interface/RPCPac.h"
00002
00003
00004 RPCPac::RPCPac(const RPCPacData * pacData, int tower, int logSector,
00005 int logSegment):
00006 RPCPacBase(tower, logSector, logSegment)
00007 {
00008
00009 m_pacData = pacData;
00010
00011 }
00012
00020 RPCPacMuon RPCPac::run(const RPCLogCone & cone) const
00021 {
00022
00023 RPCPacMuon bestMuon;
00024
00025 if(m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size() > 0)
00026 bestMuon = runTrackPatternsGroup(cone);
00027
00028
00029 if(m_pacData->m_EnergeticPatternsGroupList.size() > 0)
00030 {
00031 RPCPacMuon bufMuon = runEnergeticPatternsGroups(cone);
00032 if(bufMuon > bestMuon)
00033 bestMuon = bufMuon;
00034 }
00035
00036 bestMuon.setConeCrdnts(m_CurrConeCrdnts);
00037
00038
00039
00040 bestMuon.setLogConeIdx(cone.getIdx());
00041
00042
00043
00044
00045
00046
00047 return bestMuon;
00048 }
00049
00050
00051 RPCPacMuon RPCPac::runTrackPatternsGroup(const RPCLogCone & cone) const
00052 {
00053 RPCPacMuon bestMuon;
00054
00055 for(unsigned int vecNum = 0;
00056 vecNum < m_pacData->m_TrackPatternsGroup.m_PatternsItVec.size(); vecNum++)
00057 {
00058 RPCMuon::TDigiLinkVec digiIdx;
00059 unsigned short firedPlanes = 0;
00060 int firedPlanesCount = 0;
00061 unsigned short one = 1;
00062 const RPCPattern & pattern =
00063 *(m_pacData->m_TrackPatternsGroup.m_PatternsItVec[vecNum]);
00064 for(int logPlane = RPCConst::m_FIRST_PLANE;
00065 logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00066 logPlane++)
00067 {
00068 if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
00069 {
00070
00071 continue;
00072 }
00073 int fromBit = pattern.getStripFrom(logPlane);
00074 int toBit = pattern.getStripTo(logPlane);
00075 for(int bitNumber = fromBit; bitNumber < toBit; bitNumber++)
00076 {
00077 if(cone.getLogStripState(logPlane, bitNumber) == true)
00078 {
00079 firedPlanes = firedPlanes | one;
00080 firedPlanesCount++;
00081 std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
00082 if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin()) );
00083
00084 break;
00085 }
00086 }
00087
00088 if((RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)] -
00089 logPlane) == 3)
00090 if(firedPlanesCount == 0)
00091 break;
00092
00093 one = one << 1;
00094 }
00095
00096 if(firedPlanesCount >= 3)
00097 {
00098 short quality =
00099 m_pacData->m_QualityTabsVec[pattern.getQualityTabNumber()][firedPlanes];
00100 if(quality != -1)
00101 {
00102 if(quality >= bestMuon.getQuality())
00103 {
00104 RPCPacMuon bufMuon(pattern, quality, firedPlanes);
00105 if(bufMuon > bestMuon)
00106 {
00107 bestMuon = bufMuon;
00108 bestMuon.setDigiIdxVec(digiIdx);
00109 }
00110 }
00111 }
00112 }
00113 }
00114 return bestMuon;
00115 }
00116
00117
00118
00119 RPCPacMuon
00120 RPCPac::runEnergeticPatternsGroups(const RPCLogCone & cone) const
00121 {
00122 RPCPacMuon bestMuon;
00123 unsigned short firedPlanes = 0;
00124 int firedPlanesCount = 0;
00125 RPCPacData::TEPatternsGroupList::const_iterator iEGroup =
00126 m_pacData->m_EnergeticPatternsGroupList.begin();
00127 for(; iEGroup != m_pacData->m_EnergeticPatternsGroupList.end(); iEGroup++)
00128 {
00129 firedPlanes = 0;
00130 firedPlanesCount = 0;
00131 unsigned short one = 1;
00132 for(int logPlane = RPCConst::m_FIRST_PLANE;
00133 logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00134 logPlane++)
00135 {
00136 for(unsigned int bitNum = 0;
00137 bitNum <
00138 RPCConst::
00139 m_LOGPLANE_SIZE[abs(m_ConeCrdnts.m_Tower)][logPlane];
00140 bitNum++)
00141 {
00142 if(iEGroup->m_GroupShape.getLogStripState(logPlane, bitNum)
00143 && cone.getLogStripState(logPlane, bitNum))
00144 {
00145 firedPlanes = firedPlanes | one;
00146 firedPlanesCount++;
00147 break;
00148 }
00149 }
00150 one = one << 1;
00151 }
00152
00153 short quality =
00154 m_pacData->m_QualityTabsVec[iEGroup->m_QualityTabNumber][firedPlanes];
00155 if(quality == -1)
00156 continue;
00157
00158 RPCPacMuon bufMuon;
00159 for(unsigned int vecNum = 0; vecNum < iEGroup->m_PatternsItVec.size();
00160 vecNum++)
00161 {
00162 RPCMuon::TDigiLinkVec digiIdx;
00163 const RPCPattern::RPCPatVec::const_iterator patternIt =
00164 iEGroup->m_PatternsItVec[vecNum];
00165 const RPCPattern & pattern = *patternIt;
00166 bool wasHit = false;
00167 unsigned short one1 = 1;
00168 for(int logPlane = RPCConst::m_FIRST_PLANE;
00169 logPlane < RPCConst::m_USED_PLANES_COUNT[std::abs(m_ConeCrdnts.m_Tower)];
00170 logPlane++, one1 = one1 << 1)
00171 {
00172 if(pattern.getStripFrom(logPlane) == RPCConst::m_NOT_CONECTED)
00173 {
00174
00175 continue;
00176 }
00177 if((firedPlanes & one1) != 0)
00178 {
00179 int fromBit = pattern.getStripFrom(logPlane);
00180 int toBit = pattern.getStripTo(logPlane);
00181 wasHit = false;
00182 for(int bitNumber = fromBit; bitNumber < toBit;
00183 bitNumber++)
00184 {
00185 wasHit = wasHit || cone.getLogStripState(logPlane, bitNumber);
00186 if (wasHit) {
00187 std::vector<int> dIVec = cone.getLogStripDigisIdxs(logPlane, bitNumber);
00188 if (!dIVec.empty()) digiIdx.push_back( RPCMuon::TDigiLink(logPlane, *dIVec.begin()) );
00189 break;
00190 }
00191 }
00192
00193 if(!wasHit){
00194 break;
00195 }
00196 }
00197 }
00198 if(wasHit)
00199 {
00200 bufMuon.setAll(pattern, quality, firedPlanes);
00201 bufMuon.setDigiIdxVec(digiIdx);
00202 break;
00203 }
00204 }
00205 if(bufMuon > bestMuon){
00206 bestMuon = bufMuon;
00207 }
00208
00209
00210 }
00211 return bestMuon;
00212 }