CMS 3D CMS Logo

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

#include <GsfElectronCoreBaseProducer.h>

Inheritance diagram for GsfElectronCoreBaseProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper GEDGsfElectronCoreProducer GsfElectronCoreEcalDrivenProducer GsfElectronCoreProducer

Public Member Functions

 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
 
virtual ~GsfElectronCoreBaseProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Protected Member Functions

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

edm::Handle
< reco::TrackCollection
ctfTracksH_
 
edm::Handle
< reco::GsfPFRecTrackCollection
gsfPfRecTracksH_
 
edm::Handle
< reco::GsfTrackCollection
gsfTracksH_
 
bool useGsfPfRecTracks_
 

Private Member Functions

std::pair< reco::TrackRef, float > getCtfTrackRef (const reco::GsfTrackRef &)
 

Private Attributes

edm::EDGetTokenT
< reco::TrackCollection
ctfTracksTag_
 
edm::EDGetTokenT
< reco::GsfPFRecTrackCollection
gsfPfRecTracksTag_
 
edm::EDGetTokenT
< reco::GsfTrackCollection
gsfTracksTag_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Detailed Description

Definition at line 31 of file GsfElectronCoreBaseProducer.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSet::getParameter().

29  {
30  produces<GsfElectronCoreCollection>() ;
31  gsfPfRecTracksTag_ = mayConsume<reco::GsfPFRecTrackCollection>(config.getParameter<edm::InputTag>("gsfPfRecTracks")) ;
32  gsfTracksTag_ = consumes<reco::GsfTrackCollection>(config.getParameter<edm::InputTag>("gsfTracks"));
33  ctfTracksTag_ = consumes<reco::TrackCollection>(config.getParameter<edm::InputTag>("ctfTracks"));
34  useGsfPfRecTracks_ = config.getParameter<bool>("useGsfPfRecTracks") ;
35  }
edm::EDGetTokenT< reco::TrackCollection > ctfTracksTag_
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag_
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksTag_
GsfElectronCoreBaseProducer::~GsfElectronCoreBaseProducer ( )
virtual

Definition at line 37 of file GsfElectronCoreBaseProducer.cc.

38  {}

Member Function Documentation

void GsfElectronCoreBaseProducer::fillDescription ( edm::ParameterSetDescription desc)
static

Definition at line 20 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSetDescription::add(), and HLT_25ns14e33_v1_cff::InputTag.

Referenced by GEDGsfElectronCoreProducer::fillDescriptions().

21  {
22  desc.add<edm::InputTag>("gsfPfRecTracks",edm::InputTag("pfTrackElec")) ;
23  desc.add<edm::InputTag>("gsfTracks",edm::InputTag("electronGsfTracks")) ;
24  desc.add<edm::InputTag>("ctfTracks",edm::InputTag("generalTracks")) ;
25  desc.add<bool>("useGsfPfRecTracks",true) ;
26  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void GsfElectronCoreBaseProducer::fillElectronCore ( reco::GsfElectronCore eleCore)
protected

Definition at line 54 of file GsfElectronCoreBaseProducer.cc.

References reco::GsfElectronCore::gsfTrack(), and reco::GsfElectronCore::setCtfTrack().

Referenced by GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), GEDGsfElectronCoreProducer::produceElectronCore(), and GsfElectronCoreProducer::produceTrackerDrivenCore().

55  {
56  const GsfTrackRef & gsfTrackRef = eleCore->gsfTrack() ;
57 
58  std::pair<TrackRef,float> ctfpair = getCtfTrackRef(gsfTrackRef) ;
59  eleCore->setCtfTrack(ctfpair.first,ctfpair.second) ;
60  }
void setCtfTrack(const TrackRef &closestCtfTrack, float ctfGsfOverlap)
const GsfTrackRef & gsfTrack() const
std::pair< reco::TrackRef, float > getCtfTrackRef(const reco::GsfTrackRef &)
std::pair< TrackRef, float > GsfElectronCoreBaseProducer::getCtfTrackRef ( const reco::GsfTrackRef gsfTrackRef)
private

Definition at line 68 of file GsfElectronCoreBaseProducer.cc.

References funct::abs(), TrackingRecHit::all, counter, dPhi(), reco::HitPattern::getHitPattern(), reco::HitPattern::hitPattern, min(), pi, reco::HitPattern::pixelHitFilter(), mathSSE::sqrt(), reco::HitPattern::stripTIBHitFilter(), reco::HitPattern::stripTIDHitFilter(), and reco::HitPattern::TRACK_HITS.

