CMS 3D CMS Logo

photonIsolationHIProducer.cc
Go to the documentation of this file.
12 
16 
18 
22 
24 public:
25  explicit photonIsolationHIProducer(const edm::ParameterSet& ps);
26 
27  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
28 
29 private:
30  void produce(edm::Event& evt, const edm::EventSetup& es) override;
31 
41 
44 
46 };
47 
49  : photonProducer_(consumes(config.getParameter<edm::InputTag>("photonProducer"))),
50  barrelEcalHits_(consumes(config.getParameter<edm::InputTag>("ebRecHitCollection"))),
51  endcapEcalHits_(consumes(config.getParameter<edm::InputTag>("eeRecHitCollection"))),
52  hbhe_(consumes(config.getParameter<edm::InputTag>("hbhe"))),
53  hf_(consumes(config.getParameter<edm::InputTag>("hf"))),
54  ho_(consumes(config.getParameter<edm::InputTag>("ho"))),
55  barrelClusters_(consumes(config.getParameter<edm::InputTag>("basicClusterBarrel"))),
56  endcapClusters_(consumes(config.getParameter<edm::InputTag>("basicClusterEndcap"))),
57  tracks_(consumes(config.getParameter<edm::InputTag>("trackCollection"))),
58  ecalClusterToolsESGetTokens_{consumesCollector()},
59  geometryToken_{esConsumes()},
60  trackQuality_(config.getParameter<std::string>("trackQuality")) {
61  produces<reco::HIPhotonIsolationMap>();
62 }
63 
72  evt.getByToken(hbhe_, hbhe);
74  evt.getByToken(hf_, hf);
76  evt.getByToken(ho_, ho);
83 
84  auto outputMap = std::make_unique<reco::HIPhotonIsolationMap>();
86  std::vector<reco::HIPhotonIsolation> isoVector;
87 
90  const CaloGeometry* geometry = nullptr;
91  if (geometryHandle.isValid()) {
92  geometry = geometryHandle.product();
93  }
97 
98  for (reco::PhotonCollection::const_iterator phoItr = photons->begin(); phoItr != photons->end(); ++phoItr) {
100  // HI-style isolation info
101  iso.ecalClusterIsoR1(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 1, 0));
102  iso.ecalClusterIsoR2(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 2, 0));
103  iso.ecalClusterIsoR3(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 3, 0));
104  iso.ecalClusterIsoR4(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 4, 0));
105  iso.ecalClusterIsoR5(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 5, 0));
106 
107  iso.hcalRechitIsoR1(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 1, 0));
108  iso.hcalRechitIsoR2(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 2, 0));
109  iso.hcalRechitIsoR3(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 3, 0));
110  iso.hcalRechitIsoR4(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 4, 0));
111  iso.hcalRechitIsoR5(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 5, 0));
112 
113  iso.trackIsoR1PtCut20(TxC.getBkgSubTrackIso(*phoItr, 1, 2));
114  iso.trackIsoR2PtCut20(TxC.getBkgSubTrackIso(*phoItr, 2, 2));
115  iso.trackIsoR3PtCut20(TxC.getBkgSubTrackIso(*phoItr, 3, 2));
116  iso.trackIsoR4PtCut20(TxC.getBkgSubTrackIso(*phoItr, 4, 2));
117  iso.trackIsoR5PtCut20(TxC.getBkgSubTrackIso(*phoItr, 5, 2));
118 
119  // ecal spike rejection info (seed timing)
120  const reco::CaloClusterPtr seed = phoItr->superCluster()->seed();
121  const DetId& id = lazyTool.getMaximum(*seed).first;
122  float time = -999.;
123  const EcalRecHitCollection& rechits = (phoItr->isEB() ? *barrelEcalHits : *endcapEcalHits);
125  if (it != rechits.end()) {
126  time = it->time();
127  }
128  iso.seedTime(time);
129 
130  // ecal spike rejectino info (swiss cross)
131  float eMax = lazyTool.eMax(*seed);
132  float eRight = lazyTool.eRight(*seed);
133  float eLeft = lazyTool.eLeft(*seed);
134  float eTop = lazyTool.eTop(*seed);
135  float eBottom = lazyTool.eBottom(*seed);
136  iso.swissCrx(1 - (eRight + eLeft + eTop + eBottom) / eMax);
137 
138  isoVector.push_back(iso);
139  }
140  filler.insert(photons, isoVector.begin(), isoVector.end());
141  filler.fill();
142  evt.put(std::move(outputMap));
143 }
144 
147 
148  desc.add<edm::InputTag>("photonProducer", edm::InputTag("photons"));
149  desc.add<edm::InputTag>("ebRecHitCollection", edm::InputTag("ecalRecHit:EcalRecHitsEB"));
150  desc.add<edm::InputTag>("eeRecHitCollection", edm::InputTag("ecalRecHit:EcalRecHitsEE"));
151  desc.add<edm::InputTag>("hbhe", edm::InputTag("hbhereco"));
152  desc.add<edm::InputTag>("hf", edm::InputTag("hfreco"));
153  desc.add<edm::InputTag>("ho", edm::InputTag("horeco"));
154  desc.add<edm::InputTag>("basicClusterBarrel", edm::InputTag("islandBasicClusters:islandBarrelBasicClusters"));
155  desc.add<edm::InputTag>("basicClusterEndcap", edm::InputTag("islandBasicClusters:islandEndcapBasicClusters"));
156  desc.add<edm::InputTag>("trackCollection", edm::InputTag("hiGeneralTracks"));
157  desc.add<std::string>("trackQuality", "highPurity");
158 
159  descriptions.add("photonIsolationHIProducer", desc);
160 }
161 
photonIsolationHIProducer(const edm::ParameterSet &ps)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< HORecHitCollection > ho_
edm::EDGetTokenT< HBHERecHitCollection > hbhe_
float ecalClusterIsoR3() const
Cluster-based isolation (ECAL) R = 0.3.
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< reco::BasicClusterCollection > endcapClusters_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
Definition: config.py:1
float ecalClusterIsoR4() const
Cluster-based isolation (ECAL) R = 0.4.
float swissCrx() const
SwissCross crystal ratio.
double getBkgSubEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the background-subtracted ecal cluster energy in a cone around the SC.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
float hcalRechitIsoR5() const
Rechit-based isolation (HCAL) R = 0.5.
ESData get(edm::EventSetup const &eventSetup) const
T const * product() const
Definition: ESHandle.h:86
float trackIsoR5PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.5.
edm::EDGetTokenT< HFRecHitCollection > hf_
float ecalClusterIsoR2() const
Cluster-based isolation (ECAL) R = 0.2.
float ecalClusterIsoR5() const
Cluster-based isolation (ECAL) R = 0.5.
float ecalClusterIsoR1() const
Cluster-based isolation (ECAL) R = 0.1.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
float trackIsoR2PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.2.
float hcalRechitIsoR1() const
Rechit-based isolation (HCAL) R = 0.1.
void produce(edm::Event &evt, const edm::EventSetup &es) override
trackCollection
Definition: JetHT_cfg.py:50
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isValid() const
Definition: ESHandle.h:44
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: DetId.h:17
edm::EDGetTokenT< reco::BasicClusterCollection > barrelClusters_
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
float hcalRechitIsoR2() const
Rechit-based isolation (HCAL) R = 0.2.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double getBkgSubTrackIso(reco::Photon const &clus, const double i, const double threshold, const double innerDR=0)
Return the background-subtracted tracker energy in a cone around the photon.
float trackIsoR3PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.3.
float hcalRechitIsoR3() const
Rechit-based isolation (HCAL) R = 0.3.
HLT enums.
edm::EDGetTokenT< reco::PhotonCollection > photonProducer_
float trackIsoR4PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.4.
double getBkgSubHcalRechitIso(const reco::SuperClusterRef clus, const double i, const double threshold, const double innerR=0.0)
Return the background-subtracted hcal rechit energy in a cone around the SC.
float seedTime() const
Ecal rechit seed time.
float trackIsoR1PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.1.
edm::EDGetTokenT< reco::TrackCollection > tracks_
def move(src, dest)
Definition: eostools.py:511
float hcalRechitIsoR4() const
Rechit-based isolation (HCAL) R = 0.4.
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_