fragment analysis: fix zero count bug, clean up code#22
Conversation
wesketchum
left a comment
There was a problem hiding this comment.
Looks great! just some minor last changes to make things more configurable. I'll handle merging in and testing at ICARUS though.
| } | ||
|
|
||
| /*****/ | ||
| bool verbose = false; |
There was a problem hiding this comment.
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 { | |||
|
|
|||
There was a problem hiding this comment.
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;
|
|
||
| //Define the constructor | ||
| sbndaq::FragmentDQMAna::FragmentDQMAna(fhicl::ParameterSet const & pset) | ||
| : EDAnalyzer(pset) |
There was a problem hiding this comment.
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)
{
...
| void sbndaq::FragmentDQMAna::analyze_fragment(artdaq::Fragment frag) { | ||
|
|
||
| artdaq::ContainerFragment cont_frag(frag); | ||
| int level = 0; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
level --> fReportingLevel now (if you use my changes above). Same on next line.
| sbndaq::sendMetric(group_name, fragment_id, "zero_rate", nzero, level, artdaq::MetricMode::Rate); | ||
|
|
||
| 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;} |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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;} |
There was a problem hiding this comment.
verbose --> fVerbose (one more time!)
|
|
||
| analysis_config: | ||
| { | ||
| verbose: false |
There was a problem hiding this comment.
If you take my changes, should now be Verbose: false (though you can also remove it, and it will default to false.
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