CMS 3D CMS Logo

HLTHtMhtProducer.cc
Go to the documentation of this file.
1 
10 
15 
16 // Constructor
18  : usePt_(iConfig.getParameter<bool>("usePt")),
19  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
20  minNJetHt_(iConfig.getParameter<int>("minNJetHt")),
21  minNJetMht_(iConfig.getParameter<int>("minNJetMht")),
22  minPtJetHt_(iConfig.getParameter<double>("minPtJetHt")),
23  minPtJetMht_(iConfig.getParameter<double>("minPtJetMht")),
24  maxEtaJetHt_(iConfig.getParameter<double>("maxEtaJetHt")),
25  maxEtaJetMht_(iConfig.getParameter<double>("maxEtaJetMht")),
26  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
27  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
28  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
29  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
30 
31  // Register the products
32  produces<reco::METCollection>();
33 }
34 
35 // Destructor
37 
38 // Fill descriptions
40  // Current default is for hltHtMht
42  desc.add<bool>("usePt", false);
43  desc.add<bool>("excludePFMuons", false);
44  desc.add<int>("minNJetHt", 0);
45  desc.add<int>("minNJetMht", 0);
46  desc.add<double>("minPtJetHt", 40.);
47  desc.add<double>("minPtJetMht", 30.);
48  desc.add<double>("maxEtaJetHt", 3.);
49  desc.add<double>("maxEtaJetMht", 5.);
50  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetL1FastJetCorrected"));
51  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
52  descriptions.add("hltHtMhtProducer", desc);
53 }
54 
55 // Produce the products
57  // Create a pointer to the products
58  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
59 
60  if (pfCandidatesLabel_.label().empty())
61  excludePFMuons_ = false;
62 
64  iEvent.getByToken(m_theJetToken, jets);
65 
67  if (excludePFMuons_)
69 
70  int nj_ht = 0, nj_mht = 0;
71  double ht = 0., mhx = 0., mhy = 0.;
72 
73  if (!jets->empty()) {
74  for (reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
75  double pt = usePt_ ? j->pt() : j->et();
76  double eta = j->eta();
77  double phi = j->phi();
78  double px = usePt_ ? j->px() : j->et() * cos(phi);
79  double py = usePt_ ? j->py() : j->et() * sin(phi);
80 
81  if (pt > minPtJetHt_ && std::abs(eta) < maxEtaJetHt_) {
82  ht += pt;
83  ++nj_ht;
84  }
85 
87  mhx -= px;
88  mhy -= py;
89  ++nj_mht;
90  }
91  }
92  }
93 
94  if (excludePFMuons_) {
95  for (auto const& j : *pfCandidates) {
96  if (std::abs(j.pdgId()) == 13) {
97  mhx += j.px();
98  mhy += j.py();
99  }
100  }
101  }
102 
103  if (nj_ht < minNJetHt_) {
104  ht = 0;
105  }
106  if (nj_mht < minNJetMht_) {
107  mhx = 0;
108  mhy = 0;
109  }
110 
111  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
112  reco::MET::Point vtx(0, 0, 0);
113  reco::MET htmht(ht, p4, vtx);
114  result->push_back(htmht);
115 
116  // Put the products into the Event
117  iEvent.put(std::move(result));
118 }
ConfigurationDescriptions.h
Handle.h
zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
electrons_cff.bool
bool
Definition: electrons_cff.py:393
MessageLogger.h
HLTHtMhtProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: HLTHtMhtProducer.cc:56
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
HLTHtMhtProducer::usePt_
bool usePt_
Use pt; otherwise, use et.
Definition: HLTHtMhtProducer.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTHtMhtProducer::HLTHtMhtProducer
HLTHtMhtProducer(const edm::ParameterSet &iConfig)
Definition: HLTHtMhtProducer.cc:17
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
HLTHtMhtProducer::jetsLabel_
edm::InputTag jetsLabel_
Input jet, PFCandidate collections.
Definition: HLTHtMhtProducer.h:62
HLTHtMhtProducer::m_theJetToken
edm::EDGetTokenT< reco::JetView > m_theJetToken
Definition: HLTHtMhtProducer.h:65
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::METCollection
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
HLTHtMhtProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTHtMhtProducer.cc:39
reco::MET
Definition: MET.h:41
HLTHtMhtProducer::minNJetMht_
int minNJetMht_
Definition: HLTHtMhtProducer.h:51
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLTHtMhtProducer::pfCandidatesLabel_
edm::InputTag pfCandidatesLabel_
Definition: HLTHtMhtProducer.h:63
ParameterSetDescription.h
HLTHtMhtProducer::excludePFMuons_
bool excludePFMuons_
Definition: HLTHtMhtProducer.h:47
HLTHtMhtProducer::m_thePFCandidateToken
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
Definition: HLTHtMhtProducer.h:66
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLTHtMhtProducer::minPtJetHt_
double minPtJetHt_
Minimum pt requirement for jets.
Definition: HLTHtMhtProducer.h:54
edm::ParameterSet
Definition: ParameterSet.h:47
HLTHtMhtProducer.h
HLTHtMhtProducer::~HLTHtMhtProducer
~HLTHtMhtProducer() override
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup
Definition: EventSetup.h:57
DDAxes::phi
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTHtMhtProducer::maxEtaJetMht_
double maxEtaJetMht_
Definition: HLTHtMhtProducer.h:59
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
HLTHtMhtProducer::minNJetHt_
int minNJetHt_
Minimum number of jets passing pt and eta requirements.
Definition: HLTHtMhtProducer.h:50
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
HLTHtMhtProducer::minPtJetMht_
double minPtJetMht_
Definition: HLTHtMhtProducer.h:55
HLTHtMhtProducer::maxEtaJetHt_
double maxEtaJetHt_
Maximum (abs) eta requirement for jets.
Definition: HLTHtMhtProducer.h:58