53 #include "fastjet/PseudoJet.hh"
54 #include "fastjet/contrib/Njettiness.hh"
77 std::vector<fastjet::PseudoJet>& currentAxes)
const;
81 const fastjet::PseudoJet& tauAxis,
82 std::vector<float>& tau_trackEtaRel)
const;
128 beta_(iConfig.getParameter<double>(
"beta")),
129 R0_(iConfig.getParameter<double>(
"R0")),
130 maxSVDeltaRToJet_(iConfig.getParameter<double>(
"maxSVDeltaRToJet")),
131 maxDistToAxis_(iConfig.getParameter<
edm::
ParameterSet>(
"trackSelection").getParameter<double>(
"maxDistToAxis")),
132 maxDecayLen_(iConfig.getParameter<
edm::
ParameterSet>(
"trackSelection").getParameter<double>(
"maxDecayLen")),
137 esConsumes<TransientTrackBuilder, TransientTrackRecord>(
edm::ESInputTag(
"",
"TransientTrackBuilder"));
140 produces<std::vector<reco::BoostedDoubleSVTagInfo>>();
165 auto tagInfos = std::make_unique<std::vector<reco::BoostedDoubleSVTagInfo>>();
168 for (std::vector<reco::CandSecondaryVertexTagInfo>::const_iterator iterTI =
svTagInfos->begin();
191 float jetNTracks = 0, nSV = 0, tau1_nSecondaryVertices = 0, tau2_nSecondaryVertices = 0;
196 std::vector<fastjet::PseudoJet> currentAxes;
204 pv =
GlobalPoint(vertexRef->x(), vertexRef->y(), vertexRef->z());
211 std::vector<float> IP3Ds, IP3Ds_1, IP3Ds_2;
215 for (
size_t itt = 0; itt < trackSize; ++itt) {
218 float track_PVweight = 0.;
220 if (track_PVweight > 0.5)
221 allKinematics.
add(trackRef);
224 bool isSelected =
false;
229 bool isfromV0 =
false, isfromV0Tight =
false;
230 std::vector<reco::CandidatePtr> trackPairV0Test(2);
232 trackPairV0Test[0] = trackRef;
234 for (
size_t jtt = 0; jtt < trackSize; ++jtt) {
241 trackPairV0Test[1] = pairTrackRef;
247 isfromV0Tight =
true;
250 if (isfromV0 && isfromV0Tight)
254 if (isSelected && !isfromV0Tight)
261 if (currentAxes.size() > 1 &&
267 float decayLengthTau = -1;
268 float distTauAxis = -1;
280 IP3Ds.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
282 if (currentAxes.size() > 1) {
284 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
286 IP3Ds_2.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
288 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
293 bool charmThreshSet =
false;
304 && !charmThreshSet) {
305 trackSip2dSigAboveCharm_0 =
data.ip2d.significance();
307 charmThreshSet =
true;
320 float dummyTrack = -50.;
322 std::sort(IP3Ds.begin(), IP3Ds.end(), std::greater<float>());
323 std::sort(IP3Ds_1.begin(), IP3Ds_1.end(), std::greater<float>());
324 std::sort(IP3Ds_2.begin(), IP3Ds_2.end(), std::greater<float>());
325 int num_1 = IP3Ds_1.size();
326 int num_2 = IP3Ds_2.size();
417 std::vector<float> tau1_trackEtaRels, tau2_trackEtaRels;
419 std::map<double, size_t> VTXmap;
425 if (currentAxes.size() > 1) {
428 tau2Kinematics = tau2Kinematics + vertexKinematic;
434 tau2_nSecondaryVertices += 1.;
436 tau1Kinematics = tau1Kinematics + vertexKinematic;
442 tau1_nSecondaryVertices += 1.;
445 }
else if (!currentAxes.empty()) {
446 tau1Kinematics = tau1Kinematics + vertexKinematic;
452 tau1_nSecondaryVertices += 1.;
462 if (tau1_nSecondaryVertices > 0.) {
472 if (tau2_nSecondaryVertices > 0.) {
482 float dummyEtaRel = -1.;
484 std::sort(tau1_trackEtaRels.begin(), tau1_trackEtaRels.end());
485 std::sort(tau2_trackEtaRels.begin(), tau2_trackEtaRels.end());
487 switch (tau2_trackEtaRels.size()) {
519 switch (tau1_trackEtaRels.size()) {
556 for (std::map<double, size_t>::iterator iVtx = VTXmap.begin(); iVtx != VTXmap.end(); ++iVtx) {
581 if ((tau1_vertexMass < 0 && tau2_vertexMass > 0)) {
652 std::vector<fastjet::PseudoJet>& currentAxes)
const {
653 std::vector<fastjet::PseudoJet> fjParticles;
657 if (daughter.isNonnull() && daughter.isAvailable()) {
658 const reco::Jet* subjet = dynamic_cast<const reco::Jet*>(daughter.get());
662 for (
size_t i = 0;
i < daughter->numberOfDaughters(); ++
i) {
667 float valcheck = constit->px() + constit->py() + constit->pz() + constit->energy();
670 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
679 <<
"BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection"
682 fjParticles.push_back(
683 fastjet::PseudoJet(constit->px() *
w, constit->py() *
w, constit->pz() *
w, constit->energy() *
w));
685 fjParticles.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
688 <<
"Jet constituent required for N-subjettiness computation is missing!";
692 float valcheck = daughter->px() + daughter->py() + daughter->pz() + daughter->energy();
695 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
698 if (
jet->isWeighted()) {
704 <<
"BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
706 fjParticles.push_back(
707 fastjet::PseudoJet(daughter->px() *
w, daughter->py() *
w, daughter->pz() *
w, daughter->energy() *
w));
709 fjParticles.push_back(fastjet::PseudoJet(daughter->px(), daughter->py(), daughter->pz(), daughter->energy()));
712 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
717 fastjet::contrib::NormalizedMeasure(
beta_,
R0_));
720 tau1 = njettiness.getTau(1, fjParticles);
721 tau2 = njettiness.getTau(2, fjParticles);
722 currentAxes = njettiness.currentAxes();
727 float& PVweight)
const {
736 for (
IT it =
vtx.tracks_begin(); it !=
vtx.tracks_end(); ++it) {
739 if (baseRef == trackBaseRef) {
740 PVweight =
vtx.trackWeight(baseRef);
748 float& PVweight)
const {
766 const fastjet::PseudoJet& tauAxis,
767 std::vector<float>& tau_trackEtaRel)
const {
769 const std::vector<reco::CandidatePtr>&
tracks =
vertex.daughterPtrVector();
784 desc.add<
double>(
"beta", 1.0);
785 desc.add<
double>(
"R0", 0.8);
786 desc.add<
double>(
"maxSVDeltaRToJet", 0.7);