File indexing completed on 2024-04-06 12:30:49
0001 #include "RPCSim.h"
0002 #include "SimMuon/RPCDigitizer/src/RPCSimSetUp.h"
0003 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0004
0005 RPCSim::RPCSim(const edm::ParameterSet& config) {}
0006
0007 void RPCSim::fillDigis(int rollDetId, RPCDigiCollection& digis) {
0008
0009
0010
0011
0012
0013 for (std::set<std::pair<int, int> >::iterator i = strips.begin(); i != strips.end(); i++) {
0014 if (i->second != -999) {
0015 RPCDigi rpcDigi(i->first, i->second);
0016
0017
0018 digis.insertDigi(RPCDetId(rollDetId), rpcDigi);
0019 this->addLinks(i->first, i->second);
0020 }
0021 }
0022 strips.clear();
0023
0024 for (auto it : irpc_digis) {
0025 if (it.bx() != -999) {
0026 digis.insertDigi(RPCDetId(rollDetId), it);
0027 this->addLinks(it.strip(), it.bx());
0028 }
0029 }
0030 irpc_digis.clear();
0031 }
0032
0033 void RPCSim::addLinks(unsigned int strip, int bx) {
0034 std::pair<unsigned int, int> digi(strip, bx);
0035 std::pair<DetectorHitMap::iterator, DetectorHitMap::iterator> channelHitItr = theDetectorHitMap.equal_range(digi);
0036
0037 for (DetectorHitMap::iterator hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr) {
0038 const PSimHit* hit = (hitItr->second);
0039
0040 if (hit != nullptr) {
0041 theRpcDigiSimLinks.push_back(RPCDigiSimLink(digi,
0042 hit->entryPoint(),
0043 hit->momentumAtEntry(),
0044 hit->timeOfFlight(),
0045 hit->energyLoss(),
0046 hit->particleType(),
0047 hit->detUnitId(),
0048 hit->trackId(),
0049 hit->eventId(),
0050 hit->processType()));
0051 }
0052 }
0053 }