CMS 3D CMS Logo

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

#include <GsfElectronCoreProducer.h>

Inheritance diagram for GsfElectronCoreProducer:
GsfElectronCoreBaseProducer edm::stream::EDProducer<>

Public Member Functions

 GsfElectronCoreProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from GsfElectronCoreBaseProducer
 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from GsfElectronCoreBaseProducer
static void fillDescription (edm::ParameterSetDescription &, std::string const &gsfPfRecTracks="pfTrackElec", std::string const &gsfTracks="electronGsfTracks")
 

Private Member Functions

void produceTrackerDrivenCore (const reco::GsfTrackRef &gsfTrackRef, std::list< reco::GsfElectronCore * > &electrons)
 

Private Attributes

edm::Handle< reco::GsfElectronCoreCollectionedCoresH_
 
edm::EDGetTokenT< reco::GsfElectronCoreCollectionedCoresTag_
 
edm::Handle< reco::GsfElectronCoreCollectionpfCoresH_
 
edm::EDGetTokenT< reco::GsfElectronCoreCollectionpfCoresTag_
 

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
 
- Protected Member Functions inherited from GsfElectronCoreBaseProducer
void fillElectronCore (reco::GsfElectronCore *)
 
void initEvent (edm::Event &event, const edm::EventSetup &setup)
 
- Protected Attributes inherited from GsfElectronCoreBaseProducer
edm::Handle< reco::TrackCollectionctfTracksH_
 
edm::Handle< reco::GsfPFRecTrackCollectiongsfPfRecTracksH_
 
edm::Handle< reco::GsfTrackCollectiongsfTracksH_
 
bool useGsfPfRecTracks_
 

Detailed Description

Definition at line 9 of file GsfElectronCoreProducer.h.

Constructor & Destructor Documentation

GsfElectronCoreProducer::GsfElectronCoreProducer ( const edm::ParameterSet config)
explicit

Definition at line 30 of file GsfElectronCoreProducer.cc.

References edCoresTag_, edm::ParameterSet::getParameter(), and pfCoresTag_.

31  : GsfElectronCoreBaseProducer(config) {
32  edCoresTag_ =
33  consumes<reco::GsfElectronCoreCollection>(config.getParameter<edm::InputTag>("ecalDrivenGsfElectronCoresTag"));
34  pfCoresTag_ =
35  consumes<reco::GsfElectronCoreCollection>(config.getParameter<edm::InputTag>("pflowGsfElectronCoresTag"));
36  // pfSuperClustersTag_ = config.getParameter<edm::InputTag>("pfSuperClusters") ;
37  // pfSuperClusterTrackMapTag_ = config.getParameter<edm::InputTag>("pfSuperClusterTrackMap") ;
38 }
T getParameter(std::string const &) const
GsfElectronCoreBaseProducer(const edm::ParameterSet &conf)
edm::EDGetTokenT< reco::GsfElectronCoreCollection > pfCoresTag_
edm::EDGetTokenT< reco::GsfElectronCoreCollection > edCoresTag_

Member Function Documentation

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

Definition at line 20 of file GsfElectronCoreProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), GsfElectronCoreBaseProducer::fillDescription(), and HLT_2018_cff::InputTag.

20  {
23  desc.add<edm::InputTag>("ecalDrivenGsfElectronCoresTag", edm::InputTag("ecalDrivenGsfElectronCores"));
24  desc.add<edm::InputTag>("pflowGsfElectronCoresTag", edm::InputTag("pfElectronTranslator:pf"));
25  desc.add<edm::InputTag>("pfSuperClusters", edm::InputTag("pfElectronTranslator:pf"));
26  desc.add<edm::InputTag>("pfSuperClusterTrackMap", edm::InputTag("pfElectronTranslator:pf"));
27  descriptions.add("gsfElectronCores", desc);
28 }
static void fillDescription(edm::ParameterSetDescription &, std::string const &gsfPfRecTracks="pfTrackElec", std::string const &gsfTracks="electronGsfTracks")
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void GsfElectronCoreProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 40 of file GsfElectronCoreProducer.cc.

References universalConfigTemplate::collection, edCoresH_, edCoresTag_, pwdgSkimBPark_cfi::electrons, newFWLiteAna::found, GsfElectronCoreBaseProducer::gsfPfRecTracksH_, GsfElectronCoreBaseProducer::gsfTracksH_, mps_fire::i, GsfElectronCoreBaseProducer::initEvent(), LogDebug, eostools::move(), pfCoresH_, pfCoresTag_, produceTrackerDrivenCore(), edm::Handle< T >::product(), and GsfElectronCoreBaseProducer::useGsfPfRecTracks_.

