Skip to content

Commit

Permalink
Improve slightly the interface for reading
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Jul 27, 2023
1 parent 847ce0d commit 63c8b54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ struct ExampleFunctionalConsumer final : Gaudi::Functional::Consumer<void(const
: Consumer( name, svcLoc, KeyValue("InputLocation", "MCParticles")) {}

// This is the function that will be called to transform the data
// Note that the function has to be const, as well as all pointers to collections
// Note that the function has to be const, as well as the collections
// we get from the input
void operator()(const colltype& input) const override {
const auto* coll = input.getData();
const auto* ptr = dynamic_cast<const edm4hep::MCParticleCollection*>(coll);
auto* ptr = dynamic_cast<const edm4hep::MCParticleCollection*>(input.getData());
int i = 0;
for (const auto& p : *ptr) {
assert(p.getPDG() == 1 + i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ struct ExampleFunctionalTransformer final :
// Note that the function has to be const, as well as all pointers to collections
// we get from the input
colltype_out operator()(const colltype_in& input) const override {
const auto* coll = input.getData();
const auto* ptr = dynamic_cast<const edm4hep::MCParticleCollection*>(coll);
auto* ptr = dynamic_cast<const edm4hep::MCParticleCollection*>(input.getData());
auto coll_out = std::make_unique<edm4hep::MCParticleCollection>();
for (const auto& p : *ptr) {
auto new_particle = edm4hep::MutableMCParticle();
Expand Down

0 comments on commit 63c8b54

Please sign in to comment.