DataFormats
Scalers
src
BeamSpotOnline.cc
Go to the documentation of this file.
1
/*
2
* File: DataFormats/Scalers/src/BeamSpotOnline.cc (W.Badgett)
3
*/
4
5
#include "
DataFormats/Scalers/interface/BeamSpotOnline.h
"
6
#include "
DataFormats/Scalers/interface/ScalersRaw.h
"
7
#include <cstdio>
8
#include <ostream>
9
10
BeamSpotOnline::BeamSpotOnline
()
11
: trigType_(0),
12
eventID_(0),
13
sourceID_(0),
14
bunchNumber_(0),
15
version_(0),
16
collectionTime_(0, 0),
17
x_((
float
)0.0),
18
y_((
float
)0.0),
19
z_((
float
)0.0),
20
dxdz_((
float
)0.0),
21
dydz_((
float
)0.0),
22
err_x_((
float
)0.0),
23
err_y_((
float
)0.0),
24
err_z_((
float
)0.0),
25
err_dxdz_((
float
)0.0),
26
err_dydz_((
float
)0.0),
27
width_x_((
float
)0.0),
28
width_y_((
float
)0.0),
29
sigma_z_((
float
)0.0),
30
err_width_x_((
float
)0.0),
31
err_width_y_((
float
)0.0),
32
err_sigma_z_((
float
)0.0) {}
33
34
BeamSpotOnline::BeamSpotOnline
(
const
unsigned
char
*
rawData
) {
35
BeamSpotOnline
();
36
37
struct
ScalersEventRecordRaw_v4
const
* raw = reinterpret_cast<struct ScalersEventRecordRaw_v4 const*>(
rawData
);
38
trigType_
= (raw->
header
>> 56) & 0xFULL;
39
eventID_
= (raw->
header
>> 32) & 0x00FFFFFFULL;
40
sourceID_
= (raw->
header
>> 8) & 0x00000FFFULL;
41
bunchNumber_
= (raw->
header
>> 20) & 0xFFFULL;
42
43
version_
= raw->
version
;
44
if
(
version_
>= 4) {
45
collectionTime_
.
set_tv_sec
(static_cast<long>(raw->
beamSpotOnline
.
collectionTime_sec
));
46
collectionTime_
.
set_tv_nsec
(raw->
beamSpotOnline
.
collectionTime_nsec
);
47
x_
= raw->
beamSpotOnline
.
x
;
48
y_
= raw->
beamSpotOnline
.
y
;
49
z_
= raw->
beamSpotOnline
.
z
;
50
dxdz_
= raw->
beamSpotOnline
.
dxdz
;
51
dydz_
= raw->
beamSpotOnline
.
dydz
;
52
err_x_
= raw->
beamSpotOnline
.
err_x
;
53
err_y_
= raw->
beamSpotOnline
.
err_y
;
54
err_z_
= raw->
beamSpotOnline
.
err_z
;
55
err_dxdz_
= raw->
beamSpotOnline
.
err_dxdz
;
56
err_dydz_
= raw->
beamSpotOnline
.
err_dydz
;
57
width_x_
= raw->
beamSpotOnline
.
width_x
;
58
width_y_
= raw->
beamSpotOnline
.
width_y
;
59
sigma_z_
= raw->
beamSpotOnline
.
sigma_z
;
60
err_width_x_
= raw->
beamSpotOnline
.
err_width_x
;
61
err_width_y_
= raw->
beamSpotOnline
.
err_width_y
;
62
err_sigma_z_
= raw->
beamSpotOnline
.
err_sigma_z
;
63
}
64
}
65
66
BeamSpotOnline::~BeamSpotOnline
() {}
67
69
std::ostream&
operator<<
(std::ostream&
s
,
const
BeamSpotOnline
&
c
) {
70
char
zeit[128];
71
constexpr
size_t
kLineBufferSize = 157;
72
char
line
[kLineBufferSize];
73
struct
tm* hora;
74
75
s
<<
"BeamSpotOnline Version: "
<<
c
.version() <<
" SourceID: "
<<
c
.sourceID() << std::endl;
76
77
timespec ts =
c
.collectionTime();
78
hora = gmtime(&ts.tv_sec);
79
strftime(zeit,
sizeof
(zeit),
"%Y.%m.%d %H:%M:%S"
, hora);
80
snprintf(
line
, kLineBufferSize,
" CollectionTime: %s.%9.9d"
, zeit, (
int
)ts.tv_nsec);
81
s
<<
line
<< std::endl;
82
83
snprintf(
line
,
84
kLineBufferSize,
85
" TrigType: %d EventID: %d BunchNumber: %d"
,
86
c
.trigType(),
87
c
.eventID(),
88
c
.bunchNumber());
89
s
<<
line
<< std::endl;
90
91
snprintf(
92
line
, kLineBufferSize,
" x: %e +/- %e width: %e +/- %e"
,
c
.x(),
c
.err_x(),
c
.width_x(),
c
.err_width_x());
93
s
<<
line
<< std::endl;
94
95
snprintf(
96
line
, kLineBufferSize,
" y: %e +/- %e width: %e +/- %e"
,
c
.y(),
c
.err_y(),
c
.width_y(),
c
.err_width_y());
97
s
<<
line
<< std::endl;
98
99
snprintf(
100
line
, kLineBufferSize,
" z: %e +/- %e sigma: %e +/- %e"
,
c
.z(),
c
.err_z(),
c
.sigma_z(),
c
.err_sigma_z());
101
s
<<
line
<< std::endl;
102
103
snprintf(
104
line
, kLineBufferSize,
" dxdy: %e +/- %e dydz: %e +/- %e"
,
c
.dxdz(),
c
.err_dxdz(),
c
.dydz(),
c
.err_dydz());
105
s
<<
line
<< std::endl;
106
return
s
;
107
}
BeamSpotOnline::~BeamSpotOnline
virtual ~BeamSpotOnline()
Definition:
BeamSpotOnline.cc:66
BeamSpotOnline::trigType_
unsigned int trigType_
Definition:
BeamSpotOnline.h:72
ScalersEventRecordRaw_v4
Definition:
ScalersRaw.h:210
BeamSpotOnline::BeamSpotOnline
BeamSpotOnline()
Definition:
BeamSpotOnline.cc:10
dqmMemoryStats.float
float
Definition:
dqmMemoryStats.py:127
BeamSpotOnlineRaw_v4::err_y
float err_y
Definition:
ScalersRaw.h:161
BeamSpotOnline::collectionTime_
TimeSpec collectionTime_
Definition:
BeamSpotOnline.h:79
BeamSpotOnline::bunchNumber_
unsigned int bunchNumber_
Definition:
BeamSpotOnline.h:75
BeamSpotOnlineRaw_v4::err_sigma_z
float err_sigma_z
Definition:
ScalersRaw.h:170
BeamSpotOnlineRaw_v4::err_width_x
float err_width_x
Definition:
ScalersRaw.h:168
BeamSpotOnline::err_width_x_
float err_width_x_
Definition:
BeamSpotOnline.h:93
BeamSpotOnline::width_y_
float width_y_
Definition:
BeamSpotOnline.h:91
BeamSpotOnline::sourceID_
unsigned int sourceID_
Definition:
BeamSpotOnline.h:74
BeamSpotOnline::z_
float z_
Definition:
BeamSpotOnline.h:82
BeamSpotOnline::err_dxdz_
float err_dxdz_
Definition:
BeamSpotOnline.h:88
BeamSpotOnlineRaw_v4::collectionTime_nsec
unsigned int collectionTime_nsec
Definition:
ScalersRaw.h:154
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition:
l1tstage2_dqm_sourceclient-live_cfg.py:163
BeamSpotOnline::eventID_
unsigned int eventID_
Definition:
BeamSpotOnline.h:73
TimeSpec::set_tv_nsec
void set_tv_nsec(long value)
Definition:
TimeSpec.h:19
BeamSpotOnline.h
ScalersRaw.h
watchdog.const
const
Definition:
watchdog.py:83
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
TimeSpec::set_tv_sec
void set_tv_sec(long value)
Definition:
TimeSpec.h:18
BeamSpotOnline::y_
float y_
Definition:
BeamSpotOnline.h:81
BeamSpotOnlineRaw_v4::z
float z
Definition:
ScalersRaw.h:157
BeamSpotOnline::x_
float x_
Definition:
BeamSpotOnline.h:80
BeamSpotOnlineRaw_v4::err_z
float err_z
Definition:
ScalersRaw.h:162
BeamSpotOnline::err_width_y_
float err_width_y_
Definition:
BeamSpotOnline.h:94
BeamSpotOnline::sigma_z_
float sigma_z_
Definition:
BeamSpotOnline.h:92
BeamSpotOnlineRaw_v4::dydz
float dydz
Definition:
ScalersRaw.h:159
operator<<
std::ostream & operator<<(std::ostream &s, const BeamSpotOnline &c)
Pretty-print operator for BeamSpotOnline.
Definition:
BeamSpotOnline.cc:69
BeamSpotOnline::dydz_
float dydz_
Definition:
BeamSpotOnline.h:84
BeamSpotOnlineRaw_v4::width_y
float width_y
Definition:
ScalersRaw.h:166
BeamSpotOnlineRaw_v4::sigma_z
float sigma_z
Definition:
ScalersRaw.h:167
BeamSpotOnlineRaw_v4::collectionTime_sec
unsigned int collectionTime_sec
Definition:
ScalersRaw.h:153
BeamSpotOnlineRaw_v4::y
float y
Definition:
ScalersRaw.h:156
BeamSpotOnline::width_x_
float width_x_
Definition:
BeamSpotOnline.h:90
BeamSpotOnline::err_dydz_
float err_dydz_
Definition:
BeamSpotOnline.h:89
BeamSpotOnlineRaw_v4::err_x
float err_x
Definition:
ScalersRaw.h:160
BeamSpotOnline::err_y_
float err_y_
Definition:
BeamSpotOnline.h:86
BeamSpotOnline::err_z_
float err_z_
Definition:
BeamSpotOnline.h:87
BeamSpotOnline::err_sigma_z_
float err_sigma_z_
Definition:
BeamSpotOnline.h:95
BeamSpotOnline
Definition:
BeamSpotOnline.h:28
BeamSpotOnlineRaw_v4::err_width_y
float err_width_y
Definition:
ScalersRaw.h:169
ScalersEventRecordRaw_v4::header
unsigned long long header
Definition:
ScalersRaw.h:211
ScalersEventRecordRaw_v4::version
int version
Definition:
ScalersRaw.h:212
BeamSpotOnline::err_x_
float err_x_
Definition:
BeamSpotOnline.h:85
BeamSpotOnlineRaw_v4::err_dxdz
float err_dxdz
Definition:
ScalersRaw.h:163
ScalersEventRecordRaw_v4::beamSpotOnline
struct BeamSpotOnlineRaw_v4 beamSpotOnline
Definition:
ScalersRaw.h:215
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
BeamSpotOnlineRaw_v4::dxdz
float dxdz
Definition:
ScalersRaw.h:158
mps_splice.line
line
Definition:
mps_splice.py:76
BeamSpotOnlineRaw_v4::err_dydz
float err_dydz
Definition:
ScalersRaw.h:164
BeamSpotOnline::version_
int version_
Definition:
BeamSpotOnline.h:77
BeamSpotOnline::dxdz_
float dxdz_
Definition:
BeamSpotOnline.h:83
BeamSpotOnlineRaw_v4::x
float x
Definition:
ScalersRaw.h:155
BeamSpotOnlineRaw_v4::width_x
float width_x
Definition:
ScalersRaw.h:165
Generated for CMSSW Reference Manual by
1.8.16