CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalTriggerDigiProducer Class Reference
Inheritance diagram for HGCalTriggerDigiProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 HGCalTriggerDigiProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HGCalTriggerDigiProducer ()
 
- 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
 
 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 & itemsToGetFromEvent () 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

std::unique_ptr< HGCalTriggerBackendProcessorbackEndProcessor_
 
std::unique_ptr< HGCalTriggerFECodecBasecodec_
 
edm::EDGetToken inputbh_
 
edm::EDGetToken inputee_
 
edm::EDGetToken inputfh_
 
edm::ESHandle< HGCalTriggerGeometryBasetriggerGeometry_
 

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
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 19 of file HGCalTriggerDigiProducer.cc.

Constructor & Destructor Documentation

HGCalTriggerDigiProducer::HGCalTriggerDigiProducer ( const edm::ParameterSet conf)

Definition at line 40 of file HGCalTriggerDigiProducer.cc.

References backEndProcessor_, codec_, reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

40  :
41  inputee_(consumes<HGCEEDigiCollection>(conf.getParameter<edm::InputTag>("eeDigis"))),
42  inputfh_(consumes<HGCHEDigiCollection>(conf.getParameter<edm::InputTag>("fhDigis"))),
43  //inputbh_(consumes<HGCHEDigiCollection>(conf.getParameter<edm::InputTag>("bhDigis"))),
45 {
46  //setup FE codec
47  const edm::ParameterSet& feCodecConfig = conf.getParameterSet("FECodec");
48  const std::string& feCodecName = feCodecConfig.getParameter<std::string>("CodecName");
49  HGCalTriggerFECodecBase* codec = HGCalTriggerFECodecFactory::get()->create(feCodecName,feCodecConfig);
50  codec_.reset(codec);
51  codec_->unSetDataPayload();
52 
53  produces<l1t::HGCFETriggerDigiCollection>();
54  // register backend processor products
55  backEndProcessor_->setProduces(*this);
56 }
T getParameter(std::string const &) const
std::unique_ptr< HGCalTriggerFECodecBase > codec_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
ParameterSet const & getParameterSet(std::string const &) const
T get(const Candidate &c)
Definition: component.h:55
HGCalTriggerDigiProducer::~HGCalTriggerDigiProducer ( )
inline

Definition at line 22 of file HGCalTriggerDigiProducer.cc.

References beginRun(), and produce().

22 { }

Member Function Documentation

void HGCalTriggerDigiProducer::beginRun ( const edm::Run ,
const edm::EventSetup es 
)
virtual

Definition at line 58 of file HGCalTriggerDigiProducer.cc.

References backEndProcessor_, codec_, edm::EventSetup::get(), edm::ESHandle< T >::product(), and triggerGeometry_.

Referenced by ~HGCalTriggerDigiProducer().

59  {
61  codec_->setGeometry(triggerGeometry_.product());
63 
64 }
std::unique_ptr< HGCalTriggerFECodecBase > codec_
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void HGCalTriggerDigiProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Definition at line 66 of file HGCalTriggerDigiProducer.cc.

