CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

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, 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
int i
Definition: DBlmapReader.cc:9
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(), and edm::ParameterSetDescription::add().

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

Implements edm::EDProducer.

Definition at line 57 of file EgammaHLTTimeCleanedRechitProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), edm::Event::getByToken(), hitLabels, hitTokens, i, edm::Handle< T >::product(), productLabels, edm::Event::put(), HLT_25ns10e33_v2_cff::recHits, timeMax_, and timeMin_.

57  {
58 
60 
61 
62  for (unsigned int i=0; i<hitLabels.size(); i++) {
63  std::auto_ptr<EcalRecHitCollection> hits(new 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(hits, productLabels[i]);
79  }
80 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< EcalRecHit >::const_iterator const_iterator
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const_iterator end() const
T const * product() const
Definition: Handle.h:81
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
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.