Feature/ascarpel timing pmt crt#440
Conversation
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for c7:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for e20: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 |
|
🚨 For more details about the warning phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
* the update with a new run was already removed from the interface * map access replaced with read-only one * default values for missing entries explicitly implemented
* algorithms use `icarusDB::PMTTimingCorrections` interface (can store it in a constant reference data member) * art modules provide them the object with that interface via the `icarusDB::IPMTTimingCorrectionService` service interface: `lar::providerFrom<icarusDB::IPMTTimingCorrectionService>()` or equivalent returns the pointer the algorithms need * configuration must include the service `IPMTTimingCorrectionService` and specify its implementation (currently only `PMTTimingCorrectionService` is provided
Previously, the corrections were in ophitcorr, which was then used for creating flashes.
|
The last commit is a fix triggered by a report by @francescopoppi and @aheggest who did not see the time correction on the hits in some output trees. The branch was creating the |
PetrilloAtWork
left a comment
There was a problem hiding this comment.
The main requests were addressed. I have become part of the solution, so my review is not fair any more.
Thus, I hereby approve.
| // Get the laserChannelNumber | ||
| char laserChannelBuffer[10]; | ||
| getStringValue(tuple, 7, laserChannelBuffer, sizeof(laserChannelBuffer), &error); | ||
| if (error) throw std::runtime_error("Encountered error when trying to recover the PMT laser channel label"); |
There was a problem hiding this comment.
It would be nice to know which error that was. e.g.:
| if (error) throw std::runtime_error("Encountered error when trying to recover the PMT laser channel label"); | |
| if (error) throw std::runtime_error("Encountered error (code: " + std::to_string(error) + ") when trying to recover the PMT laser channel label"); |
This of course is a general comment for the class (and of course I don't expect you to change this all the way in this context).
| getStringValue(tuple, 7, laserChannelBuffer, sizeof(laserChannelBuffer), &error); | ||
| if (error) throw std::runtime_error("Encountered error when trying to recover the PMT laser channel label"); | ||
| std::string laserChannelLabel(laserChannelBuffer, 2, sizeof(laserChannelBuffer)); //sizeof(digitizerBuffer)); | ||
| unsigned int laserChannel = std::stol(laserChannelLabel); // try-catch syntax for stol or not necessary ? |
There was a problem hiding this comment.
Necessary if we want meaningful error messages (remember the error from the trigger decoder? the entirety of the message was: stoi).
| unsigned int laserChannel = std::stol(laserChannelLabel); // try-catch syntax for stol or not necessary ? | |
| unsigned int laserChannel; | |
| try { | |
| laserChannel = std::stol(laserChannelLabel); | |
| } | |
| catch(std::logic_error const& e) { | |
| throw std::runtime_error("Invalid laser channel number from digitizer " + digitizerLabel + ": " + laserChannelLabel + " (\"" + e.what() + "\")"; | |
| } |
|
|
||
| // Read the laser channel | ||
| std::string laserChannelLabel = argv[7]; // format is L-<number> . <number> is int from [1-41] | ||
| unsigned int laserChannel = std::stol(laserChannelLabel.substr(2,4)); // try-catch syntax for stol or not necessary ? |
There was a problem hiding this comment.
Necessary if we want meaningful error messages (remember my last comment? yes, this is C&P).
| unsigned int laserChannel = std::stol(laserChannelLabel.substr(2,4)); // try-catch syntax for stol or not necessary ? | |
| unsigned int laserChannel; | |
| try { | |
| laserChannel = std::stol(laserChannelLabel.substr(2,4)); | |
| } | |
| catch(std::logic_error const& e) { | |
| throw std::runtime_error("Invalid laser channel number for fragment " + std::to_string(fragmentID) + " channel " std::to_string(digitizerChannelNo) + ": " + laserChannelLabel + " (\"" + e.what() + "\")"; | |
| } |
| * Then define the function interface to fill these data structures | ||
| */ | ||
| using DigitizerChannelChannelIDPair = std::pair<size_t,size_t>; | ||
| using DigitizerChannelChannelIDPair = std::tuple<size_t,size_t,size_t>; // std::tuple<DigitizerChannel, ChannelID, LaserChannel> |
There was a problem hiding this comment.
Lui, lei te... un paio in tre. 😉
| bool const fRequireBoardConfig; | ||
|
|
||
| /// String of the instance to use for the time corrections | ||
| std::string fCorrectionInstance; |
There was a problem hiding this comment.
To follow the pattern in the module:
| std::string fCorrectionInstance; | |
| std::string const fCorrectionInstance; |
(not a bit deal, but it prevents "accidental" modifications)
| for (std::string const& instanceName: getAllInstanceNames()){ | ||
| if( instanceName.empty() ) continue; | ||
| produces<std::vector<icarus::timing::PMTWaveformTimeCorrection>>(instanceName); |
There was a problem hiding this comment.
I think there is a merge issue here.
| for (std::string const& instanceName: getAllInstanceNames()){ | |
| if( instanceName.empty() ) continue; | |
| produces<std::vector<icarus::timing::PMTWaveformTimeCorrection>>(instanceName); | |
| if (!fSkipWaveforms) { | |
| for (std::string const& instanceName: getAllInstanceNames()) | |
| produces<std::vector<raw::OpDetWaveform>>(instanceName); | |
| } | |
| for (std::string const& instanceName: getAllInstanceNames()){ | |
| if( instanceName.empty() ) continue; | |
| produces<std::vector<icarus::timing::PMTWaveformTimeCorrection>>(instanceName); |
My suggestion here honours fSkipWaveforms in writing the waveforms only if requested, but it always writes the correction. In alternative, the corrections may be written only when the waveforms are.
I don't believe there is one rightful solution here, since the SkipWaveforms option is there just for debug.
|
|
||
| produces<std::vector<raw::OpDetWaveform>>(); |
There was a problem hiding this comment.
Tail of the merge issue above.
| produces<std::vector<raw::OpDetWaveform>>(); |
| = [&digitizerChannelVec](unsigned short int channelNumber) -> raw::Channel_t | ||
| { | ||
| for (auto const [ chNo, chID ]: digitizerChannelVec) | ||
| for (auto const [ chNo, chID, _ ]: digitizerChannelVec) // too pythonic? |
There was a problem hiding this comment.
I have seen that (rarely) in C++ too. Maybe from people used to Python...
SFBayLaser
left a comment
There was a problem hiding this comment.
I am not entirely sure why I was selected as a reviewer here since I am not familiar with the details of this code. I see that Gianluca has done a comprehensive review and given his long track record of careful work if he has approved then it is fine for me.
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for c7:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for e20:prof -- details available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for c7:prof - 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 |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for e20:prof - 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 |
AKA: "if the branch messes up anything, it's his fault." |
|
After a quick investigation, the CI test failure is related to the change of the Optical Hit reconstruction process name. the former |
|
commit 60121d3 should fix the above |
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for c7:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for e20:prof -- details available through the CI dashboard |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for c7:prof - 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 |
|
❌ CI build for ICARUS Failed at phase ci_tests ICARUS on slf7 for e20:prof - 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 |
|
trigger build |
|
✔️ CI build for LArSoft Succeeded on slf7 for e20:prof -- details available through the CI dashboard |
|
✔️ CI build for LArSoft Succeeded on slf7 for c7: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 |
|
🚨 For more details about the warning phase, check the ci_tests ICARUS phase logs parent CI build details are available through the CI dashboard |
|
@PetrilloAtWork Hi, we got a merge conflict with recent restructuring of icarus config files. Please have a look |
… (feature/ascarpel_timing_pmt_crt, see Pull Request #440) with updates to fhicl files to include the CRT hits in stage 0. This became a bit complicated by the base of Andrea's feature branch being before the restructuring of fhicl files so I've had to reconcile that. As well, I moved the new PMT data product to the IcarusObj folder so we can be sure of where are data objects are. Note that I did not reconcile the fhicl files directly related to production running so some of the special case PMT fhicl files still need reconciliation.
…d_crt_stage0 Reconcile PR #440 with new fhicl file format, include CRT in stage 0
This PR introduces several changes related to the PMT system and the way timing is corrected and calculated:
PMTChannelMappingto include the laser optical channel in preparation of a future PR including the code for the laser calibration. It should be harmlessPMT/ICARUSFlashAssAna_module.ccnew variable are added to the TTree holding theOpFlashinformation. The new variables group together OpHit-level information related to the same PMT, in order to have a more intuitive overview of the components of each single OpFlash . It should be harmless although it would be good to verify the final data size of the calibration ntuples after this modification and verify if compatible with the space allocatedTiming/PMTTimingCorrectionService_service.cc,Timing/PMTTimingCorrectionsProvider.*are added to include a new LArSoft service that interface with the PostgreSQL calibration database and load the database entries given a run number. It should be verified the robustness of the code proposed and if there is room to improve its speed and performance.Timing/DataProducts/PMTWaveformTimeCorrection.*with the corresponding extractorPMTWaveformTimeCorrectionExtractor.*is designed to calculate and hold the time correction coming from the sampled reference signal on the spare channel of the CAEN1730V digitizers. This would allow dropping the corresponding waveform (the ones that now are saved with the instances “trigprm”, “BNB”, “NuMI”). The data product is saved following the same convention followed for the waveformsTiming/OpHitTimingCorrection_module.ccwhich takes the OpHit data products vector and generates a new OpHit data product list withPeakTimeAbs()andPeakTime()corrected for the delays calculated using the laser and muon calibration. The choice to apply that correction to the OpHit was made to preserve the representation of theOpWaveform::TimeStamp()DaqDecoderICARUSPMT_module.ccto implement the correction of the first two bullet point above and produces thePMTWaveformTimeCorrectiondata-products. It also recalculates theOpWaveform::TimeStamp()recalculating the offset starting from the sample of the "trgprim" labelled waveform. It should be verified if this approach is valid and consistent with the remaining part of the decoder logic.There should be backward compatibility with data collected previously, however, since most of the changes apply to the stage0 step of the production. Older samples must be reprocessed to include the changes here introduced