69  {
70  float maxFracShared = 0;
71  TrackRef ctfTrackRef = TrackRef() ;
72  const TrackCollection * ctfTrackCollection = ctfTracksH_.product() ;
73 
74  // get the Hit Pattern for the gsfTrack
75  const HitPattern& gsfHitPattern = gsfTrackRef->hitPattern();
76 
77  unsigned int counter ;
78  TrackCollection::const_iterator ctfTkIter ;
79  for ( ctfTkIter = ctfTrackCollection->begin() , counter = 0 ;
80  ctfTkIter != ctfTrackCollection->end() ; ctfTkIter++, counter++ )
81  {
82 
83  double dEta = gsfTrackRef->eta() - ctfTkIter->eta();
84  double dPhi = gsfTrackRef->phi() - ctfTkIter->phi();
85  double pi = acos(-1.);
86  if(std::abs(dPhi) > pi) dPhi = 2*pi - std::abs(dPhi);
87 
88  // dont want to look at every single track in the event!
89  if(sqrt(dEta*dEta + dPhi*dPhi) > 0.3) continue;
90 
91  unsigned int shared = 0 ;
92  int gsfHitCounter = 0 ;
93  int numGsfInnerHits = 0 ;
94  int numCtfInnerHits = 0 ;
95  // get the CTF Track Hit Pattern
96  const HitPattern& ctfHitPattern = ctfTkIter->hitPattern();
97 
98  trackingRecHit_iterator elHitsIt ;
99  for ( elHitsIt = gsfTrackRef->recHitsBegin() ;
100  elHitsIt != gsfTrackRef->recHitsEnd() ;
101  elHitsIt++, gsfHitCounter++ )
102  {
103  if(!((**elHitsIt).isValid())) //count only valid Hits
104  { continue ; }
105 
106  // look only in the pixels/TIB/TID
107  uint32_t gsfHit = gsfHitPattern.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter);
108  if (!(HitPattern::pixelHitFilter(gsfHit) ||
109  HitPattern::stripTIBHitFilter(gsfHit) ||
110  HitPattern::stripTIDHitFilter(gsfHit)))
111  { continue ; }
112 
113  numGsfInnerHits++ ;
114 
115  int ctfHitsCounter = 0 ;
116  numCtfInnerHits = 0 ;
117  trackingRecHit_iterator ctfHitsIt ;
118  for ( ctfHitsIt = ctfTkIter->recHitsBegin() ;
119  ctfHitsIt != ctfTkIter->recHitsEnd() ;
120  ctfHitsIt++, ctfHitsCounter++ )
121  {
122  if(!((**ctfHitsIt).isValid())) //count only valid Hits!
123  { continue ; }
124 
125  uint32_t ctfHit = ctfHitPattern.getHitPattern(HitPattern::TRACK_HITS, ctfHitsCounter);
126  if(!(HitPattern::pixelHitFilter(ctfHit) ||
127  HitPattern::stripTIBHitFilter(ctfHit) ||
128  HitPattern::stripTIDHitFilter(ctfHit)))
129  { continue ; }
130 
131  numCtfInnerHits++ ;
132 
133  if( (**elHitsIt).sharesInput(&(**ctfHitsIt),TrackingRecHit::all) )
134  {
135  shared++ ;
136  break ;
137  }
138 
139  } //ctfHits iterator
140 
141  } //gsfHits iterator
142 
143  if ((numGsfInnerHits==0)||(numCtfInnerHits==0))
144  { continue ; }
145 
146  if ( static_cast<float>(shared)/std::min(numGsfInnerHits,numCtfInnerHits) > maxFracShared )
147  {
148  maxFracShared = static_cast<float>(shared)/std::min(numGsfInnerHits, numCtfInnerHits);
149  ctfTrackRef = TrackRef(ctfTracksH_,counter);
150  }
151 
152  } //ctfTrack iterator
153 
154  return make_pair(ctfTrackRef,maxFracShared) ;
155  }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
const Double_t pi
edm::Handle< reco::TrackCollection > ctfTracksH_
uint16_t hitPattern[ARRAY_LENGTH]
Definition: HitPattern.h:418
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
T const * product() const
Definition: Handle.h:81
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:19
static std::atomic< unsigned int > counter
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:456
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
void GsfElectronCoreBaseProducer::initEvent ( edm::Event event,
const edm::EventSetup setup 
)
protected

Definition at line 46 of file GsfElectronCoreBaseProducer.cc.

Referenced by GsfElectronCoreEcalDrivenProducer::produce(), GEDGsfElectronCoreProducer::produce(), and GsfElectronCoreProducer::produce().

47  {
49  { event.getByToken(gsfPfRecTracksTag_,gsfPfRecTracksH_) ; }
50  event.getByToken(gsfTracksTag_,gsfTracksH_) ;
51  event.getByToken(ctfTracksTag_,ctfTracksH_) ;
52  }
edm::Handle< reco::TrackCollection > ctfTracksH_
edm::Handle< reco::GsfTrackCollection > gsfTracksH_
edm::EDGetTokenT< reco::TrackCollection > ctfTracksTag_
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag_
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracksH_
edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracksTag_

Member Data Documentation

edm::Handle<reco::TrackCollection> GsfElectronCoreBaseProducer::ctfTracksH_
protected

Definition at line 47 of file GsfElectronCoreBaseProducer.h.

edm::EDGetTokenT<reco::TrackCollection> GsfElectronCoreBaseProducer::ctfTracksTag_
private

Definition at line 56 of file GsfElectronCoreBaseProducer.h.

edm::Handle<reco::GsfPFRecTrackCollection> GsfElectronCoreBaseProducer::gsfPfRecTracksH_
protected
edm::EDGetTokenT<reco::GsfPFRecTrackCollection> GsfElectronCoreBaseProducer::gsfPfRecTracksTag_
private

Definition at line 54 of file GsfElectronCoreBaseProducer.h.

edm::Handle<reco::GsfTrackCollection> GsfElectronCoreBaseProducer::gsfTracksH_
protected
edm::EDGetTokenT<reco::GsfTrackCollection> GsfElectronCoreBaseProducer::gsfTracksTag_
private

Definition at line 55 of file GsfElectronCoreBaseProducer.h.

bool GsfElectronCoreBaseProducer::useGsfPfRecTracks_
protected