CMS 3D CMS Logo

GEDGsfElectronCoreProducer.cc
Go to the documentation of this file.
1 
3 
7 
15 
18 
19 #include <map>
20 
21 using namespace reco ;
22 
24 {
27  desc.add<edm::InputTag>("GEDEMUnbiased",edm::InputTag("GEDPFCandidates")) ;
28 
29  descriptions.add("produceEcalDrivenGsfElectronCores",desc) ;
30 }
31 
34 {
35  gedEMUnbiasedTag_ = consumes<reco::PFCandidateCollection>(config.getParameter<edm::InputTag>("GEDEMUnbiased")) ;
36 }
37 
39  {
40  // base input
42 
44  event.getByToken(gedEMUnbiasedTag_,gedEMUnbiasedH_);
45 
46  // output
47  auto electrons = std::make_unique<GsfElectronCoreCollection>();
48 
49  const PFCandidateCollection * pfCandidateCollection = gedEMUnbiasedH_.product();
50  for ( unsigned int i=0 ; i<pfCandidateCollection->size() ; ++i )
51  produceElectronCore((*pfCandidateCollection)[i],electrons.get()) ;
52 
53  event.put(std::move(electrons));
54  }
55 
57  {
58  const GsfTrackRef gsfTrackRef = pfCandidate.gsfTrackRef();
59  if(gsfTrackRef.isNull())
60  return;
61 
62  reco::PFCandidateEGammaExtraRef extraRef = pfCandidate.egammaExtraRef();
63  if(extraRef.isNull())
64  return;
65 
66  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;
67 
69 
70  SuperClusterRef scRef = extraRef->superClusterRef();
71  SuperClusterRef scBoxRef = extraRef->superClusterPFECALRef();
72 
73  for(const auto &convref : extraRef->conversionRef()) {
74  eleCore->addConversion(convref);
75  }
76 
77  for(const auto &convref : extraRef->singleLegConversionRef()) {
78  eleCore->addOneLegConversion(convref);
79  }
80 
81  if (!scRef.isNull() || !scBoxRef.isNull())
82  {
83  eleCore->setSuperCluster(scRef) ;
84  eleCore->setParentSuperCluster(scBoxRef) ;
85  electrons->push_back(*eleCore) ;
86  }
87  else
88  { edm::LogWarning("GEDGsfElectronCoreProducer")<<"Both superClusterRef and superClusterBoxRef of pfCandidate.egammaExtraRef() are Null" ; }
89 
90  delete eleCore ;
91  }
92 
94  {}
95 
void initEvent(edm::Event &event, const edm::EventSetup &setup)
T getParameter(std::string const &) const
GEDGsfElectronCoreProducer(const edm::ParameterSet &conf)
edm::EDGetTokenT< reco::PFCandidateCollection > gedEMUnbiasedTag_
void addOneLegConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
Definition: config.py:1
void produceElectronCore(const reco::PFCandidate &pfCandidate, reco::GsfElectronCoreCollection *electrons)
void setSuperCluster(const SuperClusterRef &scl)
void setParentSuperCluster(const SuperClusterRef &scl)
std::vector< GsfElectronCore > GsfElectronCoreCollection
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isNull() const
Checks for null.
Definition: Ref.h:248
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T const * product() const
Definition: Handle.h:74
static void fillDescription(edm::ParameterSetDescription &)
static void fillDescriptions(edm::ConfigurationDescriptions &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:605
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:480
void produce(edm::Event &, const edm::EventSetup &) override
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
void fillElectronCore(reco::GsfElectronCore *)
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1