CMS 3D CMS Logo

List of all members | Public Member Functions
RPCConeBuilderFromES Class Reference

#include <L1Trigger/RPCTrigger/interface/RPCConeBuilderFromES.h>

Public Member Functions

L1RpcLogConesVec getConesFromES (edm::Handle< RPCDigiCollection > rpcDigis, edm::ESHandle< L1RPCConeBuilder > coneBuilder, edm::ESHandle< L1RPCConeDefinition > coneDef, edm::ESHandle< L1RPCBxOrConfig > bxOrDef, edm::ESHandle< L1RPCHwConfig > hwConfig, int bx)
 
 RPCConeBuilderFromES ()
 
virtual ~RPCConeBuilderFromES ()
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 41 of file RPCConeBuilderFromES.h.

Constructor & Destructor Documentation

◆ RPCConeBuilderFromES()

RPCConeBuilderFromES::RPCConeBuilderFromES ( )

Definition at line 29 of file RPCConeBuilderFromES.cc.

29 {}

◆ ~RPCConeBuilderFromES()

RPCConeBuilderFromES::~RPCConeBuilderFromES ( )
virtual

Definition at line 36 of file RPCConeBuilderFromES.cc.

36 {}

Member Function Documentation

◆ getConesFromES()

L1RpcLogConesVec RPCConeBuilderFromES::getConesFromES ( edm::Handle< RPCDigiCollection rpcDigis,
edm::ESHandle< L1RPCConeBuilder coneBuilder,
edm::ESHandle< L1RPCConeDefinition coneDef,
edm::ESHandle< L1RPCBxOrConfig bxOrDef,
edm::ESHandle< L1RPCHwConfig hwConfig,
int  bx 
)

Definition at line 38 of file RPCConeBuilderFromES.cc.

43  {
44  std::vector<RPCLogHit> logHits;
45  std::vector<RPCLogHit> logHitsFromUncomp;
46 
47  // Build cones from digis
48  // first build loghits
49 
50  short int digiIndex = 0;
52  for (detUnitIt = rpcDigis->begin(); detUnitIt != rpcDigis->end(); ++detUnitIt) {
53  const RPCDetId& id = (*detUnitIt).first;
54 
55  uint32_t rawId = id.rawId();
56 
57  const RPCDigiCollection::Range& range = (*detUnitIt).second;
58 
59  std::pair<L1RPCConeBuilder::TCompressedConVec::const_iterator, L1RPCConeBuilder::TCompressedConVec::const_iterator>
60  compressedConnPair = coneBuilder->getCompConVec(rawId);
61 
62  // iterate over strips
63  for (RPCDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
64  ++digiIndex;
65  if (digiIt->bx() < bxOrDef->getFirstBX() + bx || digiIt->bx() > bxOrDef->getLastBX() + bx) {
66  //if ( digiIt->bx() < hwConfig->getFirstBX() + bx || digiIt->bx() > hwConfig->getLastBX() +bx ){
67  continue;
68  }
69 
70  //std::cout << digiIt->bx() << " D " << rawId << " " << id << " S " << digiIt->strip() << std::endl;
71  // for uncompressed connections
72  std::pair<L1RPCConeBuilder::TStripConVec::const_iterator, L1RPCConeBuilder::TStripConVec::const_iterator> itPair =
73  coneBuilder->getConVec(rawId, digiIt->strip());
74 
75  L1RPCConeBuilder::TStripConVec::const_iterator it = itPair.first;
76  // Iterate over uncompressed connections, convert digis to logHits
77  for (; it != itPair.second; ++it) {
78  //std::cout << " Not empty!" << std::endl;
79  if (hwConfig->isActive(it->m_tower, it->m_PAC)) {
80  RPCLogHit lh(it->m_tower, it->m_PAC, it->m_logplane, it->m_logstrip);
81  lh.setDigiIdx(digiIndex);
82  logHitsFromUncomp.push_back(lh);
83  }
84  }
85 
86  /*
87  bool printOut = false;
88  if (digiIt->strip() == 62 || digiIt->strip() == 63 ){
89  std::cout << "Strip " << digiIt->strip() << std::endl;
90  printOut = true;
91  }
92  */
93 
94  L1RPCConeBuilder::TCompressedConVec::const_iterator itComp = compressedConnPair.first;
95  for (; itComp != compressedConnPair.second; ++itComp) {
96  if (hwConfig->isActive(itComp->m_tower, itComp->m_PAC)) {
97  int logstrip = itComp->getLogStrip(digiIt->strip(), coneDef->getLPSizeVec());
98  if (logstrip != -1) {
99  RPCLogHit lh(itComp->m_tower, itComp->m_PAC, itComp->m_logplane, logstrip);
100  lh.setDigiIdx(digiIndex);
101  logHits.push_back(lh);
102  }
103  /*
104  if (printOut){
105  std::cout << "T " << (int)itComp->m_tower << " P "
106  << (int)itComp->m_PAC << " LP "
107  << (int)itComp->m_logplane << " LS "
108  << (int)logstrip << std::endl;
109  }*/
110  }
111  }
112 
113  } // strip iteration ends
114  }
115 
116  // check if we dont have any preferable uncompressed loghits
117  std::vector<RPCLogHit>::iterator itLHitUncomp = logHitsFromUncomp.begin();
118  std::vector<RPCLogHit>::iterator itLHitComp;
119 
120  // overwrite uncompressed with those coming from compressed
121  for (; itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
122  for (itLHitComp = logHits.begin(); itLHitComp != logHits.end(); ++itLHitComp) {
123  if (itLHitComp->getTower() == itLHitUncomp->getTower() &&
124  itLHitComp->getLogSector() == itLHitUncomp->getLogSector() &&
125  itLHitComp->getLogSegment() == itLHitUncomp->getLogSegment() &&
126  itLHitComp->getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber()) {
127  // std::cout<< "Overwrite " << std::endl;
128  //std::cout.flush();
129  *itLHitUncomp = *itLHitComp;
130  }
131  }
132  }
133 
134  // copy missing from compressed to uncompressed
135  for (; itLHitUncomp != logHitsFromUncomp.end(); ++itLHitUncomp) {
136  bool present = false;
137  for (unsigned int i = 0; i < logHits.size(); ++i) {
138  if (logHits[i].getTower() == itLHitUncomp->getTower() &&
139  logHits[i].getLogSector() == itLHitUncomp->getLogSector() &&
140  logHits[i].getLogSegment() == itLHitUncomp->getLogSegment() &&
141  logHits[i].getlogPlaneNumber() == itLHitUncomp->getlogPlaneNumber()) {
142  present = true;
143  }
144  }
145  if (!present) {
146  // std::cout<< "Copy " << std::endl;
147  //std::cout.flush();
148 
149  logHits.push_back(*itLHitUncomp);
150  }
151  }
152 
153  // build cones
154  L1RpcLogConesVec ActiveCones;
155 
156  std::vector<RPCLogHit>::iterator p_lhit;
157  for (p_lhit = logHits.begin(); p_lhit != logHits.end(); ++p_lhit) {
158  bool hitTaken = false;
159  L1RpcLogConesVec::iterator p_cone;
160  for (p_cone = ActiveCones.begin(); p_cone != ActiveCones.end(); p_cone++) {
161  hitTaken = p_cone->addLogHit(*p_lhit);
162  if (hitTaken)
163  break;
164  }
165 
166  if (!hitTaken) {
167  RPCLogCone newcone(*p_lhit);
168  newcone.setIdx(ActiveCones.size());
169  ActiveCones.push_back(newcone);
170  }
171  } // for loghits
172 
173  /*
174  for (int tower = -16; tower<17;++tower)
175  {
176  for (int sector = 0; sector<12;++sector)
177  {
178  for (int segment = 0; segment<12;++segment)
179  {
180  for (L1RpcLogConesVec::iterator it = ActiveCones.begin(); it!=ActiveCones.end(); ++it)
181  {
182  if (it->getTower()==tower
183  && it->getLogSector()==sector
184  && it->getLogSegment()==segment)
185  {
186  std::cout << it->toString() << std::endl;
187  }
188  }
189  }
190  }
191  }
192  // */
193 
194  return ActiveCones;
195 }

