CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GEDPhotonCoreProducer Class Reference

#include <GEDPhotonCoreProducer.h>

Inheritance diagram for GEDPhotonCoreProducer:
edm::stream::EDProducer<>

Public Member Functions

 GEDPhotonCoreProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~GEDPhotonCoreProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

edm::ParameterSet conf_
 
std::string GEDPhotonCoreCollection_
 
double minSCEt_
 
edm::EDGetTokenT< reco::PFCandidateCollectionpfEgammaCandidates_
 
edm::EDGetTokenT< reco::ElectronSeedCollectionpixelSeedProducer_
 
bool validConversions_
 
bool validPixelSeeds_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 23 of file GEDPhotonCoreProducer.h.

Constructor & Destructor Documentation

GEDPhotonCoreProducer::GEDPhotonCoreProducer ( const edm::ParameterSet ps)

Definition at line 36 of file GEDPhotonCoreProducer.cc.

References conf_, GEDPhotonCoreCollection_, edm::ParameterSet::getParameter(), pfEgammaCandidates_, pixelSeedProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

36  :
37  conf_(config)
38 
39 {
40 
41  // use onfiguration file to setup input/output collection names
43  consumes<reco::PFCandidateCollection>(conf_.getParameter<edm::InputTag>("pfEgammaCandidates"));
45  consumes<reco::ElectronSeedCollection>(conf_.getParameter<edm::InputTag>("pixelSeedProducer"));
46 
47  GEDPhotonCoreCollection_ = conf_.getParameter<std::string>("gedPhotonCoreCollection");
48 
49 
50 
51  // Register the product
52  produces<reco::PhotonCoreCollection>(GEDPhotonCoreCollection_);
53 
54 }
T getParameter(std::string const &) const
Definition: config.py:1
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
GEDPhotonCoreProducer::~GEDPhotonCoreProducer ( )
override

Definition at line 56 of file GEDPhotonCoreProducer.cc.

56 {}

Member Function Documentation

void GEDPhotonCoreProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 61 of file GEDPhotonCoreProducer.cc.

References reco::PhotonCore::addConversion(), reco::PhotonCore::addElectronPixelSeed(), reco::PhotonCore::addOneLegConversion(), GEDPhotonCoreCollection_, edm::Event::getByToken(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), edm::Ref< C, T, F >::key(), eostools::move(), pfEgammaCandidates_, pixelSeedProducer_, edm::Event::put(), edm::refToPtr(), reco::PhotonCore::setParentSuperCluster(), reco::PhotonCore::setPFlowPhoton(), reco::PhotonCore::setStandardPhoton(), reco::PhotonCore::setSuperCluster(), edm::RefVector< C, T, F >::size(), and validPixelSeeds_.

