CMS 3D CMS Logo

List of all members | 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
 
 ~GsfElectronCoreProducer () override
 
- Public Member Functions inherited from GsfElectronCoreBaseProducer
 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
 
 ~GsfElectronCoreBaseProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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
 
- Static Public Member Functions inherited from GsfElectronCoreBaseProducer
static void fillDescription (edm::ParameterSetDescription &)
 
- 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 32 of file GsfElectronCoreProducer.cc.

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

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

Definition at line 138 of file GsfElectronCoreProducer.cc.

139  {}

Member Function Documentation

void GsfElectronCoreProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 41 of file GsfElectronCoreProducer.cc.

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

42  {
43  // base input
45 
46  // transient output
47  std::list<GsfElectronCore *> electrons ;
48 
49  // event input
50  event.getByToken(edCoresTag_,edCoresH_) ;
51  event.getByToken(pfCoresTag_,pfCoresH_) ;
52 // event.getByToken(pfSuperClustersTag_,pfClustersH_) ;
53 // event.getByToken(pfSuperClusterTrackMapTag_,pfClusterTracksH_) ;
54 
55  // loop on pure tracker driven tracks
57  {
58  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = gsfPfRecTracksH_.product() ;
59  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
60  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
61  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
62  ++gsfPfRecTrack )
63  {
64  const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef() ;
65  produceTrackerDrivenCore(gsfTrackRef,electrons) ;
66  }
67  }
68  else
69  {
70  const GsfTrackCollection * gsfTrackCollection = gsfTracksH_.product() ;
71  for ( unsigned int i=0 ; i<gsfTrackCollection->size() ; ++i )
72  {
74  produceTrackerDrivenCore(gsfTrackRef,electrons) ;
75  }
76  }
77 
78  // clone ecal driven electrons
79  const GsfElectronCoreCollection * edCoresCollection = edCoresH_.product() ;
80  GsfElectronCoreCollection::const_iterator edCoreIter ;
81  for
82  ( edCoreIter = edCoresCollection->begin() ;
83  edCoreIter != edCoresCollection->end() ;
84  edCoreIter++ )
85  { electrons.push_back(edCoreIter->clone()) ; }
86 
87  // add pflow info
88  const GsfElectronCoreCollection * pfCoresCollection = pfCoresH_.product() ;
89  GsfElectronCoreCollection::const_iterator pfCoreIter ;
90  std::list<GsfElectronCore *>::iterator eleCore ;
91  bool found ;
92  for ( eleCore = electrons.begin() ; eleCore != electrons.end() ; eleCore++ )
93  {
94 // (*eleCore)->setParentSuperCluster((*pfClusterTracksH_)[(*eleCore)->gsfTrack()]) ;
95  found = false ;
96  for
97  ( pfCoreIter = pfCoresCollection->begin() ;
98  pfCoreIter != pfCoresCollection->end() ;
99  pfCoreIter++ )
100  {
101  if (pfCoreIter->gsfTrack()==(*eleCore)->gsfTrack())
102  {
103  if (found)
104  {
105  edm::LogWarning("GsfElectronCoreProducer")<<"associated pfGsfElectronCore already found" ;
106  }
107  else
108  {
109  found = true ;
110  (*eleCore)->setParentSuperCluster(pfCoreIter->parentSuperCluster()) ;
111  }
112  }
113  }
114  }
115 
116  // store
117  auto collection = std::make_unique<GsfElectronCoreCollection>();
118  for ( eleCore = electrons.begin() ; eleCore != electrons.end() ; eleCore++ )
119  {
120  if ((*eleCore)->superCluster().isNull())
121  { LogDebug("GsfElectronCoreProducer")<<"GsfTrack with no associated SuperCluster at all." ; }
122  else
123  { collection->push_back(**eleCore) ; }
124  delete (*eleCore) ;
125  }
126  event.put(std::move(collection));
127  }
#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:74
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 129 of file GsfElectronCoreProducer.cc.

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

Referenced by produce().

130  {
131  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;
132  if (eleCore->ecalDrivenSeed())
133  { delete eleCore ; return ; }
135  electrons.push_back(eleCore) ;
136  }
bool ecalDrivenSeed() const
return((rh^lh)&mask)
void fillElectronCore(reco::GsfElectronCore *)

Member Data Documentation

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

Definition at line 26 of file GsfElectronCoreProducer.h.

Referenced by produce().

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

Definition at line 21 of file GsfElectronCoreProducer.h.

Referenced by GsfElectronCoreProducer(), and produce().

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

Definition at line 27 of file GsfElectronCoreProducer.h.

Referenced by produce().

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

Definition at line 22 of file GsfElectronCoreProducer.h.

Referenced by GsfElectronCoreProducer(), and produce().