ATLAS Offline Software
TrkCascadeFitter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Header include
6 #include "VxVertex/Vertex.h"
17 #include "GaudiKernel/EventContext.h"
18 
19 //-------------------------------------------------
20 // Other stuff
21 #include<iostream>
22 
23 namespace Trk {
24 
26 //-----------------------------------------------------------------------------------------
27 // First vertex in cascade
28 //
29 //
30 // Main structure description objects
31 //
32 // cascadeV - structure with cascade vertex description. It contains
33 // vID - VertexID of the vertex
34 // vector<int> trkInVrt - used tracks
35 // vector<VertexID> inPointingV - used vertices (pseudo-tracks from them really) or vertices pointing to the current one.
36 // VertexID outPointingV - vertex to which the current vertex points
37 //
38 // PartialMassConstraint - structure for mass constraint description. It contains
39 // VRT - VertexID of corresponding vertex
40 // trkInVrt - list of real tracks. It's vector<int> of indices to m_partListForCascade
41 // pseudoInVrt - list of VertexID of the participating vertices
42 //
43 // vector<cascadeV> m_cascadeVList - main cascade defining vector with cascade vertices. Filled by cascade interface.
44 // Should not be touched during fit.
45 //
46 // vector< TrackParticleBase* > m_partListForCascade - list of all REAL tracks used in cascade
47 // vector< double > m_partMassForCascade - their masses
48 // vector< PartialMassConstraint > m_partMassCnstForCascade - list of all mass constraints in cascade
49 //
50 //
51 //---------- makeSimpleCascade transforms the full cascade definition m_cascadeVList into simplified structure with merging---------
52 //---------- SimpleCascade may have LESS vertices than Cascade itself due to merging ---------
53 //---------- SimpleCascade is defined by vertexDefinition and cascadeDefinition vectors. ---------
54 //---------- Their sizes are SimpleCascade sise. ---------
55 //
56 // vector< vector <int> > vertexDefinition - list of pointers to REAL tracks (in m_partListForConstraints ) for SimpleCascade
57 // vector< vector <int> > cascadeDefinition - simple vertices pointing to the current one. Contains indices (integer) to itself!
58 //
59 //
60 //----------------------------------------------------------------------------------------
61 
62 VertexID TrkVKalVrtFitter::startVertex(const std::vector<const xAOD::TrackParticle*> & list,
63  std::span<const double> particleMass,
64  IVKalState& istate,
65  const double massConstraint) const
66 {
67  assert(dynamic_cast<State*> (&istate)!=nullptr);
68  State& state = static_cast<State&> (istate);
69  state.m_cascadeState = std::make_unique<CascadeState>();
71 
72  return nextVertex (list, particleMass, istate, massConstraint);
73 }
74 
75 
76 //
77 // Calculate total number of degrees of freedom for cascade WITHOUT pointing to primary vertex
78 //
80 {
81 
82 // get Tracks, Vertices and Pointings in cascade
83 //
84  int nTrack = cstate.m_partListForCascade.size();
85  int nVertex = cstate.m_cascadeVList.size();
86 
87  int nPointing = 0;
88  for( int iv=0; iv<nVertex; iv++) nPointing += cstate.m_cascadeVList[iv].inPointingV.size();
89 
90  int nMassCnst = cstate.m_partMassCnstForCascade.size(); // mass cnsts
91 
92  return 2*nTrack - 3*nVertex + 2*nPointing + nMassCnst;
93 }
94 //
95 // Next vertex in cascade
96 //
97 VertexID TrkVKalVrtFitter::nextVertex(const std::vector<const xAOD::TrackParticle*> & list,
98  std::span<const double> particleMass,
99  IVKalState& istate,
100  const double massConstraint) const
101 {
102  assert(dynamic_cast<State*> (&istate)!=nullptr);
103  State& state = static_cast<State&> (istate);
104  CascadeState& cstate = *state.m_cascadeState;
105 
106 //----
107  int NV = cstate.m_cascadeSize++;
108  VertexID new_vID=10000+NV;
109 //----
110  int NTRK = list.size();
111  int presentNT = cstate.m_partListForCascade.size();
112 //----
113 
114  double totMass=0;
115  for(int it=0; it<NTRK; it++){
116  cstate.m_partListForCascade.push_back(list[it]);
117  cstate.m_partMassForCascade.push_back(particleMass[it]);
118  totMass += particleMass[it];
119  }
120 //---------------------- Fill complete vertex mass constraint
121  if(totMass < massConstraint) {
122  PartialMassConstraint tmpMcnst;
123  tmpMcnst.Mass = massConstraint;
124  tmpMcnst.VRT = new_vID;
125  for(int it=0; it<NTRK; it++)tmpMcnst.trkInVrt.push_back(it+presentNT);
126  cstate.m_partMassCnstForCascade.push_back(std::move(tmpMcnst));
127  }
128 //
129 //
130 //-- New vertex structure-----------------------------------
131  cascadeV newV; newV.vID=new_vID;
132  for(int it=0; it<NTRK; it++){
133  newV.trkInVrt.push_back(it+presentNT);
134  }
135  cstate.m_cascadeVList.push_back(std::move(newV));
136 //--------------------------------------------------------------
137  return new_vID;
138 }
139 
140 
141 //
142 // Next vertex in cascade
143 //
144 VertexID TrkVKalVrtFitter::nextVertex(const std::vector<const xAOD::TrackParticle*> & list,
145  std::span<const double> particleMass,
146  const std::vector<VertexID> &precedingVertices,
147  IVKalState& istate,
148  const double massConstraint) const
149 {
150  assert(dynamic_cast<State*> (&istate)!=nullptr);
151  State& state = static_cast<State&> (istate);
152  CascadeState& cstate = *state.m_cascadeState;
153 
154  VertexID vID=nextVertex( list, particleMass, istate, massConstraint);
155 //
156  int lastC=cstate.m_partMassCnstForCascade.size()-1; // Check if full vertex mass constraint exist
157  if( lastC>=0 ){ if( cstate.m_partMassCnstForCascade[lastC].VRT == vID ){
158  for(int iv=0; iv<(int)precedingVertices.size(); iv++){
159  cstate.m_partMassCnstForCascade[lastC].pseudoInVrt.push_back(precedingVertices[iv]); }
160  }
161  }
162 //
163 //-- New vertex structure-----------------------------------
164  int lastV=cstate.m_cascadeVList.size()-1;
165  for(int iv=0; iv<(int)precedingVertices.size(); iv++){
166  cstate.m_cascadeVList[lastV].inPointingV.push_back(precedingVertices[iv]); // fill preceding vertices list
167  }
168 //--
169  return vID;
170 }
171 
172 
173 //--------------------------------------------------------------------------------
174 // Convert complex (with vertex merging) structure into simple one for fitter
175 // vrtDef[iv][it] - list of real tracks in vertex IV in cascade
176 // cascadeDef[iv][ipv] - list of previous vertices pointing to vertex IV in cascade
177 //
178 // Vectors are filled with the indices (NOT VertexID!!!)
179 //------------------------
180 void TrkVKalVrtFitter::makeSimpleCascade(std::vector< std::vector<int> > & vrtDef,
181  std::vector< std::vector<int> > & cascadeDef,
182  CascadeState& cstate)
183 {
184  int iv,ip,it, nVAdd, iva;
185  vrtDef.clear();
186  cascadeDef.clear();
187  int NVC=cstate.m_cascadeVList.size();
188  vrtDef.resize(NVC);
189  cascadeDef.resize(NVC);
190 //
191 //---- First set up position of each vertex in simple structure with merging(!!!)
192 //
193  int vCounter=0;
194  for(iv=0; iv<NVC; iv++){
195  cascadeV &vrt=cstate.m_cascadeVList[iv];
196  vrt.indexInSimpleCascade=-1; // set to -1 for merged vertices not present in simple list
197  if(vrt.mergedTO) continue; // vertex is merged with another one;
198  vrt.indexInSimpleCascade=vCounter; // vertex position in simple cascade structure
199  vCounter++;
200  }
201 //---- Fill vertices in simple structure
202  vCounter=0;
203  for(iv=0; iv<NVC; iv++){
204  const cascadeV &vrt=cstate.m_cascadeVList[iv];
205  if(vrt.mergedTO) continue; // vertex is merged with another one;
206  for(it=0; it<(int)vrt.trkInVrt.size(); it++) vrtDef[vCounter].push_back(vrt.trkInVrt[it]); //copy real tracks
207  for(ip=0; ip<(int)vrt.inPointingV.size(); ip++) {
208  //int indInFull=vrt.inPointingV[ip]; // pointing vertex in full list WRONG!!!
209  int indInFull=indexInV(vrt.inPointingV[ip], cstate); // pointing vertex in full list
210  int indInSimple=cstate.m_cascadeVList[indInFull].indexInSimpleCascade; // its index in simple structure
211  if(indInSimple<0) continue; // merged out vertex. Will be added as tracks
212  cascadeDef[vCounter].push_back(indInSimple);
213  }
214  nVAdd=vrt.mergedIN.size();
215  if( nVAdd ) { //----------------------------- mergedIN(added) vertices exist
216  for(iva=0; iva<nVAdd; iva++){
217  const cascadeV &vrtM=cstate.m_cascadeVList[vrt.mergedIN[iva]]; // merged/added vertex itself
218  for(it=0; it<(int)vrtM.trkInVrt.size(); it++) vrtDef[vCounter].push_back(vrtM.trkInVrt[it]);
219  for(ip=0; ip<(int)vrtM.inPointingV.size(); ip++) {
220  //int indInFull=vrtM.inPointingV[ip]; // pointing vertex in full list WRONG!!!
221  int indInFull=indexInV(vrtM.inPointingV[ip], cstate); // pointing vertex in full list
222  int indInSimple=cstate.m_cascadeVList[indInFull].indexInSimpleCascade; // its index in simple structure
223  if(indInSimple<0) continue; // merged out vertex. Will be added as tracks
224  cascadeDef[vCounter].push_back(indInSimple);
225  }
226  }
227  }
228 
229  vCounter++;
230  }
231  vrtDef.resize(vCounter);
232  cascadeDef.resize(vCounter);
233 }
234 //--------------------------------------------------------------------------------
235 // Printing of cascade structure
236 //
237 void TrkVKalVrtFitter::printSimpleCascade(std::vector< std::vector<int> > & vrtDef,
238  std::vector< std::vector<int> > & cascadeDef,
239  const CascadeState& cstate)
240 {
241  int kk,kkk;
242  for(kk=0; kk<(int)vrtDef.size(); kk++){
243  std::cout<<" Vertex("<<kk<<"):: trk=";
244  for(kkk=0; kkk<(int)vrtDef[kk].size(); kkk++){
245  std::cout<<vrtDef[kk][kkk]<<", ";} std::cout<<" pseu=";
246  for(kkk=0; kkk<(int)cascadeDef[kk].size(); kkk++){
247  std::cout<<cascadeDef[kk][kkk]<<", ";}
248  } std::cout<<'\n';
249 //---
250  for(kk=0; kk<(int)vrtDef.size(); kk++){
251  std::cout<<" Vertex("<<kk<<"):: trkM=";
252  for(kkk=0; kkk<(int)vrtDef[kk].size(); kkk++){
253  std::cout<<cstate.m_partMassForCascade[vrtDef[kk][kkk]]<<", ";}
254  }std::cout<<'\n';
255 //--
256  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
257  std::cout<<" MCnst vID=";
258  std::cout<<c.VRT<<" m="<<c.Mass<<" trk=";
259  for(int idx : c.trkInVrt) {
260  std::cout<<idx<<", ";
261  }
262  std::cout<<" pseudo=";
263  for (VertexID id : c.pseudoInVrt) {
264  std::cout<<id<<", ";
265  }
266  std::cout<<'\n';
267  }
268 }
269 
270 
271 inline int SymIndex(int it, int i, int j) { return (3*it+3+i)*(3*it+3+i+1)/2 + (3*it+3+j);}
272 #define CLEANCASCADE() state.m_vkalFitControl.renewCascadeEvent(nullptr)
273 
275  const Vertex* primVrt, bool FirstDecayAtPV ) const
276 {
277  assert(dynamic_cast<State*> (&istate)!=nullptr);
278  State& state = static_cast<State&> (istate);
279  CascadeState& cstate = *state.m_cascadeState;
280 
281  int iv,it,jt;
282  std::vector< Vect3DF > cVertices;
283  std::vector< std::vector<double> > covVertices;
284  std::vector< std::vector< VectMOM> > fittedParticles;
285  std::vector< std::vector<double> > fittedCovariance;
286  std::vector<double> fitFullCovariance;
287  std::vector<double> particleChi2;
288 //
289  int ntrk=0;
290  StatusCode sc;
291  std::vector<const TrackParameters*> baseInpTrk;
292  if(m_firstMeasuredPoint){ //First measured point strategy
293  std::vector<const xAOD::TrackParticle*>::const_iterator i_ntrk;
294  //for (i_ntrk = cstate.m_partListForCascade.begin(); i_ntrk < cstate.m_partListForCascade.end(); ++i_ntrk) baseInpTrk.push_back(GetFirstPoint(*i_ntrk));
295  unsigned int indexFMP;
296  for (i_ntrk = cstate.m_partListForCascade.begin(); i_ntrk < cstate.m_partListForCascade.end(); ++i_ntrk) {
297  if ((*i_ntrk)->indexOfParameterAtPosition(indexFMP, xAOD::FirstMeasurement)){
298  ATH_MSG_DEBUG("FirstMeasuredPoint on track is discovered. Use it.");
299  baseInpTrk.push_back(new CurvilinearParameters((*i_ntrk)->curvilinearParameters(indexFMP)));
300  }else{
301  ATH_MSG_DEBUG("No FirstMeasuredPoint on track in CascadeFitter. Stop fit");
302  { CLEANCASCADE(); return nullptr; }
303  }
304  }
305  sc=CvtTrackParameters(baseInpTrk,ntrk,state);
306  if(sc.isFailure()){ntrk=0; sc=CvtTrackParticle(cstate.m_partListForCascade,ntrk,state);}
307  }else{
308  sc=CvtTrackParticle(cstate.m_partListForCascade,ntrk,state);
309  }
310  if(sc.isFailure()){ CLEANCASCADE(); return nullptr; }
311 
312  VKalVrtConfigureFitterCore(ntrk, state);
313 
314  std::vector< std::vector<int> > vertexDefinition; // track indices for vertex;
315  std::vector< std::vector<int> > cascadeDefinition; // cascade structure
316  makeSimpleCascade(vertexDefinition, cascadeDefinition, cstate);
317 
318  double * partMass=new double[ntrk];
319  for(int i=0; i<ntrk; i++) partMass[i] = cstate.m_partMassForCascade[i];
320  int IERR = makeCascade(state.m_vkalFitControl, ntrk, state.m_ich, partMass, &state.m_apar[0][0], &state.m_awgt[0][0],
321  vertexDefinition,
322  cascadeDefinition,
323  m_cascadeCnstPrecision); delete[] partMass; if(IERR){ CLEANCASCADE(); return nullptr;}
324  CascadeEvent & refCascadeEvent=*(state.m_vkalFitControl.getCascadeEvent());
325 //
326 // Then set vertex mass constraints
327 //
328  std::vector<int> indexT,indexV,indexTT,indexVV,tmpInd; // track indices for vertex;
329  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
330  //int index=c.VRT; // vertex position in simple structure
331  int index=getSimpleVIndex(c.VRT, cstate); // vertex position in simple structure
332  IERR = findPositions(c.trkInVrt, vertexDefinition[index], indexT); if(IERR)break;
333  tmpInd.clear();
334  for (int idx : c.pseudoInVrt)
335  tmpInd.push_back( getSimpleVIndex(idx, cstate) );
336  IERR = findPositions( tmpInd, cascadeDefinition[index], indexV); if(IERR)break;
337  //IERR = findPositions(c.pseudoInVrt, cascadeDefinition[index], indexV); if(IERR)break; //VK 31.10.2011 ERROR!!!
338  IERR = setCascadeMassConstraint(refCascadeEvent,index, indexT, indexV, c.Mass);
339  if(IERR)break;
340  }
341  if(IERR){ CLEANCASCADE(); return nullptr;}
342  if(msgLvl(MSG::DEBUG)){
343  msg(MSG::DEBUG)<<"Standard cascade fit" << endmsg;
344  printSimpleCascade(vertexDefinition,cascadeDefinition, cstate);
345  }
346 //
347 // At last fit of cascade
348 // primVrt == 0 - no primary vertex
349 // primVrt is <Vertex*> - exact pointing to primary vertex
350 // primVrt is <RecVertex*> - summary track pass near primary vertex
351 //
352  if(primVrt){
353  double vertex[3] = {primVrt->position().x()-state.m_refFrameX, primVrt->position().y()-state.m_refFrameY,primVrt->position().z()-state.m_refFrameZ};
354  const RecVertex* primVrtRec=dynamic_cast< const RecVertex* > (primVrt);
355  if(primVrtRec){
356  double covari[6] = {primVrtRec->covariancePosition()(0,0),primVrtRec->covariancePosition()(0,1),
357  primVrtRec->covariancePosition()(1,1),primVrtRec->covariancePosition()(0,2),
358  primVrtRec->covariancePosition()(1,2),primVrtRec->covariancePosition()(2,2)};
359  if(FirstDecayAtPV) { IERR = processCascadePV(refCascadeEvent,vertex,covari);}
360  else { IERR = processCascade(refCascadeEvent,vertex,covari);}
361  }else{
362  IERR = processCascade(refCascadeEvent,vertex);
363  }
364  }else{
365  IERR = processCascade(refCascadeEvent);
366  }
367  if(IERR){ CLEANCASCADE(); return nullptr;}
368  getFittedCascade(refCascadeEvent, cVertices, covVertices, fittedParticles, fittedCovariance, particleChi2, fitFullCovariance );
369 
370 // for(int iv=0; iv<(int)cVertices.size(); iv++){ std::cout<<"iv="<<iv<<" masses=";
371 // for(int it=0; it<(int)fittedParticles[iv].size(); it++){
372 // double m=sqrt( fittedParticles[iv][it].E *fittedParticles[iv][it].E
373 // -fittedParticles[iv][it].Pz*fittedParticles[iv][it].Pz
374 // -fittedParticles[iv][it].Py*fittedParticles[iv][it].Py
375 // -fittedParticles[iv][it].Px*fittedParticles[iv][it].Px);
376 // std::cout<<m<<", "; } std::cout<<'\n'; }
377 //-----------------------------------------------------------------------------
378 //
379 // Check cascade correctness
380 //
381  int ip,ivFrom=0,ivTo;
382  double px,py,pz,Sign=10.;
383  for( ivTo=0; ivTo<(int)vertexDefinition.size(); ivTo++){ //Vertex to check
384  if(cascadeDefinition[ivTo].empty()) continue; //no pointing to it
385  for( ip=0; ip<(int)cascadeDefinition[ivTo].size(); ip++){
386  ivFrom=cascadeDefinition[ivTo][ip]; //pointing vertex
387  px=py=pz=0;
388  for(it=0; it<(int)fittedParticles[ivFrom].size(); it++){
389  px += fittedParticles[ivFrom][it].Px;
390  py += fittedParticles[ivFrom][it].Py;
391  pz += fittedParticles[ivFrom][it].Pz;
392  }
393  Sign= (cVertices[ivFrom].X-cVertices[ivTo].X)*px
394  +(cVertices[ivFrom].Y-cVertices[ivTo].Y)*py
395  +(cVertices[ivFrom].Z-cVertices[ivTo].Z)*pz;
396  if(Sign<0) break;
397  }
398  if(Sign<0) break;
399  }
400 //
401 //--------------- Wrong vertices in cascade precedence. Squeeze cascade and refit-----------
402 //
403  int NDOFsqueezed=0;
404  if(Sign<0.){
405  int index,itmp;
406  std::vector< std::vector<int> > new_vertexDefinition; // track indices for vertex;
407  std::vector< std::vector<int> > new_cascadeDefinition; // cascade structure
408  cstate.m_cascadeVList[ivFrom].mergedTO=cstate.m_cascadeVList[ivTo].vID;
409  cstate.m_cascadeVList[ivTo].mergedIN.push_back(ivFrom);
410  makeSimpleCascade(new_vertexDefinition, new_cascadeDefinition, cstate);
411  if(msgLvl(MSG::DEBUG)){
412  msg(MSG::DEBUG)<<"Compressed cascade fit" << endmsg;
413  printSimpleCascade(new_vertexDefinition,new_cascadeDefinition, cstate);
414  }
415 //-----------------------------------------------------------------------------------------
417  partMass=new double[ntrk];
418  for(int i=0; i<ntrk; i++) partMass[i] = cstate.m_partMassForCascade[i];
419  int IERR = makeCascade(state.m_vkalFitControl, ntrk, state.m_ich, partMass, &state.m_apar[0][0], &state.m_awgt[0][0],
420  new_vertexDefinition,
421  new_cascadeDefinition); delete[] partMass; if(IERR){ CLEANCASCADE(); return nullptr;}
422 //------Set up mass constraints
423  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
424  indexT.clear(); indexV.clear();
425  index=getSimpleVIndex( c.VRT, cstate);
426  IERR = findPositions(c.trkInVrt, new_vertexDefinition[index], indexT); if(IERR)break;
427  for (VertexID inV : c.pseudoInVrt) { //cycle over pseudotracks
428  int icv=indexInV(inV, cstate); if(icv<0) break;
429  if(cstate.m_cascadeVList[icv].mergedTO == c.VRT){
430  IERR = findPositions(cstate.m_cascadeVList[icv].trkInVrt, new_vertexDefinition[index], indexTT);
431  if(IERR)break;
432  indexT.insert (indexT.end(), indexTT.begin(), indexTT.end());
433  }else{
434  std::vector<int> tmpI(1); tmpI[0]=inV;
435  IERR = findPositions(tmpI, new_cascadeDefinition[index], indexVV);
436  if(IERR)break;
437  indexV.insert (indexV.end(), indexVV.begin(), indexVV.end());
438  }
439  } if(IERR)break;
440  //std::cout<<"trk2="; for(int I=0; I<(int)indexT.size(); I++)std::cout<<indexT[I]; std::cout<<'\n';
441  //std::cout<<"pse="; for(int I=0; I<(int)indexV.size(); I++)std::cout<<indexV[I]; std::cout<<'\n';
442  IERR = setCascadeMassConstraint(*(state.m_vkalFitControl.getCascadeEvent()), index , indexT, indexV, c.Mass); if(IERR)break;
443  }
444  ATH_MSG_DEBUG("Setting compressed mass constraints ierr="<<IERR);
445  if(IERR){ CLEANCASCADE(); return nullptr;}
446 //
447 //--------------------------- Refit
448 //
449  if(primVrt){
450  double vertex[3] = {primVrt->position().x()-state.m_refFrameX, primVrt->position().y()-state.m_refFrameY,primVrt->position().z()-state.m_refFrameZ};
451  const RecVertex* primVrtRec=dynamic_cast< const RecVertex* > (primVrt);
452  if(primVrtRec){
453  double covari[6] = {primVrtRec->covariancePosition()(0,0),primVrtRec->covariancePosition()(0,1),
454  primVrtRec->covariancePosition()(1,1),primVrtRec->covariancePosition()(0,2),
455  primVrtRec->covariancePosition()(1,2),primVrtRec->covariancePosition()(2,2)};
456  IERR = processCascade(*(state.m_vkalFitControl.getCascadeEvent()),vertex,covari);
457  }else{
459  }
460  }else{
462  }
463  if(IERR){ CLEANCASCADE(); return nullptr;}
464  NDOFsqueezed=getCascadeNDoF(cstate)+3-2; // Remove vertex (+3 ndf) and this vertex pointing (-2 ndf)
465 //
466 //-------------------- Get information according to old cascade structure
467 //
468  std::vector< Vect3DF > t_cVertices;
469  std::vector< std::vector<double> > t_covVertices;
470  std::vector< std::vector< VectMOM> > t_fittedParticles;
471  std::vector< std::vector<double> > t_fittedCovariance;
472  std::vector<double> t_fitFullCovariance;
473  getFittedCascade(*(state.m_vkalFitControl.getCascadeEvent()), t_cVertices, t_covVertices, t_fittedParticles,
474  t_fittedCovariance, particleChi2, t_fitFullCovariance);
475  cVertices.clear(); covVertices.clear();
476 //
477 //------------------------- Real tracks
478 //
479  if(msgLvl(MSG::DEBUG)){
480  msg(MSG::DEBUG)<<"Initial cascade momenta"<<endmsg;
481  for(int kv=0; kv<(int)fittedParticles.size(); kv++){
482  for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)
483  std::cout<<
484  " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";";
485  std::cout<<'\n';
486  }
487  msg(MSG::DEBUG)<<"Squized cascade momenta"<<endmsg;
488  for(int kv=0; kv<(int)t_fittedParticles.size(); kv++){
489  for(int kt=0; kt<(int)t_fittedParticles[kv].size(); kt++)
490  std::cout<<
491  " Px="<<t_fittedParticles[kv][kt].Px<<" Py="<<t_fittedParticles[kv][kt].Py<<";";
492  std::cout<<'\n';
493  }
494  }
495  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
496  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of vertex in simplified structure
497  cVertices.push_back(t_cVertices[index]);
498  covVertices.push_back(t_covVertices[index]);
499  for(it=0; it<(int)cstate.m_cascadeVList[iv].trkInVrt.size(); it++){
500  int numTrk=cstate.m_cascadeVList[iv].trkInVrt[it]; //track itself
501  for(itmp=0; itmp<(int)new_vertexDefinition[index].size(); itmp++) if(numTrk==new_vertexDefinition[index][itmp])break;
502  fittedParticles[iv][it]=t_fittedParticles[index][itmp];
503 //Update only particle covariance. Cross particle covariance remains old.
504  fittedCovariance[iv][SymIndex(it,0,0)]=t_fittedCovariance[index][SymIndex(itmp,0,0)];
505  fittedCovariance[iv][SymIndex(it,1,0)]=t_fittedCovariance[index][SymIndex(itmp,1,0)];
506  fittedCovariance[iv][SymIndex(it,1,1)]=t_fittedCovariance[index][SymIndex(itmp,1,1)];
507  fittedCovariance[iv][SymIndex(it,2,0)]=t_fittedCovariance[index][SymIndex(itmp,2,0)];
508  fittedCovariance[iv][SymIndex(it,2,1)]=t_fittedCovariance[index][SymIndex(itmp,2,1)];
509  fittedCovariance[iv][SymIndex(it,2,2)]=t_fittedCovariance[index][SymIndex(itmp,2,2)];
510  }
511  fittedCovariance[iv][SymIndex(0,0,0)]=t_fittedCovariance[index][SymIndex(0,0,0)]; // Update also vertex
512  fittedCovariance[iv][SymIndex(0,1,0)]=t_fittedCovariance[index][SymIndex(0,1,0)]; // covarinace
513  fittedCovariance[iv][SymIndex(0,1,1)]=t_fittedCovariance[index][SymIndex(0,1,1)];
514  fittedCovariance[iv][SymIndex(0,2,0)]=t_fittedCovariance[index][SymIndex(0,2,0)];
515  fittedCovariance[iv][SymIndex(0,2,1)]=t_fittedCovariance[index][SymIndex(0,2,1)];
516  fittedCovariance[iv][SymIndex(0,2,2)]=t_fittedCovariance[index][SymIndex(0,2,2)];
517  }
518 // Pseudo-tracks. They are filled based on fitted results for nonmerged vertices
519 // or as sum for merged vertices
520  VectMOM tmpMom{};
521  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
522  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of current vertex in simplified structure
523  int NTrkInVrt=cstate.m_cascadeVList[iv].trkInVrt.size();
524  for(ip=0; ip<(int)cstate.m_cascadeVList[iv].inPointingV.size(); ip++){ //inPointing verties
525  int tmpIndexV=indexInV( cstate.m_cascadeVList[iv].inPointingV[ip], cstate); //index of inPointing vertex in full structure
526  if(cstate.m_cascadeVList[tmpIndexV].mergedTO){ //vertex is merged, so take pseudo-track as a sum
527  tmpMom.Px=tmpMom.Py=tmpMom.Pz=tmpMom.E=0.;
528  for(it=0; it<(int)(cstate.m_cascadeVList[tmpIndexV].trkInVrt.size()+
529  cstate.m_cascadeVList[tmpIndexV].inPointingV.size()); it++){
530  tmpMom.Px += fittedParticles[tmpIndexV][it].Px; tmpMom.Py += fittedParticles[tmpIndexV][it].Py;
531  tmpMom.Pz += fittedParticles[tmpIndexV][it].Pz; tmpMom.E += fittedParticles[tmpIndexV][it].E;
532  }
533  fittedParticles[iv][ip+NTrkInVrt]=tmpMom;
534  }else{
535  int indexS=getSimpleVIndex( cstate.m_cascadeVList[iv].inPointingV[ip], cstate ); //index of inPointing vertex in simplified structure
536  for(itmp=0; itmp<(int)new_cascadeDefinition[index].size(); itmp++) if(indexS==new_cascadeDefinition[index][itmp])break;
537  fittedParticles[iv][ip+NTrkInVrt]=t_fittedParticles[index][itmp+new_vertexDefinition[index].size()];
538  }
539  }
540  }
541  if(msgLvl(MSG::DEBUG)){
542  msg(MSG::DEBUG)<<"Refit cascade momenta"<<endmsg;
543  for(int kv=0; kv<(int)fittedParticles.size(); kv++){
544  for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)
545  std::cout<<
546  " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";";
547  std::cout<<'\n';
548  }
549  }
550 // Covariance matrix for nonmerged vertices is updated.
551 // For merged vertices (both IN and TO ) it's taken from old fit
552 
553  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
554  bool isMerged=false;
555  if(cstate.m_cascadeVList[iv].mergedTO)isMerged=true; //vertex is merged
556  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of current vertex in simplified structure
557  for(ip=0; ip<(int)cstate.m_cascadeVList[iv].inPointingV.size(); ip++){ //inPointing verties
558  int tmpIndexV=indexInV( cstate.m_cascadeVList[iv].inPointingV[ip], cstate); //index of inPointing vertex in full structure
559  if(cstate.m_cascadeVList[tmpIndexV].mergedTO)isMerged=true; //vertex is merged
560  }
561  if(!isMerged){
562  fittedCovariance[iv]=t_fittedCovariance[index]; //copy complete covarinace matrix for nonmerged vertices
563  }
564  }
565  }
566 //
567 //-------------------------------------Saving
568 //
569  ATH_MSG_DEBUG("Now save results");
570  Amg::MatrixX VrtCovMtx(3,3);
571  Trk::Perigee * measPerigee;
572  std::vector<xAOD::Vertex*> xaodVrtList(0);
573  double phi, theta, invP, mom, fullChi2=0.;
574 
575  int NDOF=getCascadeNDoF(cstate); if(NDOFsqueezed) NDOF=NDOFsqueezed;
576  if(primVrt){ if(FirstDecayAtPV){ NDOF+=3; }else{ NDOF+=2; } }
577 
578  for(iv=0; iv<(int)cVertices.size(); iv++){
579  Amg::Vector3D FitVertex(cVertices[iv].X+state.m_refFrameX,cVertices[iv].Y+state.m_refFrameY,cVertices[iv].Z+state.m_refFrameZ);
580  VrtCovMtx(0,0) = covVertices[iv][0]; VrtCovMtx(0,1) = covVertices[iv][1];
581  VrtCovMtx(1,1) = covVertices[iv][2]; VrtCovMtx(0,2) = covVertices[iv][3];
582  VrtCovMtx(1,2) = covVertices[iv][4]; VrtCovMtx(2,2) = covVertices[iv][5];
583  VrtCovMtx(1,0) = VrtCovMtx(0,1);
584  VrtCovMtx(2,0) = VrtCovMtx(0,2);
585  VrtCovMtx(2,1) = VrtCovMtx(1,2);
586  double Chi2=0;
587  for(it=0; it<(int)vertexDefinition[iv].size(); it++) { Chi2 += particleChi2[vertexDefinition[iv][it]];};
588  fullChi2+=Chi2;
589 
590 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-= xAOD::Vertex creation
591  xAOD::Vertex * tmpXAODVertex=new xAOD::Vertex();
592  tmpXAODVertex->makePrivateStore();
593  tmpXAODVertex->setPosition(FitVertex);
594  tmpXAODVertex->setFitQuality(Chi2, (float)NDOF);
595  std::vector<VxTrackAtVertex> & tmpVTAV=tmpXAODVertex->vxTrackAtVertex();
596  tmpVTAV.clear();
597 
598  int NRealT=vertexDefinition[iv].size();
599  Amg::MatrixX genCOV( NRealT*3+3, NRealT*3+3 ); // Fill cov. matrix for vertex
600  for( it=0; it<NRealT*3+3; it++){ // (X,Y,Z,px1,py1,....pxn,pyn,pzn)
601  for( jt=0; jt<=it; jt++){ //
602  genCOV(it,jt) = genCOV(jt,it) = fittedCovariance[iv][it*(it+1)/2+jt]; // for real tracks only
603  } } // (first in the list)
604  Amg::MatrixX fullDeriv;
605  if( m_makeExtendedVertex ){
606  //VK fullDeriv=new CLHEP::HepMatrix( NRealT*3+3, NRealT*3+3, 0); // matrix is filled by zeros
607  fullDeriv=Amg::MatrixX::Zero(NRealT*3+3, NRealT*3+3); // matrix is filled by zeros
608  fullDeriv(0,0)=fullDeriv(1,1)=fullDeriv(2,2)=1.;
609  }
610  for( it=0; it<NRealT; it++) {
611  mom= sqrt( fittedParticles[iv][it].Pz*fittedParticles[iv][it].Pz
612  +fittedParticles[iv][it].Py*fittedParticles[iv][it].Py
613  +fittedParticles[iv][it].Px*fittedParticles[iv][it].Px);
614  double Px=fittedParticles[iv][it].Px;
615  double Py=fittedParticles[iv][it].Py;
616  double Pz=fittedParticles[iv][it].Pz;
617  double Pt= sqrt(Px*Px + Py*Py) ;
618  phi=atan2( Py, Px);
619  theta=acos( Pz/mom );
620  invP = - state.m_ich[vertexDefinition[iv][it]] / mom; // Change charge sign according to ATLAS
621 // d(Phi,Theta,InvP)/d(Px,Py,Pz) - Perigee vs summary momentum
622  Amg::MatrixX tmpDeriv( 5, NRealT*3+3);
623  tmpDeriv.setZero(); // matrix is filled by zeros
624  tmpDeriv(0,1) = -sin(phi); // Space derivatives
625  tmpDeriv(0,2) = cos(phi);
626  tmpDeriv(1,1) = -cos(phi)/tan(theta);
627  tmpDeriv(1,2) = -sin(phi)/tan(theta);
628  tmpDeriv(1,3) = 1.;
629  tmpDeriv(2+0,3*it+3+0) = -Py/Pt/Pt; //dPhi/dPx
630  tmpDeriv(2+0,3*it+3+1) = Px/Pt/Pt; //dPhi/dPy
631  tmpDeriv(2+0,3*it+3+2) = 0; //dPhi/dPz
632  tmpDeriv(2+1,3*it+3+0) = Px*Pz/(Pt*mom*mom); //dTheta/dPx
633  tmpDeriv(2+1,3*it+3+1) = Py*Pz/(Pt*mom*mom); //dTheta/dPy
634  tmpDeriv(2+1,3*it+3+2) = -Pt/(mom*mom); //dTheta/dPz
635  tmpDeriv(2+2,3*it+3+0) = -Px/(mom*mom) * invP; //dInvP/dPx
636  tmpDeriv(2+2,3*it+3+1) = -Py/(mom*mom) * invP; //dInvP/dPy
637  tmpDeriv(2+2,3*it+3+2) = -Pz/(mom*mom) * invP; //dInvP/dPz
638 //---------- Here for Eigen block(startrow,startcol,sizerow,sizecol)
639  if( m_makeExtendedVertex )fullDeriv.block(3*it+3+0,3*it+3+0,3,3) = tmpDeriv.block(2,3*it+3+0,3,3);
640 //----------
641  AmgSymMatrix(5) tmpCovMtx ; // New Eigen based EDM
642  tmpCovMtx = genCOV.similarity(tmpDeriv); // New Eigen based EDM
643  measPerigee = new Perigee( 0.,0., phi, theta, invP, PerigeeSurface(FitVertex), std::move(tmpCovMtx) ); // New Eigen based EDM
644  tmpVTAV.emplace_back( particleChi2[vertexDefinition[iv][it]] , measPerigee ) ;
645  }
646  std::vector<float> floatErrMtx;
647  if( m_makeExtendedVertex ) {
648  Amg::MatrixX tmpCovMtx(NRealT*3+3,NRealT*3+3); // New Eigen based EDM
649  tmpCovMtx=genCOV.similarity(fullDeriv);
650  floatErrMtx.resize((NRealT*3+3)*(NRealT*3+3+1)/2);
651  int ivk=0;
652  for(int i=0;i<NRealT*3+3;i++){
653  for(int j=0;j<=i;j++){
654  floatErrMtx.at(ivk++)=tmpCovMtx(i,j);
655  }
656  }
657  }else{
658  floatErrMtx.resize(6);
659  for(int i=0; i<6; i++) floatErrMtx[i]=covVertices[iv][i];
660  }
661  tmpXAODVertex->setCovariance(floatErrMtx);
662  for(int itvk=0; itvk<NRealT; itvk++) {
664  if(itvk < (int)cstate.m_cascadeVList[iv].trkInVrt.size()){
665  TEL.setElement( cstate.m_partListForCascade[ cstate.m_cascadeVList[iv].trkInVrt[itvk] ] );
666  }else{
667  TEL.setElement( nullptr );
668  }
669  tmpXAODVertex->addTrackAtVertex(TEL,1.);
670  }
671  xaodVrtList.push_back(tmpXAODVertex); //VK Save xAOD::Vertex
672 //
673  }
674 //
675 // Save momenta of all particles including combined at vertex positions
676 //
677  std::vector<TLorentzVector> tmpMoms;
678  std::vector<std::vector<TLorentzVector> > particleMoms;
679  std::vector<Amg::MatrixX> particleCovs;
680  int allFitPrt=0;
681  for(iv=0; iv<(int)cVertices.size(); iv++){
682  tmpMoms.clear();
683  int NTrkF=fittedParticles[iv].size();
684  for(it=0; it< NTrkF; it++) {
685  tmpMoms.emplace_back( fittedParticles[iv][it].Px, fittedParticles[iv][it].Py,
686  fittedParticles[iv][it].Pz, fittedParticles[iv][it].E );
687  }
688  //CLHEP::HepSymMatrix COV( NTrkF*3+3, 0 );
689  Amg::MatrixX COV(NTrkF*3+3,NTrkF*3+3); COV=Amg::MatrixX::Zero(NTrkF*3+3,NTrkF*3+3);
690  for( it=0; it<NTrkF*3+3; it++){
691  for( jt=0; jt<=it; jt++){
692  COV(it,jt) = COV(jt,it) = fittedCovariance[iv][it*(it+1)/2+jt];
693  } }
694  particleMoms.push_back( std::move(tmpMoms) );
695  particleCovs.push_back( std::move(COV) );
696  allFitPrt += NTrkF;
697  }
698 //
699  int NAPAR=(allFitPrt+cVertices.size())*3; //Full size of complete covariance matrix
700  //CLHEP::HepSymMatrix FULL( NAPAR, 0 );
701  Amg::MatrixX FULL(NAPAR,NAPAR); FULL.setZero();
702  if( !NDOFsqueezed ){ //normal cascade
703  for( it=0; it<NAPAR; it++){
704  for( jt=0; jt<=it; jt++){
705  FULL(it,jt) = FULL(jt,it) = fitFullCovariance[it*(it+1)/2+jt];
706  } }
707  }else{ //squeezed cascade
708  //int mcount=1; //Indexing in SUB starts from 1 !!!!
709  int mcount=0; //Indexing in BLOCK starts from 0 !!!!
710  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
711  //FULL.sub(mcount,particleCovs[iv]); mcount += particleCovs[iv].num_col();
712  FULL.block(mcount,mcount,particleCovs[iv].rows(),particleCovs[iv].cols())=particleCovs[iv];
713  mcount += particleCovs[iv].rows();
714  }
715  }
716 //
717 //
718 // VxCascadeInfo * recCascade= new VxCascadeInfo(vxVrtList,particleMoms,particleCovs, NDOF ,fullChi2);
719  VxCascadeInfo * recCascade= new VxCascadeInfo(std::move(xaodVrtList),std::move(particleMoms),std::move(particleCovs), NDOF ,fullChi2);
720  recCascade->setFullCascadeCovariance(FULL);
721  CLEANCASCADE();
722  return recCascade;
723 }
724 
725 #undef CLEANCASCADE
726 
727 
729  const std::vector<const xAOD::TrackParticle*> & tracksInConstraint,
730  const std::vector<VertexID> &pseudotracksInConstraint,
731  IVKalState& istate,
732  double massConstraint ) const
733 {
734  assert(dynamic_cast<State*> (&istate)!=nullptr);
735  State& state = static_cast<State&> (istate);
736  CascadeState& cstate = *state.m_cascadeState;
737 
738  int ivc, it, itc;
739  //int NV=m_cstate.cascadeVList.size(); // cascade size
740 //----
741  if(Vertex < 0) return StatusCode::FAILURE;
742  //if(Vertex >= NV) return StatusCode::FAILURE; //Now this check is WRONG. Use indexInV(..) instead
743 //
744 //---- real tracks
745 //
746  int cnstNTRK=tracksInConstraint.size(); // number of real tracks in constraints
747  int indexV = indexInV(Vertex, cstate); // index of vertex in cascade structure
748  if(indexV<0) return StatusCode::FAILURE;
749  int NTRK = cstate.m_cascadeVList[indexV].trkInVrt.size(); // number of real tracks in chosen vertex
750  int totNTRK = cstate.m_partListForCascade.size(); // total number of real tracks
751  if( cnstNTRK > NTRK ) return StatusCode::FAILURE;
752 //-
753  PartialMassConstraint tmpMcnst;
754  tmpMcnst.Mass = massConstraint;
755  tmpMcnst.VRT = Vertex;
756 //
757  double totMass=0;
758  for(itc=0; itc<cnstNTRK; itc++) {
759  for(it=0; it<totNTRK; it++) if(tracksInConstraint[itc]==cstate.m_partListForCascade[it]) break;
760  if(it==totNTRK) return StatusCode::FAILURE; //track in constraint doesn't correspond to any track in vertex
761  tmpMcnst.trkInVrt.push_back(it);
762  totMass += cstate.m_partMassForCascade[it];
763  }
764  if(totMass > massConstraint)return StatusCode::FAILURE;
765 //
766 //---- pseudo tracks
767 //
768  int cnstNVP = pseudotracksInConstraint.size(); // number of pseudo-tracks in constraints
769  int NVP = cstate.m_cascadeVList[indexV].inPointingV.size(); // number of pseudo-tracks in chosen vertex
770  if( cnstNVP > NVP ) return StatusCode::FAILURE;
771 //-
772  for(ivc=0; ivc<cnstNVP; ivc++) {
773  int tmpV = indexInV(pseudotracksInConstraint[ivc], cstate); // index of vertex in cascade structure
774  if( tmpV< 0) return StatusCode::FAILURE; //pseudotrack in constraint doesn't correspond to any pseudotrack in vertex
775  tmpMcnst.pseudoInVrt.push_back( pseudotracksInConstraint[ivc] );
776  }
777 
778  cstate.m_partMassCnstForCascade.push_back(std::move(tmpMcnst));
779 
780  return StatusCode::SUCCESS;
781 }
782 
783 
784 //----------------------------------------------------------------------------------------
785 // Looks for index of each element of inputList in refList
786 //
787 int TrkVKalVrtFitter::findPositions(const std::vector<int> &inputList,const std::vector<int> &refList, std::vector<int> &index)
788 {
789  int R,I;
790  index.clear();
791  int nI=inputList.size(); if(nI==0) return 0; //all ok
792  int nR=refList.size(); if(nR==0) return 0; //all ok
793  //std::cout<<"inp="; for(I=0; I<nI; I++)std::cout<<inputList[I]; std::cout<<'\n';
794  //std::cout<<"ref="; for(R=0; R<nR; R++)std::cout<<refList[R]; std::cout<<'\n';
795  for(I=0; I<nI; I++){
796  for(R=0; R<nR; R++) if(inputList[I]==refList[R]){index.push_back(R); break;}
797  if(R==nR) return -1; //input element not found in reference list
798  }
799  return 0;
800 }
801 //-----------------------------------------------------------------
802 // Get index of given vertex in simplified cascade structure
803 //
805  const CascadeState& cstate)
806 {
807  int NVRT=cstate.m_cascadeVList.size();
808 
809  int iv=indexInV(vrt, cstate);
810  if(iv<0) return -1; //not found
811 
812  int ivv=0;
813  if(cstate.m_cascadeVList[iv].mergedTO){
814  for(ivv=0; ivv<NVRT; ivv++) if(cstate.m_cascadeVList[iv].mergedTO == cstate.m_cascadeVList[ivv].vID) break;
815  if(iv==NVRT) return -1; //not found
816  iv=ivv;
817  }
818  return cstate.m_cascadeVList[iv].indexInSimpleCascade;
819 }
820 //-----------------------------------------------------------------
821 // Get index of given vertex in full cascade structure
822 //
824  const CascadeState& cstate)
825 { int icv; int NVRT=cstate.m_cascadeVList.size();
826  for(icv=0; icv<NVRT; icv++) if(vrt==cstate.m_cascadeVList[icv].vID)break;
827  if(icv==NVRT)return -1;
828  return icv;
829 }
830 
831 } // End Of Namespace
Trk::TrkVKalVrtFitter::State
Definition: TrkVKalVrtFitter.h:382
Trk::TrkVKalVrtFitter::findPositions
static int findPositions(const std::vector< int > &, const std::vector< int > &, std::vector< int > &)
Definition: TrkCascadeFitter.cxx:787
Trk::TrkVKalVrtFitter::CascadeState::m_cascadeVList
std::vector< cascadeV > m_cascadeVList
Definition: TrkVKalVrtFitter.h:378
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
Trk::py
@ py
Definition: ParamDefs.h:60
xAOD::Vertex_v1::setPosition
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
Trk::TrkVKalVrtFitter::m_cascadeCnstPrecision
SimpleProperty< double > m_cascadeCnstPrecision
Definition: TrkVKalVrtFitter.h:322
CLEANCASCADE
#define CLEANCASCADE()
Definition: TrkCascadeFitter.cxx:272
Trk::TrkVKalVrtFitter::State::m_refFrameZ
double m_refFrameZ
Definition: TrkVKalVrtFitter.h:390
xAOD::Vertex_v1::setFitQuality
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
Definition: Vertex_v1.cxx:150
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::VxCascadeInfo
Definition: VxCascadeInfo.h:75
Trk::VKalVrtControl::getCascadeEvent
const CascadeEvent * getCascadeEvent() const
Definition: TrkVKalVrtCore.h:69
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition: Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Trk::VertexID
int VertexID
Definition: IVertexCascadeFitter.h:23
Trk::TrkVKalVrtFitter::State::m_refFrameX
double m_refFrameX
Definition: TrkVKalVrtFitter.h:388
Trk::processCascadePV
int processCascadePV(CascadeEvent &cascadeEvent_, const double *primVrt, const double *primVrtCov)
Definition: CFitCascade.cxx:503
Trk::makeCascade
int makeCascade(VKalVrtControl &FitCONTROL, long int NTRK, const long int *ich, double *wm, double *inp_Trk5, double *inp_CovTrk5, const std::vector< std::vector< int > > &vertexDefinition, const std::vector< std::vector< int > > &cascadeDefinition, double definedCnstAccuracy)
Definition: CascadeDefinition.cxx:116
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
correlationModel::FULL
@ FULL
Definition: AsgElectronEfficiencyCorrectionTool.cxx:49
Trk::SymIndex
int SymIndex(int it, int i, int j)
Definition: TrkCascadeFitter.cxx:271
Trk::cascadeV::vID
VertexID vID
Definition: TrkVKalVrtFitter.h:50
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
index
Definition: index.py:1
Trk::TrkVKalVrtFitter::CascadeState
Definition: TrkVKalVrtFitter.h:370
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Trk::cascadeV
Definition: TrkVKalVrtFitter.h:49
Trk::CurvilinearParameters
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
Trk::TrkVKalVrtFitter::CascadeState::m_partMassForCascade
std::vector< double > m_partMassForCascade
Definition: TrkVKalVrtFitter.h:375
Trk::TrkVKalVrtFitter::makeSimpleCascade
static void makeSimpleCascade(std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:180
Trk::TrkVKalVrtFitter::nextVertex
VertexID nextVertex(const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, IVKalState &istate, double massConstraint=0.) const override final
Definition: TrkCascadeFitter.cxx:97
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Trk::TrkVKalVrtFitter::CvtTrackParameters
StatusCode CvtTrackParameters(const std::vector< const TrackParameters * > &InpTrk, int &ntrk, State &state) const
Definition: CvtParametersBase.cxx:24
InDetSecVtxTruthMatchUtils::isMerged
bool isMerged(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:52
Trk::getFittedCascade
void getFittedCascade(CascadeEvent &cascadeEvent_, std::vector< Vect3DF > &cVertices, std::vector< std::vector< double > > &covVertices, std::vector< std::vector< VectMOM > > &fittedParticles, std::vector< std::vector< double > > &cascadeCovar, std::vector< double > &particleChi2, std::vector< double > &fullCovar)
Definition: CFitCascade.cxx:685
ParticleJetParams::kt
@ kt
Definition: ParticleJetParamDefs.h:43
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::TrkVKalVrtFitter::getCascadeNDoF
static int getCascadeNDoF(const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:79
Trk::setCascadeMassConstraint
int setCascadeMassConstraint(CascadeEvent &cascadeEvent_, long int IV, double Mass)
Definition: CascadeDefinition.cxx:241
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:61
Trk::TrkVKalVrtFitter::CascadeState::m_cascadeSize
int m_cascadeSize
Definition: TrkVKalVrtFitter.h:372
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
xAOD::Vertex_v1::setCovariance
void setCovariance(const std::vector< float > &value)
Sets the covariance matrix as a simple vector of values.
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
Trk::TrkVKalVrtFitter::indexInV
static int indexInV(const VertexID &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:823
Trk::TrkVKalVrtFitter::fitCascade
VxCascadeInfo * fitCascade(IVKalState &istate, const Vertex *primVertex=0, bool FirstDecayAtPV=false) const override final
Definition: TrkCascadeFitter.cxx:274
Trk::TrkVKalVrtFitter::State::m_cascadeState
std::unique_ptr< CascadeState > m_cascadeState
Definition: TrkVKalVrtFitter.h:440
Trk::TrkVKalVrtFitter::State::m_vkalFitControl
VKalVrtControl m_vkalFitControl
Definition: TrkVKalVrtFitter.h:402
TrkVKalVrtFitter.h
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
TrkVKalVrtCoreBase.h
Trk::processCascade
int processCascade(CascadeEvent &cascadeEvent_)
Definition: CFitCascade.cxx:244
Trk::TrkVKalVrtFitter::startVertex
VertexID startVertex(const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, IVKalState &istate, double massConstraint=0.) const override final
Interface for cascade fit.
Definition: TrkCascadeFitter.cxx:62
CascadeDefinition.h
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.changerun.kk
list kk
Definition: changerun.py:41
Trk::cascadeV::trkInVrt
std::vector< int > trkInVrt
Definition: TrkVKalVrtFitter.h:51
xAOD::Vertex_v1::addTrackAtVertex
void addTrackAtVertex(const ElementLink< TrackParticleContainer > &tr, float weight=1.0)
Add a new track to the vertex.
Definition: Vertex_v1.cxx:314
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::TrkVKalVrtFitter::addMassConstraint
StatusCode addMassConstraint(VertexID Vertex, const std::vector< const xAOD::TrackParticle * > &tracksInConstraint, const std::vector< VertexID > &verticesInConstraint, IVKalState &istate, double massConstraint) const override final
Definition: TrkCascadeFitter.cxx:728
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::TrkVKalVrtFitter::printSimpleCascade
static void printSimpleCascade(std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:237
Trk::theta
@ theta
Definition: ParamDefs.h:66
Trk::PartialMassConstraint::VRT
VertexID VRT
Definition: TrkVKalVrtFitter.h:43
xAOD::FirstMeasurement
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
Definition: TrackingPrimitives.h:213
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
Trk::TrkVKalVrtFitter::m_makeExtendedVertex
SimpleProperty< bool > m_makeExtendedVertex
Definition: TrkVKalVrtFitter.h:341
Trk::TrkVKalVrtFitter::State::m_awgt
double m_awgt[NTrMaxVFit][15]
Definition: TrkVKalVrtFitter.h:397
Trk::px
@ px
Definition: ParamDefs.h:59
VxTrackAtVertex.h
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Trk::VxCascadeInfo::setFullCascadeCovariance
void setFullCascadeCovariance(const Amg::MatrixX &)
Definition: VxCascadeInfo.cxx:28
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
Trk::cascadeV::inPointingV
std::vector< VertexID > inPointingV
Definition: TrkVKalVrtFitter.h:53
beamspotnt.rows
list rows
Definition: bin/beamspotnt.py:1112
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
Trk::TrkVKalVrtFitter::CascadeState::m_partListForCascade
std::vector< const xAOD::TrackParticle * > m_partListForCascade
Definition: TrkVKalVrtFitter.h:373
Trk::VKalVrtControl::renewCascadeEvent
void renewCascadeEvent(CascadeEvent *)
Definition: TrkVKalVrtCoreBase.cxx:307
IVKalState.h
Base class for VKal state object.
Trk::cascadeV::mergedTO
VertexID mergedTO
Definition: TrkVKalVrtFitter.h:54
CFitCascade.h
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrkVKalVrtFitter::getSimpleVIndex
static int getSimpleVIndex(const VertexID &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:804
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
Trk::TrkVKalVrtFitter::State::m_ich
long int m_ich[NTrMaxVFit]
Definition: TrkVKalVrtFitter.h:398
Vertex.h
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
VxCascadeInfo.h
Trk::CascadeEvent
Definition: TrkVKalVrtCoreBase.h:21
Trk::TrkVKalVrtFitter::State::m_refFrameY
double m_refFrameY
Definition: TrkVKalVrtFitter.h:389
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
DeMoScan.index
string index
Definition: DeMoScan.py:364
Trk::PartialMassConstraint
Definition: TrkVKalVrtFitter.h:42
Trk::cascadeV::mergedIN
std::vector< VertexID > mergedIN
Definition: TrkVKalVrtFitter.h:55
Prompt::Def::Pt
@ Pt
Definition: VarHolder.h:76
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::PartialMassConstraint::trkInVrt
std::vector< int > trkInVrt
Definition: TrkVKalVrtFitter.h:44
Trk::IVKalState
Definition: IVKalState.h:21
Trk::TrkVKalVrtFitter::CascadeState::m_partMassCnstForCascade
std::vector< PartialMassConstraint > m_partMassCnstForCascade
Definition: TrkVKalVrtFitter.h:376
DEBUG
#define DEBUG
Definition: page_access.h:11
ExtendedVxCandidate.h
Trk::cascadeV::indexInSimpleCascade
int indexInSimpleCascade
Definition: TrkVKalVrtFitter.h:56
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Trk::TrkVKalVrtFitter::VKalVrtConfigureFitterCore
void VKalVrtConfigureFitterCore(int NTRK, State &state) const
Definition: SetFitOptions.cxx:17
run_AODTCCLinking.inputList
list inputList
Definition: run_AODTCCLinking.py:93
Trk::VectMOM
Definition: TrkVKalUtils.h:21
Trk::phi
@ phi
Definition: ParamDefs.h:75
TrkVKalUtils.h
I
#define I(x, y, z)
Definition: MD5.cxx:116
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition: Vertex_v1.cxx:181
Trk::TrkVKalVrtFitter::CvtTrackParticle
StatusCode CvtTrackParticle(std::span< const xAOD::TrackParticle *const > list, int &ntrk, State &state) const
Definition: CvtTrackParticle.cxx:27
Trk::PartialMassConstraint::Mass
double Mass
Definition: TrkVKalVrtFitter.h:46
Trk::PartialMassConstraint::pseudoInVrt
std::vector< VertexID > pseudoInVrt
Definition: TrkVKalVrtFitter.h:45
python.compressB64.c
def c
Definition: compressB64.py:93
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::TrkVKalVrtFitter::m_firstMeasuredPoint
SimpleProperty< bool > m_firstMeasuredPoint
Definition: TrkVKalVrtFitter.h:339
TrackParticleContainer.h
Trk::TrkVKalVrtFitter::State::m_apar
double m_apar[NTrMaxVFit][5]
Definition: TrkVKalVrtFitter.h:396
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32