157 auto tagInfos = std::make_unique<std::vector<reco::BoostedDoubleSVTagInfo> >();
160 for(std::vector<reco::CandSecondaryVertexTagInfo>::const_iterator iterTI = svTagInfos->begin(); iterTI != svTagInfos->end(); ++iterTI)
175 float jetNTracks = 0, nSV = 0, tau1_nSecondaryVertices = 0, tau2_nSecondaryVertices = 0;
180 std::vector<fastjet::PseudoJet> currentAxes;
188 pv =
GlobalPoint(vertexRef->x(),vertexRef->y(),vertexRef->z());
192 size_t trackSize = selectedTracks.size();
196 std::vector<float> IP3Ds, IP3Ds_1, IP3Ds_2;
200 for (
size_t itt=0; itt < trackSize; ++itt)
204 float track_PVweight = 0.;
206 if (track_PVweight>0.5) allKinematics.
add(trackRef);
209 bool isSelected =
false;
213 bool isfromV0 =
false, isfromV0Tight =
false;
214 std::vector<reco::CandidatePtr> trackPairV0Test(2);
216 trackPairV0Test[0] = trackRef;
218 for (
size_t jtt=0; jtt < trackSize; ++jtt)
220 if (itt == jtt)
continue;
225 trackPairV0Test[1] = pairTrackRef;
232 isfromV0Tight =
true;
235 if (isfromV0 && isfromV0Tight)
239 if( isSelected && !isfromV0Tight ) jetNTracks += 1.;
242 GlobalVector direction(jet->px(), jet->py(), jet->pz());
245 if (currentAxes.size() > 1 &&
reco::deltaR2(trackRef->momentum(),currentAxes[1]) <
reco::deltaR2(trackRef->momentum(),currentAxes[0]))
247 direction =
GlobalVector(currentAxes[index].px(), currentAxes[index].py(), currentAxes[index].pz());
250 float decayLengthTau=-1;
251 float distTauAxis=-1;
263 IP3Ds.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
265 if (currentAxes.size() > 1)
268 IP3Ds_1.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
270 IP3Ds_2.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
273 IP3Ds_1.push_back( IP3Dsig<-50. ? -50. : IP3Dsig );
278 bool charmThreshSet =
false;
281 for (
size_t i=0;
i<indices.size(); ++
i)
283 size_t idx = indices[
i];
294 charmThreshSet =
true;
300 if ( (
i+1)<indices.size() ) trackSip2dSigAboveBottom_1 = (ipData[indices[
i+1]]).ip2d.significance();
306 float dummyTrack = -50.;
308 std::sort( IP3Ds.begin(),IP3Ds.end(),std::greater<float>() );
309 std::sort( IP3Ds_1.begin(),IP3Ds_1.end(),std::greater<float>() );
310 std::sort( IP3Ds_2.begin(),IP3Ds_2.end(),std::greater<float>() );
311 int num_1 = IP3Ds_1.size();
312 int num_2 = IP3Ds_2.size();
317 trackSip3dSig_0 = dummyTrack;
318 trackSip3dSig_1 = dummyTrack;
319 trackSip3dSig_2 = dummyTrack;
320 trackSip3dSig_3 = dummyTrack;
326 trackSip3dSig_0 = IP3Ds.at(0);
327 trackSip3dSig_1 = dummyTrack;
328 trackSip3dSig_2 = dummyTrack;
329 trackSip3dSig_3 = dummyTrack;
335 trackSip3dSig_0 = IP3Ds.at(0);
336 trackSip3dSig_1 = IP3Ds.at(1);
337 trackSip3dSig_2 = dummyTrack;
338 trackSip3dSig_3 = dummyTrack;
344 trackSip3dSig_0 = IP3Ds.at(0);
345 trackSip3dSig_1 = IP3Ds.at(1);
346 trackSip3dSig_2 = IP3Ds.at(2);
347 trackSip3dSig_3 = dummyTrack;
353 trackSip3dSig_0 = IP3Ds.at(0);
354 trackSip3dSig_1 = IP3Ds.at(1);
355 trackSip3dSig_2 = IP3Ds.at(2);
356 trackSip3dSig_3 = IP3Ds.at(3);
363 tau1_trackSip3dSig_0 = dummyTrack;
364 tau1_trackSip3dSig_1 = dummyTrack;
370 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
371 tau1_trackSip3dSig_1 = dummyTrack;
377 tau1_trackSip3dSig_0 = IP3Ds_1.at(0);
378 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);
406 std::vector<float> tau1_trackEtaRels, tau2_trackEtaRels;
408 std::map<double, size_t> VTXmap;
415 if (currentAxes.size() > 1)
419 tau2Kinematics = tau2Kinematics + vertexKinematic;
420 if( tau2_flightDistance2dSig < 0 )
426 tau2_nSecondaryVertices += 1.;
430 tau1Kinematics = tau1Kinematics + vertexKinematic;
431 if( tau1_flightDistance2dSig < 0 )
437 tau1_nSecondaryVertices += 1.;
441 else if (!currentAxes.empty())
443 tau1Kinematics = tau1Kinematics + vertexKinematic;
444 if( tau1_flightDistance2dSig < 0 )
450 tau1_nSecondaryVertices += 1.;
461 if ( tau1_nSecondaryVertices > 0. )
464 if ( allSum.E() > 0. ) tau1_vertexEnergyRatio = tau1_vertexSum.E() / allSum.E();
465 if ( tau1_vertexEnergyRatio > 50. ) tau1_vertexEnergyRatio = 50.;
467 tau1_vertexMass = tau1_vertexSum.M();
470 if ( tau2_nSecondaryVertices > 0. )
473 if ( allSum.E() > 0. ) tau2_vertexEnergyRatio = tau2_vertexSum.E() / allSum.E();
474 if ( tau2_vertexEnergyRatio > 50. ) tau2_vertexEnergyRatio = 50.;
476 tau2_vertexMass= tau2_vertexSum.M();
480 float dummyEtaRel = -1.;
482 std::sort( tau1_trackEtaRels.begin(),tau1_trackEtaRels.end() );
483 std::sort( tau2_trackEtaRels.begin(),tau2_trackEtaRels.end() );
485 switch(tau2_trackEtaRels.size()){
488 tau2_trackEtaRel_0 = dummyEtaRel;
489 tau2_trackEtaRel_1 = dummyEtaRel;
490 tau2_trackEtaRel_2 = dummyEtaRel;
496 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
497 tau2_trackEtaRel_1 = dummyEtaRel;
498 tau2_trackEtaRel_2 = dummyEtaRel;
504 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
505 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
506 tau2_trackEtaRel_2 = dummyEtaRel;
512 tau2_trackEtaRel_0 = tau2_trackEtaRels.at(0);
513 tau2_trackEtaRel_1 = tau2_trackEtaRels.at(1);
514 tau2_trackEtaRel_2 = tau2_trackEtaRels.at(2);
518 switch(tau1_trackEtaRels.size()){
521 tau1_trackEtaRel_0 = dummyEtaRel;
522 tau1_trackEtaRel_1 = dummyEtaRel;
523 tau1_trackEtaRel_2 = dummyEtaRel;
529 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
530 tau1_trackEtaRel_1 = dummyEtaRel;
531 tau1_trackEtaRel_2 = dummyEtaRel;
537 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
538 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
539 tau1_trackEtaRel_2 = dummyEtaRel;
545 tau1_trackEtaRel_0 = tau1_trackEtaRels.at(0);
546 tau1_trackEtaRel_1 = tau1_trackEtaRels.at(1);
547 tau1_trackEtaRel_2 = tau1_trackEtaRels.at(2);
556 for ( std::map<double, size_t>::iterator iVtx=VTXmap.begin(); iVtx!=VTXmap.end(); ++iVtx)
563 SV_p4_0 = vertex.
p4();
564 vtxMass = SV_p4_0.mass();
572 SV_p4_1 = vertex.
p4();
573 vtxMass = (SV_p4_1+SV_p4_0).
mass();
584 if( (tau1_vertexMass<0 && tau2_vertexMass>0) )
588 tau2_trackEtaRel_0=
temp;
592 tau2_trackEtaRel_1=
temp;
596 tau2_trackEtaRel_2=
temp;
600 tau2_flightDistance2dSig=
temp;
606 tau2_vertexEnergyRatio=
temp;
610 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)