ATLAS Offline Software
TrackInfoCnv_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: TrackInfoCnv_p1.cxx
8 //
9 //-----------------------------------------------------------------------------
10 #include "TrkTrack/TrackInfo.h"
12 
13 void TrackInfoCnv_p1::persToTrans( const Trk::TrackInfo_p1 * persObj, Trk::TrackInfo * transObj, MsgStream& )
14 {
15  // set first 32 bits
16  std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo> patrec(persObj->m_patternRecognition);
17 
18 
19  for (unsigned int i = 32;i<Trk::TrackInfo::NumberOfTrackRecoInfo;++i)
20  {
21  unsigned int mask = (1<<(i-32));
22  patrec[i] = (persObj->m_extPatternRecognition & mask );
23  }
24 
25 
26  *transObj = Trk::TrackInfo (static_cast<Trk::TrackInfo::TrackFitter>(persObj->m_fitter),
27  static_cast<Trk::ParticleHypothesis>(persObj->m_particleHypo),
28  std::bitset<Trk::TrackInfo::NumberOfTrackProperties>(persObj->m_properties),
29  patrec);
30 }//end of pers to trans method
31 
32 
33 void TrackInfoCnv_p1::transToPers( const Trk::TrackInfo * transObj, Trk::TrackInfo_p1 * persObj, MsgStream& )
34 {
35 // std::cout<<"Writing object out "<<std::endl;
36 // if(transObj->patternRecoInfo(Trk::TrackInfo::SiSpacePointsSeedMaker_LowMomentum) )
37 // std::cout<<"This is low Pt !"<<std::endl;
38 
39  persObj->m_fitter = static_cast<unsigned int>(transObj->trackFitter());
40  persObj->m_particleHypo = static_cast<unsigned int>(transObj->particleHypothesis());
41  persObj->m_properties = transObj->properties().to_ulong();
42 
43  if (transObj->patternRecognition().size()<32)
44  {
45  persObj->m_patternRecognition = transObj->patternRecognition().to_ulong();
46  }else{
47 
48 // more 32 bits so have to do it the hard way.
49  unsigned int i = 0;
50  unsigned int size=transObj->patternRecognition().size();
51 
52  // std::cout<<transObj->dumpBitsPatternRecoInfo()<<std::endl;
53 
54  for (;i<32;++i) persObj->m_patternRecognition |= ((transObj->patternRecognition()[i]) << i);
55  for (i=32;i<size;++i) persObj->m_extPatternRecognition |= ((transObj->patternRecognition()[i]) << (i-32));
56 
57 // CHECK!
58  // set first 32 bits
59  // std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo> test = std::bitset<Trk::TrackInfo::NumberOfTrackRecoInfo>(persObj->m_patternRecognition);
60  //
61  //
62  // for (unsigned int i = 32;i<Trk::TrackInfo::NumberOfTrackRecoInfo;++i)
63  // {
64  // unsigned int mask = (1<<(i-32));
65  // test[i] = (persObj->m_extPatternRecognition & mask );
66  // }
67  //
68  // if (test!=transObj->m_patternRecognition){
69  // log<<MSG::WARNING<<"TIC Trackinfos don't match! "<<endmsg;
70  // log<<MSG::WARNING<<test.to_string<char, std::char_traits<char>,std::allocator<char> >()<<endmsg;
71  // log<<MSG::WARNING<<transObj->m_patternRecognition.to_string<char, std::char_traits<char>,std::allocator<char> >()<<endmsg;
72  // }
73 
74 
75  }
76 }//end of trans to pers method
Trk::TrackInfo::NumberOfTrackRecoInfo
@ NumberOfTrackRecoInfo
Maximum number of enums.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:268
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
Trk::TrackInfo_p1::m_fitter
unsigned int m_fitter
Definition: TrackInfo_p1.h:25
TrackInfoCnv_p1::persToTrans
virtual void persToTrans(const Trk::TrackInfo_p1 *persObj, Trk::TrackInfo *transObj, MsgStream &log)
Definition: TrackInfoCnv_p1.cxx:13
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Trk::TrackInfo_p1::m_patternRecognition
unsigned int m_patternRecognition
Definition: TrackInfo_p1.h:30
Trk::TrackInfo::TrackFitter
TrackFitter
enums to identify who created this track and what propertis does it have.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:39
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::TrackInfo::properties
const std::bitset< NumberOfTrackProperties > & properties() const
TrackInfoCnv_p1::transToPers
virtual void transToPers(const Trk::TrackInfo *transObj, Trk::TrackInfo_p1 *persObj, MsgStream &log)
Definition: TrackInfoCnv_p1.cxx:33
Trk::TrackInfo::patternRecognition
const std::bitset< NumberOfTrackRecoInfo > & patternRecognition() const
Trk::TrackInfo_p1::m_extPatternRecognition
unsigned int m_extPatternRecognition
Definition: TrackInfo_p1.h:31
TrackInfo.h
TrackInfoCnv_p1.h
Trk::TrackInfo_p1
Definition: TrackInfo_p1.h:21
Trk::TrackInfo_p1::m_properties
unsigned int m_properties
Definition: TrackInfo_p1.h:29
Trk::TrackInfo::trackFitter
const TrackFitter & trackFitter() const
Access methods for track fitter.
Trk::TrackInfo::particleHypothesis
ParticleHypothesis particleHypothesis() const
Returns the particle hypothesis used for Track fitting.
Trk::TrackInfo_p1::m_particleHypo
unsigned int m_particleHypo
Definition: TrackInfo_p1.h:26