Skip to content

Commit

Permalink
Kyle's additions to writePhysicalVolumes
Browse files Browse the repository at this point in the history
  • Loading branch information
macndev committed Mar 24, 2022
1 parent 3ff41c9 commit 7128256
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions Mu2eG4/src/writePhysicalVolumes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@
#include "art/Framework/Principal/SubRun.h"
#include "art/Framework/Principal/Handle.h"

namespace {

// Helper functions to work around the problem that, starting in art v3.11,
// the signature of put is different for events and subruns.
// A better solution would be to use template logic to make the decision.
using Collection_t = mu2e::PhysicalVolumeInfoMultiCollection;

void storeIt (art::SubRun& sr, std::unique_ptr<Collection_t>& up, const std::string& outInstanceName ){
sr.put( std::move(up), outInstanceName, art::fullSubRun());
}

void storeIt (art::Event& e, std::unique_ptr<Collection_t>& up, const std::string& outInstanceName ){
e.put( std::move(up), outInstanceName);
}

}

namespace mu2e {

template <class PRINCIPAL>
Expand All @@ -49,7 +32,13 @@ namespace mu2e {
// Append info for the current stage
mvi->emplace_back(vi);

storeIt ( store, mvi, outInstanceName);
// Signature of put depends on the type PRINCIPAL.
if constexpr (std::is_same_v<PRINCIPAL, art::SubRun>) {
store.put(std::move(mvi), outInstanceName, art::fullSubRun());
}
else {
store.put(std::move(mvi), outInstanceName);
}

return simStage;
}
Expand Down

0 comments on commit 7128256

Please sign in to comment.