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;
123 beta_(iConfig.getParameter<double>(
"beta")),
124 R0_(iConfig.getParameter<double>(
"R0")),
130 produces<std::vector<reco::BoostedDoubleSVTagInfo> >();
153 auto tagInfos = std::make_unique<std::vector<reco::BoostedDoubleSVTagInfo> >();
156 for (std::vector<reco::CandSecondaryVertexTagInfo>::const_iterator iterTI = svTagInfos->begin();
157 iterTI != svTagInfos->end();
179 float jetNTracks = 0, nSV = 0, tau1_nSecondaryVertices = 0, tau2_nSecondaryVertices = 0;
184 std::vector<fastjet::PseudoJet> currentAxes;
192 pv =
GlobalPoint(vertexRef->x(), vertexRef->y(), vertexRef->z());
196 size_t trackSize = selectedTracks.size();
199 std::vector<float> IP3Ds, IP3Ds_1, IP3Ds_2;
203 for (
size_t itt = 0; itt < trackSize; ++itt) {
206 float track_PVweight = 0.;
208 if (track_PVweight > 0.5)
209 allKinematics.
add(trackRef);
212 bool isSelected =
false;
217 bool isfromV0 =
false, isfromV0Tight =
false;
218 std::vector<reco::CandidatePtr> trackPairV0Test(2);
220 trackPairV0Test[0] = trackRef;
222 for (
size_t jtt = 0; jtt < trackSize; ++jtt) {
229 trackPairV0Test[1] = pairTrackRef;
235 isfromV0Tight =
true;
238 if (isfromV0 && isfromV0Tight)
242 if (isSelected && !isfromV0Tight)
246 GlobalVector direction(jet->px(), jet->py(), jet->pz());
249 if (currentAxes.size() > 1 &&
252 direction =
GlobalVector(currentAxes[index].
px(), currentAxes[index].
py(), currentAxes[index].pz());
255 float decayLengthTau = -1;
256 float distTauAxis = -1;
268 IP3Ds.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
270 if (currentAxes.size() > 1) {
272 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
274 IP3Ds_2.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
276 IP3Ds_1.push_back(IP3Dsig < -50. ? -50. : IP3Dsig);
281 bool charmThreshSet =
false;
284 for (
size_t i = 0;
i < indices.size(); ++
i) {
285 size_t idx = indices[
i];
292 && !charmThreshSet) {
295 charmThreshSet =
true;
301 if ((
i + 1) < indices.size())
302 trackSip2dSigAboveBottom_1 = (ipData[indices[
i + 1]]).ip2d.significance();
308 float dummyTrack = -50.;
310 std::sort(IP3Ds.begin(), IP3Ds.end(), std::greater<float>());
311 std::sort(IP3Ds_1.begin(), IP3Ds_1.end(), std::greater<float>());
312 std::sort(IP3Ds_2.begin(), IP3Ds_2.end(), std::greater<float>());
313 int num_1 = IP3Ds_1.size();
314 int num_2 = IP3Ds_2.size();
319 trackSip3dSig_0 = dummyTrack;
320 trackSip3dSig_1 = dummyTrack;
321 trackSip3dSig_2 = dummyTrack;
322 trackSip3dSig_3 = dummyTrack;
328 trackSip3dSig_0 = IP3Ds.at(0);
329 trackSip3dSig_1 = dummyTrack;
330 trackSip3dSig_2 = dummyTrack;
331 trackSip3dSig_3 = dummyTrack;
337 trackSip3dSig_0 = IP3Ds.at(0);
338 trackSip3dSig_1 = IP3Ds.at(1);
339 trackSip3dSig_2 = dummyTrack;
340 trackSip3dSig_3 = dummyTrack;
346 trackSip3dSig_0 = IP3Ds.at(0);
347 trackSip3dSig_1 = IP3Ds.at(1);
348 trackSip3dSig_2 = IP3Ds.at(2);
349 trackSip3dSig_3 = dummyTrack;
355 trackSip3dSig_0 = IP3Ds.at(0);
356 trackSip3dSig_1 = IP3Ds.at(1);
357 trackSip3dSig_2 = IP3Ds.at(2);
358 trackSip3dSig_3 = IP3Ds.at(3);
364 tau1_trackSip3dSig_0 = dummyTrack;
365 tau1_trackSip3dSig_1 = dummyTrack;
371 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
372 tau1_trackSip3dSig_1 = dummyTrack;
378 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
379 tau1_trackSip3dSig_1 = IP3Ds_1.at(1);
385 tau2_trackSip3dSig_0 = dummyTrack;
386 tau2_trackSip3dSig_1 = dummyTrack;
391 tau2_trackSip3dSig_0 = IP3Ds_2.at(0);
392 tau2_trackSip3dSig_1 = dummyTrack;
398 tau2_trackSip3dSig_0 = IP3Ds_2.at(0);
399 tau2_trackSip3dSig_1 = IP3Ds_2.at(1);
405 std::vector<float> tau1_trackEtaRels, tau2_trackEtaRels;
407 std::map<double, size_t> VTXmap;
413 if (currentAxes.size() > 1) {
416 tau2Kinematics = tau2Kinematics + vertexKinematic;
417 if (tau2_flightDistance2dSig < 0) {
422 tau2_nSecondaryVertices += 1.;
424 tau1Kinematics = tau1Kinematics + vertexKinematic;
425 if (tau1_flightDistance2dSig < 0) {
430 tau1_nSecondaryVertices += 1.;
433 }
else if (!currentAxes.empty()) {
434 tau1Kinematics = tau1Kinematics + vertexKinematic;
435 if (tau1_flightDistance2dSig < 0) {
440 tau1_nSecondaryVertices += 1.;
450 if (tau1_nSecondaryVertices > 0.) {
453 tau1_vertexEnergyRatio = tau1_vertexSum.E() / allSum.E();
454 if (tau1_vertexEnergyRatio > 50.)
455 tau1_vertexEnergyRatio = 50.;
457 tau1_vertexMass = tau1_vertexSum.M();
460 if (tau2_nSecondaryVertices > 0.) {
463 tau2_vertexEnergyRatio = tau2_vertexSum.E() / allSum.E();
464 if (tau2_vertexEnergyRatio > 50.)
465 tau2_vertexEnergyRatio = 50.;
467 tau2_vertexMass = tau2_vertexSum.M();
470 float dummyEtaRel = -1.;
472 std::sort(tau1_trackEtaRels.begin(), tau1_trackEtaRels.end());
473 std::sort(tau2_trackEtaRels.begin(), tau2_trackEtaRels.end());
475 switch (tau2_trackEtaRels.size()) {
478 tau2_trackEtaRel_0 = dummyEtaRel;
479 tau2_trackEtaRel_1 = dummyEtaRel;
480 tau2_trackEtaRel_2 = dummyEtaRel;
486 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
487 tau2_trackEtaRel_1 = dummyEtaRel;
488 tau2_trackEtaRel_2 = dummyEtaRel;
494 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
495 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
496 tau2_trackEtaRel_2 = dummyEtaRel;
502 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
503 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
504 tau2_trackEtaRel_2 = tau2_trackEtaRels.at(2);
507 switch (tau1_trackEtaRels.size()) {
510 tau1_trackEtaRel_0 = dummyEtaRel;
511 tau1_trackEtaRel_1 = dummyEtaRel;
512 tau1_trackEtaRel_2 = dummyEtaRel;
518 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
519 tau1_trackEtaRel_1 = dummyEtaRel;
520 tau1_trackEtaRel_2 = dummyEtaRel;
526 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
527 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
528 tau1_trackEtaRel_2 = dummyEtaRel;
534 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
535 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
536 tau1_trackEtaRel_2 = tau1_trackEtaRels.at(2);
544 for (std::map<double, size_t>::iterator iVtx = VTXmap.begin(); iVtx != VTXmap.end(); ++iVtx) {
549 SV_p4_0 = vertex.
p4();
550 vtxMass = SV_p4_0.mass();
557 SV_p4_1 = vertex.
p4();
558 vtxMass = (SV_p4_1 + SV_p4_0).
mass();
569 if ((tau1_vertexMass < 0 && tau2_vertexMass > 0)) {
572 tau2_trackEtaRel_0 =
temp;
576 tau2_trackEtaRel_1 =
temp;
580 tau2_trackEtaRel_2 =
temp;
584 tau2_flightDistance2dSig =
temp;
590 tau2_vertexEnergyRatio =
temp;
594 tau2_vertexMass =
temp;
630 vars,
edm::Ref<std::vector<reco::CandSecondaryVertexTagInfo> >(svTagInfos, iterTI - svTagInfos->begin())));
640 std::vector<fastjet::PseudoJet>& currentAxes)
const {
641 std::vector<fastjet::PseudoJet> fjParticles;
645 if (daughter.isNonnull() && daughter.isAvailable()) {
650 for (
size_t i = 0;
i < daughter->numberOfDaughters(); ++
i) {
655 float valcheck = constit->
px() + constit->
py() + constit->
pz() + constit->
energy();
658 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
661 fjParticles.push_back(fastjet::PseudoJet(constit->
px(), constit->
py(), constit->
pz(), constit->
energy()));
664 <<
"Jet constituent required for N-subjettiness computation is missing!";
668 float valcheck = daughter->px() + daughter->py() + daughter->pz() + daughter->energy();
671 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
674 fjParticles.push_back(fastjet::PseudoJet(daughter->px(), daughter->py(), daughter->pz(), daughter->energy()));
677 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
682 fastjet::contrib::NormalizedMeasure(
beta_,
R0_));
685 tau1 = njettiness.getTau(1, fjParticles);
686 tau2 = njettiness.getTau(2, fjParticles);
687 currentAxes = njettiness.currentAxes();
692 float& PVweight)
const {
704 if (baseRef == trackBaseRef) {
713 float& PVweight)
const {
731 const fastjet::PseudoJet& tauAxis,
732 std::vector<float>& tau_trackEtaRel)
const {
736 for (std::vector<reco::CandidatePtr>::const_iterator
track = tracks.begin();
track != tracks.end(); ++
track)
reco::Vertex::Point convertPos(const GlobalPoint &p)
const edm::EDGetTokenT< std::vector< reco::CandSecondaryVertexTagInfo > > svTagInfos_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static float dummyVertexEnergyRatio
const math::XYZTLorentzVector & weightedVectorSum() const
virtual double pz() const =0
z coordinate of momentum vector
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
const double maxDistToAxis_
const double maxDecayLen_
trackRef_iterator tracks_end() const
last iterator over tracks
const double maxSVDeltaRToJet_
void add(const reco::Track &track, double weight=1.0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const VTX & secondaryVertex(unsigned int index) const
constexpr bool isNotFinite(T x)
T const * get() const
Returns C++ pointer to the item.
Base class for all types of Jets.
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Global3DPoint GlobalPoint
reco::TransientTrack build(const reco::Track *p) const
static float dummyVertexMass
edm::RefToBase< Jet > jet(void) const override
returns a polymorphic reference to the tagged jet
GlobalPoint globalPosition() const
const Container & selectedTracks() const
const MagneticField * field() const
reco::V0Filter trackPairV0Filter
void setTracksPVBase(const reco::TrackRef &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
void etaRelToTauAxis(const reco::VertexCompositePtrCandidate &vertex, const fastjet::PseudoJet &tauAxis, std::vector< float > &tau_trackEtaRel) const
reco::TrackSelector trackSelector
static float charmThreshold
virtual const daughters & daughterPtrVector() const
references to daughtes
const edm::Ref< VertexCollection > & primaryVertex() const
reco::TemplatedSecondaryVertexTagInfo< reco::CandIPTagInfo, reco::VertexCompositePtrCandidate > CandSecondaryVertexTagInfo
static float dummyFlightDistance2dSig
~BoostedDoubleSVProducer() override
size_t numberOfDaughters() const override
number of daughters
reco::TrackRef trackRef() const
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void calcNsubjettiness(const reco::JetBaseRef &jet, float &tau1, float &tau2, std::vector< fastjet::PseudoJet > ¤tAxes) const
void produce(edm::Event &, const edm::EventSetup &) override
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
static float dummyZ_ratio
void beginStream(edm::StreamID) override
const PVAssoc fromPV(size_t ipv=0) const
Abs< T >::type abs(const T &t)
const LorentzVector & p4() const final
four-momentum Lorentz vector
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
std::vector< LinkConnSpec >::const_iterator IT
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
const GlobalVector & flightDirection(unsigned int index) const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const std::vector< btag::TrackIPData > & impactParameterData() const
unsigned int nVertices() const
static float dummyVertexDeltaR
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double significance() const
static float dummyTrackSip3dSig
XYZVectorD XYZVector
spatial vector with cartesian internal representation
static float bottomThreshold
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
char data[epos_bytes_allocation]
const math::XYZTLorentzVector & vectorSum() const
Measurement1D flightDistance(unsigned int index, int dim=0) const
void setTracksPV(const reco::CandidatePtr &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
BoostedDoubleSVProducer(const edm::ParameterSet &)
void endStream() override
TrajectoryStateOnSurface impactPointState() const
static float dummyTrackEtaRel
trackRef_iterator tracks_begin() const
first iterator over tracks
virtual double px() const =0
x coordinate of momentum vector
static float dummyTrackSip2dSigAbove
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
cont
load Luminosity info ##
Global3DVector GlobalVector
void insert(const TaggingVariable &variable, bool delayed=false)