217 art::Handle<std::vector<recob::Hit>> hitListHandle;
219 std::vector<recob::Hit>
const& hitVector(*hitListHandle);
221 std::vector<hit_origin_t> hitOrigins(hitVector.size());
224 art::Handle<std::vector<sim::MCHitCollection>> mchitListHandle;
226 std::vector<sim::MCHitCollection>
const& mchitcolVector(*mchitListHandle);
229 art::Handle<std::vector<simb::MCParticle>> mcParticleHandle;
231 std::vector<simb::MCParticle>
const& mcParticleVector(*mcParticleHandle);
234 art::Handle<art::Assns<simb::MCParticle, simb::MCTruth>> assnMCParticleTruthHandle;
237 std::vector<const simb::MCTruth*> particle_to_truth =
241 std::map<int, const simb::MCTruth*> trackIDToTruthMap;
242 for (
size_t p_iter = 0; p_iter < mcParticleVector.size(); p_iter++)
243 trackIDToTruthMap[mcParticleVector[p_iter].TrackId()] = particle_to_truth[p_iter];
245 FillMCInfo(
evt, hitVector, hitOrigins, mchitcolVector, trackIDToTruthMap);
247 art::Handle<std::vector<recob::Track>> trackListHandle;
249 std::vector<recob::Track>
const& trackVector(*trackListHandle);
251 art::Handle<std::vector<recob::Cluster>> clusterListHandle;
253 std::vector<recob::Cluster>
const& clusterVector(*clusterListHandle);
255 art::Handle<art::Assns<recob::Hit, recob::Track>> assnHitTrackHandle;
257 std::vector<std::vector<size_t>> track_indices_per_hit =
260 art::Handle<art::Assns<recob::Hit, recob::Cluster>> assnHitClusterHandle;
262 std::vector<std::vector<size_t>> cluster_indices_per_hit =
265 std::vector<art::Handle<std::vector<anab::CosmicTag>>> cosmicTagHandlesVector(
267 std::vector<art::Handle<art::Assns<recob::Track, anab::CosmicTag>>> assnTrackTagHandlesVector(
269 std::vector<std::vector<const anab::CosmicTag*>> tags_per_track(
271 std::vector<art::Handle<art::Assns<recob::Cluster, anab::CosmicTag>>> assnClusterTagHandlesVector(
273 std::vector<std::vector<const anab::CosmicTag*>> tags_per_cluster(
285 for (
auto const& pair : *assnTrackTagHandlesVector[label_i])
286 tags_per_track.at(pair.first.key())[label_i] = &(*(pair.second));
292 for (
auto const& pair : *assnClusterTagHandlesVector[label_i])
293 tags_per_cluster.at(pair.first.key())[label_i] = &(*(pair.second));
299 std::vector<std::vector<bool>> hitsAccounted(
301 std::vector<bool> hitsAllTags(hitVector.size(),
false);
303 for (
size_t hit_iter = 0; hit_iter < hitVector.size(); hit_iter++) {
305 float charge = hitVector[hit_iter].Integral();
308 if (track_indices_per_hit[hit_iter].
size() != 0)
312 track_indices_per_hit[hit_iter],
314 hitsAccounted[hit_iter],
317 if (cluster_indices_per_hit[hit_iter].
size() != 0)
321 cluster_indices_per_hit[hit_iter],
323 hitsAccounted[hit_iter],
326 if (hitsAllTags[hit_iter])
FillAllTagsInfo(hitVector[hit_iter], origin);
std::string fMCHitsModuleLabel
void FillAllTagsInfo(recob::Hit const &hit, hit_origin_t const &origin)
void FillTrackInfo(size_t const &hit_iter, hit_origin_t const &origin, float const &charge, std::vector< size_t > const &track_indices_this_hit, std::vector< std::vector< const anab::CosmicTag * >> const &tags_per_cluster, std::vector< bool > &hitsAccounted_per_tag, std::vector< bool > &hitsAllTags)
std::vector< const U * > GetAssociatedVectorOneP(art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
std::size_t size(FixedBins< T, C > const &) noexcept
std::string fTrackModuleLabel
std::string fHitsModuleLabel
void FillMCInfo(art::Event const &e, std::vector< recob::Hit > const &hitlist, std::vector< hit_origin_t > &hitOrigins, std::vector< sim::MCHitCollection > const &mchitCollectionVector, std::map< int, const simb::MCTruth * > const &trackIDToTruthMap)
std::string fClusterModuleLabel
void InitEventTree(int run_number, int event_number)
std::string fMCModuleLabel
std::vector< std::vector< size_t > > GetAssociatedVectorManyI(art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
constexpr Point origin()
Returns a origin position with a point of the specified type.
void FillClusterInfo(size_t const &hit_iter, hit_origin_t const &origin, float const &charge, std::vector< size_t > const &cluster_indices_this_hit, std::vector< std::vector< const anab::CosmicTag * >> const &tags_per_cluster, std::vector< bool > &hitsAccounted_per_tag, std::vector< bool > &hitsAllTags)
std::vector< std::string > fCosmicTagAssocLabel