Skip to content

Commit 5112f8e

Browse files
committed
Store trigObj filterBits as uint64.
1 parent 27a7eb0 commit 5112f8e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class TriggerObjectTableProducer : public edm::stream::EDProducer<> {
111111
if (qualityBitsConfig[i].existsAs<unsigned int>("bit"))
112112
bit = qualityBitsConfig[i].getParameter<unsigned int>("bit");
113113
assert(!bits[bit] && "a quality bit was inserted twice"); // the bit should not have been set already
114-
assert(bit < 31 && "quality bits are store on 32 bit");
114+
assert(bit < 64 && "quality bits are store on 64 bits");
115115
bits[bit] = true;
116-
qualityBitsFunc << std::to_string(int(pow(2, bit))) << "*("
116+
qualityBitsFunc << std::to_string(1UL << bit) << "*("
117117
<< qualityBitsConfig[i].getParameter<std::string>("selection") << ")";
118118
qualityBitsDoc += std::to_string(bit) + " => " + qualityBitsConfig[i].getParameter<std::string>("doc");
119119
}
@@ -147,12 +147,12 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet
147147
const auto &trigObjs = iEvent.get(src_);
148148

149149
std::vector<std::pair<const pat::TriggerObjectStandAlone *, const SelectedObject *>> selected;
150-
std::map<int, std::map<const pat::TriggerObjectStandAlone *, int>> selected_bits;
150+
std::map<int, std::map<const pat::TriggerObjectStandAlone *, uint64_t>> selected_bits;
151151
for (const auto &obj : trigObjs) {
152152
for (const auto &sel : sels_) {
153153
if (sel.match(obj)) {
154-
selected_bits[sel.id][&obj] = int(sel.qualityBits(obj));
155-
if (sel.skipObjectsNotPassingQualityBits ? (selected_bits[sel.id][&obj] > 0) : true) {
154+
selected_bits[sel.id][&obj] = sel.qualityBits(obj);
155+
if (sel.skipObjectsNotPassingQualityBits ? (selected_bits[sel.id][&obj] != 0) : true) {
156156
selected.emplace_back(&obj, &sel);
157157
}
158158
}
@@ -269,7 +269,8 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet
269269
std::vector<float> pt(nobj, 0), eta(nobj, 0), phi(nobj, 0), l1pt(nobj, 0), l1pt_2(nobj, 0), l2pt(nobj, 0);
270270
std::vector<int16_t> l1charge(nobj, 0);
271271
std::vector<uint16_t> id(nobj, 0);
272-
std::vector<int> bits(nobj, 0), l1iso(nobj, 0);
272+
std::vector<uint64_t> bits(nobj, 0);
273+
std::vector<int> l1iso(nobj, 0);
273274
for (unsigned int i = 0; i < nobj; ++i) {
274275
const auto &obj = *selected[i].first;
275276
const auto &sel = *selected[i].second;
@@ -324,7 +325,7 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet
324325
tab->addColumn<int16_t>("l1charge", l1charge, "charge of associated L1 seed");
325326
tab->addColumn<float>("l1pt_2", l1pt_2, "pt of associated secondary L1 seed", 8);
326327
tab->addColumn<float>("l2pt", l2pt, "pt of associated 'L2' seed (i.e. HLT before tracking/PF)", 10);
327-
tab->addColumn<int>("filterBits", bits, "extra bits of associated information: " + bitsDoc_);
328+
tab->addColumn<uint64_t>("filterBits", bits, "extra bits of associated information: " + bitsDoc_);
328329
iEvent.put(std::move(tab));
329330
}
330331

PhysicsTools/NanoAOD/python/nanoDQM_cfi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@
986986
plots = cms.VPSet(
987987
Count1D('_size', 28, -0.5, 27.5),
988988
Plot1D('eta', 'eta', 20, -5, 5, 'eta'),
989-
Plot1D('filterBits', 'filterBits', 31, 0, 31, 'extra bits of associated information, object- and era-dependent: see branch documentation', bitset=True),
989+
Plot1D('filterBits', 'filterBits', 64, 0, 64, 'extra bits of associated information, object- and era-dependent: see branch documentation', bitset=True),
990990
Plot1D('id', 'id', 20, 0, 30, 'ID of the object: 11 = Electron (PixelMatched e/gamma), 22 = Photon (PixelMatch-vetoed e/gamma), 13 = Muon, 14 = Tau, 1 = Jet, 2 = MET, 3 = HT, 4 = MHT'),
991991
Plot1D('l1charge', 'l1charge', 3, -1.5, 1.5, 'charge of associated L1 seed'),
992992
Plot1D('l1iso', 'l1iso', 4, -0.5, 3.5, 'iso of associated L1 seed'),

0 commit comments

Comments
 (0)