ATLAS Offline Software
Loading...
Searching...
No Matches
BPhysPVCascadeTools.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include "TVector3.h"
9#include "BPhysPVTools.h"
11#include <boost/container/static_vector.hpp>
13#include <limits>
14#include <iostream>
15
17 AthMessaging("BPhysPVCascadeTools"),
18 m_cascadeTools(cascadeTools), m_eventInfo(nullptr), m_PV_minNTracks(0),
20{
21}
22
24 const xAOD::EventInfo* eventinfo) :
25 AthMessaging("BPhysPVCascadeTools"),
26 m_cascadeTools(cascadeTools), m_eventInfo(eventinfo), m_PV_minNTracks(0),
28{
29}
30
32 const xAOD::Vertex* PV, const xAOD::VertexContainer* PvContainer,
33 xAOD::BPhysHelper::pv_type pvtype, int refitCode) const {
34
35 BPHYS_CHECK( vtx.setPv ( PV, PvContainer, pvtype ) );
36
37 // cout << "BPhysPVCascadeTools::FillBPhysHelper for pvtype = " << pvtype << endl;
38 // cout << "lxy " << m_cascadeTools->lxy(mom, vtx.vtx(), PV) << " error " << m_cascadeTools->lxyError(mom, cov, vtx.vtx(), PV) << endl;
39
40 // set variables calculated from PV
41 BPHYS_CHECK( vtx.setLxy ( m_cascadeTools->lxy (mom, vtx.vtx(), PV), pvtype ) );
42 BPHYS_CHECK( vtx.setLxyErr ( m_cascadeTools->lxyError (mom, cov, vtx.vtx(), PV), pvtype ) );
43 BPHYS_CHECK( vtx.setA0 ( m_cascadeTools->a0 (mom, vtx.vtx(), PV), pvtype ) );
44 BPHYS_CHECK( vtx.setA0Err ( m_cascadeTools->a0Error (mom, cov, vtx.vtx(), PV), pvtype ) );
45 BPHYS_CHECK( vtx.setA0xy ( m_cascadeTools->a0xy (mom, vtx.vtx(), PV), pvtype ) );
46 BPHYS_CHECK( vtx.setA0xyErr( m_cascadeTools->a0xyError (mom, cov, vtx.vtx(), PV), pvtype ) );
47 BPHYS_CHECK( vtx.setZ0 ( m_cascadeTools->a0z (mom, vtx.vtx(), PV), pvtype ) );
48 BPHYS_CHECK( vtx.setZ0Err ( m_cascadeTools->a0zError (mom, cov, vtx.vtx(), PV), pvtype ) );
49 BPHYS_CHECK( vtx.setRefitPVStatus ( refitCode, pvtype ) );
50
51}
52
54 xAOD::BPhysHelper::pv_type pvtype, double mass) const {
55
56 const xAOD::Vertex* pv = vtx.pv(pvtype);
57 if (pv) {
58 // decorate the vertex.
59 vtx.setTau( m_cascadeTools->tau(mom, vtx.vtx(), pv), pvtype, xAOD::BPhysHypoHelper::TAU_INV_MASS );
60 vtx.setTauErr( m_cascadeTools->tauError(mom, cov, vtx.vtx(), pv), pvtype, xAOD::BPhysHypoHelper::TAU_INV_MASS );
61 // Proper decay time assuming constant mass hypothesis
62 vtx.setTau( m_cascadeTools->tau(mom, vtx.vtx(), pv, mass), pvtype, xAOD::BPhysHypoHelper::TAU_CONST_MASS );
63 vtx.setTauErr( m_cascadeTools->tauError(mom, cov, vtx.vtx(), pv, mass), pvtype, xAOD::BPhysHypoHelper::TAU_CONST_MASS );
64 //enum pv_type {PV_MAX_SUM_PT2, PV_MIN_A0, PV_MIN_Z0, PV_MIN_Z0_BA};
65 } else {
66 const float errConst = -9999999.;
71 }
72
73}
74
75size_t DerivationFramework::BPhysPVCascadeTools::FindLowZIndex(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &Obj,
76 const std::vector<const xAOD::Vertex*> &PVlist,
77 const size_t PV_minNTracks) const {
78 size_t lowZ = 0;
79 if(PVlist.empty()) {
80 lowZ=std::numeric_limits<std::size_t>::max();
81 return lowZ;
82 }
83 size_t size = PVlist.size();
84 double lowA0zcalc = fabs(m_cascadeTools->a0z (mom, Obj.vtx(), PVlist[0]));
85 for(size_t i =1; i<size; i++) {
86 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
87 double a0z = fabs(m_cascadeTools->a0z(mom, Obj.vtx(), PVlist[i]));
88 if(a0z < lowA0zcalc) {
89 lowA0zcalc = a0z;
90 lowZ =i;
91 }
92 }
93 }
94 return lowZ;
95}
96
97size_t DerivationFramework::BPhysPVCascadeTools::FindLowA0Index(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &Obj,
98 const std::vector<const xAOD::Vertex*> &PVlist,
99 const size_t PV_minNTracks) const {
100 size_t lowA0 = 0;
101 if(PVlist.empty()) {
102 lowA0=std::numeric_limits<std::size_t>::max();
103 return lowA0;
104 }
105 size_t size = PVlist.size();
106 double lowA0calc = m_cascadeTools->a0(mom, Obj.vtx(), PVlist[0]);
107 for(size_t i =1; i<size; i++) {
108 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
109 double a0 = m_cascadeTools->a0(mom, Obj.vtx(), PVlist[i]);
110 if(a0 < lowA0calc) {
111 lowA0calc = a0;
112 lowA0 =i;
113 }
114 }
115 }
116 return lowA0;
117}
118
119std::vector<const xAOD::Vertex*> DerivationFramework::BPhysPVCascadeTools::GetGoodPV(const xAOD::VertexContainer* pvContainer) {
120 typedef xAOD::VxType::VertexType VertexType;
121 VertexType Pvtx = xAOD::VxType::PriVtx;
122 VertexType Pileupvtx = xAOD::VxType::PileUp;
123 std::vector<const xAOD::Vertex*> goodPrimaryVertices;
124 goodPrimaryVertices.reserve(pvContainer->size());
125
126 for (auto ptr = pvContainer->begin(); ptr!= pvContainer->end(); ++ptr) {
127 VertexType thistype = (*ptr)->vertexType();
128 if ( thistype == Pileupvtx || thistype == Pvtx ) {
129 goodPrimaryVertices.push_back(*ptr);
130 } else {
131// cout << "vertex type " << thistype << endl;
132 }
133 }
134 return goodPrimaryVertices;
135}
136//-----------------------------------------------------------------------------
137//
139{
140
141 m_PV_minNTracks = PV_minNTracks;
142}
143//-----------------------------------------------------------------------------
144//
146 if(m_eventInfo) return Amg::Vector3D(m_eventInfo->beamPosX(), m_eventInfo->beamPosY(), m_eventInfo->beamPosZ());
147 else {
148 static const Amg::Vector3D defaultBS(-10000.,-10000.,-10000.);
149 return defaultBS;
150 }
151}
152//-----------------------------------------------------------------------------
153//
154size_t DerivationFramework::BPhysPVCascadeTools::FindLowZ0BAIndex(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj,
155 const std::vector<const xAOD::Vertex*> &PVlist,
156 const size_t PV_minNTracks) const {
157
158 size_t ilowZ0BA = std::numeric_limits<std::size_t>::max();
159 double lowZ0BAcalc = std::numeric_limits<double>::max();
160 for (size_t i = 0; i<PVlist.size(); ++i) {
161 if ( PVlist[i]->nTrackParticles() >= PV_minNTracks ) {
162 double z0BA = m_cascadeTools->a0(mom, obj.vtx(), PVlist[i]);
163 if (z0BA < lowZ0BAcalc) {
164 lowZ0BAcalc = z0BA;
165 ilowZ0BA = i;
166 }
167 }
168 }
169 return ilowZ0BA;
170}
171//-----------------------------------------------------------------------------
172//
173double DerivationFramework::BPhysPVCascadeTools::DistInZtoDOCA(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj, const xAOD::Vertex* vertex) const {
174
175 Amg::Vector3D pv = vertex->position();
176 Amg::Vector3D xDOCA = DocaExtrapToBeamSpot(mom, obj);
177 Amg::Vector3D vec = pv - xDOCA;
178 return vec.z();
179}
180//-----------------------------------------------------------------------------
181//
183
184 Amg::Vector3D xDOCA(-99999., -99999., -99999.);
185 TLorentzVector totalMom;
186 unsigned int NTrk = mom.size();
187 for( unsigned int it=0; it<NTrk; it++) totalMom += mom[it];
188 TVector3 totP = totalMom.Vect();
189 Amg::Vector3D pSV(totP.X(), totP.Y(), totP.Z());
190 Amg::Vector3D pT(pSV.x(), pSV.y(), 0.);
191 if ( pT.mag2() > 0 ) {
193 Amg::Vector3D xSV = obj.vtx()->position();
194 Amg::Vector3D xT(xSV.x()-xBS.x(), xSV.y()-xBS.y(), 0.);
195 xDOCA = xSV - pSV*pT.dot(xT)/pT.mag2();
196 } else {
197 std::cout << "BPhysPVCascadeTools::DocaExtrapToBeamSpot: WARNING pT == 0."
198 << std::endl;
199 }
200 return xDOCA;
201}
202
204{
205 auto &collection = result->vertices();
206 for(auto v : collection)
207 {
208 std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
209 for(unsigned int i=0; i< v->trackParticleLinks().size(); i++)
210 {
211 ElementLink<DataVector<xAOD::TrackParticle> > mylink=v->trackParticleLinks()[i]; // makes a copy (non-const)
212 mylink.setStorableObject(*importedTrackCollection, true);
213 newLinkVector.push_back( mylink );
214 }
215 v->clearTracks();
216 v->setTrackParticleLinks( newLinkVector );
217 }
218}
219
220void DerivationFramework::BPhysPVCascadeTools::PrepareVertexLinks(Trk::VxCascadeInfo *result, const std::vector<const xAOD::TrackParticleContainer*>& trackCols )
221{
222 auto &collection = result->vertices();
223 for(auto v : collection) {
224 std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
225 for(auto mylink : v->trackParticleLinks()) {
226 const xAOD::TrackParticle* myptr= *mylink;
227 const xAOD::TrackParticleContainer* foundcontainer = nullptr;
228 for(auto col : trackCols){
229 if(std::find(col->begin(), col->end(), myptr) != col->end()){
230 foundcontainer =col;
231 break;
232 }
233 }
234 if(foundcontainer == nullptr){
235 throw std::runtime_error("Could not find track in original containers");
236 }
237 mylink.setStorableObject(*foundcontainer, true);
238 newLinkVector.push_back( mylink );
239 }
240 v->clearTracks();
241 v->setTrackParticleLinks( newLinkVector );
242 }
243}
244
245std::vector<const xAOD::TrackParticle*> DerivationFramework::BPhysPVCascadeTools::CollectAllChargedTracks(const std::vector<xAOD::Vertex*> &cascadeVertices)
246{
247 std::vector<const xAOD::TrackParticle*> exclTrk;
248 for( size_t jt=0; jt<cascadeVertices.size(); jt++) {
249 for( size_t it=0; it<cascadeVertices[jt]->vxTrackAtVertex().size(); it++) {
250 if(cascadeVertices[jt]->trackParticle(it)->charge() != 0) exclTrk.push_back(cascadeVertices[jt]->trackParticle(it));
251 }
252 }
253 return exclTrk;
254}
255
257 const xAOD::VertexContainer* pvContainer, xAOD::VertexContainer* refPvContainer,
258 const Analysis::PrimaryVertexRefitter *pvRefitter, size_t in_PV_max, int DoVertexType,
259 Trk::VxCascadeInfo* casc, int index,
260 double mass, xAOD::BPhysHypoHelper &vtx)
261{
262 static const Trk::V0Tools* const dummy = nullptr;
263 static const DerivationFramework::BPhysPVTools pvtool(dummy);
264
265 const std::vector<TLorentzVector> &mom = casc->getParticleMoms()[index];
266 const Amg::MatrixX &cov = casc->getCovariance()[index];
267 const std::vector<xAOD::Vertex*> &cascadeVertices = casc->vertices();
268 const bool doPt = (DoVertexType & 1) != 0;
269 const bool doA0 = (DoVertexType & 2) != 0;
270 const bool doZ0 = (DoVertexType & 4) != 0;
271 const bool doZ0BA = (DoVertexType & 8) != 0;
272
273 // Collect the tracks that should be excluded from the PV
274 std::vector<const xAOD::TrackParticle*> exclTrk = CollectAllChargedTracks(cascadeVertices);
275
276
277 const std::vector<const xAOD::Vertex*> GoodPVs = GetGoodPV(pvContainer);
278 // 2) PV dependent variables
279 if (GoodPVs.empty() == false) {
280 if (refitPV) {
281 size_t pVmax =std::min((size_t)in_PV_max, GoodPVs.size());
282 std::vector<const xAOD::Vertex*> refPVvertexes;
283 std::vector<xAOD::Vertex*> refPVvertexes_toDelete;
284 std::vector<int> exitCode;
285 refPVvertexes.reserve(pVmax);
286 refPVvertexes_toDelete.reserve(pVmax);
287 exitCode.reserve(pVmax);
288
289 // Refit the primary vertex and set the related decorations.
290
291 for (size_t i =0; i < pVmax ; i++) {
292 const xAOD::Vertex* oldPV = GoodPVs.at(i);
293 // when set to false this will return null when a new vertex is not required
294// ATH_MSG_DEBUG("old PV x " << oldPV->x() << " y " << oldPV->y() << " z " << oldPV->z());
295 int exitcode = 0;
296 xAOD::Vertex* refPV = pvRefitter->refitVertex(oldPV, exclTrk, m_copyAllVertices, &exitcode);
297// if (refPV) ATH_MSG_DEBUG("ref PV x " << refPV->x() << " y " << refPV->y() << " z " << refPV->z());
298 exitCode.push_back(exitcode);
299 // we want positioning to match the goodPrimaryVertices
300 if (refPV == nullptr) {
301 refPVvertexes.push_back(oldPV);
302 refPVvertexes_toDelete.push_back(nullptr);
303 } else {
304 refPVvertexes.push_back(refPV);
305 refPVvertexes_toDelete.push_back(refPV);
306 }
307 }
308 boost::container::static_vector<size_t, 4> indexesUsed;
309 boost::container::static_vector<std::pair<size_t, xAOD::BPhysHelper::pv_type>, 4> indexestoProcess;
310
311 if(doPt){
312 indexestoProcess.push_back(std::make_pair
313 (pvtool.FindHighPtIndex(refPVvertexes), xAOD::BPhysHelper::PV_MAX_SUM_PT2));
314 }
315 if(doA0) {
316 indexestoProcess.push_back(std::make_pair( FindLowA0Index(mom, vtx, refPVvertexes, m_PV_minNTracks),
318 }
319 if(doZ0) {
320 indexestoProcess.push_back(std::make_pair(FindLowZIndex(mom, vtx, refPVvertexes, m_PV_minNTracks),
322 }
323 if(doZ0BA) {
324 size_t lowZBA = FindLowZ0BAIndex(mom, vtx, refPVvertexes, m_PV_minNTracks);
325 if( lowZBA < pVmax ) {
326 indexestoProcess.push_back(std::make_pair(lowZBA, xAOD::BPhysHelper::PV_MIN_Z0_BA));
327 }
328 else pvtool.FillBPhysHelperNULL(vtx, pvContainer, xAOD::BPhysHelper::PV_MIN_Z0_BA);
329 }
330
331 for(size_t i =0 ; i<indexestoProcess.size(); i++){
332 //if refitted add to refitted container
333 auto index = indexestoProcess[i].first;
334 auto pvtype = indexestoProcess[i].second;
335 const xAOD::VertexContainer* ParentContainer =
336 (refPVvertexes_toDelete.at(index)) ? refPvContainer : pvContainer;
337 if(ParentContainer == refPvContainer && std::find(indexesUsed.begin(),
338 indexesUsed.end(), index) == indexesUsed.end()) {
339 // store the new vertex
340 refPvContainer->push_back(refPVvertexes_toDelete.at(index));
341 indexesUsed.push_back(index);
342 }
343 FillBPhysHelper(mom, cov, vtx, refPVvertexes[index],
344 ParentContainer, pvtype, exitCode[index]);
345 vtx.setOrigPv(GoodPVs[index], pvContainer, pvtype);
346 }
347 //nullify ptrs we want to keep so these won't get deleted
348 //"delete null" is valid in C++ and does nothing so this is quicker than a lot of if statements
349 for(size_t x : indexesUsed) refPVvertexes_toDelete[x] = nullptr;
350 //Loop over toDELETE container, anything that is used or was not refitted is null
351 //This cleans up all extra vertices that were created and not used
352 for(const xAOD::Vertex* ptr : refPVvertexes_toDelete) delete ptr;
353 refPVvertexes.clear(); // Clear lists of now dangling ptrs
354 refPVvertexes_toDelete.clear();
355 exitCode.clear();
356
357 } else {
358 // 2.a) the first PV with the largest sum pT.
359 if(doPt) {
360 size_t highPtindex = pvtool.FindHighPtIndex(GoodPVs); // Should be 0 in PV ordering
361 FillBPhysHelper(mom, cov, vtx, GoodPVs[highPtindex], pvContainer, xAOD::BPhysHelper::PV_MAX_SUM_PT2, 0);
362 }
363 // 2.b) the closest in 3D:
364 if(doA0) {
365 size_t lowA0 = FindLowA0Index(mom, vtx, GoodPVs, m_PV_minNTracks);
366 FillBPhysHelper(mom, cov, vtx, GoodPVs[lowA0], pvContainer, xAOD::BPhysHelper::PV_MIN_A0, 0);
367 }
368 // 2.c) the closest in Z:
369 if(doZ0) {
370 size_t lowZ = FindLowZIndex(mom, vtx, GoodPVs, m_PV_minNTracks);
371 FillBPhysHelper(mom, cov, vtx, GoodPVs[lowZ], pvContainer, xAOD::BPhysHelper::PV_MIN_Z0, 0);
372 }
373 // 2.d) the closest in Z (DOCA w.r.t. beam axis):
374 if(doZ0BA) {
375 size_t lowZBA = FindLowZ0BAIndex(mom, vtx, GoodPVs, m_PV_minNTracks);
376 if ( lowZBA < GoodPVs.size() ) { // safety against vector index out-of-bounds
377 FillBPhysHelper(mom, cov, vtx, GoodPVs[lowZBA], pvContainer, xAOD::BPhysHelper::PV_MIN_Z0_BA, 0);
378 } else {
379 // nothing found -- fill NULL
381 }
382 }
383 } // refitPV
384 } else {
385
386 if(pvContainer->empty()) return StatusCode::FAILURE;
387 const xAOD::Vertex* Dummy = pvContainer->at(0);
388
389 // 2.a) the first PV with the largest sum pT.
390 if(doPt) {
391 FillBPhysHelper(mom, cov, vtx, Dummy, pvContainer, xAOD::BPhysHelper::PV_MAX_SUM_PT2, 0);
392 if(refitPV) vtx.setOrigPv(Dummy, pvContainer, xAOD::BPhysHelper::PV_MAX_SUM_PT2);
393 }
394 // 2.b) the closest in 3D:
395 if(doA0) {
396 FillBPhysHelper(mom, cov, vtx, Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_A0, 0);
397 if(refitPV) vtx.setOrigPv(Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_A0);
398 }
399 // 2.c) the closest in Z:
400 if(doZ0) {
401 FillBPhysHelper(mom, cov, vtx, Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_Z0, 0);
402 if(refitPV) vtx.setOrigPv(Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_Z0);
403 }
404 // 2.d) the closest in Z (DOCA w.r.t. beam axis):
405 if(doZ0BA) {
406 FillBPhysHelper(mom, cov, vtx, Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_Z0_BA, 0);
407 if(refitPV) vtx.setOrigPv(Dummy, pvContainer, xAOD::BPhysHelper::PV_MIN_Z0_BA);
408 }
409 } // GoodPVs.empty()
410
411 // 3) proper decay time and error:
412 // retrieve the refitted PV (or the original one, if the PV refitting was turned off)
413 if(doPt) ProcessVertex(mom, cov, vtx, xAOD::BPhysHelper::PV_MAX_SUM_PT2, mass);
414 if(doA0) ProcessVertex(mom, cov, vtx, xAOD::BPhysHelper::PV_MIN_A0, mass);
415 if(doZ0) ProcessVertex(mom, cov, vtx, xAOD::BPhysHelper::PV_MIN_Z0, mass);
416 if(doZ0BA) ProcessVertex(mom, cov, vtx, xAOD::BPhysHelper::PV_MIN_Z0_BA, mass);
417
418 return StatusCode::SUCCESS;
419}
420
421//-----------------------------------------------------------------------------
422
424
425 const std::vector< std::vector<TLorentzVector> > &moms = casc->getParticleMoms();
426 const std::vector<xAOD::Vertex*> &cascadeVertices = casc->vertices();
427 // Get refitted track momenta from all vertices, charged tracks only
428 std::vector<float> px;
429 std::vector<float> py;
430 std::vector<float> pz;
431 for( size_t jt=0; jt<moms.size(); jt++) {
432 for( size_t it=0; it<cascadeVertices[jt]->vxTrackAtVertex().size(); it++) {
433 px.push_back( moms[jt][it].Px() );
434 py.push_back( moms[jt][it].Py() );
435 pz.push_back( moms[jt][it].Pz() );
436 }
437 }
438 vtx.setRefTrks(std::move(px),std::move(py),std::move(pz));
439
440}
441
442bool DerivationFramework::BPhysPVCascadeTools::uniqueCollection(const std::vector<const xAOD::TrackParticle*>&col){
443 for(auto p : col){
444 if(std::count(col.begin(), col.end(), p) > 1) return false;
445 }
446 return true;
447}
448
449bool DerivationFramework::BPhysPVCascadeTools::uniqueCollection(const std::vector<const xAOD::TrackParticle*>&col1, const std::vector<const xAOD::TrackParticle*>&col2){
450 for(auto p : col1){
451 if((std::count(col1.begin(), col1.end(), p) + std::count(col2.begin(), col2.end(), p)) > 1) return false;
452 }
453 for(auto p : col2){
454 if((std::count(col1.begin(), col1.end(), p) + std::count(col2.begin(), col2.end(), p)) > 1) return false;
455 }
456 return true;
457}
458
459bool DerivationFramework::BPhysPVCascadeTools::LinkVertices(SG::AuxElement::Decorator<VertexLinkVector> &decor, const std::vector<const xAOD::Vertex*>& vertices,
460 const xAOD::VertexContainer* vertexContainer, const xAOD::Vertex* vert){
461 // create tmp vector of preceding vertex links
462 VertexLinkVector precedingVertexLinks;
463
464 // loop over input precedingVertices
465 auto precedingVerticesItr = vertices.begin();
466 for(; precedingVerticesItr!=vertices.end(); ++precedingVerticesItr) {
467 // sanity check 1: protect against null pointers
468 if( !(*precedingVerticesItr) )
469 return false;
470
471 // create element link
472 VertexLink vertexLink;
473 vertexLink.setElement(*precedingVerticesItr);
474 vertexLink.setStorableObject(*vertexContainer);
475
476 // sanity check 2: is the link valid?
477 if( !vertexLink.isValid() )
478 return false;
479
480 // link is OK, store it in the tmp vector
481 precedingVertexLinks.push_back( vertexLink );
482
483 } // end of loop over preceding vertices
484
485 // all OK: store preceding vertex links in the aux store
486 decor(*vert) = precedingVertexLinks;
487 return true;
488}
489
490
double charge(const T &p)
Definition AtlasPID.h:997
: B-physics xAOD helpers.
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
std::vector< size_t > vec
size_t size() const
Number of registered mappings.
#define x
xAOD::Vertex * refitVertex(const xAOD::Vertex *vertex, const xAOD::Vertex *excludeVertex, bool ReturnCopy=true, int *exitcode=nullptr) const
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
static bool uniqueCollection(const std::vector< const xAOD::TrackParticle * > &)
size_t m_PV_minNTracks
minimum number of tracks required in PVs considered
double DistInZtoDOCA(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj, const xAOD::Vertex *vertex) const
Calculate the distance along z axis between the PV and SV's DOCA point w.r.t.
static bool LinkVertices(SG::AuxElement::Decorator< VertexLinkVector > &decor, const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer, const xAOD::Vertex *vert)
size_t FindLowZIndex(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &Obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Returns the index integer of the vertex with the lowest Z in relation to the given vertex.
Amg::Vector3D GetBeamSpot() const
Get the current beamspot position either from cache or from BeamCondSvc.
static std::vector< const xAOD::TrackParticle * > CollectAllChargedTracks(const std::vector< xAOD::Vertex * > &cascadeVertices)
void FillBPhysHelper(const std::vector< TLorentzVector > &mom, Amg::MatrixX cov, xAOD::BPhysHelper &vtx, const xAOD::Vertex *refPV, const xAOD::VertexContainer *refPvContainer, xAOD::BPhysHelper::pv_type pvtype, int) const
Fills the BPhysHelper object with the standard parameters.
static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer *importedTrackCollection)
void SetMinNTracksInPV(size_t PV_minNTracks)
Set the minimum number of tracks required for primary vertices to be considered for primary vertex as...
ElementLink< xAOD::VertexContainer > VertexLink
Amg::Vector3D DocaExtrapToBeamSpot(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj) const
Point of DOCA w.r.t.
static std::vector< const xAOD::Vertex * > GetGoodPV(const xAOD::VertexContainer *pvContainer)
Static method call with DerivationFramework::BPhysDerHelpers::GetGoodPV Returns a std::vector contain...
static void SetVectorInfo(xAOD::BPhysHelper &, const Trk::VxCascadeInfo *)
void ProcessVertex(const std::vector< TLorentzVector > &mom, Amg::MatrixX cov, xAOD::BPhysHypoHelper &vtx, xAOD::BPhysHelper::pv_type pvtype, double mass) const
StatusCode FillCandwithRefittedVertices(bool refitPV, const xAOD::VertexContainer *pvContainer, xAOD::VertexContainer *refPvContainer, const Analysis::PrimaryVertexRefitter *pvRefitter, size_t in_PV_max, int DoVertexType, Trk::VxCascadeInfo *casc, int index, double mass, xAOD::BPhysHypoHelper &vtx)
size_t FindLowA0Index(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &Obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Returns the index integer of the vertex with the lowest A0 in relation to the given vertex.
size_t FindLowZ0BAIndex(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Find the index for the PV with the lowest distance in z of the SV's DOCA point w.r....
BPhysPVCascadeTools(const CascadeTools *cascadeTools)
void FillBPhysHelperNULL(xAOD::BPhysHelper &vtx, const xAOD::VertexContainer *PvContainer, xAOD::BPhysHelper::pv_type pvtype, bool do3d=false) const
size_t FindHighPtIndex(const std::vector< const xAOD::Vertex * > &PVlist) const
const std::vector< Amg::MatrixX > & getCovariance() const
const std::vector< std::vector< TLorentzVector > > & getParticleMoms() const
const std::vector< xAOD::Vertex * > & vertices() const
float setZ0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter
bool setLxyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
its error
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 ...
float setZ0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
longitudinal impact parameter error
const xAOD::Vertex * vtx() const
Getter method for the cached xAOD::Vertex.
float setA0(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the 3D and transverse impact parameters and their error.
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.
const xAOD::Vertex * pv(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the refitted collision vertex of type pv_type.
pv_type
: Enum type of the PV
bool setRefTrks(std::vector< float > px, std::vector< float > py, std::vector< float > pz)
Sets refitted track momenta.
float setA0Err(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
3D impact parameter error
bool setRefitPVStatus(int code, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Set the exitCode of the refitter for vertex of type pv_type.
float setA0xyErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter error
float setA0xy(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0)
transverse impact parameter
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.
bool setTau(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
: Set the proper decay time and error.
bool setTauErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time error
double a0
Definition globals.cxx:27
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
Definition index.py:1
VertexType
Vertex types.
@ PileUp
Pile-up vertex.
@ PriVtx
Primary vertex.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".