22 #ifndef RecoTauTag_HLTProducers_L1TJetsMatching_h
23 #define RecoTauTag_HLTProducers_L1TJetsMatching_h
38 #include "Math/GenVector/VectorUtil.h"
72 const std::vector<T>& pfMatchedJets,
double pt1,
double pt2,
double pt3,
double Mjj) {
73 std::pair<std::vector<T>, std::vector<T>>
output;
77 if (pfMatchedJets.size() > 1) {
78 for (
unsigned int i = 0;
i < pfMatchedJets.size() - 1;
i++) {
79 const T& myJet1 = (pfMatchedJets)[
i];
81 for (
unsigned int j =
i + 1;
j < pfMatchedJets.size();
j++) {
82 const T& myJet2 = (pfMatchedJets)[
j];
84 const double mjj_test = (myJet1.p4() + myJet2.p4()).M();
94 const T& myJet1 = (pfMatchedJets)[
i1];
95 const T& myJet2 = (pfMatchedJets)[
i2];
97 if ((mjj > Mjj) && (myJet1.pt() >=
pt1) && (myJet2.pt() >
pt2)) {
98 output.first.push_back(myJet1);
99 output.first.push_back(myJet2);
102 if ((mjj > Mjj) && (myJet1.pt() < pt3) && (myJet1.pt() >
pt2) && (myJet2.pt() >
pt2)) {
103 const T& myJetTest = (pfMatchedJets)[0];
104 if (myJetTest.pt() > pt3) {
105 output.second.push_back(myJet1);
106 output.second.push_back(myJet2);
107 output.second.push_back(myJetTest);
114 template <
typename T>
117 jetTrigger_(consumes<
trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<
edm::
InputTag>(
"L1JetTrigger"))),
118 pt1Min_(iConfig.getParameter<double>(
"pt1Min")),
119 pt2Min_(iConfig.getParameter<double>(
"pt2Min")),
120 pt3Min_(iConfig.getParameter<double>(
"pt3Min")),
121 mjjMin_(iConfig.getParameter<double>(
"mjjMin")),
122 matchingR_(iConfig.getParameter<double>(
"matchingR")),
123 matchingR2_(matchingR_ * matchingR_) {
124 produces<std::vector<T>>(
"TwoJets");
125 produces<std::vector<T>>(
"ThreeJets");
127 template <
typename T>
130 template <
typename T>
132 unique_ptr<std::vector<T>> pfMatchedJets(
new std::vector<T>);
133 std::pair<std::vector<T>, std::vector<T>>
output;
140 iEvent.getByToken(jetTrigger_, l1TriggeredJets);
149 for (
unsigned int iJet = 0; iJet <
pfJets->size(); iJet++) {
150 const T& myJet = (*pfJets)[iJet];
151 for (
unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++) {
154 if ((
reco::deltaR2(myJet.p4(), jetCandRefVec[iL1Jet]->p4()) < matchingR2_) && (myJet.pt() > pt2Min_)) {
155 pfMatchedJets->push_back(myJet);
162 unique_ptr<std::vector<T>>
output1(
new std::vector<T>(
output.first));
163 unique_ptr<std::vector<T>>
output2(
new std::vector<T>(
output.second));
168 template <
typename T>
173 ->setComment(
"Input collection of PFJets");
174 desc.add<
double>(
"pt1Min", 110.0)->setComment(
"Minimal pT1 of PFJets to match");
175 desc.add<
double>(
"pt2Min", 35.0)->setComment(
"Minimal pT2 of PFJets to match");
176 desc.add<
double>(
"pt3Min", 110.0)->setComment(
"Minimum pT3 of PFJets to match");
177 desc.add<
double>(
"mjjMin", 650.0)->setComment(
"Minimal mjj of matched PFjets");
178 desc.add<
double>(
"matchingR", 0.5)->setComment(
"dR value used for matching");
180 "This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex "
181 "of returned PFJetss are set).");