File indexing completed on 2025-09-13 08:17:16
0001
0002
0003
0004
0005
0006 #include <JANA/JApplication.h>
0007 #include <JANA/JApplicationFwd.h>
0008 #include <JANA/Utils/JTypeInfo.h>
0009 #include <edm4hep/MCParticleCollection.h>
0010 #include <fmt/core.h>
0011 #include <functional>
0012 #include <map>
0013 #include <memory>
0014 #include <string>
0015 #include <vector>
0016
0017 #include "algorithms/meta/SubDivideFunctors.h"
0018 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0019 #include "factories/meta/CollectionCollector_factory.h"
0020 #include "factories/meta/SubDivideCollection_factory.h"
0021
0022 extern "C" {
0023 void InitPlugin(JApplication* app) {
0024 InitJANAPlugin(app);
0025
0026 using namespace eicrecon;
0027
0028
0029 std::vector<std::string> outCollections{"MCBeamElectrons", "MCBeamProtons",
0030 "MCBeamNeutrons", "MCScatteredElectrons",
0031 "MCScatteredProtons", "MCScatteredNeutrons"};
0032 std::vector<std::vector<int>> values{{4, 11}, {4, 2212}, {4, 2112},
0033 {1, 11}, {1, 2212}, {1, 2112}};
0034
0035 app->Add(new JOmniFactoryGeneratorT<SubDivideCollection_factory<edm4hep::MCParticle>>(
0036 "BeamParticles", {"MCParticles"}, outCollections,
0037 {
0038 .function =
0039 ValueSplit<&edm4hep::MCParticle::getGeneratorStatus, &edm4hep::MCParticle::getPDG>{
0040 values},
0041 },
0042 app));
0043
0044
0045 app->Add(new JOmniFactoryGeneratorT<CollectionCollector_factory<edm4hep::MCParticle, true>>(
0046 "MCBeamHadrons", {"MCBeamProtons", "MCBeamNeutrons"}, {"MCBeamHadrons"}, app));
0047 }
0048 }