31 fNPV(-1),
fNThreads(1),fDistanceCut(1.
f),fLCut(-5.
f),fCutCharmPt(0.2
f),fCutCharmChiPrim(85.
f),fCutLVMPt(0.0
f),fCutLVMP(0.0
f),fCutJPsiPt(1.0
f),
32 fD0(0), fD0bar(0), fD04(0), fD04bar(0), fD0KK(0), fD0pipi(0), fDPlus(0), fDMinus(0),
33 fDPlus3Pi(0), fDMinus3Pi(0), fDsPlusK2Pi(0), fDsMinusK2Pi(0), fLcPlusP2Pi(0), fLcMinusP2Pi(0),
34 fLPi(0), fLPiPIndex(0), fHe3Pi(0), fHe3PiBar(0), fHe4Pi(0), fHe4PiBar(0),
35 fHe4L(0), fHe5L(0), fLLn(0), fH5LL(0),
36 fSecCandidates(), fPrimCandidates(), fPrimCandidatesTopo(),fPrimCandidatesTopoMass(),
37 fEmcClusters(0), fMixedEventAnalysis(0), fDecayReconstructionList()
160 const int nPartPrim = vRTracks[2].
NPions() * vRTracks[3].
NKaons() +
168 const int nPart = vRTracks[0].
NPions() * vRTracks[1].
NPions() +
171 int nEmcClusters = 0;
174 vector<KFParticle> vGammaPrimEmc;
176 int nPartEstimation = nPart+vRTracks[0].
Size()+vRTracks[1].
Size()+vRTracks[2].
Size()+vRTracks[3].
Size() + nEmcClusters;
178 if(nPartEstimation < 100000)
179 Particles.reserve(nPartEstimation);
183 for(
int iV=0; iV<4; iV++)
185 for(
int iTr=0; iTr < vRTracks[iV].
Size(); iTr++)
187 vRTracks[iV].
GetTrack(kfTrack, iTr);
188 int pdg = vRTracks[iV].
PDG()[iTr];
189 if( pdg == 19 ) pdg = 13;
190 if( pdg ==-19 ) pdg = -13;
193 tmp.
SetId(Particles.size());
194 vRTracks[iV].
SetId(Particles.size(),iTr);
195 if(vRTracks[iV+4].
Size() > 0)
196 vRTracks[iV+4].
SetId(Particles.size(),iTr);
198 #ifdef NonhomogeneousField
199 for(
int iF=0; iF<10; iF++)
200 tmp.SetFieldCoeff( vRTracks[iV].FieldCoefficient(iF)[iTr], iF);
202 Particles.push_back(tmp);
215 for(
int iV=0; iV<NClustersVec; iV++)
219 tmpGamma.
SetId(Particles.size());
222 Particles.push_back(tmpGamma);
223 vGammaPrimEmc.push_back(tmpGamma);
240 for(
int iPV=0; iPV<
fNPV; iPV++ )
257 for(
int iPV=0; iPV<
fNPV; iPV++ )
267 for(
int iPV=0; iPV<
fNPV; iPV++)
269 Particles, PrimVtx, iPV, 0);
271 for(
int iPV=0; iPV<
fNPV; iPV++)
273 Particles, PrimVtx, iPV, 0);
275 for(
int iPV=0; iPV<
fNPV; iPV++)
277 Particles, PrimVtx, iPV, 0);
279 for(
int iPV=0; iPV<
fNPV; iPV++)
281 Particles, PrimVtx, iPV, 0);
283 for(
int iPV=0; iPV<
fNPV; iPV++)
285 Particles, PrimVtx, iPV, 0);
287 for(
int iPV=0; iPV<
fNPV; iPV++)
289 Particles, PrimVtx, iPV, 0);
291 for(
int iPV=0; iPV<
fNPV; iPV++)
295 for(
int iPV=0; iPV<
fNPV; iPV++)
299 for(
int iPV=0; iPV<
fNPV; iPV++)
301 Particles, PrimVtx, iPV, 0);
303 for(
int iPV=0; iPV<
fNPV; iPV++)
305 Particles, PrimVtx, iPV, 0);
308 FindTrackV0Decay(
fHe3Pi , 3004, vRTracks[0], 1, vRTracks[0].
FirstProton(), vRTracks[0].
LastProton(), Particles, PrimVtx, -1, 0, 0, &
fHe4L);
314 FindTrackV0Decay(
fHe4Pi , 3005, vRTracks[0], 1, vRTracks[0].
FirstProton(), vRTracks[0].
LastProton(), Particles, PrimVtx, -1, 0, 0, &
fHe5L);
328 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]));
331 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]));
334 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]));
337 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]));
340 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]));
343 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]));
346 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]));
349 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]));
357 for(
int iPV=0; iPV<
fNPV; iPV++)
359 Particles, PrimVtx, iPV, 0);
361 for(
int iPV=0; iPV<
fNPV; iPV++)
363 Particles, PrimVtx, iPV, 0);
371 for(
int iPV=0; iPV<
fNPV; iPV++)
373 Particles, PrimVtx, iPV, 0);
375 for(
int iPV=0; iPV<
fNPV; iPV++)
377 Particles, PrimVtx, iPV, 0);
385 for(
int iPV=0; iPV<
fNPV; iPV++)
387 Particles, PrimVtx, iPV, 0);
389 for(
int iPV=0; iPV<
fNPV; iPV++)
391 Particles, PrimVtx, iPV, 0);
396 for(
int iPV=0; iPV<
fNPV; iPV++)
399 for(
int iPV=0; iPV<
fNPV; iPV++)
405 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]));
408 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]));
411 for(
int iPV=0; iPV<
fNPV; iPV++)
414 for(
int iPV=0; iPV<
fNPV; iPV++)
417 for(
int iPV=0; iPV<
fNPV; iPV++)
420 for(
int iPV=0; iPV<
fNPV; iPV++)
423 for(
int iPV=0; iPV<
fNPV; iPV++)
426 for(
int iPV=0; iPV<
fNPV; iPV++)
430 for(
int iPV=0; iPV<
fNPV; iPV++)
433 for(
int iPV=0; iPV<
fNPV; iPV++)
437 for(
int iPV=0; iPV<
fNPV; iPV++)
440 for(
int iPV=0; iPV<
fNPV; iPV++)
470 for(
int iPV=0; iPV<
fNPV; iPV++)
472 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]) );
474 for(
int iPV=0; iPV<
fNPV; iPV++)
476 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]) );
478 for(
int iPV=0; iPV<
fNPV; iPV++)
480 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]) );
482 for(
int iPV=0; iPV<
fNPV; iPV++)
484 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]) );
486 for(
int iPV=0; iPV<
fNPV; iPV++)
488 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]) );
490 for(
int iPV=0; iPV<
fNPV; iPV++)
492 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]) );
494 for(
int iPV=0; iPV<
fNPV; iPV++)
496 Particles, PrimVtx, -1, &(ChiToPrimVtx[0]) );
498 for(
int iPV=0; iPV<
fNPV; iPV++)
500 Particles, PrimVtx, -1, &(ChiToPrimVtx[1]) );
506 Particles, PrimVtx, -1);
508 for(
int iPV=0; iPV<
fNPV; iPV++)
511 for(
int iPV=0; iPV<
fNPV; iPV++)
516 CombinePartPart(
fSecCandidates[3],
fSecCandidates[3], Particles, PrimVtx,
fCutsPartPart[1], -1, 111, 1, 0, &
fPrimCandidates[4], &
fSecCandidates[4], mPi0, mPi0Sigma);
517 for(
int iPV=0; iPV<
fNPV; iPV++)
519 CombinePartPart(
fPrimCandidates[3][iPV],
fPrimCandidates[3][iPV], Particles, PrimVtx,
fCutsPartPart[1], iPV, 111, 1, 0, &
fPrimCandidates[4], &
fSecCandidates[4], mPi0, mPi0Sigma);
520 CombinePartPart(
fSecCandidates[3],
fPrimCandidates[3][iPV], Particles, PrimVtx,
fCutsPartPart[1], -1, 111, 0, 0, &
fPrimCandidates[4], &
fSecCandidates[4], mPi0, mPi0Sigma);
522 for(
int iPV=0; iPV<
fNPV; iPV++ )
528 Particles, PrimVtx, -1);
531 Particles, PrimVtx, -1);
537 for(
int iPV=0; iPV<
fNPV; iPV++)
539 Particles, PrimVtx, -1);
541 for(
int iPV=0; iPV<
fNPV; iPV++)
543 Particles, PrimVtx, -1);
545 for(
int iPV=0; iPV<
fNPV; iPV++)
548 for(
int iPV=0; iPV<
fNPV; iPV++)
551 for(
int iPV=0; iPV<
fNPV; iPV++)
554 for(
int iPV=0; iPV<
fNPV; iPV++)
557 for(
int iPV=0; iPV<
fNPV; iPV++)
560 for(
int iPV=0; iPV<
fNPV; iPV++)
563 for(
int iPV=0; iPV<
fNPV; iPV++)
566 for(
int iPV=0; iPV<
fNPV; iPV++)
616 parts[iv] = &tmpPart[iv];
618 for(
unsigned int iL=0; iL<vParticles.size(); iL +=
float_vLen)
621 unsigned int nPart = vParticles.size();
622 unsigned int nEntries = (iL + float_vLen < nPart) ? float_vLen : (nPart - iL);
625 for(
unsigned int iv=0; iv<nEntries; iv++)
626 tmpPart[iv] = vParticles[iL+iv];
632 for(
unsigned int iv=0; iv<nEntries; iv++)
642 uint_v& idPosDaughters,
643 uint_v& idNegDaughters,
644 int_v& daughterPosPDG,
645 int_v& daughterNegPDG,
648 const unsigned short NTracks,
651 vector<KFParticle>& Particles,
654 const int_v& pvIndex,
655 const float* secCuts,
656 const float_v& massMotherPDG,
657 const float_v& massMotherPDGSigma,
660 vector< vector<KFParticle> >* vMotherPrim,
661 vector<KFParticle>* vMotherSec
698 float_m isPrimary(simd_cast<float_m>(pvIndex>-1));
700 KFParticleSIMD posDaughter(vTracks[iTrTypePos],idPosDaughters, daughterPosPDG);
701 trackId.gather( &(vTracks[iTrTypePos].
Id()[0]), idPosDaughters );
702 posDaughter.
SetId(trackId);
704 KFParticleSIMD negDaughter(vTracks[iTrTypeNeg],idNegDaughters, daughterNegPDG);
705 trackId.gather( &(vTracks[iTrTypeNeg].
Id()[0]), idNegDaughters );
706 negDaughter.
SetId(trackId);
708 float_v ds[2] = {0.f,0.f};
714 const KFParticleSIMD* vDaughtersPointer[2] = {&negDaughter, &posDaughter};
715 mother.
Construct(vDaughtersPointer, 2, 0);
717 float_m saveParticle(simd_cast<float_m>(int_v::IndexesFromZero() <
int(NTracks)));
718 float_v chi2Cut = cuts[1];
719 float_v ldlCut = cuts[2];
720 if( !(simd_cast<float_m>(abs(mother.
PDG()) == 421 || abs(mother.
PDG()) == 426 || abs(mother.
PDG()) == 420)).isEmpty() )
722 chi2Cut( simd_cast<float_m>(abs(mother.
PDG()) == 421 || abs(mother.
PDG()) == 426 || abs(mother.
PDG()) == 420) ) =
fCutsCharm[0];
723 ldlCut( simd_cast<float_m>(abs(mother.
PDG()) == 421 || abs(mother.
PDG()) == 426 || abs(mother.
PDG()) == 420) ) = -1;
726 saveParticle &= (mother.
Chi2()/simd_cast<float_v>(mother.
NDF()) < chi2Cut );
727 saveParticle &= KFPMath::Finite(mother.
GetChi2());
728 saveParticle &= (mother.
GetChi2() > 0.0f);
731 if( saveParticle.isEmpty() )
return;
734 float_v ldlMin(1.e8f);
735 float_m isParticleFromVertex(
false);
737 for(
int iP=0; iP<
fNPV; iP++)
739 float_m isParticleFromVertexLocal;
741 isParticleFromVertex |= isParticleFromVertexLocal;
742 float_v ldl = (l[iP]/dl[iP]);
743 lMin( (l[iP] < lMin) && saveParticle) = l[iP];
744 ldlMin( (ldl < ldlMin) && saveParticle) = ldl;
747 saveParticle &= (lMin < 200.f);
748 #ifdef NonhomogeneousField
751 for(
int iP=0; iP<
fNPV; iP++)
756 float_v ldl = (l[iP]/dl[iP]);
757 ldlMin( (ldl < ldlMin) && saveParticle) = ldl;
760 saveParticle &= ( (float_m(!isPrimary) && ldlMin > ldlCut) || float_m(isPrimary) );
762 saveParticle &= (float_m(!isPrimary) && isParticleFromVertex) || isPrimary;
763 if( saveParticle.isEmpty() )
return;
765 float_m isK0 = saveParticle && simd_cast<float_m>(mother.
PDG() == int_v(310));
766 float_m isLambda = saveParticle && simd_cast<float_m>(abs(mother.
PDG()) == int_v(3122));
767 float_m isGamma = saveParticle && simd_cast<float_m>(mother.
PDG() == int_v(22));
768 float_m isHyperNuclei = saveParticle && simd_cast<float_m>(abs(mother.
PDG()) > 3000 && abs(mother.
PDG()) < 3104);
770 saveParticle &= ( ((isK0 || isLambda || isHyperNuclei) && lMin > float_v(
fLCut)) || !(isK0 || isLambda || isHyperNuclei) );
772 float_m saveMother(
false);
774 if( !(isK0.isEmpty()) || !(isLambda.isEmpty()) || !(isGamma.isEmpty()))
776 float_v
mass, errMass;
779 saveMother = saveParticle;
780 saveMother &= (abs(mass - massMotherPDG)/massMotherPDGSigma) < secCuts[0];
781 saveMother &= ((ldlMin > secCuts[2]) && !isGamma) || isGamma;
782 saveMother &= (isK0 || isLambda || isGamma);
785 for(
int iv=0; iv<NTracks; iv++)
787 if(!saveParticle[iv])
continue;
790 int motherId = Particles.size();
791 mother_temp.
SetId(Particles.size());
792 if( mother.
PDG()[iv] == 421 )
794 fD0.push_back(mother_temp);
797 if( mother.
PDG()[iv] == -421 )
799 fD0bar.push_back(mother_temp);
802 if( mother.
PDG()[iv] == 426 )
804 fD0KK.push_back(mother_temp);
807 if( mother.
PDG()[iv] == 420 )
809 fD0pipi.push_back(mother_temp);
812 if( mother.
PDG()[iv] == 3004)
813 fHe3Pi.push_back(mother_temp);
814 if( mother.
PDG()[iv] == -3004)
816 if( mother.
PDG()[iv] == 3005)
817 fHe4Pi.push_back(mother_temp);
818 if( mother.
PDG()[iv] == -3005)
821 Particles.push_back(mother_temp);
823 if( mother.
PDG()[iv] == 22 && isPrimary[iv] )
825 float negPt2 = negDaughter.
Px()[iv]*negDaughter.
Px()[iv] + negDaughter.
Py()[iv]*negDaughter.
Py()[iv];
826 float posPt2 = posDaughter.
Px()[iv]*posDaughter.
Px()[iv] + posDaughter.
Py()[iv]*posDaughter.
Py()[iv];
830 mother_temp.
SetPDG(100113);
831 mother_temp.
SetId(Particles.size());
832 Particles.push_back(mother_temp);
837 mother_temp.
SetId(Particles.size());
838 Particles.push_back(mother_temp);
843 if( mother.
PDG()[iv] == 200113 )
845 float negPt2 = negDaughter.
Px()[iv]*negDaughter.
Px()[iv] + negDaughter.
Py()[iv]*negDaughter.
Py()[iv];
846 float posPt2 = posDaughter.
Px()[iv]*posDaughter.
Px()[iv] + posDaughter.
Py()[iv]*posDaughter.
Py()[iv];
848 if( (negPt2 >
fCutJPsiPt*
fCutJPsiPt) && (posPt2 >fCutJPsiPt*fCutJPsiPt) && (abs(daughterPosPDG[iv]) == 13) && (abs(daughterNegPDG[iv]) == 13))
850 mother_temp.
SetPDG(100443);
851 mother_temp.
SetId(Particles.size());
852 Particles.push_back(mother_temp);
858 mother.
SetId(motherId);
859 motherPrimSecCand.
SetOneEntry(nPrimSecCand,mother,iv);
864 SaveV0PrimSecCand(motherPrimSecCand,nPrimSecCand,mother_temp,PrimVtx,secCuts,vMotherPrim,vMotherSec);
875 const float* secCuts,
876 vector< vector<KFParticle> >* vMotherPrim,
877 vector<KFParticle>* vMotherSec)
891 float_v massMotherPDG, massMotherPDGSigma;
893 float_m isSec(
false);
894 float_m isPrim(
false);
899 float_m isK0 = simd_cast<float_m>(mother.
PDG() == int_v(310));
900 float_m isLambda = simd_cast<float_m>(abs(mother.
PDG()) == int_v(3122));
901 float_m isGamma = simd_cast<float_m>(mother.
PDG() == int_v(22));
903 int_v arrayIndex(-1);
905 arrayIndex(mother.
PDG() == int_v(310)) = 0;
906 arrayIndex(mother.
PDG() == int_v(3122)) = 1;
907 arrayIndex(mother.
PDG() == int_v(-3122)) = 2;
908 arrayIndex(mother.
PDG() == int_v(22)) = 3;
910 float_m isPrimaryPart(
false);
912 float_v chi2TopoMin = 1.e4f;
914 for(
int iP=0; iP<
fNPV; iP++)
919 const float_v& motherTopoChi2Ndf = motherTopo.
GetChi2()/simd_cast<float_v>(motherTopo.
GetNDF());
920 chi2TopoMin(motherTopoChi2Ndf < chi2TopoMin) = motherTopoChi2Ndf;
921 const float_m isPrimaryPartLocal = ( motherTopoChi2Ndf < secCuts[1] );
922 if(isPrimaryPartLocal.isEmpty())
continue;
923 isPrimaryPart |= isPrimaryPartLocal;
924 for(
int iV=0; iV<NParticles; iV++)
926 if(isPrimaryPartLocal[iV])
930 iPrimVert[iV].push_back(iP);
935 for(
int iV=0; iV<NParticles; iV++)
937 if(isPrimaryPartLocal[iV])
945 isPrim |= ( ( isPrimaryPart ) && (isK0 || isLambda || isGamma) );
947 isSec |= ( (!isPrimaryPart ) && (isK0 || isLambda || isGamma) && (chi2TopoMin < float_v(500.
f)) );
949 isSec |= ( (!isPrimaryPart ) && (isK0 || isLambda || isGamma) );
954 for(
int iv=0; iv<NParticles; iv++)
956 if(isPrim[iv] || isSec[iv])
962 for(
unsigned int iP = 0; iP<iPrimVert[iv].size(); iP++)
963 vMotherPrim[arrayIndex[iv]][iPrimVert[iv][iP]].push_back(mother_temp);
967 vMotherSec[arrayIndex[iv]].push_back(mother_temp);
973 vector<KFParticle>& Particles,
976 const float* secCuts,
977 vector< vector<KFParticle> >* vMotherPrim,
978 vector<KFParticle>* vMotherSec )
1005 unsigned int nBufEntry = 0;
1006 uint_v idNegDaughters;
1007 uint_v idPosDaughters;
1008 int_v daughterPosPDG(-1);
1009 int_v daughterNegPDG(-1);
1011 int_v pvIndexMother(-1);
1013 float_v massMotherPDG(Vc::Zero), massMotherPDGSigma(Vc::Zero);
1014 int_v V0PDG(Vc::Zero);
1017 int nPrimSecCand =0;
1019 int trTypeIndexPos[2] = {0,2};
1020 int trTypeIndexNeg[2] = {1,3};
1022 for(
int iTrTypeNeg = 0; iTrTypeNeg<2; iTrTypeNeg++)
1024 KFPTrackVector& negTracks = vTracks[ trTypeIndexNeg[iTrTypeNeg] ];
1026 for(
int iTrTypePos=0; iTrTypePos<2; iTrTypePos++)
1028 KFPTrackVector& posTracks = vTracks[ trTypeIndexPos[iTrTypePos] ];
1029 int_v negTracksSize = negTracks.
Size();
1030 int nPositiveTracks = posTracks.
Size();
1034 int startTCPos[5] = {0};
1035 int endTCPos[5] = {0};
1036 int startTCNeg[5] = {0};
1037 int endTCNeg[5] = {0};
1039 if((iTrTypeNeg == 0) && (iTrTypePos == 0))
1044 startTCPos[0] = 0; endTCPos[0] = nPositiveTracks;
1045 startTCNeg[0] = 0; endTCNeg[0] = negTracksSize[0];
1047 startTCPos[1] = 0; endTCPos[1] = 0;
1048 startTCNeg[1] = 0; endTCNeg[1] = 0;
1050 startTCPos[2] = posTracks.
FirstPion(); endTCPos[2] = nPositiveTracks;
1057 startTCNeg[4] = negTracks.
FirstProton(); endTCNeg[4] = negTracksSize[0];
1060 if( iTrTypeNeg != iTrTypePos )
1064 startTCPos[0] = 0; endTCPos[0] = nPositiveTracks;
1065 startTCNeg[0] = 0; endTCNeg[0] = negTracksSize[0];
1068 if((iTrTypeNeg == 1) && (iTrTypePos == 1))
1073 startTCPos[0] = 0; endTCPos[0] = nPositiveTracks;
1074 startTCNeg[0] = 0; endTCNeg[0] = negTracksSize[0];
1082 startTCPos[3] = posTracks.
FirstPion(); endTCPos[3] = nPositiveTracks;
1089 for(
int iTC=0; iTC<nTC; iTC++)
1091 for(
int iTrN=startTCNeg[iTC]; iTrN < endTCNeg[iTC]; iTrN +=
float_vLen)
1095 int_v negInd = int_v::IndexesFromZero() + int(iTrN);
1097 int_v negPDG =
reinterpret_cast<const int_v&
>(negTracks.
PDG()[iTrN]);
1098 int_v negPVIndex =
reinterpret_cast<const int_v&
>(negTracks.
PVIndex()[iTrN]);
1099 int_v negNPixelHits =
reinterpret_cast<const int_v&
>(negTracks.
NPixelHits()[iTrN]);
1101 int_v trackPdgNeg = negPDG;
1102 int_m activeNeg = (negPDG != -1);
1104 if( !((negPDG == -1).isEmpty()) )
1106 trackPdgNeg(negPVIndex<0 && (negPDG == -1) ) = -211;
1108 activeNeg |= int_m(negPVIndex < 0) && int_m(negPDG == -1) ;
1111 activeNeg &= (int_v::IndexesFromZero() < int(NTracksNeg));
1113 daughterNeg.
Load(negTracks, iTrN, negPDG);
1115 float_v chiPrimNeg(Vc::Zero);
1116 float_v chiPrimPos(Vc::Zero);
1118 if( (iTrTypeNeg == 0) && (iTrTypePos == 0) )
1119 chiPrimNeg =
reinterpret_cast<const float_v&
>( ChiToPrimVtx[trTypeIndexNeg[iTrTypeNeg]][iTrN]);
1121 for(
int iTrP=startTCPos[iTC]; iTrP < endTCPos[iTC]; iTrP +=
float_vLen)
1123 const int NTracks = (iTrP +
float_vLen < nPositiveTracks) ?
float_vLen : (nPositiveTracks - iTrP);
1125 const int_v& posPDG =
reinterpret_cast<const int_v&
>(posTracks.
PDG()[iTrP]);
1126 const int_v& posPVIndex =
reinterpret_cast<const int_v&
>(posTracks.
PVIndex()[iTrP]);
1127 const int_v& posNPixelHits =
reinterpret_cast<const int_v&
>(posTracks.
NPixelHits()[iTrP]);
1128 const int_m& isPosSecondary = (posPVIndex < 0);
1130 daughterPos.
Load(posTracks, iTrP, posPDG);
1132 if( (iTrTypeNeg == 0) && (iTrTypePos == 0) )
1133 chiPrimPos =
reinterpret_cast<const float_v&
>( ChiToPrimVtx[trTypeIndexPos[iTrTypePos]][iTrP]);
1139 negPDG = negPDG.rotated(1);
1140 negPVIndex = negPVIndex.rotated(1);
1141 negNPixelHits = negNPixelHits.rotated(1);
1142 negInd = negInd.rotated(1);
1143 trackPdgNeg = trackPdgNeg.rotated(1);
1146 chiPrimNeg = chiPrimNeg.rotated(1);
1148 activeNeg = ( (negPDG != -1) || ( (negPVIndex < 0) && (negPDG == -1) ) ) && (negInd < negTracksSize);
1150 const int_m& isSecondary = int_m( negPVIndex < 0 ) && isPosSecondary;
1151 const int_m& isPrimary = int_m( negPVIndex >= 0 ) && (!isPosSecondary);
1153 float_m closeDaughters = simd_cast<float_m>(activeNeg && (int_v::IndexesFromZero() < int_v(NTracks)));
1155 if(closeDaughters.isEmpty() && (iTC != 0))
continue;
1158 int_v trackPdgPos[2];
1161 active[0] = (posPDG != -1);
1162 active[0] &= ((isPrimary && (posPVIndex == negPVIndex)) || !(isPrimary));
1164 active[1] = int_m(
false);
1166 trackPdgPos[0] = posPDG;
1169 if( (posPDG == -1).isEmpty() && (posPDG > 1000000000).isEmpty() && (posPDG == 211).isEmpty() )
1175 trackPdgPos[0](isSecondary && posPDG == -1) = 211;
1176 trackPdgPos[1] = 2212;
1178 active[0] |= isSecondary && int_m(posPDG == -1);
1179 active[1] = isSecondary && (int_m(posPDG == -1) || (posPDG > 1000000000) || (posPDG == 211));
1184 active[0] &= simd_cast<int_m>(closeDaughters);
1185 active[1] &= simd_cast<int_m>(closeDaughters);
1190 active[0] = (negInd < negTracksSize) && (int_v::IndexesFromZero() < int_v(NTracks));
1193 for(
int iPDGPos=0; iPDGPos<nPDGPos; iPDGPos++)
1195 if(active[iPDGPos].isEmpty())
continue;
1199 int_v motherPDG(-1);
1205 motherPDG( (abs(trackPdgPos[iPDGPos]) == 11) || int_m(abs(trackPdgNeg) == 11) || isSecondary ) = 22;
1209 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 13 || abs(trackPdgPos[iPDGPos])==19)
1210 && (int_m(abs(trackPdgNeg) == 13) || int_m(abs(trackPdgNeg) == 19)) ) = 200113;
1214 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 211) ) = 310;
1215 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 2212) && int_m(abs(trackPdgNeg) == 211) ) = 3122;
1216 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 1000010020) && int_m(abs(trackPdgNeg) == 211) ) = 3003;
1217 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 1000010030) && int_m(abs(trackPdgNeg) == 211) ) = 3103;
1218 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 1000020030) && int_m(abs(trackPdgNeg) == 211) ) = 3004;
1219 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 1000020040) && int_m(abs(trackPdgNeg) == 211) ) = 3005;
1220 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 211) ) = -421;
1221 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 211) ) = 313;
1222 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 211) ) = 113;
1223 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 2212) && int_m(abs(trackPdgNeg) == 211) ) = 2114;
1227 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 321) ) = 421;
1228 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 321) ) = 426;
1229 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 321) ) = -313;
1230 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 2212) && int_m(abs(trackPdgNeg) == 321) ) = 3124;
1231 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 321) ) = 333;
1235 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 2212) ) = -3122;
1236 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 1000010020) ) = -3003;
1237 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 1000010030) ) = -3103;
1238 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 1000020030) ) = -3004;
1239 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 1000020040) ) = -3005;
1240 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 2212) ) = -3124;
1241 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 2212) && int_m(abs(trackPdgNeg) == 2212) ) = 200443;
1242 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 2212) ) = -2114;
1248 motherPDG( (abs(trackPdgPos[iPDGPos])== 11) && int_m(abs(trackPdgNeg) == 11) ) = 22;
1250 motherPDG( isPrimary && (abs(trackPdgPos[iPDGPos])== 13 || abs(trackPdgPos[iPDGPos])==19)
1251 && (int_m(abs(trackPdgNeg) == 13) || int_m(abs(trackPdgNeg) == 19)) ) = 200113;
1253 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 321) && int_m(abs(trackPdgNeg) == 211) ) = -421;
1255 motherPDG( isSecondary && (abs(trackPdgPos[iPDGPos])== 211) && int_m(abs(trackPdgNeg) == 321) ) = 421;
1258 if( (iTrTypeNeg == 0) && (iTrTypePos == 0) )
1260 float_v chiprimCut =
fCuts2D[0];
1261 chiprimCut( simd_cast<float_m>(abs(motherPDG) == 421 || abs(motherPDG) == 426) ) =
fCutCharmChiPrim;
1262 active[iPDGPos] &= simd_cast<int_m>(chiPrimNeg > chiprimCut && chiPrimPos > chiprimCut);
1265 active[iPDGPos] &= (motherPDG != -1);
1270 if(!(active[iPDGPos][iV]))
continue;
1274 active[iPDGPos] &= (motherPDG != -1);
1276 if(active[iPDGPos].isEmpty())
continue;
1278 if(!( (iTrTypePos == 1) && (iTrTypeNeg == 1) ) )
1282 float_v negParameters[8], posParameters[8];
1285 float_v dx = negParameters[0]-posParameters[0];
1286 float_v
dy = negParameters[1]-posParameters[1];
1287 float_v
dz = negParameters[2]-posParameters[2];
1288 float_v dr = sqrt(dx*dx+dy*dy+dz*dz);
1290 active[iPDGPos] &= simd_cast<int_m>(dr < float_v(
fDistanceCut));
1291 if(active[iPDGPos].isEmpty())
continue;
1293 float_v p1p2 = posParameters[3]*negParameters[3] + posParameters[4]*negParameters[4] + posParameters[5]*negParameters[5];
1294 float_v p12 = posParameters[3]*posParameters[3] + posParameters[4]*posParameters[4] + posParameters[5]*posParameters[5];
1295 float_v p22 = negParameters[3]*negParameters[3] + negParameters[4]*negParameters[4] + negParameters[5]*negParameters[5];
1296 active[iPDGPos] &= simd_cast<int_m>(p1p2 > -p12);
1297 active[iPDGPos] &= simd_cast<int_m>(p1p2 > -p22);
1300 const float_v& ptNeg2 = daughterNeg.
Px()*daughterNeg.
Px() + daughterNeg.
Py()*daughterNeg.
Py();
1301 const float_v& ptPos2 = daughterPos.
Px()*daughterPos.
Px() + daughterPos.
Py()*daughterPos.
Py();
1302 if( !((abs(motherPDG) == 421 || abs(motherPDG) == 426).isEmpty()) )
1304 active[iPDGPos] &= ( (abs(motherPDG) == 421 || abs(motherPDG) == 426) &&
1306 simd_cast<int_m>(ptPos2 >= fCutCharmPt*
fCutCharmPt) &&
1308 int_m(negNPixelHits >= int_v(3)) && int_m(posNPixelHits >= int_v(3)) )
1309 || (!(abs(motherPDG) == 421 || abs(motherPDG) == 426));
1312 if(active[iPDGPos].isEmpty())
continue;
1316 if(!(active[iPDGPos][iV]))
continue;
1319 idPosDaughters[nBufEntry] = iTrP+iV;
1320 idNegDaughters[nBufEntry] = negInd[iV];
1322 daughterPosPDG[nBufEntry] = trackPdgPos[iPDGPos][iV];
1323 daughterNegPDG[nBufEntry] = trackPdgNeg[iV];
1325 if(motherPDG[iV] == 22)
1327 daughterPosPDG[nBufEntry] = -11;
1328 daughterNegPDG[nBufEntry] = 11;
1331 pvIndexMother[nBufEntry] = isPrimary[iV] ? negPVIndex[iV] : -1;
1333 if( iTrTypeNeg != iTrTypePos ) pvIndexMother[nBufEntry] = 0;
1335 V0PDG[nBufEntry] = motherPDG[iV];
1343 ConstructV0(vTracks, trTypeIndexPos[iTrTypePos], trTypeIndexNeg[iTrTypeNeg],
1344 idPosDaughters, idNegDaughters, daughterPosPDG, daughterNegPDG,
1345 mother, mother_temp,
1346 nBufEntry, l, dl, Particles, PrimVtx,
1347 cuts, pvIndexMother, secCuts, massMotherPDG,
1348 massMotherPDGSigma, motherPrimSecCand, nPrimSecCand, vMotherPrim, vMotherSec);
1353 if(motherPDG[iV] == 310 &&
1356 negNPixelHits[iV] >= 3 && posNPixelHits[iV] >= 3 &&
1360 idPosDaughters[nBufEntry] = iTrP+iV;
1361 idNegDaughters[nBufEntry] = negInd[iV];
1363 daughterPosPDG[nBufEntry] = trackPdgPos[iPDGPos][iV];
1364 daughterNegPDG[nBufEntry] = trackPdgNeg[iV];
1366 pvIndexMother[nBufEntry] = isPrimary[iV] ? negPVIndex[iV] : -1;
1368 V0PDG[nBufEntry] = 420;
1376 ConstructV0(vTracks, trTypeIndexPos[iTrTypePos], trTypeIndexNeg[iTrTypeNeg],
1377 idPosDaughters, idNegDaughters, daughterPosPDG, daughterNegPDG,
1378 mother, mother_temp,
1379 nBufEntry, l, dl, Particles, PrimVtx,
1380 cuts, pvIndexMother, secCuts, massMotherPDG,
1381 massMotherPDGSigma, motherPrimSecCand, nPrimSecCand, vMotherPrim, vMotherSec);
1396 idPosDaughters[iV] = idPosDaughters[0];
1397 idNegDaughters[iV] = idNegDaughters[0];
1403 ConstructV0(vTracks, trTypeIndexPos[iTrTypePos], trTypeIndexNeg[iTrTypeNeg],
1404 idPosDaughters, idNegDaughters, daughterPosPDG, daughterNegPDG,
1405 mother, mother_temp,
1406 nBufEntry, l, dl, Particles, PrimVtx,
1407 cuts, pvIndexMother, secCuts, massMotherPDG,
1408 massMotherPDGSigma, motherPrimSecCand, nPrimSecCand, vMotherPrim, vMotherSec);
1414 SaveV0PrimSecCand(motherPrimSecCand,nPrimSecCand,mother_temp,PrimVtx,secCuts,vMotherPrim,vMotherSec);
1423 vector<KFParticle>& Particles,
1426 const float* secCuts,
1427 vector< vector<KFParticle> >* vMotherPrim,
1428 vector<KFParticle>* vMotherSec )
1454 unsigned int nBufEntry = 0;
1456 uint_v idNegDaughters;
1457 uint_v idPosDaughters;
1458 int_v daughterPosPDG(-1);
1459 int_v daughterNegPDG(-1);
1461 int_v pvIndexMother(-1);
1463 float_v massMotherPDG(Vc::Zero), massMotherPDGSigma(Vc::Zero);
1464 int_v V0PDG(Vc::Zero);
1467 int nPrimSecCand =0;
1469 for(
int iSet=2; iSet<4; iSet++)
1476 int nPositiveTracks = positivePrimaryTracks.
Size();
1480 int_v negPDG = positivePrimaryTracks.
PDG()[iTrN];
1481 int_v negPVIndex = positivePrimaryTracks.
PVIndex()[iTrN];
1483 int_m activeNeg = (negPDG != -1);
1487 const int NTracks = (iTrP +
float_vLen < nPositiveTracks) ?
float_vLen : (nPositiveTracks - iTrP);
1490 int_v posPVIndex(0);
1491 for(
int iV=0; iV<NTracks; iV++)
1493 posPDG[iV] = positivePrimaryTracks.
PDG()[iTrP+iV];
1494 posPVIndex[iV] = positivePrimaryTracks.
PVIndex()[iTrP+iV];
1497 int_m
active = (activeNeg && (int_v::IndexesFromZero() < int_v(NTracks)));
1498 if(active.isEmpty())
continue;
1500 active &= (posPDG != int_v(-1));
1501 active &= (posPVIndex == negPVIndex);
1503 if(active.isEmpty())
continue;
1507 int_v motherPDG(-1);
1509 motherPDG( (abs(posPDG)== 211) && int_m(abs(negPDG) == 211) ) = signPDG*9001;
1510 motherPDG( (abs(posPDG)== 321) && int_m(abs(negPDG) == 211) ) = signPDG*9002;
1511 motherPDG( (abs(posPDG)== 211) && int_m(abs(negPDG) == 321) ) = signPDG*9002;
1512 motherPDG( (abs(posPDG)== 211) && int_m(abs(negPDG) == 2212) ) = signPDG*2224;
1513 motherPDG( (abs(posPDG)== 2212) && int_m(abs(negPDG) == 211) ) = signPDG*2224;
1514 motherPDG( (abs(posPDG)== 321) && int_m(abs(negPDG) == 321) ) = signPDG*9003;
1515 motherPDG( (abs(posPDG)== 321) && int_m(abs(negPDG) == 2212) ) = signPDG*9004;
1516 motherPDG( (abs(posPDG)== 2212) && int_m(abs(negPDG) == 321) ) = signPDG*9004;
1518 active &= (motherPDG != -1);
1523 if(!(active[iV]))
continue;
1527 active &= (motherPDG != -1);
1529 if(active.isEmpty())
continue;
1532 if(active.isEmpty())
continue;
1534 for(
int iV=0; iV<NTracks; iV++)
1536 if(!(active[iV]))
continue;
1538 idPosDaughters[nBufEntry] = iTrP+iV;
1539 idNegDaughters[nBufEntry] = iTrN;
1541 daughterPosPDG[nBufEntry] = posPDG[iV];
1542 daughterNegPDG[nBufEntry] = negPDG[iV];
1544 pvIndexMother[nBufEntry] = negPVIndex[iV];
1546 V0PDG[nBufEntry] = motherPDG[iV];
1555 idPosDaughters, idNegDaughters, daughterPosPDG, daughterNegPDG,
1556 mother, mother_temp,
1557 nBufEntry, l, dl, Particles, PrimVtx,
1558 cuts, pvIndexMother, secCuts, massMotherPDG,
1559 massMotherPDGSigma, motherPrimSecCand, nPrimSecCand, vMotherPrim, vMotherSec);
1569 idPosDaughters[iV] = idPosDaughters[0];
1570 idNegDaughters[iV] = idNegDaughters[0];
1577 idPosDaughters, idNegDaughters, daughterPosPDG, daughterNegPDG,
1578 mother, mother_temp,
1579 nBufEntry, l, dl, Particles, PrimVtx,
1580 cuts, pvIndexMother, secCuts, massMotherPDG,
1581 massMotherPDGSigma, motherPrimSecCand, nPrimSecCand, vMotherPrim, vMotherSec);
1587 SaveV0PrimSecCand(motherPrimSecCand,nPrimSecCand,mother_temp,PrimVtx,secCuts,vMotherPrim,vMotherSec);
1601 const unsigned short nElements,
1604 std::vector<KFParticle>& Particles,
1606 const float_v*
cuts,
1607 const int_v& pvIndex,
1608 const float_v& massMotherPDG,
1609 const float_v& massMotherPDGSigma,
1610 std::vector< std::vector<KFParticle> >* vMotherPrim,
1611 std::vector<KFParticle>* vMotherSec)
1635 float_m isPrimary(simd_cast<float_m>(pvIndex>-1));
1637 int_v trackId( &(vTracks.
Id()[0]), idTracks );
1640 track.
SetId(trackId);
1642 float_m isSameParticle = simd_cast<float_m>((abs(mother.
PDG()) == int_v(4122)) ||
1643 (abs(mother.
PDG()) == int_v(114122)) ||
1644 (abs(mother.
PDG()) == int_v(204122)) ||
1645 (abs(mother.
PDG()) == int_v(504122)) ||
1646 (abs(mother.
PDG()) == int_v(404122)) ||
1647 (abs(mother.
PDG()) == int_v(425)) ||
1648 (abs(mother.
PDG()) == int_v(427)) ||
1649 (abs(mother.
PDG()) == int_v(200411)) ||
1650 (abs(mother.
PDG()) == int_v(300411)) ||
1651 (abs(mother.
PDG()) == int_v(300431)) ||
1652 (abs(mother.
PDG()) == int_v(400431)) ||
1653 (abs(mother.
PDG()) == int_v(411)) ||
1654 (abs(mother.
PDG()) == int_v(431)) ||
1655 (abs(mother.
PDG()) == int_v(429)) ||
1656 (abs(mother.
PDG()) == int_v(1003334)) ||
1657 (abs(mother.
PDG()) == int_v(3001)) ||
1658 (abs(mother.
PDG()) == int_v(3006)) ||
1659 (abs(mother.
PDG()) == int_v(3007)) ||
1660 (abs(mother.
PDG()) == int_v(3009)) ||
1661 (abs(mother.
PDG()) == int_v(3011)) );
1662 if( isSameParticle.isEmpty() )
1665 float_v ds[2] = {0.f,0.f};
1672 mother.
Construct(vDaughtersPointer, 2, 0);
1676 int_v motherPDG = mother.
PDG();
1678 mother.
SetPDG(motherPDG);
1683 float_m
active = simd_cast<float_m>(int_v::IndexesFromZero() < int(nElements));
1685 float_m saveParticle(active);
1686 saveParticle &= (mother.
Chi2()/simd_cast<float_v>(mother.
NDF()) < cuts[2] );
1687 saveParticle &= KFPMath::Finite(mother.
GetChi2());
1688 saveParticle &= (mother.
GetChi2() > 0.0f);
1691 if( saveParticle.isEmpty() ) {
return; }
1693 int_m isSameTrack(
false);
1694 for(
unsigned int iD=0; iD<V0.
DaughterIds().size(); iD++)
1695 isSameTrack |= ( int_v(V0.
DaughterIds()[iD]) == int_v(trackId) );
1697 saveParticle &= ( !simd_cast<float_m>(isSameTrack));
1698 if( saveParticle.isEmpty() ) {
return; }
1700 float_v lMin(1.e8f);
1701 float_v ldlMin(1.e8f);
1702 float_m isParticleFromVertex(
false);
1704 for(
int iP=0; iP<
fNPV; iP++)
1706 float_m isParticleFromVertexLocal;
1708 isParticleFromVertex |= isParticleFromVertexLocal;
1709 float_v ldl = (l[iP]/dl[iP]);
1710 lMin( (l[iP] < lMin) && active) = l[iP];
1711 ldlMin( (ldl < ldlMin) && active) = ldl;
1713 saveParticle &= (lMin < 200.f);
1714 saveParticle &= ((float_m(!isPrimary) && isParticleFromVertex) || float_m(isPrimary) );
1715 if( saveParticle.isEmpty() ) {
return; }
1717 isSameParticle = isSameParticle || isPrimary;
1718 if(!((isSameParticle).isFull()))
1720 float_m isParticleFromVertexLocal;
1724 saveParticle &= ( isSameParticle || ((!isSameParticle) && isParticleFromVertexLocal));
1725 if( saveParticle.isEmpty() ) {
return; }
1728 saveParticle &= ( (float_m(!isPrimary) && ldlMin > cuts[0]) || float_m(isPrimary) );
1730 int_m setLCut = abs(mother.
PDG()) == 3312 || abs(mother.
PDG()) == 3334 || abs(mother.
PDG()) == 3001;
1731 saveParticle &= ( (simd_cast<float_m>(setLCut) && lMin > float_v(
fLCut)) || simd_cast<float_m>(!setLCut) );
1734 for(
int iP=0; iP<
fNPV; iP++)
1736 motherTopo[iP] = mother;
1738 motherTopo[iP].GetDecayLength(l[iP], dl[iP]);
1739 float_v ldl = (l[iP]/dl[iP]);
1740 ldlMin( (ldl < ldlMin) && active) = ldl;
1744 float_m isPrimaryPart(
false);
1746 for(
int iP=0; iP<
fNPV; iP++)
1748 const float_v& motherTopoChi2Ndf = motherTopo[iP].GetChi2()/simd_cast<float_v>(motherTopo[iP].GetNDF());
1749 const float_m isPrimaryPartLocal = ( motherTopoChi2Ndf < cuts[1] );
1750 isPrimaryPart |= isPrimaryPartLocal;
1753 if(isPrimaryPartLocal[iV])
1754 iPrimVert[iV].push_back(iP);
1758 for(
unsigned int iv=0; iv<nElements; iv++)
1760 if(!saveParticle[iv])
continue;
1763 if( mother.
PDG()[iv] == 3312 )
1765 fLPi.push_back(mother_temp);
1778 if( (abs(mother.
PDG()[iv]) == 411) ||
1779 (abs(mother.
PDG()[iv]) == 429) ||
1780 (abs(mother.
PDG()[iv]) == 431) ||
1781 (abs(mother.
PDG()[iv]) == 4122) ||
1782 (abs(mother.
PDG()[iv]) == 114122) ||
1783 (abs(mother.
PDG()[iv]) == 204122) ||
1784 (abs(mother.
PDG()[iv]) == 314122) ||
1785 (abs(mother.
PDG()[iv]) == 404122) ||
1786 (abs(mother.
PDG()[iv]) == 504122) ||
1787 (abs(mother.
PDG()[iv]) == 425) ||
1788 (abs(mother.
PDG()[iv]) == 427) ||
1789 (abs(mother.
PDG()[iv]) == 200411) ||
1790 (abs(mother.
PDG()[iv]) == 300411) ||
1791 (abs(mother.
PDG()[iv]) == 300431) ||
1792 (abs(mother.
PDG()[iv]) == 400431) ||
1793 (abs(mother.
PDG()[iv]) == 1003334) ||
1794 (abs(mother.
PDG()[iv]) == 3001) )
1797 for(
int iD=0; iD < vV0[iv]->
NDaughters(); iD++)
1802 if( mother.
PDG()[iv] == 411 )
1804 fDPlus.push_back(mother_temp);
1807 if( mother.
PDG()[iv] == -411 )
1809 fDMinus.push_back(mother_temp);
1812 if( mother.
PDG()[iv] == 300411 )
1817 if( mother.
PDG()[iv] == -300411 )
1822 if( mother.
PDG()[iv] == 400431 )
1827 if( mother.
PDG()[iv] == -400431 )
1832 if( mother.
PDG()[iv] == 504122 )
1837 if( mother.
PDG()[iv] == -504122 )
1848 if( mother.
PDG()[iv] == 429 )
1850 fD04.push_back(mother_temp);
1853 if( mother.
PDG()[iv] == -429 )
1855 fD04bar.push_back(mother_temp);
1859 if( mother.
PDG()[iv] == 3203 )
1860 fLLn.push_back(mother_temp);
1861 if( mother.
PDG()[iv] == 3010 )
1862 fH5LL.push_back(mother_temp);
1864 mother_temp.
SetId(Particles.size());
1866 if(!(isPrimaryPart[iv]))
1870 float mass, errMass;
1871 mother_temp.
GetMass(mass, errMass);
1872 if(abs(mother.
PDG()[iv]) == 3324)
1874 vMotherSec->push_back(mother_temp);
1878 if( (fabs(mass - massMotherPDG[iv])/massMotherPDGSigma[iv]) <= 3 )
1882 vMotherSec->push_back(mother_temp);
1886 if(!(mother.
PDG()[iv] == 3006 || mother.
PDG()[iv] == 3007))
1904 if(abs(mother.
GetPDG()[iv]) == 521 || abs(mother.
GetPDG()[iv]) == 529 || abs(mother.
GetPDG()[iv]) == 511 || abs(mother.
GetPDG()[iv]) == 519)
1909 if(abs(mother.
GetPDG()[iv]) == 521 || abs(mother.
GetPDG()[iv]) == 529)
1915 daughter_temp.
GetMass(mass,dm);
1916 if( (fabs(mass - massPDG)/massSigmaPDG) > 3 )
continue;
1922 daughter_temp.
SetId(Particles.size());
1923 daughter_temp.
SetPDG(-1);
1924 mother_temp.
SetId(Particles.size()+1);
1928 Particles.push_back(daughter_temp);
1930 Particles.push_back(mother_temp);
1932 if( abs(mother.
GetPDG()[iv]) == 3334 )
1934 float mass, errMass;
1935 mother_temp.
GetMass(mass, errMass);
1938 if( mother.
GetPDG()[iv] == 3334 )
1943 if( (fabs(mass - massMotherPDG[iv])/massMotherPDGSigma[iv]) <= 3 )
1944 for(
unsigned int iP=0; iP<iPrimVert[iv].size(); iP++)
1945 (*motherVector)[iPrimVert[iv][iP]].push_back(mother_temp);
1950 if( !((abs(mother.
GetPDG()[iv]) == 3312) || (abs(mother.
GetPDG()[iv]) == 3324)))
continue;
1951 float mass, errMass;
1953 mother_temp.
GetMass(mass, errMass);
1954 if(abs(mother.
PDG()[iv]) == 3324)
1956 for(
unsigned int iP=0; iP<iPrimVert[iv].size(); iP++)
1957 (*vMotherPrim)[iPrimVert[iv][iP]].push_back(mother_temp);
1963 if( (fabs(mass - massMotherPDG[iv])/massMotherPDGSigma[iv]) <= 3 )
1964 for(
unsigned int iP=0; iP<iPrimVert[iv].size(); iP++)
1965 (*vMotherPrim)[iPrimVert[iv][iP]].push_back(mother_temp);
1975 const int firstTrack,
1976 const int lastTrack,
1977 vector<KFParticle>& Particles,
1981 vector< vector<KFParticle> >* vMotherPrim,
1982 vector<KFParticle>* vMotherSec)
1999 if( (vV0.size() < 1) || ((lastTrack-firstTrack) < 1) )
return;
2005 std::vector<KFParticleSIMD, KFPSimdAllocator<KFParticleSIMD> > motherTopo(
fNPV);
2012 unsigned int nBufEntry = 0;
2015 int_v trackPDGMother(-1);
2017 int_v pvIndexMother(-1);
2019 float_v massMotherPDG(Vc::Zero), massMotherPDGSigma(Vc::Zero);
2020 int_v motherParticlePDG(Vc::Zero);
2023 bool isCharm = ((abs(V0PDG) == 421) || (abs(V0PDG) == 411) || (abs(V0PDG) == 429) || (abs(V0PDG) == 420) || (abs(V0PDG) == 419)) && (v0PVIndex<0);
2025 for(
unsigned int iV0=0; iV0 < vV0.size(); iV0++)
2027 int iNegDaughter = vV0[iV0].DaughterIds()[0];
2028 int iPosDaughter = vV0[iV0].DaughterIds()[1];
2030 for(
int iTr=firstTrack; iTr < lastTrack; iTr +=
float_vLen)
2034 const int_v& trackPDG =
reinterpret_cast<const int_v&
>(vTracks.
PDG()[iTr]);
2035 const int_v& trackPVIndex =
reinterpret_cast<const int_v&
>(vTracks.
PVIndex()[iTr]);
2037 const int_m& isTrackSecondary = (trackPVIndex < 0);
2038 const int_m& isSecondary = int_m( v0PVIndex < 0 ) && isTrackSecondary;
2039 const int_m& isPrimary = int_m( v0PVIndex >= 0 ) && (!isTrackSecondary);
2040 const int_m& isSamePV = (isPrimary && (v0PVIndex == trackPVIndex)) || !(isPrimary);
2042 float_m closeDaughters = simd_cast<float_m>(isSamePV) && simd_cast<float_m>(int_v::IndexesFromZero() < int(NTracks));
2084 track.
Load(vTracks, iTr, trackPDG);
2086 if(closeDaughters.isEmpty())
continue;
2089 int_v trackPdgPos[2];
2094 active[0] = simd_cast<int_m>(closeDaughters);
2095 active[1] = (trackPDG == -1) && isSecondary && simd_cast<int_m>(closeDaughters);
2097 trackPdgPos[0] = trackPDG;
2099 if( (trackPDG == -1).isEmpty() || (abs(V0PDG) == 421) || (abs(V0PDG) == 411) )
2105 trackPdgPos[0](trackPDG == -1) = q*211;
2107 trackPdgPos[1](isSecondary) = q*321;
2110 for(
int iPDGPos=0; iPDGPos<nPDGPos; iPDGPos++)
2113 if(active[iPDGPos].isEmpty())
continue;
2117 int_v motherPDG(-1);
2121 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 3312;
2122 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 304122;
2123 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 321) ) = 3334;
2124 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = 3224;
2125 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = 3114;
2126 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -321) ) = 1003314;
2128 else if( V0PDG == -3122 )
2130 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = -3312;
2131 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -304122;
2132 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 321) ) = -3334;
2133 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = -3224;
2134 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = -3114;
2135 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 321) ) = -1003314;
2137 else if( V0PDG == 310)
2139 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = 323;
2140 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = -323;
2141 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 100411;
2142 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -100411;
2143 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 321) ) = 100431;
2144 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = -100431;
2145 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 104122;
2146 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -2212) ) = -104122;
2148 else if( V0PDG == 3312 )
2149 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = 3324;
2150 else if( V0PDG == -3312)
2151 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = -3324;
2152 else if( V0PDG == 3324 )
2153 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -321) ) = 1003334;
2154 else if( V0PDG == -3324 )
2155 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 321) ) = -1003334;
2156 else if(V0PDG == 421)
2158 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 411;
2159 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 321) ) = 431;
2160 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 4122;
2161 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2162 int_m isDMeson = isSecondary && int_m(trackPdgPos[iPDGPos] == 211);
2163 active[iPDGPos] &= (!(isDMeson)) || (isDMeson && (
id > iPosDaughter) );
2164 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -521;
2165 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = -529;
2166 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = 10411;
2168 else if(V0PDG == -421)
2170 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -411;
2171 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = -431;
2172 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] ==-2212) ) = -4122;
2173 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2174 int_m isDMeson = isSecondary && int_m(trackPdgPos[iPDGPos] == -211);
2175 active[iPDGPos] &= (!(isDMeson)) || (isDMeson && (
id > iNegDaughter) );
2176 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 521;
2177 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 321) ) = 529;
2178 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = -10411;
2180 else if(V0PDG == 420 && q>0)
2182 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 211) ) = 300411;
2183 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 321) ) = 400431;
2184 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 2212) ) = 504122;
2185 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2186 int_m isDMeson = isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 211);
2187 active[iPDGPos] &= (!(isDMeson)) || (isDMeson && (
id > iPosDaughter) );
2189 else if(V0PDG == 420 && q<0)
2191 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 211) ) = -300411;
2192 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 321) ) = -400431;
2193 motherPDG( isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 2212) ) = -504122;
2194 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2195 int_m isDMeson = isSecondary && int_m(abs(trackPdgPos[iPDGPos]) == 211);
2196 active[iPDGPos] &= (!(isDMeson)) || (isDMeson && (
id > iNegDaughter) );
2198 else if(V0PDG == 411)
2200 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 429;
2201 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = 10421;
2203 else if(V0PDG == -411)
2205 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = -429;
2206 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = -10421;
2208 else if(V0PDG == 419)
2210 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -511;
2211 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = -519;
2213 else if(V0PDG == -419)
2215 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 511;
2216 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 321) ) = 519;
2218 else if(V0PDG == 429)
2219 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 211) ) = 20411;
2220 else if(V0PDG == -429)
2221 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -211) ) = -20411;
2222 else if( V0PDG == 3002 )
2224 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2225 int_m isSameProton = (
id ==
fLPiPIndex[iV0]);
2226 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) && (!isSameProton)) = 3001;
2228 else if( V0PDG == 100411 )
2230 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 425;
2232 else if( V0PDG == 100431 )
2234 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = 427;
2236 else if( V0PDG == 425)
2238 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 200411;
2239 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -200411;
2240 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 321) ) = 300431;
2241 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -321) ) = -300431;
2243 else if( V0PDG == 111 )
2245 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 3222;
2246 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -2212) ) = -3222;
2247 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == 321) ) = 100323;
2248 motherPDG( isPrimary && int_m(trackPdgPos[iPDGPos] == -321) ) = -100323;
2250 else if( V0PDG == 3004 )
2252 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 3006;
2253 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 3203;
2255 else if( V0PDG == -3004 )
2256 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -2212) ) = -3006;
2257 else if( V0PDG == 3005 )
2258 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 3007;
2259 else if( V0PDG == -3005 )
2260 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -2212) ) = -3007;
2261 else if( V0PDG == 3006 )
2262 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 3008;
2263 else if( V0PDG == 3007 )
2264 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 3010;
2265 else if( V0PDG == 3203 )
2266 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) ) = 3009;
2267 else if( V0PDG == 3010 )
2269 const int_v&
id =
reinterpret_cast<const int_v&
>(vTracks.
Id()[iTr]);
2270 int_m isSameProton = (
id == Particles[vV0[iV0].DaughterIds()[1]].DaughterIds()[2]);
2271 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 2212) && (!isSameProton)) = 3011;
2273 else if(V0PDG == 304122)
2274 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 314122;
2275 else if(V0PDG == -304122)
2276 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -314122;
2277 else if(V0PDG == 314122)
2278 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 404122;
2279 else if(V0PDG == -314122)
2280 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = -404122;
2281 else if(V0PDG == 104122)
2282 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = 114122;
2283 else if(V0PDG == -104122)
2284 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = -114122;
2285 else if(V0PDG == 114122)
2286 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == -211) ) = 204122;
2287 else if(V0PDG == -114122)
2288 motherPDG( isSecondary && int_m(trackPdgPos[iPDGPos] == 211) ) = -204122;
2290 active[iPDGPos] &= (motherPDG != -1);
2295 if(!(active[iPDGPos][iV]))
continue;
2299 active[iPDGPos] &= (motherPDG != -1);
2302 active[iPDGPos] &= ( !( (abs(motherPDG) == 3334 || abs(motherPDG) == 3312 ) ) ||
2303 ( (abs(motherPDG) == 3334 || abs(motherPDG) == 3312 ) && simd_cast<int_m>(reinterpret_cast<const float_v&>((*ChiToPrimVtx)[iTr]) > float_v(
fCuts2D[0])) ) );
2305 if(active[iPDGPos].isEmpty())
continue;
2309 track.
Load(vTracks, iTr, trackPDG);
2310 const float_v& trackPt = track.
Px()*track.
Px() + track.
Py()*track.
Py();
2311 const int_v& nPixelHits =
reinterpret_cast<const int_v&
>(vTracks.
NPixelHits()[iTr]);
2313 active[iPDGPos] &= simd_cast<int_m>(trackPt >=
fCutCharmPt*
fCutCharmPt) && simd_cast<int_m>(reinterpret_cast<const float_v&>((*ChiToPrimVtx)[iTr]) >
fCutCharmChiPrim ) && int_m(nPixelHits >= int_v(3));
2316 int_m isCharmParticle = (abs(motherPDG) == 104122) ||
2317 (abs(motherPDG) == 204122) ||
2318 (abs(motherPDG) == 304122) ||
2319 (abs(motherPDG) == 404122) ||
2320 (abs(motherPDG) == 425) ||
2321 (abs(motherPDG) == 426) ||
2322 (abs(motherPDG) == 427) ||
2323 (abs(motherPDG) == 100411) ||
2324 (abs(motherPDG) == 200411) ||
2325 (abs(motherPDG) == 100431) ||
2326 (abs(motherPDG) == 300431) ;
2328 if(!(isCharmParticle.isEmpty()))
2330 track.
Load(vTracks, iTr, trackPDG);
2331 const float_v& trackPt = track.
Px()*track.
Px() + track.
Py()*track.
Py();
2332 const int_v& nPixelHits =
reinterpret_cast<const int_v&
>(vTracks.
NPixelHits()[iTr]);
2334 active[iPDGPos] &= ( (simd_cast<int_m>(trackPt >=
fCutCharmPt*
fCutCharmPt) && simd_cast<int_m>(reinterpret_cast<const float_v&>((*ChiToPrimVtx)[iTr]) >
fCutCharmChiPrim ) && (nPixelHits >= int_v(3)) ) && isCharmParticle ) || (!isCharmParticle);
2338 for(
int iV=0; iV<NTracks; iV++)
2340 if(!(active[iPDGPos][iV]))
continue;
2343 idTrack[nBufEntry] = iTr+iV;
2344 v0Pointer[nBufEntry] = &vV0[iV0];
2346 trackPDGMother[nBufEntry] = trackPdgPos[iPDGPos][iV];
2348 pvIndexMother[nBufEntry] = v0PVIndex;
2350 float massMother, massMotherSigma;
2353 massMotherPDG[nBufEntry] = massMother;
2354 massMotherPDGSigma[nBufEntry] = massMotherSigma;
2355 motherParticlePDG[nBufEntry] = motherPDG[iV];
2359 switch (abs(motherPDG[iV]))
2361 case 3312: motherType = 0;
break;
2362 case 3334: motherType = 0;
break;
2363 case 4122: motherType = 1;
break;
2364 case 104122: motherType = 1;
break;
2365 case 304122: motherType = 1;
break;
2366 case 504122: motherType = 1;
break;
2367 case 425: motherType = 1;
break;
2368 case 426: motherType = 1;
break;
2369 case 427: motherType = 1;
break;
2370 case 100411: motherType = 1;
break;
2371 case 300411: motherType = 1;
break;
2372 case 100431: motherType = 1;
break;
2373 case 400431: motherType = 1;
break;
2374 case 431: motherType = 1;
break;
2375 case 411: motherType = 1;
break;
2376 case 428: motherType = 1;
break;
2377 case 429: motherType = 1;
break;
2378 case 521: motherType = 1;
break;
2379 case 529: motherType = 1;
break;
2380 case 511: motherType = 1;
break;
2381 case 519: motherType = 1;
break;
2382 case 3001: motherType = 1;
break;
2383 case 3222: motherType = 1;
break;
2384 case 3006: motherType = 1;
break;
2385 case 3007: motherType = 1;
break;
2386 case 3008: motherType = 1;
break;
2387 case 3009: motherType = 1;
break;
2388 case 3011: motherType = 1;
break;
2389 default: motherType = 2;
break;
2391 for(
int iCut=0; iCut<3; iCut++)
2392 cuts[iCut][nBufEntry] =
fCutsTrackV0[motherType][iCut];
2398 mother.
SetPDG( motherParticlePDG );
2400 idTrack, trackPDGMother, v0Pointer,
2401 mother, motherTopo, mother_temp,
2402 nBufEntry, l, dl, Particles, PrimVtx,
2403 cuts, pvIndexMother, massMotherPDG,
2404 massMotherPDGSigma, vMotherPrim, vMotherSec);
2415 idTrack[iV] = idTrack[0];
2417 mother.
SetPDG( motherParticlePDG );
2419 idTrack, trackPDGMother, v0Pointer,
2420 mother, motherTopo, mother_temp,
2421 nBufEntry, l, dl, Particles, PrimVtx,
2422 cuts, pvIndexMother, massMotherPDG,
2423 massMotherPDGSigma, vMotherPrim, vMotherSec);
2429 vector<KFParticle>& vCandidates,
2431 const float& cutChi2Topo,
2432 const float& cutLdL,
2434 const float& massErr,
2435 const float& massCut)
2451 int nCand = vCandidates.size();
2453 vector<KFParticle> newCandidates;
2460 for(
int iv=0; iv<nEntries; iv++)
2461 cand[iv] = &vCandidates[iC+iv];
2465 float_m saveParticle(simd_cast<float_m>(int_v::IndexesFromZero() <
int(nEntries)));
2467 float_v lMin(1.e8f);
2468 float_v ldlMin(1.e8f);
2469 float_m isParticleFromVertex(
false);
2471 for(
int iP=0; iP<
fNPV; iP++)
2473 float_m isParticleFromVertexLocal;
2475 isParticleFromVertex |= isParticleFromVertexLocal;
2476 float_v ldl = (l[iP]/dl[iP]);
2477 lMin( (l[iP] < lMin) && saveParticle) = l[iP];
2478 ldlMin( (ldl < ldlMin) && saveParticle) = ldl;
2480 saveParticle &= ldlMin > cutLdL;
2481 saveParticle &= (lMin < 200.f);
2482 saveParticle &= isParticleFromVertex;
2483 if( saveParticle.isEmpty() )
continue;
2487 for(
int iP=0; iP<
fNPV; iP++)
2489 candTopo[iP] = mother;
2493 for(
int iv=0; iv<nEntries; iv++)
2495 if(!saveParticle[iv])
continue;
2498 for(
int iP=0; iP<
fNPV; iP++)
2500 if( !(KFPMath::Finite(candTopo[iP].
GetChi2())[iv]) )
continue;
2501 if(!(candTopo[iP].
GetChi2()[iv] > 0.0
f))
continue;
2502 if(!(candTopo[iP].
GetChi2()[iv]==candTopo[iP].
GetChi2()[iv]))
continue;
2504 if(
float(candTopo[iP].
GetChi2()[iv])/
float(candTopo[iP].
GetNDF()[iv]) <= cutChi2Topo )
2510 vCandidates[iC+iv].SetId(Particles.size());
2511 Particles.push_back(vCandidates[iC+iv]);
2514 vCandidates[iC+iv].GetMass(m,dm);
2515 if( (fabs(m - mass)/massErr) > massCut )
continue;
2517 vCandidates[iC+iv].SetNonlinearMassConstraint(mass);
2518 newCandidates.push_back(vCandidates[iC+iv]);
2520 if(candTopo)
delete [] candTopo;
2523 vCandidates = newCandidates;
2527 vector<KFParticle>& particles2,
2528 vector<KFParticle>& Particles,
2532 const int MotherPDG,
2533 bool isSameInputPart,
2534 bool saveOnlyPrimary,
2535 vector< vector<KFParticle> >* vMotherPrim,
2536 vector<KFParticle>* vMotherSec,
2537 float massMotherPDG,
2538 float massMotherPDGSigma)
2555 if( (particles1.size() == 0) || (particles2.size() == 0) )
return;
2561 mother.
SetPDG( MotherPDG );
2566 int nPart2 = particles2.size();
2568 bool isPrimary = (iPV >= 0);
2569 bool isCharm = (MotherPDG == 425) ||
2570 (MotherPDG == 427) ||
2571 (abs(MotherPDG) == 200411) ||
2572 (abs(MotherPDG) == 404122) ||
2573 (abs(MotherPDG) == 4132) ||
2574 (abs(MotherPDG) == 300431) ||
2575 (abs(MotherPDG) == 204122);
2577 for(
unsigned int iP1=0; iP1 < particles1.size(); iP1++)
2581 unsigned int startIndex=0;
2582 if(isSameInputPart) startIndex=iP1+1;
2583 for(
int iP2=startIndex; iP2 < nPart2; iP2 +=
float_vLen)
2586 float_m
active(simd_cast<float_m>(int_v::IndexesFromZero() <
int(nElements)));
2588 for(
int iv=0; iv<nElements; iv++)
2589 tmpPart2[iv] = &particles2[iP2+iv];
2624 mother = vDaughters[0];
2625 mother += vDaughters[1];
2626 mother.
SetPDG( MotherPDG );
2630 const KFParticleSIMD* vDaughtersPointer[2] = {&vDaughters[0], &vDaughters[1]};
2631 mother.
Construct(vDaughtersPointer, 2, 0);
2634 float_m saveParticle(active);
2635 saveParticle &= (mother.
Chi2()/simd_cast<float_v>(mother.
NDF()) < cuts[2] );
2636 saveParticle &= KFPMath::Finite(mother.
GetChi2());
2637 saveParticle &= (mother.
GetChi2() >= 0.0f);
2640 if( saveParticle.isEmpty() ) {
continue; }
2642 int_m isSameTrack(
false);
2643 for(
unsigned int iD=0; iD<vDaughters[0].
DaughterIds().size(); iD++)
2644 for(
unsigned int iD1=0; iD1<vDaughters[1].
DaughterIds().size(); iD1++)
2646 saveParticle &= ( !simd_cast<float_m>(isSameTrack));
2647 if( saveParticle.isEmpty() ) {
continue; }
2649 float_v lMin(1.e8f);
2650 float_v ldlMin(1.e8f);
2651 float_m isParticleFromVertex(
false);
2653 for(
int iP=0; iP<
fNPV; iP++)
2655 if( (iPV > -1) && (iP !=iPV) )
continue;
2656 float_m isParticleFromVertexLocal;
2658 isParticleFromVertex |= isParticleFromVertexLocal;
2659 float_v ldl = (l[iP]/dl[iP]);
2660 lMin( (l[iP] < lMin) && active) = l[iP];
2661 ldlMin( (ldl < ldlMin) && active) = ldl;
2663 saveParticle &= ( (float_m(!isPrimary) && ldlMin > cuts[0]) || float_m(isPrimary) );
2664 saveParticle &= (lMin < 200.f);
2666 int_m setLCut = abs(mother.
PDG()) == 3000;
2667 saveParticle &= ( (simd_cast<float_m>(setLCut) && lMin > float_v(
fLCut)) || simd_cast<float_m>(!setLCut) );
2670 saveParticle &= ((float_m(!isPrimary) && isParticleFromVertex) || float_m(isPrimary) );
2671 if( saveParticle.isEmpty() ) {
continue; }
2673 float_m isSameParticle(isPrimary || isCharm);
2674 if(!((isSameParticle).isFull()))
2676 float_m isParticleFromVertexLocal;
2680 saveParticle &= ( isSameParticle || ((!isSameParticle) && isParticleFromVertexLocal));
2681 if( saveParticle.isEmpty() ) {
continue; }
2684 for(
int iP=0; iP<
fNPV; iP++)
2686 if( (iPV > -1) && (iP !=iPV) )
continue;
2687 motherTopo[iP] = mother;
2692 float_m isPrimaryPart(
false);
2694 for(
int iP=0; iP<
fNPV; iP++)
2696 if( (iPV > -1) && (iP !=iPV) )
continue;
2697 const float_v& motherTopoChi2Ndf = motherTopo[iP].
GetChi2()/simd_cast<float_v>(motherTopo[iP].
GetNDF());
2698 const float_m isPrimaryPartLocal = ( motherTopoChi2Ndf < float_v(cuts[1]) );
2699 isPrimaryPart |= isPrimaryPartLocal;
2702 if(isPrimaryPartLocal[iV])
2703 iPrimVert[iV].push_back(iP);
2707 for(
int iv=0; iv<nElements; iv++)
2709 if(!saveParticle[iv])
continue;
2714 if( (abs(mother.
PDG()[iv]) == 428))
2717 for(
int iD=0; iD < particles1[iP1].NDaughters(); iD++)
2718 mother_temp.
AddDaughterId( particles1[iP1].DaughterIds()[iD] );
2724 if(isPrimaryPart[iv])
2726 mother_temp.
SetId(Particles.size());
2727 Particles.push_back(mother_temp);
2732 mother_temp.
SetId(Particles.size());
2733 Particles.push_back(mother_temp);
2736 if(vMotherPrim || vMotherSec)
2738 float mass, errMass;
2739 mother_temp.
GetMass(mass, errMass);
2740 if( (fabs(mass - massMotherPDG)/massMotherPDGSigma) > 3.
f )
continue;
2743 if(MotherPDG == 428)
2746 for(
int iD=0; iD < tmpPart2[iv]->
NDaughters(); iD++)
2748 for(
int iD=0; iD < particles1[iP1].NDaughters(); iD++)
2749 mother_temp.
AddDaughterId( particles1[iP1].DaughterIds()[iD] );
2752 if(vMotherSec && (!(isPrimaryPart[iv])) )
2753 vMotherSec->push_back(mother_temp);
2755 for(
unsigned int iP=0; iP<iPrimVert[iv].size(); iP++)
2756 (*vMotherPrim)[iPrimVert[iv][iP]].push_back(mother_temp);
2762 if(motherTopo)
delete [] motherTopo;
2767 vector<KFParticle>& Particles)
2784 uint_v idMotherTrack;
2785 uint_v idChargedDaughter;
2786 int_v ChargedDaughterPDG(-1);
2788 int_v pvIndexMother(-1);
2790 int outNeutralDaughterPDG[4][5];
2791 int outMotherPDG[4][5];
2793 int trTypeIndexMother[2] = {6,7};
2794 int trTypeIndexDaughter[2] = {0,1};
2796 for(
int iTrTypeDaughter = 0; iTrTypeDaughter<2; iTrTypeDaughter++)
2798 KFPTrackVector& DaughterTracks = vTracks[ trTypeIndexDaughter[iTrTypeDaughter] ];
2799 KFPTrackVector& MotherTracks = vTracks[ trTypeIndexMother[iTrTypeDaughter] ];
2801 int_v DaughterTracksSize = DaughterTracks.
Size();
2802 int MotherTracksSize = MotherTracks.
Size();
2806 int startTCMother[4] = {0,0,0,0};
2807 int endTCMother[4] = {0,0,0,0};
2808 int startTCDaughter[4] = {0,0,0,0};
2809 int endTCDaughter[4] = {0,0,0,0};
2812 vector<int> nMotherHypothesis(nTC,0);
2813 vector< vector<int> > motherPDGHypothesis(nTC);
2814 vector< vector<float> > neutralDaughterMassHypothesis(nTC);
2818 startTCMother[0] = 0; endTCMother[0] = MotherTracksSize;
2819 startTCDaughter[0] = DaughterTracks.
FirstMuon(); endTCDaughter[0] = DaughterTracks.
LastMuon();
2821 nMotherHypothesis[0] = 2;
2824 motherPDGHypothesis[0].push_back(211);
2825 motherPDGHypothesis[0].push_back(321);
2827 neutralDaughterMassHypothesis[0].push_back(0.);
2828 neutralDaughterMassHypothesis[0].push_back(0.);
2830 outNeutralDaughterPDG[0][0]=-7000014;
2831 outNeutralDaughterPDG[0][1]=-8000014;
2833 outMotherPDG[0][0]=-7000211;
2834 outMotherPDG[0][1]=-7000321;
2837 startTCMother[1] = 0; endTCMother[1] = MotherTracksSize;
2838 startTCDaughter[1] = DaughterTracks.
FirstPion(); endTCDaughter[1] = DaughterTracks.
LastPion();
2840 nMotherHypothesis[1] = 5;
2842 motherPDGHypothesis[1].push_back(3112);
2843 motherPDGHypothesis[1].push_back(3222);
2844 motherPDGHypothesis[1].push_back(3312);
2845 motherPDGHypothesis[1].push_back(3334);
2846 motherPDGHypothesis[1].push_back(321);
2848 neutralDaughterMassHypothesis[1].push_back(0.939565);
2849 neutralDaughterMassHypothesis[1].push_back(0.939565);
2850 neutralDaughterMassHypothesis[1].push_back(1.115683);
2851 neutralDaughterMassHypothesis[1].push_back(1.31486);
2852 neutralDaughterMassHypothesis[1].push_back(0.1349766);
2854 outNeutralDaughterPDG[1][0]= 7002112;
2855 outNeutralDaughterPDG[1][1]=-8002112;
2856 outNeutralDaughterPDG[1][2]= 7003122;
2857 outNeutralDaughterPDG[1][3]= 7003322;
2858 outNeutralDaughterPDG[1][4]=-9000111;
2860 outMotherPDG[1][0]= 7003112;
2861 outMotherPDG[1][1]=-7003222;
2862 outMotherPDG[1][2]= 7003312;
2863 outMotherPDG[1][3]= 7003334;
2864 outMotherPDG[1][4]=-9000321;
2867 startTCMother[2] = 0; endTCMother[2] = MotherTracksSize;
2868 startTCDaughter[2] = DaughterTracks.
FirstKaon(); endTCDaughter[2] = DaughterTracks.
LastKaon();
2870 nMotherHypothesis[2] = 1;
2872 motherPDGHypothesis[2].push_back(3334);
2874 neutralDaughterMassHypothesis[2].push_back(1.115683);
2876 outNeutralDaughterPDG[2][0]= 8003122;
2878 outMotherPDG[2][0]= 8003334;
2881 startTCMother[3] = 0; endTCMother[3] = MotherTracksSize;
2884 nMotherHypothesis[3] = 1;
2886 motherPDGHypothesis[3].push_back(3222);
2888 neutralDaughterMassHypothesis[3].push_back(0.1349766);
2890 outNeutralDaughterPDG[3][0]=-8000111;
2892 outMotherPDG[3][0]=-8003222;
2896 for(
int iTC=0; iTC<nTC; iTC++)
2898 for(
unsigned short iTrD=startTCDaughter[iTC]; iTrD < endTCDaughter[iTC]; iTrD +=
float_vLen)
2902 int_v DaughterInd = int_v::IndexesFromZero() + int(iTrD);
2904 int_v DaughterPDG =
reinterpret_cast<const int_v&
>(DaughterTracks.
PDG()[iTrD]);
2905 int_v DaughterPVIndex =
reinterpret_cast<const int_v&
>(DaughterTracks.
PVIndex()[iTrD]);
2906 int_v daughterId =
reinterpret_cast<const int_v&
>(DaughterTracks.
Id()[iTrD]);
2908 int_v trackPdgDaughter = DaughterPDG;
2909 int_m activeDaughter = (DaughterPDG != -1);
2911 if( !((DaughterPDG == -1).isEmpty()) )
2913 trackPdgDaughter(DaughterPVIndex<0 && (DaughterPDG == -1) ) = 211;
2918 activeDaughter = (int_v::IndexesFromZero() < int(NTracksDaughter));
2920 ChargedDaughter.
Load(DaughterTracks, iTrD, DaughterPDG);
2921 ChargedDaughter.
SetId(daughterId);
2923 for(
unsigned short iTrM=startTCMother[iTC]; iTrM < endTCMother[iTC]; iTrM +=
float_vLen)
2925 const unsigned short NTracks = (iTrM +
float_vLen < MotherTracksSize) ?
float_vLen : (MotherTracksSize - iTrM);
2929 const int_v& motherTrackId =
reinterpret_cast<const int_v&
>(MotherTracks.
Id()[iTrM]);
2935 DaughterPDG = DaughterPDG.rotated(1);
2936 DaughterPVIndex = DaughterPVIndex.rotated(1);
2937 DaughterInd = DaughterInd.rotated(1);
2938 trackPdgDaughter = trackPdgDaughter.rotated(1);
2940 ChargedDaughter.
Rotate();
2942 activeDaughter = (DaughterInd < DaughterTracksSize);
2945 int_v trackPdgMother;
2948 activeDaughter &= abs(DaughterPDG)==13;
2950 activeDaughter &= abs(DaughterPDG)==211;
2952 activeDaughter &= abs(DaughterPDG)==321;
2954 activeDaughter &= abs(DaughterPDG)==2212;
2955 if (activeDaughter.isEmpty())
continue;
2958 for(
int iHypothesis=0; iHypothesis<nMotherHypothesis[iTC]; iHypothesis++)
2960 int motherKFPDG = outMotherPDG[iTC][iHypothesis];
2961 if(iTrTypeDaughter==0) motherKFPDG = -outMotherPDG[iTC][iHypothesis];
2964 int_m
active = activeDaughter && (int_v::IndexesFromZero() < int(NTracks));
2966 MotherTrack.
Load(MotherTracks, iTrM, motherPDGHypothesis[iTC][iHypothesis]);
2968 float_v zMother = MotherTrack.
Z();
2969 float_v zCD = ChargedDaughter.
Z();
2972 active &= simd_cast<int_m>(zCD >= (zMother - float_v(0.5
f)));
2973 if( active.isEmpty() )
continue;
2977 active &= simd_cast<int_m>(neutralDaughter.
E() > ChargedDaughter.
E());
2978 if( active.isEmpty() )
continue;
2981 neutralDaughter.
NDF() = -1;
2982 neutralDaughter.
Chi2() = 0.f;
2986 active &= simd_cast<int_m>(neutralDaughter.
Z() >= zMother - float_v(10.0
f));
2987 active &= simd_cast<int_m>(neutralDaughter.
Z() <= zCD + float_v(10.0
f));
2989 active &= simd_cast<int_m>(neutralDaughter.
NDF() >= int_v(Vc::Zero));
2990 active &= simd_cast<int_m>(neutralDaughter.
Chi2()/simd_cast<float_v>(neutralDaughter.
NDF()) <=
fCuts2D[1]);
2992 active &= simd_cast<int_m>(neutralDaughter.
Chi2() >= float_v(Vc::Zero));
2993 active &= simd_cast<int_m>(neutralDaughter.
Chi2() == neutralDaughter.
Chi2());
2994 if( active.isEmpty() )
continue;
2998 if ((iTC==1 && iHypothesis<4) || iTC==2)
2999 active &= simd_cast<int_m>( !( (neutralDaughter.
GetPt())<0.5
f && neutralDaughter.
GetRapidity()<0.5f ) );
3001 active &= simd_cast<int_m>( !( (neutralDaughter.
GetPt())<0.2
f && neutralDaughter.
GetRapidity()<1.f ) );
3002 if( active.isEmpty() )
continue;
3007 const KFParticleSIMD* daughters[2] = {&neutralDaughter, &ChargedDaughter};
3012 active &= simd_cast<int_m>(mother.
Z() >= zMother);
3013 active &= simd_cast<int_m>(mother.
Z() <= zCD);
3015 active &= simd_cast<int_m>(mother.
NDF() >= int_v(Vc::Zero));
3016 active &= simd_cast<int_m>(mother.
Chi2()/simd_cast<float_v>(mother.
NDF()) <=
fCuts2D[1]);
3018 active &= simd_cast<int_m>(mother.
Chi2() >= float_v(Vc::Zero));
3019 active &= simd_cast<int_m>(mother.
Chi2() == mother.
Chi2());
3020 if( active.isEmpty() )
continue;
3022 for(
int iV=0; iV<NTracks; iV++)
3024 if(!active[iV])
continue;
3027 int neutralId = Particles.size();
3028 mother_temp.
SetId(neutralId);
3029 if (iTrTypeDaughter==0)
3030 mother_temp.
SetPDG(-outNeutralDaughterPDG[iTC][iHypothesis]);
3032 mother_temp.
SetPDG(outNeutralDaughterPDG[iTC][iHypothesis]);
3033 Particles.push_back(mother_temp);
3036 mother_temp.
SetId(Particles.size());
3041 if (iTrTypeDaughter==0)
3042 mother_temp.
SetPDG(-outMotherPDG[iTC][iHypothesis]);
3044 mother_temp.
SetPDG(outMotherPDG[iTC][iHypothesis]);
3045 Particles.push_back(mother_temp);
3073 if(candidate.
GetPDG() == 310) iSet = 0;
3074 if(candidate.
GetPDG() == 3122) iSet = 1;
3075 if(candidate.
GetPDG() == -3122) iSet = 2;
3076 if(candidate.
GetPDG() == 22) iSet = 3;
3077 if(candidate.
GetPDG() == 111) iSet = 4;
3078 if(candidate.
GetPDG() == 3312) iSet = 5;
3079 if(candidate.
GetPDG() == -3312) iSet = 6;
3080 if(candidate.
GetPDG() == 3334) iSet = 7;
3081 if(candidate.
GetPDG() == -3334) iSet = 8;
3085 if(iPV >= 0 && iPV<
fNPV)
3087 if(candidate.
NDF() == 2)
3089 if(candidate.
NDF() == 3)
3091 if(candidate.
NDF() == 4)