Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "L1Trigger/RPCTrigger/interface/RPCConeBuilderFromES.h"
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 RPCConeBuilderFromES::RPCConeBuilderFromES()
00032 {
00033 }
00034
00035
00036
00037
00038
00039
00040 RPCConeBuilderFromES::~RPCConeBuilderFromES()
00041 {
00042 }
00043
00044 L1RpcLogConesVec RPCConeBuilderFromES::getConesFromES(edm::Handle<RPCDigiCollection> rpcDigis,
00045 edm::ESHandle<L1RPCConeBuilder> coneBuilder,
00046 edm::ESHandle<L1RPCConeDefinition> coneDef,
00047 edm::ESHandle<L1RPCBxOrConfig> bxOrDef,
00048 edm::ESHandle<L1RPCHwConfig> hwConfig, int bx)
00049 {
00050 std::vector<RPCLogHit> logHits;
00051 std::vector<RPCLogHit> logHitsFromUncomp;
00052
00053
00054
00055
00056 short int digiIndex = 0;
00057 RPCDigiCollection::DigiRangeIterator detUnitIt;
00058 for (detUnitIt=rpcDigis->begin();
00059 detUnitIt!=rpcDigis->end();
00060 ++detUnitIt)
00061 {
00062 const RPCDetId& id = (*detUnitIt).first;
00063
00064 uint32_t rawId = id.rawId();
00065
00066 const RPCDigiCollection::Range& range = (*detUnitIt).second;
00067
00068 std::pair<L1RPCConeBuilder::TCompressedConVec::const_iterator, L1RPCConeBuilder::TCompressedConVec::const_iterator>
00069 compressedConnPair = coneBuilder->getCompConVec(rawId);
00070
00071
00072 for (RPCDigiCollection::const_iterator digiIt = range.first;
00073 digiIt!=range.second;
00074 ++digiIt)
00075 {
00076
00077 ++digiIndex;
00078 if ( digiIt->bx() < bxOrDef->getFirstBX() + bx || digiIt->bx() > bxOrDef->getLastBX() +bx ){
00079
00080 continue;
00081 }
00082
00083
00084
00085 std::pair<L1RPCConeBuilder::TStripConVec::const_iterator, L1RPCConeBuilder::TStripConVec::const_iterator>
00086 itPair = coneBuilder->getConVec(rawId,digiIt->strip());
00087
00088 L1RPCConeBuilder::TStripConVec::const_iterator it = itPair.first;
00089
00090 for (; it!=itPair.second;++it){
00091
00092 if ( hwConfig->isActive(it->m_tower, it->m_PAC) ){
00093
00094 RPCLogHit lh(it->m_tower, it->m_PAC, it->m_logplane, it->m_logstrip);
00095 lh.setDigiIdx(digiIndex);
00096 logHitsFromUncomp.push_back( lh );
00097 }
00098 }
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 L1RPCConeBuilder::TCompressedConVec::const_iterator itComp = compressedConnPair.first;
00109 for (; itComp!=compressedConnPair.second; ++itComp){
00110 if ( hwConfig->isActive(itComp->m_tower, itComp->m_PAC)){
00111 int logstrip = itComp->getLogStrip(digiIt->strip(),coneDef->getLPSizeVec());
00112 if (logstrip!=-1){
00113 RPCLogHit lh(itComp->m_tower, itComp->m_PAC, itComp->m_logplane, logstrip );
00114 lh.setDigiIdx(digiIndex);
00115 logHits.push_back( lh );
00116 }
00117
00118
00119
00120
00121
00122
00123
00124
00125 }
00126 }
00127
00128 }
00129
00130 }
00131
00132
00133
00134 std::vector<RPCLogHit>::iterator itLHitUncomp = logHitsFromUncomp.begin();
00135 std::vector<RPCLogHit>::iterator itLHitComp;
00136
00137
00138 for(;itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
00139 for (itLHitComp = logHits.begin(); itLHitComp != logHits.end(); ++itLHitComp){
00140
00141 if ( itLHitComp->getTower() == itLHitUncomp->getTower()
00142 && itLHitComp->getLogSector() == itLHitUncomp->getLogSector()
00143 && itLHitComp->getLogSegment() == itLHitUncomp->getLogSegment()
00144 && itLHitComp->getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber() )
00145 {
00146
00147
00148 *itLHitUncomp = *itLHitComp;
00149 }
00150
00151 }
00152 }
00153
00154
00155 for(;itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
00156 bool present = false;
00157 for (unsigned int i=0; i < logHits.size(); ++i)
00158 {
00159
00160 if ( logHits[i].getTower() == itLHitUncomp->getTower()
00161 && logHits[i].getLogSector() == itLHitUncomp->getLogSector()
00162 && logHits[i].getLogSegment() == itLHitUncomp->getLogSegment()
00163 && logHits[i].getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber() )
00164 {
00165 present = true;
00166 }
00167 }
00168 if (!present)
00169 {
00170
00171
00172
00173 logHits.push_back(*itLHitUncomp);
00174 }
00175 }
00176
00177
00178 L1RpcLogConesVec ActiveCones;
00179
00180 std::vector<RPCLogHit>::iterator p_lhit;
00181 for (p_lhit = logHits.begin(); p_lhit != logHits.end(); ++p_lhit){
00182
00183 bool hitTaken = false;
00184 L1RpcLogConesVec::iterator p_cone;
00185 for (p_cone = ActiveCones.begin(); p_cone != ActiveCones.end(); p_cone++){
00186 hitTaken = p_cone->addLogHit(*p_lhit);
00187 if(hitTaken)
00188 break;
00189 }
00190
00191 if(!hitTaken) {
00192 RPCLogCone newcone(*p_lhit);
00193 newcone.setIdx(ActiveCones.size());
00194 ActiveCones.push_back(newcone);
00195 }
00196 }
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 return ActiveCones;
00220
00221 }
00222