Skip to content

Commit

Permalink
Fix typedef style
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Oct 4, 2023
1 parent 86750a4 commit 550d7c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
#include <stdexcept>
#include <string>

// Which type of collection we are reading
using colltype = edm4hep::MCParticleCollection;

struct ExampleFunctionalConsumer final : Gaudi::Functional::Consumer<void(const colltype& input), BaseClass_t> {
struct ExampleFunctionalConsumer final
: Gaudi::Functional::Consumer<void(const edm4hep::MCParticleCollection& input), BaseClass_t> {
// The pair in KeyValue can be changed from python and it corresponds
// to the name of the input collection
ExampleFunctionalConsumer(const std::string& name, ISvcLocator* svcLoc)
Expand All @@ -40,7 +38,7 @@ struct ExampleFunctionalConsumer final : Gaudi::Functional::Consumer<void(const
// This is the function that will be called to transform the data
// 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 {
void operator()(const edm4hep::MCParticleCollection& input) const override {
int i = 0;
for (const auto& particle : input) {
if ((particle.getPDG() != 1 + i + m_possibleOffset) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@

#include <string>

// Which collection we are producing
using colltype = edm4hep::MCParticleCollection;

struct ExampleFunctionalProducer final : Gaudi::Functional::Producer<colltype(), BaseClass_t> {
struct ExampleFunctionalProducer final : Gaudi::Functional::Producer<edm4hep::MCParticleCollection(), BaseClass_t> {
// The pair in KeyValue can be changed from python and it corresponds
// to the name of the output collection
ExampleFunctionalProducer(const std::string& name, ISvcLocator* svcLoc)
: Producer(name, svcLoc, KeyValue("OutputCollection", "MCParticles")) {}

// This is the function that will be called to produce the data
colltype operator()() const override {
edm4hep::MCParticleCollection operator()() const override {
auto coll = edm4hep::MCParticleCollection();
coll.push_back({1, 2, 3, 4, 5, 6, {}, {}, {}, {}, {}, {}});
coll.push_back({2, 3, 4, 5, 6, 7, {}, {}, {}, {}, {}, {}});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#include <string>

// Which type of collections we are producing
using Float_t = podio::UserDataCollection<float>;
using Particle_t = edm4hep::MCParticleCollection;
using SimTrackerHit_t = edm4hep::SimTrackerHitCollection;
using TrackerHit_t = edm4hep::TrackerHitCollection;
using Track_t = edm4hep::TrackCollection;
using Float = podio::UserDataCollection<float>;
using Particle = edm4hep::MCParticleCollection;
using SimTrackerHit = edm4hep::SimTrackerHitCollection;
using TrackerHit = edm4hep::TrackerHitCollection;
using Track = edm4hep::TrackCollection;

struct ExampleFunctionalProducerMultiple final
: Gaudi::Functional::Producer<std::tuple<Float_t, Particle_t, Particle_t, SimTrackerHit_t, TrackerHit_t, Track_t>(),
: Gaudi::Functional::Producer<std::tuple<Float, Particle, Particle, SimTrackerHit, TrackerHit, Track>(),
BaseClass_t> {
// The pairs in KeyValue can be changed from python and they correspond
// to the names of the output collections
Expand All @@ -50,7 +50,7 @@ struct ExampleFunctionalProducerMultiple final
KeyValue("OutputCollectionTrackerHits", "TrackerHits"), KeyValue("OutputCollectionTracks", "Tracks")}) {}

// This is the function that will be called to produce the data
std::tuple<Float_t, Particle_t, Particle_t, SimTrackerHit_t, TrackerHit_t, Track_t> operator()() const override {
std::tuple<Float, Particle, Particle, SimTrackerHit, TrackerHit, Track> operator()() const override {
// The following was copied and adapted from the
// k4FWCoreTest_CreateExampleEventData test

Expand Down Expand Up @@ -92,7 +92,7 @@ struct ExampleFunctionalProducerMultiple final
track.addToTrackerHits(trackerHit);
track.addToTracks(track2);

return std::make_tuple(std::move(floatVector), std::move(particles), Particle_t(), std::move(simTrackerHits),
return std::make_tuple(std::move(floatVector), std::move(particles), Particle(), std::move(simTrackerHits),
std::move(trackerHits), std::move(tracks));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ using TrackerHitColl = edm4hep::TrackerHitCollection;
using TrackColl = edm4hep::TrackCollection;

// As a simple example, we'll write an integer and a collection of MCParticles
using Counter_t = podio::UserDataCollection<int>;
using Particle_t = edm4hep::MCParticleCollection;
using Counter = podio::UserDataCollection<int>;
using Particle = edm4hep::MCParticleCollection;

struct ExampleFunctionalTransformerMultiple final
: Gaudi::Functional::MultiTransformer<std::tuple<Counter_t, Particle_t>(const FloatColl&, const ParticleColl&,
const SimTrackerHitColl&,
const TrackerHitColl&, const TrackColl&),
: Gaudi::Functional::MultiTransformer<std::tuple<Counter, Particle>(const FloatColl&, const ParticleColl&,
const SimTrackerHitColl&, const TrackerHitColl&,
const TrackColl&),
BaseClass_t> {
ExampleFunctionalTransformerMultiple(const std::string& name, ISvcLocator* svcLoc)
: MultiTransformer(
Expand All @@ -59,11 +59,10 @@ struct ExampleFunctionalTransformerMultiple final
// This is the function that will be called to transform the data
// Note that the function has to be const, as well as the collections
// we get from the input
std::tuple<Counter_t, Particle_t> operator()(const FloatColl& floatVector, const ParticleColl& particles,
const SimTrackerHitColl& simTrackerHits,
const TrackerHitColl& trackerHits,
const TrackColl& tracks) const override {
Counter_t counter;
std::tuple<Counter, Particle> operator()(const FloatColl& floatVector, const ParticleColl& particles,
const SimTrackerHitColl& simTrackerHits, const TrackerHitColl& trackerHits,
const TrackColl& tracks) const override {
Counter counter;

counter.push_back(floatVector.size());

Expand Down

0 comments on commit 550d7c8

Please sign in to comment.