CMS 3D CMS Logo

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 &)
 
virtual ~BlockElementImporterBase ()=default
 

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 _selectionChoice, _selectionTypes, _selector, _superClustersArePF, CombinedDetectorIso, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), electrons_cff::hoe, importToBlock(), SeparateDetectorIso, and AlCaHLTBitMon_QueryRunRegistry::string.

36  :
37  BlockElementImporterBase(conf,sumes),
40  {"CombinedDetectorIso",EGPhotonImporter::CombinedDetectorIso} }),
41  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")) {
42  const std::string& selChoice =
43  conf.getParameter<std::string>("SelectionChoice");
44  _selectionChoice = _selectionTypes.at(selChoice);
45  const edm::ParameterSet& selDef =
46  conf.getParameterSet("SelectionDefinition");
47  const float minEt = selDef.getParameter<double>("minEt");
48  const float trackIso_const = selDef.getParameter<double>("trackIsoConstTerm");
49  const float trackIso_slope = selDef.getParameter<double>("trackIsoSlopeTerm");
50  const float ecalIso_const = selDef.getParameter<double>("ecalIsoConstTerm");
51  const float ecalIso_slope = selDef.getParameter<double>("ecalIsoSlopeTerm");
52  const float hcalIso_const = selDef.getParameter<double>("hcalIsoConstTerm");
53  const float hcalIso_slope = selDef.getParameter<double>("hcalIsoSlopeTerm");
54  const float hoe = selDef.getParameter<double>("HoverE");
55  const float loose_hoe = selDef.getParameter<double>("LooseHoverE");
56  const float combIso = selDef.getParameter<double>("combIsoConstTerm");
57  _selector.reset(new PhotonSelectorAlgo((float)_selectionChoice,
58  minEt,
59  trackIso_const, trackIso_slope,
60  ecalIso_const, ecalIso_slope,
61  hcalIso_const, hcalIso_slope,
62  hoe,
63  combIso,
64  loose_hoe));
65 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
SelectionChoices _selectionChoice
ParameterSet const & getParameterSet(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)
std::unique_ptr< const PhotonSelectorAlgo > _selector
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, SoftLeptonByDistance_cfi::distance, edm::Event::getHandle(), muons2muons_cfi::photon, muons_cff::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().

Referenced by EGPhotonImporter().

69  {
71  auto photons = e.getHandle(_src);
72  elems.reserve(elems.size()+photons->size());
73  // setup our elements so that all the SCs are grouped together
74  auto SCs_end = std::partition(elems.begin(),elems.end(),
75  [](const ElementType& a){
76  return a->type() == reco::PFBlockElement::SC;
77  });
78  //now add the photons
79  auto bphoton = photons->cbegin();
80  auto ephoton = photons->cend();
81  reco::PFBlockElementSuperCluster* scbe = nullptr;
82  reco::PhotonRef phoref;
83  for( auto photon = bphoton; photon != ephoton; ++photon ) {
84  if( _selector->passPhotonSelection(*photon) ) {
85  phoref = reco::PhotonRef(photons,std::distance(bphoton,photon));
86  const reco::SuperClusterRef& scref = photon->superCluster();
87  PFBlockElementSCEqual myEqual(scref);
88  auto sc_elem = std::find_if(elems.begin(),SCs_end,myEqual);
89  if( sc_elem != SCs_end ) {
90  scbe = static_cast<reco::PFBlockElementSuperCluster*>(sc_elem->get());
91  scbe->setFromPhoton(true);
92  scbe->setPhotonRef(phoref);
93  scbe->setTrackIso(photon->trkSumPtHollowConeDR04());
94  scbe->setEcalIso(photon->ecalRecHitSumEtConeDR04());
95  scbe->setHcalIso(photon->hcalTowerSumEtConeDR04());
96  scbe->setHoE(photon->hadronicOverEm());
97  } else {
98  scbe = new reco::PFBlockElementSuperCluster(scref);
99  scbe->setFromPhoton(true);
101  scbe->setPhotonRef(phoref);
102  scbe->setTrackIso(photon->trkSumPtHollowConeDR04());
103  scbe->setEcalIso(photon->ecalRecHitSumEtConeDR04());
104  scbe->setHcalIso(photon->hcalTowerSumEtConeDR04());
105  scbe->setHoE(photon->hadronicOverEm());
106  SCs_end = elems.insert(SCs_end,ElementType(scbe));
107  ++SCs_end; // point to element *after* the new one
108  }
109  }
110  }// loop on photons
111  elems.shrink_to_fit();
112 }
void setFromPhoton(bool val)
set provenance
void setHcalIso(float val)
set the had Iso
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
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.

Referenced by EGPhotonImporter().

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

Definition at line 24 of file EGPhotonImporter.cc.

Referenced by EGPhotonImporter().

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

Definition at line 26 of file EGPhotonImporter.cc.

Referenced by EGPhotonImporter(), and 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 EGPhotonImporter(), and importToBlock().