CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ME0DigiPreRecoProducer Class Reference

#include <ME0DigiPreRecoProducer.h>

Inheritance diagram for ME0DigiPreRecoProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 ME0DigiPreRecoProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~ME0DigiPreRecoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< CrossingFrame< PSimHit > > 
cf_token
 
std::string digiPreRecoModelString_
 
ME0DigiPreRecoModelme0DigiPreRecoModel_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 29 of file ME0DigiPreRecoProducer.cc.

References cf_token, digiPreRecoModelString_, edm::hlt::Exception, reco::get(), edm::ParameterSet::getParameter(), HLT_25ns14e33_v1_cff::InputTag, LogDebug, me0DigiPreRecoModel_, and AlCaHLTBitMon_QueryRunRegistry::string.

30  : digiPreRecoModelString_(ps.getParameter<std::string>("digiPreRecoModelString"))
31 {
32  produces<ME0DigiPreRecoCollection>();
33 
35  if (!rng.isAvailable()){
36  throw cms::Exception("Configuration")
37  << "ME0DigiPreRecoProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
38  << "Add the service in the configuration file or remove the modules that require it.";
39  }
41  LogDebug("ME0DigiPreRecoProducer") << "Using ME0" + digiPreRecoModelString_ + "Model";
42 
43  std::string mix_(ps.getParameter<std::string>("mixLabel"));
44  std::string collection_(ps.getParameter<std::string>("inputCollection"));
45 
46  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_));
47 }
#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 ( )
virtual

Definition at line 50 of file ME0DigiPreRecoProducer.cc.

References me0DigiPreRecoModel_.

51 {
52  delete me0DigiPreRecoModel_;
53 }
ME0DigiPreRecoModel * me0DigiPreRecoModel_

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 56 of file ME0DigiPreRecoProducer.cc.

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

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

Implements edm::EDProducer.

Definition at line 66 of file ME0DigiPreRecoProducer.cc.

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

67 {
69  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
70 
72  e.getByToken(cf_token, cf);
73 
74  std::auto_ptr<MixCollection<PSimHit> > hits( new MixCollection<PSimHit>(cf.product()) );
75 
76  // Create empty output
77  std::auto_ptr<ME0DigiPreRecoCollection> digis(new ME0DigiPreRecoCollection());
78 
79  // arrange the hits by eta partition
80  std::map<uint32_t, edm::PSimHitContainer> hitMap;
81  for(auto &hit: *hits){
82  hitMap[hit.detUnitId()].push_back(hit);
83  }
84 
85  // simulate signal and noise for each eta partition
86  const auto & etaPartitions(me0DigiPreRecoModel_->getGeometry()->etaPartitions());
87 
88  for(auto &roll: etaPartitions){
89  const ME0DetId detId(roll->id());
90  const uint32_t rawId(detId.rawId());
91  const auto & simHits(hitMap[rawId]);
92 
93  LogDebug("ME0DigiPreRecoProducer")
94  << "ME0DigiPreRecoProducer: found " << simHits.size() << " hit(s) in eta partition" << rawId;
95 
97  me0DigiPreRecoModel_->simulateNoise(roll, engine);
98  me0DigiPreRecoModel_->fillDigis(rawId, *digis);
99  }
100 
101  // store them in the event
102  e.put(digis);
103 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
void fillDigis(int rollDetId, ME0DigiPreRecoCollection &)
ME0DigiPreRecoModel * me0DigiPreRecoModel_
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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:57
T const * product() const
Definition: Handle.h:81
tuple simHits
Definition: trackerHits.py:16
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
StreamID streamID() const
Definition: Event.h:72

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