CMS 3D CMS Logo

RPCDigitizer.cc
Go to the documentation of this file.
9 
10 // default constructor allocates default wire and strip digitizers
11 
13  : theRPCSim{RPCSimFactory::get()->create(config.getParameter<std::string>("digiModel"),
14  config.getParameter<edm::ParameterSet>("digiModelConfig"))},
15  theNoise{config.getParameter<bool>("doBkgNoise")} {}
16 
17 RPCDigitizer::~RPCDigitizer() = default;
18 
20  RPCDigiCollection& rpcDigis,
21  RPCDigiSimLinks& rpcDigiSimLink,
22  CLHEP::HepRandomEngine* engine) {
23  theRPCSim->setRPCSimSetUp(theSimSetUp);
24 
25  // arrange the hits by roll
26  std::map<int, edm::PSimHitContainer> hitMap;
27  for (MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
28  hitMap[hitItr->detUnitId()].push_back(*hitItr);
29  }
30 
31  if (!theGeometry) {
32  throw cms::Exception("Configuration")
33  << "RPCDigitizer requires the RPCGeometry \n which is not present in the configuration file. You must add the "
34  "service\n in the configuration file or remove the modules that require it.";
35  }
36 
37  const std::vector<const RPCRoll*>& rpcRolls = theGeometry->rolls();
38  for (auto r = rpcRolls.begin(); r != rpcRolls.end(); r++) {
39  RPCDetId id = (*r)->id();
40  const edm::PSimHitContainer& rollSimHits = hitMap[id];
41 
42  if (!((*r)->isIRPC())) {
43  theRPCSim->simulate(*r, rollSimHits, engine);
44 
45  if (theNoise) {
46  theRPCSim->simulateNoise(*r, engine);
47  }
48  }
49 
50  theRPCSim->fillDigis((*r)->id(), rpcDigis);
51  rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
52  }
53 }
54 
55 const RPCRoll* RPCDigitizer::findDet(int detId) const {
56  assert(theGeometry != nullptr);
57  const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId));
58  return dynamic_cast<const RPCRoll*>(detUnit);
59 }
RPCDigitizer::doAction
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
Definition: RPCDigitizer.cc:19
RPCRoll
Definition: RPCRoll.h:12
edm::DetSetVector< RPCDigiSimLink >
RPCDigitizer::theNoise
bool theNoise
Definition: RPCDigitizer.h:59
MessageLogger.h
RPCDigitizer::theSimSetUp
RPCSimSetUp * theSimSetUp
Definition: RPCDigitizer.h:58
GeomDet
Definition: GeomDet.h:27
RPCSimFactory.h
RPCDetId
Definition: RPCDetId.h:16
cms::cuda::assert
assert(be >=bs)
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
RPCRoll.h
RPCSim.h
MixCollection::MixItr
Definition: MixCollection.h:62
RPCDigitizer::findDet
const RPCRoll * findDet(int detId) const
finds the rpc det unit in the geometry associated with this det ID
Definition: RPCDigitizer.cc:55
RPCGeometry::idToDetUnit
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:30
RPCDigiCollection
config
Definition: config.py:1
edm::DetSetVector::insert
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:220
PSimHit.h
RPCDigitizer::theRPCSim
std::unique_ptr< RPCSim > theRPCSim
Definition: RPCDigitizer.h:57
MixCollection
Definition: MixCollection.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDigitizer::theGeometry
const RPCGeometry * theGeometry
Definition: RPCDigitizer.h:56
edm::ParameterSet
Definition: ParameterSet.h:36
RPCDigitizer::~RPCDigitizer
~RPCDigitizer()
get
#define get
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RPCDigitizer.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
RPCSimSetUp.h
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
RPCGeometry::rolls
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
ParameterSet.h
RPCDigitizer::RPCDigitizer
RPCDigitizer(const edm::ParameterSet &config)
Definition: RPCDigitizer.cc:12