CMS 3D CMS Logo

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< ME0DigiSimLinkME0DigiSimLinks
 
typedef edm::DetSetVector< StripDigiSimLinkStripDigiSimLinks
 
- 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
 

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
edm::ESGetToken< ME0Geometry, MuonGeometryRecordgeom_token_
 
std::unique_ptr< ME0DigiModelME0DigiModel_
 

Detailed Description

Definition at line 41 of file ME0DigiProducer.cc.

Member Typedef Documentation

◆ ME0DigiSimLinks

Definition at line 45 of file ME0DigiProducer.cc.

◆ StripDigiSimLinks

Definition at line 43 of file ME0DigiProducer.cc.

Constructor & Destructor Documentation

◆ ME0DigiProducer()

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

Definition at line 63 of file ME0DigiProducer.cc.

64  : ME0DigiModel_{
65  ME0DigiModelFactory::get()->create("ME0" + ps.getParameter<std::string>("digiModelString") + "Model", ps)} {
66  produces<ME0DigiCollection>();
67  produces<StripDigiSimLinks>("ME0");
68  produces<ME0DigiSimLinks>("ME0");
69 
71  if (!rng.isAvailable()) {
72  throw cms::Exception("Configuration")
73  << "ME0DigiProducer::ME0DigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
74  << "Add the service in the configuration file or remove the modules that require it.";
75  }
76 
77  LogDebug("ME0DigiProducer") << "Using ME0" + ps.getParameter<std::string>("digiModelString") + "Model";
78 
79  std::string mix_(ps.getParameter<std::string>("mixLabel"));
80  std::string collection_(ps.getParameter<std::string>("inputCollection"));
81 
82  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
83  geom_token_ = esConsumes<ME0Geometry, MuonGeometryRecord, edm::Transition::BeginRun>();
84 }

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

◆ ~ME0DigiProducer()

ME0DigiProducer::~ME0DigiProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Definition at line 88 of file ME0DigiProducer.cc.

88  {
90  ME0DigiModel_->setGeometry(&*hGeom);
91  ME0DigiModel_->setup();
92 }

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

◆ produce()

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

Definition at line 94 of file ME0DigiProducer.cc.

94  {
96  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
97 
99  e.getByToken(cf_token, cf);
100 
102 
103  // Create empty output
104  auto digis = std::make_unique<ME0DigiCollection>();
105  auto stripDigiSimLinks = std::make_unique<StripDigiSimLinks>();
106  auto me0DigiSimLinks = std::make_unique<ME0DigiSimLinks>();
107 
108  // arrange the hits by eta partition
109  std::map<uint32_t, edm::PSimHitContainer> hitMap;
110  for (const auto& hit : hits) {
111  hitMap[hit.detUnitId()].emplace_back(hit);
112  }
113 
114  // simulate signal and noise for each eta partition
115  const auto& etaPartitions(ME0DigiModel_->getGeometry()->etaPartitions());
116 
117  for (const auto& roll : etaPartitions) {
118  const ME0DetId detId(roll->id());
119  const uint32_t rawId(detId.rawId());
120  const auto& simHits(hitMap[rawId]);
121 
122  LogDebug("ME0DigiProducer") << "ME0DigiProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
123 
124  ME0DigiModel_->simulateSignal(roll, simHits, engine);
125  ME0DigiModel_->simulateNoise(roll, engine);
126  ME0DigiModel_->fillDigis(rawId, *digis);
127  (*stripDigiSimLinks).insert(ME0DigiModel_->stripDigiSimLinks());
128  (*me0DigiSimLinks).insert(ME0DigiModel_->me0DigiSimLinks());
129  }
130 
131  // store them in the event
132  e.put(std::move(digis));
133  e.put(std::move(stripDigiSimLinks), "ME0");
134  e.put(std::move(me0DigiSimLinks), "ME0");
135 }

References cf_token, MillePedeFileConverter_cfg::e, edm::RandomNumberGenerator::getEngine(), hfClusterShapes_cfi::hits, LogDebug, ME0DigiModel_, eostools::move(), edm::Handle< T >::product(), and FastTrackerRecHitCombiner_cfi::simHits.

Member Data Documentation

◆ cf_token

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

Definition at line 57 of file ME0DigiProducer.cc.

Referenced by produce().

◆ geom_token_

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

Definition at line 58 of file ME0DigiProducer.cc.

Referenced by beginRun().

◆ ME0DigiModel_

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

Definition at line 60 of file ME0DigiProducer.cc.

Referenced by beginRun(), and produce().

edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::Handle::product
T const * product() const
Definition: Handle.h:70
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ME0DigiProducer::geom_token_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_
Definition: ME0DigiProducer.cc:58
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
edm::Handle
Definition: AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
ME0DigiProducer::ME0DigiModel_
std::unique_ptr< ME0DigiModel > ME0DigiModel_
Definition: ME0DigiProducer.cc:60
MixCollection
Definition: MixCollection.h:11
edm::ESHandle< ME0Geometry >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ME0DigiProducer::cf_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
Definition: ME0DigiProducer.cc:57
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::Service< edm::RandomNumberGenerator >
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
ME0DetId
Definition: ME0DetId.h:16
get
#define get
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37