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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
std::string digiPreRecoModelString_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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(), edm::ParameterSet::getParameter(), LogDebug, me0DigiPreRecoModel_, and AlCaHLTBitMon_QueryRunRegistry::string.

27  : digiPreRecoModelString_(ps.getParameter<std::string>("digiPreRecoModelString"))
28 {
29  produces<ME0DigiPreRecoCollection>();
30 
32  if (!rng.isAvailable()){
33  throw cms::Exception("Configuration")
34  << "ME0DigiPreRecoProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
35  << "Add the service in the configuration file or remove the modules that require it.";
36  }
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
ME0DigiPreRecoModel * me0DigiPreRecoModel_
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
T get(const Candidate &c)
Definition: component.h:55
ME0DigiPreRecoProducer::~ME0DigiPreRecoProducer ( )
override

Definition at line 47 of file ME0DigiPreRecoProducer.cc.

References me0DigiPreRecoModel_.

48 {
49  delete me0DigiPreRecoModel_;
50 }
ME0DigiPreRecoModel * me0DigiPreRecoModel_

Member Function Documentation

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

Definition at line 53 of file ME0DigiPreRecoProducer.cc.

References edm::EventSetup::get(), me0DigiPreRecoModel_, ME0DigiPreRecoModel::setGeometry(), and ME0DigiPreRecoModel::setup().

54 {
55  // set geometry
57  eventSetup.get<MuonGeometryRecord>().get(hGeom);
60 }
virtual void setup()=0
ME0DigiPreRecoModel * me0DigiPreRecoModel_
void setGeometry(const ME0Geometry *geom)
const T & get() const
Definition: EventSetup.h:58
void ME0DigiPreRecoProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
override

Definition at line 63 of file ME0DigiPreRecoProducer.cc.

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

64 {
66  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
67 
69  e.getByToken(cf_token, cf);
70 
71  std::unique_ptr<MixCollection<PSimHit> > hits( new MixCollection<PSimHit>(cf.product()) );
72 
73  // Create empty output
74  std::unique_ptr<ME0DigiPreRecoCollection> digis(new ME0DigiPreRecoCollection());
75 
76  // arrange the hits by eta partition
77  std::map<uint32_t, edm::PSimHitContainer> hitMap;
78  for (const auto& hit: *hits){
79  hitMap[hit.detUnitId()].push_back(hit);
80  }
81 
82  // simulate signal and noise for each eta partition
83  const auto & etaPartitions(me0DigiPreRecoModel_->getGeometry()->etaPartitions());
84 
85  for (const auto& roll: etaPartitions){
86  const ME0DetId detId(roll->id());
87  const uint32_t rawId(detId.rawId());
88  const auto & simHits(hitMap[rawId]);
89 
90  LogDebug("ME0DigiPreRecoProducer")
91  << "ME0DigiPreRecoProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
92 
94  me0DigiPreRecoModel_->simulateNoise(roll, engine);
95  me0DigiPreRecoModel_->fillDigis(rawId, *digis);
96  }
97 
98  // store them in the event
99  e.put(std::move(digis));
100 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void fillDigis(int rollDetId, ME0DigiPreRecoCollection &)
ME0DigiPreRecoModel * me0DigiPreRecoModel_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
virtual void simulateNoise(const ME0EtaPartition *, CLHEP::HepRandomEngine *engine)=0
const ME0Geometry * getGeometry()
virtual void simulateSignal(const ME0EtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *engine)=0
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:59
T const * product() const
Definition: Handle.h:81
StreamID streamID() const
Definition: Event.h:95
def move(src, dest)
Definition: eostools.py:510

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().

ME0DigiPreRecoModel* ME0DigiPreRecoProducer::me0DigiPreRecoModel_
private