File indexing completed on 2024-04-06 12:21:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "L1Trigger/RPCTrigger/interface/RPCConeBuilderFromES.h"
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 RPCConeBuilderFromES::RPCConeBuilderFromES() {}
0030
0031
0032
0033
0034
0035
0036 RPCConeBuilderFromES::~RPCConeBuilderFromES() {}
0037
0038 L1RpcLogConesVec RPCConeBuilderFromES::getConesFromES(edm::Handle<RPCDigiCollection> rpcDigis,
0039 edm::ESHandle<L1RPCConeBuilder> coneBuilder,
0040 edm::ESHandle<L1RPCConeDefinition> coneDef,
0041 edm::ESHandle<L1RPCBxOrConfig> bxOrDef,
0042 edm::ESHandle<L1RPCHwConfig> hwConfig,
0043 int bx) {
0044 std::vector<RPCLogHit> logHits;
0045 std::vector<RPCLogHit> logHitsFromUncomp;
0046
0047
0048
0049
0050 short int digiIndex = 0;
0051 RPCDigiCollection::DigiRangeIterator detUnitIt;
0052 for (detUnitIt = rpcDigis->begin(); detUnitIt != rpcDigis->end(); ++detUnitIt) {
0053 const RPCDetId& id = (*detUnitIt).first;
0054
0055 uint32_t rawId = id.rawId();
0056
0057 const RPCDigiCollection::Range& range = (*detUnitIt).second;
0058
0059 std::pair<L1RPCConeBuilder::TCompressedConVec::const_iterator, L1RPCConeBuilder::TCompressedConVec::const_iterator>
0060 compressedConnPair = coneBuilder->getCompConVec(rawId);
0061
0062
0063 for (RPCDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0064 ++digiIndex;
0065 if (digiIt->bx() < bxOrDef->getFirstBX() + bx || digiIt->bx() > bxOrDef->getLastBX() + bx) {
0066
0067 continue;
0068 }
0069
0070
0071
0072 std::pair<L1RPCConeBuilder::TStripConVec::const_iterator, L1RPCConeBuilder::TStripConVec::const_iterator> itPair =
0073 coneBuilder->getConVec(rawId, digiIt->strip());
0074
0075 L1RPCConeBuilder::TStripConVec::const_iterator it = itPair.first;
0076
0077 for (; it != itPair.second; ++it) {
0078
0079 if (hwConfig->isActive(it->m_tower, it->m_PAC)) {
0080 RPCLogHit lh(it->m_tower, it->m_PAC, it->m_logplane, it->m_logstrip);
0081 lh.setDigiIdx(digiIndex);
0082 logHitsFromUncomp.push_back(lh);
0083 }
0084 }
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094 L1RPCConeBuilder::TCompressedConVec::const_iterator itComp = compressedConnPair.first;
0095 for (; itComp != compressedConnPair.second; ++itComp) {
0096 if (hwConfig->isActive(itComp->m_tower, itComp->m_PAC)) {
0097 int logstrip = itComp->getLogStrip(digiIt->strip(), coneDef->getLPSizeVec());
0098 if (logstrip != -1) {
0099 RPCLogHit lh(itComp->m_tower, itComp->m_PAC, itComp->m_logplane, logstrip);
0100 lh.setDigiIdx(digiIndex);
0101 logHits.push_back(lh);
0102 }
0103
0104
0105
0106
0107
0108
0109
0110 }
0111 }
0112
0113 }
0114 }
0115
0116
0117 std::vector<RPCLogHit>::iterator itLHitUncomp = logHitsFromUncomp.begin();
0118 std::vector<RPCLogHit>::iterator itLHitComp;
0119
0120
0121 for (; itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
0122 for (itLHitComp = logHits.begin(); itLHitComp != logHits.end(); ++itLHitComp) {
0123 if (itLHitComp->getTower() == itLHitUncomp->getTower() &&
0124 itLHitComp->getLogSector() == itLHitUncomp->getLogSector() &&
0125 itLHitComp->getLogSegment() == itLHitUncomp->getLogSegment() &&
0126 itLHitComp->getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber()) {
0127
0128
0129 *itLHitUncomp = *itLHitComp;
0130 }
0131 }
0132 }
0133
0134
0135 for (; itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
0136 bool present = false;
0137 for (unsigned int i = 0; i < logHits.size(); ++i) {
0138 if (logHits[i].getTower() == itLHitUncomp->getTower() &&
0139 logHits[i].getLogSector() == itLHitUncomp->getLogSector() &&
0140 logHits[i].getLogSegment() == itLHitUncomp->getLogSegment() &&
0141 logHits[i].getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber()) {
0142 present = true;
0143 }
0144 }
0145 if (!present) {
0146
0147
0148
0149 logHits.push_back(*itLHitUncomp);
0150 }
0151 }
0152
0153
0154 L1RpcLogConesVec ActiveCones;
0155
0156 std::vector<RPCLogHit>::iterator p_lhit;
0157 for (p_lhit = logHits.begin(); p_lhit != logHits.end(); ++p_lhit) {
0158 bool hitTaken = false;
0159 L1RpcLogConesVec::iterator p_cone;
0160 for (p_cone = ActiveCones.begin(); p_cone != ActiveCones.end(); p_cone++) {
0161 hitTaken = p_cone->addLogHit(*p_lhit);
0162 if (hitTaken)
0163 break;
0164 }
0165
0166 if (!hitTaken) {
0167 RPCLogCone newcone(*p_lhit);
0168 newcone.setIdx(ActiveCones.size());
0169 ActiveCones.push_back(newcone);
0170 }
0171 }
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 return ActiveCones;
0195 }