ATLAS Offline Software
Loading...
Searching...
No Matches
TrackParticleBaseCnv_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
5//-----------------------------------------------------------------------------
6//
7// file: TrackParticleBaseCnv_p1.cxx
8//
9//-----------------------------------------------------------------------------
10
12#include "TrkTrack/TrackInfo.h"
14
16{
18 m_elementLinkTrackCollectionConverter.persToTrans(&persObj->m_originalTrack,&transObj->m_originalTrack,log);
20 m_elementLinkVxContainerConverter.persToTrans(&persObj->m_elVxCandidate,&transObj->m_elVxCandidate,log);
21
22 m_vecParametersBaseCnv.persToTrans( &persObj->m_trackParameters, &(transObj->m_trackParameters), log );
23
27
28//reading the persistent TrackInfo if any
29
31 Trk::ParticleHypothesis hypothesis = static_cast<Trk::ParticleHypothesis>(persObj->m_particleHypo);
32 Trk::TrackInfo info(fitter, hypothesis);
33 transObj->m_trackInfo = info;
34
35 transObj->m_trackInfo.m_properties = std::bitset<Trk::TrackInfo::NumberOfTrackProperties>(persObj->m_properties);
36// transObj->m_trackInfo.m_patternRecognition = std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo>(persObj->m_patternRecognition);
37
38 transObj->m_trackInfo.m_patternRecognition = std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo>(persObj->m_patternRecognition);
39 for (unsigned int i = 32;i<Trk::TrackInfo::NumberOfTrackRecoInfo;++i) {
40 unsigned int mask = (1<<(i-32));
41 transObj->m_trackInfo.m_patternRecognition[i] = (persObj->m_extPatternRecognition & mask );
42 }
43}
44
45
47{
49 m_elementLinkTrackCollectionConverter.transToPers(&transObj->m_originalTrack,&persObj->m_originalTrack,log);
51 m_elementLinkVxContainerConverter.transToPers(&transObj->m_elVxCandidate,&persObj->m_elVxCandidate,log);
52
53 m_vecParametersBaseCnv.transToPers( &(transObj->m_trackParameters), &persObj->m_trackParameters, log );
54
55 persObj->m_trackParticleOrigin = static_cast<unsigned int>(transObj->m_trackParticleOrigin);
56 persObj->m_trackSummary = toPersistent( &m_trackSummaryCnv, transObj->m_trackSummary, log );
57 persObj->m_fitQuality = toPersistent( &m_fitQualityCnv, transObj->m_fitQuality, log );
58
59 Trk::TrackInfo info = transObj->m_trackInfo;
60 persObj->m_fitter = static_cast<unsigned int>(info.m_fitter);
61 persObj->m_particleHypo = static_cast<unsigned int>(info.m_particleHypo);
62 persObj->m_properties = info.m_properties.to_ulong();
63// persObj->m_patternRecognition = info.m_patternRecognition.to_ulong();
64 if (info.m_patternRecognition.size()<32) {
65 persObj->m_patternRecognition = info.m_patternRecognition.to_ulong();
66 } else {
67 // more 32 bits so have to do it the hard way.
68 unsigned int i = 0;
69 unsigned int size=info.m_patternRecognition.size();
70 persObj->m_patternRecognition=0;
71 persObj->m_extPatternRecognition=0;
72 for (;i<32;++i) persObj->m_patternRecognition |= ((transObj->m_trackInfo.m_patternRecognition[i]) << i);
73 for (i=32;i<size;++i) persObj->m_extPatternRecognition |= ((transObj->m_trackInfo.m_patternRecognition[i]) << (i-32));
74 }
75
76 // std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo> test = std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo>(persObj->m_patternRecognition);
77 // for (unsigned int i = 32;i<Trk::TrackInfo::NumberOfTrackRecoInfo;++i)
78 // {
79 // unsigned int mask = (1<<(i-32));
80 // test[i] = (persObj->m_extPatternRecognition & mask );
81 // }
82 //
83 // // Leave test in for the moment.
84 // // TODO - remove.
85 // if (test!=transObj->m_trackInfo.m_patternRecognition){
86 // log<<MSG::WARNING<<"TPBC Trackinfos don't match! "<<endmsg;
87 // std::cout<<"Trans: "<<transObj->m_trackInfo.m_patternRecognition.to_string<char, std::char_traits<char>,std::allocator<char> >()<<std::endl;
88 // std::cout<<"Read back: "<<test.to_string<char, std::char_traits<char>,std::allocator<char> >()<<std::endl;
89 // std::cout<<"persObj->m_patternRecognition: "<<std::hex<<persObj->m_patternRecognition<<std::endl;
90 // std::cout<<"persObj->m_extPatternRecognition: "<<persObj->m_extPatternRecognition<<std::dec<<std::endl;
91 // std::cout<<"transObj->m_trackInfo.m_patternRecognition[i]: "<<std::endl;
92 // for (unsigned int i=0;i<info.m_patternRecognition.size();++i) std::cout<<" "<<(transObj->m_trackInfo.m_patternRecognition[i]);
93 // for (unsigned int i=0;i<info.m_patternRecognition.size();++i) std::cout<<" "<<i;
94 // std::cout<<std::endl;
95 //
96 // }
97
98}
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
virtual void transToPers(const Trk ::TrackParticleBase *transObj, Trk ::TrackParticleBase_p1 *persObj, MsgStream &log)
virtual void persToTrans(const Trk ::TrackParticleBase_p1 *persObj, Trk ::TrackParticleBase *transObj, MsgStream &log)
TrackSummaryCnv_p1 * m_trackSummaryCnv
ElementLinkCnv_p2< ElementLink< VxContainer > > m_elementLinkVxContainerConverter
vecParametersBaseCnv_p1 m_vecParametersBaseCnv
ElementLinkCnv_p2< ElementLink< TrackCollection > > m_elementLinkTrackCollectionConverter
Contains information about the 'fitter' of this track.
std::bitset< NumberOfTrackProperties > m_properties
A bitset providing information on the properties of the track.
TrackFitter
enums to identify who created this track and what propertis does it have.
std::bitset< NumberOfTrackRecoInfo > m_patternRecognition
A bitset providing information on the actual pattern recognition algotithm.
ElementLinkContNames_p2 m_originalTrackNames
std::vector< TPObjRef > m_trackParameters
ElementLinkContNames_p2 m_elVxCandidateNames
const TrackSummary * m_trackSummary
the summary of this TrackParticle.
const FitQuality * m_fitQuality
the fit quality of this TrackParticle.
ElementLink< TrackCollection > m_originalTrack
ElementLink to the Track used to create this TrackParticleBase object Before writing to disk,...
TrackInfo m_trackInfo
This is a class which stores the identity of where the track was created, fitted,...
TrackParticleOrigin m_trackParticleOrigin
specifies the origin type of the particle (prim.vertex, ...)
std::vector< const TrackParameters * > m_trackParameters
DataVector of TrackParameters stored inside this TrackParticle.
ElementLink< VxContainer > m_elVxCandidate
ElementLink to a VxCandidate.
VertexType TrackParticleOrigin
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.