Skip to content

Commit

Permalink
Merge branch 'feature/hlay_particle_ancestry_map' into release/v09_70_00
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarren committed Mar 23, 2023
2 parents af8aa6b + d8ab490 commit b3d75b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
13 changes: 7 additions & 6 deletions larg4/Analysis/CheckMCParticle_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "art_root_io/TFileDirectory.h"
#include "art_root_io/TFileService.h"
#include "lardataobj/Simulation/ParticleAncestryMap.h"
#include "nusimdata/SimulationBase/MCParticle.h"

// Root includes.
Expand Down Expand Up @@ -57,14 +58,14 @@ void larg4::CheckMCParticle::analyze(const art::Event& event)
{
#if defined _verbose_

auto allDropped = event.getMany<std::map<int, std::set<int>>>();
auto allDropped = event.getMany<sim::ParticleAncestryMap>();

for (auto const& maps : allDropped) {
for (auto const& element : *maps) {
std::cout << "Parent of dropped Tracks: " << element.first << std::endl;
std::set<int> droppedset = element.second;
std::cout << " droppedid size: " << droppedset.size() << std::endl;
for (auto const& droppedid : droppedset) {
auto const& map = maps->GetMap();
for (auto const& [parent, daughters] : map) {
std::cout << "Parent of dropped Tracks: " << parent << std::endl;
std::cout << " droppedid size: " << daughters.size() << std::endl;
for (auto const& droppedid : daughters) {
std::cout << droppedid << " ";
}
std::cout << std::endl;
Expand Down
3 changes: 2 additions & 1 deletion larg4/Core/larg4Main_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// art extensions
#include "lardataalg/MCDumpers/MCDumpers.h"
#include "lardataobj/Simulation/GeneratedParticleInfo.h"
#include "lardataobj/Simulation/ParticleAncestryMap.h"
#include "nug4/ParticleNavigation/ParticleList.h"
#include "nurandom/RandomUtils/NuRandomService.h"
// Geant4 includes
Expand Down Expand Up @@ -136,7 +137,7 @@ larg4::larg4Main::larg4Main(fhicl::ParameterSet const& p)
, uiAtBeginRun_(p.get<bool>("uiAtBeginRun", false))
, afterEvent_(p.get<std::string>("afterEvent", "pass"))
{
produces<std::map<int, std::set<int>>>();
produces<sim::ParticleAncestryMap>();
produces<std::vector<simb::MCParticle>>();
produces<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>();

Expand Down
6 changes: 2 additions & 4 deletions larg4/pluginActions/ParticleListAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ namespace larg4 {
}

partCol_ = std::make_unique<std::vector<simb::MCParticle>>();
droppedCol_ = std::make_unique<std::map<int, std::set<int>>>();
droppedCol_ = std::make_unique<sim::ParticleAncestryMap>();
tpassn_ =
std::make_unique<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>();
// Set up the utility class for the "for_each" algorithm. (We only
Expand Down Expand Up @@ -728,9 +728,7 @@ namespace larg4 {
tpassn_->addSingle(mct, mcp_ptr, truthInfo);
}
mf::LogDebug("Offset") << "nGeneratedParticles = " << nGeneratedParticles;
for (auto const& dropped : fdroppedTracksMap) {
droppedCol_->insert(dropped);
}
droppedCol_->SetMap(fdroppedTracksMap);
++nMCTruths;
}
}
Expand Down
5 changes: 3 additions & 2 deletions larg4/pluginActions/ParticleListAction_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"

#include "lardataobj/Simulation/GeneratedParticleInfo.h"
#include "lardataobj/Simulation/ParticleAncestryMap.h"

#include "artg4tk/actionBase/EventActionBase.hh"
#include "artg4tk/actionBase/SteppingActionBase.hh"
Expand Down Expand Up @@ -99,7 +100,7 @@ namespace larg4 {
{
return std::move(partCol_);
}
std::unique_ptr<std::map<int, std::set<int>>> DroppedTracksCollection()
std::unique_ptr<sim::ParticleAncestryMap> DroppedTracksCollection()
{
return std::move(droppedCol_);
}
Expand Down Expand Up @@ -197,7 +198,7 @@ namespace larg4 {
std::map<int, std::set<int>> fdroppedTracksMap;

std::unique_ptr<std::vector<simb::MCParticle>> partCol_;
std::unique_ptr<std::map<int, std::set<int>>> droppedCol_;
std::unique_ptr<sim::ParticleAncestryMap> droppedCol_;
std::unique_ptr<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>
tpassn_;
art::ProductID pid_{art::ProductID::invalid()};
Expand Down

0 comments on commit b3d75b5

Please sign in to comment.