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>
116 : jetSrc_(consumes<std::
vector<
T>>(iConfig.getParameter<edm::
InputTag>(
"JetSrc"))),
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);
161 output =
categorise(*pfMatchedJets, pt1Min_, pt2Min_, pt3Min_, mjjMin_);
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).");
void setComment(std::string const &value)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
L1TJetsMatching(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string defaultModuleLabel()
const edm::EDGetTokenT< std::vector< T > > jetSrc_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::pair< std::vector< T >, std::vector< T > > categorise(const std::vector< T > &pfMatchedJets, double pt1, double pt2, double pt3, double Mjj)
~L1TJetsMatching() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > jetTrigger_
void setComment(std::string const &value)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< JetRef > JetVectorRef