CMS 3D CMS Logo

GsfElectronCoreBaseProducer.cc
Go to the documentation of this file.
11 
13 
14 using namespace reco ;
15 
17  {
18  desc.add<edm::InputTag>("gsfPfRecTracks",edm::InputTag("pfTrackElec")) ;
19  desc.add<edm::InputTag>("gsfTracks",edm::InputTag("electronGsfTracks")) ;
20  desc.add<edm::InputTag>("ctfTracks",edm::InputTag("generalTracks")) ;
21  desc.add<bool>("useGsfPfRecTracks",true) ;
22  }
23 
25  {
26  produces<GsfElectronCoreCollection>() ;
27  gsfPfRecTracksTag_ = mayConsume<reco::GsfPFRecTrackCollection>(config.getParameter<edm::InputTag>("gsfPfRecTracks")) ;
28  gsfTracksTag_ = consumes<reco::GsfTrackCollection>(config.getParameter<edm::InputTag>("gsfTracks"));
29  ctfTracksTag_ = consumes<reco::TrackCollection>(config.getParameter<edm::InputTag>("ctfTracks"));
30  useGsfPfRecTracks_ = config.getParameter<bool>("useGsfPfRecTracks") ;
31  }
32 
34  {}
35 
36 
37 //=======================================================================================
38 // For derived producers
39 //=======================================================================================
40 
41 // to be called at the beginning of each new event
43  {
44  if (useGsfPfRecTracks_)
45  { event.getByToken(gsfPfRecTracksTag_,gsfPfRecTracksH_) ; }
46  event.getByToken(gsfTracksTag_,gsfTracksH_) ;
47  event.getByToken(ctfTracksTag_,ctfTracksH_) ;
48  }
49 
51  {
52  const GsfTrackRef & gsfTrackRef = eleCore->gsfTrack() ;
53 
54  std::pair<TrackRef,float> ctfpair = gsfElectronTools::getClosestCtfToGsf(gsfTrackRef,ctfTracksH_) ;
55  eleCore->setCtfTrack(ctfpair.first,ctfpair.second) ;
56  }
void initEvent(edm::Event &event, const edm::EventSetup &setup)
T getParameter(std::string const &) const
void setCtfTrack(const TrackRef &closestCtfTrack, float ctfGsfOverlap)
const GsfTrackRef & gsfTrack() const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
GsfElectronCoreBaseProducer(const edm::ParameterSet &conf)
Definition: config.py:1
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescription(edm::ParameterSetDescription &)
fixed size matrix
std::pair< reco::TrackRef, float > getClosestCtfToGsf(reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH)
void fillElectronCore(reco::GsfElectronCore *)
Definition: event.py:1