65 art::View<simb::MCParticle> pcol;
72 std::map<int, int> trackIDToPColEntry;
73 for(
size_t p = 0;
p < pcol.vals().size(); ++
p) trackIDToPColEntry[pcol.vals().at(
p)->TrackId()] =
p;
76 art::Handle< std::vector<recob::Vertex> > vertexcol;
83 std::vector< art::Ptr<recob::Vertex> > vertices;
84 art::fill_ptr_vector(vertices, vertexcol);
87 std::vector< art::Ptr<recob::Vertex> >::iterator vertexitr = vertices.begin();
90 std::map<art::Ptr<simb::MCTruth>, std::vector< art::Ptr<recob::Vertex> > > vertexMap;
91 std::map<art::Ptr<simb::MCTruth>, std::vector< art::Ptr<recob::Vertex> > >::iterator vertexMapItr = vertexMap.begin();
94 while( vertexitr != vertices.end() ){
96 size_t pcolEntry = trackIDToPColEntry.find((*vertexitr)->ID())->
second;
97 const art::Ptr<simb::MCTruth> primary = fo.at(pcolEntry);
99 vertexMap[primary].push_back(*vertexitr);
104 std::unique_ptr< std::vector<recob::Event> > eventcol(
new std::vector<recob::Event>);
105 std::unique_ptr< art::Assns<recob::Event, recob::Vertex> > evassn(
new art::Assns<recob::Event, recob::Vertex>);
106 std::unique_ptr< art::Assns<recob::Event, recob::Hit> > ehassn(
new art::Assns<recob::Event, recob::Hit>);
109 for(vertexMapItr = vertexMap.begin(); vertexMapItr != vertexMap.end(); vertexMapItr++){
111 art::PtrVector<recob::Vertex> ptrvs;
113 std::vector< art::Ptr<recob::Vertex> > verts( (*vertexMapItr).second );
122 for(
size_t p = 0;
p < ptrvs.size(); ++
p){
123 std::vector< art::Ptr<recob::Hit> > hits = fm.at(
p);
128 mf::LogInfo(
"EventCheater") <<
"adding event: \n"
130 <<
"\nto collection";
134 evt.put(std::move(eventcol));
135 evt.put(std::move(evassn));
136 evt.put(std::move(ehassn));
std::string fCheatedVertexLabel
label for module creating recob::Vertex objects
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.