40  {
41  // base input
43 
44  // transient output
45  std::list<GsfElectronCore *> electrons;
46 
47  // event input
48  event.getByToken(edCoresTag_, edCoresH_);
49  event.getByToken(pfCoresTag_, pfCoresH_);
50  // event.getByToken(pfSuperClustersTag_,pfClustersH_) ;
51  // event.getByToken(pfSuperClusterTrackMapTag_,pfClusterTracksH_) ;
52 
53  // loop on pure tracker driven tracks
54  if (useGsfPfRecTracks_) {
55  const GsfPFRecTrackCollection *gsfPfRecTrackCollection = gsfPfRecTracksH_.product();
56  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack;
57  for (gsfPfRecTrack = gsfPfRecTrackCollection->begin(); gsfPfRecTrack != gsfPfRecTrackCollection->end();
58  ++gsfPfRecTrack) {
59  const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef();
60  produceTrackerDrivenCore(gsfTrackRef, electrons);
61  }
62  } else {
63  const GsfTrackCollection *gsfTrackCollection = gsfTracksH_.product();
64  for (unsigned int i = 0; i < gsfTrackCollection->size(); ++i) {
66  produceTrackerDrivenCore(gsfTrackRef, electrons);
67  }
68  }
69 
70  // clone ecal driven electrons
71  const GsfElectronCoreCollection *edCoresCollection = edCoresH_.product();
72  GsfElectronCoreCollection::const_iterator edCoreIter;
73  for (edCoreIter = edCoresCollection->begin(); edCoreIter != edCoresCollection->end(); edCoreIter++) {
74  electrons.push_back(edCoreIter->clone());
75  }
76 
77  // add pflow info
78  const GsfElectronCoreCollection *pfCoresCollection = pfCoresH_.product();
79  GsfElectronCoreCollection::const_iterator pfCoreIter;
80  std::list<GsfElectronCore *>::iterator eleCore;
81  bool found;
82  for (eleCore = electrons.begin(); eleCore != electrons.end(); eleCore++) {
83  // (*eleCore)->setParentSuperCluster((*pfClusterTracksH_)[(*eleCore)->gsfTrack()]) ;
84  found = false;
85  for (pfCoreIter = pfCoresCollection->begin(); pfCoreIter != pfCoresCollection->end(); pfCoreIter++) {
86  if (pfCoreIter->gsfTrack() == (*eleCore)->gsfTrack()) {
87  if (found) {
88  edm::LogWarning("GsfElectronCoreProducer") << "associated pfGsfElectronCore already found";
89  } else {
90  found = true;
91  (*eleCore)->setParentSuperCluster(pfCoreIter->parentSuperCluster());
92  }
93  }
94  }
95  }
96 
97  // store
98  auto collection = std::make_unique<GsfElectronCoreCollection>();
99  for (eleCore = electrons.begin(); eleCore != electrons.end(); eleCore++) {
100  if ((*eleCore)->superCluster().isNull()) {
101  LogDebug("GsfElectronCoreProducer") << "GsfTrack with no associated SuperCluster at all.";
102  } else {
103  collection->push_back(**eleCore);
104  }
105  delete (*eleCore);
106  }
107  event.put(std::move(collection));
108 }
#define LogDebug(id)
void initEvent(edm::Event &event, const edm::EventSetup &setup)
edm::Handle< reco::GsfElectronCoreCollection > edCoresH_
void produceTrackerDrivenCore(const reco::GsfTrackRef &gsfTrackRef, std::list< reco::GsfElectronCore * > &electrons)
edm::Handle< reco::GsfTrackCollection > gsfTracksH_
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
edm::EDGetTokenT< reco::GsfElectronCoreCollection > pfCoresTag_
T const * product() const
Definition: Handle.h:69
edm::EDGetTokenT< reco::GsfElectronCoreCollection > edCoresTag_
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracksH_
edm::Handle< reco::GsfElectronCoreCollection > pfCoresH_
def move(src, dest)
Definition: eostools.py:511
void GsfElectronCoreProducer::produceTrackerDrivenCore ( const reco::GsfTrackRef gsfTrackRef,
std::list< reco::GsfElectronCore * > &  electrons 
)
private

Definition at line 110 of file GsfElectronCoreProducer.cc.

References reco::GsfElectronCore::ecalDrivenSeed(), and GsfElectronCoreBaseProducer::fillElectronCore().

Referenced by produce().

111  {
112  GsfElectronCore *eleCore = new GsfElectronCore(gsfTrackRef);
113  if (eleCore->ecalDrivenSeed()) {
114  delete eleCore;
115  return;
116  }
118  electrons.push_back(eleCore);
119 }
bool ecalDrivenSeed() const
void fillElectronCore(reco::GsfElectronCore *)

Member Data Documentation

edm::Handle<reco::GsfElectronCoreCollection> GsfElectronCoreProducer::edCoresH_
private

Definition at line 22 of file GsfElectronCoreProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::GsfElectronCoreCollection> GsfElectronCoreProducer::edCoresTag_
private

Definition at line 17 of file GsfElectronCoreProducer.h.

Referenced by GsfElectronCoreProducer(), and produce().

edm::Handle<reco::GsfElectronCoreCollection> GsfElectronCoreProducer::pfCoresH_
private

Definition at line 23 of file GsfElectronCoreProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::GsfElectronCoreCollection> GsfElectronCoreProducer::pfCoresTag_
private

Definition at line 18 of file GsfElectronCoreProducer.h.

Referenced by GsfElectronCoreProducer(), and produce().