CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EGPhotonImporter Class Reference
Inheritance diagram for EGPhotonImporter:
BlockElementImporterBase

Public Types

enum  SelectionChoices { SeparateDetectorIso, CombinedDetectorIso }
 
- Public Types inherited from BlockElementImporterBase
typedef std::vector
< std::unique_ptr
< reco::PFBlockElement > > 
ElementList
 

Public Member Functions

 EGPhotonImporter (const edm::ParameterSet &, edm::ConsumesCollector &)
 
void importToBlock (const edm::Event &, ElementList &) const override
 
- Public Member Functions inherited from BlockElementImporterBase
 BlockElementImporterBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 BlockElementImporterBase (const BlockElementImporterBase &)=delete
 
const std::string & name () const
 
BlockElementImporterBaseoperator= (const BlockElementImporterBase &)=delete
 
virtual void updateEventSetup (const edm::EventSetup &)
 

Private Attributes

SelectionChoices _selectionChoice
 
const std::unordered_map
< std::string,
SelectionChoices
_selectionTypes
 
std::unique_ptr< const
PhotonSelectorAlgo
_selector
 
edm::EDGetTokenT
< reco::PhotonCollection
_src
 
bool _superClustersArePF
 

Detailed Description

Definition at line 13 of file EGPhotonImporter.cc.

Member Enumeration Documentation

Enumerator
SeparateDetectorIso 
CombinedDetectorIso 

Definition at line 15 of file EGPhotonImporter.cc.

Constructor & Destructor Documentation

EGPhotonImporter::EGPhotonImporter ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes 
)

Definition at line 35 of file EGPhotonImporter.cc.

References CombinedDetectorIso, and SeparateDetectorIso.

36  :
37  BlockElementImporterBase(conf,sumes),
40  {"CombinedDetectorIso",EGPhotonImporter::CombinedDetectorIso} }),
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EDGetTokenT< reco::PhotonCollection > _src
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
const std::unordered_map< std::string, SelectionChoices > _selectionTypes

Member Function Documentation

void EGPhotonImporter::importToBlock ( const edm::Event e,
BlockElementImporterBase::ElementList elems 
) const
overridevirtual

Implements BlockElementImporterBase.

Definition at line 68 of file EGPhotonImporter.cc.

References _selector, _src, _superClustersArePF, a, HLT_25ns10e33_v2_cff::distance, edm::Event::getByToken(), NULL, interactiveExample::photons, reco::PFBlockElement::SC, reco::PFBlockElementSuperCluster::setEcalIso(), reco::PFBlockElementSuperCluster::setFromPFSuperCluster(), reco::PFBlockElementSuperCluster::setFromPhoton(), reco::PFBlockElementSuperCluster::setHcalIso(), reco::PFBlockElementSuperCluster::setHoE(), reco::PFBlockElementSuperCluster::setPhotonRef(), and reco::PFBlockElementSuperCluster::setTrackIso().

69  {
72  e.getByToken(_src,photons);
73  elems.reserve(elems.size()+photons->size());
74  // setup our elements so that all the SCs are grouped together
75  auto SCs_end = std::partition(elems.begin(),elems.end(),
76  [](const ElementType& a){
77  return a->type() == reco::PFBlockElement::SC;
78  });
79  //now add the photons
80  auto bphoton = photons->cbegin();
81  auto ephoton = photons->cend();
83  reco::PhotonRef phoref;
84  for( auto photon = bphoton; photon != ephoton; ++photon ) {
85  if( _selector->passPhotonSelection(*photon) ) {
86  phoref = reco::PhotonRef(photons,std::distance(bphoton,photon));
87  const reco::SuperClusterRef& scref = photon->superCluster();
88  PFBlockElementSCEqual myEqual(scref);
89  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
90  if( sc_elem != SCs_end ) {
91  scbe = static_cast<reco::PFBlockElementSuperCluster*>(sc_elem->get());
92  scbe->setFromPhoton(true);
93  scbe->setPhotonRef(phoref);
94  scbe->setTrackIso(photon->trkSumPtHollowConeDR04());
95  scbe->setEcalIso(photon->ecalRecHitSumEtConeDR04());
96  scbe->setHcalIso(photon->hcalTowerSumEtConeDR04());
97  scbe->setHoE(photon->hadronicOverEm());
98  } else {
99  scbe = new reco::PFBlockElementSuperCluster(scref);
100  scbe->setFromPhoton(true);
102  scbe->setPhotonRef(phoref);
103  scbe->setTrackIso(photon->trkSumPtHollowConeDR04());
104  scbe->setEcalIso(photon->ecalRecHitSumEtConeDR04());
105  scbe->setHcalIso(photon->hcalTowerSumEtConeDR04());
106  scbe->setHoE(photon->hadronicOverEm());
107  SCs_end = elems.insert(SCs_end,ElementType(scbe));
108  ++SCs_end; // point to element *after* the new one
109  }
110  }
111  }// loop on photons
112  elems.shrink_to_fit();
113 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define NULL
Definition: scimark2.h:8
void setFromPhoton(bool val)
set provenance
void setHcalIso(float val)
set the had Iso
void setTrackIso(float val)
set the track Iso
void setPhotonRef(const PhotonRef &ref)
set photonRef
edm::Ref< PhotonCollection > PhotonRef
reference to an object in a collection of Photon objects
Definition: PhotonFwd.h:15
double a
Definition: hdecay.h:121
edm::EDGetTokenT< reco::PhotonCollection > _src
void setEcalIso(float val)
set the ecal Iso
std::unique_ptr< const PhotonSelectorAlgo > _selector

Member Data Documentation

SelectionChoices EGPhotonImporter::_selectionChoice
private

Definition at line 25 of file EGPhotonImporter.cc.

const std::unordered_map<std::string,SelectionChoices> EGPhotonImporter::_selectionTypes
private

Definition at line 24 of file EGPhotonImporter.cc.

std::unique_ptr<const PhotonSelectorAlgo> EGPhotonImporter::_selector
private

Definition at line 26 of file EGPhotonImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<reco::PhotonCollection> EGPhotonImporter::_src
private

Definition at line 23 of file EGPhotonImporter.cc.

Referenced by importToBlock().

bool EGPhotonImporter::_superClustersArePF
private

Definition at line 27 of file EGPhotonImporter.cc.

Referenced by importToBlock().