CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCDigitizer.cc
Go to the documentation of this file.
9 
10 // default constructor allocates default wire and strip digitizers
11 
12 RPCDigitizer::RPCDigitizer(const edm::ParameterSet& config, CLHEP::HepRandomEngine& eng) {
13  theName = config.getParameter<std::string>("digiModel");
14  theRPCSim = RPCSimFactory::get()->create(theName,config.getParameter<edm::ParameterSet>("digiModelConfig"));
15  theRPCSim->setRandomEngine(eng);
16 }
17 
19  if( theRPCSim )
20  delete theRPCSim;
21  theRPCSim = 0;
22 }
23 
25  RPCDigiCollection & rpcDigis,
26  RPCDigiSimLinks & rpcDigiSimLink)
27 {
28 
30 
31  // arrange the hits by roll
32  std::map<int, edm::PSimHitContainer> hitMap;
33  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
34  hitItr != simHits.end(); ++hitItr)
35  {
36  hitMap[hitItr->detUnitId()].push_back(*hitItr);
37  }
38 
39  if ( ! theGeometry) {
40  throw cms::Exception("Configuration")
41  << "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.";
42  }
43 
44 
45  std::vector<RPCRoll*> rpcRolls = theGeometry->rolls() ;
46  for(std::vector<RPCRoll*>::iterator r = rpcRolls.begin();
47  r != rpcRolls.end(); r++){
48 
49  const edm::PSimHitContainer & rollSimHits = hitMap[(*r)->id()];
50 
51 // LogDebug("RPCDigitizer") << "RPCDigitizer: found " << rollSimHits.size()
52 // <<" hit(s) in the rpc roll";
53 
54  theRPCSim->simulate(*r,rollSimHits);
56  theRPCSim->fillDigis((*r)->id(),rpcDigis);
57  rpcDigiSimLink.insert(theRPCSim->rpcDigiSimLinks());
58  }
59 }
60 
61 const RPCRoll * RPCDigitizer::findDet(int detId) const {
62  assert(theGeometry != 0);
63  const GeomDetUnit* detUnit = theGeometry->idToDetUnit(RPCDetId(detId));
64  return dynamic_cast<const RPCRoll *>(detUnit);
65 }
66 
T getParameter(std::string const &) const
const RPCDigiSimLinks & rpcDigiSimLinks() const
Definition: RPCSim.h:50
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:48
RPCSim * theRPCSim
Definition: RPCDigitizer.h:55
RPCSimSetUp * theSimSetUp
Definition: RPCDigitizer.h:56
iterator end()
RPCDigitizer(const edm::ParameterSet &config, CLHEP::HepRandomEngine &)
Definition: RPCDigitizer.cc:12
void setRPCSimSetUp(RPCSimSetUp *setup)
Definition: RPCSim.h:45
virtual void fillDigis(int rollDetId, RPCDigiCollection &digis)
Definition: RPCSim.cc:10
iterator begin()
const RPCGeometry * theGeometry
Definition: RPCDigitizer.h:54
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink)
Definition: RPCDigitizer.cc:24
virtual void simulateNoise(const RPCRoll *roll)=0
tuple simHits
Definition: trackerHits.py:16
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:234
const RPCRoll * findDet(int detId) const
finds the rpc det unit in the geometry associated with this det ID
Definition: RPCDigitizer.cc:61
std::string theName
Definition: RPCDigitizer.h:57
std::vector< PSimHit > PSimHitContainer
virtual void simulate(const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)=0
T get(const Candidate &c)
Definition: component.h:55
const std::vector< RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:67