156 auto tagInfos = std::make_unique<std::vector<reco::BoostedDoubleSVTagInfo> >();
159 for(std::vector<reco::CandSecondaryVertexTagInfo>::const_iterator iterTI = svTagInfos->begin(); iterTI != svTagInfos->end(); ++iterTI)
174 float jetNTracks = 0, nSV = 0, tau1_nSecondaryVertices = 0, tau2_nSecondaryVertices = 0;
179 std::vector<fastjet::PseudoJet> currentAxes;
187 pv =
GlobalPoint(vertexRef->x(),vertexRef->y(),vertexRef->z());
191 size_t trackSize = selectedTracks.size();
195 std::vector<float> IP3Ds, IP3Ds_1, IP3Ds_2;
199 for (
size_t itt=0; itt < trackSize; ++itt)
203 float track_PVweight = 0.;
205 if (track_PVweight>0.5) allKinematics.
add(trackRef);
208 bool isSelected =
false;
212 bool isfromV0 =
false, isfromV0Tight =
false;
213 std::vector<reco::CandidatePtr> trackPairV0Test(2);
215 trackPairV0Test[0] = trackRef;
217 for (
size_t jtt=0; jtt < trackSize; ++jtt)
219 if (itt == jtt)
continue;
224 trackPairV0Test[1] = pairTrackRef;
231 isfromV0Tight =
true;
234 if (isfromV0 && isfromV0Tight)
238 if( isSelected && !isfromV0Tight ) jetNTracks += 1.;
241 GlobalVector direction(jet->px(), jet->py(), jet->pz());
244 if (currentAxes.size() > 1 &&
reco::deltaR2(trackRef->momentum(),currentAxes[1]) <
reco::deltaR2(trackRef->momentum(),currentAxes[0]))
246 direction =
GlobalVector(currentAxes[index].px(), currentAxes[index].py(), currentAxes[index].pz());
249 float decayLengthTau=-1;
250 float distTauAxis=-1;
262 IP3Ds.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
264 if (currentAxes.size() > 1)
267 IP3Ds_1.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
269 IP3Ds_2.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
272 IP3Ds_1.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
277 bool charmThreshSet =
false;
280 for (
size_t i=0;
i<indices.size(); ++
i)
282 size_t idx = indices[
i];
293 charmThreshSet =
true;
299 if ( (
i+1)<indices.size() ) trackSip2dSigAboveBottom_1 = (ipData[indices[
i+1]]).ip2d.significance();
305 float dummyTrack = -50.;
307 std::sort( IP3Ds.begin(),IP3Ds.end(),std::greater<float>() );
308 std::sort( IP3Ds_1.begin(),IP3Ds_1.end(),std::greater<float>() );
309 std::sort( IP3Ds_2.begin(),IP3Ds_2.end(),std::greater<float>() );
310 int num_1 = IP3Ds_1.size();
311 int num_2 = IP3Ds_2.size();
316 trackSip3dSig_0 = dummyTrack;
317 trackSip3dSig_1 = dummyTrack;
318 trackSip3dSig_2 = dummyTrack;
319 trackSip3dSig_3 = dummyTrack;
325 trackSip3dSig_0 = IP3Ds.at(0);
326 trackSip3dSig_1 = dummyTrack;
327 trackSip3dSig_2 = dummyTrack;
328 trackSip3dSig_3 = dummyTrack;
334 trackSip3dSig_0 = IP3Ds.at(0);
335 trackSip3dSig_1 = IP3Ds.at(1);
336 trackSip3dSig_2 = dummyTrack;
337 trackSip3dSig_3 = dummyTrack;
343 trackSip3dSig_0 = IP3Ds.at(0);
344 trackSip3dSig_1 = IP3Ds.at(1);
345 trackSip3dSig_2 = IP3Ds.at(2);
346 trackSip3dSig_3 = dummyTrack;
352 trackSip3dSig_0 = IP3Ds.at(0);
353 trackSip3dSig_1 = IP3Ds.at(1);
354 trackSip3dSig_2 = IP3Ds.at(2);
355 trackSip3dSig_3 = IP3Ds.at(3);
362 tau1_trackSip3dSig_0 = dummyTrack;
363 tau1_trackSip3dSig_1 = dummyTrack;
369 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
370 tau1_trackSip3dSig_1 = dummyTrack;
376 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
377 tau1_trackSip3dSig_1 = IP3Ds_1.at(1);
384 tau2_trackSip3dSig_0 = dummyTrack;
385 tau2_trackSip3dSig_1 = dummyTrack;
390 tau2_trackSip3dSig_0 = IP3Ds_2.at(0);
391 tau2_trackSip3dSig_1 = dummyTrack;
397 tau2_trackSip3dSig_0 = IP3Ds_2.at(0);
398 tau2_trackSip3dSig_1 = IP3Ds_2.at(1);
405 std::vector<float> tau1_trackEtaRels, tau2_trackEtaRels;
407 std::map<double, size_t> VTXmap;
414 if (currentAxes.size() > 1)
418 tau2Kinematics = tau2Kinematics + vertexKinematic;
419 if( tau2_flightDistance2dSig < 0 )
425 tau2_nSecondaryVertices += 1.;
429 tau1Kinematics = tau1Kinematics + vertexKinematic;
430 if( tau1_flightDistance2dSig < 0 )
436 tau1_nSecondaryVertices += 1.;
440 else if (!currentAxes.empty())
442 tau1Kinematics = tau1Kinematics + vertexKinematic;
443 if( tau1_flightDistance2dSig < 0 )
449 tau1_nSecondaryVertices += 1.;
460 if ( tau1_nSecondaryVertices > 0. )
463 if ( allSum.E() > 0. ) tau1_vertexEnergyRatio = tau1_vertexSum.E() / allSum.E();
464 if ( tau1_vertexEnergyRatio > 50. ) tau1_vertexEnergyRatio = 50.;
466 tau1_vertexMass = tau1_vertexSum.M();
469 if ( tau2_nSecondaryVertices > 0. )
472 if ( allSum.E() > 0. ) tau2_vertexEnergyRatio = tau2_vertexSum.E() / allSum.E();
473 if ( tau2_vertexEnergyRatio > 50. ) tau2_vertexEnergyRatio = 50.;
475 tau2_vertexMass= tau2_vertexSum.M();
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()){
487 tau2_trackEtaRel_0 = dummyEtaRel;
488 tau2_trackEtaRel_1 = dummyEtaRel;
489 tau2_trackEtaRel_2 = dummyEtaRel;
495 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
496 tau2_trackEtaRel_1 = dummyEtaRel;
497 tau2_trackEtaRel_2 = dummyEtaRel;
503 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
504 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
505 tau2_trackEtaRel_2 = dummyEtaRel;
511 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
512 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
513 tau2_trackEtaRel_2 = tau2_trackEtaRels.at(2);
517 switch(tau1_trackEtaRels.size()){
520 tau1_trackEtaRel_0 = dummyEtaRel;
521 tau1_trackEtaRel_1 = dummyEtaRel;
522 tau1_trackEtaRel_2 = dummyEtaRel;
528 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
529 tau1_trackEtaRel_1 = dummyEtaRel;
530 tau1_trackEtaRel_2 = dummyEtaRel;
536 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
537 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
538 tau1_trackEtaRel_2 = dummyEtaRel;
544 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
545 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
546 tau1_trackEtaRel_2 = tau1_trackEtaRels.at(2);
555 for ( std::map<double, size_t>::iterator iVtx=VTXmap.begin(); iVtx!=VTXmap.end(); ++iVtx)
562 SV_p4_0 = vertex.
p4();
563 vtxMass = SV_p4_0.mass();
571 SV_p4_1 = vertex.
p4();
572 vtxMass = (SV_p4_1+SV_p4_0).
mass();
583 if( (tau1_vertexMass<0 && tau2_vertexMass>0) )
587 tau2_trackEtaRel_0=
temp;
591 tau2_trackEtaRel_1=
temp;
595 tau2_trackEtaRel_2=
temp;
599 tau2_flightDistance2dSig=
temp;
605 tau2_vertexEnergyRatio=
temp;
609 tau2_vertexMass=
temp;
reco::Vertex::Point convertPos(const GlobalPoint &p)
const edm::EDGetTokenT< std::vector< reco::CandSecondaryVertexTagInfo > > svTagInfos_
static float dummyVertexEnergyRatio
const math::XYZTLorentzVector & weightedVectorSum() const
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_
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
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 etaRelToTauAxis(const reco::VertexCompositePtrCandidate &vertex, const fastjet::PseudoJet &tauAxis, std::vector< float > &tau_trackEtaRel) const
reco::TrackSelector trackSelector
static float charmThreshold
const edm::Ref< VertexCollection > & primaryVertex() const
static float dummyFlightDistance2dSig
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
static float dummyZ_ratio
Abs< T >::type abs(const T &t)
const LorentzVector & p4() const final
four-momentum Lorentz vector
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.
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
TrajectoryStateOnSurface impactPointState() const
static float dummyTrackEtaRel
static float dummyTrackSip2dSigAbove
Global3DVector GlobalVector
void insert(const TaggingVariable &variable, bool delayed=false)