CMS 3D CMS Logo

EgammaHLTCaloTowerProducer.cc
Go to the documentation of this file.
1 
19 
22 
25 
26 #include "Math/GenVector/VectorUtil.h"
27 
28 #include <cmath>
29 #include <string>
30 
32 public:
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const final;
37 
39  const double cone_;
42  const double EtThreshold_;
43  const double EThreshold_;
44 };
45 
46 using namespace edm;
47 using namespace reco;
48 using namespace std;
49 using namespace l1extra;
50 
52  : towers_(consumes<CaloTowerCollection>(p.getParameter<InputTag>("towerCollection"))),
53  cone_(p.getParameter<double>("useTowersInCone")),
54  l1isoseeds_(consumes<edm::View<reco::Candidate>>(p.getParameter<edm::InputTag>("L1IsoCand"))),
55  l1nonisoseeds_(consumes<edm::View<reco::Candidate>>(p.getParameter<edm::InputTag>("L1NonIsoCand"))),
56  EtThreshold_(p.getParameter<double>("EtMin")),
57  EThreshold_(p.getParameter<double>("EMin")) {
58  produces<CaloTowerCollection>();
59 }
60 
63 
64  desc.add<edm::InputTag>(("towerCollection"), edm::InputTag("hltRecoEcalCandidate"));
65  desc.add<edm::InputTag>(("L1IsoCand"), edm::InputTag("hltTowerMakerForAll"));
66  desc.add<edm::InputTag>(("L1NonIsoCand"), edm::InputTag("fixedGridRhoFastjetAllCalo"));
67  desc.add<double>(("useTowersInCone"), 0.8);
68  desc.add<double>(("EtMin"), 1.0);
69  desc.add<double>(("EMin"), 1.0);
70  descriptions.add(("hltCaloTowerForEgamma"), desc);
71 }
72 
76 
78  evt.getByToken(l1isoseeds_, emIsolColl);
80  evt.getByToken(l1nonisoseeds_, emNonIsolColl);
81  auto cands = std::make_unique<CaloTowerCollection>();
82  cands->reserve(caloTowers->size());
83 
84  for (unsigned idx = 0; idx < caloTowers->size(); idx++) {
85  const CaloTower* cal = &((*caloTowers)[idx]);
86  if (cal->et() >= EtThreshold_ && cal->energy() >= EThreshold_) {
87  bool fill = false;
88  math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
89  for (edm::View<reco::Candidate>::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end();
90  ++emItr) {
91  double delta = ROOT::Math::VectorUtil::DeltaR((*emItr).p4().Vect(), p);
92  if (delta < cone_) {
93  cands->push_back(*cal);
94  fill = true;
95  break;
96  }
97  }
98 
99  if (!fill) {
100  for (edm::View<reco::Candidate>::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end();
101  ++emItr) {
102  double delta = ROOT::Math::VectorUtil::DeltaR((*emItr).p4().Vect(), p);
103  if (delta < cone_) {
104  cands->push_back(*cal);
105  break;
106  }
107  }
108  }
109  }
110  }
111 
112  evt.put(std::move(cands));
113 }
114 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
Handle.h
CaloTower.h
EgammaHLTCaloTowerProducer::EtThreshold_
const double EtThreshold_
Definition: EgammaHLTCaloTowerProducer.cc:42
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
math::PtEtaPhiELorentzVector
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
edm::SortedCollection< CaloTower >
EgammaHLTCaloTowerProducer::produce
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const final
Definition: EgammaHLTCaloTowerProducer.cc:73
EgammaHLTCaloTowerProducer::towers_
const edm::EDGetTokenT< CaloTowerCollection > towers_
Definition: EgammaHLTCaloTowerProducer.cc:38
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
EgammaHLTCaloTowerProducer::EThreshold_
const double EThreshold_
Definition: EgammaHLTCaloTowerProducer.cc:43
edm::Handle
Definition: AssociativeIterator.h:50
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
EgammaHLTCaloTowerProducer::l1nonisoseeds_
const edm::EDGetTokenT< edm::View< reco::Candidate > > l1nonisoseeds_
Definition: EgammaHLTCaloTowerProducer.cc:41
MakerMacros.h
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
CaloTowerDefs.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
L1EmParticleFwd.h
edm::View
Definition: CaloClusterFwd.h:14
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15161
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Event.h
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
eleHcalExtractorBlocks_cff.caloTowers
caloTowers
Definition: eleHcalExtractorBlocks_cff.py:15
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
CaloTower
Definition: CaloTower.h:26
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
CaloTower::et
double et(double vtxZ) const
Definition: CaloTower.h:150
EgammaHLTCaloTowerProducer
Definition: EgammaHLTCaloTowerProducer.cc:31
edm::EventSetup
Definition: EventSetup.h:58
L1EmParticle.h
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
InputTag.h
reco::Candidate
Definition: Candidate.h:27
EgammaHLTCaloTowerProducer::~EgammaHLTCaloTowerProducer
~EgammaHLTCaloTowerProducer() override
Definition: EgammaHLTCaloTowerProducer.cc:34
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
EgammaHLTCaloTowerProducer::l1isoseeds_
const edm::EDGetTokenT< edm::View< reco::Candidate > > l1isoseeds_
Definition: EgammaHLTCaloTowerProducer.cc:40
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
EgammaHLTCaloTowerProducer::cone_
const double cone_
Definition: EgammaHLTCaloTowerProducer.cc:39
EgammaHLTCaloTowerProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaHLTCaloTowerProducer.cc:61
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
ParameterSet.h
RecoCaloTowerCandidate.h
EDProducer.h
l1extra
Definition: L1EmParticle.h:26
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
EgammaHLTCaloTowerProducer::EgammaHLTCaloTowerProducer
EgammaHLTCaloTowerProducer(const edm::ParameterSet &)
Definition: EgammaHLTCaloTowerProducer.cc:51