CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ME0DigiPreRecoProducer Class Reference

#include <ME0DigiPreRecoProducer.h>

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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 17 of file ME0DigiPreRecoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file ME0DigiPreRecoProducer.cc.

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

27  : digiPreRecoModelString_(ps.getParameter<std::string>("digiPreRecoModelString"))
29 {
30  produces<ME0DigiPreRecoCollection>();
31 
33  if (!rng.isAvailable()){
34  throw cms::Exception("Configuration")
35  << "ME0DigiPreRecoProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
36  << "Add the service in the configuration file or remove the modules that require it.";
37  }
38  LogDebug("ME0DigiPreRecoProducer") << "Using ME0" + digiPreRecoModelString_ + "Model";
39 
40  std::string mix_(ps.getParameter<std::string>("mixLabel"));
41  std::string collection_(ps.getParameter<std::string>("inputCollection"));
42 
43  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
44 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
T get(const Candidate &c)
Definition: component.h:55
ME0DigiPreRecoProducer::~ME0DigiPreRecoProducer ( )
overridedefault

Referenced by ME0DigiPreRecoProducer().

Member Function Documentation

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

Definition at line 49 of file ME0DigiPreRecoProducer.cc.

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

50 {
51  // set geometry
53  eventSetup.get<MuonGeometryRecord>().get(hGeom);
54  me0DigiPreRecoModel_->setGeometry(&*hGeom);
55  me0DigiPreRecoModel_->setup();
56 }
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
T get() const
Definition: EventSetup.h:71
void ME0DigiPreRecoProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 59 of file ME0DigiPreRecoProducer.cc.

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

60 {
62  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
63 
65  e.getByToken(cf_token, cf);
66 
68 
69  // Create empty output
70  auto digis = std::make_unique<ME0DigiPreRecoCollection>();
71 
72  // arrange the hits by eta partition
73  std::map<uint32_t, edm::PSimHitContainer> hitMap;
74  for (const auto& hit: hits){
75  hitMap[hit.detUnitId()].push_back(hit);
76  }
77 
78  // simulate signal and noise for each eta partition
79  const auto & etaPartitions(me0DigiPreRecoModel_->getGeometry()->etaPartitions());
80 
81  for (const auto& roll: etaPartitions){
82  const ME0DetId detId(roll->id());
83  const uint32_t rawId(detId.rawId());
84  const auto & simHits(hitMap[rawId]);
85 
86  LogDebug("ME0DigiPreRecoProducer")
87  << "ME0DigiPreRecoProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
88 
89  me0DigiPreRecoModel_->simulateSignal(roll, simHits, engine);
90  me0DigiPreRecoModel_->simulateNoise(roll, engine);
91  me0DigiPreRecoModel_->fillDigis(rawId, *digis);
92  }
93 
94  // store them in the event
95  e.put(std::move(digis));
96 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:74
StreamID streamID() const
Definition: Event.h:95
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 32 of file ME0DigiPreRecoProducer.h.

Referenced by ME0DigiPreRecoProducer(), and produce().

std::string ME0DigiPreRecoProducer::digiPreRecoModelString_
private

Definition at line 34 of file ME0DigiPreRecoProducer.h.

Referenced by ME0DigiPreRecoProducer().

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

Definition at line 35 of file ME0DigiPreRecoProducer.h.

Referenced by beginRun(), and produce().