-
Notifications
You must be signed in to change notification settings - Fork 35
Move PMTBeamSignal data product from icaruscode to sbnobj #832
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
Open
aheggest
wants to merge
10
commits into
develop
Choose a base branch
from
feature/aheggest_RWMinCAF
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
790445e
move PMTBeamSignal data product from icaruscode/IcarusObj to sbnobj/C…
aheggest ffbcc35
remove old PMTBeamSignal definition
aheggest 4b44b74
remove "#include icaruscode/IcarusObj/PMTBeamSignal.h" from classes.h
aheggest 8a5a79b
keep icarus::timing namespace in PMTBeamSignalsExtractor_module
aheggest 0ec30cd
fix typo in comment for PMTBeamSignalsExtractor producer namespace
aheggest 12f66d1
Revert "remove old PMTBeamSignal definition"
aheggest 2f6a05d
keep PMTBeamSignal defined in icaruscode for backward compatibility
aheggest 4023a32
fix typo and add information in comment
aheggest e695592
add simple producer module to convert PMTBeamSignal namespace from ic…
aheggest 2e7c592
keep producer general to also convert the beamTime:EW product if needed
aheggest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
icaruscode/Timing/PMTBeamSignalNamespaceConverter_module.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
//////////////////////////////////////////////////////////////////////// | ||
// Class: PMTBeamSignalNameSpaceConverter_module | ||
// Plugin Type: producer (Unknown Unknown) | ||
// File: PMTBeamSignalNameSpaceConverter_module.cc | ||
// | ||
// Generated at Thu Jun 5 14:59:32 2025 by Anna Heggestuen using cetskelgen | ||
// from cetlib version 3.18.02. | ||
//////////////////////////////////////////////////////////////////////// | ||
#include "sbnobj/Common/PMT/Data/PMTBeamSignal.hh" | ||
#include "icaruscode/IcarusObj/Legacy/PMTBeamSignal.h" | ||
|
||
#include "art/Framework/Core/EDProducer.h" | ||
#include "art/Framework/Core/ModuleMacros.h" | ||
#include "art/Framework/Principal/Event.h" | ||
#include "art/Framework/Principal/Handle.h" | ||
#include "art/Framework/Principal/Run.h" | ||
#include "art/Framework/Principal/SubRun.h" | ||
#include "canvas/Utilities/InputTag.h" | ||
#include "fhiclcpp/ParameterSet.h" | ||
#include "messagefacility/MessageLogger/MessageLogger.h" | ||
|
||
#include <memory> | ||
|
||
namespace sbn::timing { | ||
class PMTBeamSignalNamespaceConverter; | ||
} | ||
/** | ||
* @brief Copy PMTBeamSignal data product from icaruscode/IcarusObj namespace to sbnobj/Common | ||
* | ||
* This producer module simply copies what is stored in the icaruscode/IcarusObj data product | ||
* `std::vector<icarus::timing::PMTBeamSignal>` to a new sbnobj/Common data product | ||
* `std::vector<sbn::timing::PMTBeamSignal>`. This is to help with backward compatibility for | ||
* files that are produced with the `icarus::timing::PMTBeamSignal` data product. Converting | ||
* the icarus::timing namespace to sbn::timing allows us to fill this variable in the CAFs. | ||
* | ||
*/ | ||
|
||
class sbn::timing::PMTBeamSignalNamespaceConverter : public art::EDProducer { | ||
public: | ||
explicit PMTBeamSignalNamespaceConverter(fhicl::ParameterSet const& p); | ||
// The compiler-generated destructor is fine for non-base | ||
// classes without bare pointers or other resource use. | ||
|
||
// Plugins should not be copied or assigned. | ||
PMTBeamSignalNamespaceConverter(PMTBeamSignalNamespaceConverter const&) = delete; | ||
PMTBeamSignalNamespaceConverter(PMTBeamSignalNamespaceConverter&&) = delete; | ||
PMTBeamSignalNamespaceConverter& operator=(PMTBeamSignalNamespaceConverter const&) = delete; | ||
PMTBeamSignalNamespaceConverter& operator=(PMTBeamSignalNamespaceConverter&&) = delete; | ||
|
||
// Required functions. | ||
void produce(art::Event& e) override; | ||
|
||
private: | ||
|
||
/// RWM waveform instance label | ||
art::InputTag const fRWMlabel; | ||
|
||
// RWM times | ||
std::vector<icarus::timing::PMTBeamSignal> fRWMTimes; | ||
using BeamSignalCollection = std::vector<icarus::timing::PMTBeamSignal>; | ||
}; | ||
|
||
|
||
sbn::timing::PMTBeamSignalNamespaceConverter::PMTBeamSignalNamespaceConverter(fhicl::ParameterSet const& p) | ||
: EDProducer{p}, | ||
fRWMlabel(p.get<art::InputTag>("RWMlabel")) | ||
{ | ||
// Call appropriate produces<>() functions here. | ||
produces<std::vector<sbn::timing::PMTBeamSignal>>("RWM"); | ||
|
||
// Call appropriate consumes<>() for any products to be retrieved by this module. | ||
consumes<std::vector<icarus::timing::PMTBeamSignal>>(fRWMlabel); | ||
aheggest marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
void sbn::timing::PMTBeamSignalNamespaceConverter::produce(art::Event& e) | ||
{ | ||
//old `icarus::timing::PMTBeamSignal` data product | ||
fRWMTimes = e.getProduct<std::vector<icarus::timing::PMTBeamSignal>>(fRWMlabel); | ||
|
||
//new `sbn::timing::PMTBeamSignal` data product | ||
auto PMTBeamSignalColl = std::make_unique<std::vector<sbn::timing::PMTBeamSignal>>(); | ||
|
||
if (fRWMTimes.empty()) | ||
mf::LogTrace("ICARUSBeamStructureAna") << "Data product std::vector<icarus::timing::PMTBeamSignal> for '" << fRWMlabel.label() | ||
<< "' is empty in event!"; | ||
else{ | ||
for (size_t i = 0; i < fRWMTimes.size(); i++){ | ||
//std::cout << "i: " << i << ", fRWMTimes[i].specialChannel = " << fRWMTimes[i].specialChannel << "\n"; | ||
sbn::timing::PMTBeamSignal newRWMTimes;// = fRWMTimes[i]; | ||
newRWMTimes.specialChannel = fRWMTimes[i].specialChannel; | ||
newRWMTimes.digitizerLabel = fRWMTimes[i].digitizerLabel; | ||
newRWMTimes.crate = fRWMTimes[i].crate; | ||
newRWMTimes.sample = fRWMTimes[i].sample; | ||
newRWMTimes.startTimeAbs = fRWMTimes[i].startTimeAbs; | ||
newRWMTimes.startTime = fRWMTimes[i].startTime; | ||
PMTBeamSignalColl->push_back(newRWMTimes); | ||
} | ||
} | ||
e.put(std::move(PMTBeamSignalColl), "RWM"); | ||
} | ||
|
||
DEFINE_ART_MODULE(sbn::timing::PMTBeamSignalNamespaceConverter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.