CMS 3D CMS Logo

EgammaHLTClusterShapeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaHLTProducers
4 // Class: EgammaHLTClusterShapeProducer
5 //
8 //
9 // Original Author: Roberto Covarelli (CERN)
10 // Created: Tue Jun 13 14:48:33 CEST 2006
11 // $Id: EgammaHLTClusterShapeProducer.h,v 1.1 2009/01/15 14:28:27 covarell Exp $
12 //
13 //
14 
28 
30 public:
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
36 
37 private:
38  // ----------member data ---------------------------
39 
45  const bool useIEta_;
46  const double multThresEB_;
47  const double multThresEE_;
48 };
49 
51  : recoEcalCandidateProducer_(consumes(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
52  ecalRechitEBToken_(consumes(config.getParameter<edm::InputTag>("ecalRechitEB"))),
53  ecalRechitEEToken_(consumes(config.getParameter<edm::InputTag>("ecalRechitEE"))),
54  ecalClusterLazyToolsESGetTokens_{consumesCollector()},
55  ecalPFRechitThresholdsToken_{esConsumes()},
56  useIEta_(config.getParameter<bool>("isIeta")),
57  multThresEB_(config.getParameter<double>("multThresEB")),
58  multThresEE_(config.getParameter<double>("multThresEE")) {
59  //register your products
60  produces<reco::RecoEcalCandidateIsolationMap>();
61  produces<reco::RecoEcalCandidateIsolationMap>("sigmaIEtaIEta5x5");
62  produces<reco::RecoEcalCandidateIsolationMap>("sigmaIEtaIEta5x5NoiseCleaned");
63  produces<reco::RecoEcalCandidateIsolationMap>("sigmaIPhiIPhi");
64  produces<reco::RecoEcalCandidateIsolationMap>("sigmaIPhiIPhi5x5");
65  produces<reco::RecoEcalCandidateIsolationMap>("sigmaIPhiIPhi5x5NoiseCleaned");
66 }
67 
69 
72  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
73  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEB"));
74  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEE"));
75  desc.add<bool>(("isIeta"), true);
76  desc.add<double>(("multThresEB"), EgammaLocalCovParamDefaults::kMultThresEB);
77  desc.add<double>(("multThresEE"), EgammaLocalCovParamDefaults::kMultThresEE);
78  descriptions.add(("hltEgammaHLTClusterShapeProducer"), desc);
79 }
80 
83  const edm::EventSetup& iSetup) const {
84  // Get the HLT filtered objects
86  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
87 
88  auto const& ecalClusterLazyToolsESData = ecalClusterLazyToolsESGetTokens_.get(iSetup);
89  auto const& thresholds = iSetup.getData(ecalPFRechitThresholdsToken_);
90 
91  EcalClusterLazyTools lazyTools(iEvent, ecalClusterLazyToolsESData, ecalRechitEBToken_, ecalRechitEEToken_);
92  noZS::EcalClusterLazyTools lazyTools5x5(iEvent, ecalClusterLazyToolsESData, ecalRechitEBToken_, ecalRechitEEToken_);
93 
94  //Map is for sigmaIEtaIEta
95  reco::RecoEcalCandidateIsolationMap clshMap(recoecalcandHandle);
96  reco::RecoEcalCandidateIsolationMap clsh5x5Map(recoecalcandHandle);
97  reco::RecoEcalCandidateIsolationMap clsh5x5NoiseCleanedMap(recoecalcandHandle);
98 
99  //Map2 is for sigmaIPhiIPhi
100  reco::RecoEcalCandidateIsolationMap clshMap2(recoecalcandHandle);
101  reco::RecoEcalCandidateIsolationMap clsh5x5Map2(recoecalcandHandle);
102  reco::RecoEcalCandidateIsolationMap clsh5x5NoiseCleanedMap2(recoecalcandHandle);
103 
104  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoecalcandHandle->size(); iRecoEcalCand++) {
105  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);
106  if (recoecalcandref->superCluster()->seed()->seed().det() != DetId::Ecal) { //HGCAL, skip for now
107  clshMap.insert(recoecalcandref, 0);
108  clsh5x5Map.insert(recoecalcandref, 0);
109  clsh5x5NoiseCleanedMap.insert(recoecalcandref, 0);
110 
111  clshMap2.insert(recoecalcandref, 0);
112  clsh5x5Map2.insert(recoecalcandref, 0);
113  clsh5x5NoiseCleanedMap2.insert(recoecalcandref, 0);
114 
115  continue;
116  }
117 
118  double sigmaee;
119  double sigmapp; //sigmaIphiIphi, needed in e/gamma HLT regression setup
120  if (useIEta_) {
121  //this is fractional showershape (sigmaIEtaIEta / sigmaIPhiIPhi)
122  const auto& vCov = lazyTools.localCovariances(*(recoecalcandref->superCluster()->seed()));
123  sigmaee = sqrt(vCov[0]);
124  sigmapp = sqrt(vCov[2]);
125  } else {
126  //this is showershape using absolute geometry (sigmaEtaEta / sigmaPhiPhi)
127  //generally not used anymore
128  const auto& vCov = lazyTools.covariances(*(recoecalcandref->superCluster()->seed()));
129  sigmaee = sqrt(vCov[0]);
130  sigmapp = sqrt(vCov[2]);
131  double EtaSC = recoecalcandref->eta();
132  if (EtaSC > 1.479)
133  sigmaee = sigmaee - 0.02 * (EtaSC - 2.3);
134  }
135 
136  //this is full5x5 showershape
137  auto const ecalCandLocalCov = lazyTools5x5.localCovariances(*(recoecalcandref->superCluster()->seed()));
138  auto const sigmaee5x5 = sqrt(ecalCandLocalCov[0]);
139  auto const sigmapp5x5 = sqrt(ecalCandLocalCov[2]);
140 
141  auto const ecalCandLocalCovNoiseCleaned = lazyTools5x5.localCovariances(*(recoecalcandref->superCluster()->seed()),
143  &thresholds,
144  multThresEB_,
145  multThresEE_);
146  auto const sigmaee5x5NoiseCleaned = sqrt(ecalCandLocalCovNoiseCleaned[0]);
147  auto const sigmapp5x5NoiseCleaned = sqrt(ecalCandLocalCovNoiseCleaned[2]);
148 
149  clshMap.insert(recoecalcandref, sigmaee);
150  clsh5x5Map.insert(recoecalcandref, sigmaee5x5);
151  clsh5x5NoiseCleanedMap.insert(recoecalcandref, sigmaee5x5NoiseCleaned);
152 
153  clshMap2.insert(recoecalcandref, sigmapp);
154  clsh5x5Map2.insert(recoecalcandref, sigmapp5x5);
155  clsh5x5NoiseCleanedMap2.insert(recoecalcandref, sigmapp5x5NoiseCleaned);
156  }
157 
158  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clshMap));
159  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clsh5x5Map), "sigmaIEtaIEta5x5");
160  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clsh5x5NoiseCleanedMap),
161  "sigmaIEtaIEta5x5NoiseCleaned");
162 
163  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clshMap2), "sigmaIPhiIPhi");
164  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clsh5x5Map2), "sigmaIPhiIPhi5x5");
165  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(clsh5x5NoiseCleanedMap2),
166  "sigmaIPhiIPhi5x5NoiseCleaned");
167 }
168 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: config.py:1
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
EgammaHLTClusterShapeProducer(const edm::ParameterSet &)
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRechitThresholdsToken_
ESData get(edm::EventSetup const &eventSetup) const
int iEvent
Definition: GenABIO.cc:224
const EcalClusterLazyTools::ESGetTokens ecalClusterLazyToolsESGetTokens_
std::array< float, 3 > localCovariances(const reco::BasicCluster &cluster, float w0=EgammaLocalCovParamDefaults::kRelEnCut, const EcalPFRecHitThresholds *rhthresholds=nullptr, float multEB=0.0, float multEE=0.0) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:19
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void insert(const key_type &k, const data_type &v)
insert an association
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_