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
daqONCSEvent.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file daqONCSEvent.cc
1
#include <
daqONCSEvent.h
>
2
3
// the constructor first ----------------
4
daqONCSEvent::daqONCSEvent
(
int
* where,
const
int
length
5
,
const
int
irun,
const
int
etype,
const
int
evtseq)
6
{
7
event_base
= where;
8
evthdr
= (
evtdata_ptr
) where;
9
evthdr
->
evt_type
= etype;
10
max_length
=
length
;
11
prepare_next
(evtseq, irun);
12
}
13
14
15
int
daqONCSEvent::prepare_next
()
16
{
17
return
prepare_next
(-1,-1);
18
}
19
20
int
daqONCSEvent::prepare_next
(
const
int
evtseq,
const
int
irun)
21
{
22
// re-initialize the event header length
23
evthdr
->
evt_length
=
EVTHEADERLENGTH
;
24
25
// if < 0, just increment the current seq. number
26
if
( evtseq < 0 )
27
{
28
evthdr
->
evt_sequence
++;
29
}
30
else
31
{
32
evthdr
->
evt_sequence
= evtseq;
33
}
34
35
// if > 0, adjust the run number, else just keep it.
36
if
( irun > 0 )
37
{
38
evthdr
->
run_number
=irun;
39
}
40
// if > 0, adjust the run number, else just keep it.
41
evthdr
->
date
= 0;
42
evthdr
->
time
=
time
(0);
43
evthdr
->
reserved
[0] = 0;
44
evthdr
->
reserved
[1] = 0;
45
46
47
// reset the current data index, and the leftover counter
48
current
= 0;
49
left
=
max_length
-
EVTHEADERLENGTH
;
50
return
0;
51
}
52
53
54
int
daqONCSEvent::addSubevent
(
const
int
etype,
daq_device
*dev)
55
{
56
int
len;
57
58
len = dev->
put_data
( etype, &(
evthdr
->
data
[
current
]),
left
);
59
if
(
left
< 0) {
60
return
0;
61
}
62
evthdr
->
evt_length
+= len;
63
current
+= len;
64
left
-= len;
65
return
len;
66
}
67
68
69
int
daqONCSEvent::formatHeader
(
int
* where
70
,
const
int
id
71
,
const
int
hf
72
,
const
int
type
)
73
{
74
subevtdata_ptr
sevt = (
subevtdata_ptr
) where;
75
sevt->
sub_length
=
SEVTHEADERLENGTH
;
76
77
sevt->
sub_id
=
id
;
78
sevt->
sub_type
=
type
;
79
sevt->
sub_decoding
= hf;
80
sevt->
reserved
[0] = 0;
81
sevt->
reserved
[1] = 0;
82
return
4;
83
}
84
rcdaq
blob
master
daqONCSEvent.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:47
using
1.8.2 with
sPHENIX GitHub integration