37 std::vector<edm::ParameterSet> selPSets = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"selections");
38 sels_.reserve(selPSets.size());
39 std::stringstream idstr, qualitystr;
40 idstr <<
"ID of the object: ";
41 for (
auto &
pset : selPSets) {
43 idstr <<
sels_.back().id <<
" = " <<
sels_.back().name;
44 if (
sels_.size() < selPSets.size())
46 if (!
sels_.back().qualityBitsDoc.empty()) {
47 qualitystr <<
sels_.back().qualityBitsDoc <<
" for " <<
sels_.back().name <<
"; ";
53 produces<nanoaod::FlatTable>();
119 std::vector<std::pair<const pat::TriggerObjectStandAlone *, const SelectedObject *>> selected;
120 for (
const auto &
obj : *
src) {
122 if (
sel.match(
obj) && (
sel.skipObjectsNotPassingQualityBits ? (
int(
sel.qualityBits(
obj)) > 0) :
true)) {
123 selected.emplace_back(&
obj, &
sel);
132 std::map<const pat::TriggerObjectStandAlone *, int> selected_bits;
133 for (
unsigned int i = 0;
i < selected.size(); ++
i) {
134 const auto &
obj = *selected[
i].first;
135 const auto &
sel = *selected[
i].second;
138 for (
unsigned int j = 0;
j <
i; ++
j) {
139 const auto &obj2 = *selected[
j].first;
140 const auto &sel2 = *selected[
j].second;
142 selected_bits[&obj2] |= selected_bits[&
obj];
143 selected.erase(selected.begin() +
i);
160 std::vector<pair<pat::TriggerObjectStandAlone, int>> l1Objects;
166 l1Objects.emplace_back(l1obj, it->hwIso());
172 switch (it->getType()) {
175 l1obj.setCollection(
"L1ETM");
180 l1obj.setCollection(
"L1ETMHF");
185 l1obj.setCollection(
"L1ETT");
190 l1obj.setCollection(
"L1ETEm");
195 l1obj.setCollection(
"L1HTT");
200 l1obj.setCollection(
"L1HTTHF");
205 l1obj.setCollection(
"L1HTM");
210 l1obj.setCollection(
"L1HTMHF");
217 l1Objects.emplace_back(l1obj, it->hwIso());
224 l1Objects.emplace_back(l1obj, it->hwIso());
231 l1obj.setCharge(it->charge());
232 l1Objects.emplace_back(l1obj, it->hwIso());
239 l1Objects.emplace_back(l1obj, it->hwIso());
242 unsigned int nobj = selected.size();
243 std::vector<float>
pt(nobj, 0),
eta(nobj, 0),
phi(nobj, 0), l1pt(nobj, 0), l1pt_2(nobj, 0), l2pt(nobj, 0);
244 std::vector<int>
id(nobj, 0),
bits(nobj, 0), l1iso(nobj, 0), l1charge(nobj, 0);
245 for (
unsigned int i = 0;
i < nobj; ++
i) {
246 const auto &
obj = *selected[
i].first;
247 const auto &
sel = *selected[
i].second;
254 float best =
sel.l1DR2;
255 for (
const auto &l1obj : l1Objects) {
256 const auto &
seed = l1obj.first;
258 if (dr2 < best &&
sel.l1cut(
seed)) {
261 l1iso[
i] = l1obj.second;
262 l1charge[
i] =
seed.charge();
266 if (
sel.l1DR2_2 > 0) {
267 float best =
sel.l1DR2_2;
268 for (
const auto &l1obj : l1Objects) {
269 const auto &
seed = l1obj.first;
271 if (dr2 < best &&
sel.l1cut_2(
seed)) {
273 l1pt_2[
i] =
seed.pt();
278 float best =
sel.l2DR2;
279 for (
const auto &
seed : *
src) {
281 if (dr2 < best &&
sel.l2cut(
seed)) {
289 auto tab = std::make_unique<nanoaod::FlatTable>(nobj,
name_,
false,
false);
290 tab->addColumn<
int>(
"id",
id,
idDoc_);
291 tab->addColumn<
float>(
"pt",
pt,
"pt", 12);
292 tab->addColumn<
float>(
"eta",
eta,
"eta", 12);
293 tab->addColumn<
float>(
"phi",
phi,
"phi", 12);
294 tab->addColumn<
float>(
"l1pt", l1pt,
"pt of associated L1 seed", 8);
295 tab->addColumn<
int>(
"l1iso", l1iso,
"iso of associated L1 seed");
296 tab->addColumn<
int>(
"l1charge", l1charge,
"charge of associated L1 seed");
297 tab->addColumn<
float>(
"l1pt_2", l1pt_2,
"pt of associated secondary L1 seed", 8);
298 tab->addColumn<
float>(
"l2pt", l2pt,
"pt of associated 'L2' seed (i.e. HLT before tracking/PF)", 10);
299 tab->addColumn<
int>(
"filterBits",
bits,
"extra bits of associated information: " +
bitsDoc_);
BXVector< EGamma > EGammaBxCollection
T getParameter(std::string const &) const
SelectedObject(const edm::ParameterSet &pset)
enum start value shifted to 81 so as to avoid clashes with PDG codes
bool skipObjectsNotPassingQualityBits
BXVector< Tau > TauBxCollection
~TriggerObjectTableProducer() override
StringCutObjectSelector< pat::TriggerObjectStandAlone > l1cut
edm::EDGetTokenT< l1t::JetBxCollection > l1Jet_
std::vector< T >::const_iterator const_iterator
BXVector< EtSum > EtSumBxCollection
TriggerObjectTableProducer(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< std::vector< pat::TriggerObjectStandAlone > > src_
void setCollection(const std::string &collName)
Methods.
StringObjectFunction< pat::TriggerObjectStandAlone > qualityBits
edm::EDGetTokenT< l1t::MuonBxCollection > l1Muon_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
bool match(const pat::TriggerObjectStandAlone &obj) const
std::string qualityBitsDoc
BXVector< Muon > MuonBxCollection
BXVector< Jet > JetBxCollection
StringCutObjectSelector< pat::TriggerObjectStandAlone > l1cut_2
edm::EDGetTokenT< l1t::TauBxCollection > l1Tau_
StringCutObjectSelector< pat::TriggerObjectStandAlone > cut
std::vector< SelectedObject > sels_
edm::EDGetTokenT< l1t::EGammaBxCollection > l1EG_
edm::EDGetTokenT< l1t::EtSumBxCollection > l1Sum_
void produce(edm::Event &, edm::EventSetup const &) override
Power< A, B >::type pow(const A &a, const B &b)
StringCutObjectSelector< pat::TriggerObjectStandAlone > l2cut
Analysis-level trigger object class (stand-alone)