CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
GsfElectronCoreEcalDrivenProducer Class Reference

#include <GsfElectronCoreEcalDrivenProducer.h>

Inheritance diagram for GsfElectronCoreEcalDrivenProducer:
GsfElectronCoreBaseProducer edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GsfElectronCoreEcalDrivenProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~GsfElectronCoreEcalDrivenProducer ()
 
- Public Member Functions inherited from GsfElectronCoreBaseProducer
 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
 
virtual ~GsfElectronCoreBaseProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void produceEcalDrivenCore (const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection *electrons)
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from GsfElectronCoreBaseProducer
static void fillDescription (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from GsfElectronCoreBaseProducer
void fillElectronCore (reco::GsfElectronCore *)
 
void initEvent (edm::Event &event, const edm::EventSetup &setup)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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)
 
- Protected Attributes inherited from GsfElectronCoreBaseProducer
edm::Handle
< reco::TrackCollection
ctfTracksH_
 
edm::Handle
< reco::GsfPFRecTrackCollection
gsfPfRecTracksH_
 
edm::Handle
< reco::GsfTrackCollection
gsfTracksH_
 
bool useGsfPfRecTracks_
 

Detailed Description

Definition at line 7 of file GsfElectronCoreEcalDrivenProducer.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file GsfElectronCoreEcalDrivenProducer.cc.

GsfElectronCoreEcalDrivenProducer::~GsfElectronCoreEcalDrivenProducer ( )
virtual

Definition at line 89 of file GsfElectronCoreEcalDrivenProducer.cc.

90  {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 31 of file GsfElectronCoreEcalDrivenProducer.cc.

References HI_PhotonSkim_cff::electrons, edm::Ref< C, T, F >::get(), GsfElectronCoreBaseProducer::gsfPfRecTracksH_, GsfElectronCoreBaseProducer::gsfTracksH_, i, GsfElectronCoreBaseProducer::initEvent(), produceEcalDrivenCore(), edm::Handle< T >::product(), and GsfElectronCoreBaseProducer::useGsfPfRecTracks_.

32  {
33  // base input
35 
36  // output
37  std::auto_ptr<GsfElectronCoreCollection> electrons(new GsfElectronCoreCollection) ;
38 
39  // loop on ecal driven tracks
41  {
42  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = gsfPfRecTracksH_.product() ;
43  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
44  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
45  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
46  ++gsfPfRecTrack )
47  {
48  const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef() ;
49  produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
50  }
51  }
52  else
53  {
54  const GsfTrackCollection * gsfTrackCollection = gsfTracksH_.product() ;
55  for ( unsigned int i=0 ; i<gsfTrackCollection->size() ; ++i )
56  {
58  produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
59  }
60  }
61 
62  event.put(electrons) ;
63  }
void initEvent(edm::Event &event, const edm::EventSetup &setup)
int i
Definition: DBlmapReader.cc:9
void produceEcalDrivenCore(const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection *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
T const * product() const
Definition: Handle.h:81
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracksH_
void GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore ( const reco::GsfTrackRef gsfTrackRef,
reco::GsfElectronCoreCollection electrons 
)
private

Definition at line 65 of file GsfElectronCoreEcalDrivenProducer.cc.

References edm::RefToBase< T >::castTo(), reco::GsfElectronCore::ecalDrivenSeed(), GsfElectronCoreBaseProducer::fillElectronCore(), edm::Ref< C, T, F >::isNull(), reco::return(), and reco::GsfElectronCore::setSuperCluster().

Referenced by produce().

66  {
67  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;
68 
69  if (!eleCore->ecalDrivenSeed())
70  { delete eleCore ; return ; }
71 
73 
74  edm::RefToBase<TrajectorySeed> seed = gsfTrackRef->extra()->seedRef() ;
75  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
76  edm::RefToBase<CaloCluster> caloCluster = elseed->caloCluster() ;
77  SuperClusterRef scRef = caloCluster.castTo<SuperClusterRef>() ;
78  if (!scRef.isNull())
79  {
80  eleCore->setSuperCluster(scRef) ;
81  electrons->push_back(*eleCore) ;
82  }
83  else
84  { edm::LogWarning("GsfElectronCoreEcalDrivenProducer")<<"Seed CaloCluster is not a SuperCluster, unexpected..." ; }
85 
86  delete eleCore ;
87  }
bool ecalDrivenSeed() const
void setSuperCluster(const SuperClusterRef &scl)
bool isNull() const
Checks for null.
Definition: Ref.h:247
REF castTo() const
cast to a concrete type
Definition: RefToBase.h:241
return(e1-e2)*(e1-e2)+dp *dp
void fillElectronCore(reco::GsfElectronCore *)