CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  std::auto_ptr<GsfElectronCoreCollection> electrons(new 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(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
int i
Definition: DBlmapReader.cc:9
GEDGsfElectronCoreProducer(const edm::ParameterSet &conf)
edm::EDGetTokenT< reco::PFCandidateCollection > gedEMUnbiasedTag_
void addOneLegConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
virtual void produce(edm::Event &, const edm::EventSetup &)
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)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isNull() const
Checks for null.
Definition: Ref.h:249
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T const * product() const
Definition: Handle.h:81
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:39
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:596
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:471
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
void fillElectronCore(reco::GsfElectronCore *)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")