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)
 
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::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::GsfPFRecTrackCollection
gsfPfRecTracksH_
 
edm::Handle
< reco::GsfTrackCollection
gsfTracksH_
 
bool useGsfPfRecTracks_
 

Private Member Functions

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

Private Attributes

edm::InputTag ctfTracksTag_
 
edm::InputTag gsfPfRecTracksTag_
 
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 28 of file GsfElectronCoreBaseProducer.cc.

References edm::ParameterSet::getParameter().

29  {
30  produces<GsfElectronCoreCollection>() ;
31  gsfPfRecTracksTag_ = config.getParameter<edm::InputTag>("gsfPfRecTracks") ;
32  gsfTracksTag_ = config.getParameter<edm::InputTag>("gsfTracks") ;
33  ctfTracksTag_ = config.getParameter<edm::InputTag>("ctfTracks") ;
34  useGsfPfRecTracks_ = config.getParameter<bool>("useGsfPfRecTracks") ;
35  }
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().

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(), 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 abs, TrackingRecHit::all, dPhi(), reco::HitPattern::getHitPattern(), min, pi, reco::HitPattern::pixelHitFilter(), mathSSE::sqrt(), reco::HitPattern::stripTIBHitFilter(), and reco::HitPattern::stripTIDHitFilter().

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(gsfHitCounter) ;
108  if (!(gsfHitPattern.pixelHitFilter(gsfHit) ||
109  gsfHitPattern.stripTIBHitFilter(gsfHit) ||
110  gsfHitPattern.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(ctfHitsCounter);
126  if( !(ctfHitPattern.pixelHitFilter(ctfHit) ||
127  ctfHitPattern.stripTIBHitFilter(ctfHit) ||
128  ctfHitPattern.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:10
#define abs(x)
Definition: mlp_lapack.h:159
#define min(a, b)
Definition: mlp_lapack.h:161
const Double_t pi
static bool stripTIDHitFilter(uint32_t pattern)
Definition: HitPattern.h:423
edm::Handle< reco::TrackCollection > ctfTracksH_
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:46
static bool pixelHitFilter(uint32_t pattern)
Definition: HitPattern.h:384
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
T const * product() const
Definition: Handle.h:74
uint32_t getHitPattern(int position) const
Definition: HitPattern.cc:144
static bool stripTIBHitFilter(uint32_t pattern)
Definition: HitPattern.h:416
void GsfElectronCoreBaseProducer::initEvent ( edm::Event event,
const edm::EventSetup setup 
)
protected

Definition at line 46 of file GsfElectronCoreBaseProducer.cc.

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

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

Member Data Documentation

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

Definition at line 47 of file GsfElectronCoreBaseProducer.h.

edm::InputTag GsfElectronCoreBaseProducer::ctfTracksTag_
private

Definition at line 56 of file GsfElectronCoreBaseProducer.h.

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

Definition at line 54 of file GsfElectronCoreBaseProducer.h.

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

Definition at line 55 of file GsfElectronCoreBaseProducer.h.

bool GsfElectronCoreBaseProducer::useGsfPfRecTracks_
protected