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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () 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 20 of file GEDPhotonCoreProducer.h.

Constructor & Destructor Documentation

◆ GEDPhotonCoreProducer()

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

Definition at line 36 of file GEDPhotonCoreProducer.cc.

37  : conf_(config)
38 
39 {
40  // use onfiguration file to setup input/output collection names
41  pfEgammaCandidates_ = consumes<reco::PFCandidateCollection>(conf_.getParameter<edm::InputTag>("pfEgammaCandidates"));
42  pixelSeedProducer_ = consumes<reco::ElectronSeedCollection>(conf_.getParameter<edm::InputTag>("pixelSeedProducer"));
43 
44  GEDPhotonCoreCollection_ = conf_.getParameter<std::string>("gedPhotonCoreCollection");
45 
46  // Register the product
47  produces<reco::PhotonCoreCollection>(GEDPhotonCoreCollection_);
48 }

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

◆ ~GEDPhotonCoreProducer()

GEDPhotonCoreProducer::~GEDPhotonCoreProducer ( )
override

Definition at line 50 of file GEDPhotonCoreProducer.cc.

50 {}

Member Function Documentation

◆ produce()

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

Definition at line 52 of file GEDPhotonCoreProducer.cc.

52  {
53  using namespace edm;
54  // nEvt_++;
55 
56  reco::PhotonCoreCollection outputPhotonCoreCollection;
57  auto outputPhotonCoreCollection_p = std::make_unique<reco::PhotonCoreCollection>();
58 
59  // Get the PF refined cluster collection
60  Handle<reco::PFCandidateCollection> pfCandidateHandle;
61  theEvent.getByToken(pfEgammaCandidates_, pfCandidateHandle);
62  if (!pfCandidateHandle.isValid()) {
63  edm::LogError("GEDPhotonCoreProducer") << "Error! Can't get the pfEgammaCandidates";
64  }
65 
66  // Get ElectronPixelSeeds
67  validPixelSeeds_ = true;
70  theEvent.getByToken(pixelSeedProducer_, pixelSeedHandle);
71  if (!pixelSeedHandle.isValid()) {
72  validPixelSeeds_ = false;
73  }
74 
75  // std::cout << " GEDPhotonCoreProducer::produce input PFcandidate size " << pfCandidateHandle->size() << std::endl;
76 
77  // Loop over PF candidates and get only photons
78  for (unsigned int lCand = 0; lCand < pfCandidateHandle->size(); lCand++) {
79  reco::PFCandidateRef candRef(reco::PFCandidateRef(pfCandidateHandle, lCand));
80 
81  // Retrieve stuff from the pfPhoton
82  reco::PFCandidateEGammaExtraRef pfPhoRef = candRef->egammaExtraRef();
83  reco::SuperClusterRef refinedSC = pfPhoRef->superClusterRef();
84  reco::SuperClusterRef boxSC = pfPhoRef->superClusterPFECALRef();
85  const reco::ConversionRefVector& doubleLegConv = pfPhoRef->conversionRef();
86  const reco::ConversionRefVector& singleLegConv = pfPhoRef->singleLegConversionRef();
87  reco::CaloClusterPtr refinedSCPtr = edm::refToPtr(refinedSC);
88 
89  // std::cout << "newCandidate doubleLegConv="<<doubleLegConv.size()<< std::endl;
90  //std::cout << "newCandidate singleLegConv="<< pfPhoRef->singleLegConvTrackRef().size()<< std::endl;
91 
93  reco::PhotonCore newCandidate;
94  newCandidate.setPFlowPhoton(true);
95  newCandidate.setStandardPhoton(false);
96  newCandidate.setSuperCluster(refinedSC);
97  newCandidate.setParentSuperCluster(boxSC);
98  // fill conversion infos
99 
100  for (unsigned int lConv = 0; lConv < doubleLegConv.size(); lConv++) {
101  newCandidate.addConversion(doubleLegConv[lConv]);
102  }
103 
104  for (unsigned int lConv = 0; lConv < singleLegConv.size(); lConv++) {
105  newCandidate.addOneLegConversion(singleLegConv[lConv]);
106  }
107 
108  // std::cout << "newCandidate pf refined SC energy="<< newCandidate.superCluster()->energy()<<std::endl;
109  //std::cout << "newCandidate pf SC energy="<< newCandidate.parentSuperCluster()->energy()<<std::endl;
110  //std::cout << "newCandidate nconv2leg="<<newCandidate.conversions().size()<< std::endl;
111 
112  if (validPixelSeeds_) {
113  for (unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
114  reco::ElectronSeedRef cpRef(pixelSeedHandle, icp);
115  if (boxSC.isNonnull() && boxSC.id() == cpRef->caloCluster().id() && boxSC.key() == cpRef->caloCluster().key()) {
116  newCandidate.addElectronPixelSeed(cpRef);
117  }
118  }
119  }
120 
121  outputPhotonCoreCollection.push_back(newCandidate);
122  }
123 
124  // put the product in the event
125  // edm::LogInfo("GEDPhotonCoreProducer") << " Put in the event " << iSC << " Photon Candidates \n";
126  outputPhotonCoreCollection_p->assign(outputPhotonCoreCollection.begin(), outputPhotonCoreCollection.end());
127  theEvent.put(std::move(outputPhotonCoreCollection_p), GEDPhotonCoreCollection_);
128 }

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_.

