55 produces<edm::ValueMap<float>>(
"leptonPtRelv0");
56 produces<edm::ValueMap<float>>(
"leptonPtRelInvv0");
57 produces<edm::ValueMap<int>>(
"leptonPdgId");
58 produces<edm::ValueMap<float>>(
"leptonDeltaR");
59 produces<edm::ValueMap<float>>(
"leadTrackPt");
60 produces<edm::ValueMap<float>>(
"vtxPt");
61 produces<edm::ValueMap<float>>(
"vtxMass");
62 produces<edm::ValueMap<float>>(
"vtx3dL");
63 produces<edm::ValueMap<float>>(
"vtx3deL");
64 produces<edm::ValueMap<int>>(
"vtxNtrk");
65 produces<edm::ValueMap<float>>(
"ptD");
102 const auto& vtxProd =
iEvent.get(srcVtx_);
103 const auto& svProd =
iEvent.get(srcSV_);
105 auto nJet =
srcJet->size();
107 std::vector<float> leptonPtRel_v0(nJet, 0);
108 std::vector<float> leptonPtRelInv_v0(nJet, 0);
112 std::vector<float>
vtxPt(nJet, 0);
113 std::vector<float>
vtxMass(nJet, 0);
114 std::vector<float>
vtx3dL(nJet, 0);
115 std::vector<float>
vtx3deL(nJet, 0);
116 std::vector<int>
vtxNtrk(nJet, 0);
117 std::vector<float>
ptD(nJet, 0);
119 const auto&
pv = vtxProd.at(0);
120 for (
unsigned int ij = 0; ij < nJet; ij++) {
127 for (
const auto&
d :
jet->daughterPtrVector()) {
128 sumWeight += (
d->pt()) * (
d->pt());
134 ptD[ij] = (sumWeight > 0 ?
sqrt(sumWeight) /
sumPt : 0);
139 for (
const auto&
d :
jet->daughterPtrVector()) {
140 if (
abs(
d->pdgId()) == 11 ||
abs(
d->pdgId()) == 13) {
141 if (
d->pt() < maxLepPt)
143 auto res2 = calculatePtRatioRelSimple(
d,
jet);
144 leptonPtRel_v0[ij] = std::get<1>(res2);
145 leptonPtRelInv_v0[ij] = std::get<2>(res2);
154 float maxFoundSignificance = 0;
162 for (
const auto&
sv : svProd) {
174 vtxNtrk[ij] =
sv.numberOfSourceCandidatePtrs();
182 fillerRel_v0.
insert(
srcJet, leptonPtRel_v0.begin(), leptonPtRel_v0.end());
188 fillerRelInv_v0.
insert(
srcJet, leptonPtRelInv_v0.begin(), leptonPtRelInv_v0.end());
189 fillerRelInv_v0.
fill();
219 fillerVtxMass.
fill();
231 fillerVtx3deL.
fill();
247 template <
typename T>
250 auto lepp4 = lep->
p4();
251 auto rawp4 =
jet->correctedP4(
"Uncorrected");
253 if ((rawp4 - lepp4).
R() < 1
e-4)
254 return std::tuple<float, float, float>(1.0, 0.0, 0.0);
256 auto jetp4 =
jet->p4();
257 auto ptratio = lepp4.pt() / jetp4.pt();
258 auto ptrel = lepp4.Vect().Cross((jetp4).Vect().Unit()).R();
259 auto ptrelinv = jetp4.Vect().Cross((lepp4).Vect().Unit()).R();
261 return std::tuple<float, float, float>(ptratio, ptrel, ptrelinv);
265 template <
typename T>
272 desc.add<
edm::InputTag>(
"svsrc")->setComment(
"secondary vertex input collection");
276 modname +=
"RegressionVarProducer";
reco::Vertex::Point convertPos(const GlobalPoint &p)
edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > srcSV_
~BJetEnergyRegressionVarProducer() override
reco::Vertex::Error convertError(const GlobalError &ge)
void insert(const H &h, I begin, I end)
BJetEnergyRegressionVarProducer(const edm::ParameterSet &iConfig)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
BJetEnergyRegressionVarProducer< pat::Jet > JetRegressionVarProducer
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< std::vector< reco::Vertex > > srcVtx_
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double significance() const
std::tuple< float, float, float > calculatePtRatioRelSimple(edm::Ptr< reco::Candidate > lep, edm::Ptr< pat::Jet > jet) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector