ATLAS Offline Software
VxCandidateCnv_p2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "VxVertex/VxCandidate.h"
8 #include <iostream>
9 
10 void VxCandidateCnv_p2::persToTrans(const Trk::VxCandidate_p1 * persObj, Trk::VxCandidate * transObj, MsgStream &log) {
11 
12  Trk::RecVertex vx;
14 
15  std::vector<Trk::VxTrackAtVertex*> trackAtVertex;
16  if (!persObj->m_vxTrackAtVertex.empty()){ // not to call if 0
17  trackAtVertex.reserve( persObj->m_vxTrackAtVertex.size() );
18  for(auto it : persObj->m_vxTrackAtVertex)
19  trackAtVertex.push_back( createTransFromPStore( &m_vxTrackAtVertexConverter, it, log ) );
20  }
21 
22  *transObj = Trk::VxCandidate (std::move(vx),
23  std::move (trackAtVertex));
24  transObj->setVertexType (static_cast<Trk::VertexType>(persObj->m_vertexType));
25 
26 // std::cout<<"m_recVertex:"<<transObj->m_recVertex<<std::endl;
27 
28 // std::vector<Trk::VxTrackAtVertex*>::iterator it=transObj->m_vxTrackAtVertex.begin();
29 // for (;it!=transObj->m_vxTrackAtVertex.end();++it)
30 // std::cout<<*(*it)<<std::endl;
31 
32 }
33 
34 void VxCandidateCnv_p2::transToPers(const Trk::VxCandidate * transObj, Trk::VxCandidate_p1 * persObj, MsgStream &log)
35 {
36 
37  // std::cout<<"VxCandidateCnv_p2 transToPers"<<std::endl;
38  persObj->m_recVertex = toPersistent( &m_recVertexConverter, &(transObj->recVertex()), log );
39 
40  // get rid of the refitted perigees in case of primary and pileup vertex
41  const std::vector<Trk::VxTrackAtVertex*>& trackAtVertex = *transObj->vxTrackAtVertex();
42  if (transObj->vertexType() == Trk::PriVtx || transObj->vertexType() == Trk::PileUp) {
43  for (Trk::VxTrackAtVertex* t : trackAtVertex) {
44  t->setPerigeeAtVertex (static_cast<Trk::TrackParameters*>(nullptr));
45  }
46  }
47  m_vxTrkAtVrtCnv.transToPers( &trackAtVertex, &persObj->m_vxTrackAtVertex, log);
48  persObj->m_vertexType = static_cast<int>(transObj->vertexType());
49 }
VxCandidateCnv_p2::m_recVertexConverter
RecVertexCnv_p2 * m_recVertexConverter
Definition: VxCandidateCnv_p2.h:30
VxCandidateCnv_p2.h
Trk::VxCandidate::recVertex
const Trk::RecVertex & recVertex(void) const
Returns a reference to reconstructed vertex.
Definition: VxCandidate.h:132
Trk::VxTrackAtVertex
The VxTrackAtVertex is a common class for all present TrkVertexFitters The VxTrackAtVertex is designe...
Definition: VxTrackAtVertex.h:77
Trk::VertexType
VertexType
Definition: VertexType.h:25
Trk::VxCandidate::vertexType
VertexType vertexType() const
return the type of the vertex
Definition: VxCandidate.h:120
skel.it
it
Definition: skel.GENtoEVGEN.py:396
VxCandidateCnv_p2::m_vxTrackAtVertexConverter
ITPConverterFor< Trk::VxTrackAtVertex > * m_vxTrackAtVertexConverter
Definition: VxCandidateCnv_p2.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ITPConverterFor::fillTransFromPStore
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
Convert persistent object, stored in the the top-level persistent object and referenced by the TP Ref...
Definition: TPConverter.h:145
VxCandidateCnv_p2::persToTrans
void persToTrans(const Trk::VxCandidate_p1 *persObj, Trk::VxCandidate *transObj, MsgStream &log)
Definition: VxCandidateCnv_p2.cxx:10
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
Trk::VxCandidate::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex * > * vxTrackAtVertex(void)
Unconst pointer to the vector of tracks Required by some of the vertex fitters.
Definition: VxCandidate.h:144
VxTrackAtVertex.h
TPPolyVectorCnv::transToPers
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
Definition: TPConverter.h:1122
Trk::VxCandidate_p1::m_recVertex
TPObjRef m_recVertex
Definition: VxCandidate_p1.h:29
VxCandidateCnv_p2::transToPers
void transToPers(const Trk::VxCandidate *transObj, Trk::VxCandidate_p1 *persObj, MsgStream &log)
Definition: VxCandidateCnv_p2.cxx:34
Trk::ParametersBase
Definition: ParametersBase.h:55
VxCandidate.h
ITPConverterFor::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
Definition: TPConverter.h:119
VxCandidateCnv_p2::m_vxTrkAtVrtCnv
VxTrkAtVrtVectorCnv_p1 m_vxTrkAtVrtCnv
Definition: VxCandidateCnv_p2.h:34
Trk::VxCandidate_p1
Definition: VxCandidate_p1.h:23
Trk::VxCandidate
Definition: VxCandidate.h:27
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::PriVtx
@ PriVtx
Primary Vertex.
Definition: VertexType.h:27
Trk::VxCandidate_p1::m_vertexType
int m_vertexType
Definition: VxCandidate_p1.h:31
Trk::VxCandidate_p1::m_vxTrackAtVertex
std::vector< TPObjRef > m_vxTrackAtVertex
Definition: VxCandidate_p1.h:30
Trk::PileUp
@ PileUp
Pile Up Vertex.
Definition: VertexType.h:29
ITPConverterFor::createTransFromPStore
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Create transient representation of a persistent object, stored in the the top-level persistent object...
Definition: TPConverter.h:172
Trk::VxCandidate::setVertexType
void setVertexType(VertexType vertexType)
return the type of the vertex
Definition: VxCandidate.h:114