ATLAS Offline Software
Loading...
Searching...
No Matches
V0CandidateCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8void V0CandidateCnv_p1::persToTrans(const Trk::V0Candidate_p1 * persObj, Trk::V0Candidate * transObj, MsgStream &log)
9{
10
11// A simplest possible approcah to work with the base class:
12// dynamic casting each element of the vector
13// allows to work with vectors and containers of
14// all derived types of VxCandidate. I.e. poly converters
15// are now defined for each of derived types. A VxContainer
16// of any of them can now be stored and read. But objects
17// like V0Candidate are now forced to work through a base
18// type. Dynamic_cast is the simplest solution. In principle,
19// the template should have been re-written
20
21 std::vector<Trk::VxCandidate *> v;
22 m_v0HypothesisVectorCnv.persToTrans( &persObj->m_v0Hyp, &v,log);
23 std::vector<Trk::V0Hypothesis *> vh;
24 vh.reserve (v.size());
25 for(auto & i : v)
26 vh.push_back( dynamic_cast<Trk::V0Hypothesis *>(i));
27 *transObj = Trk::V0Candidate (std::move (vh));
28}
29
30void V0CandidateCnv_p1::transToPers(const Trk::V0Candidate * transObj, Trk::V0Candidate_p1 * persObj, MsgStream &log){
31
32 std::vector<Trk::VxCandidate *> lVx;
33// std::cout<<"Ilija writing v0candidate. size: "<<transObj->m_v0Hyp.size()<<std::endl;
34 const std::vector<Trk::V0Hypothesis *>& v0Hyp = *transObj->v0Hypothesis();
35 lVx.reserve(v0Hyp.size());
36for(auto *i : v0Hyp)
37 lVx.push_back( i);
38 m_v0HypothesisVectorCnv.transToPers( &lVx, &persObj->m_v0Hyp, log);
39
40}
std::vector< TPObjRef > m_v0Hyp
std::vector< Trk::V0Hypothesis * > * v0Hypothesis(void)
Unconst access to the vector of V0Hypothesis Required by the finder to set the element links properly...
Definition V0Candidate.h:91
An extension of Trk::ExtendedVxCandidate, to be used for constrained and unconstrained V0 candidates ...
void persToTrans(const Trk::V0Candidate_p1 *persObj, Trk::V0Candidate *transObj, MsgStream &log)
void transToPers(const Trk::V0Candidate *transObj, Trk::V0Candidate_p1 *persObj, MsgStream &log)
V0HypothesisVectorCnv_p1 m_v0HypothesisVectorCnv