31 src_(consumes<
std::vector<
pat::TriggerObjectStandAlone>>(iConfig.getParameter<
edm::InputTag>(
"src"))),
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>();
82 : name(pset.getParameter<
std::
string>(
"name")),
83 id(pset.getParameter<
int>(
"id")),
84 cut(pset.getParameter<
std::
string>(
"sel")),
91 skipObjectsNotPassingQualityBits(pset.getParameter<
bool>(
"skipObjectsNotPassingQualityBits")),
92 qualityBits(pset.getParameter<
std::
string>(
"qualityBits")),
93 qualityBitsDoc(pset.getParameter<
std::
string>(
"qualityBitsDoc")) {
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);
130 std::map<const pat::TriggerObjectStandAlone *, int> selected_bits;
131 for (
unsigned int i = 0;
i < selected.size(); ++
i) {
132 const auto &
obj = *selected[
i].first;
133 const auto &
sel = *selected[
i].second;
136 for (
unsigned int j = 0; j <
i; ++j) {
137 const auto &obj2 = *selected[j].first;
138 const auto &sel2 = *selected[j].second;
140 selected_bits[&obj2] |= selected_bits[&
obj];
141 selected.erase(selected.begin() +
i);
158 std::vector<pair<pat::TriggerObjectStandAlone, int>> l1Objects;
164 l1Objects.emplace_back(l1obj, it->hwIso());
170 switch (it->getType()) {
173 l1obj.setCollection(
"L1ETM");
178 l1obj.setCollection(
"L1ETMHF");
183 l1obj.setCollection(
"L1ETT");
188 l1obj.setCollection(
"L1ETEm");
193 l1obj.setCollection(
"L1HTT");
198 l1obj.setCollection(
"L1HTTHF");
203 l1obj.setCollection(
"L1HTM");
208 l1obj.setCollection(
"L1HTMHF");
215 l1Objects.emplace_back(l1obj, it->hwIso());
222 l1Objects.emplace_back(l1obj, it->hwIso());
229 l1obj.setCharge(it->charge());
230 l1Objects.emplace_back(l1obj, it->hwIso());
237 l1Objects.emplace_back(l1obj, it->hwIso());
240 unsigned int nobj = selected.size();
241 std::vector<float>
pt(nobj, 0),
eta(nobj, 0),
phi(nobj, 0), l1pt(nobj, 0), l1pt_2(nobj, 0), l2pt(nobj, 0);
242 std::vector<int>
id(nobj, 0),
bits(nobj, 0), l1iso(nobj, 0), l1charge(nobj, 0);
243 for (
unsigned int i = 0;
i < nobj; ++
i) {
244 const auto &
obj = *selected[
i].first;
245 const auto &
sel = *selected[
i].second;
252 float best =
sel.l1DR2;
253 for (
const auto &l1obj : l1Objects) {
254 const auto &
seed = l1obj.first;
256 if (dr2 < best &&
sel.l1cut(
seed)) {
258 l1iso[
i] = l1obj.second;
259 l1charge[
i] =
seed.charge();
263 if (
sel.l1DR2_2 > 0) {
264 float best =
sel.l1DR2_2;
265 for (
const auto &l1obj : l1Objects) {
266 const auto &
seed = l1obj.first;
268 if (dr2 < best &&
sel.l1cut_2(
seed)) {
269 l1pt_2[
i] =
seed.pt();
274 float best =
sel.l2DR2;
275 for (
const auto &
seed : *src) {
277 if (dr2 < best &&
sel.l2cut(
seed)) {
284 auto tab = std::make_unique<nanoaod::FlatTable>(nobj,
name_,
false,
false);
293 tab->addColumn<
float>(
BXVector< EGamma > EGammaBxCollection
const_iterator end(int bx) const
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
SelectedObject(const edm::ParameterSet &pset)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
enum start value shifted to 81 so as to avoid clashes with PDG codes
#define DEFINE_FWK_MODULE(type)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
bool skipObjectsNotPassingQualityBits
BXVector< Tau > TauBxCollection
~TriggerObjectTableProducer() override
StringCutObjectSelector< pat::TriggerObjectStandAlone > l1cut
edm::EDGetTokenT< l1t::JetBxCollection > l1Jet_
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)
std::string qualityBitsDoc
BXVector< Muon > MuonBxCollection
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
BXVector< Jet > JetBxCollection
StringCutObjectSelector< pat::TriggerObjectStandAlone > l1cut_2
bool match(const pat::TriggerObjectStandAlone &obj) const
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
const_iterator begin(int bx) const
Power< A, B >::type pow(const A &a, const B &b)
StringCutObjectSelector< pat::TriggerObjectStandAlone > l2cut
std::vector< EGamma >::const_iterator const_iterator
Analysis-level trigger object class (stand-alone)