Skip to content

Commit

Permalink
add IPA to get NR FEEs
Browse files Browse the repository at this point in the history
  • Loading branch information
JAEBEOm PARK committed Aug 30, 2024
1 parent eec711d commit ed309b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions newbasic/oncsSub_idtpcfeev4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ int oncsSub_idtpcfeev4::tpc_gtm_decode()

if (_is_gtm_decoded ) return 0;
_is_gtm_decoded = 1;
NR_VALIDFEE=0;

unsigned int payload_length = 2 * (getLength() - SEVTHEADERLENGTH - getPadding() );

unsigned int index = 0;

unsigned short *buffer = ( unsigned short *) &SubeventHdr->data;
//std::vector<bool> fee_seen(26, false);
std::bitset<26> fee_seen;


// demultiplexer
while (index < payload_length)
Expand All @@ -124,11 +128,15 @@ int oncsSub_idtpcfeev4::tpc_gtm_decode()
{

unsigned int fee_id = buffer[index] & 0xff;
if (!fee_seen[fee_id]) {
fee_seen[fee_id] = true;
NR_VALIDFEE++;
}
// coutfl << " index = " << index << " fee_id = " << fee_id << " len = " << datalength << endl;
++index;
if (fee_id < MAX_FEECOUNT)
{
index += datalength;
index += datalength;
}
if (index >= payload_length) break;
}
Expand All @@ -139,7 +147,7 @@ int oncsSub_idtpcfeev4::tpc_gtm_decode()
// memcpy?
for (unsigned int i = 0; i < 16; i++)
{
buf[i] = buffer[index++];
buf[i] = buffer[index++];
}

decode_gtm_data(buf);
Expand Down Expand Up @@ -338,6 +346,12 @@ long long oncsSub_idtpcfeev4::lValue(const int n, const char *what)
{
return gtm_data.size();
}

else if ( strcmp(what,"NR_VALIDFEE") == 0 )
{
return NR_VALIDFEE;
}


else if (strcmp(what, "TAGGER_TYPE") == 0 )
{
Expand Down
2 changes: 2 additions & 0 deletions newbasic/oncsSub_idtpcfeev4.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "oncsSubevent.h"
#include <vector>
#include <set>
#include <bitset>
#include <algorithm>
#include <functional>
#include <limits>
Expand Down Expand Up @@ -56,6 +57,7 @@ class oncsSub_idtpcfeev4 : public oncsSubevent_w2 {
int decode_gtm_data(unsigned short gtm[16]);

int _broken;
unsigned long NR_VALIDFEE = 0;

int _is_decoded{0};
int _is_gtm_decoded{0};
Expand Down

0 comments on commit ed309b8

Please sign in to comment.