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

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<>
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 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"))} {}

Member Function Documentation

◆ produce()

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

Definition at line 39 of file GEDPhotonCoreProducer.cc.

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 }

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

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().

conv
static HepMC::IO_HEPEVT conv
Definition: BeamHaloProducer.cc:48
edm::Ref< SuperClusterCollection >
GEDPhotonCoreProducer::putToken_
const edm::EDPutTokenT< reco::PhotonCoreCollection > putToken_
Definition: GEDPhotonCoreProducer.cc:28
config
Definition: config.py:1
GEDPhotonCoreProducer::pixelSeedProducer_
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedProducer_
Definition: GEDPhotonCoreProducer.cc:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::PhotonCoreCollection
std::vector< PhotonCore > PhotonCoreCollection
collectin of PhotonCore objects
Definition: PhotonCoreFwd.h:9
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
cand
Definition: decayParser.h:32
edm::makeValid
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
GEDPhotonCoreProducer::pfEgammaCandidates_
const edm::EDGetTokenT< reco::PFCandidateCollection > pfEgammaCandidates_
Definition: GEDPhotonCoreProducer.cc:26
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15
edm::ProductID::id
ProductIndex id() const
Definition: ProductID.h:35