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
 
enum  VetoMode { pfRecTrackCollection = 0, ticlSeedingRegion = 1, pfCandidateCollection = 2 }
 

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 &cc)
 
 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

◆ SelectionChoices

Enumerator
SeparateDetectorIso 
CombinedDetectorIso 

Definition at line 15 of file EGPhotonImporter.cc.

Constructor & Destructor Documentation

◆ EGPhotonImporter()

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

Definition at line 31 of file EGPhotonImporter.cc.

References CombinedDetectorIso, and SeparateDetectorIso.

33  _src(cc.consumes<reco::PhotonCollection>(conf.getParameter<edm::InputTag>("source"))),
35  {"CombinedDetectorIso", EGPhotonImporter::CombinedDetectorIso}}),
36  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")) {
37  const std::string& selChoice = conf.getParameter<std::string>("SelectionChoice");
38  _selectionChoice = _selectionTypes.at(selChoice);
39  const edm::ParameterSet& selDef = conf.getParameterSet("SelectionDefinition");
40  const float minEt = selDef.getParameter<double>("minEt");
41  const float trackIso_const = selDef.getParameter<double>("trackIsoConstTerm");
42  const float trackIso_slope = selDef.getParameter<double>("trackIsoSlopeTerm");
43  const float ecalIso_const = selDef.getParameter<double>("ecalIsoConstTerm");
44  const float ecalIso_slope = selDef.getParameter<double>("ecalIsoSlopeTerm");
45  const float hcalIso_const = selDef.getParameter<double>("hcalIsoConstTerm");
46  const float hcalIso_slope = selDef.getParameter<double>("hcalIsoSlopeTerm");
47  const float hoe = selDef.getParameter<double>("HoverE");
48  const float loose_hoe = selDef.getParameter<double>("LooseHoverE");
49  const float combIso = selDef.getParameter<double>("combIsoConstTerm");
50  _selector = std::make_unique<PhotonSelectorAlgo>((float)_selectionChoice,
51  minEt,
52  trackIso_const,
53  trackIso_slope,
54  ecalIso_const,
55  ecalIso_slope,
56  hcalIso_const,
57  hcalIso_slope,
58  hoe,
59  combIso,
60  loose_hoe);
61 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::unordered_map< std::string, SelectionChoices > _selectionTypes
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
ParameterSet const & getParameterSet(std::string const &) const
SelectionChoices _selectionChoice
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EDGetTokenT< reco::PhotonCollection > _src
std::unique_ptr< const PhotonSelectorAlgo > _selector

Member Function Documentation

◆ importToBlock()

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

Implements BlockElementImporterBase.

Definition at line 63 of file EGPhotonImporter.cc.

References _selector, _src, _superClustersArePF, a, HLT_2023v12_cff::distance, MillePedeFileConverter_cfg::e, l1ctLayer1_patternWriters_cff::partition, displacedMuons_cfi::photon, BPHMonitor_cfi::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().

63  {
65  auto photons = e.getHandle(_src);
66  elems.reserve(elems.size() + photons->size());
67  // setup our elements so that all the SCs are grouped together
68  auto SCs_end = std::partition(
69  elems.begin(), elems.end(), [](const ElementType& a) { return a->type() == reco::PFBlockElement::SC; });
70  //now add the photons
71  auto bphoton = photons->cbegin();
72  auto ephoton = photons->cend();
73  reco::PFBlockElementSuperCluster* scbe = nullptr;
74  reco::PhotonRef phoref;
75  for (auto photon = bphoton; photon != ephoton; ++photon) {
76  if (_selector->passPhotonSelection(*photon)) {
77  phoref = reco::PhotonRef(photons, std::distance(bphoton, photon));
78  const reco::SuperClusterRef& scref = photon->superCluster();
79  PFBlockElementSCEqual myEqual(scref);
80  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
81  if (sc_elem != SCs_end) {
82  scbe = static_cast<reco::PFBlockElementSuperCluster*>(sc_elem->get());
83  scbe->setFromPhoton(true);
84  scbe->setPhotonRef(phoref);
85  scbe->setTrackIso(photon->trkSumPtHollowConeDR04());
86  scbe->setEcalIso(photon->ecalRecHitSumEtConeDR04());
87  scbe->setHcalIso(photon->hcalTowerSumEtConeDR04());
88  scbe->setHoE(photon->hadronicOverEm());
89  } else {
90  scbe = new reco::PFBlockElementSuperCluster(scref);
91  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  SCs_end = elems.insert(SCs_end, ElementType(scbe));
99  ++SCs_end; // point to element *after* the new one
100  }
101  }
102  } // loop on photons
103  elems.shrink_to_fit();
104 }
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:119
edm::EDGetTokenT< reco::PhotonCollection > _src
void setEcalIso(float val)
set the ecal Iso
std::unique_ptr< const PhotonSelectorAlgo > _selector

Member Data Documentation

◆ _selectionChoice

SelectionChoices EGPhotonImporter::_selectionChoice
private

Definition at line 24 of file EGPhotonImporter.cc.

◆ _selectionTypes

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

Definition at line 23 of file EGPhotonImporter.cc.

◆ _selector

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

Definition at line 25 of file EGPhotonImporter.cc.

Referenced by importToBlock().

◆ _src

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

Definition at line 22 of file EGPhotonImporter.cc.

Referenced by importToBlock().

◆ _superClustersArePF

bool EGPhotonImporter::_superClustersArePF
private

Definition at line 26 of file EGPhotonImporter.cc.

Referenced by importToBlock().