ATLAS Offline Software
TrigVertexCnv_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 
8 #include <fenv.h>
9 
10 
11 //-----------------------------------------------------------------------------
12 // Persistent to transient
13 //-----------------------------------------------------------------------------
15  TrigVertex *transObj,
16  MsgStream &log )
17 {
18  log << MSG::DEBUG << "TrigVertexCnv_p2::persToTrans called " << endmsg;
19 
20  // Disable FPEs for this bit ... avoids crashes when reading some
21  // 16.0.1 data.
22  fenv_t fenv;
23  feholdexcept (&fenv);
24 
25  transObj->m_x = persObj->m_allFloats[0];
26  transObj->m_y = persObj->m_allFloats[1];
27  transObj->m_z = persObj->m_allFloats[2];
28  transObj->m_mass = persObj->m_allFloats[3];
29  transObj->m_massVar = persObj->m_allFloats[4];
30  for(int i=0;i<6;i++){
31  if (isnan(persObj->m_allFloats[5+i])) {
32  transObj->m_cov[i] = 0;
33  }
34  else {
35  transObj->m_cov[i] = persObj->m_allFloats[5+i];
36  }
37  }
38  transObj->m_energyFraction = persObj->m_allFloats[11];
39  transObj->m_chiSquared = persObj->m_allFloats[12];
40 
41  transObj->m_nTwoTracksSecVtx = persObj->m_allInts[0];
42  transObj->m_nDOF = persObj->m_allInts[1];
43  transObj->m_algId = static_cast<TrigVertex::AlgoId>(persObj->m_allInts[2]) ;
44 
45  fesetenv (&fenv);
46 
48  if(!m_trackInVertexVector.empty()) {
49 
50  if (transObj->m_tracks)
51  transObj->m_tracks->assign (m_trackInVertexVector.begin(),
52  m_trackInVertexVector.end());
53  else
54  transObj->m_tracks =
56  m_trackInVertexVector.end());
57  transObj->m_ownTracks = true;
58  }
59 }
60 
61 //-----------------------------------------------------------------------------
62 // Transient to persistent
63 //-----------------------------------------------------------------------------
65  TrigVertex_p2 *persObj ,
66  MsgStream &log )
67 {
68  log << MSG::DEBUG << "TrigVertexCnv_p2::transToPers called " << endmsg;
69 
70  persObj->m_allFloats[0] = transObj->m_x ;
71  persObj->m_allFloats[1] = transObj->m_y ;
72  persObj->m_allFloats[2] = transObj->m_z ;
73  persObj->m_allFloats[3] = transObj->m_mass ;
74  persObj->m_allFloats[4] = transObj->m_massVar ;
75  persObj->m_allFloats[5] = transObj->m_cov[0] ;
76  persObj->m_allFloats[6] = transObj->m_cov[1] ;
77  persObj->m_allFloats[7] = transObj->m_cov[2] ;
78  persObj->m_allFloats[8] = transObj->m_cov[3] ;
79  persObj->m_allFloats[9] = transObj->m_cov[4] ;
80  persObj->m_allFloats[10] = transObj->m_cov[5] ;
81  persObj->m_allFloats[11] = transObj->m_energyFraction ;
82  persObj->m_allFloats[12] = transObj->m_chiSquared ;
83 
84  persObj->m_allInts[0] = transObj->m_nTwoTracksSecVtx ;
85  persObj->m_allInts[1] = transObj->m_nDOF ;
86  persObj->m_allInts[2] = transObj->m_algId ;
87 
88  if(transObj->m_tracks!=NULL ){
89 
90  TrackInVertexList L = *(transObj->m_tracks);
91  TrackInVertexList::const_iterator iBeg = L.begin();
92  TrackInVertexList::const_iterator iEnd = L.end();
93  m_trackInVertexVector.clear();
94  m_trackInVertexVector.reserve(L.size());
95 
96  for(; iBeg != iEnd; ++iBeg){
97  m_trackInVertexVector.push_back(*iBeg);
98  }
99 
100  //TrackInVertexVector::const_iterator iVBeg = m_trackInVertexVector.begin();
101  //TrackInVertexVector::const_iterator iVEnd = m_trackInVertexVector.end();
102 
104 
105  } else {
106  log << MSG::DEBUG << "TrigVertexCnv_p2::transToPers: No tracks associated to the vertex" << endmsg;
107  }
108 
109 }
TrigVertex::m_x
double m_x
Definition: TrigVertex.h:167
TrigVertex::m_mass
double m_mass
Definition: TrigVertex.h:167
TrigVertex_p2::m_allFloats
float m_allFloats[13]
Definition: TrigVertex_p2.h:47
TrigVertexCnv_p2.h
TrigVertex::m_chiSquared
double m_chiSquared
Definition: TrigVertex.h:178
TrigVertex::m_massVar
double m_massVar
Definition: TrigVertex.h:167
TrigVertex_p2
Definition: TrigVertex_p2.h:27
TrigVertex::m_algId
AlgoId m_algId
Definition: TrigVertex.h:181
TrigVertex::m_z
double m_z
Definition: TrigVertex.h:167
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigVertexCnv_p2::persToTrans
virtual void persToTrans(const TrigVertex_p2 *persObj, TrigVertex *transObj, MsgStream &log)
Definition: TrigVertexCnv_p2.cxx:14
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
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
TrigVertex::m_nDOF
int m_nDOF
Definition: TrigVertex.h:179
TrigVertex::m_y
double m_y
Definition: TrigVertex.h:167
TrigVertexCnv_p2::m_TrigInDetTrackVectorCnv
TrigInDetTrackVectorCnv_p3 m_TrigInDetTrackVectorCnv
Definition: TrigVertexCnv_p2.h:56
TrigVertexCnv_p2::transToPers
virtual void transToPers(const TrigVertex *transObj, TrigVertex_p2 *persObj, MsgStream &log)
Definition: TrigVertexCnv_p2.cxx:64
TrigVertexCnv_p2::m_trackInVertexVector
TrackInVertexVector m_trackInVertexVector
Definition: TrigVertexCnv_p2.h:57
TrigVertex::m_tracks
TrackInVertexList * m_tracks
Definition: TrigVertex.h:180
TrigVertex::m_cov
double m_cov[6]
Definition: TrigVertex.h:168
TrackInVertexList
std::list< const TrigInDetTrack * > TrackInVertexList
Definition: TrigVertex.h:26
TrigVertex.h
TrigVertex::m_nTwoTracksSecVtx
int m_nTwoTracksSecVtx
number of 2-track vertices
Definition: TrigVertex.h:172
TrigVertex
Definition: TrigVertex.h:28
TrigVertex_p2::m_allInts
int m_allInts[3]
Definition: TrigVertex_p2.h:48
DEBUG
#define DEBUG
Definition: page_access.h:11
TrigVertex_p2::m_tracks
std::vector< TPObjRef > m_tracks
Definition: TrigVertex_p2.h:50
TrigVertex::m_energyFraction
double m_energyFraction
energy ratio E(secondary vertex)/E(jet)
Definition: TrigVertex.h:170
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TrigVertex_p2.h
TrigVertex::AlgoId
AlgoId
Definition: TrigVertex.h:31
TrigVertex::m_ownTracks
bool m_ownTracks
Definition: TrigVertex.h:183