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 
18 RPCDigitizer::~RPCDigitizer() = default;
19 
21  RPCDigiCollection & rpcDigis,
22  RPCDigiSimLinks & rpcDigiSimLink,
23  CLHEP::HepRandomEngine* engine)
24 {
25 
26  theRPCSim->setRPCSimSetUp(theSimSetUp);
27 
28  // arrange the hits by roll
29  std::map<int, edm::PSimHitContainer> hitMap;
30  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
31  hitItr != simHits.end(); ++hitItr)
32  {
33  hitMap[hitItr->detUnitId()].push_back(*hitItr);
34  }
35 
36  if ( ! theGeometry) {
37  throw cms::Exception("Configuration")
38  << "RPCDigitizer 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.";
39  }
40 
41 
42  const std::vector<const RPCRoll*>& rpcRolls = theGeometry->rolls() ;
43  for(auto r = rpcRolls.begin();
44  r != rpcRolls.end(); r++){
45 
46  RPCDetId id = (*r)->id();
47  const edm::PSimHitContainer & rollSimHits = hitMap[id];
48 
49 
50  if(!((*r)->isIRPC())){
51  theRPCSim->simulate(*r, rollSimHits, engine);
52 
53  if(theNoise){
54  theRPCSim->simulateNoise(*r, engine);
55  }
56  }
57 
58  theRPCSim->fillDigis((*r)->id(),rpcDigis);
59  rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
60  }
61 }
62 
63 const RPCRoll * RPCDigitizer::findDet(int detId) const {
64  assert(theGeometry != nullptr);
65  const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId));
66  return dynamic_cast<const RPCRoll *>(detUnit);
67 }
68 
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
RPCDigitizer(const edm::ParameterSet &config)
Definition: RPCDigitizer.cc:12
RPCSimSetUp * theSimSetUp
Definition: RPCDigitizer.h:59
Definition: config.py:1
iterator end() const
std::unique_ptr< RPCSim > theRPCSim
Definition: RPCDigitizer.h:58
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
Definition: RPCDigitizer.cc:20
const RPCGeometry * theGeometry
Definition: RPCDigitizer.h:57
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:235
const RPCRoll * findDet(int detId) const
finds the rpc det unit in the geometry associated with this det ID
Definition: RPCDigitizer.cc:63
std::vector< PSimHit > PSimHitContainer
iterator begin() const
T get(const Candidate &c)
Definition: component.h:55