13 #include <TDatabasePDG.h> 15 #include "TStopwatch.h" 32 #include "Utilities/AssociationUtil.h" 66 produces< std::vector<simb::MCTruth> >();
67 produces< std::vector<simb::MCFlux> >();
68 produces< std::vector<simb::GTruth> >();
69 produces< art::Assns<simb::MCTruth, simb::MCFlux> >();
70 produces< art::Assns<simb::MCTruth, simb::GTruth> >();
97 std::set<art::Ptr<simb::MCTruth> > truthToKeep;
102 for (
size_t p = 0;
p < particles->size(); ++
p ) {
103 for (
size_t t = 0;
t < truthAssn.at(
p).size(); ++
t ) {
105 truthToKeep.insert(mcTru);
110 std::vector< art::Handle< std::vector<simb::MCTruth> > > mclists;
114 for(
size_t mcl = 0; mcl < mclists.size(); ++mcl){
115 std::unique_ptr<std::vector<simb::MCTruth> > slimMCTruth (
new std::vector<simb::MCTruth> );
116 std::unique_ptr<std::vector<simb::MCFlux> > slimMCFlux (
new std::vector<simb::MCFlux> );
117 std::unique_ptr<std::vector<simb::GTruth> > slimGTruth (
new std::vector<simb::GTruth> );
127 for(
size_t i = 0;
i < mclistHandle->size(); ++
i){
131 if ( truthToKeep.find(mct) == truthToKeep.end() )
continue;
133 slimMCTruth->push_back(*mct);
134 for (
size_t j = 0;
j < fluxAssn.at(
i).size(); ++
j ) {
136 slimMCFlux->push_back(*theFlux);
139 for (
size_t j = 0;
j < gtruAssn.at(
i).size(); ++
j ) {
141 slimGTruth->push_back(*theGTru);
145 evt.
put(std::move(slimMCTruth));
146 evt.
put(std::move(slimMCFlux ));
147 evt.
put(std::move(slimGTruth ));
148 evt.
put(std::move(slimFluxAssns));
149 evt.
put(std::move(slimGTruAssns));
TruthSlim – remove generated objects that don't contribute.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
void beginRun(art::Run &run)
void produce(art::Event &evt)
DEFINE_ART_MODULE(TestTMapFile)
object containing MC flux information
ProductID put(std::unique_ptr< PROD > &&product)
std::string fGeantLabel
label used for the Geant simulation module
void getManyByType(std::vector< Handle< PROD >> &results) const
std::string fTruthLabel
label used for the Monte Carlo generator module
TStopwatch fStopwatch
keep track of how long it takes to run the job
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
TruthSlim(fhicl::ParameterSet const &pset)
A module to slim the generator output.