CMS 3D CMS Logo

HLTCaloTowerHtMhtProducer.cc
Go to the documentation of this file.
1 
11 
16 
17 // Constructor
19  : usePt_(iConfig.getParameter<bool>("usePt")),
20  minPtTowerHt_(iConfig.getParameter<double>("minPtTowerHt")),
21  minPtTowerMht_(iConfig.getParameter<double>("minPtTowerMht")),
22  maxEtaTowerHt_(iConfig.getParameter<double>("maxEtaTowerHt")),
23  maxEtaTowerMht_(iConfig.getParameter<double>("maxEtaTowerMht")),
24  towersLabel_(iConfig.getParameter<edm::InputTag>("towersLabel")) {
25  m_theTowersToken = consumes<CaloTowerCollection>(towersLabel_);
26 
27  // Register the products
28  produces<reco::METCollection>();
29 }
30 
31 // Destructor
33 
34 // Fill descriptions
36  // Current default is for hltHtMht
38  desc.add<bool>("usePt", false);
39  desc.add<double>("minPtTowerHt", 1.);
40  desc.add<double>("minPtTowerMht", 1.);
41  desc.add<double>("maxEtaTowerHt", 5.);
42  desc.add<double>("maxEtaTowerMht", 5.);
43  desc.add<edm::InputTag>("towersLabel", edm::InputTag("hltTowerMakerForAll"));
44  descriptions.add("hltCaloTowerHtMhtProducer", desc);
45 }
46 
47 // Produce the products
49  // Create a pointer to the products
50  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
51 
53  iEvent.getByToken(m_theTowersToken, towers);
54 
55  double ht = 0., mhx = 0., mhy = 0.;
56 
57  if (!towers->empty()) {
58  for (auto const& j : *towers) {
59  double pt = usePt_ ? j.pt() : j.et();
60  double eta = j.eta();
61  double phi = j.phi();
62  double px = usePt_ ? j.px() : j.et() * cos(phi);
63  double py = usePt_ ? j.py() : j.et() * sin(phi);
64 
66  ht += pt;
67  }
68 
70  mhx -= px;
71  mhy -= py;
72  }
73  }
74  }
75 
76  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
77  reco::MET::Point vtx(0, 0, 0);
78  reco::MET htmht(ht, p4, vtx);
79  result->push_back(htmht);
80 
81  // Put the products into the Event
82  iEvent.put(std::move(result));
83 }
ConfigurationDescriptions.h
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36362
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
MessageLogger.h
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HLTCaloTowerHtMhtProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTCaloTowerHtMhtProducer.cc:35
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTCaloTowerHtMhtProducer::maxEtaTowerMht_
double maxEtaTowerMht_
Definition: HLTCaloTowerHtMhtProducer.h:48
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
HLTCaloTowerHtMhtProducer::minPtTowerMht_
double minPtTowerMht_
Definition: HLTCaloTowerHtMhtProducer.h:44
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
reco::MET
Definition: MET.h:41
HLTCaloTowerHtMhtProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: HLTCaloTowerHtMhtProducer.cc:48
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
HLTCaloTowerHtMhtProducer::m_theTowersToken
edm::EDGetTokenT< CaloTowerCollection > m_theTowersToken
Definition: HLTCaloTowerHtMhtProducer.h:52
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLTCaloTowerHtMhtProducer::minPtTowerHt_
double minPtTowerHt_
Minimum pt requirement for jets.
Definition: HLTCaloTowerHtMhtProducer.h:43
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
HLTCaloTowerHtMhtProducer.h
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
HLTCaloTowerHtMhtProducer::maxEtaTowerHt_
double maxEtaTowerHt_
Maximum (abs) eta requirement for jets.
Definition: HLTCaloTowerHtMhtProducer.h:47
edm::EventSetup
Definition: EventSetup.h:57
HLTCaloTowerHtMhtProducer::usePt_
bool usePt_
Use pt; otherwise, use et.
Definition: HLTCaloTowerHtMhtProducer.h:40
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
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
HLTCaloTowerHtMhtProducer::towersLabel_
edm::InputTag towersLabel_
Input CaloTower collection.
Definition: HLTCaloTowerHtMhtProducer.h:51
HLTCaloTowerHtMhtProducer::HLTCaloTowerHtMhtProducer
HLTCaloTowerHtMhtProducer(const edm::ParameterSet &iConfig)
Definition: HLTCaloTowerHtMhtProducer.cc:18
HLTCaloTowerHtMhtProducer::~HLTCaloTowerHtMhtProducer
~HLTCaloTowerHtMhtProducer() override
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