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::EDProducer edm::ProducerBase edm::ProductRegistryHelper GsfElectronCoreEcalDrivenProducer GsfElectronCoreProducer

Public Member Functions

 GsfElectronCoreBaseProducer (const edm::ParameterSet &conf)
 
virtual ~GsfElectronCoreBaseProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Static Public Member Functions

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

Protected Member Functions

void fillElectronCore (reco::GsfElectronCore *)
 
void initEvent (edm::Event &event, const edm::EventSetup &setup)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Protected Attributes

edm::Handle
< reco::TrackCollection
ctfTracksH_
 
edm::Handle
< reco::GsfTrackCollection
gsfTracksH_
 

Private Member Functions

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

Private Attributes

edm::InputTag ctfTracksTag_
 
edm::InputTag gsfTracksTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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 26 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSet::getParameter().

27  {
28  produces<GsfElectronCoreCollection>() ;
29  gsfTracksTag_ = config.getParameter<edm::InputTag>("gsfTracks") ;
30  ctfTracksTag_ = config.getParameter<edm::InputTag>("ctfTracks");
31  }
tuple config
Definition: cmsDriver.py:17
GsfElectronCoreBaseProducer::~GsfElectronCoreBaseProducer ( )
virtual

Definition at line 33 of file GsfElectronCoreBaseProducer.cc.

34  {}

Member Function Documentation

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

Definition at line 20 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSetDescription::add().

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

Definition at line 48 of file GsfElectronCoreBaseProducer.cc.

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

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

49  {
50  const GsfTrackRef & gsfTrackRef = eleCore->gsfTrack() ;
51 
52  std::pair<TrackRef,float> ctfpair = getCtfTrackRef(gsfTrackRef) ;
53  eleCore->setCtfTrack(ctfpair.first,ctfpair.second) ;
54  }
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 62 of file GsfElectronCoreBaseProducer.cc.

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

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

Definition at line 42 of file GsfElectronCoreBaseProducer.cc.

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

43  {
44  event.getByLabel(gsfTracksTag_,gsfTracksH_) ;
45  event.getByLabel(ctfTracksTag_,ctfTracksH_) ;
46  }
edm::Handle< reco::TrackCollection > ctfTracksH_
edm::Handle< reco::GsfTrackCollection > gsfTracksH_

Member Data Documentation

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

Definition at line 46 of file GsfElectronCoreBaseProducer.h.

edm::InputTag GsfElectronCoreBaseProducer::ctfTracksTag_
private

Definition at line 53 of file GsfElectronCoreBaseProducer.h.

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

Definition at line 52 of file GsfElectronCoreBaseProducer.h.