CMS 3D CMS Logo

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

#include <GEMDigiProducer.h>

Inheritance diagram for GEMDigiProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::DetSetVector< GEMDigiSimLinkGEMDigiSimLinks
 
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 Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 GEMDigiProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~GEMDigiProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
std::string digiModelString_
 
GEMDigiModelgemDigiModel_
 

Additional Inherited Members

- 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 20 of file GEMDigiProducer.h.

Member Typedef Documentation

Definition at line 26 of file GEMDigiProducer.h.

Definition at line 24 of file GEMDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file GEMDigiProducer.cc.

References cf_token, digiModelString_, Exception, gemDigiModel_, reco::get(), edm::ParameterSet::getParameter(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

30  : digiModelString_(ps.getParameter<std::string>("digiModelString"))
31 {
32  produces<GEMDigiCollection>();
33  produces<StripDigiSimLinks>("GEM");
34  produces<GEMDigiSimLinks>("GEM");
35 
37  if (!rng.isAvailable()){
38  throw cms::Exception("Configuration")
39  << "GEMDigiProducer::GEMDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
40  << "Add the service in the configuration file or remove the modules that require it.";
41  }
42  gemDigiModel_ = GEMDigiModelFactory::get()->create("GEM" + digiModelString_ + "Model", ps);
43  LogDebug("GEMDigiProducer") << "Using GEM" + digiModelString_ + "Model";
44 
45  std::string mix_(ps.getParameter<std::string>("mixLabel"));
46  std::string collection_(ps.getParameter<std::string>("inputCollection"));
47 
48  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
49 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::string digiModelString_
GEMDigiModel * gemDigiModel_
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
T get(const Candidate &c)
Definition: component.h:55
GEMDigiProducer::~GEMDigiProducer ( )
virtual

Definition at line 52 of file GEMDigiProducer.cc.

References gemDigiModel_.

53 {
54  delete gemDigiModel_;
55 }
GEMDigiModel * gemDigiModel_

Member Function Documentation

void GEMDigiProducer::beginRun ( const edm::Run ,
const edm::EventSetup eventSetup 
)
overridevirtual

Definition at line 58 of file GEMDigiProducer.cc.

References gemDigiModel_, edm::EventSetup::get(), GEMDigiModel::setGeometry(), and GEMDigiModel::setup().

59 {
61  eventSetup.get<MuonGeometryRecord>().get(hGeom);
62  gemDigiModel_->setGeometry(&*hGeom);
64 }
void setGeometry(const GEMGeometry *geom)
Definition: GEMDigiModel.h:41
GEMDigiModel * gemDigiModel_
virtual void setup()=0
const T & get() const
Definition: EventSetup.h:55
void GEMDigiProducer::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overridevirtual

Definition at line 67 of file GEMDigiProducer.cc.

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

68 {
70  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
71 
73  e.getByToken(cf_token, cf);
74 
75  std::unique_ptr<MixCollection<PSimHit> > hits(new MixCollection<PSimHit>(cf.product()));
76 
77  // Create empty output
78  std::unique_ptr<GEMDigiCollection> digis(new GEMDigiCollection());
79  std::unique_ptr<StripDigiSimLinks> stripDigiSimLinks(new StripDigiSimLinks() );
80  std::unique_ptr<GEMDigiSimLinks> gemDigiSimLinks(new GEMDigiSimLinks() );
81 
82  // arrange the hits by eta partition
83  std::map<uint32_t, edm::PSimHitContainer> hitMap;
84  for (const auto& hit: *hits){
85  hitMap[hit.detUnitId()].emplace_back(hit);
86  }
87 
88  // simulate signal and noise for each eta partition
89  const auto & etaPartitions(gemDigiModel_->getGeometry()->etaPartitions());
90 
91  for (const auto& roll: etaPartitions){
92  const GEMDetId detId(roll->id());
93  const uint32_t rawId(detId.rawId());
94  const auto & simHits(hitMap[rawId]);
95 
96  LogDebug("GEMDigiProducer")
97  << "GEMDigiProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
98 
99  gemDigiModel_->simulateSignal(roll, simHits, engine);
100  gemDigiModel_->simulateNoise(roll, engine);
101  gemDigiModel_->fillDigis(rawId, *digis);
102  (*stripDigiSimLinks).insert(gemDigiModel_->stripDigiSimLinks());
103  (*gemDigiSimLinks).insert(gemDigiModel_->gemDigiSimLinks());
104  }
105 
106  // store them in the event
107  e.put(std::move(digis));
108  e.put(std::move(stripDigiSimLinks),"GEM");
109  e.put(std::move(gemDigiSimLinks),"GEM");
110 }
const GEMDigiSimLinks & gemDigiSimLinks() const
Definition: GEMDigiModel.h:57
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
const GEMGeometry * getGeometry()
Definition: GEMDigiModel.h:43
virtual void simulateNoise(const GEMEtaPartition *, CLHEP::HepRandomEngine *engine)=0
edm::DetSetVector< StripDigiSimLink > StripDigiSimLinks
GEMDigiModel * gemDigiModel_
MuonDigiCollection< GEMDetId, GEMDigi > GEMDigiCollection
virtual void simulateSignal(const GEMEtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *engine)=0
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const StripDigiSimLinks & stripDigiSimLinks() const
Definition: GEMDigiModel.h:56
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:63
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
T const * product() const
Definition: Handle.h:81
StreamID streamID() const
Definition: Event.h:81
edm::DetSetVector< GEMDigiSimLink > GEMDigiSimLinks
void fillDigis(int rollDetId, GEMDigiCollection &)
Definition: GEMDigiModel.cc:5
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 39 of file GEMDigiProducer.h.

Referenced by GEMDigiProducer(), and produce().

std::string GEMDigiProducer::digiModelString_
private

Definition at line 41 of file GEMDigiProducer.h.

Referenced by GEMDigiProducer().

GEMDigiModel* GEMDigiProducer::gemDigiModel_
private

Definition at line 42 of file GEMDigiProducer.h.

Referenced by beginRun(), GEMDigiProducer(), produce(), and ~GEMDigiProducer().