Member Data Documentation

◆ conf_

edm::ParameterSet GEDPhotonCoreProducer::conf_
private

Definition at line 34 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer().

◆ GEDPhotonCoreCollection_

std::string GEDPhotonCoreProducer::GEDPhotonCoreCollection_
private

Definition at line 28 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

◆ minSCEt_

double GEDPhotonCoreProducer::minSCEt_
private

Definition at line 32 of file GEDPhotonCoreProducer.h.

◆ pfEgammaCandidates_

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

Definition at line 29 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

◆ pixelSeedProducer_

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

Definition at line 30 of file GEDPhotonCoreProducer.h.

Referenced by GEDPhotonCoreProducer(), and produce().

◆ validConversions_

bool GEDPhotonCoreProducer::validConversions_
private

Definition at line 33 of file GEDPhotonCoreProducer.h.

◆ validPixelSeeds_

bool GEDPhotonCoreProducer::validPixelSeeds_
private

Definition at line 35 of file GEDPhotonCoreProducer.h.

Referenced by produce().

reco::PhotonCore::setPFlowPhoton
void setPFlowPhoton(const bool prov)
set the provenance
Definition: PhotonCore.h:58
reco::PhotonCore::setSuperCluster
void setSuperCluster(const reco::SuperClusterRef &r)
set reference to SuperCluster
Definition: PhotonCore.h:48
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::PhotonCore::addConversion
void addConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:52
edm::RefVector< ConversionCollection >
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< PFCandidateCollection >
edm::refToPtr
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
config
Definition: config.py:1
reco::PhotonCore::setStandardPhoton
void setStandardPhoton(const bool prov)
Definition: PhotonCore.h:59
GEDPhotonCoreProducer::validPixelSeeds_
bool validPixelSeeds_
Definition: GEDPhotonCoreProducer.h:35
reco::PhotonCore
Definition: PhotonCore.h:24
reco::PhotonCore::addElectronPixelSeed
void addElectronPixelSeed(const reco::ElectronSeedRef &r)
set electron pixel seed ref
Definition: PhotonCore.h:56
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
reco::PhotonCore::addOneLegConversion
void addOneLegConversion(const reco::ConversionRef &r)
add single ConversionRef to the vector of Refs
Definition: PhotonCore.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::PhotonCoreCollection
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
GEDPhotonCoreProducer::conf_
edm::ParameterSet conf_
Definition: GEDPhotonCoreProducer.h:34
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
GEDPhotonCoreProducer::pixelSeedProducer_
edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
Definition: GEDPhotonCoreProducer.h:30
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::Ptr< CaloCluster >
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
eostools.move
def move(src, dest)
Definition: eostools.py:511
GEDPhotonCoreProducer::pfEgammaCandidates_
edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
Definition: GEDPhotonCoreProducer.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
GEDPhotonCoreProducer::GEDPhotonCoreCollection_
std::string GEDPhotonCoreCollection_
Definition: GEDPhotonCoreProducer.h:28
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::RefVector::size
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
edm::InputTag
Definition: InputTag.h:15
reco::PhotonCore::setParentSuperCluster
void setParentSuperCluster(const reco::SuperClusterRef &r)
set reference to PFlow SuperCluster
Definition: PhotonCore.h:50
edm::ProductID::id
ProductIndex id() const
Definition: ProductID.h:35