ATLAS Offline Software
MuPlusDpstCascade.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 // MuPlusDpstCascade.cxx, (c) ATLAS Detector software
14 #include "xAODTracking/Vertex.h"
16 #include <algorithm>
18 #include "HepPDT/ParticleDataTable.hh"
21 
22 namespace DerivationFramework {
24  typedef std::vector<VertexLink> VertexLinkVector;
25  typedef std::vector<const xAOD::TrackParticle*> TrackBag;
26 
27 
29  // retrieving vertex Fitter
30  ATH_CHECK( m_iVertexFitter.retrieve());
31 
32  // retrieving the V0 tools
33  ATH_CHECK( m_V0Tools.retrieve());
34 
35  // retrieving the Cascade tools
36  ATH_CHECK( m_CascadeTools.retrieve());
37 
39 
40  //======================== inDetTrack selection tool ==================
41  m_trackSelectionTools = std::make_unique<InDet::InDetTrackSelectionTool>("TrackSelector");
42  ANA_CHECK(m_trackSelectionTools->setProperty("CutLevel", "LoosePrimary"));
43  ANA_CHECK(m_trackSelectionTools->initialize() );
44  //=====================================================================
45 
46  ATH_CHECK( m_partPropSvc.retrieve() );
47  auto pdt = m_partPropSvc->PDT();
48 
49  // retrieve particle masses
52 
57 
58  return StatusCode::SUCCESS;
59  }
60 
61 
63  {
64 
65  std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
66  constexpr int topoN = 2;
67  std::array<xAOD::VertexContainer*, topoN> Vtxwritehandles;
68  std::array<xAOD::VertexAuxContainer*, topoN> Vtxwritehandlesaux;
69  if(m_cascadeOutputsKeys.size() !=topoN) { ATH_MSG_FATAL("Incorrect number of VtxContainers"); return StatusCode::FAILURE; }
70 
71  for(int i =0; i<topoN;i++){
72  Vtxwritehandles[i] = new xAOD::VertexContainer();
73  Vtxwritehandlesaux[i] = new xAOD::VertexAuxContainer();
74  Vtxwritehandles[i]->setStore(Vtxwritehandlesaux[i]);
75  ATH_CHECK(evtStore()->record(Vtxwritehandles[i] , m_cascadeOutputsKeys[i] ));
76  ATH_CHECK(evtStore()->record(Vtxwritehandlesaux[i], m_cascadeOutputsKeys[i] + "Aux."));
77  }
78 
79  //----------------------------------------------------
80  // retrieve primary vertices
81  //----------------------------------------------------
82  const xAOD::Vertex * primaryVertex(nullptr);
83  const xAOD::VertexContainer *pvContainer(nullptr);
85  ATH_MSG_DEBUG("Found " << m_VxPrimaryCandidateName << " in StoreGate!");
86 
87  if (pvContainer->size()==0){
88  ATH_MSG_WARNING("You have no primary vertices: " << pvContainer->size());
89  return StatusCode::RECOVERABLE;
90  } else {
91  primaryVertex = (*pvContainer)[0];
92  }
93 
94  //----------------------------------------------------
95  // Try to retrieve refitted primary vertices
96  //----------------------------------------------------
97  xAOD::VertexContainer* refPvContainer = nullptr;
98  xAOD::VertexAuxContainer* refPvAuxContainer = nullptr;
99  if (m_refitPV) {
100  if (evtStore()->contains<xAOD::VertexContainer>(m_refPVContainerName)) {
101  // refitted PV container exists. Get it from the store gate
102  ATH_CHECK(evtStore()->retrieve(refPvContainer , m_refPVContainerName ));
103  ATH_CHECK(evtStore()->retrieve(refPvAuxContainer, m_refPVContainerName + "Aux."));
104  } else {
105  // refitted PV container does not exist. Create a new one.
106  refPvContainer = new xAOD::VertexContainer;
107  refPvAuxContainer = new xAOD::VertexAuxContainer;
108  refPvContainer->setStore(refPvAuxContainer);
109  ATH_CHECK(evtStore()->record(refPvContainer , m_refPVContainerName));
110  ATH_CHECK(evtStore()->record(refPvAuxContainer, m_refPVContainerName+"Aux."));
111  }
112  }
113 
114  ATH_CHECK(performSearch(&cascadeinfoContainer));
116  if(!evt.isValid()) {
117  ATH_MSG_ERROR("Cannot Retrieve " << m_eventInfo_key.key() );
118  return StatusCode::FAILURE;
119  }
120 
122  helper.SetMinNTracksInPV(m_PV_minNTracks);
123  // Decorators for the main vertex: chi2, ndf, pt and pt error, plus the D0 vertex variables
124  SG::AuxElement::Decorator<VertexLinkVector> CascadeLinksDecor("CascadeVertexLinks");
125  SG::AuxElement::Decorator<VertexLinkVector> MuPiLinksDecor("MuPiVertexLinks");
126  SG::AuxElement::Decorator<VertexLinkVector> D0LinksDecor("D0VertexLinks");
127  SG::AuxElement::Decorator<float> chi2_decor("ChiSquared");
128  SG::AuxElement::Decorator<float> ndof_decor("NumberDoF");
129  SG::AuxElement::Decorator<float> Pt_decor("Pt");
130  SG::AuxElement::Decorator<float> PtErr_decor("PtErr");
131  SG::AuxElement::Decorator<float> Mass_svdecor("D0_mass");
132  SG::AuxElement::Decorator<float> MassErr_svdecor("D0_massErr");
133  SG::AuxElement::Decorator<float> Pt_svdecor("D0_Pt");
134  SG::AuxElement::Decorator<float> PtErr_svdecor("D0_PtErr");
135  SG::AuxElement::Decorator<float> Lxy_svdecor("D0_Lxy");
136  SG::AuxElement::Decorator<float> LxyErr_svdecor("D0_LxyErr");
137  SG::AuxElement::Decorator<float> Tau_svdecor("D0_Tau");
138  SG::AuxElement::Decorator<float> TauErr_svdecor("D0_TauErr");
139 
140  SG::AuxElement::Decorator<float> massMuPi_decor("MuPi_mass"); //mu+pi_soft mass before fit
141  SG::AuxElement::Decorator<float> MassKpi_svdecor("Kpi_mass");
142  SG::AuxElement::Decorator<float> MassMuPiAft_decor("MuPiAft_mass"); //mu+pi_soft mass after fit
143  SG::AuxElement::Decorator<float> MassPiD0_decor("PiD0_mass");
144  SG::AuxElement::Decorator<float> MassMuPiPiK_decor("MuPiPiK_mass");
145 
146  SG::AuxElement::Decorator<float> ChargePi_decor("Pi_charge");
147  SG::AuxElement::Decorator<float> ChargeMu_decor("Mu_charge");
148  SG::AuxElement::Decorator<float> ChargeK_decor("K_charge");
149  SG::AuxElement::Decorator<float> ChargePi_s_decor("Pi_s_charge");
150  SG::AuxElement::Decorator<float> Chi2Mu_decor("Mu_chi2");
151  SG::AuxElement::Decorator<float> nDoFMu_decor("Mu_nDoF");
152  //muon contribution to chi2 of the cascade fit
153  SG::AuxElement::Decorator<float> MuChi2B_decor("Mu_chi2_B");
154  SG::AuxElement::Decorator<float> MunDoFB_decor("Mu_nDoF_B");
155 
156 
157  // Get mu+pi container and identify the input mu+pi
158  const xAOD::VertexContainer *MuPiContainer(nullptr);
159  ATH_CHECK(evtStore()->retrieve(MuPiContainer , m_vertexContainerKey ));
160  const xAOD::VertexContainer *d0Container(nullptr);
161  ATH_CHECK(evtStore()->retrieve(d0Container , m_vertexD0ContainerKey )); //"D0Vertices"
162 
163  for (Trk::VxCascadeInfo* x : cascadeinfoContainer) {
164  if(x==nullptr){
165  ATH_MSG_ERROR("cascadeinfoContainer is null");
166  continue;
167  }
168 
169  // the cascade fitter returns:
170  // std::vector<xAOD::Vertex*>, each xAOD::Vertex contains the refitted track parameters (perigee at the vertex position)
171  // vertices[iv] the links to the original TPs and a covariance of size 3+5*NTRK; the chi2 of the total fit
172  // is split between the cascade vertices as per track contribution
173  // std::vector< std::vector<TLorentzVector> >, each std::vector<TLorentzVector> contains the refitted momenta (TLorentzVector)
174  // momenta[iv][...] of all tracks in the corresponding vertex, including any pseudotracks (from cascade vertices)
175  // originating in this vertex; the masses are as assigned in the cascade fit
176  // std::vector<Amg::MatrixX>, the corresponding covariance matrices in momentum space
177  // covariance[iv]
178  // int nDoF, double Chi2
179  //
180  // the invariant mass, pt, lifetime etc. errors should be calculated using the covariance matrices in momentum space as these
181  // take into account the full track-track and track-vertex correlations
182  //
183  // in the case of Jpsi+V0: vertices[0] is the V0 vertex, vertices[1] is the B/Lambda_b(bar) vertex, containing the 2 Jpsi tracks.
184  // The covariance terms between the two vertices are not stored. In momentum space momenta[0] contains the 2 V0 tracks,
185  // their momenta add up to the momentum of the 3rd track in momenta[1], the first two being the Jpsi tracks
186 
187  const std::vector<xAOD::Vertex*> &cascadeVertices = x->vertices();
188  if(cascadeVertices.size()!=topoN)
189  ATH_MSG_ERROR("Incorrect number of vertices");
190  if(cascadeVertices[0] == nullptr || cascadeVertices[1] == nullptr) ATH_MSG_ERROR("Error null vertex");
191  // Keep vertices (bear in mind that they come in reverse order!)
192  for(int i =0;i<topoN;i++) Vtxwritehandles[i]->push_back(cascadeVertices[i]);
193 
194  x->setSVOwnership(false); // Prevent Container from deleting vertices
195  const auto mainVertex = cascadeVertices[1]; // this is the B_c+/- vertex
196  const std::vector< std::vector<TLorentzVector> > &moms = x->getParticleMoms();
197 
198  // Set links to cascade vertices
199  std::vector<const xAOD::Vertex*> verticestoLink;
200  verticestoLink.push_back(cascadeVertices[0]);
201  if(Vtxwritehandles[1] == nullptr) ATH_MSG_ERROR("Vtxwritehandles[1] is null");
202  if(!BPhysPVCascadeTools::LinkVertices(CascadeLinksDecor, verticestoLink, Vtxwritehandles[0], cascadeVertices[1]))
203  ATH_MSG_ERROR("Error decorating with cascade vertices");
204 
205  // Identify the input mu+pi_soft
206  const xAOD::Vertex* MuPiVertex = BPhysPVCascadeTools::FindVertex<2>(MuPiContainer, cascadeVertices[1]);
207  ATH_MSG_DEBUG("1 pt mu+pi_soft tracks " << cascadeVertices[1]->trackParticle(0)->pt() << ", " << cascadeVertices[1]->trackParticle(1)->pt());
208  if (MuPiVertex) ATH_MSG_DEBUG("2 pt mu+pi_soft tracks " << MuPiVertex->trackParticle(0)->pt() << ", " << MuPiVertex->trackParticle(1)->pt());
209 
210  // Identify the input D0
211  const xAOD::Vertex* d0Vertex = BPhysPVCascadeTools::FindVertex<2>(d0Container, cascadeVertices[0]);;
212  ATH_MSG_DEBUG("1 pt D0 tracks " << cascadeVertices[0]->trackParticle(0)->pt() << ", " << cascadeVertices[0]->trackParticle(1)->pt());
213  if (d0Vertex) ATH_MSG_DEBUG("2 pt D0 tracks " << d0Vertex->trackParticle(0)->pt() << ", " << d0Vertex->trackParticle(1)->pt());
214 
215  // Set links to input vertices
216  std::vector<const xAOD::Vertex*> MuPiVerticestoLink;
217  if (MuPiVertex) MuPiVerticestoLink.push_back(MuPiVertex);
218  else ATH_MSG_WARNING("Could not find linking mu+pi_soft");
219  if(!BPhysPVCascadeTools::LinkVertices(MuPiLinksDecor, MuPiVerticestoLink, MuPiContainer, cascadeVertices[1]))
220  ATH_MSG_ERROR("Error decorating with mu+pi_soft vertices");
221 
222  std::vector<const xAOD::Vertex*> d0VerticestoLink;
223  if (d0Vertex) d0VerticestoLink.push_back(d0Vertex);
224  else ATH_MSG_WARNING("Could not find linking D0");
225  if(!BPhysPVCascadeTools::LinkVertices(D0LinksDecor, d0VerticestoLink, d0Container, cascadeVertices[1]))
226  ATH_MSG_ERROR("Error decorating with D0 vertices");
227 
228  bool tagD0(true);
229  if (MuPiVertex){
230  if(std::abs(m_Dx_pid)==421 && (MuPiVertex->trackParticle(1)->charge()==-1)) tagD0 = false; //checking soft pion charge
231  }
232 
233  double mass_b = m_vtx0MassHypo;
234  double mass_d0 = m_vtx1MassHypo;
235  std::vector<double> massesMuPi;
236  massesMuPi.push_back(m_vtx0Daug1MassHypo); //mu
237  massesMuPi.push_back(m_vtx0Daug2MassHypo); //pi_soft
238  std::vector<double> massesD0;
239  if(tagD0){
240  massesD0.push_back(m_vtx1Daug1MassHypo); //pi
241  massesD0.push_back(m_vtx1Daug2MassHypo); //K
242  }else{ // Change the order of masses for D*-->D0bar pi-, D0bar->K+pi-
243  massesD0.push_back(m_vtx1Daug2MassHypo); //K
244  massesD0.push_back(m_vtx1Daug1MassHypo); //pi
245  }
246  std::vector<double> Masses; // masses of all particles "inside" of B
247  Masses.push_back(m_vtx0Daug1MassHypo); //mu
248  Masses.push_back(m_vtx0Daug2MassHypo); //pi_soft
249  Masses.push_back(m_vtx1MassHypo); //D0 mass
250 
251  // loop over candidates -- Don't apply PV_minNTracks requirement here
252  // because it may result in exclusion of the high-pt PV.
253  // get good PVs
254 
255  xAOD::BPhysHypoHelper vtx(m_hypoName, mainVertex);
256 
257  // Get refitted track momenta from all vertices, charged tracks only
259 
260 
261  // Decorate main vertex
262  //
263  // 1.a) mass, mass error
264  BPHYS_CHECK( vtx.setMass(m_CascadeTools->invariantMass(moms[1])) );
265  BPHYS_CHECK( vtx.setMassErr(m_CascadeTools->invariantMassError(moms[1],x->getCovariance()[1])) );
266  // 1.b) pt and pT error (the default pt of mainVertex is != the pt of the full cascade fit!)
267  Pt_decor(*mainVertex) = m_CascadeTools->pT(moms[1]);
268  PtErr_decor(*mainVertex) = m_CascadeTools->pTError(moms[1],x->getCovariance()[1]);
269  // 1.c) chi2 and ndof (the default chi2 of mainVertex is != the chi2 of the full cascade fit!)
270  chi2_decor(*mainVertex) = x->fitChi2();
271  ndof_decor(*mainVertex) = x->nDoF();
272  Chi2Mu_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->chiSquared();
273  nDoFMu_decor(*mainVertex) = cascadeVertices[1]->trackParticle(0)->numberDoF();
274 
275  // track contribution to chi2 of cascasde fit
276  std::vector< Trk::VxTrackAtVertex > trkAtB = cascadeVertices[1]->vxTrackAtVertex();
277  MuChi2B_decor(*mainVertex) = trkAtB.at(0).trackQuality().chiSquared();
278  MunDoFB_decor(*mainVertex) = trkAtB.at(0).trackQuality().numberDoF();
279 
280  float massMuPi = 0.;
281  if (MuPiVertex) {
282  TLorentzVector p4_mu1, p4_pi_s;
283  p4_mu1.SetPtEtaPhiM(MuPiVertex->trackParticle(0)->pt(),
284  MuPiVertex->trackParticle(0)->eta(),
285  MuPiVertex->trackParticle(0)->phi(), m_vtx0Daug1MassHypo); //mu
286  p4_pi_s.SetPtEtaPhiM(MuPiVertex->trackParticle(1)->pt(),
287  MuPiVertex->trackParticle(1)->eta(),
288  MuPiVertex->trackParticle(1)->phi(), m_vtx0Daug2MassHypo); // pi_soft
289  massMuPi = (p4_mu1 + p4_pi_s).M();
290  ChargePi_s_decor(*mainVertex) = MuPiVertex->trackParticle(1)->charge();
291  ChargeMu_decor(*mainVertex) = MuPiVertex->trackParticle(0)->charge();
292  }
293  massMuPi_decor(*mainVertex) = massMuPi;
294 
295  //float massKpi = 0.;
296  if (d0Vertex) {
297  TLorentzVector p4_ka, p4_pi;
298  if(tagD0){
299  p4_pi.SetPtEtaPhiM(d0Vertex->trackParticle(0)->pt(),
300  d0Vertex->trackParticle(0)->eta(),
301  d0Vertex->trackParticle(0)->phi(), m_vtx1Daug1MassHypo);
302  p4_ka.SetPtEtaPhiM(d0Vertex->trackParticle(1)->pt(),
303  d0Vertex->trackParticle(1)->eta(),
304  d0Vertex->trackParticle(1)->phi(), m_vtx1Daug2MassHypo);
305  ChargeK_decor(*mainVertex) = d0Vertex->trackParticle(1)->charge();
306  ChargePi_decor(*mainVertex) = d0Vertex->trackParticle(0)->charge();
307 
308  }else{ // Change the oreder of masses for D*-->D0bar pi-, D0bar->K+pi-
309  p4_pi.SetPtEtaPhiM(d0Vertex->trackParticle(1)->pt(),
310  d0Vertex->trackParticle(1)->eta(),
311  d0Vertex->trackParticle(1)->phi(), m_vtx1Daug1MassHypo);
312  p4_ka.SetPtEtaPhiM(d0Vertex->trackParticle(0)->pt(),
313  d0Vertex->trackParticle(0)->eta(),
314  d0Vertex->trackParticle(0)->phi(), m_vtx1Daug2MassHypo);
315  ChargeK_decor(*mainVertex) = d0Vertex->trackParticle(0)->charge();
316  ChargePi_decor(*mainVertex) = d0Vertex->trackParticle(1)->charge();
317  }
318  //massKpi = (p4_ka + p4_pi).M();
319  }
320  MassMuPiAft_decor(*mainVertex) = (moms[1][0] + moms[1][1]).M(); //mu + pi_soft
321  MassPiD0_decor(*mainVertex) = (moms[1][1] + moms[0][0] + moms[0][1]).M(); //pi_soft + D0
322  MassKpi_svdecor(*mainVertex) = (moms[0][0] + moms[0][1]).M();//D0
323  MassMuPiPiK_decor(*mainVertex) = m_CascadeTools->invariantMass(moms[1]); //B0
324 
325  ATH_CHECK(helper.FillCandwithRefittedVertices(m_refitPV, pvContainer, refPvContainer, &(*m_pvRefitter), m_PV_max, m_DoVertexType, x, 1, mass_b, vtx));
326 
327  // 4) decorate the main vertex with D0 vertex mass, pt, lifetime and lxy values (plus errors)
328  // D0 points to the main vertex, so lifetime and lxy are w.r.t the main vertex
329  Mass_svdecor(*mainVertex) = m_CascadeTools->invariantMass(moms[0]);
330  MassErr_svdecor(*mainVertex) = m_CascadeTools->invariantMassError(moms[0],x->getCovariance()[0]);
331  Pt_svdecor(*mainVertex) = m_CascadeTools->pT(moms[0]);
332  PtErr_svdecor(*mainVertex) = m_CascadeTools->pTError(moms[0],x->getCovariance()[0]);
333  Lxy_svdecor(*mainVertex) = m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]);
334  LxyErr_svdecor(*mainVertex) = m_CascadeTools->lxyError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
335  Tau_svdecor(*mainVertex) = m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1]);
336  TauErr_svdecor(*mainVertex) = m_CascadeTools->tauError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1]);
337 
338 
339  // Some checks in DEBUG mode
340  ATH_MSG_DEBUG("chi2 " << x->fitChi2() //DEBUG->INFO
341  << " chi2_1 " << m_V0Tools->chisq(cascadeVertices[0])
342  << " chi2_2 " << m_V0Tools->chisq(cascadeVertices[1])
343  << " vprob " << m_CascadeTools->vertexProbability(x->nDoF(),x->fitChi2()));
344  ATH_MSG_DEBUG("ndf " << x->nDoF() << " ndf_1 " << m_V0Tools->ndof(cascadeVertices[0]) << " ndf_2 " << m_V0Tools->ndof(cascadeVertices[1]));
345  ATH_MSG_DEBUG("V0Tools mass_d0 " << m_V0Tools->invariantMass(cascadeVertices[0],massesD0)
346  << " error " << m_V0Tools->invariantMassError(cascadeVertices[0],massesD0)
347  << " mass_J " << m_V0Tools->invariantMass(cascadeVertices[1],massesMuPi)
348  << " error " << m_V0Tools->invariantMassError(cascadeVertices[1],massesMuPi));
349  // masses and errors, using track masses assigned in the fit
350  double Mass_B = m_CascadeTools->invariantMass(moms[1]);
351  double Mass_D0 = m_CascadeTools->invariantMass(moms[0]);
352  double Mass_B_err = m_CascadeTools->invariantMassError(moms[1],x->getCovariance()[1]);
353  double Mass_D0_err = m_CascadeTools->invariantMassError(moms[0],x->getCovariance()[0]);
354  ATH_MSG_DEBUG("Mass_B " << Mass_B << " Mass_D0 " << Mass_D0);
355  ATH_MSG_DEBUG("Mass_B_err " << Mass_B_err << " Mass_D0_err " << Mass_D0_err);
356  double mprob_B = m_CascadeTools->massProbability(mass_b,Mass_B,Mass_B_err);
357  double mprob_D0 = m_CascadeTools->massProbability(mass_d0,Mass_D0,Mass_D0_err);
358  ATH_MSG_DEBUG("mprob_B " << mprob_B << " mprob_D0 " << mprob_D0);
359  // masses and errors, assigning user defined track masses
360  ATH_MSG_DEBUG("Mass_b " << m_CascadeTools->invariantMass(moms[1],Masses)
361  << " Mass_d0 " << m_CascadeTools->invariantMass(moms[0],massesD0));
362  ATH_MSG_DEBUG("Mass_b_err " << m_CascadeTools->invariantMassError(moms[1],x->getCovariance()[1],Masses)
363  << " Mass_d0_err " << m_CascadeTools->invariantMassError(moms[0],x->getCovariance()[0],massesD0));
364  ATH_MSG_DEBUG("pt_b " << m_CascadeTools->pT(moms[1])
365  << " pt_d " << m_CascadeTools->pT(moms[0])
366  << " pt_d0 " << m_V0Tools->pT(cascadeVertices[0]));
367  ATH_MSG_DEBUG("ptErr_b " << m_CascadeTools->pTError(moms[1],x->getCovariance()[1])
368  << " ptErr_d " << m_CascadeTools->pTError(moms[0],x->getCovariance()[0])
369  << " ptErr_d0 " << m_V0Tools->pTError(cascadeVertices[0]));
370  ATH_MSG_DEBUG("lxy_B " << m_V0Tools->lxy(cascadeVertices[1],primaryVertex) << " lxy_D " << m_V0Tools->lxy(cascadeVertices[0],cascadeVertices[1]));
371  ATH_MSG_DEBUG("lxy_b " << m_CascadeTools->lxy(moms[1],cascadeVertices[1],primaryVertex) << " lxy_d " << m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]));
372  ATH_MSG_DEBUG("lxyErr_b " << m_CascadeTools->lxyError(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex)
373  << " lxyErr_d " << m_CascadeTools->lxyError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
374  << " lxyErr_d0 " << m_V0Tools->lxyError(cascadeVertices[0],cascadeVertices[1]));
375  ATH_MSG_DEBUG("tau_B " << m_CascadeTools->tau(moms[1],cascadeVertices[1],primaryVertex,mass_b)
376  << " tau_d0 " << m_V0Tools->tau(cascadeVertices[0],cascadeVertices[1],massesD0));
377  ATH_MSG_DEBUG("tau_b " << m_CascadeTools->tau(moms[1],cascadeVertices[1],primaryVertex)
378  << " tau_d " << m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1])
379  << " tau_D " << m_CascadeTools->tau(moms[0],cascadeVertices[0],cascadeVertices[1],mass_d0));
380  ATH_MSG_DEBUG("tauErr_b " << m_CascadeTools->tauError(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex)
381  << " tauErr_d " << m_CascadeTools->tauError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
382  << " tauErr_d0 " << m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0));
383  ATH_MSG_DEBUG("TauErr_b " << m_CascadeTools->tauError(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex,mass_b)
384  << " TauErr_d " << m_CascadeTools->tauError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1],mass_d0)
385  << " TauErr_d0 " << m_V0Tools->tauError(cascadeVertices[0],cascadeVertices[1],massesD0,mass_d0));
386 
387  ATH_MSG_DEBUG("CascadeTools main vert wrt PV " << " CascadeTools SV " << " V0Tools SV");
388  ATH_MSG_DEBUG("a0z " << m_CascadeTools->a0z(moms[1],cascadeVertices[1],primaryVertex)
389  << ", " << m_CascadeTools->a0z(moms[0],cascadeVertices[0],cascadeVertices[1])
390  << ", " << m_V0Tools->a0z(cascadeVertices[0],cascadeVertices[1]));
391  ATH_MSG_DEBUG("a0zErr " << m_CascadeTools->a0zError(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex)
392  << ", " << m_CascadeTools->a0zError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
393  << ", " << m_V0Tools->a0zError(cascadeVertices[0],cascadeVertices[1]));
394  ATH_MSG_DEBUG("a0xy " << m_CascadeTools->a0xy(moms[1],cascadeVertices[1],primaryVertex)
395  << ", " << m_CascadeTools->a0xy(moms[0],cascadeVertices[0],cascadeVertices[1])
396  << ", " << m_V0Tools->a0xy(cascadeVertices[0],cascadeVertices[1]));
397  ATH_MSG_DEBUG("a0xyErr " << m_CascadeTools->a0xyError(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex)
398  << ", " << m_CascadeTools->a0xyError(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
399  << ", " << m_V0Tools->a0xyError(cascadeVertices[0],cascadeVertices[1]));
400  ATH_MSG_DEBUG("a0 " << m_CascadeTools->a0(moms[1],cascadeVertices[1],primaryVertex)
401  << ", " << m_CascadeTools->a0(moms[0],cascadeVertices[0],cascadeVertices[1])
402  << ", " << m_V0Tools->a0(cascadeVertices[0],cascadeVertices[1]));
403  ATH_MSG_DEBUG("a0Err " << m_CascadeTools->a0Error(moms[1],x->getCovariance()[1],cascadeVertices[1],primaryVertex)
404  << ", " << m_CascadeTools->a0Error(moms[0],x->getCovariance()[0],cascadeVertices[0],cascadeVertices[1])
405  << ", " << m_V0Tools->a0Error(cascadeVertices[0],cascadeVertices[1]));
406  ATH_MSG_DEBUG("x0 " << m_V0Tools->vtx(cascadeVertices[0]).x() << " y0 " << m_V0Tools->vtx(cascadeVertices[0]).y() << " z0 " << m_V0Tools->vtx(cascadeVertices[0]).z());
407  ATH_MSG_DEBUG("x1 " << m_V0Tools->vtx(cascadeVertices[1]).x() << " y1 " << m_V0Tools->vtx(cascadeVertices[1]).y() << " z1 " << m_V0Tools->vtx(cascadeVertices[1]).z());
408  ATH_MSG_DEBUG("X0 " << primaryVertex->x() << " Y0 " << primaryVertex->y() << " Z0 " << primaryVertex->z());
409  ATH_MSG_DEBUG("rxy0 " << m_V0Tools->rxy(cascadeVertices[0]) << " rxyErr0 " << m_V0Tools->rxyError(cascadeVertices[0]));
410  ATH_MSG_DEBUG("rxy1 " << m_V0Tools->rxy(cascadeVertices[1]) << " rxyErr1 " << m_V0Tools->rxyError(cascadeVertices[1]));
411  ATH_MSG_DEBUG("Rxy0 wrt PV " << m_V0Tools->rxy(cascadeVertices[0],primaryVertex) << " RxyErr0 wrt PV " << m_V0Tools->rxyError(cascadeVertices[0],primaryVertex));
412  ATH_MSG_DEBUG("Rxy1 wrt PV " << m_V0Tools->rxy(cascadeVertices[1],primaryVertex) << " RxyErr1 wrt PV " << m_V0Tools->rxyError(cascadeVertices[1],primaryVertex));
413  ATH_MSG_DEBUG("number of covariance matrices " << (x->getCovariance()).size());
414  } // loop over cascadeinfoContainer
415 
416  // Deleting cascadeinfo since this won't be stored.
417  // Vertices have been kept in m_cascadeOutputs and should be owned by their container
418  for (auto x : cascadeinfoContainer) delete x;
419 
420  return StatusCode::SUCCESS;
421  }
422 
423 
424  MuPlusDpstCascade::MuPlusDpstCascade(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p),
425  m_vertexContainerKey(""),
426  m_vertexD0ContainerKey(""),
427  m_cascadeOutputsKeys{ "MuPlusDpstCascadeVtx1", "MuPlusDpstCascadeVtx2" },
428  m_VxPrimaryCandidateName("PrimaryVertices"),
429  m_MuPiMassLower(0.0),
430  m_MuPiMassUpper(10000.0),
431  m_D0MassLower(0.0),
432  m_D0MassUpper(10000.0),
433  m_DstMassLower(0.0),
434  m_DstMassUpper(10000.0),
435  m_DstMassUpperAft(10000.0),
436  m_MassLower(0.0),
437  m_MassUpper(20000.0),
438  m_vtx0MassHypo(-1),
439  m_vtx1MassHypo(-1),
440  m_vtx0Daug1MassHypo(-1),
441  m_vtx0Daug2MassHypo(-1),
442  m_vtx1Daug1MassHypo(-1),
443  m_vtx1Daug2MassHypo(-1),
444  m_Dx_pid(421),
445  m_constrD0(true),
446  m_constrMuPi(false),
447  m_chi2cut(-1.0),
448  m_iVertexFitter("Trk::TrkVKalVrtFitter"),
449  m_pvRefitter("Analysis::PrimaryVertexRefitter", this),
450  m_V0Tools("Trk::V0Tools"),
451  m_CascadeTools("DerivationFramework::CascadeTools")
452  {
453  declareProperty("MuPiVertices", m_vertexContainerKey);
454  declareProperty("D0Vertices", m_vertexD0ContainerKey);
455  declareProperty("VxPrimaryCandidateName", m_VxPrimaryCandidateName);
456  declareProperty("RefPVContainerName", m_refPVContainerName = "RefittedPrimaryVertices");
457  declareProperty("MuPiMassLowerCut", m_MuPiMassLower);
458  declareProperty("MuPiMassUpperCut", m_MuPiMassUpper);
459  declareProperty("D0MassLowerCut", m_D0MassLower);
460  declareProperty("D0MassUpperCut", m_D0MassUpper);
461  declareProperty("DstMassLowerCut", m_DstMassLower);
462  declareProperty("DstMassUpperCut", m_DstMassUpper);
463  declareProperty("DstMassUpperCutAft", m_DstMassUpperAft); //mass cut after cascade fit
464  declareProperty("MassLowerCut", m_MassLower);
465  declareProperty("MassUpperCut", m_MassUpper);
466  declareProperty("HypothesisName", m_hypoName = "B");
467  declareProperty("Vtx0MassHypo", m_vtx0MassHypo);
468  declareProperty("Vtx1MassHypo", m_vtx1MassHypo);
469  declareProperty("Vtx0Daug1MassHypo", m_vtx0Daug1MassHypo);
470  declareProperty("Vtx0Daug2MassHypo", m_vtx0Daug2MassHypo);
471  declareProperty("Vtx0Daug3MassHypo", m_vtx0Daug2MassHypo);
472  declareProperty("Vtx1Daug1MassHypo", m_vtx1Daug1MassHypo);
473  declareProperty("Vtx1Daug2MassHypo", m_vtx1Daug2MassHypo);
474  declareProperty("DxHypothesis", m_Dx_pid);
475  declareProperty("ApplyD0MassConstraint", m_constrD0);
476  declareProperty("ApplyMuPiMassConstraint", m_constrMuPi);
477  declareProperty("Chi2Cut", m_chi2cut);
478  declareProperty("RefitPV", m_refitPV = true);
479  declareProperty("MaxnPV", m_PV_max = 999);
480  declareProperty("MinNTracksInPV", m_PV_minNTracks = 0);
481  declareProperty("DoVertexType", m_DoVertexType = 7);
482  declareProperty("TrkVertexFitterTool", m_iVertexFitter);
483  declareProperty("PVRefitter", m_pvRefitter);
484  declareProperty("V0Tools", m_V0Tools);
485  declareProperty("CascadeTools", m_CascadeTools);
486  declareProperty("CascadeVertexCollections", m_cascadeOutputsKeys);
487  }
488 
490 
491  StatusCode MuPlusDpstCascade::performSearch(std::vector<Trk::VxCascadeInfo*> *cascadeinfoContainer) const
492  {
493 
494  assert(cascadeinfoContainer!=nullptr);
495 
496  // Get TrackParticle container (for setting links to the original tracks)
497  const xAOD::TrackParticleContainer *trackContainer(nullptr);
498  ATH_CHECK(evtStore()->retrieve(trackContainer , "InDetTrackParticles" ));
499 
500  // Get mu+pi container
501  const xAOD::VertexContainer *MuPiContainer(nullptr);
502  ATH_CHECK(evtStore()->retrieve(MuPiContainer , m_vertexContainerKey ));
503 
504  // Get D0 container
505  const xAOD::VertexContainer *d0Container(nullptr);
506  ATH_CHECK(evtStore()->retrieve(d0Container , m_vertexD0ContainerKey )); //"D0Vertices"
507 
508  double mass_d0 = m_vtx1MassHypo;
509  std::vector<const xAOD::TrackParticle*> tracksMuPi;
510  std::vector<const xAOD::TrackParticle*> tracksD0;
511  std::vector<double> massesMuPi;
512  massesMuPi.push_back(m_vtx0Daug1MassHypo); //mass mu
513  massesMuPi.push_back(m_vtx0Daug2MassHypo); //mass pi
514  std::vector<double> massesD0;
515  massesD0.push_back(m_vtx1Daug1MassHypo); //mass pi
516  massesD0.push_back(m_vtx1Daug2MassHypo); //mass K
517  std::vector<double> massesD0b; // Change the oreder of masses for D*-->D0bar pi-, D0bar->K+pi-
518  massesD0b.push_back(m_vtx1Daug2MassHypo);
519  massesD0b.push_back(m_vtx1Daug1MassHypo);
520  std::vector<double> Masses;
521  Masses.push_back(m_vtx0Daug1MassHypo); //mu
522  Masses.push_back(m_vtx0Daug2MassHypo); //pi
523  Masses.push_back(m_vtx1MassHypo); //D0
524 
525 
526 
527  // Select mu+pi_soft candidates before calling cascade fit
528  std::vector<const xAOD::Vertex*> selectedMuPiCandidates;
529  for ( auto vxcItr : *MuPiContainer ){
530  // Check mu+pi_soft candidate invariant mass and skip if need be
531  TLorentzVector p4Mup_in, p4Mum_in;
532  p4Mup_in.SetPtEtaPhiM(vxcItr->trackParticle(0)->pt(),
533  vxcItr->trackParticle(0)->eta(),
534  vxcItr->trackParticle(0)->phi(), m_vtx0Daug1MassHypo);
535  p4Mum_in.SetPtEtaPhiM(vxcItr->trackParticle(1)->pt(),
536  vxcItr->trackParticle(1)->eta(),
537  vxcItr->trackParticle(1)->phi(), m_vtx0Daug2MassHypo);
538  double mass_MuPi = (p4Mup_in + p4Mum_in).M();
539  ATH_MSG_DEBUG("mu pi_soft mass " << mass_MuPi);
540  if (mass_MuPi < m_MuPiMassLower || mass_MuPi > m_MuPiMassUpper) {
541  ATH_MSG_DEBUG(" Original mu & pi_soft candidate rejected by the mass cut: mass = "
542  << mass_MuPi << " != (" << m_MuPiMassLower << ", " << m_MuPiMassUpper << ")" );
543  continue;
544  }
545 
546  // Track selection - Loose
547  // for soft pion wich is (2nd) in MuPi vertex
548  if ( !m_trackSelectionTools->accept(vxcItr->trackParticle(1)) ){
549  ATH_MSG_DEBUG(" Original mu & pi_soft candidate rejected by the track's cut level - loose");
550  continue;
551  }
552 
553  selectedMuPiCandidates.push_back(vxcItr);
554  } //for(auto vxcItr : *MuPiContainer)
555  if(selectedMuPiCandidates.size()<1) return StatusCode::SUCCESS;
556 
557  // Select the D0/D0b candidates before calling cascade fit
558  std::vector<const xAOD::Vertex*> selectedD0Candidates;
559  for(auto vxcItr : *d0Container){
560  // Check the passed flag first
561  const xAOD::Vertex* vtx = vxcItr;
562  SG::AuxElement::Accessor<Char_t> flagAcc1("passed_D0");
563  SG::AuxElement::Accessor<Char_t> flagAcc2("passed_D0b");
564  bool isD0(true);
565  bool isD0b(true);
566  if(flagAcc1.isAvailable(*vtx)){
567  if(!flagAcc1(*vtx)) isD0 = false;
568  }
569  if(flagAcc2.isAvailable(*vtx)){
570  if(!flagAcc2(*vtx)) isD0b = false;
571  }
572  if(!(isD0||isD0b)) continue;
573 
574  // Track selection - Loose
575  if ( !m_trackSelectionTools->accept(vxcItr->trackParticle(0)) ){
576  ATH_MSG_DEBUG(" Original D0/D0-bar candidate rejected by the track's cut level - loose ");
577  continue;
578  }
579  if ( !m_trackSelectionTools->accept(vxcItr->trackParticle(1)) ){
580  ATH_MSG_DEBUG(" Original D0/D0-bar candidate rejected by the track's cut level - loose ");
581  continue;
582  }
583 
584 
585  // Ensure the total charge is correct
586  if (vxcItr->trackParticle(0)->charge() != 1 || vxcItr->trackParticle(1)->charge() != -1) {
587  ATH_MSG_DEBUG(" Original D0/D0-bar candidate rejected by the charge requirement: "
588  << vxcItr->trackParticle(0)->charge() << ", " << vxcItr->trackParticle(1)->charge() );
589  continue;
590  }
591 
592  // Check D0/D0bar candidate invariant mass and skip if need be
593  double mass_D0 = m_V0Tools->invariantMass(vxcItr,massesD0);
594  double mass_D0b = m_V0Tools->invariantMass(vxcItr,massesD0b);
595  ATH_MSG_DEBUG("D0 mass " << mass_D0 << ", D0b mass "<<mass_D0b);
596  if ((mass_D0 < m_D0MassLower || mass_D0 > m_D0MassUpper) && (mass_D0b < m_D0MassLower || mass_D0b > m_D0MassUpper)) {
597  ATH_MSG_DEBUG(" Original D0/D0-bar candidate rejected by the mass cut: mass = "
598  << mass_D0 << " != (" << m_D0MassLower << ", " << m_D0MassUpper << ") "
599  << mass_D0b << " != (" << m_D0MassLower << ", " << m_D0MassUpper << ") " );
600  continue;
601  }
602 
603  selectedD0Candidates.push_back(vxcItr);
604  } //for(auto vxcItr : *d0Container)
605  if(selectedD0Candidates.size()<1) return StatusCode::SUCCESS;
606 
607  // Select mu D*+ candidates
608  // Iterate over mu+pi_soft vertices
609  for(auto MuPiItr:selectedMuPiCandidates){
610  size_t MuPiTrkNum = MuPiItr->nTrackParticles();
611 
612  tracksMuPi.clear();
613  for( unsigned int it=0; it<MuPiTrkNum; it++) tracksMuPi.push_back(MuPiItr->trackParticle(it));
614 
615  if (tracksMuPi.size() != 2 || massesMuPi.size() != 2 ) {
616  ATH_MSG_INFO("problems with mu+pi_soft input");
617  }
618 
619  bool tagD0(true);
620  if(std::abs(m_Dx_pid)==421 && MuPiItr->trackParticle(1)->charge()==-1) tagD0 = false;
621 
622  TLorentzVector p4_pi1; // Momentum of soft pion1 = our soft pion (1)
623  p4_pi1.SetPtEtaPhiM(MuPiItr->trackParticle(1)->pt(),
624  MuPiItr->trackParticle(1)->eta(),
625  MuPiItr->trackParticle(1)->phi(), m_vtx0Daug2MassHypo);
626  // Iterate over D0/D0bar vertices
627  for(auto d0Itr : selectedD0Candidates){
628 
629  // Check identical tracks in input
630  if(std::find(tracksMuPi.cbegin(), tracksMuPi.cend(), d0Itr->trackParticle(0)) != tracksMuPi.cend()) continue;
631  if(std::find(tracksMuPi.cbegin(), tracksMuPi.cend(), d0Itr->trackParticle(1)) != tracksMuPi.cend()) continue;
632 
633  TLorentzVector p4_ka, p4_pi2;
634  if(tagD0){ // for D*+
635  p4_pi2.SetPtEtaPhiM(d0Itr->trackParticle(0)->pt(),
636  d0Itr->trackParticle(0)->eta(),
637  d0Itr->trackParticle(0)->phi(), m_vtx1Daug1MassHypo);
638  p4_ka.SetPtEtaPhiM( d0Itr->trackParticle(1)->pt(),
639  d0Itr->trackParticle(1)->eta(),
640  d0Itr->trackParticle(1)->phi(), m_vtx1Daug2MassHypo);
641  }else{ // change the order in the case of D*-
642  p4_pi2.SetPtEtaPhiM(d0Itr->trackParticle(1)->pt(),
643  d0Itr->trackParticle(1)->eta(),
644  d0Itr->trackParticle(1)->phi(), m_vtx1Daug1MassHypo);
645  p4_ka.SetPtEtaPhiM( d0Itr->trackParticle(0)->pt(),
646  d0Itr->trackParticle(0)->eta(),
647  d0Itr->trackParticle(0)->phi(), m_vtx1Daug2MassHypo);
648  }
649  // Check D*+/- candidate invariant mass and skip if need be
650  double mass_Dst= (p4_pi1 + p4_ka + p4_pi2).M();
651  ATH_MSG_DEBUG("D*+/- mass " << mass_Dst);
652  if (mass_Dst < m_DstMassLower || mass_Dst > m_DstMassUpper) {
653  ATH_MSG_DEBUG(" Original D*+/- candidate rejected by the mass cut: mass = "
654  << mass_Dst << " != (" << m_DstMassLower << ", " << m_DstMassUpper << ")" );
655  continue;
656  }
657 
658  size_t d0TrkNum = d0Itr->nTrackParticles(); //2
659  tracksD0.clear();
660  for( unsigned int it=0; it<d0TrkNum; it++) tracksD0.push_back(d0Itr->trackParticle(it));
661  if (tracksD0.size() != 2 || massesD0.size() != 2 ) {
662  ATH_MSG_INFO("problems with D0 input");
663  }
664 
665  //Leaving for the possible mods in the future
666  //SG::AuxElement::Accessor<xAOD::Vertex_v1::TrackParticleLinks_t> trackAcc( "trackParticleLinks" );
667  //ATH_MSG_INFO("CUSTOM:: "<<*(trackAcc(*d0Itr)).at(0));
668  //ATH_MSG_INFO("CUSTOM2:: "<<tracksD0.at(0)); //-> gives the same result
669 
670  // Apply the user's settings to the fitter
671  // Reset
672  std::unique_ptr<Trk::IVKalState> state (m_iVertexFitter->makeState());
673  // Robustness
674  int robustness = 0;
675  m_iVertexFitter->setRobustness(robustness, *state);
676  // Build up the topology
677  // Vertex list
678  std::vector<Trk::VertexID> vrtList;
679  // D0 vertex
680  Trk::VertexID vID;
681  if (m_constrD0) { //ApplyD0MassConstraint = true
682  if(tagD0) vID = m_iVertexFitter->startVertex(tracksD0,massesD0, *state,mass_d0);
683  else vID = m_iVertexFitter->startVertex(tracksD0,massesD0b, *state,mass_d0);
684  } else {
685  if(tagD0) vID = m_iVertexFitter->startVertex(tracksD0, massesD0,*state);
686  else vID = m_iVertexFitter->startVertex(tracksD0, massesD0b, *state);
687  }
688  vrtList.push_back(vID);
689  // B vertex including mu+pi_soft
690  Trk::VertexID vID2 = m_iVertexFitter->nextVertex(tracksMuPi,massesMuPi,vrtList,*state);
691  if (m_constrMuPi) {
692  std::vector<Trk::VertexID> cnstV;
693  cnstV.clear();
694  if ( !m_iVertexFitter->addMassConstraint(vID2,tracksMuPi,cnstV,*state,m_vtx0MassHypo).isSuccess() ) {
695  ATH_MSG_WARNING("addMassConstraint failed");
696  //return StatusCode::FAILURE;
697  }
698  }
699 
700  // Do the work
701  std::unique_ptr<Trk::VxCascadeInfo> result(m_iVertexFitter->fitCascade(*state));
702 
703  if (result != nullptr) {
704  // reset links to original tracks
705  BPhysPVCascadeTools::PrepareVertexLinks(result.get(), trackContainer);
706  ATH_MSG_DEBUG("storing tracks " << ((result->vertices())[0])->trackParticle(0) << ", "
707  << ((result->vertices())[0])->trackParticle(1) << ", "
708  << ((result->vertices())[1])->trackParticle(0) << ", "
709  << ((result->vertices())[1])->trackParticle(1));
710  // necessary to prevent memory leak
711  result->setSVOwnership(true);
712 
713  // Chi2/DOF cut
714  double bChi2DOF = result->fitChi2()/result->nDoF();
715  ATH_MSG_DEBUG("Candidate chi2/DOF is " << bChi2DOF);
716  bool chi2CutPassed = (m_chi2cut <= 0.0 || bChi2DOF < m_chi2cut);
717 
718  const std::vector< std::vector<TLorentzVector> > &moms = result->getParticleMoms();
719  const std::vector<xAOD::Vertex*> &cascadeVertices = result->vertices();
720 
721  double mass = m_CascadeTools->invariantMass(moms[1]);
722  double DstMassAft = (moms[1][1] + moms[0][0] + moms[0][1]).M(); //pi_soft + D0
723 
724  if(chi2CutPassed) {
725  if (mass >= m_MassLower && mass <= m_MassUpper) {
726  if (m_CascadeTools->pT(moms[1]) > 9500){ //B_pT
727  if (m_CascadeTools->lxy(moms[0],cascadeVertices[0],cascadeVertices[1]) > 0){ //D0_Lxy>0
728  if (DstMassAft < m_DstMassUpperAft){
729 
730  cascadeinfoContainer->push_back(result.release());
731 
732  } //Dst_m < m_DstMassUpperAft
733  } //D0_Lxy>0
734  } //B_pT
735  } else {
736  ATH_MSG_DEBUG("Candidate rejected by the mass cut: mass = "
737  << mass << " != (" << m_MassLower << ", " << m_MassUpper << ")" );
738  } //mass Upper/Lower
739  } //chi2CutPassed
740  } //if (result != nullptr)
741 
742  } //Iterate over D0 vertices
743 
744  } //Iterate over mu+pi_soft vertices
745  ATH_MSG_DEBUG("cascadeinfoContainer size " << cascadeinfoContainer->size());
746  return StatusCode::SUCCESS;
747  }
748 
749 }
750 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::MuPlusDpstCascade::m_D0MassUpper
double m_D0MassUpper
Definition: MuPlusDpstCascade.h:58
xAOD::BPhysHypoHelper::setMass
bool setMass(const float val)
Set given invariant mass and its error.
Definition: BPhysHypoHelper.cxx:49
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
DerivationFramework::MuPlusDpstCascade::m_vtx0Daug1MassHypo
double m_vtx0Daug1MassHypo
Definition: MuPlusDpstCascade.h:66
xAOD::Vertex_v1::x
float x() const
Returns the x position.
V0Tools.h
DerivationFramework::MuPlusDpstCascade::m_vtx1Daug2MassHypo
double m_vtx1Daug2MassHypo
Definition: MuPlusDpstCascade.h:69
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::VertexAuxContainer_v1
Temporary container used until we have I/O for AuxStoreInternal.
Definition: VertexAuxContainer_v1.h:32
DerivationFramework::MuPlusDpstCascade::m_PV_max
int m_PV_max
Definition: MuPlusDpstCascade.h:90
DerivationFramework::MuPlusDpstCascade::m_refitPV
bool m_refitPV
Definition: MuPlusDpstCascade.h:85
Trk::VxCascadeInfo
Definition: VxCascadeInfo.h:75
DerivationFramework::MuPlusDpstCascade::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition: MuPlusDpstCascade.h:77
Trk::VertexID
int VertexID
Definition: IVertexCascadeFitter.h:23
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
DerivationFramework::MuPlusDpstCascade::m_DstMassUpperAft
double m_DstMassUpperAft
Definition: MuPlusDpstCascade.h:61
DerivationFramework::BPhysPVCascadeTools::LinkVertices
static bool LinkVertices(SG::AuxElement::Decorator< VertexLinkVector > &decor, const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer, const xAOD::Vertex *vert)
Definition: BPhysPVCascadeTools.cxx:460
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::TrackParticle_v1::charge
float charge() const
Returns the charge.
Definition: TrackParticle_v1.cxx:150
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
DerivationFramework::MuPlusDpstCascade::MuPlusDpstCascade
MuPlusDpstCascade(const std::string &t, const std::string &n, const IInterface *p)
Definition: MuPlusDpstCascade.cxx:424
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
DerivationFramework::BPhysPVCascadeTools::getParticleMass
static double getParticleMass(const HepPDT::ParticleDataTable *pdt, int pdg)
Definition: BPhysPVCascadeTools.cxx:491
DerivationFramework::MuPlusDpstCascade::m_VxPrimaryCandidateName
std::string m_VxPrimaryCandidateName
Name of primary vertex container.
Definition: MuPlusDpstCascade.h:53
DerivationFramework::MuPlusDpstCascade::m_trackSelectionTools
std::unique_ptr< InDet::InDetTrackSelectionTool > m_trackSelectionTools
Definition: MuPlusDpstCascade.h:82
skel.it
it
Definition: skel.GENtoEVGEN.py:396
test_pyathena.pt
pt
Definition: test_pyathena.py:11
MuPlusDpstCascade.h
DerivationFramework::MuPlusDpstCascade::m_constrD0
bool m_constrD0
Definition: MuPlusDpstCascade.h:73
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
DerivationFramework::MuPlusDpstCascade::m_MassUpper
double m_MassUpper
Definition: MuPlusDpstCascade.h:63
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
DerivationFramework::MuPlusDpstCascade::m_iVertexFitter
ToolHandle< Trk::TrkVKalVrtFitter > m_iVertexFitter
Definition: MuPlusDpstCascade.h:78
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
xAOD::VertexContainer
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Definition: VertexContainer.h:14
x
#define x
DerivationFramework::MuPlusDpstCascade::m_refPVContainerName
std::string m_refPVContainerName
Definition: MuPlusDpstCascade.h:86
TrkVKalVrtFitter.h
DerivationFramework::MuPlusDpstCascade::m_vtx1Daug1MassHypo
double m_vtx1Daug1MassHypo
Definition: MuPlusDpstCascade.h:68
DerivationFramework::MuPlusDpstCascade::m_vtx1MassHypo
double m_vtx1MassHypo
Definition: MuPlusDpstCascade.h:65
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
DerivationFramework::MuPlusDpstCascade::performSearch
StatusCode performSearch(std::vector< Trk::VxCascadeInfo * > *cascadeinfoContainer) const
Definition: MuPlusDpstCascade.cxx:491
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
DerivationFramework::MuPlusDpstCascade::m_partPropSvc
ServiceHandle< IPartPropSvc > m_partPropSvc
Definition: MuPlusDpstCascade.h:83
xAOD::BPhysHypoHelper
Definition: BPhysHypoHelper.h:73
DerivationFramework::BPhysPVCascadeTools::SetVectorInfo
static void SetVectorInfo(xAOD::BPhysHelper &, const Trk::VxCascadeInfo *)
Definition: BPhysPVCascadeTools.cxx:424
BPHYS_CHECK
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
Definition: BPhysHelper.h:738
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::MuPlusDpstCascade::m_CascadeTools
ToolHandle< DerivationFramework::CascadeTools > m_CascadeTools
Definition: MuPlusDpstCascade.h:81
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
xAOD::VertexAuxContainer
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
Definition: VertexAuxContainer.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BPhysHypoHelper.h
: B-physcis xAOD helpers.
DerivationFramework::MuPlusDpstCascade::m_chi2cut
double m_chi2cut
Definition: MuPlusDpstCascade.h:75
DerivationFramework::BPhysPVCascadeTools::PrepareVertexLinks
static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer *importedTrackCollection)
Definition: BPhysPVCascadeTools.cxx:204
DerivationFramework::MuPlusDpstCascade::m_pvRefitter
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition: MuPlusDpstCascade.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::Vertex_v1::trackParticle
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Definition: Vertex_v1.cxx:249
DerivationFramework::TrackBag
std::vector< const xAOD::TrackParticle * > TrackBag
Definition: BPhysAddMuonBasedInvMass.h:32
xAOD::Vertex_v1::z
float z() const
Returns the z position.
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DerivationFramework::VertexLink
ElementLink< xAOD::VertexContainer > VertexLink
Definition: Cascade3Plus1.cxx:23
DerivationFramework::MuPlusDpstCascade::m_Dx_pid
int m_Dx_pid
Definition: MuPlusDpstCascade.h:72
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Vertex.h
BPhysPVCascadeTools.h
DerivationFramework::MuPlusDpstCascade::m_vertexD0ContainerKey
std::string m_vertexD0ContainerKey
Definition: MuPlusDpstCascade.h:50
DerivationFramework::MuPlusDpstCascade::m_PV_minNTracks
size_t m_PV_minNTracks
Definition: MuPlusDpstCascade.h:92
DerivationFramework::MuPlusDpstCascade::m_MuPiMassLower
double m_MuPiMassLower
Definition: MuPlusDpstCascade.h:55
DerivationFramework::MuPlusDpstCascade::m_vtx0MassHypo
double m_vtx0MassHypo
Definition: MuPlusDpstCascade.h:64
DerivationFramework::BPhysPVCascadeTools
Definition: BPhysPVCascadeTools.h:34
DerivationFramework::MuPlusDpstCascade::m_vertexContainerKey
std::string m_vertexContainerKey
Definition: MuPlusDpstCascade.h:49
CascadeTools.h
IVertexFitter.h
DerivationFramework::MuPlusDpstCascade::m_DstMassUpper
double m_DstMassUpper
Definition: MuPlusDpstCascade.h:60
VxCascadeInfo.h
DerivationFramework::MuPlusDpstCascade::m_vtx0Daug2MassHypo
double m_vtx0Daug2MassHypo
Definition: MuPlusDpstCascade.h:67
DerivationFramework::MuPlusDpstCascade::~MuPlusDpstCascade
~MuPlusDpstCascade()
Definition: MuPlusDpstCascade.cxx:489
mc.mass_b
mass_b
Definition: mc.PhPy8EG_A14NNPDF23_gg4l_example.py:21
DerivationFramework::VertexLinkVector
std::vector< VertexLink > VertexLinkVector
Definition: Cascade3Plus1.cxx:24
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::MuPlusDpstCascade::m_DstMassLower
double m_DstMassLower
Definition: MuPlusDpstCascade.h:59
DerivationFramework::MuPlusDpstCascade::m_V0Tools
ToolHandle< Trk::V0Tools > m_V0Tools
Definition: MuPlusDpstCascade.h:80
DerivationFramework::MuPlusDpstCascade::m_MuPiMassUpper
double m_MuPiMassUpper
Definition: MuPlusDpstCascade.h:56
xAOD::Vertex_v1::y
float y() const
Returns the y position.
DerivationFramework::MuPlusDpstCascade::m_MassLower
double m_MassLower
Definition: MuPlusDpstCascade.h:62
DerivationFramework::MuPlusDpstCascade::addBranches
virtual StatusCode addBranches() const override
Pass the thinning service
Definition: MuPlusDpstCascade.cxx:62
DerivationFramework::MuPlusDpstCascade::m_DoVertexType
int m_DoVertexType
Definition: MuPlusDpstCascade.h:91
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::MuPlusDpstCascade::initialize
virtual StatusCode initialize() override
Definition: MuPlusDpstCascade.cxx:28
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DerivationFramework::MuPlusDpstCascade::m_cascadeOutputsKeys
std::vector< std::string > m_cascadeOutputsKeys
Definition: MuPlusDpstCascade.h:51
DerivationFramework::MuPlusDpstCascade::m_hypoName
std::string m_hypoName
name of the mass hypothesis.
Definition: MuPlusDpstCascade.h:87
HepMCHelpers.h
xAOD::BPhysHypoHelper::setMassErr
bool setMassErr(const float val)
invariant mass error
Definition: BPhysHypoHelper.cxx:54
VertexAuxContainer.h
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
DerivationFramework::MuPlusDpstCascade::m_D0MassLower
double m_D0MassLower
Definition: MuPlusDpstCascade.h:57
DerivationFramework::MuPlusDpstCascade::m_constrMuPi
bool m_constrMuPi
Definition: MuPlusDpstCascade.h:74