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