CMS 3D CMS Logo

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

Public Member Functions

 GsfElectronCoreEcalDrivenProducer (const edm::ParameterSet &conf)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- 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 Member Functions

void produceEcalDrivenCore (const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection &electrons, edm::Handle< reco::TrackCollection > const &ctfTracksHandle) const
 

Private Attributes

const edm::EDGetTokenT< reco::TrackCollectionctfTracksToken_
 
const edm::EDGetTokenT< reco::GsfPFRecTrackCollectiongsfPfRecTracksToken_
 
const edm::EDGetTokenT< reco::GsfTrackCollectiongsfTracksToken_
 
const edm::EDPutTokenT< reco::GsfElectronCoreCollectionputToken_
 
const bool useGsfPfRecTracks_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 13 of file GsfElectronCoreEcalDrivenProducer.cc.

Constructor & Destructor Documentation

◆ GsfElectronCoreEcalDrivenProducer()

GsfElectronCoreEcalDrivenProducer::GsfElectronCoreEcalDrivenProducer ( const edm::ParameterSet conf)
explicit

Definition at line 49 of file GsfElectronCoreEcalDrivenProducer.cc.

50  : useGsfPfRecTracks_(config.getParameter<bool>("useGsfPfRecTracks")),
51  gsfPfRecTracksToken_(mayConsume<GsfPFRecTrackCollection>(config.getParameter<edm::InputTag>("gsfPfRecTracks"))),
52  gsfTracksToken_(consumes<reco::GsfTrackCollection>(config.getParameter<edm::InputTag>("gsfTracks"))),
53  ctfTracksToken_(consumes<reco::TrackCollection>(config.getParameter<edm::InputTag>("ctfTracks"))),
54  putToken_(produces<reco::GsfElectronCoreCollection>()) {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 40 of file GsfElectronCoreEcalDrivenProducer.cc.

40  {
42  desc.add<edm::InputTag>("gsfPfRecTracks", {"pfTrackElec"});
43  desc.add<edm::InputTag>("gsfTracks", {"electronGsfTracks"});
44  desc.add<edm::InputTag>("ctfTracks", {"generalTracks"});
45  desc.add<bool>("useGsfPfRecTracks", true);
46  descriptions.add("ecalDrivenGsfElectronCores", desc);
47 }

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

◆ produce()

void GsfElectronCoreEcalDrivenProducer::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup setup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 56 of file GsfElectronCoreEcalDrivenProducer.cc.

56  {
57  auto gsfTracksHandle = event.getHandle(gsfTracksToken_);
58  auto ctfTracksHandle = event.getHandle(ctfTracksToken_);
59 
60  // output
62 
63  // loop on ecal driven tracks
64  if (useGsfPfRecTracks_) {
65  for (auto const& gsfPfRecTrack : event.get(gsfPfRecTracksToken_)) {
66  produceEcalDrivenCore(gsfPfRecTrack.gsfTrackRef(), electrons, ctfTracksHandle);
67  }
68  } else {
69  for (unsigned int i = 0; i < gsfTracksHandle->size(); ++i) {
70  produceEcalDrivenCore(edm::Ref<GsfTrackCollection>(gsfTracksHandle, i), electrons, ctfTracksHandle);
71  }
72  }
73 
74  event.emplace(putToken_, std::move(electrons));
75 }

References ctfTracksToken_, pwdgSkimBPark_cfi::electrons, gsfPfRecTracksToken_, gsfTracksToken_, mps_fire::i, eostools::move(), produceEcalDrivenCore(), putToken_, and useGsfPfRecTracks_.

◆ produceEcalDrivenCore()

void GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore ( const reco::GsfTrackRef gsfTrackRef,
reco::GsfElectronCoreCollection electrons,
edm::Handle< reco::TrackCollection > const &  ctfTracksHandle 
) const
private

Definition at line 77 of file GsfElectronCoreEcalDrivenProducer.cc.

80  {
81  electrons.emplace_back(gsfTrackRef);
82  auto& eleCore = electrons.back();
83 
84  if (!eleCore.ecalDrivenSeed()) {
85  electrons.pop_back();
86  return;
87  }
88 
89  auto ctfpair = egamma::getClosestCtfToGsf(eleCore.gsfTrack(), ctfTracksHandle);
90  eleCore.setCtfTrack(ctfpair.first, ctfpair.second);
91 
92  auto scRef = gsfTrackRef->extra()->seedRef().castTo<ElectronSeedRef>()->caloCluster().castTo<SuperClusterRef>();
93  if (!scRef.isNull()) {
94  eleCore.setSuperCluster(scRef);
95  } else {
96  electrons.pop_back();
97  edm::LogWarning("GsfElectronCoreEcalDrivenProducer") << "Seed CaloCluster is not a SuperCluster, unexpected...";
98  }
99 }

References pwdgSkimBPark_cfi::electrons, and egamma::getClosestCtfToGsf().

Referenced by produce().

Member Data Documentation

◆ ctfTracksToken_

const edm::EDGetTokenT<reco::TrackCollection> GsfElectronCoreEcalDrivenProducer::ctfTracksToken_
private

Definition at line 29 of file GsfElectronCoreEcalDrivenProducer.cc.

Referenced by produce().

◆ gsfPfRecTracksToken_

const edm::EDGetTokenT<reco::GsfPFRecTrackCollection> GsfElectronCoreEcalDrivenProducer::gsfPfRecTracksToken_
private

Definition at line 27 of file GsfElectronCoreEcalDrivenProducer.cc.

Referenced by produce().

◆ gsfTracksToken_

const edm::EDGetTokenT<reco::GsfTrackCollection> GsfElectronCoreEcalDrivenProducer::gsfTracksToken_
private

Definition at line 28 of file GsfElectronCoreEcalDrivenProducer.cc.

Referenced by produce().

◆ putToken_

const edm::EDPutTokenT<reco::GsfElectronCoreCollection> GsfElectronCoreEcalDrivenProducer::putToken_
private

Definition at line 31 of file GsfElectronCoreEcalDrivenProducer.cc.

Referenced by produce().

◆ useGsfPfRecTracks_

const bool GsfElectronCoreEcalDrivenProducer::useGsfPfRecTracks_
private

Definition at line 25 of file GsfElectronCoreEcalDrivenProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
GsfElectronCoreEcalDrivenProducer::ctfTracksToken_
const edm::EDGetTokenT< reco::TrackCollection > ctfTracksToken_
Definition: GsfElectronCoreEcalDrivenProducer.cc:29
GsfElectronCoreEcalDrivenProducer::useGsfPfRecTracks_
const bool useGsfPfRecTracks_
Definition: GsfElectronCoreEcalDrivenProducer.cc:25
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Ref< GsfTrackCollection >
config
Definition: config.py:1
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::GsfElectronCoreCollection
std::vector< GsfElectronCore > GsfElectronCoreCollection
Definition: GsfElectronCoreFwd.h:12
reco::SuperClusterRef
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
Definition: SuperClusterFwd.h:15
GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore
void produceEcalDrivenCore(const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection &electrons, edm::Handle< reco::TrackCollection > const &ctfTracksHandle) const
Definition: GsfElectronCoreEcalDrivenProducer.cc:77
edm::LogWarning
Definition: MessageLogger.h:141
GsfElectronCoreEcalDrivenProducer::gsfPfRecTracksToken_
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksToken_
Definition: GsfElectronCoreEcalDrivenProducer.cc:27
GsfElectronCoreEcalDrivenProducer::gsfTracksToken_
const edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksToken_
Definition: GsfElectronCoreEcalDrivenProducer.cc:28
eostools.move
def move(src, dest)
Definition: eostools.py:511
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
GsfElectronCoreEcalDrivenProducer::putToken_
const edm::EDPutTokenT< reco::GsfElectronCoreCollection > putToken_
Definition: GsfElectronCoreEcalDrivenProducer.cc:31
reco::ElectronSeedRef
edm::Ref< ElectronSeedCollection > ElectronSeedRef
reference to an object in a collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:14
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
egamma::getClosestCtfToGsf
std::pair< reco::TrackRef, float > getClosestCtfToGsf(reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH)
Definition: GsfElectronTools.cc:17