61  {
62 
63 
64  using namespace edm;
65  // nEvt_++;
66 
67  reco::PhotonCoreCollection outputPhotonCoreCollection;
68  auto outputPhotonCoreCollection_p = std::make_unique<reco::PhotonCoreCollection>();
69 
70  // Get the PF refined cluster collection
71  Handle<reco::PFCandidateCollection> pfCandidateHandle;
72  theEvent.getByToken(pfEgammaCandidates_,pfCandidateHandle);
73  if (!pfCandidateHandle.isValid()) {
74  edm::LogError("GEDPhotonCoreProducer")
75  << "Error! Can't get the pfEgammaCandidates";
76  }
77 
78 
79  // Get ElectronPixelSeeds
80  validPixelSeeds_=true;
83  theEvent.getByToken(pixelSeedProducer_, pixelSeedHandle);
84  if (!pixelSeedHandle.isValid()) {
85  validPixelSeeds_=false;
86  }
87 
88 
89 
90  // std::cout << " GEDPhotonCoreProducer::produce input PFcandidate size " << pfCandidateHandle->size() << std::endl;
91 
92 
93  // Loop over PF candidates and get only photons
94  reco::ElectronSeedCollection::const_iterator pixelSeedItr;
95  for(unsigned int lCand=0; lCand < pfCandidateHandle->size(); lCand++) {
96  reco::PFCandidateRef candRef (reco::PFCandidateRef(pfCandidateHandle,lCand));
97 
98  // Retrieve stuff from the pfPhoton
99  reco::PFCandidateEGammaExtraRef pfPhoRef = candRef->egammaExtraRef();
100  reco::SuperClusterRef refinedSC= pfPhoRef->superClusterRef();
101  reco::SuperClusterRef boxSC= pfPhoRef->superClusterPFECALRef();
102  const reco::ConversionRefVector & doubleLegConv = pfPhoRef->conversionRef();
103  const reco::ConversionRefVector & singleLegConv = pfPhoRef->singleLegConversionRef();
104  reco::CaloClusterPtr refinedSCPtr= edm::refToPtr(refinedSC);
105 
106  // std::cout << "newCandidate doubleLegConv="<<doubleLegConv.size()<< std::endl;
107  //std::cout << "newCandidate singleLegConv="<< pfPhoRef->singleLegConvTrackRef().size()<< std::endl;
108 
110  reco::PhotonCore newCandidate;
111  newCandidate.setPFlowPhoton(true);
112  newCandidate.setStandardPhoton(false);
113  newCandidate.setSuperCluster(refinedSC);
114  newCandidate.setParentSuperCluster(boxSC);
115  // fill conversion infos
116 
117 
118  for(unsigned int lConv=0; lConv < doubleLegConv.size(); lConv++) {
119  newCandidate.addConversion(doubleLegConv[lConv]);
120  }
121 
122  for(unsigned int lConv=0; lConv < singleLegConv.size(); lConv++) {
123  newCandidate.addOneLegConversion(singleLegConv[lConv]);
124  }
125 
126  // std::cout << "newCandidate pf refined SC energy="<< newCandidate.superCluster()->energy()<<std::endl;
127  //std::cout << "newCandidate pf SC energy="<< newCandidate.parentSuperCluster()->energy()<<std::endl;
128  //std::cout << "newCandidate nconv2leg="<<newCandidate.conversions().size()<< std::endl;
129 
130  if ( validPixelSeeds_) {
131  for( unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
132  reco::ElectronSeedRef cpRef(pixelSeedHandle,icp);
133  if ( boxSC.isNonnull() && boxSC.id() == cpRef->caloCluster().id() && boxSC.key() == cpRef->caloCluster().key() ) {
134  newCandidate.addElectronPixelSeed(cpRef);
135  }
136  }
137  }
138 
139  outputPhotonCoreCollection.push_back(newCandidate);
140  }
141 
142  // put the product in the event
143  // edm::LogInfo("GEDPhotonCoreProducer") << " Put in the event " << iSC << " Photon Candidates \n";
144  outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(),outputPhotonCoreCollection.end());
145  theEvent.put(std::move(outputPhotonCoreCollection_p), GEDPhotonCoreCollection_);
146 
147 
148 
149 
150 }
void setSuperCluster(const reco::SuperClusterRef &r)
set reference to SuperCluster
Definition: PhotonCore.h:50
void addOneLegConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:56
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:54
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
key_type key() const
Accessor for product key.
Definition: Ref.h:265
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
void setParentSuperCluster(const reco::SuperClusterRef &r)
set reference to PFlow SuperCluster
Definition: PhotonCore.h:52
void setStandardPhoton(const bool prov)
Definition: PhotonCore.h:61
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
bool isValid() const
Definition: HandleBase.h:74
void setPFlowPhoton(const bool prov)
set the provenance
Definition: PhotonCore.h:60
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
HLT enums.
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
ProductIndex id() const
Definition: ProductID.h:38
void addElectronPixelSeed(const reco::ElectronSeedRef &r)
set electron pixel seed ref
Definition: PhotonCore.h:58
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::ParameterSet GEDPhotonCoreProducer::conf_
private

Definition at line 40 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer().

std::string GEDPhotonCoreProducer::GEDPhotonCoreCollection_
private

Definition at line 34 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

double GEDPhotonCoreProducer::minSCEt_
private

Definition at line 38 of file GEDPhotonCoreProducer.h.

edm::EDGetTokenT<reco::PFCandidateCollection> GEDPhotonCoreProducer::pfEgammaCandidates_
private

Definition at line 35 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

edm::EDGetTokenT<reco::ElectronSeedCollection> GEDPhotonCoreProducer::pixelSeedProducer_
private

Definition at line 36 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

bool GEDPhotonCoreProducer::validConversions_
private

Definition at line 39 of file GEDPhotonCoreProducer.h.

bool GEDPhotonCoreProducer::validPixelSeeds_
private

Definition at line 41 of file GEDPhotonCoreProducer.h.

Referenced by produce().