CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCDigiProducer.cc
Go to the documentation of this file.
22 #include <sstream>
23 #include <string>
24 
25 #include <map>
26 #include <vector>
27 
30 
31 //Random Number
35 #include "CLHEP/Random/RandomEngine.h"
36 
37 
38 
40 
41  produces<RPCDigiCollection>();
42  produces<RPCDigitizerSimLinks>("RPCDigiSimLink");
43 
44  //Name of Collection used for create the XF
45  mix_ = ps.getParameter<std::string>("mixLabel");
46  collection_for_XF = ps.getParameter<std::string>("InputCollection");
47 
49  if ( ! rng.isAvailable()) {
50  throw cms::Exception("Configuration")
51  << "RPCDigitizer requires the RandomNumberGeneratorService\n"
52  "which is not present in the configuration file. You must add the service\n"
53  "in the configuration file or remove the modules that require it.";
54  }
55 
56 
57  CLHEP::HepRandomEngine& engine = rng->getEngine();
58 
59  theRPCSimSetUp = new RPCSimSetUp(ps);
60  theDigitizer = new RPCDigitizer(ps,engine);
61 
62 
63 }
64 
66  delete theDigitizer;
67  delete theRPCSimSetUp;
68 }
69 
70 void RPCDigiProducer::beginRun(const edm::Run& r, const edm::EventSetup& eventSetup){
71 
73  eventSetup.get<MuonGeometryRecord>().get( hGeom );
74  const RPCGeometry *pGeom = &*hGeom;
75 
77  eventSetup.get<RPCStripNoisesRcd>().get(noiseRcd);
78 
80  eventSetup.get<RPCClusterSizeRcd>().get(clsRcd);
81 
82  theRPCSimSetUp->setRPCSetUp(noiseRcd->getVNoise(), clsRcd->getCls());
83 // theRPCSimSetUp->setRPCSetUp(noiseRcd->getVNoise(), noiseRcd->getCls());
84 
85  theDigitizer->setGeometry( pGeom );
86  theRPCSimSetUp->setGeometry( pGeom );
88 }
89 
91 
94 
95  std::auto_ptr<MixCollection<PSimHit> >
96  hits( new MixCollection<PSimHit>(cf.product()) );
97 
98  // Create empty output
99  std::auto_ptr<RPCDigiCollection> pDigis(new RPCDigiCollection());
100  std::auto_ptr<RPCDigitizerSimLinks> RPCDigitSimLink(new RPCDigitizerSimLinks() );
101 
102  // run the digitizer
103  theDigitizer->doAction(*hits, *pDigis, *RPCDigitSimLink);
104 
105  // store them in the event
106  e.put(pDigis);
107  e.put(RPCDigitSimLink,"RPCDigiSimLink");
108 }
109 
T getParameter(std::string const &) const
std::string mix_
std::string collection_for_XF
RPCDigiProducer(const edm::ParameterSet &ps)
void setGeometry(const RPCGeometry *geom)
sets geometry
Definition: RPCDigitizer.h:44
void setGeometry(const RPCGeometry *geom)
sets geometry
Definition: RPCSimSetUp.h:46
RPCSimSetUp * theRPCSimSetUp
void setRPCSimSetUp(RPCSimSetUp *simsetup)
Definition: RPCDigitizer.h:46
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
virtual ~RPCDigiProducer()
const T & get() const
Definition: EventSetup.h:55
RPCDigitizer::RPCDigiSimLinks RPCDigitizerSimLinks
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink)
Definition: RPCDigitizer.cc:24
T const * product() const
Definition: Handle.h:81
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
RPCDigitizer * theDigitizer
void setRPCSetUp(const std::vector< RPCStripNoises::NoiseItem > &vnoise, const std::vector< float > &vcls)
Definition: RPCSimSetUp.cc:46
Definition: Run.h:41