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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
std::string digiPreRecoModelString_
 
edm::ESGetToken< ME0Geometry, MuonGeometryRecordgeom_token_
 
std::unique_ptr< ME0DigiPreRecoModelme0DigiPreRecoModel_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 37 of file ME0DigiPreRecoProducer.cc.

Constructor & Destructor Documentation

◆ ME0DigiPreRecoProducer()

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

Definition at line 56 of file ME0DigiPreRecoProducer.cc.

References digiPreRecoModelString_, and get.

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

◆ ~ME0DigiPreRecoProducer()

ME0DigiPreRecoProducer::~ME0DigiPreRecoProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Definition at line 79 of file ME0DigiPreRecoProducer.cc.

References options_cfi::eventSetup, geom_token_, and me0DigiPreRecoModel_.

79  {
80  // set geometry
82  me0DigiPreRecoModel_->setGeometry(&*hGeom);
83  me0DigiPreRecoModel_->setup();
84 }
std::unique_ptr< ME0DigiPreRecoModel > me0DigiPreRecoModel_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_

◆ produce()

void ME0DigiPreRecoProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 86 of file ME0DigiPreRecoProducer.cc.

References cf_token, hcalRecHitTable_cff::detId, MillePedeFileConverter_cfg::e, edm::RandomNumberGenerator::getEngine(), hfClusterShapes_cfi::hits, LogDebug, me0DigiPreRecoModel_, eostools::move(), edm::Handle< T >::product(), nano_mu_digi_cff::rawId, nano_mu_digi_cff::roll, and FastTrackerRecHitCombiner_cfi::simHits.

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

Member Data Documentation

◆ cf_token

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

Definition at line 49 of file ME0DigiPreRecoProducer.cc.

Referenced by produce().

◆ digiPreRecoModelString_

std::string ME0DigiPreRecoProducer::digiPreRecoModelString_
private

Definition at line 52 of file ME0DigiPreRecoProducer.cc.

Referenced by ME0DigiPreRecoProducer().

◆ geom_token_

edm::ESGetToken<ME0Geometry, MuonGeometryRecord> ME0DigiPreRecoProducer::geom_token_
private

Definition at line 50 of file ME0DigiPreRecoProducer.cc.

Referenced by beginRun().

◆ me0DigiPreRecoModel_

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

Definition at line 53 of file ME0DigiPreRecoProducer.cc.

Referenced by beginRun(), and produce().