Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment analysis: fix zero count bug, clean up code #22

Open
wants to merge 4 commits into
base: area/27Apr22
Choose a base branch
from

Conversation

wjdanswjddl
Copy link
Contributor

Description

fix zero count bug: now gets fragment ID directly
code cleaned up: unused lines erased, comments -> verbose

Related Repository Branches

Testing details

tested with icarus data file w/ 50 events, filename: data_dl4_fstrmBNB_run7344_57_20211214T091133.root
*not: this file does not contain any empty container fragment events

Copy link
Contributor

@wesketchum wesketchum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! just some minor last changes to make things more configurable. I'll handle merging in and testing at ICARUS though.

@@ -43,6 +43,7 @@ namespace sbndaq {
}

/*****/
bool verbose = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove from here. This makes it a global variable, but it'd be better to make it part of the class and get configuration from pset. See comments below.

@@ -57,6 +58,7 @@ class sbndaq::FragmentDQMAna : public art::EDAnalyzer {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some configurable class elements (using f as a way to indicate variable is a private member of the FragmentDQMAna class)

const bool fVerbose;
const int fReportingLevel;

@@ -57,6 +58,7 @@ class sbndaq::FragmentDQMAna : public art::EDAnalyzer {

};


//Define the constructor
sbndaq::FragmentDQMAna::FragmentDQMAna(fhicl::ParameterSet const & pset)
: EDAnalyzer(pset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can pull configuration information in here (and supply defaults):

sbndaq::FragmentDQMAna::FragmentDQMAna(fhicl::ParameterSet const & pset)
  : EDAnalyzer(pset)
  , fVerbose(pset.get<bool>("Verbose",false);
  , fReportingLevel(pset.get<int>("ReportingLevel",0)
  {
  ...

@@ -76,64 +78,51 @@ sbndaq::FragmentDQMAna::~FragmentDQMAna()
//analyze_fragment
void sbndaq::FragmentDQMAna::analyze_fragment(artdaq::Fragment frag) {

artdaq::ContainerFragment cont_frag(frag);
int level = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the level declaration here.


sbndaq::sendMetric(group_name, fragment_id, "frag_count", frag_count, level, average);
sbndaq::sendMetric(group_name, fragment_id, "zero_rate", nzero, level, rate);
sbndaq::sendMetric(group_name, fragment_id, "frag_count", frag_count, level, artdaq::MetricMode::Average);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

level --> fReportingLevel now (if you use my changes above). Same on next line.


std::cout << "sending: " << group_name << ":" << fragment_id << ", frag count: " << frag_count << ", nzero: " << nzero << std::endl;
if (verbose) {std::cout << "sending: " << group_name << ":" << fragment_id << ", frag count: " << frag_count << ", nzero: " << nzero << std::endl;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbose --> fVerbose if you use my changes above.

std::cout << std::endl;
std::cout << "Run " << evt.run() << ", subrun " << evt.subRun()<< ", event " << evt.event();
std::cout << std::endl;
if (verbose) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbose --> fVerbose again

auto fragmentHandles = evt.getMany<artdaq::Fragments>(); //returns std::vector< art::Handle< std::vector<artdaq::Fragment> > >

std::cout << "We have " << fragmentHandles.size() << " fragment collections." << std::endl;
if (verbose) {std::cout << "We have " << fragmentHandles.size() << " fragment collections." << std::endl;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbose --> fVerbose (one more time!)

services.RedisConnection.host: "icarus-db01.fnal.gov"

analysis_config:
{
verbose: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my changes, should now be Verbose: false (though you can also remove it, and it will default to false.

Copy link
Contributor Author

@wjdanswjddl wjdanswjddl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've committed these changes, tested with the same data file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants