CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
66  evt.getByToken(photonProducer_, photons);
68  evt.getByToken(barrelEcalHits_, barrelEcalHits);
70  evt.getByToken(endcapEcalHits_, endcapEcalHits);
72  evt.getByToken(hbhe_, hbhe);
74  evt.getByToken(hf_, hf);
76  evt.getByToken(ho_, ho);
78  evt.getByToken(barrelClusters_, barrelClusters);
80  evt.getByToken(endcapClusters_, endcapClusters);
82  evt.getByToken(tracks_, trackCollection);
83 
84  auto outputMap = std::make_unique<reco::HIPhotonIsolationMap>();
85  reco::HIPhotonIsolationMap::Filler filler(*outputMap);
86  std::vector<reco::HIPhotonIsolation> isoVector;
87 
88  EcalClusterIsoCalculator CxC(barrelClusters, endcapClusters);
90  const CaloGeometry* geometry = nullptr;
91  if (geometryHandle.isValid()) {
92  geometry = geometryHandle.product();
93  }
94  HcalRechitIsoCalculator RxC(geometry, hbhe, hf, ho);
95  TrackIsoCalculator TxC(*trackCollection, trackQuality_);
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)
float hcalRechitIsoR1() const
Rechit-based isolation (HCAL) R = 0.1.
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 ecalClusterIsoR1() const
Cluster-based isolation (ECAL) R = 0.1.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< reco::BasicClusterCollection > endcapClusters_
float seedTime() const
Ecal rechit seed time.
float hcalRechitIsoR3() const
Rechit-based isolation (HCAL) R = 0.3.
float ecalClusterIsoR4() const
Cluster-based isolation (ECAL) R = 0.4.
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.
string barrelEcalHits
float hcalRechitIsoR4() const
Rechit-based isolation (HCAL) R = 0.4.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
tuple barrelClusters
edm::EDGetTokenT< HFRecHitCollection > hf_
def move
Definition: eostools.py:511
void produce(edm::Event &evt, const edm::EventSetup &es) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
float trackIsoR5PtCut20() const
Track-based isolation, pt&gt;2.0GeV, R = 0.5.
float ecalClusterIsoR5() const
Cluster-based isolation (ECAL) R = 0.5.
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: DetId.h:17
ESData get(edm::EventSetup const &eventSetup) const
tuple trackCollection
float ecalClusterIsoR2() const
Cluster-based isolation (ECAL) R = 0.2.
edm::EDGetTokenT< reco::BasicClusterCollection > barrelClusters_
float hcalRechitIsoR5() const
Rechit-based isolation (HCAL) R = 0.5.
float hcalRechitIsoR2() const
Rechit-based isolation (HCAL) R = 0.2.
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
T const * product() const
Definition: ESHandle.h:86
void add(std::string const &label, ParameterSetDescription const &psetDescription)
float trackIsoR1PtCut20() const
Track-based isolation, pt&gt;2.0GeV, R = 0.1.
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 swissCrx() const
SwissCross crystal ratio.
float trackIsoR4PtCut20() const
Track-based isolation, pt&gt;2.0GeV, R = 0.4.
tuple config
parse the configuration file
edm::EDGetTokenT< reco::PhotonCollection > photonProducer_
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 trackIsoR2PtCut20() const
Track-based isolation, pt&gt;2.0GeV, R = 0.2.
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
bool isValid() const
Definition: ESHandle.h:44
float trackIsoR3PtCut20() const
Track-based isolation, pt&gt;2.0GeV, R = 0.3.
tuple endcapClusters
string endcapEcalHits
float ecalClusterIsoR3() const
Cluster-based isolation (ECAL) R = 0.3.
edm::EDGetTokenT< reco::TrackCollection > tracks_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_