CMS 3D CMS Logo

RPCandIRPCDigiProducer.cc
Go to the documentation of this file.
21 #include <sstream>
22 #include <string>
23 
24 #include <map>
25 #include <vector>
26 
29 
30 //Random Number
34 #include "CLHEP/Random/RandFlat.h"
35 
36 namespace CLHEP {
37  class HepRandomEngine;
38 }
39 
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 
58  theRPCDigitizer = new RPCDigitizer(ps);
60  crossingFrameToken = consumes<CrossingFrame<PSimHit>>(edm::InputTag(mix_, collection_for_XF));
61 }
62 
64  delete theRPCDigitizer;
65  delete theIRPCDigitizer;
66  delete theRPCSimSetUpRPC;
67  delete theRPCSimSetUpIRPC;
68 }
69 
72  eventSetup.get<MuonGeometryRecord>().get(hGeom);
73  const RPCGeometry* pGeom = &*hGeom;
74  _pGeom = &*hGeom;
76  eventSetup.get<RPCStripNoisesRcd>().get(noiseRcd);
77 
79  eventSetup.get<RPCClusterSizeRcd>().get(clsRcd);
80 
81  //setup the two digi models
83  theRPCSimSetUpRPC->setRPCSetUp(noiseRcd->getVNoise(), clsRcd->getCls());
85  theRPCSimSetUpIRPC->setRPCSetUp(noiseRcd->getVNoise(), clsRcd->getCls());
86 
87  //setup the two digitizers
92 }
93 
96  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
97 
98  LogDebug("RPCandIRPCDigiProducer") << "[RPCandIRPCDigiProducer::produce] got the CLHEP::HepRandomEngine engine from "
99  "the edm::Event.streamID() and edm::Service<edm::RandomNumberGenerator>";
100  LogDebug("RPCandIRPCDigiProducer") << "[RPCandIRPCDigiProducer::produce] test the CLHEP::HepRandomEngine by firing "
101  "once RandFlat ---- this must be the first time in SimMuon/RPCDigitizer";
102  LogDebug("RPCandIRPCDigiProducer") << "[RPCandIRPCDigiProducer::produce] to activate the test go in "
103  "RPCandIRPCDigiProducer.cc and uncomment the line below";
104 
106  e.getByToken(crossingFrameToken, cf);
107 
108  std::unique_ptr<MixCollection<PSimHit>> hits(new MixCollection<PSimHit>(cf.product()));
109 
110  // Create empty output
111  std::unique_ptr<RPCDigiCollection> pDigis(new RPCDigiCollection());
112  std::unique_ptr<RPCDigitizerSimLinks> RPCDigitSimLink(new RPCDigitizerSimLinks());
113 
114  theRPCDigitizer->doAction(*hits, *pDigis, *RPCDigitSimLink, engine); //make "bakelite RPC" digitizer do the action
115  theIRPCDigitizer->doAction(*hits, *pDigis, *RPCDigitSimLink, engine); //make "IRPC" digitizer do the action
116 
117  e.put(std::move(pDigis));
118  //store the SimDigiLinks in the event
119  e.put(std::move(RPCDigitSimLink), "RPCDigiSimLink");
120 }
RPCStripNoises::getVNoise
std::vector< NoiseItem > const & getVNoise() const
Definition: RPCStripNoises.h:24
RPCDigitizer::doAction
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
Definition: RPCDigitizer.cc:19
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
Handle.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EDProducer.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
RPCandIRPCDigiProducer::theIRPCDigitizer
IRPCDigitizer * theIRPCDigitizer
Definition: RPCandIRPCDigiProducer.h:39
ESHandle.h
RPCClusterSizeRcd
Definition: RPCClusterSizeRcd.h:24
edm::Run
Definition: Run.h:45
RPCStripNoisesRcd
Definition: RPCStripNoisesRcd.h:24
RandomNumberGenerator.h
CrossingFrame.h
PSimHitContainer.h
RPCClusterSize::getCls
std::vector< ClusterSizeItem > const & getCls() const
Definition: RPCClusterSize.h:23
RPCDigitizer::setRPCSimSetUp
void setRPCSimSetUp(RPCSimSetUp *simsetup)
Definition: RPCDigitizer.h:48
RPCDigitizer
Definition: RPCDigitizer.h:33
RPCandIRPCDigiProducer::RPCDigitizerSimLinks
RPCDigitizer::RPCDigiSimLinks RPCDigitizerSimLinks
Definition: RPCandIRPCDigiProducer.h:25
RPCSimSetUp::setGeometry
void setGeometry(const RPCGeometry *geom)
sets geometry
Definition: RPCSimSetUp.h:47
edm::Handle
Definition: AssociativeIterator.h:50
IRPCDigitizer.h
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
IRPCDigitizer::setRPCSimSetUp
void setRPCSimSetUp(RPCSimSetUp *simsetup)
Definition: IRPCDigitizer.h:48
MixCollection.h
MixCollection
Definition: MixCollection.h:11
Service.h
RPCandIRPCDigiProducer::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: RPCandIRPCDigiProducer.cc:94
RPCandIRPCDigiProducer::~RPCandIRPCDigiProducer
~RPCandIRPCDigiProducer() override
Definition: RPCandIRPCDigiProducer.cc:63
IRPCDigitizer::setGeometry
void setGeometry(const RPCGeometry *geom)
sets geometry
Definition: IRPCDigitizer.h:46
RPCandIRPCDigiProducer::mix_
std::string mix_
Definition: RPCandIRPCDigiProducer.h:45
IdealMagneticFieldRecord.h
edm::ESHandle< RPCGeometry >
RPCandIRPCDigiProducer::crossingFrameToken
edm::EDGetTokenT< CrossingFrame< PSimHit > > crossingFrameToken
Definition: RPCandIRPCDigiProducer.h:49
RPCandIRPCDigiProducer::RPCandIRPCDigiProducer
RPCandIRPCDigiProducer(const edm::ParameterSet &ps)
Definition: RPCandIRPCDigiProducer.cc:40
RPCandIRPCDigiProducer::theRPCSimSetUpRPC
RPCSimSetUp * theRPCSimSetUpRPC
Definition: RPCandIRPCDigiProducer.h:40
CLHEP
Definition: CocoaGlobals.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId.h
RPCandIRPCDigiProducer::_pGeom
const RPCGeometry * _pGeom
Definition: RPCandIRPCDigiProducer.h:50
IRPCDigitizer
Definition: IRPCDigitizer.h:33
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
RPCDigiCollection
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
Definition: RPCDigiCollection.h:13
edm::Service< edm::RandomNumberGenerator >
edm::EventSetup
Definition: EventSetup.h:57
RPCandIRPCDigiProducer.h
get
#define get
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
RPCDigitizer.h
Exception
Definition: hltDiff.cc:246
RPCDigitizer::setGeometry
void setGeometry(const RPCGeometry *geom)
sets geometry
Definition: RPCDigitizer.h:46
EventSetup.h
RPCandIRPCDigiProducer::theRPCSimSetUpIRPC
RPCSimSetUp * theRPCSimSetUpIRPC
Definition: RPCandIRPCDigiProducer.h:41
Exception.h
RPCSimSetUp.h
RPCandIRPCDigiProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: RPCandIRPCDigiProducer.cc:70
RPCGeometry
Definition: RPCGeometry.h:20
RPCSimSetUp
Definition: RPCSimSetUp.h:28
ParameterSet.h
RPCSimSetUp::setRPCSetUp
void setRPCSetUp(const std::vector< RPCStripNoises::NoiseItem > &vnoise, const std::vector< float > &vcls)
Definition: RPCSimSetUp.cc:44
MuonGeometryRecord.h
IRPCDigitizer::doAction
void doAction(MixCollection< PSimHit > &simHits, RPCDigiCollection &rpcDigis, RPCDigiSimLinks &rpcDigiSimLink, CLHEP::HepRandomEngine *)
Definition: IRPCDigitizer.cc:20
RPCandIRPCDigiProducer::collection_for_XF
std::string collection_for_XF
Definition: RPCandIRPCDigiProducer.h:46
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
RPCSynchronizer.h
RPCandIRPCDigiProducer::theRPCDigitizer
RPCDigitizer * theRPCDigitizer
Definition: RPCandIRPCDigiProducer.h:38
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37