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
 
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

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

Constructor & Destructor Documentation

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

Definition at line 41 of file HGCalTriggerDigiProducer.cc.

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

41  :
42  inputee_(consumes<HGCEEDigiCollection>(conf.getParameter<edm::InputTag>("eeDigis"))),
43  inputfh_(consumes<HGCHEDigiCollection>(conf.getParameter<edm::InputTag>("fhDigis"))),
44  inputbh_(consumes<HGCBHDigiCollection>(conf.getParameter<edm::InputTag>("bhDigis"))),
46 {
47  //setup FE codec
48  const edm::ParameterSet& feCodecConfig = conf.getParameterSet("FECodec");
49  const std::string& feCodecName = feCodecConfig.getParameter<std::string>("CodecName");
50  HGCalTriggerFECodecBase* codec = HGCalTriggerFECodecFactory::get()->create(feCodecName,feCodecConfig);
51  codec_.reset(codec);
52  codec_->unSetDataPayload();
53 
54  produces<l1t::HGCFETriggerDigiCollection>();
55  // register backend processor products
56  backEndProcessor_->setProduces(*this);
57 }
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 23 of file HGCalTriggerDigiProducer.cc.

References beginRun(), and produce().

23 { }

Member Function Documentation

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

Definition at line 59 of file HGCalTriggerDigiProducer.cc.

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

Referenced by ~HGCalTriggerDigiProducer().

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

Definition at line 67 of file HGCalTriggerDigiProducer.cc.

References backEndProcessor_, codec_, HGCalTriggerGeometryBase::disconnectedModule(), edm::Event::getByToken(), HGCalTriggerGeometryBase::getModuleFromCell(), HcalEndcap, inputbh_, inputee_, inputfh_, eostools::move(), edm::Event::put(), l1t::HGCFETriggerDigi::setDetId(), and triggerGeometry_.

Referenced by ~HGCalTriggerDigiProducer().

67  {
68  std::unique_ptr<l1t::HGCFETriggerDigiCollection>
69  fe_output( new l1t::HGCFETriggerDigiCollection );
70 
74 
75  e.getByToken(inputee_,ee_digis_h);
76  e.getByToken(inputfh_,fh_digis_h);
77  e.getByToken(inputbh_,bh_digis_h);
78 
79  const HGCEEDigiCollection& ee_digis = *ee_digis_h;
80  const HGCHEDigiCollection& fh_digis = *fh_digis_h;
81  const HGCBHDigiCollection& bh_digis = *bh_digis_h;
82 
83  // First find modules containing hits and prepare list of hits for each module
84  std::unordered_map<uint32_t, HGCEEDigiCollection> hit_modules_ee;
85  for(const auto& eedata : ee_digis) {
86  uint32_t module = triggerGeometry_->getModuleFromCell(eedata.id());
87  if(triggerGeometry_->disconnectedModule(module)) continue;
88  auto itr_insert = hit_modules_ee.emplace(module,HGCEEDigiCollection());
89  itr_insert.first->second.push_back(eedata);
90  }
91  std::unordered_map<uint32_t,HGCHEDigiCollection> hit_modules_fh;
92  for(const auto& fhdata : fh_digis) {
93  uint32_t module = triggerGeometry_->getModuleFromCell(fhdata.id());
94  if(triggerGeometry_->disconnectedModule(module)) continue;
95  auto itr_insert = hit_modules_fh.emplace(module, HGCHEDigiCollection());
96  itr_insert.first->second.push_back(fhdata);
97  }
98  std::unordered_map<uint32_t,HGCBHDigiCollection> hit_modules_bh;
99  for(const auto& bhdata : bh_digis) {
100  if(HcalDetId(bhdata.id()).subdetId()!=HcalEndcap) continue;
101  uint32_t module = triggerGeometry_->getModuleFromCell(bhdata.id());
102  if(triggerGeometry_->disconnectedModule(module)) continue;
103  auto itr_insert = hit_modules_bh.emplace(module, HGCBHDigiCollection());
104  itr_insert.first->second.push_back(bhdata);
105  }
106  // loop on modules containing hits and call front-end processing
107  // we produce one output trigger digi per module in the FE
108  fe_output->reserve(hit_modules_ee.size() + hit_modules_fh.size() + hit_modules_bh.size());
109  for( const auto& module_hits : hit_modules_ee ) {
110  fe_output->push_back(l1t::HGCFETriggerDigi());
111  l1t::HGCFETriggerDigi& digi = fe_output->back();
112  codec_->setDataPayload(module_hits.second,HGCHEDigiCollection(),HGCBHDigiCollection());
113  codec_->encode(digi);
114  digi.setDetId( DetId(module_hits.first) );
115  codec_->unSetDataPayload();
116  } //end loop on EE modules
117  for( const auto& module_hits : hit_modules_fh ) {
118  fe_output->push_back(l1t::HGCFETriggerDigi());
119  l1t::HGCFETriggerDigi& digi = fe_output->back();
120  codec_->setDataPayload(HGCEEDigiCollection(),module_hits.second,HGCBHDigiCollection());
121  codec_->encode(digi);
122  digi.setDetId( DetId(module_hits.first) );
123  codec_->unSetDataPayload();
124  } //end loop on FH modules
125  for( const auto& module_hits : hit_modules_bh ) {
126  fe_output->push_back(l1t::HGCFETriggerDigi());
127  l1t::HGCFETriggerDigi& digi = fe_output->back();
128  codec_->setDataPayload(HGCEEDigiCollection(),HGCHEDigiCollection(),module_hits.second);
129  codec_->encode(digi);
130  digi.setDetId( DetId(module_hits.first) );
131  codec_->unSetDataPayload();
132  } //end loop on BH modules
133 
134 
135  // get the orphan handle and fe digi collection
136  auto fe_digis_handle = e.put(std::move(fe_output));
137  auto fe_digis_coll = *fe_digis_handle;
138 
139  //now we run the emulation of the back-end processor
140  backEndProcessor_->reset();
141  backEndProcessor_->run(fe_digis_coll,es,e);
142  backEndProcessor_->putInEvent(e);
143 }
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:460
edm::SortedCollection< HGCBHDataFrame > HGCBHDigiCollection
std::unique_ptr< HGCalTriggerFECodecBase > codec_
void setDetId(const IDTYPE &id)
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
virtual bool disconnectedModule(const unsigned module_id) const =0
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 35 of file HGCalTriggerDigiProducer.cc.

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

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

Definition at line 34 of file HGCalTriggerDigiProducer.cc.

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

edm::EDGetToken HGCalTriggerDigiProducer::inputbh_
private

Definition at line 31 of file HGCalTriggerDigiProducer.cc.

Referenced by produce().

edm::EDGetToken HGCalTriggerDigiProducer::inputee_
private

Definition at line 31 of file HGCalTriggerDigiProducer.cc.

Referenced by produce().

edm::EDGetToken HGCalTriggerDigiProducer::inputfh_
private

Definition at line 31 of file HGCalTriggerDigiProducer.cc.

Referenced by produce().

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

Definition at line 32 of file HGCalTriggerDigiProducer.cc.

Referenced by beginRun(), and produce().