90 int nTrackPairs_Init = 0;
91 int nTrackPairs_Selected = 0;
92 int nConv_VertexFit = 0;
93 int nConv_Selected = 0;
94 int nConv_Selected_DeltaM = 0;
96 std::vector<const xAOD::Vertex*> oniaVertices;
105 if(diMuonContainer->
size() == 0) {
117 bool passedHypothesis =
false;
122 if(pass) passedHypothesis =
true;
125 if(passedHypothesis) {
126 oniaVertices.push_back(
vertex);
136 conversionContainer->setStore(conversionAuxContainer.get());
140 const bool callConvFinder = !
m_requireDeltaM || oniaVertices.size() > 0;
151 std::vector<const xAOD::TrackParticle*> posTracks; posTracks.clear();
152 std::vector<const xAOD::TrackParticle*> negTracks; negTracks.clear();
167 if( nSCT + nPIX < 1 )
continue;
169 if(
track->charge() > 0.0) {
170 posTracks.push_back(
track);
172 negTracks.push_back(
track);
177 ATH_MSG_DEBUG(posTracks.size() + negTracks.size() <<
" tracks pass pre-selection");
179 std::vector<const xAOD::TrackParticle*>::const_iterator tpIt1;
180 std::vector<const xAOD::TrackParticle*>::const_iterator tpIt2;
183 for(tpIt1 = posTracks.begin(); tpIt1 != posTracks.end(); ++tpIt1) {
190 for(tpIt2 = negTracks.begin(); tpIt2 != negTracks.end(); ++tpIt2) {
192 if (*tpIt1 == *tpIt2)
continue;
203 const double deltaCotTheta = fabs(1./
tan(trackPerigee1.parameters()[
Trk::theta]) - 1./
tan(trackPerigee2.parameters()[
Trk::theta]));
208 bool gotDistance =
result.has_value();
218 std::map<std::string, float> vertexOutput;
220 if(errorcode != 0)
continue;
223 nTrackPairs_Selected++;
225 std::vector<const xAOD::TrackParticle*> trackPair;
227 trackPair.push_back(trackParticle1);
228 trackPair.push_back(trackParticle2);
231 std::unique_ptr<xAOD::Vertex> convVertexCandidate(
m_vertexFitter->fit(trackPair, startingPoint) );
234 if(convVertexCandidate != NULL) {
238 convVertexCandidate->clearTracks();
245 convVertexCandidate->addTrackAtVertex(newLink1);
246 convVertexCandidate->addTrackAtVertex(newLink2);
256 std::vector<Amg::Vector3D> positionList;
259 if( !
m_postSelector->selectConversionCandidate(convVertexCandidate.get(),0,positionList) ) {
260 convVertexCandidate.reset();
268 const xAOD::Vertex * constConvVertex = convVertexCandidate.get();
278 bool passDeltaM =
false;
281 std::vector<const xAOD::Vertex*> candidateOniaVertices;
282 candidateOniaVertices.clear();
284 for ( std::vector<const xAOD::Vertex*>::const_iterator vtxItr = oniaVertices.begin(); vtxItr != oniaVertices.end(); ++vtxItr ) {
291 std::vector<float> diMuon_Px = RefTrackPxAcc(*oniaVertex);
292 std::vector<float> diMuon_Py = RefTrackPyAcc(*oniaVertex);
293 std::vector<float> diMuon_Pz = RefTrackPzAcc(*oniaVertex);
295 TLorentzVector muon1, muon2;
296 muon1.SetXYZM(diMuon_Px.at(0),diMuon_Py.at(0),diMuon_Pz.at(0),105.658);
297 muon2.SetXYZM(diMuon_Px.at(1),diMuon_Py.at(1),diMuon_Pz.at(1),105.658);
299 TLorentzVector diMuon = muon1 + muon2;
301 const double deltaM = (diMuon+
photon).M() - diMuon.M();
303 ATH_MSG_DEBUG(
"Candidate DeltaM = " << deltaM <<
" MeV DiMuon " << oniaVertex->
index() <<
" ( Mass = " << diMuon.M() <<
" MeV )");
308 candidateOniaVertices.push_back(oniaVertex);
315 convVertexCandidate.reset();
323 nConv_Selected_DeltaM++;
326 std::vector< ElementLink<xAOD::VertexContainer> > diMuonLinks;
330 std::vector<float> fit_Psi1S_Px, fit_Psi1S_Py, fit_Psi1S_Pz, fit_Psi1S_M, fit_Psi1S_ChiSq;
331 std::vector<float> fit_Psi2S_Px, fit_Psi2S_Py, fit_Psi2S_Pz, fit_Psi2S_M, fit_Psi2S_ChiSq;
332 std::vector<float> fit_Upsi1S_Px, fit_Upsi1S_Py, fit_Upsi1S_Pz, fit_Upsi1S_M, fit_Upsi1S_ChiSq;
333 std::vector<float> fit_Upsi2S_Px, fit_Upsi2S_Py, fit_Upsi2S_Pz, fit_Upsi2S_M, fit_Upsi2S_ChiSq;
334 std::vector<float> fit_Upsi3S_Px, fit_Upsi3S_Py, fit_Upsi3S_Pz, fit_Upsi3S_M, fit_Upsi3S_ChiSq;
337 for(std::vector<const xAOD::Vertex*>::const_iterator vtxItr = candidateOniaVertices.begin(); vtxItr != candidateOniaVertices.end(); ++vtxItr ) {
351 diMuonLinks.push_back(myLink);
357 bool passed_Psi = passed_PsiAcc(**vtxItr);
358 bool passed_Upsi = passed_UpsiAcc(**vtxItr);
363 float fitChiSq_Psi1S = 99999;
364 TLorentzVector fitResult_Psi1S;
372 fit_Psi1S_Px.push_back(fitResult_Psi1S.Px());
373 fit_Psi1S_Py.push_back(fitResult_Psi1S.Py());
374 fit_Psi1S_Pz.push_back(fitResult_Psi1S.Pz());
375 fit_Psi1S_M.push_back(fitResult_Psi1S.M());
376 fit_Psi1S_ChiSq.push_back(fitChiSq_Psi1S);
381 float fitChiSq_Psi2S = 99999;
382 TLorentzVector fitResult_Psi2S;
390 fit_Psi2S_Px.push_back(fitResult_Psi2S.Px());
391 fit_Psi2S_Py.push_back(fitResult_Psi2S.Py());
392 fit_Psi2S_Pz.push_back(fitResult_Psi2S.Pz());
393 fit_Psi2S_M.push_back(fitResult_Psi2S.M());
394 fit_Psi2S_ChiSq.push_back(fitChiSq_Psi2S);
399 float fitChiSq_Upsi1S = 99999;
400 TLorentzVector fitResult_Upsi1S;
408 fit_Upsi1S_Px.push_back(fitResult_Upsi1S.Px());
409 fit_Upsi1S_Py.push_back(fitResult_Upsi1S.Py());
410 fit_Upsi1S_Pz.push_back(fitResult_Upsi1S.Pz());
411 fit_Upsi1S_M.push_back(fitResult_Upsi1S.M());
412 fit_Upsi1S_ChiSq.push_back(fitChiSq_Upsi1S);
417 float fitChiSq_Upsi2S = 99999;
418 TLorentzVector fitResult_Upsi2S;
426 fit_Upsi2S_Px.push_back(fitResult_Upsi2S.Px());
427 fit_Upsi2S_Py.push_back(fitResult_Upsi2S.Py());
428 fit_Upsi2S_Pz.push_back(fitResult_Upsi2S.Pz());
429 fit_Upsi2S_M.push_back(fitResult_Upsi2S.M());
430 fit_Upsi2S_ChiSq.push_back(fitChiSq_Upsi2S);
435 float fitChiSq_Upsi3S = 99999;
436 TLorentzVector fitResult_Upsi3S;
444 fit_Upsi3S_Px.push_back(fitResult_Upsi3S.Px());
445 fit_Upsi3S_Py.push_back(fitResult_Upsi3S.Py());
446 fit_Upsi3S_Pz.push_back(fitResult_Upsi3S.Pz());
447 fit_Upsi3S_M.push_back(fitResult_Upsi3S.M());
448 fit_Upsi3S_ChiSq.push_back(fitChiSq_Upsi3S);
458 DiMuonLinksAcc(*convVertexCandidate) = diMuonLinks;
465 CascadeFit_Psi1S_PxAcc(*convVertexCandidate) = fit_Psi1S_Px;
466 CascadeFit_Psi1S_PyAcc(*convVertexCandidate) = fit_Psi1S_Py;
467 CascadeFit_Psi1S_PzAcc(*convVertexCandidate) = fit_Psi1S_Pz;
468 CascadeFit_Psi1S_MAcc(*convVertexCandidate) = fit_Psi1S_M;
469 CascadeFit_Psi1S_ChiSqAcc(*convVertexCandidate) = fit_Psi1S_ChiSq;
476 CascadeFit_Psi2S_PxAcc(*convVertexCandidate) = fit_Psi2S_Px;
477 CascadeFit_Psi2S_PyAcc(*convVertexCandidate) = fit_Psi2S_Py;
478 CascadeFit_Psi2S_PzAcc(*convVertexCandidate) = fit_Psi2S_Pz;
479 CascadeFit_Psi2S_MAcc(*convVertexCandidate) = fit_Psi2S_M;
480 CascadeFit_Psi2S_ChiSqAcc(*convVertexCandidate) = fit_Psi2S_ChiSq;
487 CascadeFit_Upsi1S_PxAcc(*convVertexCandidate) = fit_Upsi1S_Px;
488 CascadeFit_Upsi1S_PyAcc(*convVertexCandidate) = fit_Upsi1S_Py;
489 CascadeFit_Upsi1S_PzAcc(*convVertexCandidate) = fit_Upsi1S_Pz;
490 CascadeFit_Upsi1S_MAcc(*convVertexCandidate) = fit_Upsi1S_M;
491 CascadeFit_Upsi1S_ChiSqAcc(*convVertexCandidate) = fit_Upsi1S_ChiSq;
498 CascadeFit_Upsi2S_PxAcc(*convVertexCandidate) = fit_Upsi2S_Px;
499 CascadeFit_Upsi2S_PyAcc(*convVertexCandidate) = fit_Upsi2S_Py;
500 CascadeFit_Upsi2S_PzAcc(*convVertexCandidate) = fit_Upsi2S_Pz;
501 CascadeFit_Upsi2S_MAcc(*convVertexCandidate) = fit_Upsi2S_M;
502 CascadeFit_Upsi2S_ChiSqAcc(*convVertexCandidate) = fit_Upsi2S_ChiSq;
509 CascadeFit_Upsi3S_PxAcc(*convVertexCandidate) = fit_Upsi3S_Px;
510 CascadeFit_Upsi3S_PyAcc(*convVertexCandidate) = fit_Upsi3S_Py;
511 CascadeFit_Upsi3S_PzAcc(*convVertexCandidate) = fit_Upsi3S_Pz;
512 CascadeFit_Upsi3S_MAcc(*convVertexCandidate) = fit_Upsi3S_M;
513 CascadeFit_Upsi3S_ChiSqAcc(*convVertexCandidate) = fit_Upsi3S_ChiSq;
518 pxAcc(*convVertexCandidate) =
momentum.x();
519 pyAcc(*convVertexCandidate) =
momentum.y();
520 pzAcc(*convVertexCandidate) =
momentum.z();
524 deltaCotThetaTrkAcc(*convVertexCandidate) = deltaCotTheta;
525 minimumDistanceTrkAcc(*convVertexCandidate) =
distance;
529 deltaPhiTracksAcc(*convVertexCandidate) = vertexOutput[
"deltaPhiTracks"];
530 DR1R2Acc(*convVertexCandidate) = vertexOutput[
"DR1R2"];
533 passedAcc(*convVertexCandidate) =
true;
535 conversionContainer->push_back(convVertexCandidate.release());
552 ATH_MSG_DEBUG(
"Number of track pairs: " << nTrackPairs_Init);
553 ATH_MSG_DEBUG(
"Number of track pairs selected: " << nTrackPairs_Selected);
554 ATH_MSG_DEBUG(
"Number of successful vertex fits: " << nConv_VertexFit);
555 ATH_MSG_DEBUG(
"Number of selected vertices: " << nConv_Selected);
556 ATH_MSG_DEBUG(
"Number of selected vertices (after DeltaM req.): " << nConv_Selected_DeltaM);
558 return StatusCode::SUCCESS;