CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EgammaHLTTimeCleanedRechitProducer Class Reference

#include <EgammaHLTTimeCleanedRechitProducer.h>

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

Public Member Functions

 EgammaHLTTimeCleanedRechitProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaHLTTimeCleanedRechitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< edm::InputTaghitLabels
 
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
 
std::vector< std::string > productLabels
 
double timeMax_
 
double timeMin_
 
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 13 of file EgammaHLTTimeCleanedRechitProducer.h.

Constructor & Destructor Documentation

EgammaHLTTimeCleanedRechitProducer::EgammaHLTTimeCleanedRechitProducer ( const edm::ParameterSet ps)

Definition at line 21 of file EgammaHLTTimeCleanedRechitProducer.cc.

References Exception, edm::ParameterSet::getParameter(), hitLabels, hitTokens, mps_fire::i, productLabels, timeMax_, and timeMin_.

21  {
22 
23  timeMax_ = ps.getParameter<double>("TimeMax");
24  timeMin_ = ps.getParameter<double>("TimeMin");
25  hitLabels = ps.getParameter<std::vector<edm::InputTag>>("ecalhitLabels");
26  productLabels = ps.getParameter<std::vector<std::string>>("productLabels");
27 
28  if (!(hitLabels.size() == 2)) throw cms::Exception("ConfigError","ecalhitLabels should contain 2 labels: one for RecHits in barrel, the other for RecHits in endcaps");
29  if (!(productLabels.size() == 2)) throw cms::Exception("ConfigError","productLabels should contain 2 labels: one for RecHits in barrel, the other for RecHits in endcaps");
30 
31 
32  for (unsigned int i=0; i<hitLabels.size(); i++) {
33  hitTokens.push_back(consumes<EcalRecHitCollection>(hitLabels[i]));
34  produces<EcalRecHitCollection> (productLabels[i]);
35  }
36 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
EgammaHLTTimeCleanedRechitProducer::~EgammaHLTTimeCleanedRechitProducer ( )

Definition at line 39 of file EgammaHLTTimeCleanedRechitProducer.cc.

40 {}

Member Function Documentation

void EgammaHLTTimeCleanedRechitProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file EgammaHLTTimeCleanedRechitProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HiRecoMuon_cff::inputTags.

42  {
44  std::vector<std::string> productTags;
45  productTags.push_back("EcalTimeCleanedRecHitsEB");
46  productTags.push_back("EcalTimeCleanedRecHitsEE");
47  desc.add<std::vector<std::string>>("productLabels", productTags);
48  std::vector<edm::InputTag> inputTags;
49  inputTags.push_back(edm::InputTag("hltEcalRecHitAll:EcalRecHitsEB"));
50  inputTags.push_back(edm::InputTag("hltEcalRecHitAll:EcalRecHitsEE"));
51  desc.add<std::vector<edm::InputTag>>("ecalhitLabels", inputTags);
52  desc.add<double>("TimeMax", 10);
53  desc.add<double>("TimeMin", -10);
54  descriptions.add(("hltEgammaHLTTimeCleanedRechitProducer"), desc);
55 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTTimeCleanedRechitProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Definition at line 57 of file EgammaHLTTimeCleanedRechitProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), edm::Event::getByToken(), hitLabels, hfClusterShapes_cfi::hits, hitTokens, mps_fire::i, eostools::move(), edm::Handle< T >::product(), productLabels, edm::Event::put(), timeMax_, and timeMin_.

57  {
58 
60 
61 
62  for (unsigned int i=0; i<hitLabels.size(); i++) {
63  auto hits = std::make_unique<EcalRecHitCollection>();
64 
65  evt.getByToken(hitTokens[i], rhcH[i]);
66  if (!(rhcH[i].isValid())) {
67  edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection! (" << hitLabels[i].encode() << ")" << std::endl;
68  return;
69  }
70  const EcalRecHitCollection* recHits = rhcH[i].product();
71 
73  for (it = recHits->begin(); it != recHits->end(); it++){
74  if (((*it).time() < timeMax_) && ((*it).time() > timeMin_))
75  hits->push_back(*it);
76  }
77 
78  evt.put(std::move(hits), productLabels[i]);
79  }
80 }
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:457
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
T const * product() const
Definition: Handle.h:81
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
def move(src, dest)
Definition: eostools.py:510
const_iterator begin() const

Member Data Documentation

std::vector<edm::InputTag> EgammaHLTTimeCleanedRechitProducer::hitLabels
private
std::vector<edm::EDGetTokenT<EcalRecHitCollection> > EgammaHLTTimeCleanedRechitProducer::hitTokens
private
std::vector<std::string> EgammaHLTTimeCleanedRechitProducer::productLabels
private
double EgammaHLTTimeCleanedRechitProducer::timeMax_
private
double EgammaHLTTimeCleanedRechitProducer::timeMin_
private
std::vector<edm::EDGetTokenT<EcalUncalibratedRecHitCollection> > EgammaHLTTimeCleanedRechitProducer::uncalibHitTokens
private

Definition at line 29 of file EgammaHLTTimeCleanedRechitProducer.h.