CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ME0DigiPreRecoProducer Class Reference
Inheritance diagram for ME0DigiPreRecoProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 ME0DigiPreRecoProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ME0DigiPreRecoProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
std::string digiPreRecoModelString_
 
std::unique_ptr< ME0DigiPreRecoModelme0DigiPreRecoModel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 36 of file ME0DigiPreRecoProducer.cc.

Constructor & Destructor Documentation

ME0DigiPreRecoProducer::ME0DigiPreRecoProducer ( const edm::ParameterSet ps)
explicit

Definition at line 54 of file ME0DigiPreRecoProducer.cc.

References cf_token, digiPreRecoModelString_, Exception, timingPdfMaker::get, HLT_2018_cff::InputTag, LogDebug, AlCaHLTBitMon_QueryRunRegistry::string, and ~ME0DigiPreRecoProducer().

55  : digiPreRecoModelString_(ps.getParameter<std::string>("digiPreRecoModelString")),
57  produces<ME0DigiPreRecoCollection>();
58 
60  if (!rng.isAvailable()) {
61  throw cms::Exception("Configuration")
62  << "ME0DigiPreRecoProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in "
63  "configuration file.\n"
64  << "Add the service in the configuration file or remove the modules that require it.";
65  }
66  LogDebug("ME0DigiPreRecoProducer") << "Using ME0" + digiPreRecoModelString_ + "Model";
67 
68  std::string mix_(ps.getParameter<std::string>("mixLabel"));
69  std::string collection_(ps.getParameter<std::string>("inputCollection"));
70 
71  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
72 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
ME0DigiPreRecoProducer::~ME0DigiPreRecoProducer ( )
overridedefault

Referenced by ME0DigiPreRecoProducer().

Member Function Documentation

void ME0DigiPreRecoProducer::beginRun ( const edm::Run ,
const edm::EventSetup eventSetup 
)
override

Definition at line 76 of file ME0DigiPreRecoProducer.cc.

References edm::EventSetup::get(), and me0DigiPreRecoModel_.

76  {
77  // set geometry
79  eventSetup.get<MuonGeometryRecord>().get(hGeom);
80  me0DigiPreRecoModel_->setGeometry(&*hGeom);
81  me0DigiPreRecoModel_->setup();
82 }
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
T get() const
Definition: EventSetup.h:73
void ME0DigiPreRecoProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 84 of file ME0DigiPreRecoProducer.cc.

References cf_token, DEFINE_FWK_MODULE, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), hfClusterShapes_cfi::hits, LogDebug, me0DigiPreRecoModel_, eostools::move(), edm::Handle< T >::product(), edm::Event::put(), FastTrackerRecHitCombiner_cfi::simHits, and edm::Event::streamID().

84  {
86  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
87 
89  e.getByToken(cf_token, cf);
90 
92 
93  // Create empty output
94  auto digis = std::make_unique<ME0DigiPreRecoCollection>();
95 
96  // arrange the hits by eta partition
97  std::map<uint32_t, edm::PSimHitContainer> hitMap;
98  for (const auto& hit : hits) {
99  hitMap[hit.detUnitId()].push_back(hit);
100  }
101 
102  // simulate signal and noise for each eta partition
103  const auto& etaPartitions(me0DigiPreRecoModel_->getGeometry()->etaPartitions());
104 
105  for (const auto& roll : etaPartitions) {
106  const ME0DetId detId(roll->id());
107  const uint32_t rawId(detId.rawId());
108  const auto& simHits(hitMap[rawId]);
109 
110  LogDebug("ME0DigiPreRecoProducer") << "ME0DigiPreRecoProducer: found " << simHits.size()
111  << " hit(s) in eta partition" << rawId;
112 
113  me0DigiPreRecoModel_->simulateSignal(roll, simHits, engine);
114  me0DigiPreRecoModel_->simulateNoise(roll, engine);
115  me0DigiPreRecoModel_->fillDigis(rawId, *digis);
116  }
117 
118  // store them in the event
119  e.put(std::move(digis));
120 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
T const * product() const
Definition: Handle.h:69
StreamID streamID() const
Definition: Event.h:96
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<CrossingFrame<PSimHit> > ME0DigiPreRecoProducer::cf_token
private

Definition at line 48 of file ME0DigiPreRecoProducer.cc.

Referenced by ME0DigiPreRecoProducer(), and produce().

std::string ME0DigiPreRecoProducer::digiPreRecoModelString_
private

Definition at line 50 of file ME0DigiPreRecoProducer.cc.

Referenced by ME0DigiPreRecoProducer().

std::unique_ptr<ME0DigiPreRecoModel> ME0DigiPreRecoProducer::me0DigiPreRecoModel_
private

Definition at line 51 of file ME0DigiPreRecoProducer.cc.

Referenced by beginRun(), and produce().