ATLAS Offline Software
BPhysHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "xAODTracking/Vertex.h"
13 
14 /*****************************************************************************/
20 using VertexLinkVector = std::vector<VertexLink>;
22 using MuonLinkVector = std::vector<MuonLink>;
24 using ElectronLinkVector = std::vector<ElectronLink>;
25 
28 /*****************************************************************************/
29 
34 const unsigned int xAOD::BPhysHelper::n_pv_types = 4;
35 const std::string xAOD::BPhysHelper::pv_type_str[] =
36  {"PV_MAX_SUM_PT2", "PV_MIN_A0", "PV_MIN_Z0", "PV_MIN_Z0_BA"};
37 
38 /*****************************************************************************/
39 
44 /*****************************************************************************/
45 #define GET_PV( name ) \
46 { \
47  static const SG::AuxElement::Accessor<VertexLink> pvLinkAcc(name); \
48  if(!pvLinkAcc.isAvailable(*m_b)) { \
49  return 0; \
50  } \
51  const VertexLink& pvLink = pvLinkAcc(*m_b); \
52  if(!pvLink.isValid()) { \
53  return 0; \
54  } \
55  return *pvLink; \
56 }
57 /*****************************************************************************/
58 #define SET_PV( name, pv, vertexContainer ) \
59 { \
60  static const SG::AuxElement::Decorator<VertexLink> pvLinkDecor(name); \
61  VertexLink vertexLink; \
62  if(pv) { \
63  vertexLink.setElement(pv); \
64  vertexLink.setStorableObject(*vertexContainer); \
65  if( !vertexLink.isValid() ) \
66  return false;} \
67  pvLinkDecor(*m_b) = vertexLink; \
68  return true; \
69 }
70 /*****************************************************************************/
71 #define GET_FLOAT(name) \
72 { \
73  static const SG::AuxElement::Accessor<float> floatAcc(name); \
74  if(!floatAcc.isAvailable(*m_b)) return -9999999.; \
75  return floatAcc(*m_b); \
76 }
77 /*****************************************************************************/
78 #define SET_FLOAT( name, val) \
79 { \
80  static const SG::AuxElement::Decorator<float> floatDec(name); \
81  floatDec(*m_b) = val; \
82  return true; \
83 }
84 /*****************************************************************************/
85 #define GET_INT(name) \
86 { \
87  static const SG::AuxElement::Accessor<int> intAcc(name); \
88  if(!intAcc.isAvailable(*m_b)) return -9999999; \
89  return intAcc(*m_b); \
90 }
91 /*****************************************************************************/
92 #define SET_INT( name, val) \
93 { \
94  static const SG::AuxElement::Decorator<int> intDec(name); \
95  intDec(*m_b) = val; \
96  return true; \
97 }
98 /*****************************************************************************/
99 
102 /*****************************************************************************/
103 const TMatrixTSym<double>& xAOD::BPhysHelper::covariance()
104 {
105 
106  // cache covariance matrix
107  if(!cacheCov())
109 
110  // all OK:
111  return m_cachedCov;
112 }
113 
114 /*****************************************************************************/
116 {
117  // cache refitted tracks
118  if( !cacheRefTracks() ) return -1;
119 
120  // all OK:
121  return m_cachedRefTracks.size();
122 
123 }
124 
125 /*****************************************************************************/
126 TVector3 xAOD::BPhysHelper::refTrk(const size_t index)
127 {
128  // cache refitted tracks
129  if( !cacheRefTracks() ) return
130  TVector3(0,0,0);
131 
132  // range check:
133  if(index>=m_cachedRefTracks.size())
134  return TVector3(0,0,0);
135 
136  // all OK:
137  return m_cachedRefTracks[index];
138 
139 }
140 
141 /*****************************************************************************/
142 const std::vector<TVector3>& xAOD::BPhysHelper::refTrks()
143 {
144  // cache refitted tracks
145  if( !cacheRefTracks() )
147 
148  // return
149  return m_cachedRefTracks;
150 }
151 
152 /*****************************************************************************/
153 TLorentzVector xAOD::BPhysHelper::refTrk(const size_t index, const float mass)
154 {
155  // cache refitted tracks
156  if( !cacheRefTracks() ) return
157  TLorentzVector(0,0,0,0);
158 
159  // range check:
160  if(index>=m_cachedRefTracks.size())
161  return TLorentzVector(0,0,0,0);
162 
163  // all OK, create the 4-momentum
164  TLorentzVector mom;
165  mom.SetVectM(m_cachedRefTracks[index], mass);
166  return mom;
167 
168 }
169 
170 /*****************************************************************************/
172 {
173  // range check:
174  // FIXME: add neutral particles once they are available
175  //if(index>=m_b->nTrackParticles()+m_b->nNeutralParticles())
176  // return 0;
177 
178  // FIXME:supports charged particles only for now
179  if(index>=m_b->nTrackParticles())
180  return nullptr;
181 
182  // charged tracks
183  if(index<m_b->nTrackParticles()) {
184  return m_b->trackParticle(index);
185  } else {
186  // FIXME: add neutral particles once they are available
187  //return m_b->neutralParticle(index - m_b->nNeutralParticles());
188  return nullptr;
189  }
190 
191 }
192 
193 /*****************************************************************************/
194 TVector3 xAOD::BPhysHelper::refTrkOriginP(const size_t index) const
195 {
196  // range check:
197  // FIXME: add neutral particles once they are available
198  //if(index>=m_b->nTrackParticles()+m_b->nNeutralParticles())
199  // return TVector3(0,0,0);
200 
201  // FIXME:supports charged particles only for now
202  if(index>=m_b->nTrackParticles())
203  return TVector3(0,0,0);
204 
205  if(index<m_b->nTrackParticles()) {
206  // charged track
207  const xAOD::TrackParticle* trk = dynamic_cast<const xAOD::TrackParticle*>(refTrkOrigin(index));
208 
209  // null-pointer protection
210  if(!trk) return TVector3(0,0,0);
211 
212  // all OK
213  TVector3 tmp;
214  tmp.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
215  return tmp;
216 
217  }else{
218  // // neutral track
219  // const xAOD::NeutralParticle* trk = dynamic_cast<const xAOD::NeutralParticle*>(refTrkOrigin(index));
220 
221  // // null-pointer protection
222  // if(!trk) return TVector3(0,0,0);
223 
224  // // all OK
225  // TVector3 tmp;
226  // tmp.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
227  // return tmp;
228 
229  // FIXME neutral tracks not implemented yet:
230  return TVector3(0,0,0);
231  }
232 
233 }
234 
235 /*****************************************************************************/
236 TLorentzVector xAOD::BPhysHelper::refTrkOriginP(const size_t index, const float mass) const
237 {
238  // range check:
239  // FIXME: add neutral particles once they are available
240  //if(index>=m_b->nTrackParticles()+m_b->nNeutralParticles())
241  // return TVector3(0,0,0);
242 
243  // FIXME:supports charged particles only for now
244  if(index>=m_b->nTrackParticles())
245  return TLorentzVector(0,0,0,0);
246 
247  // create TLorentzVector
248  TLorentzVector tmp;
249  tmp.SetVectM(refTrkOriginP(index), mass);
250  return tmp;
251 
252 }
253 
254 /*****************************************************************************/
255 float xAOD::BPhysHelper::refTrkCharge(const size_t index) const
256 {
257  // range check:
258  // FIXME: add neutral particles once they are available
259  //if(index>=m_b->nTrackParticles()+m_b->nNeutralParticles())
260  // return 0;
261 
262  // FIXME:supports charged particles only for now
263  if(index>=m_b->nTrackParticles())
264  return -9999.;
265 
266  if(index<m_b->nTrackParticles()) {
267  // charged track
268  const xAOD::TrackParticle* trk = dynamic_cast<const xAOD::TrackParticle*>(refTrkOrigin(index));
269 
270  // null-pointer protection
271  if(!trk)
272  return -9999.;
273 
274  // all OK
275  return trk->charge();
276 
277  }else{
278  // we do not need to do anything here, since we know this track must be neutral
279  return 0.;
280  }
281 
282 
283 }
284 
285 /*****************************************************************************/
286 bool xAOD::BPhysHelper::setRefTrks(std::vector<float> px,
287  std::vector<float> py,
288  std::vector<float> pz)
289 {
290  // sanity check:
291  if(px.size()!=py.size() || px.size()!=pz.size())
292  return false;
293 
294  // erase refitted track cache to preserve consistency
295  m_refTracksCached = false;
296  m_cachedRefTracks.clear();
297 
298  // create decorators
299  static const SG::AuxElement::Decorator< std::vector<float> > refTrackPxDeco("RefTrackPx");
300  static const SG::AuxElement::Decorator< std::vector<float> > refTrackPyDeco("RefTrackPy");
301  static const SG::AuxElement::Decorator< std::vector<float> > refTrackPzDeco("RefTrackPz");
302 
303  // store the elements:
304  refTrackPxDeco(*m_b) = std::move(px);
305  refTrackPyDeco(*m_b) = std::move(py);
306  refTrackPzDeco(*m_b) = std::move(pz);
307 
308  return true;
309 }
310 
311 /*****************************************************************************/
312 bool xAOD::BPhysHelper::setRefTrks(const std::vector<TVector3>& refTrks)
313 {
314  // sanity check
315  if(refTrks.empty())
316  return false;
317 
318  // tmp vectors of px,py,pz components:
319  std::vector<float> px;
320  std::vector<float> py;
321  std::vector<float> pz;
322  px.reserve(refTrks.size());
323  py.reserve(refTrks.size());
324  pz.reserve(refTrks.size());
325  // loop over refitted track momenta and store the components
326  std::vector<TVector3>::const_iterator refTrksItr = refTrks.begin();
327  for(; refTrksItr!=refTrks.end(); ++refTrksItr) {
328  px.push_back( refTrksItr->Px() );
329  py.push_back( refTrksItr->Py() );
330  pz.push_back( refTrksItr->Pz() );
331  }
332 
333  // call overloaded method:
334  return setRefTrks(std::move(px),std::move(py),std::move(pz));
335 
336 }
337 
338 /*****************************************************************************/
339 #ifndef XAOD_ANALYSIS
340 
342 {
343  // refitted momenta
344  std::vector<float> px;
345  std::vector<float> py;
346  std::vector<float> pz;
347  const auto N = vtx()->vxTrackAtVertex().size();
348  px.reserve(N);
349  py.reserve(N);
350  pz.reserve(N);
351  // loop over refitted tracks at vertex
352  for(uint i=0; i<N; ++i) {
353  const Trk::TrackParameters* aPerigee = vtx()->vxTrackAtVertex()[i].perigeeAtVertex();
354  //sanity check
355  if(!aPerigee)
356  return false;
357 
358  // store individual momentum components
359  px.push_back( aPerigee->momentum()[Trk::px] );
360  py.push_back( aPerigee->momentum()[Trk::py] );
361  pz.push_back( aPerigee->momentum()[Trk::pz] );
362  }
363 
364  // store as augmentation:
365  setRefTrks(std::move(px), std::move(py), std::move(pz));
366 
367  // all OK
368  return true;
369 
370 }
371 
372 #endif // not XAOD_ANALYSIS
373 /*****************************************************************************/
375 {
376  // cache refitted tracks
377  if( !cacheRefTracks() && nCascadeVertices()<=0) {
378  // In case of cascade decays, vector with no refitted tracks can still be correct.
379  // Therefore, return error only is this is not the case
380  return TVector3(0,0,0);
381  }
382 
383  // sum the momenta
384  TVector3 sum(0,0,0);
385  int n = nRefTrks();
386  for(int i=0; i<n; ++i) {
387  sum += refTrk(i);
388  }
389 
390  // treat cascade vertices, if they exist
391  if(nCascadeVertices()>0) {
392  for(int i=0; i<nCascadeVertices(); ++i) {
393  // create helper class for the daughter vertex
394  xAOD::BPhysHelper daughterVtx( cascadeVertex(i) );
395  TVector3 daughterP = daughterVtx.totalP();
396 
397  // check that the daughter total momentum was retrieved correctly
398  if(daughterP==TVector3(0,0,0))
399  return TVector3(0,0,0);
400 
401  //OK, sum the momenta
402  sum += daughterP;
403  }
404  }
405 
406  return sum;
407 }
408 
409 /*****************************************************************************/
410 TLorentzVector xAOD::BPhysHelper::totalP(std::span<const double> masses)
411 {
412  // cache refitted tracks
413  if( !cacheRefTracks() )
414  return TLorentzVector(0,0,0,0);
415  int n = nRefTrks();
416  // input check
417  if(int(masses.size()) != n)
418  return TLorentzVector(0,0,0,0);
419 
420  // sum the 4-momenta
421  TLorentzVector sum;
422  for(int i=0; i<n; ++i) {
423  sum += refTrk(i, masses[i]);
424  }
425 
426  return sum;
427 
428 }
429 
430 /*****************************************************************************/
432 {
433  GET_FLOAT("PtErr");
434 }
435 /*****************************************************************************/
437 {
438  SET_FLOAT("PtErr", val);
439 }
440 /*****************************************************************************/
442 {
443  // cache linked muons
444  if(!cacheMuons())
445  return -1;
446 
447  // all OK:
448  return m_cachedMuons.size();
449 }
450 
451 /*****************************************************************************/
453 {
454  // cache linked muons
455  if(!cacheMuons())
456  return nullptr;
457 
458  // range check
459  if(index>=m_cachedMuons.size())
460  return nullptr;
461 
462  // all OK:
463  return m_cachedMuons[index];
464 
465 }
466 
467 /*****************************************************************************/
468 const std::vector<const xAOD::Muon*>& xAOD::BPhysHelper::muons()
469 {
470  // cache linked muons
471  if(!cacheMuons())
473 
474  // all OK:
475  return m_cachedMuons;
476 }
477 
478 /*****************************************************************************/
479 bool xAOD::BPhysHelper::setMuons(const std::vector<const xAOD::Muon*>& muons,
481 {
482  // erase muon cache to preserve cosistency
483  m_muonsCached = false;
484  m_cachedMuons.clear();
485 
486  // Create muon links decorator
487  static const SG::AuxElement::Decorator<MuonLinkVector> muonLinksDecor("MuonLinks");
488 
489  // create tmp vector of muon links
490  MuonLinkVector muonLinks;
491 
492  // loop over input muons
493  std::vector<const xAOD::Muon*>::const_iterator muonsItr = muons.begin();
494  for(; muonsItr!=muons.end(); ++muonsItr) {
495  // sanity check 1: protect against null pointers
496  if( !(*muonsItr) )
497  return false;
498 
499  // create element link
501  muLink.setElement(*muonsItr);
503 
504  // sanity check 2: is the link valid?
505  if( !muLink.isValid() )
506  return false;
507 
508  // link is OK, store it in the tmp vector
509  muonLinks.push_back( muLink );
510 
511  } // end of loop over muons
512 
513  // all OK: store muon links in the aux store
514  muonLinksDecor(*m_b) = std::move(muonLinks);
515 
516  return true;
517 
518 }
519 
520 /*****************************************************************************/
522 {
523  // cache linked electrons
524  if(!cacheElectrons())
525  return -1;
526 
527  // all OK:
528  return m_cachedElectrons.size();
529 }
530 
531 /*****************************************************************************/
533 {
534  // cache linked electrons
535  if(!cacheElectrons())
536  return nullptr;
537 
538  // range check
539  if(index>=m_cachedElectrons.size())
540  return nullptr;
541 
542  // all OK:
543  return m_cachedElectrons[index];
544 
545 }
546 
547 /*****************************************************************************/
548 const std::vector<const xAOD::Electron*>& xAOD::BPhysHelper::electrons()
549 {
550  // cache linked electrons
551  if(!cacheElectrons())
553 
554  // all OK:
555  return m_cachedElectrons;
556 }
557 
558 /*****************************************************************************/
559 bool xAOD::BPhysHelper::setElectrons(const std::vector<const xAOD::Electron*>& electrons,
561 {
562  // erase electron cache to preserve cosistency
563  m_electronsCached = false;
564  m_cachedElectrons.clear();
565 
566  // Create electron links decorator
567  static const SG::AuxElement::Decorator<ElectronLinkVector> electronLinksDecor("ElectronLinks");
568 
569  // create tmp vector of electron links
570  ElectronLinkVector electronLinks;
571 
572  // loop over input electrons
573  std::vector<const xAOD::Electron*>::const_iterator electronsItr = electrons.begin();
574  for(; electronsItr!=electrons.end(); ++electronsItr) {
575  // sanity check 1: protect against null pointers
576  if( !(*electronsItr) )
577  return false;
578 
579  // create element link
581  elLink.setElement(*electronsItr);
583 
584  // sanity check 2: is the link valid?
585  if( !elLink.isValid() )
586  return false;
587 
588  // link is OK, store it in the tmp vector
589  electronLinks.push_back( elLink );
590 
591  } // end of loop over electrons
592 
593  // all OK: store electron links in the aux store
594  electronLinksDecor(*m_b) = std::move(electronLinks);
595 
596  return true;
597 
598 }
599 
600 /*****************************************************************************/
602 {
603  // cache linked preceding vertices
604  if(!cachePrecedingVertices())
605  return -1;
606 
607  // all OK:
608  return m_cachedPrecedingVertices.size();
609 
610 }
611 
612 /*****************************************************************************/
614 {
615  // cache linked precedingVertices
616  if(!cachePrecedingVertices())
617  return nullptr;
618 
619  // range check
620  if(index>=m_cachedPrecedingVertices.size())
621  return nullptr;
622 
623  // all OK:
624  return m_cachedPrecedingVertices[index];
625 
626 }
627 
628 /*****************************************************************************/
629 const std::vector<const xAOD::Vertex*>& xAOD::BPhysHelper::precedingVertices()
630 {
631  // cache linked precedingVertices
632  if(!cachePrecedingVertices())
634 
635  // all OK:
636  return m_cachedPrecedingVertices;
637 
638 }
639 
640 /*****************************************************************************/
641 bool xAOD::BPhysHelper::setPrecedingVertices(const std::vector<const xAOD::Vertex*>& vertices,
642  const xAOD::VertexContainer* vertexContainer)
643 {
644  // erase precedingVertex cache to preserve consistency
645  m_precedingVerticesCached = false;
646  m_cachedPrecedingVertices.clear();
647 
648  // Create preceding vertex links decorator
649  static const SG::AuxElement::Decorator<VertexLinkVector> precedingVertexLinksDecor("PrecedingVertexLinks");
650 
651  // create tmp vector of preceding vertex links
652  VertexLinkVector precedingVertexLinks;
653 
654  // loop over input precedingVertices
655  std::vector<const xAOD::Vertex*>::const_iterator precedingVerticesItr = vertices.begin();
656  for(; precedingVerticesItr!=vertices.end(); ++precedingVerticesItr) {
657  // sanity check 1: protect against null pointers
658  if( !(*precedingVerticesItr) )
659  return false;
660 
661  // create element link
662  VertexLink vertexLink;
663  vertexLink.setElement(*precedingVerticesItr);
664  vertexLink.setStorableObject(*vertexContainer);
665 
666  // sanity check 2: is the link valid?
667  if( !vertexLink.isValid() )
668  return false;
669 
670  // link is OK, store it in the tmp vector
671  precedingVertexLinks.push_back( vertexLink );
672 
673  } // end of loop over preceding vertices
674 
675  // all OK: store preceding vertex links in the aux store
676  precedingVertexLinksDecor(*m_b) = std::move(precedingVertexLinks);
677 
678  return true;
679 
680 }
681 /*****************************************************************************/
683 {
684  // cache linked cascade vertices
685  if(!cacheCascadeVertices())
686  return -1;
687 
688  // all OK:
689  return m_cachedCascadeVertices.size();
690 
691 }
692 
693 /*****************************************************************************/
695 {
696  // cache linked cascadeVertices
697  if(!cacheCascadeVertices())
698  return nullptr;
699 
700  // range check
701  if(index>=m_cachedCascadeVertices.size())
702  return nullptr;
703 
704  // all OK:
705  return m_cachedCascadeVertices[index];
706 
707 }
708 
709 /*****************************************************************************/
710 const std::vector<const xAOD::Vertex*>& xAOD::BPhysHelper::cascadeVertices()
711 {
712  // cache linked cascadeVertices
713  if(!cacheCascadeVertices())
715 
716  // all OK:
717  return m_cachedCascadeVertices;
718 
719 }
720 
721 /*****************************************************************************/
722 bool xAOD::BPhysHelper::setCascadeVertices(const std::vector<const xAOD::Vertex*>& vertices,
723  const xAOD::VertexContainer* vertexContainer)
724 {
725  // erase cascadeVertex cache to preserve consistency
726  m_cascadeVerticesCached = false;
727  m_cachedCascadeVertices.clear();
728 
729  // Create cascade vertex links decorator
730  static const SG::AuxElement::Decorator<VertexLinkVector> cascadeVertexLinksDecor("CascadeVertexLinks");
731 
732  // create tmp vector of cascade vertex links
733  VertexLinkVector cascadeVertexLinks;
734 
735  // loop over input cascadeVertices
736  std::vector<const xAOD::Vertex*>::const_iterator cascadeVerticesItr = vertices.begin();
737  for(; cascadeVerticesItr!=vertices.end(); ++cascadeVerticesItr) {
738  // sanity check 1: protect against null pointers
739  if( !(*cascadeVerticesItr) )
740  return false;
741 
742  // create element link
743  VertexLink vertexLink;
744  vertexLink.setElement(*cascadeVerticesItr);
745  vertexLink.setStorableObject(*vertexContainer);
746 
747  // sanity check 2: is the link valid?
748  if( !vertexLink.isValid() )
749  return false;
750 
751  // link is OK, store it in the tmp vector
752  cascadeVertexLinks.push_back( vertexLink );
753 
754  } // end of loop over cascade vertices
755 
756  // all OK: store cascade vertex links in the aux store
757  cascadeVertexLinksDecor(*m_b) = std::move(cascadeVertexLinks);
758 
759  return true;
760 
761 }
762 
763 /*****************************************************************************/
765 {
766  // get number of refitted tracks in this vertex
767  int n = nRefTrks();
768 
769  // check for errors. If there are cascade vertices stored in this vertex,
770  // it is possible there are no refitted tracks, so report error only in case
771  // when this veretx has no cascade vertices and no refitted tracks:
772  if(n<0 && nCascadeVertices()<=0) {
773  return -1;
774  } else if(n<0 && nCascadeVertices()>0) {
775  n = 0;
776  }
777 
778  // loop over cascade vertices, if they exist:
779  for(int i=0; i<nCascadeVertices(); ++i) {
780  // create helper class for the daughter vertex
781  xAOD::BPhysHelper daughterVtx(cascadeVertex(i));
782 
783  // check for errors
784  if(daughterVtx.nRefTrksCascade()<0)
785  return -1;
786 
787  // OK, add the numbers
788  n += daughterVtx.nRefTrksCascade();
789  }
790 
791 
792  // all OK, return the number of tracks
793  return n;
794 }
795 /*****************************************************************************/
797 {
798  switch(vertexType) {
799  case PV_MAX_SUM_PT2 : GET_PV("PvMaxSumPt2Link");
800  case PV_MIN_A0 : GET_PV("PvMinA0Link");
801  case PV_MIN_Z0 : GET_PV("PvMinZ0Link");
802  case PV_MIN_Z0_BA : GET_PV("PvMinZ0BALink");
803  default: return nullptr;
804  }
805 }
806 /*****************************************************************************/
808 {
809  switch(vertexType) {
810  case PV_MAX_SUM_PT2 : GET_PV("OrigPvMaxSumPt2Link");
811  case PV_MIN_A0 : GET_PV("OrigPvMinA0Link");
812  case PV_MIN_Z0 : GET_PV("OrigPvMinZ0Link");
813  case PV_MIN_Z0_BA : GET_PV("OrigPvMinZ0BALink");
814  default: return nullptr;
815  }
816 }
817 /*****************************************************************************/
819  const xAOD::VertexContainer* vertexContainer,
820  const pv_type vertexType)
821 {
822  switch(vertexType) {
823  case PV_MAX_SUM_PT2 : SET_PV("OrigPvMaxSumPt2Link", pv, vertexContainer);
824  case PV_MIN_A0 : SET_PV("OrigPvMinA0Link" , pv, vertexContainer);
825  case PV_MIN_Z0 : SET_PV("OrigPvMinZ0Link" , pv, vertexContainer);
826  case PV_MIN_Z0_BA : SET_PV("OrigPvMinZ0BALink" , pv, vertexContainer);
827  default: return 0;
828  }
829 }
830 /*****************************************************************************/
832  const xAOD::VertexContainer* vertexContainer,
833  const pv_type vertexType)
834 {
835  switch(vertexType) {
836  case PV_MAX_SUM_PT2 : SET_PV("PvMaxSumPt2Link", pv, vertexContainer);
837  case PV_MIN_A0 : SET_PV("PvMinA0Link" , pv, vertexContainer);
838  case PV_MIN_Z0 : SET_PV("PvMinZ0Link" , pv, vertexContainer);
839  case PV_MIN_Z0_BA : SET_PV("PvMinZ0BALink" , pv, vertexContainer);
840  default: return false;
841  }
842 }
843 /*****************************************************************************/
845 {
846  switch(vertexType) {
847  case PV_MAX_SUM_PT2 : SET_INT("PvMaxSumPt2Status", code);
848  case PV_MIN_A0 : SET_INT("PvMinA0Status" , code);
849  case PV_MIN_Z0 : SET_INT("PvMinZ0Status" , code);
850  case PV_MIN_Z0_BA : SET_INT("PvMinZ0BAStatus" , code);
851  default: return 0;
852  }
853 }
854 /*****************************************************************************/
856 {
857  switch(vertexType) {
858  case PV_MAX_SUM_PT2 : GET_INT("PvMaxSumPt2Status");
859  case PV_MIN_A0 : GET_INT("PvMinA0Status" );
860  case PV_MIN_Z0 : GET_INT("PvMinZ0Status" );
861  case PV_MIN_Z0_BA : GET_INT("PvMinZ0BAStatus" );
862  default: return -999999;
863  }
864 }
865 /*****************************************************************************/
867 {
868  switch(vertexType) {
869  case PV_MAX_SUM_PT2 : GET_FLOAT("LxyMaxSumPt2");
870  case PV_MIN_A0 : GET_FLOAT("LxyMinA0");
871  case PV_MIN_Z0 : GET_FLOAT("LxyMinZ0");
872  case PV_MIN_Z0_BA : GET_FLOAT("LxyMinZ0BA");
873  default: return -9999999.;
874  }
875 }
876 /*****************************************************************************/
878 {
879  switch(vertexType) {
880  case PV_MAX_SUM_PT2 : GET_FLOAT("LxyErrMaxSumPt2");
881  case PV_MIN_A0 : GET_FLOAT("LxyErrMinA0");
882  case PV_MIN_Z0 : GET_FLOAT("LxyErrMinZ0");
883  case PV_MIN_Z0_BA : GET_FLOAT("LxyErrMinZ0BA");
884  default: return -9999999.;
885  }
886 }
887 /*****************************************************************************/
889 {
890  switch(vertexType) {
891  case PV_MAX_SUM_PT2 : SET_FLOAT("LxyMaxSumPt2", val);
892  case PV_MIN_A0 : SET_FLOAT("LxyMinA0" , val);
893  case PV_MIN_Z0 : SET_FLOAT("LxyMinZ0" , val);
894  case PV_MIN_Z0_BA : SET_FLOAT("LxyMinZ0BA" , val);
895  default: return false;
896  }
897 }
898 /*****************************************************************************/
900 {
901  switch(vertexType) {
902  case PV_MAX_SUM_PT2 : SET_FLOAT("LxyErrMaxSumPt2", val);
903  case PV_MIN_A0 : SET_FLOAT("LxyErrMinA0" , val);
904  case PV_MIN_Z0 : SET_FLOAT("LxyErrMinZ0" , val);
905  case PV_MIN_Z0_BA : SET_FLOAT("LxyErrMinZ0BA" , val);
906  default: return false;
907  }
908 }
909 
910 //3dLxyz
911 /*****************************************************************************/
913 {
914  switch(vertexType) {
915  case PV_MAX_SUM_PT2 : GET_FLOAT("LxyzMaxSumPt2");
916  case PV_MIN_A0 : GET_FLOAT("LxyzMinA0");
917  case PV_MIN_Z0 : GET_FLOAT("LxyzMinZ0");
918  case PV_MIN_Z0_BA : GET_FLOAT("LxyzMinZ0BA");
919  default: return -9999999.;
920  }
921 }
922 /*****************************************************************************/
924 {
925  switch(vertexType) {
926  case PV_MAX_SUM_PT2 : GET_FLOAT("LxyzErrMaxSumPt2");
927  case PV_MIN_A0 : GET_FLOAT("LxyzErrMinA0");
928  case PV_MIN_Z0 : GET_FLOAT("LxyzErrMinZ0");
929  case PV_MIN_Z0_BA : GET_FLOAT("LxyzErrMinZ0BA");
930  default: return -9999999.;
931  }
932 }
933 /*****************************************************************************/
935 {
936  switch(vertexType) {
937  case PV_MAX_SUM_PT2 : SET_FLOAT("LxyzMaxSumPt2", val);
938  case PV_MIN_A0 : SET_FLOAT("LxyzMinA0" , val);
939  case PV_MIN_Z0 : SET_FLOAT("LxyzMinZ0" , val);
940  case PV_MIN_Z0_BA : SET_FLOAT("LxyzMinZ0BA" , val);
941  default: return false;
942  }
943 }
944 /*****************************************************************************/
946 {
947  switch(vertexType) {
948  case PV_MAX_SUM_PT2 : SET_FLOAT("LxyzErrMaxSumPt2", val);
949  case PV_MIN_A0 : SET_FLOAT("LxyzErrMinA0" , val);
950  case PV_MIN_Z0 : SET_FLOAT("LxyzErrMinZ0" , val);
951  case PV_MIN_Z0_BA : SET_FLOAT("LxyzErrMinZ0BA" , val);
952  default: return false;
953  }
954 }
955 
956 /*****************************************************************************/
958 {
959  switch(vertexType) {
960  case PV_MAX_SUM_PT2 : GET_FLOAT("A0MaxSumPt2");
961  case PV_MIN_A0 : GET_FLOAT("A0MinA0");
962  case PV_MIN_Z0 : GET_FLOAT("A0MinZ0");
963  case PV_MIN_Z0_BA : GET_FLOAT("A0MinZ0BA");
964  default: return -9999999.;
965  }
966 }
967 /*****************************************************************************/
969 {
970  switch(vertexType) {
971  case PV_MAX_SUM_PT2 : GET_FLOAT("A0ErrMaxSumPt2");
972  case PV_MIN_A0 : GET_FLOAT("A0ErrMinA0");
973  case PV_MIN_Z0 : GET_FLOAT("A0ErrMinZ0");
974  case PV_MIN_Z0_BA : GET_FLOAT("A0ErrMinZ0BA");
975  default: return -9999999.;
976  }
977 }
978 /*****************************************************************************/
980 {
981  switch(vertexType) {
982  case PV_MAX_SUM_PT2 : GET_FLOAT("A0xyMaxSumPt2");
983  case PV_MIN_A0 : GET_FLOAT("A0xyMinA0");
984  case PV_MIN_Z0 : GET_FLOAT("A0xyMinZ0");
985  case PV_MIN_Z0_BA : GET_FLOAT("A0xyMinZ0BA");
986  default: return -9999999.;
987  }
988 }
989 /*****************************************************************************/
991 {
992  switch(vertexType) {
993  case PV_MAX_SUM_PT2 : GET_FLOAT("A0xyErrMaxSumPt2");
994  case PV_MIN_A0 : GET_FLOAT("A0xyErrMinA0");
995  case PV_MIN_Z0 : GET_FLOAT("A0xyErrMinZ0");
996  case PV_MIN_Z0_BA : GET_FLOAT("A0xyErrMinZ0BA");
997  default: return -9999999.;
998  }
999 }
1000 /*****************************************************************************/
1002 {
1003  switch(vertexType) {
1004  case PV_MAX_SUM_PT2 : GET_FLOAT("Z0MaxSumPt2");
1005  case PV_MIN_A0 : GET_FLOAT("Z0MinA0");
1006  case PV_MIN_Z0 : GET_FLOAT("Z0MinZ0");
1007  case PV_MIN_Z0_BA : GET_FLOAT("Z0MinZ0BA");
1008  default: return -9999999.;
1009  }
1010 }
1011 /*****************************************************************************/
1013 {
1014  switch(vertexType) {
1015  case PV_MAX_SUM_PT2 : GET_FLOAT("Z0ErrMaxSumPt2");
1016  case PV_MIN_A0 : GET_FLOAT("Z0ErrMinA0");
1017  case PV_MIN_Z0 : GET_FLOAT("Z0ErrMinZ0");
1018  case PV_MIN_Z0_BA : GET_FLOAT("Z0ErrMinZ0BA");
1019  default: return -9999999.;
1020  }
1021 }
1022 /*****************************************************************************/
1024 {
1025  switch(vertexType) {
1026  case PV_MAX_SUM_PT2 : SET_FLOAT("A0MaxSumPt2", val);
1027  case PV_MIN_A0 : SET_FLOAT("A0MinA0" , val);
1028  case PV_MIN_Z0 : SET_FLOAT("A0MinZ0" , val);
1029  case PV_MIN_Z0_BA : SET_FLOAT("A0MinZ0BA" , val);
1030  default: return false;
1031  }
1032 }
1033 /*****************************************************************************/
1035 {
1036  switch(vertexType) {
1037  case PV_MAX_SUM_PT2 : SET_FLOAT("A0ErrMaxSumPt2", val);
1038  case PV_MIN_A0 : SET_FLOAT("A0ErrMinA0" , val);
1039  case PV_MIN_Z0 : SET_FLOAT("A0ErrMinZ0" , val);
1040  case PV_MIN_Z0_BA : SET_FLOAT("A0ErrMinZ0BA" , val);
1041  default: return false;
1042  }
1043 }
1044 /*****************************************************************************/
1046 {
1047  switch(vertexType) {
1048  case PV_MAX_SUM_PT2 : SET_FLOAT("A0xyMaxSumPt2", val);
1049  case PV_MIN_A0 : SET_FLOAT("A0xyMinA0" , val);
1050  case PV_MIN_Z0 : SET_FLOAT("A0xyMinZ0" , val);
1051  case PV_MIN_Z0_BA : SET_FLOAT("A0xyMinZ0BA" , val);
1052  default: return false;
1053  }
1054 }
1055 /*****************************************************************************/
1057 {
1058  switch(vertexType) {
1059  case PV_MAX_SUM_PT2 : SET_FLOAT("A0xyErrMaxSumPt2", val);
1060  case PV_MIN_A0 : SET_FLOAT("A0xyErrMinA0" , val);
1061  case PV_MIN_Z0 : SET_FLOAT("A0xyErrMinZ0" , val);
1062  case PV_MIN_Z0_BA : SET_FLOAT("A0xyErrMinZ0BA" , val);
1063  default: return false;
1064  }
1065 }
1066 /*****************************************************************************/
1068 {
1069  switch(vertexType) {
1070  case PV_MAX_SUM_PT2 : SET_FLOAT("Z0MaxSumPt2", val);
1071  case PV_MIN_A0 : SET_FLOAT("Z0MinA0" , val);
1072  case PV_MIN_Z0 : SET_FLOAT("Z0MinZ0" , val);
1073  case PV_MIN_Z0_BA : SET_FLOAT("Z0MinZ0BA" , val);
1074  default: return false;
1075  }
1076 }
1077 /*****************************************************************************/
1079 {
1080  switch(vertexType) {
1081  case PV_MAX_SUM_PT2 : SET_FLOAT("Z0ErrMaxSumPt2", val);
1082  case PV_MIN_A0 : SET_FLOAT("Z0ErrMinA0" , val);
1083  case PV_MIN_Z0 : SET_FLOAT("Z0ErrMinZ0" , val);
1084  case PV_MIN_Z0_BA : SET_FLOAT("Z0ErrMinZ0BA" , val);
1085  default: return false;
1086  }
1087 }
1088 /*****************************************************************************/
1090 {
1091  // if cov matrix is already cached, do nothing and return true
1092  if(m_covCached && m_cachedCov.GetNrows()!=0)
1093  return true;
1094 
1095  // if cov matrix is cached but the cache is empty, return false (error)
1096  if(m_covCached && m_cachedCov.GetNrows()==0)
1097  return false;
1098 
1099  // get number of tracks
1100  // if ref tracks are stripped from the vertex, this will not work and
1101  // error will be returned
1102  const int nTrk = nRefTrks();
1103  if(nTrk<0)
1104  return false;
1105 
1106  // Covariance matrix not cached, yet. Retrieve them from
1107  // the vertex and convert:
1108  m_covCached = true;
1109 
1110  // retrieve native covariance matrix
1111  const std::vector<float>& cov = m_b->covariance();
1112 
1113  // convert covariance matrix
1114  if(int(cov.size())==(3*nTrk+3)*(3*nTrk+3+1)/2) {
1115  // this is a VKalVrtFitter covariance matrix
1116  m_cachedCov.ResizeTo(3+3*nTrk, 3+3*nTrk);
1117 
1118  long int ij=0;
1119  for(int i=0; i<(3+3*nTrk); i++) {
1120  for(int j=0; j<=i; j++) {
1121  m_cachedCov(i,j) = cov[ij];
1122  ij++;
1123  }
1124  }
1125 
1126  return true;
1127  }
1128 
1129  // FIXME: so far we can only conver VKalVrt cov matrix
1130 
1131  // error
1132  return false;
1133 
1134 }
1135 
1136 /*****************************************************************************/
1138 {
1139  // if refitted tracks are already cached, do nothing and return true
1140  if(m_refTracksCached && !m_cachedRefTracks.empty())
1141  return true;
1142 
1143  // if refitted tracks are cached but the cache is empty, return false (error)
1144  if(m_refTracksCached && m_cachedRefTracks.empty())
1145  return false;
1146 
1147  // Refitted tracks are not cached, yet. Retrieve them from the aux store:
1148  m_refTracksCached = true;
1149  m_cachedRefTracks.clear();
1150 
1151  // Create auxiliary branches accessors
1152  static const SG::AuxElement::Accessor< std::vector<float> > refTrackPxAcc("RefTrackPx");
1153  static const SG::AuxElement::Accessor< std::vector<float> > refTrackPyAcc("RefTrackPy");
1154  static const SG::AuxElement::Accessor< std::vector<float> > refTrackPzAcc("RefTrackPz");
1155 
1156  // check if branches are available:
1157  if(!refTrackPxAcc.isAvailable(*m_b) ||
1158  !refTrackPyAcc.isAvailable(*m_b) ||
1159  !refTrackPzAcc.isAvailable(*m_b) )
1160  return false;
1161 
1162  // retrieve branches:
1163  const std::vector<float>& refTrackPx = refTrackPxAcc(*m_b);
1164  const std::vector<float>& refTrackPy = refTrackPyAcc(*m_b);
1165  const std::vector<float>& refTrackPz = refTrackPzAcc(*m_b);
1166 
1167  // all must have the same lenght
1168  if(refTrackPx.size()!=refTrackPy.size() || refTrackPx.size()!=refTrackPz.size())
1169  return false;
1170 
1171  // all OK: store refitted tracks in the cache
1172  for(uint i=0; i<refTrackPx.size(); ++i) {
1173  m_cachedRefTracks.emplace_back(refTrackPx[i], refTrackPy[i], refTrackPz[i] );
1174  }
1175 
1176  return true;
1177 
1178 }
1179 
1180 /*****************************************************************************/
1182 {
1183  // if linked muons are already cached do nothing and return true
1184  if(m_muonsCached && !m_cachedMuons.empty())
1185  return true;
1186 
1187  // if linked muons are cached but the cache is empty, return false (error)
1188  if(m_muonsCached && m_cachedMuons.empty())
1189  return false;
1190 
1191  // Linked muons are not cached, yet. Retrieve them from the aux store:
1192  m_muonsCached = true;
1193  m_cachedMuons.clear();
1194 
1195  // Create auxiliary branches accessors
1196  static const SG::AuxElement::Accessor<MuonLinkVector> muonLinksAcc("MuonLinks");
1197 
1198  // check if branch exists
1199  if(!muonLinksAcc.isAvailable(*m_b)) {
1200  return false;
1201  }
1202 
1203  // retrieve the muon links...
1204  const MuonLinkVector& muonLinks = muonLinksAcc(*m_b);
1205 
1206  // ... and check if they are all valid
1207  MuonLinkVector::const_iterator muonLinksItr = muonLinks.begin();
1208  for(; muonLinksItr!=muonLinks.end(); ++muonLinksItr) {
1209  // check if links are valid
1210  if(!(*muonLinksItr).isValid()) {
1211  return false;
1212  }
1213  }
1214 
1215  // all OK, cache the muons
1216  muonLinksItr = muonLinks.begin();
1217  for(; muonLinksItr!=muonLinks.end(); ++muonLinksItr) {
1218  m_cachedMuons.push_back(*(*muonLinksItr));
1219  }
1220 
1221  return true;
1222 
1223 }
1224 
1225 /*****************************************************************************/
1227 {
1228  // if linked electrons are already cached do nothing and return true
1229  if(m_electronsCached && !m_cachedElectrons.empty())
1230  return true;
1231 
1232  // if linked electrons are cached but the cache is empty, return false (error)
1233  if(m_electronsCached && m_cachedElectrons.empty())
1234  return false;
1235 
1236  // Linked electrons are not cached, yet. Retrieve them from the aux store:
1237  m_electronsCached = true;
1238  m_cachedElectrons.clear();
1239 
1240  // Create auxiliary branches accessors
1241  static const SG::AuxElement::Accessor<ElectronLinkVector> electronLinksAcc("ElectronLinks");
1242 
1243  // check if branch exists
1244  if(!electronLinksAcc.isAvailable(*m_b)) {
1245  return false;
1246  }
1247 
1248  // retrieve the electron links...
1249  const ElectronLinkVector& electronLinks = electronLinksAcc(*m_b);
1250 
1251  // ... and check if they are all valid
1252  ElectronLinkVector::const_iterator electronLinksItr = electronLinks.begin();
1253  for(; electronLinksItr!=electronLinks.end(); ++electronLinksItr) {
1254  // check if links are valid
1255  if(!(*electronLinksItr).isValid()) {
1256  return false;
1257  }
1258  }
1259 
1260  // all OK, cache the electrons
1261  electronLinksItr = electronLinks.begin();
1262  for(; electronLinksItr!=electronLinks.end(); ++electronLinksItr) {
1263  m_cachedElectrons.push_back(*(*electronLinksItr));
1264  }
1265 
1266  return true;
1267 
1268 }
1269 
1270 /*****************************************************************************/
1272 {
1273  // if linked preceding vertices are already cached do nothing and return true
1274  if(m_precedingVerticesCached && !m_cachedPrecedingVertices.empty())
1275  return true;
1276 
1277  // if linked preceding vertices are cached but the cache is empty, return false (error)
1278  if(m_precedingVerticesCached && m_cachedPrecedingVertices.empty())
1279  return false;
1280 
1281  // Linked preceding vertices are not cached, yet. Retrieve them from the aux store:
1282  m_precedingVerticesCached = true;
1283  m_cachedPrecedingVertices.clear();
1284 
1285  // Create auxiliary branches accessors
1286  static const SG::AuxElement::Accessor<VertexLinkVector> precedingVertexLinksAcc("PrecedingVertexLinks");
1287 
1288  // check if branch exists
1289  if(!precedingVertexLinksAcc.isAvailable(*m_b)) {
1290  return false;
1291  }
1292 
1293  // retrieve the precedingVertex links...
1294  const VertexLinkVector& precedingVertexLinks = precedingVertexLinksAcc(*m_b);
1295 
1296  // ... and check if they are all valid
1297  VertexLinkVector::const_iterator precedingVertexLinksItr = precedingVertexLinks.begin();
1298  for(; precedingVertexLinksItr!=precedingVertexLinks.end(); ++precedingVertexLinksItr) {
1299  // check if links are valid
1300  if(!(*precedingVertexLinksItr).isValid()) {
1301  return false;
1302  }
1303  }
1304 
1305  // all OK, cache the precedingVertices
1306  precedingVertexLinksItr = precedingVertexLinks.begin();
1307  for(; precedingVertexLinksItr!=precedingVertexLinks.end(); ++precedingVertexLinksItr) {
1308  m_cachedPrecedingVertices.push_back(*(*precedingVertexLinksItr));
1309  }
1310 
1311  return true;
1312 
1313 }
1314 
1315 /*****************************************************************************/
1317 {
1318  // if linked cascade vertices are already cached do nothing and return true
1319  if(m_cascadeVerticesCached && !m_cachedCascadeVertices.empty())
1320  return true;
1321 
1322  // if linked cascade vertices are cached but the cache is empty, return false (error)
1323  if(m_cascadeVerticesCached && m_cachedCascadeVertices.empty())
1324  return false;
1325 
1326  // Linked cascade vertices are not cached, yet. Retrieve them from the aux store:
1327  m_cascadeVerticesCached = true;
1328  m_cachedCascadeVertices.clear();
1329 
1330  // Create auxiliary branches accessors
1331  static const SG::AuxElement::Accessor<VertexLinkVector> cascadeVertexLinksAcc("CascadeVertexLinks");
1332 
1333  // check if branch exists
1334  if(!cascadeVertexLinksAcc.isAvailable(*m_b)) {
1335  return false;
1336  }
1337 
1338  // retrieve the cascadeVertex links...
1339  const VertexLinkVector& cascadeVertexLinks = cascadeVertexLinksAcc(*m_b);
1340 
1341  // ... and check if they are all valid
1342  VertexLinkVector::const_iterator cascadeVertexLinksItr = cascadeVertexLinks.begin();
1343  for(; cascadeVertexLinksItr!=cascadeVertexLinks.end(); ++cascadeVertexLinksItr) {
1344  // check if links are valid
1345  if(!(*cascadeVertexLinksItr).isValid()) {
1346  return false;
1347  }
1348  }
1349 
1350  // all OK, cache the cascadeVertices
1351  cascadeVertexLinksItr = cascadeVertexLinks.begin();
1352  for(; cascadeVertexLinksItr!=cascadeVertexLinks.end(); ++cascadeVertexLinksItr) {
1353  m_cachedCascadeVertices.push_back(*(*cascadeVertexLinksItr));
1354  }
1355 
1356  return true;
1357 
1358 }
1359 /*****************************************************************************/
1360 /*****************************************************************************/
1361 const std::vector<TVector3> xAOD::BPhysHelper::s_emptyVectorOfTVector3(0);
1362 const std::vector<const xAOD::Muon*> xAOD::BPhysHelper::s_emptyVectorOfMuons(0);
1363 const std::vector<const xAOD::Electron*> xAOD::BPhysHelper::s_emptyVectorOfElectrons(0);
1364 const TMatrixTSym<double> xAOD::BPhysHelper::s_emptyMatrix(0);
1365 const std::vector<const xAOD::Vertex*> xAOD::BPhysHelper::s_emptyVectorOfVertices(0);
1366 /*****************************************************************************/
xAOD::BPhysHelper::electrons
const std::vector< const xAOD::Electron * > & electrons()
Definition: BPhysHelper.cxx:548
muonContainer
xAOD::MuonContainer * muonContainer
Definition: TrigGlobEffCorrValidation.cxx:188
xAOD::BPhysHelper::RefitPVStatus
int RefitPVStatus(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the exitCode of the refitter for vertex of type pv_type.
Definition: BPhysHelper.cxx:855
xAOD::BPhysHelper::refTrkCharge
float refTrkCharge(const size_t index) const
Returns charge of the i-th track.
Definition: BPhysHelper.cxx:255
GET_PV
#define GET_PV(name)
Definition: BPhysHelper.cxx:45
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
Trk::py
@ py
Definition: ParamDefs.h:60
xAOD::BPhysHelper::totalP
TVector3 totalP()
: Returns total 3-momentum calculated from the refitted tracks
Definition: BPhysHelper.cxx:374
xAOD::BPhysHelper::setA0xyErr
float setA0xyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter error
Definition: BPhysHelper.cxx:1056
electronContainer
xAOD::ElectronContainer * electronContainer
Definition: TrigGlobEffCorrValidation.cxx:187
xAOD::BPhysHelper::nMuons
int nMuons()
: Methods providing access to the linked muons
Definition: BPhysHelper.cxx:441
xAOD::BPhysHelper
Definition: BPhysHelper.h:71
test_pyathena.px
px
Definition: test_pyathena.py:18
xAOD::BPhysHelper::s_emptyVectorOfTVector3
static const std::vector< TVector3 > s_emptyVectorOfTVector3
Definition: BPhysHelper.h:725
xAOD::BPhysHelper::pv_type_str
static const std::string pv_type_str[]
Definition: BPhysHelper.h:605
xAOD::BPhysHelper::nRefTrks
int nRefTrks()
Returns number of stored refitted track momenta.
Definition: BPhysHelper.cxx:115
xAOD::BPhysHelper::nCascadeVertices
int nCascadeVertices()
: Links to cascade vertices
Definition: BPhysHelper.cxx:682
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
xAOD::BPhysHelper::setRefitPVStatus
bool setRefitPVStatus(int code, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the exitCode of the refitter for vertex of type pv_type.
Definition: BPhysHelper.cxx:844
index
Definition: index.py:1
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
xAOD::BPhysHelper::a0xyErr
float a0xyErr(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
rtansverse impact parameter error
Definition: BPhysHelper.cxx:990
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
SET_INT
#define SET_INT(name, val)
Definition: BPhysHelper.cxx:92
xAOD::BPhysHelper::muon
const xAOD::Muon * muon(const size_t index)
Returns pointer to the i-th linked muon.
Definition: BPhysHelper.cxx:452
xAOD::BPhysHelper::setCascadeVertices
bool setCascadeVertices(const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer)
Sets links to cascade vertices.
Definition: BPhysHelper.cxx:722
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
xAOD::BPhysHelper::ptErr
float ptErr()
Returns pT error.
Definition: BPhysHelper.cxx:431
xAOD::BPhysHelper::setPrecedingVertices
bool setPrecedingVertices(const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer)
Sets links to preceding vertices.
Definition: BPhysHelper.cxx:641
xAOD::BPhysHelper::z0Err
float z0Err(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter error
Definition: BPhysHelper.cxx:1012
xAOD::BPhysHelper::m_cachedCov
TMatrixTSym< double > m_cachedCov
Definition: BPhysHelper.h:682
xAOD::BPhysHelper::lxyErr
float lxyErr(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
Definition: BPhysHelper.cxx:877
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:61
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::py
py
Definition: CompositeParticle_v1.cxx:160
xAOD::BPhysHelper::z0
float z0(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter
Definition: BPhysHelper.cxx:1001
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
VertexLinkVector
std::vector< VertexLink > VertexLinkVector
Definition: BPhysHelper.cxx:20
xAOD::BPhysHelper::lxyzErr
float lxyzErr(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
Definition: BPhysHelper.cxx:923
xAOD::BPhysHelper::s_emptyVectorOfElectrons
static const std::vector< const xAOD::Electron * > s_emptyVectorOfElectrons
Definition: BPhysHelper.h:727
xAOD::BPhysHelper::nRefTrksCascade
int nRefTrksCascade()
Returns number of stored refitted tracks INCLUDING those from the linked cascade vertices.
Definition: BPhysHelper.cxx:764
xAOD::BPhysHelper::setPtErr
bool setPtErr(const float val)
Set pT error.
Definition: BPhysHelper.cxx:436
ElectronLinkVector
std::vector< ElectronLink > ElectronLinkVector
Definition: BPhysHelper.cxx:24
SET_FLOAT
#define SET_FLOAT(name, val)
Definition: BPhysHelper.cxx:78
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
GET_FLOAT
#define GET_FLOAT(name)
Definition: BPhysHelper.cxx:71
histSizes.code
code
Definition: histSizes.py:129
GET_INT
#define GET_INT(name)
Definition: BPhysHelper.cxx:85
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
xAOD::BPhysHelper::pv_type
pv_type
: Enum type of the PV
Definition: BPhysHelper.h:475
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
xAOD::BPhysHelper::setA0xy
float setA0xy(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter
Definition: BPhysHelper.cxx:1045
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::BPhysHelper::lxyz
float lxyz(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
decay distance
Definition: BPhysHelper.cxx:912
xAOD::BPhysHelper::electron
const xAOD::Electron * electron(const size_t index)
Definition: BPhysHelper.cxx:532
xAOD::BPhysHelper::s_emptyVectorOfVertices
static const std::vector< const xAOD::Vertex * > s_emptyVectorOfVertices
Definition: BPhysHelper.h:729
beamspotman.n
n
Definition: beamspotman.py:731
xAOD::BPhysHelper::precedingVertex
const xAOD::Vertex * precedingVertex(const size_t index)
Returns pointer to a preceding vertex.
Definition: BPhysHelper.cxx:613
xAOD::BPhysHelper::setZ0Err
float setZ0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter error
Definition: BPhysHelper.cxx:1078
Trk::px
@ px
Definition: ParamDefs.h:59
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
xAOD::BPhysHelper::setA0Err
float setA0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
3D impact parameter error
Definition: BPhysHelper.cxx:1034
Trk::ParametersBase
Definition: ParametersBase.h:55
xAOD::BPhysHelper::origPv
const xAOD::Vertex * origPv(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
original PV
Definition: BPhysHelper.cxx:807
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
xAOD::BPhysHelper::setElectrons
bool setElectrons(const std::vector< const xAOD::Electron * > &electrons, const xAOD::ElectronContainer *electronContainer)
Definition: BPhysHelper.cxx:559
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Vertex.h
xAOD::BPhysHelper::cacheElectrons
bool cacheElectrons()
Definition: BPhysHelper.cxx:1226
xAOD::BPhysHelper::s_emptyVectorOfMuons
static const std::vector< const xAOD::Muon * > s_emptyVectorOfMuons
Definition: BPhysHelper.h:726
xAOD::BPhysHelper::setRefTrks
bool setRefTrks()
: Sets refitted track momenta
Definition: BPhysHelper.cxx:341
xAOD::BPhysHelper::setLxy
bool setLxy(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the transverse decay distance and its error measured between the refitted primary vertex of type ...
Definition: BPhysHelper.cxx:888
xAOD::BPhysHelper::cachePrecedingVertices
bool cachePrecedingVertices()
: Cache preceding vertices
Definition: BPhysHelper.cxx:1271
xAOD::BPhysHelper::refTrkOrigin
const xAOD::IParticle * refTrkOrigin(const size_t index) const
: Returns the original track (charged or neutral) corresponding to the i-th refitted track
Definition: BPhysHelper.cxx:171
xAOD::BPhysHelper::setMuons
bool setMuons(const std::vector< const xAOD::Muon * > &muons, const xAOD::MuonContainer *muonContainer)
Set links to muons.
Definition: BPhysHelper.cxx:479
xAOD::BPhysHelper::setPv
bool setPv(const xAOD::Vertex *pv, const xAOD::VertexContainer *vertexContainer, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the refitted collision vertex of type pv_type.
Definition: BPhysHelper.cxx:831
xAOD::BPhysHelper::cascadeVertices
const std::vector< const xAOD::Vertex * > & cascadeVertices()
Returns vector of pointers to cascade vertices.
Definition: BPhysHelper.cxx:710
xAOD::BPhysHelper::s_emptyMatrix
static const TMatrixTSym< double > s_emptyMatrix
Definition: BPhysHelper.h:728
xAOD::vertexType
vertexType
Definition: Vertex_v1.cxx:166
xAOD::BPhysHelper::cacheCov
bool cacheCov()
: Cache covariance matrix
Definition: BPhysHelper.cxx:1089
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::BPhysHelper::setLxyErr
bool setLxyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
Definition: BPhysHelper.cxx:899
xAOD::BPhysHelper::cacheRefTracks
bool cacheRefTracks()
: Cache refitted tracks
Definition: BPhysHelper.cxx:1137
xAOD::BPhysHelper::a0Err
float a0Err(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
3D impact parameter error
Definition: BPhysHelper.cxx:968
xAOD::BPhysHelper::cacheMuons
bool cacheMuons()
: Cache linked muons
Definition: BPhysHelper.cxx:1181
BPhysHelper.h
: B-physics xAOD helpers.
TrackParticle.h
xAOD::BPhysHelper::precedingVertices
const std::vector< const xAOD::Vertex * > & precedingVertices()
Returns vector of pointers to preceding vertices.
Definition: BPhysHelper.cxx:629
xAOD::BPhysHelper::setOrigPv
bool setOrigPv(const xAOD::Vertex *pv, const xAOD::VertexContainer *vertexContainer, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the original collision vertex of type pv_type.
Definition: BPhysHelper.cxx:818
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
DeMoScan.index
string index
Definition: DeMoScan.py:364
VertexLink
ElementLink< xAOD::VertexContainer > VertexLink
Definition: BPhysHelper.cxx:19
xAOD::BPhysHelper::lxy
float lxy(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the transverse decay distance and its error measured between the refitted primary vertex of type ...
Definition: BPhysHelper.cxx:866
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::BPhysHelper::refTrk
TVector3 refTrk(const size_t index)
Returns i-th refitted track 3-momentum.
Definition: BPhysHelper.cxx:126
xAOD::BPhysHelper::a0xy
float a0xy(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter
Definition: BPhysHelper.cxx:979
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
MuonLinkVector
std::vector< MuonLink > MuonLinkVector
Definition: BPhysHelper.cxx:22
xAOD::BPhysHelper::nPrecedingVertices
int nPrecedingVertices()
: Links to preceding vertices
Definition: BPhysHelper.cxx:601
python.changerun.pv
pv
Definition: changerun.py:81
xAOD::BPhysHelper::pv
const xAOD::Vertex * pv(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the refitted collision vertex of type pv_type.
Definition: BPhysHelper.cxx:796
xAOD::BPhysHelper::refTrks
const std::vector< TVector3 > & refTrks()
Returns refitted track momenta.
Definition: BPhysHelper.cxx:142
xAOD::BPhysHelper::setLxyzErr
bool setLxyzErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
Definition: BPhysHelper.cxx:945
xAOD::BPhysHelper::nElectrons
int nElectrons()
Definition: BPhysHelper.cxx:521
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::BPhysHelper::setA0
float setA0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the 3D and transverse impact parameters and their error.
Definition: BPhysHelper.cxx:1023
xAOD::BPhysHelper::n_pv_types
static const unsigned int n_pv_types
Definition: BPhysHelper.h:613
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::BPhysHelper::setZ0
float setZ0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter
Definition: BPhysHelper.cxx:1067
xAOD::BPhysHelper::muons
const std::vector< const xAOD::Muon * > & muons()
Returns linked muons.
Definition: BPhysHelper.cxx:468
xAOD::BPhysHelper::a0
float a0(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the 3D, transverse, and longitudinal impact parameters and their error.
Definition: BPhysHelper.cxx:957
xAOD::BPhysHelper::setLxyz
bool setLxyz(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
decay distance
Definition: BPhysHelper.cxx:934
xAOD::BPhysHelper::covariance
const TMatrixTSym< double > & covariance()
: Returns full covariance matrix
Definition: BPhysHelper.cxx:103
SET_PV
#define SET_PV(name, pv, vertexContainer)
Definition: BPhysHelper.cxx:58
xAOD::BPhysHelper::cascadeVertex
const xAOD::Vertex * cascadeVertex(const size_t index)
Returns pointer to a cascade vertex.
Definition: BPhysHelper.cxx:694
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
xAOD::BPhysHelper::cacheCascadeVertices
bool cacheCascadeVertices()
: Cache cascade vertices
Definition: BPhysHelper.cxx:1316
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
SUSY_SimplifiedModel_PreInclude.masses
dictionary masses
Definition: SUSY_SimplifiedModel_PreInclude.py:7
xAOD::BPhysHelper::refTrkOriginP
TVector3 refTrkOriginP(const size_t index) const
Returns perigee 3-momentum of the original track corresponding i-th refitted track.
Definition: BPhysHelper.cxx:194