ATLAS Offline Software
Reconstruction
RecEventTPCnv
src
RecoTimingObjCnv_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
#include "
RecEventTPCnv/RecoTimingObjCnv_p1.h
"
7
8
#include <malloc.h>
9
10
#include <sys/time.h>
11
#include <sys/resource.h>
12
#include <unistd.h>
13
14
void
RecoTimingObjCnv_p1::persToTrans
(
const
RecoTimingObj_p1
* pers,
15
RecoTimingObj
* trans,
16
MsgStream&
msg
)
17
{
18
if
(
msg
.level() <=
MSG::DEBUG
)
19
msg
<<
MSG::DEBUG
<<
"Loading RecoTimingObj from persistent state.[start]"
<<
endmsg
;
20
trans->
m_readFromFile
=
true
;
21
trans->
m_isTimings
=pers->
m_isTimings
;
22
23
trans->clear();
24
trans->reserve(pers->
timings
.size());
25
for
(
unsigned
int
i
(0);
i
<pers->
timings
.size(); ++
i
)
26
trans->push_back( pers->
timings
[
i
] );
27
if
(
msg
.level() <=
MSG::DEBUG
)
28
msg
<<
MSG::DEBUG
<<
"Loading RecoTimingObj from persistent state.[end]"
<<
endmsg
;
29
return
;
30
}
31
32
void
RecoTimingObjCnv_p1::transToPers
(
const
RecoTimingObj
* trans,
33
RecoTimingObj_p1
* pers,
34
MsgStream&
msg
)
35
{
36
if
(
msg
.level() <=
MSG::DEBUG
)
37
msg
<<
MSG::DEBUG
<<
"Creating persistent state of RecoTimingObj.[start]"
<<
endmsg
;
38
if
( trans->
m_readFromFile
)
39
pers->
timings
.reserve(trans->size());
40
else
41
{
42
if
( trans->
m_isTimings
)
43
pers->
timings
.reserve(trans->size()+1);
44
else
45
pers->
timings
.reserve(trans->size()+2);
46
}
47
pers->
m_isTimings
=trans->
m_isTimings
;
48
49
for
(
unsigned
int
i
(0);
i
<trans->size(); ++
i
)
50
{
51
pers->
timings
.push_back( (*trans)[
i
] );
52
if
(
msg
.level() <=
MSG::DEBUG
)
53
msg
<<
MSG::DEBUG
<<
"Creating persistent state of RecoTimingObj.["
<<
i
<<
"] : "
<< (*trans)[
i
] <<
endmsg
;
54
}
55
if
( ! trans->
m_readFromFile
&& trans->size() > 0 )
56
{
57
float
f0(0);
58
float
f1
(0);
59
float
f2
(0);
60
61
if
( trans->size() > 0 )
62
f0=(*trans)[0];
63
if
( ! trans->
m_isTimings
)
64
{
65
if
( trans->size() > 1 )
66
f1
=(*trans)[1];
67
if
( trans->size() > 2 )
68
f2
=(*trans)[2];
69
}
70
71
if
( pers->
m_isTimings
)
72
{
73
struct
rusage
r
;
74
getrusage(RUSAGE_SELF, &
r
);
75
f0=
float
(
r
.ru_utime.tv_sec+
r
.ru_stime.tv_sec) +
float
(
r
.ru_utime.tv_usec+
r
.ru_stime.tv_usec)/1000000 - f0;
76
}
77
else
78
{
79
if
(
m_pagesize
==0)
80
m_pagesize
=sysconf(_SC_PAGESIZE);
81
unsigned
long
a0
(-1);
82
unsigned
long
a1(-1);
83
unsigned
long
a2(-1);
84
FILE *
proc
= fopen(
"/proc/self/statm"
,
"r"
);
85
if
(
proc
) {
86
fscanf(
proc
,
"%80lu %80lu %80lu"
, &
a0
, &a1, &a2);
87
fclose(
proc
);
88
}
89
f0=
float
(
a0
*
m_pagesize
)-f0;
90
f1
=
float
(a1*
m_pagesize
)-
f1
;
91
f2
=
float
(a2*
m_pagesize
)-
f2
;
92
}
93
pers->
timings
.push_back( f0 );
94
if
( ! pers->
m_isTimings
)
95
{
96
pers->
timings
.push_back(
f1
);
97
pers->
timings
.push_back(
f2
);
98
}
99
if
(
msg
.level() <=
MSG::DEBUG
)
100
msg
<<
MSG::DEBUG
<<
"Creating persistent state of RecoTimingObj.[end] : "
<< f0 <<
endmsg
;
101
}
102
if
(
msg
.level() <=
MSG::DEBUG
)
103
msg
<<
MSG::DEBUG
<<
"Creating persistent state of RecoTimingObj.[end]"
<<
endmsg
;
104
return
;
105
}
beamspotman.r
def r
Definition:
beamspotman.py:676
RecoTimingObj
Definition:
RecoTimingObj.h:13
RecoTimingObjCnv_p1::persToTrans
virtual void persToTrans(const RecoTimingObj_p1 *persObj, RecoTimingObj *transObj, MsgStream &msg)
Definition:
RecoTimingObjCnv_p1.cxx:14
RecoTimingObj_p1
Definition:
RecoTimingObj_p1.h:14
RecoTimingObj::m_readFromFile
bool m_readFromFile
Definition:
RecoTimingObj.h:18
RecoTimingObj_p1::m_isTimings
bool m_isTimings
Definition:
RecoTimingObj_p1.h:29
read_hist_ntuple.f2
f2
Definition:
read_hist_ntuple.py:20
lumiFormat.i
int i
Definition:
lumiFormat.py:85
endmsg
#define endmsg
Definition:
AnalysisConfig_Ntuple.cxx:63
RecoTimingObjCnv_p1::transToPers
virtual void transToPers(const RecoTimingObj *transObj, RecoTimingObj_p1 *persObj, MsgStream &msg)
Definition:
RecoTimingObjCnv_p1.cxx:32
a0
double a0
Definition:
globals.cxx:27
mc.proc
proc
Definition:
mc.PhPy8EG_A14NNPDF23_gg4l_example.py:22
RecoTimingObjCnv_p1.h
RecoTimingObj::m_isTimings
bool m_isTimings
Definition:
RecoTimingObj.h:24
RecoTimingObjCnv_p1::m_pagesize
unsigned long m_pagesize
Definition:
RecoTimingObjCnv_p1.h:26
DEBUG
#define DEBUG
Definition:
page_access.h:11
RecoTimingObj_p1::timings
std::vector< float > timings
Definition:
RecoTimingObj_p1.h:27
python.AutoConfigFlags.msg
msg
Definition:
AutoConfigFlags.py:7
readCCLHist.float
float
Definition:
readCCLHist.py:83
read_hist_ntuple.f1
f1
Definition:
read_hist_ntuple.py:4
Generated on Sat Jan 11 2025 21:16:50 for ATLAS Offline Software by
1.8.18