CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GEDPhotonCoreProducer Class Reference
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
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const edm::EDGetTokenT< reco::PFCandidateCollectionpfEgammaCandidates_
 
const edm::EDGetTokenT< reco::ElectronSeedCollectionpixelSeedProducer_
 
const edm::EDPutTokenT< reco::PhotonCoreCollectionputToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 19 of file GEDPhotonCoreProducer.cc.

Constructor & Destructor Documentation

◆ GEDPhotonCoreProducer()

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

Definition at line 34 of file GEDPhotonCoreProducer.cc.

35  : pfEgammaCandidates_{consumes(config.getParameter<edm::InputTag>("pfEgammaCandidates"))},
36  pixelSeedProducer_{consumes(config.getParameter<edm::InputTag>("pixelSeedProducer"))},
37  putToken_{produces<reco::PhotonCoreCollection>(config.getParameter<std::string>("gedPhotonCoreCollection"))} {}
Definition: config.py:1
const edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
const edm::EDPutTokenT< reco::PhotonCoreCollection > putToken_

Member Function Documentation

◆ produce()

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

Definition at line 39 of file GEDPhotonCoreProducer.cc.

References conv, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), edm::makeValid(), eostools::move(), pfEgammaCandidates_, pixelSeedProducer_, and putToken_.

39  {
40  reco::PhotonCoreCollection outputPhotonCoreCollection;
41 
42  // Get the PF refined cluster collection
43  auto pfCandidateHandle = edm::makeValid(event.getHandle(pfEgammaCandidates_));
44 
45  // Get ElectronPixelSeeds
46  bool validPixelSeeds = true;
47  auto pixelSeedHandle = event.getHandle(pixelSeedProducer_);
48  if (!pixelSeedHandle.isValid()) {
49  validPixelSeeds = false;
50  }
51 
52  // Loop over PF candidates and get only photons
53  for (auto const& cand : *pfCandidateHandle) {
54  // Retrieve stuff from the pfPhoton
55  auto const& pfPho = *cand.egammaExtraRef();
56  reco::SuperClusterRef refinedSC = pfPho.superClusterRef();
57  reco::SuperClusterRef boxSC = pfPho.superClusterPFECALRef();
58 
59  // Construct new PhotonCore
60  outputPhotonCoreCollection.emplace_back();
61  auto& newCandidate = outputPhotonCoreCollection.back();
62 
63  newCandidate.setPFlowPhoton(true);
64  newCandidate.setStandardPhoton(false);
65  newCandidate.setSuperCluster(refinedSC);
66  newCandidate.setParentSuperCluster(boxSC);
67 
68  // Fill conversion infos
69  for (auto const& conv : pfPho.conversionRef()) {
70  newCandidate.addConversion(conv);
71  }
72  for (auto const& conv : pfPho.singleLegConversionRef()) {
73  newCandidate.addOneLegConversion(conv);
74  }
75 
76  // std::cout << "newCandidate pf refined SC energy="<< newCandidate.superCluster()->energy()<<std::endl;
77  //std::cout << "newCandidate pf SC energy="<< newCandidate.parentSuperCluster()->energy()<<std::endl;
78  //std::cout << "newCandidate nconv2leg="<<newCandidate.conversions().size()<< std::endl;
79 
80  if (validPixelSeeds) {
81  for (unsigned int icp = 0; icp < pixelSeedHandle->size(); icp++) {
82  reco::ElectronSeedRef cpRef(pixelSeedHandle, icp);
83  if (boxSC.isNonnull() && boxSC.id() == cpRef->caloCluster().id() && boxSC.key() == cpRef->caloCluster().key()) {
84  newCandidate.addElectronPixelSeed(cpRef);
85  }
86  }
87  }
88  }
89 
90  // put the product in the event
91  event.emplace(putToken_, std::move(outputPhotonCoreCollection));
92 }
ProductID id() const
Accessor for product ID.
Definition: Ref.h:238
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
key_type key() const
Accessor for product key.
Definition: Ref.h:244
const edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
ProductIndex id() const
Definition: ProductID.h:35
EPOS::IO_EPOS conv
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
const edm::EDPutTokenT< reco::PhotonCoreCollection > putToken_
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ pfEgammaCandidates_

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

Definition at line 26 of file GEDPhotonCoreProducer.cc.

Referenced by produce().

◆ pixelSeedProducer_

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

Definition at line 27 of file GEDPhotonCoreProducer.cc.

Referenced by produce().

◆ putToken_

const edm::EDPutTokenT<reco::PhotonCoreCollection> GEDPhotonCoreProducer::putToken_
private

Definition at line 28 of file GEDPhotonCoreProducer.cc.

Referenced by produce().