Belle II Software  release-08-01-10
RawCOPPERFormat_v1.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <rawdata/dataobjects/RawCOPPERFormat_v1.h>
10 
11 
12 using namespace std;
13 using namespace Belle2;
14 
15 //#define DESY
16 //#define NO_DATA_CHECK
17 //#define WO_FIRST_EVENUM_CHECK
18 
19 //ClassImp(RawCOPPERFormat_v1);
20 
21 RawCOPPERFormat_v1::RawCOPPERFormat_v1()
22 {
23 }
24 
25 RawCOPPERFormat_v1::~RawCOPPERFormat_v1()
26 {
27 }
28 
29 int RawCOPPERFormat_v1::GetNumFINESSEBlock(int n)
30 {
31  int cnt = 0;
32  for (int i = 0; i < 4; i++) {
33  if (GetFINESSENwords(n, i) > 0) {
34  cnt++;
35  }
36  }
37  return cnt;
38 }
39 
40 #ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
41 void RawCOPPERFormat_v1::CheckB2LFEEHeaderVersion(int n)
42 {
43 
44  int* temp_buf;
45 
46  for (int i = 0; i < 4; i++) {
47  if (GetFINESSENwords(n, i) > 0) {
48  temp_buf = GetFINESSEBuffer(n, i);
49  if ((temp_buf[ 3 ] & 0x40000000) == 0) {
50 #ifdef TEMP
51  // this word for exp/run
52  // old one (ver.1) used for SPring8 test in 2013
53  printf("[DEBUG] \033[31m");
54  printf("[DEBUG] ===Firmware ver. ERROR===\n ");
55  printf("[DEBUG] FTSW and b2tt firmwares was updated on Nov.22, 2013 and the header format attached by B2link was changed in the new firmwares.\n");
56  printf("[DEBUG] If you are going to take data now, Please update the firmware.\n");
57  printf("[DEBUG] For details, please see Nakao-san's e-mail [b2link_ml:0111] Re: [daq2ml:0159] beta version of trigger timing receiver firmware (b2tt) on bdaq SVN\n");
58  printf("[DEBUG] Or if you are going to read data taken before the update, please use basf2 software before rev. 7419\n");
59  printf("[DEBUG] About the format please see Nakao-san's B2GM slides(p. 13 and 15) http://kds.kek.jp/getFile.py/access?contribId=143&sessionId=38&resId=0&materialId=slides&confId=13911.\n");
60  printf("[DEBUG] Sorry for inconvenience.\n");
61  printf("[DEBUG] \033[0m");
62  fflush(stderr);
63  char err_buf[500];
64  sprintf(err_buf, "FTSW and b2tt firmwares are old. Exiting...\n %s %s %d\n",
65  __FILE__, __PRETTY_FUNCTION__, __LINE__);
66  printf("%s", err_buf); fflush(stdout);
67  B2FATAL(err_buf);
68 #endif
69  } else {
70  // this word for 32bit unixtime
71  // new one (ver.2)
72  break;
73  }
74  }
75 
76  if (i == 3) {
77 #ifdef TEMP
78  char err_buf[500];
79  sprintf(err_buf, "RawCOPPERFormat_v1 contains no FINESSE data. Exiting...\n %s %s %d\n",
80  __FILE__, __PRETTY_FUNCTION__, __LINE__);
81  printf("%s", err_buf); fflush(stdout);
82  B2FATAL(err_buf);
83 #endif
84  }
85  }
86  return;
87 }
88 #endif
Abstract base class for different kinds of events.