-
Notifications
You must be signed in to change notification settings - Fork 35
Enables Database Lookup for Exposure accounting #394
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
Enables Database Lookup for Exposure accounting #394
Conversation
|
This is connected to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For BNB, the changes are aimed to skip the gates which have been exposed to the minimum bias trigger (and as such have been acquired). Whether a spill is acquired as minimum bias is discovered consulting an external database which was filled separately with trigger information.
This information should have been included in the pull request description.
The code has some hard-coded unexplained values, which need to be documented. The code does not specifically treat cases where the spill is not in the database. Most spills in fact won't be in the database, since the database has entries only for gates which triggered — it is however expected that all the minimum bias spills are present, because they did trigger. This subtlety might be worth documenting too.
I am not comfortable to have production code rely on a database currently stored in /pnfs/icarus/scratch, and much less comfortable that such location is hard-coded so that fixing it forces a new code release. I strongly recommend that to be moved into a parameter now.
For the NuMI module, GIT is not very helpful in highlighting the differences... I notice the change from V2 to V3 (and consequent metadata interface change). Is there anything else that I missed?
For the BNB off-beam module, I did not understand the meaning of the code. Please explain.
sbncode/BeamSpillInfoRetriever/BNBRetriever/BNBRetriever_module.cc
Outdated
Show resolved
Hide resolved
| Bundle: "BoosterNeutrinoBeam_read" | ||
| MultiWireBundle: "BNBMultiWire" | ||
| TimeWindow: "500" #seconds | ||
| TimeWindow: "700" #seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need comments to document where these values come from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was updated because with the trigger database we were able to actually realize we were not grabbing all the spills, that additional 200 seconds has allowed us to make sure we are grabbing all the correct spills between the two majority triggers
| //check if this spill is is minbias | ||
| mf::LogDebug("BNBRetriever") << std::setprecision(19) << "matchMultiWireData:: trigger type : " << get_trigger_type_matching_gate(db, callback_trigger_type, run_number, times_temps[i]*1.e9-triggerInfo.WR_to_Spill_conversion+3.6e7, 40.) << " times : spill " << times_temps[i]*1.e9 << " - " << triggerInfo.WR_to_Spill_conversion << " + " << 3.6e7 << std::endl; | ||
|
|
||
| if(get_trigger_type_matching_gate(db, callback_trigger_type, run_number, times_temps[i]*1.e9-triggerInfo.WR_to_Spill_conversion+3.6e7, 40.) == 1){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 40 (milliseconds) also needs explanation, i.e. why we choose 40 ms of tolerance.
Also, this is a real value, while the threshold parameter of get_trigger_type_matching_gate() is an integer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
40 ms was selected to be close to but outside the 66 ms time of the next spill (when the beam is running at 15 Hz) DocDB 33155 provides documentation of this, I have resolved the int vs float issue and added a comment
| produces< std::vector< sbn::BNBSpillInfo >, art::InSubRun >(); | ||
| TotalBeamSpills = 0; | ||
|
|
||
| rc = sqlite3_open("/pnfs/icarus/scratch/users/mueller/icarus_triggers.db", &db); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard coded path to scratch area in the code won't do.
Either move the file to stable area, or set the path to a parameter.
Better: both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved file to sbndata and made the path a fcl parameter
| // art::SubRun so it persists | ||
|
|
||
| if(evtCount != 0 && totalMinBias != 0) | ||
| scale_factor = 1. - (evtCount/totalMinBias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure out the rationale here.
Can you explain (and document) the intent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to scale by the minimum bias prescale rate, which can change run-to-run based on our configuration. The best way I found to do this was to use frag.getDeltaGatesBNBOffMinbias() BUT it doesn't work for event which haven't had a MinBias trigger yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the prescale rate with something like:
void sbn::BNBExtRetriever::beginRun(art::Run& run) {
auto const& trigConfig = run.getProduct<icarus::TriggerConfiguration>(fTrigConfigLabel);
fPrescale = trigConfig.getMinBiasPrescale(sbn::triggerSource::OffbeamBNB);
}(#include "icaruscode/Decode/DataProducts/TriggerConfiguration.h")
With this information you can correct either statistically (* (1.0 - 1.0/fPrescale)) or exactly event by event.
The correct label from ICARUS Stage0 processing is triggerConfig if I am not wrong.
I don't understand the meaning of the fraction evtCount/totalMinBias... I would understand a gate count instead of the triggered event count on the denominator as an estimation of the prescale factor.
I am not sure what the existing code does in the presence of events with gate_type != 3.
|
I am very concerned about the need for an external database which is currently at some 8 GB from anecdotes on a slack thread. We need to find a place to house this, and determine how it is used, in a way that does not break general users/developers and/or prevent them from running standard workflows, potentially in non-gpvm environments. |
|
Documenting in-person discussion from yesterday. @justinjmueller believes he can extract a database with only the relevant information that will be small enough to live in icarusdata so the offline database issue is resolved. (The issue of what to do about online filling of a database that would be available for keepup production in the future is left for another day). |
|
The database size has been reduced to ~84 MB after removing unnecessary columns and any triggers which are not on-beam triggers. @jzennamo has said that he will find some time for testing the reduced database to make sure there are no problems. |
…he spill quality for the spill that goes with a given event, and code supporting that.
…wants to use this spill. The other checks not just for the first event but the first event OF A GIVEN STREAM for the numi case.
…add another). Thanks Gianluca
|
OK, I have gotten @justinjmueller's new database working and it is rather quick! I am going to start working through @PetrilloAtWork's comments now. Thanks everyone! |
PetrilloAtWork
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up on one of the comments.
Maybe I am using GitHub wrong.
| // art::SubRun so it persists | ||
|
|
||
| if(evtCount != 0 && totalMinBias != 0) | ||
| scale_factor = 1. - (evtCount/totalMinBias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the prescale rate with something like:
void sbn::BNBExtRetriever::beginRun(art::Run& run) {
auto const& trigConfig = run.getProduct<icarus::TriggerConfiguration>(fTrigConfigLabel);
fPrescale = trigConfig.getMinBiasPrescale(sbn::triggerSource::OffbeamBNB);
}(#include "icaruscode/Decode/DataProducts/TriggerConfiguration.h")
With this information you can correct either statistically (* (1.0 - 1.0/fPrescale)) or exactly event by event.
The correct label from ICARUS Stage0 processing is triggerConfig if I am not wrong.
I don't understand the meaning of the fraction evtCount/totalMinBias... I would understand a gate count instead of the triggered event count on the denominator as an estimation of the prescale factor.
I am not sure what the existing code does in the presence of events with gate_type != 3.
SFBayLaser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern regarding the home for the database has been nicely resolved so am happy to approve.
|
OK! After a good amount of fighting, I have had to update everything to the latest flavor of This PR needs to be paired with these two other PRs: |
PetrilloAtWork
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok.
Thank you for your patience!
|
trigger build SBNSoftware/sbnobj#100 SBNSoftware/sbndata#6 |
…FOR_DEVELOP_basedOnJZennamoBranch Feature/howard spillquality for develop based on j zennamo branch
|
❌ CI build for SBND Failed at phase build SBND on slf7 for e26:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build SBND phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase build ICARUS on slf7 for e26:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build ICARUS phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase build ICARUS on slf7 for c14:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build ICARUS phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for SBND Failed at phase build SBND on slf7 for c14:prof -- details available through the CI dashboard 🚨 For more details about the failed phase, check the build SBND phase logs parent CI build details are available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for c14:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for e26:prof -- details available through the CI dashboard |
|
🚨 For more details about the warning phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for SBND Failed at phase ci_tests SBND on slf7 for c14:prof - ignored warnings for build -- details available through the CI dashboard 🚨 For more details about the failed phase, check the ci_tests SBND phase logs parent CI build details are available through the CI dashboard |
|
🚨 For more details about the warning phase, check the ci_tests SBND phase logs parent CI build details are available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for c14:prof - ignored failure for unit_test - ignored warnings for build -- details available through the CI dashboard 🚨 For more details about the failed phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
No description provided.