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);
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)
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) {
560 flightDir_0 =
svTagInfo.flightDirection(iVtx->second);
568 flightDir_1 =
svTagInfo.flightDirection(iVtx->second);
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()) {
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" 683 fjParticles.push_back(
684 fastjet::PseudoJet(constit->px() *
w, constit->py() *
w, constit->pz() *
w, constit->energy() *
w));
687 fjParticles.push_back(fastjet::PseudoJet(constit->px(), constit->py(), constit->pz(), constit->energy()));
691 <<
"Jet constituent required for N-subjettiness computation is missing!";
695 float valcheck = daughter->px() + daughter->py() + daughter->pz() + daughter->energy();
698 <<
"Jet constituent required for N-subjettiness computation contains Nan/Inf values!";
701 if (
jet->isWeighted()) {
707 <<
"BoostedDoubleSVProducer: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
710 fjParticles.push_back(
711 fastjet::PseudoJet(daughter->px() *
w, daughter->py() *
w, daughter->pz() *
w, daughter->energy() *
w));
714 fjParticles.push_back(fastjet::PseudoJet(daughter->px(), daughter->py(), daughter->pz(), daughter->energy()));
718 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
723 fastjet::contrib::NormalizedMeasure(
beta_,
R0_));
726 tau1 = njettiness.getTau(1, fjParticles);
727 tau2 = njettiness.getTau(2, fjParticles);
728 currentAxes = njettiness.currentAxes();
733 float& PVweight)
const {
745 if (baseRef == trackBaseRef) {
746 PVweight =
vtx.trackWeight(baseRef);
754 float& PVweight)
const {
772 const fastjet::PseudoJet& tauAxis,
773 std::vector<float>& tau_trackEtaRel)
const {
775 const std::vector<reco::CandidatePtr>&
tracks =
vertex.daughterPtrVector();
790 desc.add<
double>(
"beta", 1.0);
791 desc.add<
double>(
"R0", 0.8);
792 desc.add<
double>(
"maxSVDeltaRToJet", 0.7);
static constexpr float charmThreshold
static constexpr float dummyTrackSip2dSigAbove
reco::Vertex::Point convertPos(const GlobalPoint &p)
const edm::EDGetTokenT< std::vector< reco::CandSecondaryVertexTagInfo > > svTagInfos_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual CandidatePtr daughterPtr(size_type i) const
reference to daughter at given position
void calcNsubjettiness(const reco::JetBaseRef &jet, float &tau1, float &tau2, std::vector< fastjet::PseudoJet > ¤tAxes) const
T getParameter(std::string const &) const
const double maxDistToAxis_
trackSelector
Tracks selection.
const double maxDecayLen_
void setTracksPVBase(const reco::TrackRef &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
const double maxSVDeltaRToJet_
void add(const reco::Track &track, double weight=1.0)
constexpr bool isNotFinite(T x)
Base class for all types of Jets.
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
int closest(std::vector< int > const &vec, int value)
constexpr bool isUninitialized() const noexcept
Global3DPoint GlobalPoint
const Container & selectedTracks() const
bool isNonnull() const
Checks for non-null.
static constexpr float dummyTrackEtaRel
const PVAssoc fromPV(size_t ipv=0) const
reco::V0Filter trackPairV0Filter
reco::TrackSelector trackSelector
void setTracksPV(const reco::CandidatePtr &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
virtual int isWeighted() const
boolean if weights were applied by algorithm (e.g. PUPPI weights)
reco::TemplatedSecondaryVertexTagInfo< reco::CandIPTagInfo, reco::VertexCompositePtrCandidate > CandSecondaryVertexTagInfo
~BoostedDoubleSVProducer() override
reco::TransientTrack build(const reco::Track *p) const
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void produce(edm::Event &, const edm::EventSetup &) override
void etaRelToTauAxis(const reco::VertexCompositePtrCandidate &vertex, const fastjet::PseudoJet &tauAxis, std::vector< float > &tau_trackEtaRel) const
void addDefault(ParameterSetDescription const &psetDescription)
static constexpr float dummyTrackSip3dSig
edm::Handle< edm::ValueMap< float > > weightsHandle_
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
void beginStream(edm::StreamID) override
bool isNonnull() const
Checks for non-null.
const MagneticField * field() const
static constexpr float dummyFlightDistance2dSig
const math::XYZTLorentzVector & vectorSum() const
Abs< T >::type abs(const T &t)
const std::vector< btag::TrackIPData > & impactParameterData() const
#define DEFINE_FWK_MODULE(type)
static constexpr float dummyVertexEnergyRatio
std::vector< LinkConnSpec >::const_iterator IT
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
T const * get() const
Returns C++ pointer to the item.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
size_t numberOfDaughters() const override
number of daughters
static constexpr float bottomThreshold
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > trackBuilderToken_
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static constexpr float dummyZ_ratio
Particle reconstructed by the particle flow algorithm.
static constexpr float dummyVertexMass
char data[epos_bytes_allocation]
const math::XYZTLorentzVector & weightedVectorSum() const
BoostedDoubleSVProducer(const edm::ParameterSet &)
void endStream() override
const edm::Ref< VertexCollection > & primaryVertex() const
Log< level::Warning, false > LogWarning
static constexpr float dummyVertexDeltaR
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
TrajectoryStateOnSurface impactPointState() const
cont
load Luminosity info ##
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
Global3DVector GlobalVector