ATLAS Offline Software
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 
8 void 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;
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 
30 void 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());
36 for(auto *i : v0Hyp)
37  lVx.push_back( i);
39 
40 }
V0Candidate.h
Trk::V0Candidate_p1
Definition: V0Candidate_p1.h:22
Trk::V0Hypothesis
Definition: V0Hypothesis.h:40
V0CandidateCnv_p1::persToTrans
void persToTrans(const Trk::V0Candidate_p1 *persObj, Trk::V0Candidate *transObj, MsgStream &log)
Definition: V0CandidateCnv_p1.cxx:8
lumiFormat.i
int i
Definition: lumiFormat.py:92
V0CandidateCnv_p1::transToPers
void transToPers(const Trk::V0Candidate *transObj, Trk::V0Candidate_p1 *persObj, MsgStream &log)
Definition: V0CandidateCnv_p1.cxx:30
TPPtrVectorCnv::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:948
V0CandidateCnv_p1.h
TPPtrVectorCnv::persToTrans
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
Definition: TPConverter.h:929
Trk::V0Candidate_p1::m_v0Hyp
std::vector< TPObjRef > m_v0Hyp
Definition: V0Candidate_p1.h:29
python.PyAthena.v
v
Definition: PyAthena.py:157
V0CandidateCnv_p1::m_v0HypothesisVectorCnv
V0HypothesisVectorCnv_p1 m_v0HypothesisVectorCnv
Definition: V0CandidateCnv_p1.h:40
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::V0Candidate
Definition: V0Candidate.h:33
Trk::V0Candidate::v0Hypothesis
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