644 int nTruthVertices = (int)(truthHSVertices.size() + truthPUVertices.size());
645 int nRecoVertices = (int)vertexContainer.
size()-1;
650 const static xAOD::Vertex::Decorator<InDetVertexTruthMatchUtils::VertexMatchType> recoVtxMatchTypeInfo(
"VertexMatchType");
651 std::map<InDetVertexTruthMatchUtils::VertexMatchType, int> breakdown = {};
658 if (!recoHardScatter){
659 ATH_MSG_INFO(
"No recoHardScatter vertex - not filling vertex truth matching.");
668 if (!truthHSVertices.empty()) {
669 if (truthHSVertices.size() != 1) {
670 ATH_MSG_WARNING(
"Size of truth HS vertex vector is >1 -- only using the first one in the vector.");
672 truthHSVtx = truthHSVertices.at(0);
677 ATH_MSG_WARNING(
"Size of truth HS vertex vector is 0 -- assuming truth HS vertex to NOT be reconstructed.");
682 ATH_MSG_INFO(
"No truthHSVtx vertex - not filling vertex truth matching.");
685 float localPUDensity =
getLocalPUDensity(truthHSVtx, truthHSVertices, truthPUVertices);
691 if (!bestRecoHSVtx_truth){
692 ATH_MSG_INFO(
"No bestRecoHS vertex - not filling vertex truth matching.");
702 bool truthHSVtxRecoed =
false;
704 float truthRecoRadialDiff2 = -1.;
708 truthRecoRadialDiff2 =
getRadialDiff2(bestRecoHSVtx_truth, truthHSVtx);
709 if (truthRecoRadialDiff2 < minTruthRecoRadialDiff2) {
710 truthHSVtxRecoed =
true;
711 minTruthRecoRadialDiff2 = truthRecoRadialDiff2;
716 float number_matched = 0;
717 float number_merged = 0;
718 float number_split = 0;
719 float number_fake = 0;
720 float number_matched_HS = 0;
721 float number_merged_HS = 0;
722 float number_split_HS = 0;
723 float number_fake_HS = 0;
724 float number_matched_PU = 0;
725 float number_merged_PU = 0;
726 float number_split_PU = 0;
727 float number_fake_PU = 0;
730 float vx_hs_mindz=9999.;
731 float min_fabs_dz = 9999.;
735 for (
const auto& vertex : vertexContainer.
stdcont()) {
744 matchType = recoVtxMatchTypeInfo(*vertex);
745 breakdown[matchType] += 1;
749 if(!matchVertex)
continue;
750 float residual_z = matchVertex->
z() - vertex->z();
751 float residual_x = matchVertex->
x() - vertex->x();
752 float residual_y = matchVertex->
y() - vertex->y();
753 const AmgSymMatrix(3)& covariance = vertex->covariancePosition();
757 localPUDensity =
getLocalPUDensity(matchVertex, truthHSVertices, truthPUVertices);
793 float minpt = 20000 ;
801 float weighted_sumDZ = 0;
802 float weighted_deltaZ = 0;
803 float weighted_modsumDZ = 0;
804 float weighted_z_asym =0;
807 std::vector<float> track_deltaZ;
808 std::vector<float> track_deltaPt;
809 std::vector<float> track_deltaZ_weighted;
811 for (
size_t i = 0; i < vertex->nTrackParticles(); i++) {
812 trackTmp = vertex->trackParticle(i);
816 trackPt = trackTmp->
pt();
817 sumPt = sumPt + trackPt;
818 deltaZ = trackTmp->
z0() - vertex->z();
819 track_deltaZ.push_back(deltaZ);
821 float trk_weight = vertex->trackWeight(i);
822 weighted_deltaZ = deltaZ*trk_weight;
824 sumDZ = sumDZ + deltaZ;
825 modsumDZ = modsumDZ + std::abs(deltaZ);
826 weighted_sumDZ = weighted_sumDZ + weighted_deltaZ;
827 weighted_modsumDZ = weighted_modsumDZ + std::abs(weighted_deltaZ);
832 z_asym = sumDZ/modsumDZ;
834 if (weighted_modsumDZ >0) {
835 weighted_z_asym = weighted_sumDZ/weighted_modsumDZ;
841 mean_Dz=sumDZ/track_deltaZ.size();
842 double number_tracks =0;
843 number_tracks = track_deltaZ.size();
851 for (
auto i : track_deltaZ) {
853 z_zbar = (i - mean_Dz);
854 z_var =(z_var + z_zbar*z_zbar);
855 z_skew =(z_skew + z_zbar*z_zbar*z_zbar);
856 z_kurt =(z_kurt + z_zbar*z_zbar*z_zbar*z_zbar);
859 z_var = z_var/(number_tracks -1);
860 z_sd = std::sqrt(z_var);
861 z_skew = z_skew/((number_tracks -1)*z_sd*z_sd*z_sd);
862 z_kurt = z_kurt/((number_tracks -1)*z_sd*z_sd*z_sd*z_sd);
864 float ndf = vertex->numberDoF();
868 if (vertex == bestRecoHSVtx_truth) {
879 for (
const float& trkWeight : vertex->trackWeights()) {
896 for (
const float& trkWeight : vertex->trackWeights()) {
910 for (
const float& trkWeight : vertex->trackWeights()) {
919 if (vertex == bestRecoHSVtx_truth) {
928 for (
const float& trkWeight : vertex->trackWeights()) {
944 for (
const float& trkWeight : vertex->trackWeights()) {
958 for (
const float& trkWeight : vertex->trackWeights()) {
967 if (vertex == bestRecoHSVtx_truth) {
975 for (
const float& trkWeight : vertex->trackWeights()) {
990 for (
const float& trkWeight : vertex->trackWeights()) {
1006 for (
const float& trkWeight : vertex->trackWeights()) {
1018 if (vertex == bestRecoHSVtx_truth) {
1019 number_matched_HS++;
1022 number_matched_PU++;
1024 if (sumPt > minpt) {
1030 if (vertex == bestRecoHSVtx_truth) {
1036 if (sumPt > minpt) {
1042 if (vertex == bestRecoHSVtx_truth) {
1048 if (sumPt > minpt) {
1054 if (vertex == bestRecoHSVtx_truth) {
1060 if (sumPt > minpt) {
1069 for (
const auto& vertex : vertexContainer.
stdcont()) {
1070 if (vertex == bestRecoHSVtx_truth) {
1105 if (sumPt > minpt) {
1125 float absd_hs_dz = std::abs(bestRecoHSVtx_truth->
z() - vertex->z());
1126 if(bestRecoHSVtx_truth != vertex && absd_hs_dz < min_fabs_dz) {
1127 min_fabs_dz = absd_hs_dz;
1128 vx_hs_mindz = bestRecoHSVtx_truth->
z() - vertex->z();
1131 for (
const auto& vertex2 : vertexContainer.
stdcont()) {
1133 if(vertex2 == vertex)
continue;
1157 if (!truthHSVertices.empty()) {
1158 if (truthHSVtxRecoed) {
1159 float residual_z = truthHSVtx->
z() - bestRecoHSVtx_truth->
z();
1160 float residual_r = std::sqrt(std::pow(truthHSVtx->
x() - bestRecoHSVtx_truth->
x(), 2) + std::pow(truthHSVtx->
y() - bestRecoHSVtx_truth->
y(), 2));
1161 float residual_x = truthHSVtx->
x() - bestRecoHSVtx_truth->
x();
1162 float residual_y = truthHSVtx->
y() - bestRecoHSVtx_truth->
y();
1173 const AmgSymMatrix(3)& covariance = bestRecoHSVtx_truth->covariancePosition();