Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
packet_cdevwcm.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file packet_cdevwcm.cc
1
#include <
packet_cdevwcm.h
>
2
3
4
Packet_cdevwcm::Packet_cdevwcm
(
PACKET_ptr
data
)
5
:
Packet_w4
(data)
6
{
7
ps
= 0;
8
numberofreadings
= 0;
9
}
10
11
int
*
Packet_cdevwcm::decode
(
int
*nwout)
12
{
13
14
int
i
;
15
if
(
ps
!= 0)
return
0;
16
17
int
*
k
= (
int
*)
findPacketDataStart
(
packet
);
18
if
(k == 0)
19
{
20
ps
= 0;
21
*nwout = 0;
22
return
0;
23
}
24
numberofreadings
= k[0];
25
26
ps
= (
struct
cdevWCMHistory
*) k;
27
28
if
(numberofreadings < 0 || numberofreadings >100)
return
0;
29
30
for
( i = 0; i<
numberofreadings
; i++)
31
{
32
fix_endianess
(&(
ps
->
reading
[i].
beamcurrent
));
33
34
}
35
36
*nwout = 0;
37
38
return
0;
39
}
40
41
42
// ------------------------------------------------------
43
44
45
void
Packet_cdevwcm::dump
(
OSTREAM
&
os
)
46
{
47
48
int
i
,
j
;
49
50
decode
(&i);
51
52
this->
identify
(os);
53
54
os <<
"Number of samples "
<<
numberofreadings
<< std::endl;
55
for
( i = 0; i <
numberofreadings
; i++)
56
{
57
os <<
"Beam current for Sample "
<< std::setw(3) << i <<
" "
58
<< std::setw(12) <<
ps
->
reading
[
i
].
beamcurrent
<<
59
" Time: "
<< std::setw(8) <<
ps
->
reading
[
i
].
cdevCaptureTimeStamp
<< std::endl;
60
}
61
62
63
for
( i = 0; i <
numberofreadings
; i++)
64
{
65
os <<
" --- Bunch current values for Sample "
<< std::setw(3) << i << std::endl;
66
67
for
(j=0; j< 360; j++)
68
{
69
if
(
ps
->
reading
[i].
bunchcurrent
[j])
70
{
71
os << std::setw(3) << i <<
" "
<< std::setw(4) << j <<
" "
<<
72
ps
->
reading
[
i
].
bunchcurrent
[
j
] << std::endl;
73
}
74
}
75
}
76
77
78
dumpErrorBlock
(os);
79
dumpDebugBlock
(os);
80
}
81
82
int
Packet_cdevwcm::iValue
(
const
int
ich,
const
char
*what)
83
{
84
85
86
int
i
;
87
decode
(&i);
88
89
if
( strcmp(what,
"SAMPLES"
) == 0 )
return
numberofreadings
;
90
if
( strcmp(what,
"TIMESTAMP"
) == 0 )
91
{
92
93
if
(ich < 0 || ich >=
numberofreadings
)
return
0;
94
return
ps
->
reading
[ich].
cdevCaptureTimeStamp
;
95
96
}
97
98
std::cout <<
"packet_cdevwcm::iValue error unknown datum: "
<< what << std::endl;
99
return
0;
100
101
}
102
103
104
float
Packet_cdevwcm::rValue
(
const
int
ich,
const
char
*what)
105
{
106
107
108
int
i
;
109
decode
(&i);
110
111
if
( strcmp(what,
"SAMPLES"
) == 0 )
return
numberofreadings
;
112
113
if
( strcmp(what,
"BEAMCURRENT"
) == 0 )
114
{
115
116
if
(ich < 0 || ich >=
numberofreadings
)
return
0;
117
return
ps
->
reading
[ich].
beamcurrent
;
118
119
}
120
121
std::cout <<
"packet_cdevwcm::rValue error unknown datum: "
<< what << std::endl;
122
return
0;
123
124
}
125
126
float
Packet_cdevwcm::rValue
(
const
int
ich,
const
int
y
)
127
{
128
129
130
int
i
;
131
decode
(&i);
132
133
if
(ich < 0 || ich >=
numberofreadings
)
return
0;
134
if
(y < 0 || y >= 360)
return
0;
135
136
return
ps
->
reading
[ich].
bunchcurrent
[
y
];
137
138
}
139
140
141
142
online_distribution
blob
master
newbasic
packet_cdevwcm.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:27
using
1.8.2 with
sPHENIX GitHub integration