CMS 3D CMS Logo

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

Public Member Functions

 ChargedHadronPFTrackIsolationProducer (const edm::ParameterSet &cfg)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~ChargedHadronPFTrackIsolationProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::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 & 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)
 

Static Public Member Functions

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

Private Attributes

edm::EDGetTokenT< edm::View< reco::PFCandidate > > candidates_token
 
double minRawCaloEnergy_
 
double minTrackPt_
 
edm::InputTag srccandidates_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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 26 of file ChargedHadronPFTrackIsolationProducer.cc.

Constructor & Destructor Documentation

ChargedHadronPFTrackIsolationProducer::ChargedHadronPFTrackIsolationProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 44 of file ChargedHadronPFTrackIsolationProducer.cc.

References candidates_token, edm::ParameterSet::getParameter(), minRawCaloEnergy_, minTrackPt_, and srccandidates_.

45 {
47  candidates_token = consumes<edm::View<reco::PFCandidate> >(srccandidates_);
48  minTrackPt_ = cfg.getParameter<double>("minTrackPt");
49  minRawCaloEnergy_ = cfg.getParameter<double>("minRawCaloEnergy");
50 
51  produces<edm::ValueMap<bool> >();
52 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::PFCandidate > > candidates_token
ChargedHadronPFTrackIsolationProducer::~ChargedHadronPFTrackIsolationProducer ( )
inline

Definition at line 31 of file ChargedHadronPFTrackIsolationProducer.cc.

References fillDescriptions(), and produce().

31 {}

Member Function Documentation

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

Definition at line 88 of file ChargedHadronPFTrackIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

Referenced by ~ChargedHadronPFTrackIsolationProducer().

88  {
90  desc.add<edm::InputTag>("src", edm::InputTag("particleFlow"));
91  desc.add<double>("minTrackPt", 1);
92  desc.add<double>("minRawCaloEnergy", 0.5);
93  descriptions.add("chargedHadronPFTrackIsolation", desc);
94 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ChargedHadronPFTrackIsolationProducer::produce ( edm::StreamID  ,
edm::Event evt,
const edm::EventSetup es 
) const
override

Definition at line 54 of file ChargedHadronPFTrackIsolationProducer.cc.

References EnergyCorrector::c, objects.IsoTrackAnalyzer::candidates, candidates_token, allElectronIsolations_cfi::elements, edm::helper::Filler< Map >::fill(), objects.autophobj::filler, edm::Event::getByToken(), edm::helper::Filler< Map >::insert(), minRawCaloEnergy_, minTrackPt_, eostools::move(), nTracks(), MillePedeFileConverter_cfg::out, edm::Event::put(), reco::PFBlockElement::TRACK, and MuonErrorMatrixValues_cff::values.

Referenced by ~ChargedHadronPFTrackIsolationProducer().

55 {
56  // get a view of our candidates via the base candidates
57  typedef edm::View<reco::PFCandidate> PFCandidateView;
59  evt.getByToken(candidates_token, candidates);
60 
61  std::vector<bool> values;
62 
63  for( auto const& c : *candidates ) {
64  // Check that there is only one track in the block.
65  unsigned int nTracks = 0;
66  if ((c.particleId()==1) && (c.pt()>minTrackPt_) && ((c.rawEcalEnergy()+c.rawHcalEnergy())>minRawCaloEnergy_)) {
67  const reco::PFCandidate::ElementsInBlocks& theElements = c.elementsInBlocks();
68  if( theElements.empty() ) continue;
69  const reco::PFBlockRef blockRef = theElements[0].first;
70  const edm::OwnVector<reco::PFBlockElement>& elements = blockRef->elements();
71  // Find the tracks in the block
72  for( auto const & ele : elements ) {
73  reco::PFBlockElement::Type type = ele.type();
74  if( type== reco::PFBlockElement::TRACK)
75  nTracks++;
76  }
77  }
78  values.push_back((nTracks==1));
79  }
80 
81  std::unique_ptr<edm::ValueMap<bool> > out(new edm::ValueMap<bool>());
83  filler.insert(candidates,values.begin(),values.end());
84  filler.fill();
85  evt.put(std::move(out));
86 }
type
Definition: HCALResponse.h:21
const unsigned int nTracks(const reco::Vertex &sv)
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:460
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:386
edm::EDGetTokenT< edm::View< reco::PFCandidate > > candidates_token
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<edm::View<reco::PFCandidate> > ChargedHadronPFTrackIsolationProducer::candidates_token
private
double ChargedHadronPFTrackIsolationProducer::minRawCaloEnergy_
private
double ChargedHadronPFTrackIsolationProducer::minTrackPt_
private
edm::InputTag ChargedHadronPFTrackIsolationProducer::srccandidates_
private