From fd9ab176aa360f16def68ecbffbbade7215ce2e3 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Tue, 25 Jun 2019 07:13:43 -0500 Subject: [PATCH 01/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 53 +++++++++++++++------ 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 9114820..4c24d6c 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -15,7 +15,8 @@ class VFATdata uint16_t fcrc_calc; ///> 56); - fCRCcheck = 0xff & (word >> 48); - fHeader = 0xff & (word >> 40); - fEC = 0xff & (word >> 32); - fBC = 0xffff & (word >> 16); - fmsData = 0xffff000000000000 & (word << 48); + switch(c){ + case 1:fPos = 0x3f & (word >> 56); + fCRCcheck = 0xff & (word >> 48); + fHeader = 0xff & (word >> 40); + fEC = 0xff & (word >> 32); + fBC = 0xffff & (word >> 16); + fmsData = 0xffff000000000000 & (word << 48); + break; + case 2:fPos = 0x3f & (word >> 56); + fCRCcheck = 0xff & (word >> 48); + fHeader = 0xff & (word >> 40); + fEC = 0xff & (word >> 32); + fBC = 0xffff & (word >> 16); + //fmsData = 0xffff000000000000 & (word << 48); + controlData = word << 16 + break; + } } //!Read second word from the block. - void read_sw(uint64_t word) + void read_sw(uint64_t word, int c) { - fmsData = fmsData | (0x0000ffffffffffff & word >> 16); - flsData = 0xffff000000000000 & (word << 48); + switch(c){ + case 1:fmsData = fmsData | (0x0000ffffffffffff & word >> 16); + flsData = 0xffff000000000000 & (word << 48); + break; + case 2: + if(){fcrc = 0xffff & word;} + break; + } + + } //!Read third word from the block. - void read_tw(uint64_t word) + void read_tw(uint64_t word,int c) { - flsData = flsData | (0x0000ffffffffffff & word >> 16); - fcrc = 0xffff & word; + switch(c){ + case 1:flsData = flsData | (0x0000ffffffffffff & word >> 16); + fcrc = 0xffff & word; + break; + case 2: break; + + } } uint8_t Pos (){ return fPos; } From 584957e2f3deaa0ffbf618a99e47b89064a0d213 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Wed, 26 Jun 2019 06:02:36 -0500 Subject: [PATCH 02/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 4c24d6c..59f9808 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -16,7 +16,8 @@ class VFATdata int fSlotNumber; ///> 56); + //The method is exactly the same as before, except the laft 16 bits of line 1 are not vfat data, but + //a 16 bit number with bits indicating which packet is populated with anything (8 channels for a packet) fCRCcheck = 0xff & (word >> 48); fHeader = 0xff & (word >> 40); fEC = 0xff & (word >> 32); @@ -75,9 +78,21 @@ class VFATdata case 1:fmsData = fmsData | (0x0000ffffffffffff & word >> 16); flsData = 0xffff000000000000 & (word << 48); break; - case 2: - if(){fcrc = 0xffff & word;} - break; + case 2:count=0; + //This populates an array of 8 bit numbers whose length corresponds to the number of packets. + uint16_t helper=controlData; + int i=0; + while (helper > 0) { + count += helper & 1; + helper >>= 1; + } + while(count>0){ + packets[i] = (word >> 64-(i+1)*8); + i+=1; + count-=1; + if(i*8==56){break;} + } + } From b3d5e885db7174693e5dada59fd35906be802672 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Wed, 26 Jun 2019 06:18:41 -0500 Subject: [PATCH 03/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 59f9808..c77ac74 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -66,7 +66,7 @@ class VFATdata fEC = 0xff & (word >> 32); fBC = 0xffff & (word >> 16); //fmsData = 0xffff000000000000 & (word << 48); - controlData = word << 16 + controlData = word break; } } From 7e8725234b93ed6d34cb0461033fc6ae4b379e6a Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Thu, 27 Jun 2019 03:15:42 -0500 Subject: [PATCH 04/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index c77ac74..9b65feb 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -18,7 +18,8 @@ class VFATdata uint16_t controlData; ///> 32); fBC = 0xffff & (word >> 16); //fmsData = 0xffff000000000000 & (word << 48); - controlData = word + controlData = 0xffff & word break; } } @@ -81,17 +82,18 @@ class VFATdata case 2:count=0; //This populates an array of 8 bit numbers whose length corresponds to the number of packets. uint16_t helper=controlData; - int i=0; while (helper > 0) { count += helper & 1; helper >>= 1; } + int i=0 while(count>0){ - packets[i] = (word >> 64-(i+1)*8); - i+=1; + packets[i] =0xffff & (word >> 64-(counter2+1)*8); + counter2+=1; count-=1; - if(i*8==56){break;} + if(counter2*8==56){break;} } + break; } @@ -105,8 +107,7 @@ class VFATdata case 1:flsData = flsData | (0x0000ffffffffffff & word >> 16); fcrc = 0xffff & word; break; - case 2: break; - + case 2: } } From b6fef93d3ff6bd0bed062cdd0ddd78bd40d199a1 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Thu, 27 Jun 2019 04:25:04 -0500 Subject: [PATCH 05/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 55 ++++++++++++++++----- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 9b65feb..0aa8def 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -18,7 +18,9 @@ class VFATdata uint16_t controlData; ///0){ - packets[i] =0xffff & (word >> 64-(counter2+1)*8); - counter2+=1; + packets[i] = 0xffff & (word >> 64-(i+1)*8); + i+=1; count-=1; - if(counter2*8==56){break;} + if((i*8==56&&count==0)){need3=1;} + if((i*8==64&&count==0)){need3=2;} + //need3 will take 0 if third line not needed, 1 if needed just to read of half of crc,2 if all, 3 if needed for data and crc + if(i*8==64){break;} } - break; - - } - - + if(i<7){fcrc = 0xffff & word;need3=0;break;}//In case we don't even need a third line + fcrc= 0xffff & (word << 8);//In case it cuts it off + break; + } } - //!Read third word from the block. void read_tw(uint64_t word,int c) { @@ -107,10 +110,38 @@ class VFATdata case 1:flsData = flsData | (0x0000ffffffffffff & word >> 16); fcrc = 0xffff & word; break; - case 2: + case 2: + if(need3==1){fcrc=fcrc|(0xff & word >> 56);break;}//If it was cut off before + if(need3==2){fcrc=0xffff & (word >> 48);break;}//If we just barely needed the full line + if(need3==3){ + int i=0; + while(count>0){ + packets[i+8] = 0xff & (word >> 64-(i+1)*8); + i+=1; + count-=1; + if(i*8==56){need4=1;}//Takes 0 if 4rth line not needed, Takes 1 if 1/2 crc needed, Takes 2 otherwise + if(i*8==64){need4=2;break;} + } + if(0> 64-(i+2)*8);}//In case the whole word stays in + if(i*8==56){fcrc= 0xffff & (word << 8)};//In case it cuts it off + break; + } + break; } } - + void read_4w(uint64_t word) + { + if(need4==1){fcrc=fcrc|(0xff & word >> 56);break;}//if it had previously cut it off before + fcrc=0xffff & (word >> 48); + break; + } + int getNeed3(){ + return need3; + } + int getNeed4(){ + return need4; + } + uint8_t Pos (){ return fPos; } uint16_t BC (){ return fBC; } uint8_t Header (){ return fHeader; } From 1eeb1fb44a75362121eb4cfaea7f54561c48a27a Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Thu, 27 Jun 2019 04:36:11 -0500 Subject: [PATCH 06/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index c281ec5..a4d046f 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -110,15 +110,21 @@ class GEMUnpacker std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 1\n"); //printf("%016llX\n", m_word); - m_vfatdata->read_fw(m_word); + int helper=2 + m_vfatdata->read_fw(m_word,helper); std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 2\n"); //printf("%016llX\n", m_word); - m_vfatdata->read_sw(m_word); - std::fread(&m_word, sizeof(uint64_t), 1, m_file); + m_vfatdata->read_sw(m_word,helper); + if(getNeed3()>0||helper==1){ + std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 3\n"); //printf("%016llX\n", m_word); - m_vfatdata->read_tw(m_word); + m_vfatdata->read_tw(m_word);} + if(getNeed4()>0){ + std::fread(&m_word, sizeof(uint64_t), 1, m_file); + m_vfatdata->read_4w(m_word); + } // //printf("VFAT MS Data 3\n"); //printf("%016llX\n", m_vfatdata->msData()); From 30e3c4d5557b33fb7029247857bb492d8adbd2f1 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 06:08:48 -0500 Subject: [PATCH 07/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 119 +++++++++----------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 0aa8def..69dcaf6 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -20,6 +20,7 @@ class VFATdata uint8_t packets[16]; ///> 56); - fCRCcheck = 0xff & (word >> 48); - fHeader = 0xff & (word >> 40); - fEC = 0xff & (word >> 32); - fBC = 0xffff & (word >> 16); - fmsData = 0xffff000000000000 & (word << 48); - break; - case 2:fPos = 0x3f & (word >> 56); - //The method is exactly the same as before, except the laft 16 bits of line 1 are not vfat data, but - //a 16 bit number with bits indicating which packet is populated with anything (8 channels for a packet) - fCRCcheck = 0xff & (word >> 48); - fHeader = 0xff & (word >> 40); - fEC = 0xff & (word >> 32); - fBC = 0xffff & (word >> 16); - //fmsData = 0xffff000000000000 & (word << 48); - controlData = 0xffff & word - break; + suppression = 0x4 & (word >> 61); + fPos = 0x3f & (word >> 56); + fCRCcheck = 0xff & (word >> 48); + fHeader = 0xff & (word >> 40); + fEC = 0xff & (word >> 32); + fBC = 0xffff & (word >> 16); + if(suppression< 0x4){ + fmsData = 0xffff000000000000 & (word << 48); + return; } + //fmsData = 0xffff000000000000 & (word << 48); + controlData = 0xffff & word//a 16 bit number with bits indicating which packet is populated with anything (8 channels for a packet) } //!Read second word from the block. void read_sw(uint64_t word, int c) { - switch(c){ - case 1:fmsData = fmsData | (0x0000ffffffffffff & word >> 16); - flsData = 0xffff000000000000 & (word << 48); - break; - case 2:count=0; - //This populates an array of 8 bit numbers whose length corresponds to the number of packets. - uint16_t helper=controlData; - while (helper > 0) { - count += helper & 1; - helper >>= 1; - } - int i=0 - while(count>0){ - packets[i] = 0xffff & (word >> 64-(i+1)*8); - i+=1; - count-=1; - if((i*8==56&&count==0)){need3=1;} - if((i*8==64&&count==0)){need3=2;} - //need3 will take 0 if third line not needed, 1 if needed just to read of half of crc,2 if all, 3 if needed for data and crc - if(i*8==64){break;} - } - if(i<7){fcrc = 0xffff & word;need3=0;break;}//In case we don't even need a third line - fcrc= 0xffff & (word << 8);//In case it cuts it off - break; - } + if(suppression< 0x4){ + fmsData = fmsData | (0x0000ffffffffffff & word >> 16); + flsData = 0xffff000000000000 & (word << 48); + return; + } + count=0; + //This populates an array of 8 bit numbers whose length corresponds to the number of packets. + uint16_t helper=controlData; + while (helper > 0) { + count += helper & 1; + helper >>= 1; + } + int i=0; + while(count>0){ + packets[i] = 0xffff & (word >> 64-(i+1)*8); + i+=1; + count-=1; + if((i*8==56&&count==0)){need3=1;} + if((i*8==64&&count==0)){need3=2;} + //need3 will take 0 if third line not needed, 1 if needed just to read of half of crc,2 if all, 3 if needed for data and crc + if(i*8==64){break;} + } + if(i<7){fcrc = 0xffff & word;need3=0;break;}//In case we don't even need a third line + fcrc= 0xffff & (word << 8);//In case it cuts it off } //!Read third word from the block. void read_tw(uint64_t word,int c) { - switch(c){ - case 1:flsData = flsData | (0x0000ffffffffffff & word >> 16); - fcrc = 0xffff & word; - break; - case 2: - if(need3==1){fcrc=fcrc|(0xff & word >> 56);break;}//If it was cut off before - if(need3==2){fcrc=0xffff & (word >> 48);break;}//If we just barely needed the full line - if(need3==3){ - int i=0; - while(count>0){ - packets[i+8] = 0xff & (word >> 64-(i+1)*8); - i+=1; - count-=1; - if(i*8==56){need4=1;}//Takes 0 if 4rth line not needed, Takes 1 if 1/2 crc needed, Takes 2 otherwise - if(i*8==64){need4=2;break;} - } - if(0> 64-(i+2)*8);}//In case the whole word stays in - if(i*8==56){fcrc= 0xffff & (word << 8)};//In case it cuts it off - break; - } - break; + if(suppression< 0x4){ + flsData = flsData | (0x0000ffffffffffff & word >> 16); + fcrc = 0xffff & word; + break; + return; + } + if(need3==1){fcrc=fcrc|(0xff & word >> 56);return;}//If it was cut off before + if(need3==2){fcrc=0xffff & (word >> 48);return;}//If we just barely needed the full line + if(need3==3){ + int i=0; + while(count>0){ + packets[i+8] = 0xff & (word >> 64-(i+1)*8); + i+=1; + count-=1; + if(i*8==56){need4=1;}//Takes 0 if 4rth line not needed, Takes 1 if 1/2 crc needed, Takes 2 otherwise + if(i*8==64){need4=2;break;} + } + if(0> 64-(i+2)*8);}//In case the whole word stays in + if(i*8==56){fcrc= 0xffff & (word << 8)};//In case it cuts it off } } void read_4w(uint64_t word) From 8e20ae5a893f017dd099df99a5ae8ef1ce2c789d Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 06:23:00 -0500 Subject: [PATCH 08/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 69dcaf6..b8e84a9 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -71,7 +71,13 @@ class VFATdata //!Read second word from the block. void read_sw(uint64_t word, int c) { - if(suppression< 0x4){ + if(suppression<4){ + if(suppression>=1){//Package suppression + + if(suppression==1){//Data Suppression + + } + } fmsData = fmsData | (0x0000ffffffffffff & word >> 16); flsData = 0xffff000000000000 & (word << 48); return; From 354d5bf6261091b28771718991becaf9848ac5c1 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 08:41:14 -0500 Subject: [PATCH 09/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index b8e84a9..d4870e9 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -18,6 +18,7 @@ class VFATdata uint16_t controlData; ///> 56); fCRCcheck = 0xff & (word >> 48); fHeader = 0xff & (word >> 40); + if((suppression==2||suppression==3||suppression==6||suppression==7)&&Empty){need2=1;return;}//Package suppression + if((suppression==1||suppression==5)&&Empty){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;need2=1;return;}//Data Suppression fEC = 0xff & (word >> 32); fBC = 0xffff & (word >> 16); if(suppression< 0x4){ @@ -72,12 +75,6 @@ class VFATdata void read_sw(uint64_t word, int c) { if(suppression<4){ - if(suppression>=1){//Package suppression - - if(suppression==1){//Data Suppression - - } - } fmsData = fmsData | (0x0000ffffffffffff & word >> 16); flsData = 0xffff000000000000 & (word << 48); return; @@ -132,6 +129,9 @@ class VFATdata fcrc=0xffff & (word >> 48); break; } + int getNeed2(){ + return need2; + } int getNeed3(){ return need3; } From 05919bc75c96d4b6c64b8be41ac607f3271dd879 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 08:45:19 -0500 Subject: [PATCH 10/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index a4d046f..f7290f3 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -110,13 +110,13 @@ class GEMUnpacker std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 1\n"); //printf("%016llX\n", m_word); - int helper=2 - m_vfatdata->read_fw(m_word,helper); + m_vfatdata->read_fw(m_word); + if(getNeed2()>0){ std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 2\n"); //printf("%016llX\n", m_word); - m_vfatdata->read_sw(m_word,helper); - if(getNeed3()>0||helper==1){ + m_vfatdata->read_sw(m_word);} + if(getNeed3()>0){ std::fread(&m_word, sizeof(uint64_t), 1, m_file); //printf("VFAT WORD 3\n"); //printf("%016llX\n", m_word); From a3f812378cbe438b06923c6a85cd91cf6f108e37 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 08:48:05 -0500 Subject: [PATCH 11/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index d4870e9..db3b2b6 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -59,8 +59,9 @@ class VFATdata fPos = 0x3f & (word >> 56); fCRCcheck = 0xff & (word >> 48); fHeader = 0xff & (word >> 40); - if((suppression==2||suppression==3||suppression==6||suppression==7)&&Empty){need2=1;return;}//Package suppression - if((suppression==1||suppression==5)&&Empty){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;need2=1;return;}//Data Suppression + if((suppression==2||suppression==3||suppression==6||suppression==7)&&Empty){return;}//Package suppression + if((suppression==1||suppression==5)&&Empty){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;return;}//Data Suppression + need2=1; fEC = 0xff & (word >> 32); fBC = 0xffff & (word >> 16); if(suppression< 0x4){ @@ -77,6 +78,7 @@ class VFATdata if(suppression<4){ fmsData = fmsData | (0x0000ffffffffffff & word >> 16); flsData = 0xffff000000000000 & (word << 48); + need3=1; return; } count=0; From 57280743aeaadc8c14eff9b9edde8dede9c8e152 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2019 09:00:27 -0500 Subject: [PATCH 12/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index db3b2b6..1c90512 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -53,14 +53,14 @@ class VFATdata ~VFATdata(){} //!Read first word from the block. - void read_fw(uint64_t word, int c) + void read_fw(uint64_t word) { suppression = 0x4 & (word >> 61); fPos = 0x3f & (word >> 56); fCRCcheck = 0xff & (word >> 48); fHeader = 0xff & (word >> 40); - if((suppression==2||suppression==3||suppression==6||suppression==7)&&Empty){return;}//Package suppression - if((suppression==1||suppression==5)&&Empty){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;return;}//Data Suppression + if((suppression==2||suppression==3||suppression==6||suppression==7)&&(fHeader==26||fHeader==86)){return;}//Package suppression + if((suppression==1||suppression==5)&&(fHeader==26||fHeader==86)){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;return;}//Data Suppression need2=1; fEC = 0xff & (word >> 32); fBC = 0xffff & (word >> 16); @@ -73,7 +73,7 @@ class VFATdata } //!Read second word from the block. - void read_sw(uint64_t word, int c) + void read_sw(uint64_t word) { if(suppression<4){ fmsData = fmsData | (0x0000ffffffffffff & word >> 16); @@ -102,7 +102,7 @@ class VFATdata fcrc= 0xffff & (word << 8);//In case it cuts it off } //!Read third word from the block. - void read_tw(uint64_t word,int c) + void read_tw(uint64_t word) { if(suppression< 0x4){ flsData = flsData | (0x0000ffffffffffff & word >> 16); From f24700772ae3a617b0143fe6d70402722094ef8d Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Wed, 3 Jul 2019 03:48:52 -0500 Subject: [PATCH 13/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 1c90512..1281843 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -231,7 +231,7 @@ class GEBdata { m_ZeroSup = 0x00ffffff & (word >> 40); /*!Zero Suppression*/ m_InputID = 0b00011111 & (word >> 35); /*!GLIB Input ID*/ - m_Vwh = 0x0fff & (word >> 23); /*!VFAT word count*/ + m_Vwh = 0x0fff & (word >> 23); /*!VFAT word count*///LOOK m_ErrorC = 0b0001111111111111 & (word >> 10); /*!Thirteen Flags*/ for(int i=0; i<13; ++i) { From daf843bf32b251079393d6843950029cf6268cfb Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Thu, 4 Jul 2019 04:13:41 -0500 Subject: [PATCH 14/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 130 +++++--------------- 1 file changed, 33 insertions(+), 97 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 1281843..b25cf45 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -15,14 +15,9 @@ class VFATdata uint16_t fcrc_calc; ///> 61); - fPos = 0x3f & (word >> 56); - fCRCcheck = 0xff & (word >> 48); - fHeader = 0xff & (word >> 40); - if((suppression==2||suppression==3||suppression==6||suppression==7)&&(fHeader==26||fHeader==86)){return;}//Package suppression - if((suppression==1||suppression==5)&&(fHeader==26||fHeader==86)){fEC = 0xff & (word >> 32);fBC = 0xffff & (word >> 16);fcrc = 0xffff & word;return;}//Data Suppression - need2=1; - fEC = 0xff & (word >> 32); - fBC = 0xffff & (word >> 16); - if(suppression< 0x4){ - fmsData = 0xffff000000000000 & (word << 48); - return; - } - //fmsData = 0xffff000000000000 & (word << 48); - controlData = 0xffff & word//a 16 bit number with bits indicating which packet is populated with anything (8 channels for a packet) - } - - //!Read second word from the block. - void read_sw(uint64_t word) - { - if(suppression<4){ - fmsData = fmsData | (0x0000ffffffffffff & word >> 16); - flsData = 0xffff000000000000 & (word << 48); - need3=1; - return; - } - count=0; - //This populates an array of 8 bit numbers whose length corresponds to the number of packets. - uint16_t helper=controlData; - while (helper > 0) { - count += helper & 1; - helper >>= 1; - } - int i=0; - while(count>0){ - packets[i] = 0xffff & (word >> 64-(i+1)*8); - i+=1; - count-=1; - if((i*8==56&&count==0)){need3=1;} - if((i*8==64&&count==0)){need3=2;} - //need3 will take 0 if third line not needed, 1 if needed just to read of half of crc,2 if all, 3 if needed for data and crc - if(i*8==64){break;} - } - if(i<7){fcrc = 0xffff & word;need3=0;break;}//In case we don't even need a third line - fcrc= 0xffff & (word << 8);//In case it cuts it off - } - //!Read third word from the block. - void read_tw(uint64_t word) - { - if(suppression< 0x4){ - flsData = flsData | (0x0000ffffffffffff & word >> 16); - fcrc = 0xffff & word; - break; - return; - } - if(need3==1){fcrc=fcrc|(0xff & word >> 56);return;}//If it was cut off before - if(need3==2){fcrc=0xffff & (word >> 48);return;}//If we just barely needed the full line - if(need3==3){ - int i=0; - while(count>0){ - packets[i+8] = 0xff & (word >> 64-(i+1)*8); - i+=1; - count-=1; - if(i*8==56){need4=1;}//Takes 0 if 4rth line not needed, Takes 1 if 1/2 crc needed, Takes 2 otherwise - if(i*8==64){need4=2;break;} - } - if(0> 64-(i+2)*8);}//In case the whole word stays in - if(i*8==56){fcrc= 0xffff & (word << 8)};//In case it cuts it off - } - } - void read_4w(uint64_t word) - { - if(need4==1){fcrc=fcrc|(0xff & word >> 56);break;}//if it had previously cut it off before - fcrc=0xffff & (word >> 48); - break; - } - int getNeed2(){ - return need2; - } - int getNeed3(){ - return need3; - } - int getNeed4(){ - return need4; - } uint8_t Pos (){ return fPos; } uint16_t BC (){ return fBC; } @@ -152,7 +60,21 @@ class VFATdata uint16_t crc_calc (){ return fcrc_calc; } int SlotNumber (){ return fSlotNumber; } bool isBlockGood(){ return fisBlockGood;} - + uint16_t controlData(){ return fcontrolData;} + int CH (){ return fCH;} + + + void rPos(uint8_t _rPos){this.fPos=_rPos;} + void rCRCcheck(uint8_t _rCRCcheck){this.fCRCcheck=_rCRCcheck;} + void rHeader(uint8t_t _rHeader){this.fHeader=_rHeader;} + void rEC(uint8_t _rEC){this.fEC=_rEC;} + void rBC(uint16_t _rBC){this.fBC=_rBC;} + void rcrc(uint16_t _rcrc){this.fcrc=_rcrc;} + void rlsData(uint64_t _rlsData){this.flsData=_rlsData;} + void rmsData(uint64_t _rmsData){this.fmsData=_rmsData;} + void rcontrolData(uint16_t _rcontrolData){this.fcontrolData=_rcontrolData;} + void rpacket(uint8_t _rpacket,int i){this.fpackets[i]=_rpacket;} + void rCH(int _rCH){this.fCH=_rCH} }; //!A class for GEB data @@ -198,6 +120,8 @@ class GEBdata //!(7 0's):7 Stuck data:1 /*!Input status (warning): Data in InFIFO or EvtFIFO when L1A FIFO was empty. Only resets with resync or reset*/ uint8_t m_Stuckd; + unint8_t m_Calib; + //Bits for calibration mode to determine the channel public: //!Empty constructor. Functions used to assign data members. @@ -229,6 +153,7 @@ class GEBdata */ void setChamberHeader(uint64_t word) { + m_Calib=0b0111111 & (word >> 57); m_ZeroSup = 0x00ffffff & (word >> 40); /*!Zero Suppression*/ m_InputID = 0b00011111 & (word >> 35); /*!GLIB Input ID*/ m_Vwh = 0x0fff & (word >> 23); /*!VFAT word count*///LOOK @@ -269,7 +194,8 @@ class GEBdata uint8_t InputID() {return m_InputID;} ///> 16); /*!Buffer Status*/ m_GDcount = 0b00011111 & (word >> 11); /*!GEM DAV count*/ m_Tstate = 0b00000111 & word; /*!TTS state*/ + m_suppression = (word >> 4); /*!suppresion word*/ + } + + uint4_t getSupp() + { + return this.suppression } //!Reads the word for the GEM Event Trailer @@ -471,6 +406,7 @@ class AMCdata uint32_t CRC() {return m_CRC;} uint8_t L1AT() {return m_L1AT;} uint32_t DlengthT() {return m_DlengthT;} + uint4_t suppression() {return m_suppression;} //!Adds GEB data to vector void g_add(GEBdata g){gebd.push_back(g);} From a1f3efce5e5886aeb5a40aa906a98d4e32a05a35 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Thu, 4 Jul 2019 04:13:54 -0500 Subject: [PATCH 15/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 81 +++++++++++++++++-------- 1 file changed, 55 insertions(+), 26 deletions(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index f7290f3..ed8668e 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -102,38 +102,67 @@ class GEMUnpacker //printf("%016llX\n", m_word); // fill the vfat data here //std::cout << "Number of VFAT words " << m_gebdata->Vwh() << std::endl; - int m_nvb = m_gebdata->Vwh() / 3; // number of VFAT2 blocks. Eventually add here sanity check + //int m_nvb = m_gebdata->Vwh() / 3; // number of VFAT2 blocks. Eventually add here sanity check //printf("N vfat blocks %d\n",m_nvb); - for (unsigned short k = 0; k < m_nvb; k++){ + + //START OF VFAT READER + + uint4_t helper=m_amcdata->suppression(); + int bitcount=0; + while((bitcount/64) Vwh()){ VFATdata * m_vfatdata = new VFATdata(); - // read 3 vfat block words, totaly 192 bits - std::fread(&m_word, sizeof(uint64_t), 1, m_file); - //printf("VFAT WORD 1\n"); - //printf("%016llX\n", m_word); - m_vfatdata->read_fw(m_word); - if(getNeed2()>0){ - std::fread(&m_word, sizeof(uint64_t), 1, m_file); - //printf("VFAT WORD 2\n"); - //printf("%016llX\n", m_word); - m_vfatdata->read_sw(m_word);} - if(getNeed3()>0){ - std::fread(&m_word, sizeof(uint64_t), 1, m_file); - //printf("VFAT WORD 3\n"); - //printf("%016llX\n", m_word); - m_vfatdata->read_tw(m_word);} - if(getNeed4()>0){ - std::fread(&m_word, sizeof(uint64_t), 1, m_file); - m_vfatdata->read_4w(m_word); + if(helper > 8){//PORTION THAT DEALS WITH CALIBRATION MODE + std::fread(&m_word, sizeof(uint8_t), 1, m_file); bitcount+=8; + m_vfatdata->rCH((int) m_word>>7); + m_vfatdata->rEC(0b00000011& m_word); + m_vfatdata->rPos(0b00011111& m_word); + //ADD METHOD SPECIFICALLY FOR CHANNEL COUNT + m_gebdata->v_add(*m_vfatdata); + delete m_vfatdata; + continue; + } + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rPos(0b00011111& m_word); bitcount+=8; + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rCRCcheck(m_word); bitcount+=8; + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rHeader(m_word); bitcount+=8; + if((helper==2||helper==3||helper==6||helper==7)&&(m_word==26||m_word==86)){ + m_gebdata->v_add(*m_vfatdata); + delete m_vfatdata; + continue; + }//Package suppression + if((helper==1||helper==5)&&(mword==26||mword==86)){ + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word); bitcount+=8; + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word); bitcount+=16; + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; + m_gebdata->v_add(*m_vfatdata); + delete m_vfatdata; + continue; + }//Data Suppression + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word); bitcount+=8; + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word); bitcount+=16; + if(helper<4){ + std::fread(&m_word, sizeof(uint64_t), 1, m_file); m_vfatdata->rlsData(m_word); bitcount+=64; + std::fread(&m_word, sizeof(uint64_t), 1, m_file); m_vfatdata->rmsData(m_word); bitcount+=64; + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; + m_gebdata->v_add(*m_vfatdata); + delete m_vfatdata; + continue; + } + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcontrolData(m_word); bitcount+=16; + uint16_t count=0xffff; + while (m_word > 0) { + count += m_word & 0bx0000000000000001; + m_word >>= 1; + } + for(int i=0; i< (int) count;i++){ + std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rpacket(m_word,i); bitcount+=8; } - // - //printf("VFAT MS Data 3\n"); - //printf("%016llX\n", m_vfatdata->msData()); - //printf("VFAT LS Data 3\n"); - //printf("%016llX\n", m_vfatdata->lsData()); - // + std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; } + //END OF VFAT READER + + std::fread(&m_word, sizeof(uint64_t), 1, m_file); m_gebdata->setChamberTrailer(m_word); m_amcdata->g_add(*m_gebdata); From ee77398b421863bfa93c7dc0db32f7aeeaa690bd Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 5 Jul 2019 04:52:59 -0500 Subject: [PATCH 16/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index ed8668e..df7b569 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -122,7 +122,8 @@ class GEMUnpacker continue; } std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rPos(0b00011111& m_word); bitcount+=8; - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rCRCcheck(m_word); bitcount+=8; + m_vfatdata->rCRCcheck(m_word>>7); + //std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rCRCcheck(m_word); bitcount+=8; std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rHeader(m_word); bitcount+=8; if((helper==2||helper==3||helper==6||helper==7)&&(m_word==26||m_word==86)){ m_gebdata->v_add(*m_vfatdata); From e35f0c45b62dd60dc16b6b412b29a7182a922cc9 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 5 Jul 2019 04:59:28 -0500 Subject: [PATCH 17/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index df7b569..24a5048 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -193,6 +193,8 @@ class GEMUnpacker private: std::FILE *m_file; uint64_t m_word; + uint8_t m_word8; + uint16_t m_word16; uint32_t m_word32; bool type; AMC13Event * m_AMC13Event; From c6a2440697afc5814ed75794d50e646c8bc2636c Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 5 Jul 2019 05:02:33 -0500 Subject: [PATCH 18/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index 24a5048..3d78ac6 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -112,52 +112,52 @@ class GEMUnpacker while((bitcount/64) Vwh()){ VFATdata * m_vfatdata = new VFATdata(); if(helper > 8){//PORTION THAT DEALS WITH CALIBRATION MODE - std::fread(&m_word, sizeof(uint8_t), 1, m_file); bitcount+=8; - m_vfatdata->rCH((int) m_word>>7); - m_vfatdata->rEC(0b00000011& m_word); - m_vfatdata->rPos(0b00011111& m_word); + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); bitcount+=8; + m_vfatdata->rCH((int) m_word8>>7); + m_vfatdata->rEC(0b00000011& m_word8); + m_vfatdata->rPos(0b00011111& m_word8); //ADD METHOD SPECIFICALLY FOR CHANNEL COUNT m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; continue; } - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rPos(0b00011111& m_word); bitcount+=8; - m_vfatdata->rCRCcheck(m_word>>7); + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rPos(0b00011111& m_word8); bitcount+=8; + m_vfatdata->rCRCcheck(m_word8>>7); //std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rCRCcheck(m_word); bitcount+=8; - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rHeader(m_word); bitcount+=8; + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rHeader(m_word8); bitcount+=8; if((helper==2||helper==3||helper==6||helper==7)&&(m_word==26||m_word==86)){ m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; continue; }//Package suppression if((helper==1||helper==5)&&(mword==26||mword==86)){ - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word); bitcount+=8; - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word); bitcount+=16; - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word8); bitcount+=8; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word16); bitcount+=16; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word16); bitcount+=16; m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; continue; }//Data Suppression - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word); bitcount+=8; - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word); bitcount+=16; + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rEC(m_word8); bitcount+=8; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rBC(m_word16); bitcount+=16; if(helper<4){ std::fread(&m_word, sizeof(uint64_t), 1, m_file); m_vfatdata->rlsData(m_word); bitcount+=64; std::fread(&m_word, sizeof(uint64_t), 1, m_file); m_vfatdata->rmsData(m_word); bitcount+=64; - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word16); bitcount+=16; m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; continue; } - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcontrolData(m_word); bitcount+=16; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rcontrolData(m_word16); bitcount+=16; uint16_t count=0xffff; - while (m_word > 0) { - count += m_word & 0bx0000000000000001; - m_word >>= 1; + while (m_word16 > 0) { + count += m_word16 & 0bx0000000000000001; + m_word16 >>= 1; } for(int i=0; i< (int) count;i++){ - std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rpacket(m_word,i); bitcount+=8; + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rpacket(m_word8,i); bitcount+=8; } - std::fread(&m_word, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word); bitcount+=16; + std::fread(&m_word16, sizeof(uint16_t), 1, m_file); m_vfatdata->rcrc(m_word16); bitcount+=16; m_gebdata->v_add(*m_vfatdata); delete m_vfatdata; } From de299e4625e44c199decbbb8cc94d6ef43200c17 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Mon, 8 Jul 2019 01:55:35 -0500 Subject: [PATCH 19/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index b25cf45..46adfa8 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -153,8 +153,8 @@ class GEBdata */ void setChamberHeader(uint64_t word) { - m_Calib=0b0111111 & (word >> 57); - m_ZeroSup = 0x00ffffff & (word >> 40); /*!Zero Suppression*/ + m_Calib=0b0111111 & (word >> 40);//(Used to be 57) + //m_ZeroSup = 0x00ffffff & (word >> 40); /*!Zero Suppression*/ m_InputID = 0b00011111 & (word >> 35); /*!GLIB Input ID*/ m_Vwh = 0x0fff & (word >> 23); /*!VFAT word count*///LOOK m_ErrorC = 0b0001111111111111 & (word >> 10); /*!Thirteen Flags*/ From b76c731e6a937029977bc96ea44b12d8d76e0c1c Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Mon, 8 Jul 2019 01:58:29 -0500 Subject: [PATCH 20/23] Update GEMAMC13EventFormat.h --- gemtreewriter/include/GEMAMC13EventFormat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemtreewriter/include/GEMAMC13EventFormat.h b/gemtreewriter/include/GEMAMC13EventFormat.h index 46adfa8..e288c0b 100644 --- a/gemtreewriter/include/GEMAMC13EventFormat.h +++ b/gemtreewriter/include/GEMAMC13EventFormat.h @@ -153,7 +153,7 @@ class GEBdata */ void setChamberHeader(uint64_t word) { - m_Calib=0b0111111 & (word >> 40);//(Used to be 57) + m_Calib=0b01111111 & (word >> 40);//(Used to be 57) //m_ZeroSup = 0x00ffffff & (word >> 40); /*!Zero Suppression*/ m_InputID = 0b00011111 & (word >> 35); /*!GLIB Input ID*/ m_Vwh = 0x0fff & (word >> 23); /*!VFAT word count*///LOOK From 64a354c1dac1fd90beadbd551914043db8e36026 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Tue, 9 Jul 2019 07:45:57 -0500 Subject: [PATCH 21/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index 3d78ac6..1c78de3 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -109,7 +109,9 @@ class GEMUnpacker uint4_t helper=m_amcdata->suppression(); int bitcount=0; - while((bitcount/64) Vwh()){ + int vfcount=0; + while(((bitcount/64) Vwh())&& vfcount<23){ + vfcount+=1; VFATdata * m_vfatdata = new VFATdata(); if(helper > 8){//PORTION THAT DEALS WITH CALIBRATION MODE std::fread(&m_word8, sizeof(uint8_t), 1, m_file); bitcount+=8; From f42d17fdc9b59bf747b541bae08cef730c8502cd Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Tue, 9 Jul 2019 07:56:00 -0500 Subject: [PATCH 22/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index 1c78de3..fcd4397 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -109,12 +109,18 @@ class GEMUnpacker uint4_t helper=m_amcdata->suppression(); int bitcount=0; - int vfcount=0; - while(((bitcount/64) Vwh())&& vfcount<23){ - vfcount+=1; + //int vfcount=0;//vfcount+=1; + while((bitcount/64) Vwh()){ VFATdata * m_vfatdata = new VFATdata(); + std::fread(&m_word8, sizeof(uint8_t), 1, m_file); + if(m_word8==0b11111111){ + while((bitcount/64) Vwh()){ + std::fread(&m_word8, sizeof(uint8_t), 1, m_file);bitcount+=8; + } + break; + } + bitcount+=8; if(helper > 8){//PORTION THAT DEALS WITH CALIBRATION MODE - std::fread(&m_word8, sizeof(uint8_t), 1, m_file); bitcount+=8; m_vfatdata->rCH((int) m_word8>>7); m_vfatdata->rEC(0b00000011& m_word8); m_vfatdata->rPos(0b00011111& m_word8); @@ -123,7 +129,7 @@ class GEMUnpacker delete m_vfatdata; continue; } - std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rPos(0b00011111& m_word8); bitcount+=8; + m_vfatdata->rPos(0b00011111& m_word8); m_vfatdata->rCRCcheck(m_word8>>7); //std::fread(&m_word, sizeof(uint8_t), 1, m_file); m_vfatdata->rCRCcheck(m_word); bitcount+=8; std::fread(&m_word8, sizeof(uint8_t), 1, m_file); m_vfatdata->rHeader(m_word8); bitcount+=8; From af2e09c625ac79f564a9d6991ba2a31c189ea2e7 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Tue, 9 Jul 2019 08:01:27 -0500 Subject: [PATCH 23/23] Update GEMUnpacker.cc --- gemtreewriter/src/common/GEMUnpacker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemtreewriter/src/common/GEMUnpacker.cc b/gemtreewriter/src/common/GEMUnpacker.cc index fcd4397..3b518a3 100644 --- a/gemtreewriter/src/common/GEMUnpacker.cc +++ b/gemtreewriter/src/common/GEMUnpacker.cc @@ -111,7 +111,6 @@ class GEMUnpacker int bitcount=0; //int vfcount=0;//vfcount+=1; while((bitcount/64) Vwh()){ - VFATdata * m_vfatdata = new VFATdata(); std::fread(&m_word8, sizeof(uint8_t), 1, m_file); if(m_word8==0b11111111){ while((bitcount/64) Vwh()){ @@ -120,6 +119,7 @@ class GEMUnpacker break; } bitcount+=8; + VFATdata * m_vfatdata = new VFATdata(); if(helper > 8){//PORTION THAT DEALS WITH CALIBRATION MODE m_vfatdata->rCH((int) m_word8>>7); m_vfatdata->rEC(0b00000011& m_word8);