CMS 3D CMS Logo

IRPCDigitizer.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>("digiIRPCModel"),
14  config.getParameter<edm::ParameterSet>("digiIRPCModelConfig"))}
15 {
16  theNoise=config.getParameter<bool>("doBkgNoise");
17 }
18 
20 
22  RPCDigiCollection & rpcDigis,
23  RPCDigiSimLinks & rpcDigiSimLink,
24  CLHEP::HepRandomEngine* engine)
25 {
26 
27  theRPCSim->setRPCSimSetUp(theSimSetUp);
28 
29  // arrange the hits by roll
30  std::map<int, edm::PSimHitContainer> hitMap;
31  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
32  hitItr != simHits.end(); ++hitItr)
33  {
34  hitMap[hitItr->detUnitId()].push_back(*hitItr);
35  }
36 
37  if ( ! theGeometry) {
38  throw cms::Exception("Configuration")
39  << "IRPCDigitizer requires the RPCGeometry \n which is not present in the configuration file. You must add the service\n in the configuration file or remove the modules that require it.";
40  }
41 
42 
43  const std::vector<const RPCRoll*>& rpcRolls = theGeometry->rolls() ;
44  for(auto r = rpcRolls.begin();
45  r != rpcRolls.end(); r++){
46 
47  RPCDetId id = (*r)->id();
48  const edm::PSimHitContainer & rollSimHits = hitMap[id];
49 
50  if((*r)->isIRPC()){
51  theRPCSim->simulate(*r, rollSimHits, engine);
52 
53  if(theNoise){
54  theRPCSim->simulateNoise(*r, engine);
55  }
56  }
57 
58 
59  theRPCSim->fillDigis((*r)->id(),rpcDigis);
60  rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
61  }
62 }
63 
64 const RPCRoll * IRPCDigitizer::findDet(int detId) const {
65  assert(theGeometry != nullptr);
66  const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId));
67  return dynamic_cast<const RPCRoll *>(detUnit);
68 }
69 
T getParameter(std::string const &) const
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:48
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:67
Definition: config.py:1
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
const RPCGeometry * theGeometry
Definition: IRPCDigitizer.h:57
iterator end() const
IRPCDigitizer(const edm::ParameterSet &config)
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:235
RPCSimSetUp * theSimSetUp
Definition: IRPCDigitizer.h:59
std::vector< PSimHit > PSimHitContainer
iterator begin() const
std::unique_ptr< RPCSim > theRPCSim
Definition: IRPCDigitizer.h:58
T get(const Candidate &c)
Definition: component.h:55
const RPCRoll * findDet(int detId) const
finds the rpc det unit in the geometry associated with this det ID