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  theName = config.getParameter<std::string>("digiModel");
14  theRPCSim = RPCSimFactory::get()->create(theName,config.getParameter<edm::ParameterSet>("digiModelConfig"));
15  theNoise=config.getParameter<bool>("doBkgNoise");
16 }
17 
19  if( theRPCSim )
20  delete theRPCSim;
21  theRPCSim = 0;
22 }
23 
25  RPCDigiCollection & rpcDigis,
26  RPCDigiSimLinks & rpcDigiSimLink,
27  CLHEP::HepRandomEngine* engine)
28 {
29 
31 
32  // arrange the hits by roll
33  std::map<int, edm::PSimHitContainer> hitMap;
34  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
35  hitItr != simHits.end(); ++hitItr)
36  {
37  hitMap[hitItr->detUnitId()].push_back(*hitItr);
38  }
39 
40  if ( ! theGeometry) {
41  throw cms::Exception("Configuration")
42  << "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.";
43  }
44 
45 
46  const std::vector<const RPCRoll*>& rpcRolls = theGeometry->rolls() ;
47  for(auto r = rpcRolls.begin();
48  r != rpcRolls.end(); r++){
49 
50  RPCDetId id = (*r)->id();
51  const edm::PSimHitContainer & rollSimHits = hitMap[id];
52 
53 
54  if(!((*r)->isIRPC())){
55  theRPCSim->simulate(*r, rollSimHits, engine);
56 
57  if(theNoise){
58  theRPCSim->simulateNoise(*r, engine);
59  }
60  }
61 
62  theRPCSim->fillDigis((*r)->id(),rpcDigis);
63  rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
64  }
65 }
66 
67 const RPCRoll * RPCDigitizer::findDet(int detId) const {
68  assert(theGeometry != 0);
69  const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId));
70  return dynamic_cast<const RPCRoll *>(detUnit);
71 }
72 
T getParameter(std::string const &) const
const RPCDigiSimLinks & rpcDigiSimLinks() const
Definition: RPCSim.h:53
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:67
RPCSim * theRPCSim
Definition: RPCDigitizer.h:58
RPCDigitizer(const edm::ParameterSet &config)
Definition: RPCDigitizer.cc:12
RPCSimSetUp * theSimSetUp
Definition: RPCDigitizer.h:59
Definition: config.py:1
const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:48
iterator end() const
virtual void simulateNoise(const RPCRoll *roll, CLHEP::HepRandomEngine *)=0
void setRPCSimSetUp(RPCSimSetUp *setup)
Definition: RPCSim.h:48
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
Definition: RPCDigitizer.cc:24
virtual void fillDigis(int rollDetId, RPCDigiCollection &digis)
Definition: RPCSim.cc:11
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:67
std::string theName
Definition: RPCDigitizer.h:60
std::vector< PSimHit > PSimHitContainer
iterator begin() const
virtual void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *)=0
T get(const Candidate &c)
Definition: component.h:55