BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
TrigSAF.cxx
Go to the documentation of this file.
1#include <iostream>
2#include "TrigEvent/TrigSAF.h"
3
4TrigSAF::TrigSAF(char* name)
5{
6 m_name = name;
7}
8
10{
11 for(int i = 0; i < 48; i++)
12 {
13 m_dataGroup1_One[i] = 0;
14 m_dataGroup1_Zero[i] = 0;
15 m_dataGroup2_One[i] = 0;
16 m_dataGroup2_Zero[i] = 0;
17 m_dataGroup3[i] = 0;
18 m_dataGroup4[i] = 0;
19 }
20}
21
22void TrigSAF::setSAFTrigData( uint32_t boardId, uint32_t window, uint32_t datasize, const uint32_t* data) {
23
24 if((boardId != 0xd2)&&(boardId != 0xd4)&&(boardId != 0xd6)) std::cerr << "ERROR: You set the wrong board data to TrigSAF!!!" << std::endl;
25
26 uint32_t jBegin = 0, jEnd = 0;
27 if(boardId == 0xd2) { jBegin = 32; jEnd = jBegin+16; } //SAF1
28 if(boardId == 0xd4) { jBegin = 16; jEnd = jBegin+16; } //SAF2
29 if(boardId == 0xd6) { jBegin = 0; jEnd = jBegin+16; } //SAF3
30
31 for(uint32_t i = 0; i < datasize; i++) {
32 uint32_t dataId = ((data[i] >> 16) & 0xFF);
33 for(uint32_t j = jBegin, mask = 1; j < jEnd; j++, mask <<= 1) {
34 if(dataId == 1) {
35 if((data[i] & mask) != 0) {
36 m_dataGroup1_One[j] += 1;
37 }
38 if(m_dataGroup1_One[j] == 0) m_dataGroup1_Zero[j] += 1;
39 }
40 if(dataId == 2) {
41 if((data[i] & mask) != 0) {
42 m_dataGroup2_One[j] += 1;
43 }
44 if(m_dataGroup2_One[j] == 0) m_dataGroup2_Zero[j] += 1;
45 }
46 if(dataId == 3) {
47 if((data[i] & mask) != 0) {
48 m_dataGroup3[j] = 1;
49 }
50 }
51 if(dataId == 4) {
52 if((data[i] & mask) != 0) {
53 m_dataGroup4[j] = 1;
54 }
55 }
56 }
57 }
58}
TTree * data
TrigSAF(char *name)
Definition: TrigSAF.cxx:4
void initialize()
Definition: TrigSAF.cxx:9
void setSAFTrigData(uint32_t boardId, uint32_t window, uint32_t datasize, const uint32_t *data)
Definition: TrigSAF.cxx:22