16 #include "HepPDT/ParticleDataTable.hh"
30 m_vertexJXContainerKey(
"InputJXVertices"),
31 m_vertexV0ContainerKey{
""},
32 m_cascadeOutputKeys({
"JpsiXPlus2V0_SubVtx1",
"JpsiXPlus2V0_SubVtx2",
"JpsiXPlus2V0_SubVtx3",
"JpsiXPlus2V0_MainVtx"}),
34 m_TrkParticleCollection(
"InDetTrackParticles"),
35 m_VxPrimaryCandidateName(
"PrimaryVertices"),
36 m_refPVContainerName(
"RefittedPrimaryVertices"),
37 m_eventInfo_key(
"EventInfo"),
38 m_RelinkContainers({
"InDetTrackParticles",
"InDetLargeD0TrackParticles"}),
40 m_jxMassUpper(30000.0),
42 m_jpsiMassUpper(20000.0),
43 m_diTrackMassLower(-1.0),
44 m_diTrackMassUpper(-1.0),
45 m_V01Hypothesis(
"Ks"),
47 m_V01MassUpper(20000.0),
49 m_V02Hypothesis(
"Lambda"),
51 m_V02MassUpper(20000.0),
53 m_minMass_gamma(-1.0),
54 m_chi2cut_gamma(-1.0),
55 m_JXV02MassLower(0.0),
56 m_JXV02MassUpper(30000.0),
60 m_jxDaug1MassHypo(-1),
61 m_jxDaug2MassHypo(-1),
62 m_jxDaug3MassHypo(-1),
63 m_jxDaug4MassHypo(-1),
88 m_maxMainVCandidates(0),
89 m_iVertexFitter(
"Trk::TrkVKalVrtFitter"),
90 m_iV0Fitter(
"Trk::V0VertexFitter"),
91 m_iGammaFitter(
"Trk::TrkVKalVrtFitter"),
92 m_pvRefitter(
"Analysis::PrimaryVertexRefitter",
this),
93 m_V0Tools(
"Trk::V0Tools"),
94 m_trackToVertexTool(
"Reco::TrackToVertex"),
95 m_v0TrkSelector(
"InDet::TrackSelectorTool"),
96 m_CascadeTools(
"DerivationFramework::CascadeTools"),
97 m_vertexEstimator(
"InDet::VertexPointEstimator"),
98 m_extrapolator(
"Trk::Extrapolator/AtlasExtrapolator")
100 declareProperty(
"JXVertices", m_vertexJXContainerKey);
101 declareProperty(
"V0Vertices", m_vertexV0ContainerKey);
102 declareProperty(
"JXVtxHypoNames", m_vertexJXHypoNames);
103 declareProperty(
"CascadeVertexCollections", m_cascadeOutputKeys);
104 declareProperty(
"OutoutV0VtxCollection", m_v0VtxOutputKey);
105 declareProperty(
"TrackParticleCollection", m_TrkParticleCollection);
106 declareProperty(
"VxPrimaryCandidateName", m_VxPrimaryCandidateName);
107 declareProperty(
"RefPVContainerName", m_refPVContainerName);
108 declareProperty(
"EventInfoKey", m_eventInfo_key);
109 declareProperty(
"RelinkTracks", m_RelinkContainers);
110 declareProperty(
"JXMassLowerCut", m_jxMassLower);
111 declareProperty(
"JXMassUpperCut", m_jxMassUpper);
112 declareProperty(
"JpsiMassLowerCut", m_jpsiMassLower);
113 declareProperty(
"JpsiMassUpperCut", m_jpsiMassUpper);
114 declareProperty(
"DiTrackMassLower", m_diTrackMassLower);
115 declareProperty(
"DiTrackMassUpper", m_diTrackMassUpper);
116 declareProperty(
"V01Hypothesis", m_V01Hypothesis);
117 declareProperty(
"V01MassLowerCut", m_V01MassLower);
118 declareProperty(
"V01MassUpperCut", m_V01MassUpper);
119 declareProperty(
"LxyV01Cut", m_lxyV01_cut);
120 declareProperty(
"V02Hypothesis", m_V02Hypothesis);
121 declareProperty(
"V02MassLowerCut", m_V02MassLower);
122 declareProperty(
"V02MassUpperCut", m_V02MassUpper);
123 declareProperty(
"LxyV02Cut", m_lxyV02_cut);
124 declareProperty(
"MassCutGamma", m_minMass_gamma);
125 declareProperty(
"Chi2CutGamma", m_chi2cut_gamma);
126 declareProperty(
"JXV02MassLowerCut", m_JXV02MassLower);
127 declareProperty(
"JXV02MassUpperCut", m_JXV02MassUpper);
128 declareProperty(
"MassLowerCut", m_MassLower);
129 declareProperty(
"MassUpperCut", m_MassUpper);
130 declareProperty(
"HypothesisName", m_hypoName =
"TQ");
131 declareProperty(
"NumberOfJXDaughters", m_jxDaug_num);
132 declareProperty(
"JXDaug1MassHypo", m_jxDaug1MassHypo);
133 declareProperty(
"JXDaug2MassHypo", m_jxDaug2MassHypo);
134 declareProperty(
"JXDaug3MassHypo", m_jxDaug3MassHypo);
135 declareProperty(
"JXDaug4MassHypo", m_jxDaug4MassHypo);
136 declareProperty(
"JXMass", m_massJX);
137 declareProperty(
"JpsiMass", m_massJpsi);
138 declareProperty(
"XMass", m_massX);
139 declareProperty(
"V01Mass", m_massV01);
140 declareProperty(
"V02Mass", m_massV02);
141 declareProperty(
"JXV02VtxMass", m_massJXV02);
142 declareProperty(
"MainVtxMass", m_massMainV);
143 declareProperty(
"ApplyJXMassConstraint", m_constrJX);
144 declareProperty(
"ApplyJpsiMassConstraint", m_constrJpsi);
145 declareProperty(
"ApplyXMassConstraint", m_constrX);
146 declareProperty(
"ApplyV01MassConstraint", m_constrV01);
147 declareProperty(
"ApplyV02MassConstraint", m_constrV02);
148 declareProperty(
"ApplyJXV02MassConstraint", m_constrJXV02);
149 declareProperty(
"ApplyMainVMassConstraint", m_constrMainV);
150 declareProperty(
"HasJXSubVertex", m_JXSubVtx);
151 declareProperty(
"HasJXV02SubVertex", m_JXV02SubVtx);
152 declareProperty(
"Chi2CutJX", m_chi2cut_JX);
153 declareProperty(
"Chi2CutV0", m_chi2cut_V0);
154 declareProperty(
"Chi2Cut", m_chi2cut);
155 declareProperty(
"UseTRT", m_useTRT);
156 declareProperty(
"PtTRT", m_ptTRT);
157 declareProperty(
"Trackd0Cut", m_d0_cut);
158 declareProperty(
"MaxJXCandidates", m_maxJXCandidates);
159 declareProperty(
"MaxV0Candidates", m_maxV0Candidates);
160 declareProperty(
"MaxMainVCandidates", m_maxMainVCandidates);
161 declareProperty(
"RefitPV", m_refitPV =
true);
162 declareProperty(
"MaxnPV", m_PV_max = 1000);
163 declareProperty(
"MinNTracksInPV", m_PV_minNTracks = 0);
164 declareProperty(
"DoVertexType", m_DoVertexType = 7);
165 declareProperty(
"TrkVertexFitterTool", m_iVertexFitter);
166 declareProperty(
"V0VertexFitterTool", m_iV0Fitter);
167 declareProperty(
"GammaFitterTool", m_iGammaFitter);
168 declareProperty(
"PVRefitter", m_pvRefitter);
169 declareProperty(
"V0Tools", m_V0Tools);
170 declareProperty(
"TrackToVertexTool", m_trackToVertexTool);
171 declareProperty(
"V0TrackSelectorTool", m_v0TrkSelector);
172 declareProperty(
"CascadeTools", m_CascadeTools);
173 declareProperty(
"VertexPointEstimator", m_vertexEstimator);
174 declareProperty(
"Extrapolator", m_extrapolator);
179 ATH_MSG_FATAL(
"Incorrect V0 container hypothesis - not recognized");
180 return StatusCode::FAILURE;
183 if(m_jxDaug_num<2 || m_jxDaug_num>4) {
185 return StatusCode::FAILURE;
189 ATH_MSG_FATAL(
"Input and output V0 container names can not be both empty");
190 return StatusCode::FAILURE;
266 return StatusCode::SUCCESS;
271 if(selectedV0Candidates.size()==0)
return StatusCode::SUCCESS;
274 std::vector<const xAOD::TrackParticleContainer*> trackCols;
278 trackCols.push_back(handle.
cptr());
290 std::vector<const xAOD::Vertex*> selectedJXCandidates;
291 for(
auto vxcItr=jxContainer.
ptr()->
begin(); vxcItr!=jxContainer.
ptr()->
end(); ++vxcItr) {
304 TLorentzVector p4_mu1, p4_mu2;
307 double mass_jpsi = (p4_mu1 + p4_mu2).M();
308 if (mass_jpsi < m_jpsiMassLower || mass_jpsi >
m_jpsiMassUpper)
continue;
310 TLorentzVector p4_trk1, p4_trk2;
315 double mass_jx = (p4_mu1 + p4_mu2 + p4_trk1).M();
316 if(mass_jx < m_jxMassLower || mass_jx >
m_jxMassUpper)
continue;
319 double mass_jx = (p4_mu1 + p4_mu2 + p4_trk1 + p4_trk2).M();
320 if(mass_jx < m_jxMassLower || mass_jx >
m_jxMassUpper)
continue;
323 double mass_diTrk = (p4_trk1 + p4_trk2).M();
331 selectedJXCandidates.push_back(vtx);
333 if(selectedJXCandidates.size()==0)
return StatusCode::SUCCESS;
335 std::sort( selectedJXCandidates.begin(), selectedJXCandidates.end(), [](
const xAOD::Vertex*
a,
const xAOD::Vertex*
b) { return a->chiSquared()/a->numberDoF() < b->chiSquared()/b->numberDoF(); } );
337 selectedJXCandidates.erase(selectedJXCandidates.begin()+
m_maxJXCandidates, selectedJXCandidates.end());
341 for(
auto jxItr=selectedJXCandidates.cbegin(); jxItr!=selectedJXCandidates.cend(); ++jxItr) {
342 for(
auto V0Itr1=selectedV0Candidates.cbegin(); V0Itr1!=selectedV0Candidates.cend(); ++V0Itr1) {
343 for(
auto V0Itr2=V0Itr1+1; V0Itr2!=selectedV0Candidates.cend(); ++V0Itr2) {
350 return StatusCode::SUCCESS;
358 ATH_MSG_FATAL(
"Incorrect number of output cascade vertices");
359 return StatusCode::FAILURE;
362 std::array<SG::WriteHandle<xAOD::VertexContainer>, 4> VtxWriteHandles;
int ikey(0);
365 ATH_CHECK( VtxWriteHandles[ikey].record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()) );
375 if (pvContainer.
cptr()->
size()==0) {
377 return StatusCode::RECOVERABLE;
379 else primaryVertex = (*pvContainer.
cptr())[0];
387 ATH_CHECK( refPvContainer.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()) );
395 std::vector<const xAOD::TrackParticleContainer*> trackCols;
399 trackCols.push_back(handle.
cptr());
406 ATH_CHECK( V0OutputContainer.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()) );
410 std::vector<const xAOD::TrackParticle*> tracksDisplaced;
411 for(
auto tpIt=trackContainer.
cptr()->
begin(); tpIt!=trackContainer.
cptr()->
end(); ++tpIt) {
419 if(!
m_useTRT && nclus == 0)
continue;
421 bool trk_cut =
false;
422 if(nclus != 0) trk_cut =
true;
423 if(nclus == 0 && TP->
pt()>=
m_ptTRT) trk_cut =
true;
424 if(!trk_cut)
continue;
427 if(!
d0Pass(TP,primaryVertex))
continue;
429 tracksDisplaced.push_back(TP);
439 std::vector<std::pair<const xAOD::Vertex*,V0Enum> > selectedV0Candidates;
448 std::string type_V0Vtx;
449 if(mAcc_type.
isAvailable(*vtx)) type_V0Vtx = mAcc_type(*vtx);
452 if(type_V0Vtx ==
"Lambda") {
456 else if(type_V0Vtx ==
"Lambdabar") {
460 else if(type_V0Vtx ==
"Ks") {
472 int gamma_fit = mAcc_gfit.
isAvailable(*vtx) ? mAcc_gfit(*vtx) : 0;
473 double gamma_mass = mAcc_gmass.
isAvailable(*vtx) ? mAcc_gmass(*vtx) : -1;
474 double gamma_chisq = mAcc_gchisq.
isAvailable(*vtx) ? mAcc_gchisq(*vtx) : 999999;
475 double gamma_ndof = mAcc_gndof.
isAvailable(*vtx) ? mAcc_gndof(*vtx) : 0;
478 selectedV0Candidates.push_back(std::pair<const xAOD::Vertex*,V0Enum>{vtx,
opt});
485 for(
auto vxcItr=V0OutputContainer.
ptr()->
begin(); vxcItr!=V0OutputContainer.
ptr()->
end(); ++vxcItr) {
487 std::string type_V0Vtx;
488 if(mAcc_type.
isAvailable(*vtx)) type_V0Vtx = mAcc_type(*vtx);
491 if(type_V0Vtx ==
"Lambda") {
495 else if(type_V0Vtx ==
"Lambdabar") {
499 else if(type_V0Vtx ==
"Ks") {
511 int gamma_fit = mAcc_gfit.
isAvailable(*vtx) ? mAcc_gfit(*vtx) : 0;
512 double gamma_mass = mAcc_gmass.
isAvailable(*vtx) ? mAcc_gmass(*vtx) : -1;
513 double gamma_chisq = mAcc_gchisq.
isAvailable(*vtx) ? mAcc_gchisq(*vtx) : 999999;
514 double gamma_ndof = mAcc_gndof.
isAvailable(*vtx) ? mAcc_gndof(*vtx) : 0;
517 selectedV0Candidates.push_back(std::pair<const xAOD::Vertex*,V0Enum>{vtx,
opt});
522 std::sort( selectedV0Candidates.begin(), selectedV0Candidates.end(), [](std::pair<const xAOD::Vertex*,V0Enum>&
a, std::pair<const xAOD::Vertex*,V0Enum>&
b) { return a.first->chiSquared()/a.first->numberDoF() < b.first->chiSquared()/b.first->numberDoF(); } );
524 selectedV0Candidates.erase(selectedV0Candidates.begin()+
m_maxV0Candidates, selectedV0Candidates.end());
527 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
534 cascadeinfoContainer.erase(cascadeinfoContainer.begin()+
m_maxMainVCandidates, cascadeinfoContainer.end());
577 for(
auto cascade_info : cascadeinfoContainer) {
578 if(cascade_info==
nullptr) {
583 const std::vector<xAOD::Vertex*> &cascadeVertices = cascade_info->vertices();
584 if(cascadeVertices.size() != topoN)
ATH_MSG_ERROR(
"Incorrect number of vertices");
585 for(
size_t i=0;
i<topoN;
i++) {
586 if(cascadeVertices[
i]==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
589 cascade_info->setSVOwnership(
false);
590 const auto mainVertex = cascadeVertices[topoN-1];
591 const std::vector< std::vector<TLorentzVector> > &moms = cascade_info->getParticleMoms();
596 if(
m_jxDaug_num==4) jxVtx = FindVertex<4>(jxContainer.
ptr(), cascadeVertices[ijx]);
597 else if(
m_jxDaug_num==3) jxVtx = FindVertex<3>(jxContainer.
ptr(), cascadeVertices[ijx]);
598 else jxVtx = FindVertex<2>(jxContainer.
ptr(), cascadeVertices[ijx]);
615 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[topoN-1],cascade_info->getCovariance()[topoN-1]);
617 chi2_decor(*mainVertex) = cascade_info->fitChi2();
618 ndof_decor(*mainVertex) = cascade_info->nDoF();
621 lxy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],mainVertex);
622 lxyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxyError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
623 a0z_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0z(moms[0],cascadeVertices[0],mainVertex);
624 a0zErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0zError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
625 a0xy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],mainVertex);
626 a0xyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xyError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
629 lxy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[2]);
630 lxyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
631 a0z_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0z(moms[1],cascadeVertices[1],cascadeVertices[2]);
632 a0zErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0zError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
633 a0xy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],cascadeVertices[2]);
634 a0xyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
637 lxy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],mainVertex);
638 lxyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
639 a0z_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0z(moms[1],cascadeVertices[1],mainVertex);
640 a0zErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0zError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
641 a0xy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],mainVertex);
642 a0xyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
646 lxy_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->lxy(moms[2],cascadeVertices[2],mainVertex);
647 lxyErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->lxyError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
648 a0z_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0z(moms[2],cascadeVertices[2],mainVertex);
649 a0zErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0zError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
650 a0xy_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0xy(moms[2],cascadeVertices[2],mainVertex);
651 a0xyErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0xyError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
654 chi2_V3_decor(*cascadeVertices[2]) =
m_V0Tools->chisq(jxVtx);
655 ndof_V3_decor(*cascadeVertices[2]) =
m_V0Tools->ndof(jxVtx);
660 for(
size_t i=0;
i<topoN;
i++) {
661 VtxWriteHandles[
i].ptr()->push_back(cascadeVertices[
i]);
669 if( vertexLink1.
isValid() ) precedingVertexLinks.push_back( vertexLink1 );
673 if( vertexLink2.
isValid() ) precedingVertexLinks.push_back( vertexLink2 );
678 if( vertexLink3.
isValid() ) precedingVertexLinks.push_back( vertexLink3 );
680 CascadeLinksDecor(*mainVertex) = precedingVertexLinks;
685 for (
auto cascade_info : cascadeinfoContainer)
delete cascade_info;
687 return StatusCode::SUCCESS;
692 const EventContext& ctx = Gaudi::Hive::currentContext();
694 if(!per)
return pass;
696 double sig_d0 = sqrt((*per->covariance())(0,0));
697 if(std::abs(
d0/sig_d0) >
m_d0_cut) pass =
true;
709 std::vector<const xAOD::TrackParticle*> tracksJX;
711 if (tracksJX.size() != massesJX.size()) {
712 ATH_MSG_ERROR(
"Problems with JX input: number of tracks or track mass inputs is not correct!");
720 std::vector<const xAOD::TrackParticle*> tracksV01;
725 std::vector<const xAOD::TrackParticle*> tracksV02;
728 std::vector<const xAOD::TrackParticle*> tracksJpsi{tracksJX[0], tracksJX[1]};
729 std::vector<const xAOD::TrackParticle*> tracksX;
733 std::vector<double> massesV01;
737 std::vector<double> massesV02;
742 double massV01 =
m_V0Tools->invariantMass(V01vtx, massesV01);
744 double massV02 =
m_V0Tools->invariantMass(V02vtx, massesV02);
747 TLorentzVector p4_moth,
tmp;
754 p4_moth += V01_helper.
refTrk(
it,massesV01[
it]);
758 p4_moth += V02_helper.
refTrk(
it,massesV02[
it]);
763 TLorentzVector p4_JXV02;
769 p4_JXV02 += V02_helper.
refTrk(
it,massesV02[
it]);
798 std::vector<float> trk_px;
799 std::vector<float> trk_py;
800 std::vector<float> trk_pz;
809 std::vector<Trk::VertexID> vrtList;
818 vrtList.push_back(vID1);
826 vrtList.push_back(vID2);
831 std::vector<Trk::VertexID> vrtList1{vID1};
832 std::vector<Trk::VertexID> vrtList2{vID2};
838 vrtList1.push_back(vID3);
840 std::vector<const xAOD::TrackParticle*>
tp;
tp.clear();
841 std::vector<double> tp_masses; tp_masses.clear();
855 vrtList.push_back(vID3);
857 std::vector<const xAOD::TrackParticle*>
tp;
tp.clear();
858 std::vector<double> tp_masses; tp_masses.clear();
874 std::vector<Trk::VertexID> cnstV; cnstV.clear();
881 std::vector<Trk::VertexID> cnstV; cnstV.clear();
887 std::vector<Trk::VertexID> cnstV; cnstV.clear();
893 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
895 if (fit_result !=
nullptr) {
897 if(
v->nTrackParticles()==0) {
898 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
899 v->setTrackParticleLinks(nullLinkVector);
909 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
911 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
912 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
913 size_t iMoth = cascadeVertices.size()-1;
914 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
917 chi2_V1_decor(*cascadeVertices[0]) = V01vtx->
chiSquared();
918 ndof_V1_decor(*cascadeVertices[0]) = V01vtx->
numberDoF();
919 if(V01==
LAMBDA) type_V1_decor(*cascadeVertices[0]) =
"Lambda";
920 else if(V01==
LAMBDABAR) type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
921 else if(V01==
KS) type_V1_decor(*cascadeVertices[0]) =
"Ks";
922 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.
isAvailable(*V01vtx) ? mAcc_gfit(*V01vtx) : 0;
923 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.
isAvailable(*V01vtx) ? mAcc_gmass(*V01vtx) : -1;
924 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.
isAvailable(*V01vtx) ? mAcc_gmasserr(*V01vtx) : -1;
925 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.
isAvailable(*V01vtx) ? mAcc_gchisq(*V01vtx) : 999999;
926 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.
isAvailable(*V01vtx) ? mAcc_gndof(*V01vtx) : 0;
927 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.
isAvailable(*V01vtx) ? mAcc_gprob(*V01vtx) : -1;
928 trk_px.clear(); trk_py.clear(); trk_pz.clear();
930 trk_px.push_back( V01_helper.
refTrk(
it).Px() );
931 trk_py.push_back( V01_helper.
refTrk(
it).Py() );
932 trk_pz.push_back( V01_helper.
refTrk(
it).Pz() );
934 trk_pxDeco(*cascadeVertices[0]) = trk_px;
935 trk_pyDeco(*cascadeVertices[0]) = trk_py;
936 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
938 chi2_V2_decor(*cascadeVertices[1]) = V02vtx->
chiSquared();
939 ndof_V2_decor(*cascadeVertices[1]) = V02vtx->
numberDoF();
940 if(V02==
LAMBDA) type_V2_decor(*cascadeVertices[1]) =
"Lambda";
941 else if(V02==
LAMBDABAR) type_V2_decor(*cascadeVertices[1]) =
"Lambdabar";
942 else if(V02==
KS) type_V2_decor(*cascadeVertices[1]) =
"Ks";
943 mDec_gfit(*cascadeVertices[1]) = mAcc_gfit.
isAvailable(*V02vtx) ? mAcc_gfit(*V02vtx) : 0;
944 mDec_gmass(*cascadeVertices[1]) = mAcc_gmass.
isAvailable(*V02vtx) ? mAcc_gmass(*V02vtx) : -1;
945 mDec_gmasserr(*cascadeVertices[1]) = mAcc_gmasserr.
isAvailable(*V02vtx) ? mAcc_gmasserr(*V02vtx) : -1;
946 mDec_gchisq(*cascadeVertices[1]) = mAcc_gchisq.
isAvailable(*V02vtx) ? mAcc_gchisq(*V02vtx) : 999999;
947 mDec_gndof(*cascadeVertices[1]) = mAcc_gndof.
isAvailable(*V02vtx) ? mAcc_gndof(*V02vtx) : 0;
948 mDec_gprob(*cascadeVertices[1]) = mAcc_gprob.
isAvailable(*V02vtx) ? mAcc_gprob(*V02vtx) : -1;
949 trk_px.clear(); trk_py.clear(); trk_pz.clear();
951 trk_px.push_back( V02_helper.
refTrk(
it).Px() );
952 trk_py.push_back( V02_helper.
refTrk(
it).Py() );
953 trk_pz.push_back( V02_helper.
refTrk(
it).Pz() );
955 trk_pxDeco(*cascadeVertices[1]) = trk_px;
956 trk_pyDeco(*cascadeVertices[1]) = trk_py;
957 trk_pzDeco(*cascadeVertices[1]) = trk_pz;
959 result = fit_result.release();
967 const EventContext& ctx = Gaudi::Hive::currentContext();
977 std::vector<const xAOD::TrackParticle*> posTracks;
978 std::vector<const xAOD::TrackParticle*> negTracks;
979 for(
auto tpIt=selectedTracks.begin(); tpIt!=selectedTracks.end(); ++tpIt) {
981 if(TP->
charge()>0) posTracks.push_back(TP);
982 else negTracks.push_back(TP);
985 for(
auto tpIt1 = posTracks.begin(); tpIt1 != posTracks.end(); ++tpIt1) {
988 for(
auto tpIt2 = negTracks.begin(); tpIt2 != negTracks.end(); ++tpIt2) {
991 int sflag(0), errorcode(0);
993 if (errorcode != 0) {startingPoint(0) = 0.0; startingPoint(1) = 0.0; startingPoint(2) = 0.0;}
995 if (errorcode == 0 || errorcode == 5 || errorcode == 6 || errorcode == 8) {
999 std::vector<std::unique_ptr<const Trk::TrackParameters> > cleanup;
1001 else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee1));
1003 else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee2));
1004 if(extrapolatedPerigee1 && extrapolatedPerigee2) {
1006 TLorentzVector v1; TLorentzVector
v2;
1010 if((v1+
v2).M()>900.0 && (v1+
v2).M()<1350.0) pass =
true;
1015 if((v1+
v2).M()>900.0 && (v1+
v2).M()<1350.0) pass =
true;
1020 if((v1+
v2).M()>300.0 && (v1+
v2).M()<700.0) pass =
true;
1023 std::vector<const xAOD::TrackParticle*> tracksV0;
1024 tracksV0.push_back(TP1); tracksV0.push_back(TP2);
1025 std::unique_ptr<xAOD::Vertex> V0vtx = std::unique_ptr<xAOD::Vertex>(
m_iV0Fitter->fit(tracksV0, startingPoint) );
1033 if(massSig_V0_Lambda1<=massSig_V0_Lambda2 && massSig_V0_Lambda1<=massSig_V0_Ks) {
1034 mDec_type(*V0vtx.get()) =
"Lambda";
1036 else if(massSig_V0_Lambda2<=massSig_V0_Lambda1 && massSig_V0_Lambda2<=massSig_V0_Ks) {
1037 mDec_type(*V0vtx.get()) =
"Lambdabar";
1039 else if(massSig_V0_Ks<=massSig_V0_Lambda1 && massSig_V0_Ks<=massSig_V0_Lambda2) {
1040 mDec_type(*V0vtx.get()) =
"Ks";
1043 int gamma_fit = 0;
int gamma_ndof = 0;
double gamma_chisq = 999999.;
1044 double gamma_prob = -1., gamma_mass = -1., gamma_massErr = -1.;
1045 std::unique_ptr<xAOD::Vertex> gammaVtx = std::unique_ptr<xAOD::Vertex>(
m_iGammaFitter->fit(tracksV0,
m_V0Tools->vtx(V0vtx.get())) );
1050 gamma_chisq =
m_V0Tools->chisq(gammaVtx.get());
1051 gamma_ndof =
m_V0Tools->ndof(gammaVtx.get());
1052 gamma_prob =
m_V0Tools->vertexProbability(gammaVtx.get());
1054 mDec_gfit(*V0vtx.get()) = gamma_fit;
1055 mDec_gmass(*V0vtx.get()) = gamma_mass;
1056 mDec_gmasserr(*V0vtx.get()) = gamma_massErr;
1057 mDec_gchisq(*V0vtx.get()) = gamma_chisq;
1058 mDec_gndof(*V0vtx.get()) = gamma_ndof;
1059 mDec_gprob(*V0vtx.get()) = gamma_prob;
1064 if(not trackCols.empty()){
1067 }
catch (std::runtime_error
const&
e) {
1073 V0ContainerNew->
push_back(std::move(V0vtx));
1082 template<
size_t NTracks>
1085 assert(v1->nTrackParticles() == NTracks);
1086 std::array<const xAOD::TrackParticle*, NTracks> a1;
1087 std::array<const xAOD::TrackParticle*, NTracks> a2;
1088 for(
size_t i=0;
i<NTracks;
i++){
1089 a1[
i] = v1->trackParticle(
i);
1090 a2[
i] =
v->trackParticle(
i);
1092 std::sort(a1.begin(), a1.end());
1093 std::sort(a2.begin(), a2.end());
1094 if(a1 == a2)
return v1;