52 #include "fastjet/PseudoJet.hh"
53 #include "fastjet/contrib/Njettiness.hh"
76 std::vector<fastjet::PseudoJet>& currentAxes)
const;
80 const fastjet::PseudoJet& tauAxis,
81 std::vector<float>& tau_trackEtaRel)
const;
126 beta_(iConfig.getParameter<double>(
"beta")),
127 R0_(iConfig.getParameter<double>(
"R0")),
128 maxSVDeltaRToJet_(iConfig.getParameter<double>(
"maxSVDeltaRToJet")),
129 maxDistToAxis_(iConfig.getParameter<
edm::
ParameterSet>(
"trackSelection").getParameter<double>(
"maxDistToAxis")),
130 maxDecayLen_(iConfig.getParameter<
edm::
ParameterSet>(
"trackSelection").getParameter<double>(
"maxDecayLen")),
136 produces<std::vector<reco::BoostedDoubleSVTagInfo>>();
162 auto tagInfos = std::make_unique<std::vector<reco::BoostedDoubleSVTagInfo>>();
165 for (std::vector<reco::CandSecondaryVertexTagInfo>::const_iterator iterTI =
svTagInfos->begin();
188 float jetNTracks = 0, nSV = 0, tau1_nSecondaryVertices = 0, tau2_nSecondaryVertices = 0;
193 std::vector<fastjet::PseudoJet> currentAxes;
201 pv =
GlobalPoint(vertexRef->x(), vertexRef->y(), vertexRef->z());
208 std::vector<float> IP3Ds, IP3Ds_1, IP3Ds_2;
212 for (
size_t itt = 0; itt < trackSize; ++itt) {
215 float track_PVweight = 0.;
217 if (track_PVweight > 0.5)
218 allKinematics.
add(trackRef);
221 bool isSelected =
false;
226 bool isfromV0 =
false, isfromV0Tight =
false;
227 std::vector<reco::CandidatePtr> trackPairV0Test(2);
229 trackPairV0Test[0] = trackRef;
231 for (
size_t jtt = 0; jtt < trackSize; ++jtt) {
238 trackPairV0Test[1] = pairTrackRef;
244 isfromV0Tight =
true;
247 if (isfromV0 && isfromV0Tight)
251 if (isSelected && !isfromV0Tight)
258 if (currentAxes.size() > 1 &&
264 float decayLengthTau = -1;
265 float distTauAxis = -1;
277 IP3Ds.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
279 if (currentAxes.size() > 1) {
281 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
283 IP3Ds_2.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
285 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
290 bool charmThreshSet =
false;
301 && !charmThreshSet) {
302 trackSip2dSigAboveCharm_0 =
data.ip2d.significance();
304 charmThreshSet =
true;
317 float dummyTrack = -50.;
319 std::sort(IP3Ds.begin(), IP3Ds.end(), std::greater<float>());
320 std::sort(IP3Ds_1.begin(), IP3Ds_1.end(), std::greater<float>());
321 std::sort(IP3Ds_2.begin(), IP3Ds_2.end(), std::greater<float>());
322 int num_1 = IP3Ds_1.size();
323 int num_2 = IP3Ds_2.size();
414 std::vector<float> tau1_trackEtaRels, tau2_trackEtaRels;
416 std::map<double, size_t> VTXmap;
422 if (currentAxes.size() > 1) {
425 tau2Kinematics = tau2Kinematics + vertexKinematic;
431 tau2_nSecondaryVertices += 1.;
433 tau1Kinematics = tau1Kinematics + vertexKinematic;
439 tau1_nSecondaryVertices += 1.;
442 }
else if (!currentAxes.empty()) {
443 tau1Kinematics = tau1Kinematics + vertexKinematic;
449 tau1_nSecondaryVertices += 1.;
459 if (tau1_nSecondaryVertices > 0.) {
469 if (tau2_nSecondaryVertices > 0.) {
479 float dummyEtaRel = -1.;
481 std::sort(tau1_trackEtaRels.begin(), tau1_trackEtaRels.end());
482 std::sort(tau2_trackEtaRels.begin(), tau2_trackEtaRels.end());
484 switch (tau2_trackEtaRels.size()) {
516 switch (tau1_trackEtaRels.size()) {
553 for (std::map<double, size_t>::iterator iVtx = VTXmap.begin(); iVtx != VTXmap.end(); ++iVtx) {
578 if ((tau1_vertexMass < 0 && tau2_vertexMass > 0)) {
649 std::vector<fastjet::PseudoJet>& currentAxes)
const {
650 std::vector<fastjet::PseudoJet> fjParticles;
654 if (daughter.isNonnull() && daughter.isAvailable()) {
655 const reco::Jet* subjet = dynamic_cast<const reco::Jet*>(daughter.get());
659 for (
size_t i = 0;
i < daughter->numberOfDaughters(); ++
i) {
664 float valcheck = constit->px() + constit->py() + constit->pz() + constit->energy();
667 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
676 <<
"BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection"
679 fjParticles.push_back(
680 fastjet::PseudoJet(constit->px() *
w, constit->py() *
w, constit->pz() *
w, constit->energy() *
w));
682 fjParticles.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
685 <<
"Jet constituent required for N-subjettiness computation is missing!";
689 float valcheck = daughter->px() + daughter->py() + daughter->pz() + daughter->energy();
692 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
695 if (
jet->isWeighted()) {
701 <<
"BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
703 fjParticles.push_back(
704 fastjet::PseudoJet(daughter->px() *
w, daughter->py() *
w, daughter->pz() *
w, daughter->energy() *
w));
706 fjParticles.push_back(fastjet::PseudoJet(daughter->px(), daughter->py(), daughter->pz(), daughter->energy()));
709 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
714 fastjet::contrib::NormalizedMeasure(
beta_,
R0_));
717 tau1 = njettiness.getTau(1, fjParticles);
718 tau2 = njettiness.getTau(2, fjParticles);
719 currentAxes = njettiness.currentAxes();
724 float& PVweight)
const {
733 for (
IT it =
vtx.tracks_begin(); it !=
vtx.tracks_end(); ++it) {
736 if (baseRef == trackBaseRef) {
737 PVweight =
vtx.trackWeight(baseRef);
745 float& PVweight)
const {
763 const fastjet::PseudoJet& tauAxis,
764 std::vector<float>& tau_trackEtaRel)
const {
766 const std::vector<reco::CandidatePtr>&
tracks =
vertex.daughterPtrVector();
781 desc.
add<
double>(
"beta", 1.0);
782 desc.
add<
double>(
"R0", 0.8);
783 desc.
add<
double>(
"maxSVDeltaRToJet", 0.7);