References simKBmtfDigis_cfi::bx, L1RPCConeBuilder::getCompConVec(), L1RPCConeBuilder::getConVec(), L1RPCBxOrConfig::getFirstBX(), L1RPCBxOrConfig::getLastBX(), L1RPCConeDefinition::getLPSizeVec(), mps_fire::i, L1RPCHwConfig::isActive(), mathSSE::lh, FastTimerService_cff::range, DetId::rawId(), and RPCLogCone::setIdx().

Referenced by RPCTrigger::produce().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:355
L1RPCConeDefinition::getLPSizeVec
const TLPSizeVec & getLPSizeVec() const
Definition: L1RPCConeDefinition.h:73
RPCDetId
Definition: RPCDetId.h:16
L1RPCHwConfig::isActive
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:70
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
L1RPCConeBuilder::getConVec
std::pair< TStripConVec::const_iterator, TStripConVec::const_iterator > getConVec(uint32_t det, unsigned char strip) const
Definition: L1RPCConeBuilder.cc:27
MuonDigiCollection< RPCDetId, RPCDigi >::const_iterator
std::vector< RPCDigi >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
RPCLogCone
Definition: RPCLogCone.h:23
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
RPCLogHit
Definition: RPCLogHit.h:20
L1RPCBxOrConfig::getLastBX
int getLastBX() const
Definition: L1RPCBxOrConfig.h:32
L1RPCBxOrConfig::getFirstBX
int getFirstBX() const
Definition: L1RPCBxOrConfig.h:31
L1RpcLogConesVec
std::vector< RPCLogCone > L1RpcLogConesVec
Definition: RPCLogCone.h:119
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MuonDigiCollection< RPCDetId, RPCDigi >::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
DigiContainerIterator
Definition: MuonDigiCollection.h:30
L1RPCConeBuilder::getCompConVec
std::pair< TCompressedConVec::const_iterator, TCompressedConVec::const_iterator > getCompConVec(uint32_t det) const
Definition: L1RPCConeBuilder.cc:45