CMS 3D CMS Logo

EgammaHLTHGCalIDVarProducer.cc
Go to the documentation of this file.
20 
22 public:
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27  void produce(edm::Event&, const edm::EventSetup&) override;
28 
29  class PCAAssocMap {
30  public:
32 
34  assocMap_ = std::make_unique<reco::RecoEcalCandidateIsolationMap>(candHandle);
35  }
36 
38  assocMap_->insert(ref, showerWidths.*var_);
39  }
40 
41  std::unique_ptr<reco::RecoEcalCandidateIsolationMap> releaseMap() { return std::move(assocMap_); }
42  const std::string& name() const { return name_; }
43 
44  private:
47  std::unique_ptr<reco::RecoEcalCandidateIsolationMap> assocMap_;
48  };
49 
50 private:
51  // ----------member data ---------------------------
52  float rCylinder_;
53  float hOverECone_;
54  std::vector<PCAAssocMap> pcaAssocMaps_;
59 };
60 
62  : rCylinder_(config.getParameter<double>("rCylinder")),
63  hOverECone_(config.getParameter<double>("hOverECone")),
64  recoEcalCandidateToken_(
65  consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
66  hgcalRecHitToken_(consumes<reco::PFRecHitCollection>(config.getParameter<edm::InputTag>("hgcalRecHits"))),
67  layerClusterToken_(consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusters"))),
68  ssHelper_(consumesCollector()) {
78 
79  produces<reco::RecoEcalCandidateIsolationMap>("rVar");
80  produces<reco::RecoEcalCandidateIsolationMap>("hForHOverE");
81  for (auto& var : pcaAssocMaps_) {
82  produces<reco::RecoEcalCandidateIsolationMap>(var.name());
83  }
84 }
85 
87 
90  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidate"));
91  desc.add<edm::InputTag>("hgcalRecHits", edm::InputTag("hgcalRecHits"));
92  desc.add<edm::InputTag>("layerClusters", edm::InputTag("layerClusters"));
93  desc.add<double>("rCylinder", EgammaHGCALIDParamDefaults::kRCylinder);
94  desc.add<double>("hOverECone", 0.15);
95  descriptions.add(("hltEgammaHLTHGCalIDVarProducer"), desc);
96 }
97 
99  auto recoEcalCandHandle = iEvent.getHandle(recoEcalCandidateToken_);
100  const auto& hgcalRecHits = iEvent.get(hgcalRecHitToken_);
101  const auto& layerClusters = iEvent.get(layerClusterToken_);
102 
104 
105  auto rVarMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
106  auto hForHoverEMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
107  for (auto& pcaMap : pcaAssocMaps_) {
108  pcaMap.initMap(recoEcalCandHandle);
109  }
110 
111  for (size_t candNr = 0; candNr < recoEcalCandHandle->size(); candNr++) {
112  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle, candNr);
113  auto ssCalc = ssHelper_.createCalc(*candRef->superCluster());
114  rVarMap->insert(candRef, ssCalc.getRvar(rCylinder_));
115 
116  float hForHoverE = HGCalClusterTools::hadEnergyInCone(
117  candRef->superCluster()->eta(), candRef->superCluster()->phi(), layerClusters, 0., hOverECone_, 0., 0.);
118  hForHoverEMap->insert(candRef, hForHoverE);
119  auto pcaWidths = ssCalc.getPCAWidths(rCylinder_);
120  for (auto& pcaMap : pcaAssocMaps_) {
121  pcaMap.insert(candRef, pcaWidths);
122  }
123  }
124  iEvent.put(std::move(rVarMap), "rVar");
125  iEvent.put(std::move(hForHoverEMap), "hForHOverE");
126  for (auto& pcaMap : pcaAssocMaps_) {
127  iEvent.put(pcaMap.releaseMap(), pcaMap.name());
128  }
129 }
130 
RecoEcalCandidateIsolation.h
ConfigurationDescriptions.h
reco::RecoEcalCandidateCollection
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
Definition: RecoEcalCandidateFwd.h:9
EgammaHLTHGCalIDVarProducer::PCAAssocMap::name_
std::string name_
Definition: EgammaHLTHGCalIDVarProducer.cc:46
HGCalShowerShapeHelper::ShowerWidths::sigma2yy
double sigma2yy
Definition: HGCalShowerShapeHelper.h:49
edm::EDGetTokenT< reco::RecoEcalCandidateCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
EgammaHLTHGCalIDVarProducer::PCAAssocMap::var_
double HGCalShowerShapeHelper::ShowerWidths::* var_
Definition: EgammaHLTHGCalIDVarProducer.cc:45
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HGCalShowerShapeHelper::ShowerWidths::sigma2uu
double sigma2uu
Definition: HGCalShowerShapeHelper.h:56
EgammaHLTHGCalIDVarProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EgammaHLTHGCalIDVarProducer.cc:98
EDProducer.h
EgammaHLTHGCalIDVarProducer::EgammaHLTHGCalIDVarProducer
EgammaHLTHGCalIDVarProducer(const edm::ParameterSet &)
Definition: EgammaHLTHGCalIDVarProducer.cc:61
EgammaHLTHGCalIDVarProducer::hOverECone_
float hOverECone_
Definition: EgammaHLTHGCalIDVarProducer.cc:53
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
HGCalClusterTools.h
EgammaHLTHGCalIDVarProducer::PCAAssocMap::assocMap_
std::unique_ptr< reco::RecoEcalCandidateIsolationMap > assocMap_
Definition: EgammaHLTHGCalIDVarProducer.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
PFRecHit.h
edm::Ref
Definition: AssociativeIterator.h:58
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
EgammaHLTHGCalIDVarProducer::PCAAssocMap::name
const std::string & name() const
Definition: EgammaHLTHGCalIDVarProducer.cc:42
config
Definition: config.py:1
MakerMacros.h
reco::PFRecHitCollection
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
EgammaHLTHGCalIDVarProducer::PCAAssocMap::PCAAssocMap
PCAAssocMap(double HGCalShowerShapeHelper::ShowerWidths::*var, const std::string &name)
Definition: EgammaHLTHGCalIDVarProducer.cc:31
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EgammaHGCALIDParamDefaults.h
EgammaHLTHGCalIDVarProducer::recoEcalCandidateToken_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:55
EgammaHLTHGCalIDVarProducer::PCAAssocMap::initMap
void initMap(const edm::Handle< reco::RecoEcalCandidateCollection > &candHandle)
Definition: EgammaHLTHGCalIDVarProducer.cc:33
reco::CaloClusterCollection
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
Definition: CaloClusterFwd.h:19
HGCalShowerShapeHelper::ShowerWidths::sigma2vv
double sigma2vv
Definition: HGCalShowerShapeHelper.h:57
CaloClusterFwd.h
HGCalShowerShapeHelper::ShowerWidths::sigma2zz
double sigma2zz
Definition: HGCalShowerShapeHelper.h:50
HGCalShowerShapeHelper.h
HGCalShowerShapeHelper::ShowerWidths
Definition: HGCalShowerShapeHelper.h:47
ParameterSetDescription.h
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
HGCalShowerShapeHelper::ShowerWidths::sigma2yz
double sigma2yz
Definition: HGCalShowerShapeHelper.h:53
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
EgammaHLTHGCalIDVarProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaHLTHGCalIDVarProducer.cc:88
EgammaHLTHGCalIDVarProducer::hgcalRecHitToken_
const edm::EDGetTokenT< reco::PFRecHitCollection > hgcalRecHitToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:56
EgammaHLTHGCalIDVarProducer::layerClusterToken_
const edm::EDGetTokenT< reco::CaloClusterCollection > layerClusterToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:57
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalShowerShapeHelper::createCalc
HGCalShowerShapeHelper::ShowerShapeCalc createCalc(const std::vector< std::pair< DetId, float > > &hitsAndFracs, double rawEnergy, double minHitE=0, double minHitET=0, int minLayer=1, int maxLayer=-1, DetId::Detector subDet=DetId::HGCalEE) const
Event.h
EgammaHGCALIDParamDefaults::kRCylinder
static constexpr float kRCylinder
Definition: EgammaHGCALIDParamDefaults.h:5
EgammaHLTHGCalIDVarProducer::~EgammaHLTHGCalIDVarProducer
~EgammaHLTHGCalIDVarProducer() override
Definition: EgammaHLTHGCalIDVarProducer.cc:86
iEvent
int iEvent
Definition: GenABIO.cc:224
HGCalShowerShapeHelper::ShowerWidths::sigma2xy
double sigma2xy
Definition: HGCalShowerShapeHelper.h:52
EgammaHLTHGCalIDVarProducer::PCAAssocMap::releaseMap
std::unique_ptr< reco::RecoEcalCandidateIsolationMap > releaseMap()
Definition: EgammaHLTHGCalIDVarProducer.cc:41
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalShowerShapeHelper::ShowerWidths::sigma2ww
double sigma2ww
Definition: HGCalShowerShapeHelper.h:58
EgammaHLTHGCalIDVarProducer::ssHelper_
HGCalShowerShapeHelper ssHelper_
Definition: EgammaHLTHGCalIDVarProducer.cc:58
particleFlowSuperClusteringSequence_cff.hgcalRecHits
hgcalRecHits
Definition: particleFlowSuperClusteringSequence_cff.py:38
EgammaHLTHGCalIDVarProducer::rCylinder_
float rCylinder_
Definition: EgammaHLTHGCalIDVarProducer.cc:52
EgammaHLTHGCalIDVarProducer
Definition: EgammaHLTHGCalIDVarProducer.cc:21
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalClusterTools::hadEnergyInCone
static float hadEnergyInCone(const float eta, const float phi, const std::vector< reco::CaloCluster > &layerClusters, const float minDR, const float maxDR, const float minEt, const float minEnergy, const HGCalClusterTools::EType &eType=EType::ENERGY)
Definition: HGCalClusterTools.h:21
RecoEcalCandidate.h
SuperClusterFwd.h
Frameworkfwd.h
SuperCluster.h
EgammaHLTHGCalIDVarProducer::PCAAssocMap::insert
void insert(reco::RecoEcalCandidateRef &ref, const HGCalShowerShapeHelper::ShowerWidths &showerWidths)
Definition: EgammaHLTHGCalIDVarProducer.cc:37
RecoEcalCandidateFwd.h
EgammaHLTHGCalIDVarProducer::pcaAssocMaps_
std::vector< PCAAssocMap > pcaAssocMaps_
Definition: EgammaHLTHGCalIDVarProducer.cc:54
EgammaHLTHGCalIDVarProducer::PCAAssocMap
Definition: EgammaHLTHGCalIDVarProducer.cc:29
ParameterSet.h
HGCalShowerShapeHelper::ShowerWidths::sigma2zx
double sigma2zx
Definition: HGCalShowerShapeHelper.h:54
HGCalShowerShapeHelper::ShowerWidths::sigma2xx
double sigma2xx
Definition: HGCalShowerShapeHelper.h:48
HGCalShowerShapeHelper::initPerEvent
void initPerEvent(const std::vector< reco::PFRecHit > &recHits)
Definition: HGCalShowerShapeHelper.cc:309
edm::Event
Definition: Event.h:73
HGCalShowerShapeHelper
Definition: HGCalShowerShapeHelper.h:31
edm::InputTag
Definition: InputTag.h:15
CaloCluster.h