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