References backEndProcessor_, codec_, edm::Event::getByToken(), HGCalTriggerGeometryBase::getModuleFromCell(), inputee_, inputfh_, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), l1t::HGCFETriggerDigi::setDetId(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerGeometry_.

Referenced by ~HGCalTriggerDigiProducer().

66  {
67  std::unique_ptr<l1t::HGCFETriggerDigiCollection>
68  fe_output( new l1t::HGCFETriggerDigiCollection );
69 
71  edm::Handle<HGCHEDigiCollection> fh_digis_h, bh_digis_h;
72 
73  e.getByToken(inputee_,ee_digis_h);
74  e.getByToken(inputfh_,fh_digis_h);
75  //e.getByToken(inputbh_,bh_digis_h);
76 
77  const HGCEEDigiCollection& ee_digis = *ee_digis_h;
78  const HGCHEDigiCollection& fh_digis = *fh_digis_h;
79  //const HGCHEDigiCollection& bh_digis = *bh_digis_h;
80 
81  // First find modules containing hits and prepare list of hits for each module
82  std::unordered_map<uint32_t, HGCEEDigiCollection> hit_modules_ee;
83  for(const auto& eedata : ee_digis) {
84  uint32_t module = triggerGeometry_->getModuleFromCell(eedata.id());
85  auto itr_insert = hit_modules_ee.emplace(module,HGCEEDigiCollection());
86  itr_insert.first->second.push_back(eedata);
87  }
88  std::unordered_map<uint32_t,HGCHEDigiCollection> hit_modules_fh;
89  for(const auto& fhdata : fh_digis) {
90  uint32_t module = triggerGeometry_->getModuleFromCell(fhdata.id());
91  auto itr_insert = hit_modules_fh.emplace(module, HGCHEDigiCollection());
92  itr_insert.first->second.push_back(fhdata);
93  }
94  // loop on modules containing hits and call front-end processing
95  // we produce one output trigger digi per module in the FE
96  fe_output->reserve(hit_modules_ee.size() + hit_modules_fh.size());
97  std::stringstream output;
98  for( const auto& module_hits : hit_modules_ee ) {
99  fe_output->push_back(l1t::HGCFETriggerDigi());
100  l1t::HGCFETriggerDigi& digi = fe_output->back();
101  codec_->setDataPayload(module_hits.second,HGCHEDigiCollection(),HGCHEDigiCollection());
102  codec_->encode(digi);
103  digi.setDetId( DetId(module_hits.first) );
104  codec_->print(digi,output);
105  edm::LogInfo("HGCalTriggerDigiProducer")
106  << output.str();
107  codec_->unSetDataPayload();
108  output.str(std::string());
109  output.clear();
110  } //end loop on EE modules
111  for( const auto& module_hits : hit_modules_fh ) {
112  fe_output->push_back(l1t::HGCFETriggerDigi());
113  l1t::HGCFETriggerDigi& digi = fe_output->back();
114  codec_->setDataPayload(HGCEEDigiCollection(),module_hits.second,HGCHEDigiCollection());
115  codec_->encode(digi);
116  digi.setDetId( DetId(module_hits.first) );
117  codec_->print(digi,output);
118  edm::LogInfo("HGCalTriggerDigiProducer")
119  << output.str();
120  codec_->unSetDataPayload();
121  output.str(std::string());
122  output.clear();
123  } //end loop on FH modules
124 
125 
126  // get the orphan handle and fe digi collection
127  auto fe_digis_handle = e.put(std::move(fe_output));
128  auto fe_digis_coll = *fe_digis_handle;
129 
130  //now we run the emulation of the back-end processor
131  backEndProcessor_->reset();
132  backEndProcessor_->run(fe_digis_coll,es,e);
133  backEndProcessor_->putInEvent(e);
134 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::SortedCollection< HGCEEDataFrame > HGCEEDigiCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::unique_ptr< HGCalTriggerFECodecBase > codec_
void setDetId(const IDTYPE &id)
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
virtual unsigned getModuleFromCell(const unsigned cell_det_id) const =0
Definition: DetId.h:18
Definition: vlib.h:208
edm::SortedCollection< HGCHEDataFrame > HGCHEDigiCollection
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::unique_ptr<HGCalTriggerBackendProcessor> HGCalTriggerDigiProducer::backEndProcessor_
private

Definition at line 34 of file HGCalTriggerDigiProducer.cc.

Referenced by beginRun(), HGCalTriggerDigiProducer(), and produce().

std::unique_ptr<HGCalTriggerFECodecBase> HGCalTriggerDigiProducer::codec_
private

Definition at line 33 of file HGCalTriggerDigiProducer.cc.

Referenced by beginRun(), HGCalTriggerDigiProducer(), and produce().

edm::EDGetToken HGCalTriggerDigiProducer::inputbh_
private

Definition at line 30 of file HGCalTriggerDigiProducer.cc.

edm::EDGetToken HGCalTriggerDigiProducer::inputee_
private

Definition at line 30 of file HGCalTriggerDigiProducer.cc.

Referenced by produce().

edm::EDGetToken HGCalTriggerDigiProducer::inputfh_
private

Definition at line 30 of file HGCalTriggerDigiProducer.cc.

Referenced by produce().

edm::ESHandle<HGCalTriggerGeometryBase> HGCalTriggerDigiProducer::triggerGeometry_
private

Definition at line 31 of file HGCalTriggerDigiProducer.cc.

Referenced by beginRun(), and produce().