CMS 3D CMS Logo

EgammaHLTHGCalIDVarProducer.cc
Go to the documentation of this file.
19 
21 public:
24 
25  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
26  void produce(edm::Event&, const edm::EventSetup&) override;
27 
28  class PCAAssocMap {
29  public:
31 
33  assocMap_ = std::make_unique<reco::RecoEcalCandidateIsolationMap>(candHandle);
34  }
35 
37  assocMap_->insert(ref, showerWidths.*var_);
38  }
39 
40  std::unique_ptr<reco::RecoEcalCandidateIsolationMap> releaseMap() { return std::move(assocMap_); }
41  const std::string& name() const { return name_; }
42 
43  private:
46  std::unique_ptr<reco::RecoEcalCandidateIsolationMap> assocMap_;
47  };
48 
49 private:
50  // ----------member data ---------------------------
51  float rCylinder_;
52  float hOverECone_;
53  std::vector<PCAAssocMap> pcaAssocMaps_;
58 };
59 
61  : rCylinder_(config.getParameter<double>("rCylinder")),
62  hOverECone_(config.getParameter<double>("hOverECone")),
63  recoEcalCandidateToken_(
64  consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
65  hgcalRecHitToken_(consumes<reco::PFRecHitCollection>(config.getParameter<edm::InputTag>("hgcalRecHits"))),
66  layerClusterToken_(consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusters"))),
67  ssCalc_(consumesCollector()) {
77 
78  produces<reco::RecoEcalCandidateIsolationMap>("rVar");
79  produces<reco::RecoEcalCandidateIsolationMap>("hForHOverE");
80  for (auto& var : pcaAssocMaps_) {
81  produces<reco::RecoEcalCandidateIsolationMap>(var.name());
82  }
83 }
84 
86 
89  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidate"));
90  desc.add<edm::InputTag>("hgcalRecHits", edm::InputTag("hgcalRecHits"));
91  desc.add<edm::InputTag>("layerClusters", edm::InputTag("layerClusters"));
92  desc.add<double>("rCylinder", 2.8);
93  desc.add<double>("hOverECone", 0.15);
94  descriptions.add(("hltEgammaHLTHGCalIDVarProducer"), desc);
95 }
96 
98  auto recoEcalCandHandle = iEvent.getHandle(recoEcalCandidateToken_);
99  const auto& hgcalRecHits = iEvent.get(hgcalRecHitToken_);
100  const auto& layerClusters = iEvent.get(layerClusterToken_);
101 
103 
104  auto rVarMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
105  auto hForHoverEMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
106  for (auto& pcaMap : pcaAssocMaps_) {
107  pcaMap.initMap(recoEcalCandHandle);
108  }
109 
110  for (size_t candNr = 0; candNr < recoEcalCandHandle->size(); candNr++) {
111  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle, candNr);
112  ssCalc_.initPerObject(candRef->superCluster()->hitsAndFractions());
113  rVarMap->insert(candRef, ssCalc_.getRvar(rCylinder_, candRef->superCluster()->energy()));
114 
115  float hForHoverE = HGCalClusterTools::hadEnergyInCone(
116  candRef->superCluster()->eta(), candRef->superCluster()->phi(), layerClusters, 0., hOverECone_, 0., 0.);
117  hForHoverEMap->insert(candRef, hForHoverE);
118  auto pcaWidths = ssCalc_.getPCAWidths(rCylinder_);
119  for (auto& pcaMap : pcaAssocMaps_) {
120  pcaMap.insert(candRef, pcaWidths);
121  }
122  }
123  iEvent.put(std::move(rVarMap), "rVar");
124  iEvent.put(std::move(hForHoverEMap), "hForHOverE");
125  for (auto& pcaMap : pcaAssocMaps_) {
126  iEvent.put(pcaMap.releaseMap(), pcaMap.name());
127  }
128 }
129 
RecoEcalCandidateIsolation.h
ConfigurationDescriptions.h
EgammaHLTHGCalIDVarProducer::ssCalc_
HGCalShowerShapeHelper ssCalc_
Definition: EgammaHLTHGCalIDVarProducer.cc:57
HLTEgPhaseIITestSequence_cff.hgcalRecHits
hgcalRecHits
Definition: HLTEgPhaseIITestSequence_cff.py:2505
reco::RecoEcalCandidateCollection
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
Definition: RecoEcalCandidateFwd.h:9
EgammaHLTHGCalIDVarProducer::PCAAssocMap::name_
std::string name_
Definition: EgammaHLTHGCalIDVarProducer.cc:45
HGCalShowerShapeHelper::ShowerWidths::sigma2yy
double sigma2yy
Definition: HGCalShowerShapeHelper.h:64
edm::EDGetTokenT< reco::RecoEcalCandidateCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
EgammaHLTHGCalIDVarProducer::PCAAssocMap::var_
double HGCalShowerShapeHelper::ShowerWidths::* var_
Definition: EgammaHLTHGCalIDVarProducer.cc:44
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HGCalShowerShapeHelper::ShowerWidths::sigma2uu
double sigma2uu
Definition: HGCalShowerShapeHelper.h:71
EgammaHLTHGCalIDVarProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EgammaHLTHGCalIDVarProducer.cc:97
EDProducer.h
EgammaHLTHGCalIDVarProducer::EgammaHLTHGCalIDVarProducer
EgammaHLTHGCalIDVarProducer(const edm::ParameterSet &)
Definition: EgammaHLTHGCalIDVarProducer.cc:60
EgammaHLTHGCalIDVarProducer::hOverECone_
float hOverECone_
Definition: EgammaHLTHGCalIDVarProducer.cc:52
HGCalShowerShapeHelper::initPerEvent
void initPerEvent(const edm::EventSetup &iSetup, const std::vector< reco::PFRecHit > &recHits)
Definition: HGCalShowerShapeHelper.cc:9
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HGCalClusterTools.h
EgammaHLTHGCalIDVarProducer::PCAAssocMap::assocMap_
std::unique_ptr< reco::RecoEcalCandidateIsolationMap > assocMap_
Definition: EgammaHLTHGCalIDVarProducer.cc:46
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:41
config
Definition: config.py:1
MakerMacros.h
HGCalShowerShapeHelper::initPerObject
void initPerObject(const std::vector< std::pair< DetId, float > > &hitsAndFracs, double minHitE=0, double minHitET=0, int minLayer=1, int maxLayer=-1, DetId::Detector subDet=DetId::HGCalEE)
Definition: HGCalShowerShapeHelper.cc:14
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:30
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
EgammaHLTHGCalIDVarProducer::recoEcalCandidateToken_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:54
EgammaHLTHGCalIDVarProducer::PCAAssocMap::initMap
void initMap(const edm::Handle< reco::RecoEcalCandidateCollection > &candHandle)
Definition: EgammaHLTHGCalIDVarProducer.cc:32
reco::CaloClusterCollection
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
Definition: CaloClusterFwd.h:19
HGCalShowerShapeHelper::ShowerWidths::sigma2vv
double sigma2vv
Definition: HGCalShowerShapeHelper.h:72
CaloClusterFwd.h
HGCalShowerShapeHelper::ShowerWidths::sigma2zz
double sigma2zz
Definition: HGCalShowerShapeHelper.h:65
HGCalShowerShapeHelper.h
HGCalShowerShapeHelper::ShowerWidths
Definition: HGCalShowerShapeHelper.h:62
ParameterSetDescription.h
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
HGCalShowerShapeHelper::ShowerWidths::sigma2yz
double sigma2yz
Definition: HGCalShowerShapeHelper.h:68
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EgammaHLTHGCalIDVarProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaHLTHGCalIDVarProducer.cc:87
EgammaHLTHGCalIDVarProducer::hgcalRecHitToken_
const edm::EDGetTokenT< reco::PFRecHitCollection > hgcalRecHitToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:55
EgammaHLTHGCalIDVarProducer::layerClusterToken_
const edm::EDGetTokenT< reco::CaloClusterCollection > layerClusterToken_
Definition: EgammaHLTHGCalIDVarProducer.cc:56
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EgammaHLTHGCalIDVarProducer::~EgammaHLTHGCalIDVarProducer
~EgammaHLTHGCalIDVarProducer() override
Definition: EgammaHLTHGCalIDVarProducer.cc:85
iEvent
int iEvent
Definition: GenABIO.cc:224
HGCalShowerShapeHelper::ShowerWidths::sigma2xy
double sigma2xy
Definition: HGCalShowerShapeHelper.h:67
EgammaHLTHGCalIDVarProducer::PCAAssocMap::releaseMap
std::unique_ptr< reco::RecoEcalCandidateIsolationMap > releaseMap()
Definition: EgammaHLTHGCalIDVarProducer.cc:40
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
HGCalShowerShapeHelper::getRvar
const double getRvar(double cylinderR, double energyNorm, bool useFractions=true, bool useCellSize=true)
Definition: HGCalShowerShapeHelper.cc:137
HGCalShowerShapeHelper::ShowerWidths::sigma2ww
double sigma2ww
Definition: HGCalShowerShapeHelper.h:73
EgammaHLTHGCalIDVarProducer::rCylinder_
float rCylinder_
Definition: EgammaHLTHGCalIDVarProducer.cc:51
EgammaHLTHGCalIDVarProducer
Definition: EgammaHLTHGCalIDVarProducer.cc:20
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
HGCalShowerShapeHelper::getPCAWidths
const ShowerWidths getPCAWidths(double cylinderR, bool useFractions=false)
Definition: HGCalShowerShapeHelper.cc:188
Frameworkfwd.h
SuperCluster.h
EgammaHLTHGCalIDVarProducer::PCAAssocMap::insert
void insert(reco::RecoEcalCandidateRef &ref, const HGCalShowerShapeHelper::ShowerWidths &showerWidths)
Definition: EgammaHLTHGCalIDVarProducer.cc:36
RecoEcalCandidateFwd.h
EgammaHLTHGCalIDVarProducer::pcaAssocMaps_
std::vector< PCAAssocMap > pcaAssocMaps_
Definition: EgammaHLTHGCalIDVarProducer.cc:53
EgammaHLTHGCalIDVarProducer::PCAAssocMap
Definition: EgammaHLTHGCalIDVarProducer.cc:28
ParameterSet.h
HGCalShowerShapeHelper::ShowerWidths::sigma2zx
double sigma2zx
Definition: HGCalShowerShapeHelper.h:69
HGCalShowerShapeHelper::ShowerWidths::sigma2xx
double sigma2xx
Definition: HGCalShowerShapeHelper.h:63
edm::Event
Definition: Event.h:73
HGCalShowerShapeHelper
Definition: HGCalShowerShapeHelper.h:46
edm::InputTag
Definition: InputTag.h:15
CaloCluster.h