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)
ATH_MSG_ERROR(
"CascadeInfo is null");
580 const std::vector<xAOD::Vertex*> &cascadeVertices = cascade_info->vertices();
581 if(cascadeVertices.size() != topoN)
ATH_MSG_ERROR(
"Incorrect number of vertices");
582 for(
size_t i=0;
i<topoN;
i++) {
583 if(cascadeVertices[
i]==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
586 cascade_info->setSVOwnership(
false);
587 const auto mainVertex = cascadeVertices[topoN-1];
588 const std::vector< std::vector<TLorentzVector> > &moms = cascade_info->getParticleMoms();
593 if(
m_jxDaug_num==4) jxVtx = FindVertex<4>(jxContainer.
ptr(), cascadeVertices[ijx]);
594 else if(
m_jxDaug_num==3) jxVtx = FindVertex<3>(jxContainer.
ptr(), cascadeVertices[ijx]);
595 else jxVtx = FindVertex<2>(jxContainer.
ptr(), cascadeVertices[ijx]);
612 PtErr_decor(*mainVertex) =
m_CascadeTools->pTError(moms[topoN-1],cascade_info->getCovariance()[topoN-1]);
614 chi2_decor(*mainVertex) = cascade_info->fitChi2();
615 ndof_decor(*mainVertex) = cascade_info->nDoF();
618 lxy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],mainVertex);
619 lxyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxyError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
620 a0z_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0z(moms[0],cascadeVertices[0],mainVertex);
621 a0zErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0zError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
622 a0xy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],mainVertex);
623 a0xyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xyError(moms[0],cascade_info->getCovariance()[0],cascadeVertices[0],mainVertex);
626 lxy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],cascadeVertices[2]);
627 lxyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
628 a0z_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0z(moms[1],cascadeVertices[1],cascadeVertices[2]);
629 a0zErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0zError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
630 a0xy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],cascadeVertices[2]);
631 a0xyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],cascadeVertices[2]);
634 lxy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],mainVertex);
635 lxyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
636 a0z_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0z(moms[1],cascadeVertices[1],mainVertex);
637 a0zErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0zError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
638 a0xy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],mainVertex);
639 a0xyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xyError(moms[1],cascade_info->getCovariance()[1],cascadeVertices[1],mainVertex);
643 lxy_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->lxy(moms[2],cascadeVertices[2],mainVertex);
644 lxyErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->lxyError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
645 a0z_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0z(moms[2],cascadeVertices[2],mainVertex);
646 a0zErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0zError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
647 a0xy_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0xy(moms[2],cascadeVertices[2],mainVertex);
648 a0xyErr_SV3_decor(*cascadeVertices[2]) =
m_CascadeTools->a0xyError(moms[2],cascade_info->getCovariance()[2],cascadeVertices[2],mainVertex);
651 chi2_V3_decor(*cascadeVertices[2]) =
m_V0Tools->chisq(jxVtx);
652 ndof_V3_decor(*cascadeVertices[2]) =
m_V0Tools->ndof(jxVtx);
657 for(
size_t i=0;
i<topoN;
i++) {
658 VtxWriteHandles[
i].ptr()->push_back(cascadeVertices[
i]);
666 if( vertexLink1.
isValid() ) precedingVertexLinks.push_back( vertexLink1 );
670 if( vertexLink2.
isValid() ) precedingVertexLinks.push_back( vertexLink2 );
675 if( vertexLink3.
isValid() ) precedingVertexLinks.push_back( vertexLink3 );
677 CascadeLinksDecor(*mainVertex) = precedingVertexLinks;
682 for (
auto cascade_info : cascadeinfoContainer)
delete cascade_info;
684 return StatusCode::SUCCESS;
689 const EventContext& ctx = Gaudi::Hive::currentContext();
691 if(!per)
return pass;
693 double sig_d0 = sqrt((*per->covariance())(0,0));
694 if(std::abs(
d0/sig_d0) >
m_d0_cut) pass =
true;
706 std::vector<const xAOD::TrackParticle*> tracksJX;
708 if (tracksJX.size() != massesJX.size()) {
709 ATH_MSG_ERROR(
"Problems with JX input: number of tracks or track mass inputs is not correct!");
717 std::vector<const xAOD::TrackParticle*> tracksV01;
722 std::vector<const xAOD::TrackParticle*> tracksV02;
725 std::vector<const xAOD::TrackParticle*> tracksJpsi{tracksJX[0], tracksJX[1]};
726 std::vector<const xAOD::TrackParticle*> tracksX;
730 std::vector<double> massesV01;
734 std::vector<double> massesV02;
739 double massV01 =
m_V0Tools->invariantMass(V01vtx, massesV01);
741 double massV02 =
m_V0Tools->invariantMass(V02vtx, massesV02);
744 TLorentzVector p4_moth,
tmp;
751 p4_moth += V01_helper.
refTrk(
it,massesV01[
it]);
755 p4_moth += V02_helper.
refTrk(
it,massesV02[
it]);
760 TLorentzVector p4_JXV02;
766 p4_JXV02 += V02_helper.
refTrk(
it,massesV02[
it]);
795 std::vector<float> trk_px;
796 std::vector<float> trk_py;
797 std::vector<float> trk_pz;
806 std::vector<Trk::VertexID> vrtList;
815 vrtList.push_back(vID1);
823 vrtList.push_back(vID2);
828 std::vector<Trk::VertexID> vrtList1{vID1};
829 std::vector<Trk::VertexID> vrtList2{vID2};
835 vrtList1.push_back(vID3);
837 std::vector<const xAOD::TrackParticle*>
tp;
tp.clear();
838 std::vector<double> tp_masses; tp_masses.clear();
852 vrtList.push_back(vID3);
854 std::vector<const xAOD::TrackParticle*>
tp;
tp.clear();
855 std::vector<double> tp_masses; tp_masses.clear();
871 std::vector<Trk::VertexID> cnstV; cnstV.clear();
878 std::vector<Trk::VertexID> cnstV; cnstV.clear();
884 std::vector<Trk::VertexID> cnstV; cnstV.clear();
890 std::unique_ptr<Trk::VxCascadeInfo> fit_result = std::unique_ptr<Trk::VxCascadeInfo>(
m_iVertexFitter->fitCascade(*state) );
892 if (fit_result !=
nullptr) {
894 if(
v->nTrackParticles()==0) {
895 std::vector<ElementLink<xAOD::TrackParticleContainer> > nullLinkVector;
896 v->setTrackParticleLinks(nullLinkVector);
906 double chi2DOF = fit_result->
fitChi2()/fit_result->
nDoF();
908 const std::vector<std::vector<TLorentzVector> > &moms = fit_result->
getParticleMoms();
909 const std::vector<xAOD::Vertex*> &cascadeVertices = fit_result->
vertices();
910 size_t iMoth = cascadeVertices.size()-1;
911 double lxy_SV1 =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[iMoth]);
914 chi2_V1_decor(*cascadeVertices[0]) = V01vtx->
chiSquared();
915 ndof_V1_decor(*cascadeVertices[0]) = V01vtx->
numberDoF();
916 if(V01==
LAMBDA) type_V1_decor(*cascadeVertices[0]) =
"Lambda";
917 else if(V01==
LAMBDABAR) type_V1_decor(*cascadeVertices[0]) =
"Lambdabar";
918 else if(V01==
KS) type_V1_decor(*cascadeVertices[0]) =
"Ks";
919 mDec_gfit(*cascadeVertices[0]) = mAcc_gfit.
isAvailable(*V01vtx) ? mAcc_gfit(*V01vtx) : 0;
920 mDec_gmass(*cascadeVertices[0]) = mAcc_gmass.
isAvailable(*V01vtx) ? mAcc_gmass(*V01vtx) : -1;
921 mDec_gmasserr(*cascadeVertices[0]) = mAcc_gmasserr.
isAvailable(*V01vtx) ? mAcc_gmasserr(*V01vtx) : -1;
922 mDec_gchisq(*cascadeVertices[0]) = mAcc_gchisq.
isAvailable(*V01vtx) ? mAcc_gchisq(*V01vtx) : 999999;
923 mDec_gndof(*cascadeVertices[0]) = mAcc_gndof.
isAvailable(*V01vtx) ? mAcc_gndof(*V01vtx) : 0;
924 mDec_gprob(*cascadeVertices[0]) = mAcc_gprob.
isAvailable(*V01vtx) ? mAcc_gprob(*V01vtx) : -1;
925 trk_px.clear(); trk_py.clear(); trk_pz.clear();
927 trk_px.push_back( V01_helper.
refTrk(
it).Px() );
928 trk_py.push_back( V01_helper.
refTrk(
it).Py() );
929 trk_pz.push_back( V01_helper.
refTrk(
it).Pz() );
931 trk_pxDeco(*cascadeVertices[0]) = trk_px;
932 trk_pyDeco(*cascadeVertices[0]) = trk_py;
933 trk_pzDeco(*cascadeVertices[0]) = trk_pz;
935 chi2_V2_decor(*cascadeVertices[1]) = V02vtx->
chiSquared();
936 ndof_V2_decor(*cascadeVertices[1]) = V02vtx->
numberDoF();
937 if(V02==
LAMBDA) type_V2_decor(*cascadeVertices[1]) =
"Lambda";
938 else if(V02==
LAMBDABAR) type_V2_decor(*cascadeVertices[1]) =
"Lambdabar";
939 else if(V02==
KS) type_V2_decor(*cascadeVertices[1]) =
"Ks";
940 mDec_gfit(*cascadeVertices[1]) = mAcc_gfit.
isAvailable(*V02vtx) ? mAcc_gfit(*V02vtx) : 0;
941 mDec_gmass(*cascadeVertices[1]) = mAcc_gmass.
isAvailable(*V02vtx) ? mAcc_gmass(*V02vtx) : -1;
942 mDec_gmasserr(*cascadeVertices[1]) = mAcc_gmasserr.
isAvailable(*V02vtx) ? mAcc_gmasserr(*V02vtx) : -1;
943 mDec_gchisq(*cascadeVertices[1]) = mAcc_gchisq.
isAvailable(*V02vtx) ? mAcc_gchisq(*V02vtx) : 999999;
944 mDec_gndof(*cascadeVertices[1]) = mAcc_gndof.
isAvailable(*V02vtx) ? mAcc_gndof(*V02vtx) : 0;
945 mDec_gprob(*cascadeVertices[1]) = mAcc_gprob.
isAvailable(*V02vtx) ? mAcc_gprob(*V02vtx) : -1;
946 trk_px.clear(); trk_py.clear(); trk_pz.clear();
948 trk_px.push_back( V02_helper.
refTrk(
it).Px() );
949 trk_py.push_back( V02_helper.
refTrk(
it).Py() );
950 trk_pz.push_back( V02_helper.
refTrk(
it).Pz() );
952 trk_pxDeco(*cascadeVertices[1]) = trk_px;
953 trk_pyDeco(*cascadeVertices[1]) = trk_py;
954 trk_pzDeco(*cascadeVertices[1]) = trk_pz;
956 result = fit_result.release();
964 const EventContext& ctx = Gaudi::Hive::currentContext();
974 std::vector<const xAOD::TrackParticle*> posTracks;
975 std::vector<const xAOD::TrackParticle*> negTracks;
976 for(
auto tpIt=selectedTracks.begin(); tpIt!=selectedTracks.end(); ++tpIt) {
978 if(TP->
charge()>0) posTracks.push_back(TP);
979 else negTracks.push_back(TP);
982 for(
auto tpIt1 = posTracks.begin(); tpIt1 != posTracks.end(); ++tpIt1) {
985 for(
auto tpIt2 = negTracks.begin(); tpIt2 != negTracks.end(); ++tpIt2) {
988 int sflag(0), errorcode(0);
990 if (errorcode != 0) {startingPoint(0) = 0.0; startingPoint(1) = 0.0; startingPoint(2) = 0.0;}
992 if (errorcode == 0 || errorcode == 5 || errorcode == 6 || errorcode == 8) {
996 std::vector<std::unique_ptr<const Trk::TrackParameters> > cleanup;
998 else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee1));
1000 else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee2));
1001 if(extrapolatedPerigee1 && extrapolatedPerigee2) {
1003 TLorentzVector v1; TLorentzVector
v2;
1007 if((v1+
v2).M()>900.0 && (v1+
v2).M()<1350.0) pass =
true;
1012 if((v1+
v2).M()>900.0 && (v1+
v2).M()<1350.0) pass =
true;
1017 if((v1+
v2).M()>300.0 && (v1+
v2).M()<700.0) pass =
true;
1020 std::vector<const xAOD::TrackParticle*> tracksV0;
1021 tracksV0.push_back(TP1); tracksV0.push_back(TP2);
1022 std::unique_ptr<xAOD::Vertex> V0vtx = std::unique_ptr<xAOD::Vertex>(
m_iV0Fitter->fit(tracksV0, startingPoint) );
1030 if(massSig_V0_Lambda1<=massSig_V0_Lambda2 && massSig_V0_Lambda1<=massSig_V0_Ks) {
1031 mDec_type(*V0vtx.get()) =
"Lambda";
1033 else if(massSig_V0_Lambda2<=massSig_V0_Lambda1 && massSig_V0_Lambda2<=massSig_V0_Ks) {
1034 mDec_type(*V0vtx.get()) =
"Lambdabar";
1036 else if(massSig_V0_Ks<=massSig_V0_Lambda1 && massSig_V0_Ks<=massSig_V0_Lambda2) {
1037 mDec_type(*V0vtx.get()) =
"Ks";
1040 int gamma_fit = 0;
int gamma_ndof = 0;
double gamma_chisq = 999999.;
1041 double gamma_prob = -1., gamma_mass = -1., gamma_massErr = -1.;
1042 std::unique_ptr<xAOD::Vertex> gammaVtx = std::unique_ptr<xAOD::Vertex>(
m_iGammaFitter->fit(tracksV0,
m_V0Tools->vtx(V0vtx.get())) );
1047 gamma_chisq =
m_V0Tools->chisq(gammaVtx.get());
1048 gamma_ndof =
m_V0Tools->ndof(gammaVtx.get());
1049 gamma_prob =
m_V0Tools->vertexProbability(gammaVtx.get());
1051 mDec_gfit(*V0vtx.get()) = gamma_fit;
1052 mDec_gmass(*V0vtx.get()) = gamma_mass;
1053 mDec_gmasserr(*V0vtx.get()) = gamma_massErr;
1054 mDec_gchisq(*V0vtx.get()) = gamma_chisq;
1055 mDec_gndof(*V0vtx.get()) = gamma_ndof;
1056 mDec_gprob(*V0vtx.get()) = gamma_prob;
1061 if(not trackCols.empty()){
1064 }
catch (std::runtime_error
const&
e) {
1070 V0ContainerNew->
push_back(std::move(V0vtx));
1079 template<
size_t NTracks>
1082 assert(v1->nTrackParticles() == NTracks);
1083 std::array<const xAOD::TrackParticle*, NTracks> a1;
1084 std::array<const xAOD::TrackParticle*, NTracks> a2;
1085 for(
size_t i=0;
i<NTracks;
i++){
1086 a1[
i] = v1->trackParticle(
i);
1087 a2[
i] =
v->trackParticle(
i);
1089 std::sort(a1.begin(), a1.end());
1090 std::sort(a2.begin(), a2.end());
1091 if(a1 == a2)
return v1;