CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Attributes
ME0DigiProducer Class Reference
Inheritance diagram for ME0DigiProducer:
edm::stream::EDProducer<>

Public Types

typedef edm::DetSetVector
< ME0DigiSimLink
ME0DigiSimLinks
 
- 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
 

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 ME0DigiProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ME0DigiProducer () 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
 
edm::ESGetToken< ME0Geometry,
MuonGeometryRecord
geom_token_
 
std::unique_ptr< ME0DigiModelME0DigiModel_
 

Detailed Description

Definition at line 39 of file ME0DigiProducer.cc.

Member Typedef Documentation

Definition at line 41 of file ME0DigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 59 of file ME0DigiProducer.cc.

References get, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

60  : ME0DigiModel_{
61  ME0DigiModelFactory::get()->create("ME0" + ps.getParameter<std::string>("digiModelString") + "Model", ps)} {
62  produces<ME0DigiCollection>();
63  produces<ME0DigiSimLinks>("ME0");
64 
66  if (!rng.isAvailable()) {
67  throw cms::Exception("Configuration")
68  << "ME0DigiProducer::ME0DigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
69  << "Add the service in the configuration file or remove the modules that require it.";
70  }
71 
72  LogDebug("ME0DigiProducer") << "Using ME0" + ps.getParameter<std::string>("digiModelString") + "Model";
73 
74  std::string mix_(ps.getParameter<std::string>("mixLabel"));
75  std::string collection_(ps.getParameter<std::string>("inputCollection"));
76 
77  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
78  geom_token_ = esConsumes<ME0Geometry, MuonGeometryRecord, edm::Transition::BeginRun>();
79 }
std::unique_ptr< ME0DigiModel > ME0DigiModel_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
#define get
#define LogDebug(id)
ME0DigiProducer::~ME0DigiProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 83 of file ME0DigiProducer.cc.

References geom_token_, edm::EventSetup::getHandle(), and ME0DigiModel_.

83  {
85  ME0DigiModel_->setGeometry(&*hGeom);
86  ME0DigiModel_->setup();
87 }
std::unique_ptr< ME0DigiModel > ME0DigiModel_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void ME0DigiProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 89 of file ME0DigiProducer.cc.

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

89  {
91  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
92 
94  e.getByToken(cf_token, cf);
95 
97 
98  // Create empty output
99  auto digis = std::make_unique<ME0DigiCollection>();
100  auto me0DigiSimLinks = std::make_unique<ME0DigiSimLinks>();
101 
102  // arrange the hits by eta partition
103  std::map<uint32_t, edm::PSimHitContainer> hitMap;
104  for (const auto& hit : hits) {
105  hitMap[hit.detUnitId()].emplace_back(hit);
106  }
107 
108  // simulate signal and noise for each eta partition
109  const auto& etaPartitions(ME0DigiModel_->getGeometry()->etaPartitions());
110 
111  for (const auto& roll : etaPartitions) {
112  const ME0DetId detId(roll->id());
113  const uint32_t rawId(detId.rawId());
114  const auto& simHits(hitMap[rawId]);
115 
116  LogDebug("ME0DigiProducer") << "ME0DigiProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
117 
118  ME0DigiModel_->simulateSignal(roll, simHits, engine);
119  ME0DigiModel_->simulateNoise(roll, engine);
120  ME0DigiModel_->fillDigis(rawId, *digis);
121  (*me0DigiSimLinks).insert(ME0DigiModel_->me0DigiSimLinks());
122  }
123 
124  // store them in the event
125  e.put(std::move(digis));
126  e.put(std::move(me0DigiSimLinks), "ME0");
127 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::unique_ptr< ME0DigiModel > ME0DigiModel_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
def move
Definition: eostools.py:511
T const * product() const
Definition: Handle.h:70
tuple simHits
Definition: trackerHits.py:16
StreamID streamID() const
Definition: Event.h:98
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
#define LogDebug(id)

Member Data Documentation

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

Definition at line 53 of file ME0DigiProducer.cc.

Referenced by produce().

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

Definition at line 54 of file ME0DigiProducer.cc.

Referenced by beginRun().

std::unique_ptr<ME0DigiModel> ME0DigiProducer::ME0DigiModel_
private

Definition at line 56 of file ME0DigiProducer.cc.

Referenced by beginRun(), and produce().