9unsigned long calEts(
const uint32_t* dptr)
11 unsigned int tmp = dptr[0] & 0xffffff;
12 unsigned long val = (tmp >> 16 ) * 61 * 61;
13 val += ((tmp >> 8) & 0xff) * 61;
16 val += (dptr[1] & 0x3fffff);
23 std::cout << std::hex;
24 for ( uint32_t i = 0; i <
n; ++i ) {
30 std::cout << std::endl;
32 std::cout <<
"0x" << std::setw(8) << std::setfill(
'0') <<
data[i];
34 std::cout << std::dec << std::endl;
37void processETS(
const uint32_t* dataPtr, uint32_t dataLen)
39 unsigned long t1 = 0, t2 = 0;
41 if ( dataLen > 11 && dataPtr[1] == 0xffffffff ) {
43 if ( (dataPtr[start] >> 24) == 0xcf ) {
44 t1 =
calEts( dataPtr + start );
46 static unsigned long _t2 = 0;
47 if ( (start+3) < dataLen && (dataPtr[start+2]>>24) == 0xd1 ) {
48 _t2 =
calEts( dataPtr + start + 2 );
54 std::cout <<
"t1 " << t1 <<
" t2 " << t2 << std::endl;
56 dump(dataPtr, dataLen);
59int main(
int argc,
char* argv[])
62 std::cout <<
"Usage: " << argv[0] <<
" file.data nevts" << std::endl;
66 const uint32_t** m_sds =
new const uint32_t*[64];
67 const uint32_t** m_robs =
new const uint32_t*[256];
69 int nevts = atoi( argv[2] );
73 for (
int i = 0; i < nevts; ++i ) {
75 uint32_t* dataptr =
NULL;
82 std::cout << i <<
" >> run: " <<
f.run_no() <<
" event: " <<
f.global_id() << std::endl;
85 int nsds =
f.children(m_sds, 64);
86 for (
int sdi = 0; sdi < nsds; ++sdi ) {
90 for (
int robi = 0; robi < nrobs; robi++) {
93 source_id_number <<= 8;
94 source_id_number >>= 24;
98 if ( source_id_number == 165 ) {
107 std::cout <<
"no ETS data found" << std::endl;
115 catch (std::exception& ex) {
116 std::cerr << std::endl <<
"Uncaught std exception: " << ex.what() << std::endl;
120 std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl;
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
unsigned long calEts(const uint32_t *dptr)
void processETS(const uint32_t *dataPtr, uint32_t dataLen)
void dump(const uint32_t *data, uint32_t n)
virtual void print() const
const uint32_t * nextEvent()