3 #include "fhiclcpp/ParameterSet.h"
4 #include "art/Utilities/ToolMacros.h"
5 #include "art/Framework/Services/Registry/ServiceHandle.h"
6 #include "art_root_io/TFileService.h"
7 #include "art/Framework/Core/ModuleMacros.h"
8 #include "art_root_io/TFileDirectory.h"
9 #include "canvas/Utilities/InputTag.h"
10 #include "messagefacility/MessageLogger/MessageLogger.h"
11 #include "canvas/Persistency/Common/FindManyP.h"
63 void reconfigure(fhicl::ParameterSet
const & pset)
override;
79 const art::Ptr<simb::MCTruth>&
TrackIDToMCTruth(
int const id)
const override;
80 const art::Ptr<simb::MCTruth>&
ParticleToMCTruth(
const simb::MCParticle*
p)
const override;
81 std::vector<const simb::MCParticle*>
MCTruthToParticles(art::Ptr<simb::MCTruth>
const& mct)
const override;
82 const std::vector< art::Ptr<simb::MCTruth> >&
MCTruthVector()
const override;
89 art::Ptr<recob::Hit>
const&
hit)
const override;
94 std::vector<int>
const& tkIDs)
const override;
99 art::Ptr<recob::Hit>
const&
hit)
const override;
103 art::Ptr<recob::Hit>
const&
hit)
const override;
107 art::Ptr<recob::SpacePoint>
const& spt,
108 art::Event
const&
evt,
109 std::string
const& label)
const override;
113 art::PtrVector<recob::Hit>
const& hits)
const override;
117 std::set<int>
const& trackIDs,
118 std::vector< art::Ptr<recob::Hit> >
const& hits)
const override;
123 std::set<int>
const& trackIDs,
125 std::vector< art::Ptr<recob::Hit> >
const& allhits,
130 std::set<int>
const& trackIDs,
131 std::vector< art::Ptr<recob::Hit> >
const& hits)
const override;
136 std::set<int>
const& trackIDs,
138 std::vector< art::Ptr<recob::Hit> >
const& allhits,
149 std::vector< art::Ptr<recob::Hit> >
const& hits)
const override;
153 std::vector< art::Ptr<recob::Hit> >
const& hits)
const override;
173 fGeometry = lar::providerFrom<geo::Geometry>();
178 mf::LogInfo(
"BackTrackerTruth") <<
"BackTrackerTruth configured\n";
201 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
202 return partInventory->ParticleList();
209 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
210 return partInventory->TrackIdToParticle_P(
id);
216 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
217 return partInventory->TrackIdToMotherParticle_P(
id);
223 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
224 return partInventory->TrackIdToMCTruth_P(
id);
230 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
231 return partInventory->ParticleToMCTruth_P(p);
237 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
238 return partInventory->MCTruthToParticles_Ps(mct);
244 art::ServiceHandle<cheat::ParticleInventoryService> partInventory;
245 return partInventory->MCTruthVector_Ps();
252 art::ServiceHandle<cheat::BackTrackerService> backTracker;
253 return backTracker->HitToTrackIDEs(clockData, hit);
258 art::Ptr<recob::Hit>
const&
hit)
const
266 std::vector<int>
const& tkIDs)
const
268 std::vector<std::vector<art::Ptr<recob::Hit>>> tkIDsToHitsVec;
269 art::ServiceHandle<cheat::BackTrackerService> backTracker;
271 for(
const auto& tkID : tkIDs)
273 std::vector<art::Ptr<recob::Hit>> hitVec = backTracker->TrackIdToHits_Ps(clockData, tkID, allhits);
274 tkIDsToHitsVec.push_back(hitVec);
277 return tkIDsToHitsVec;
285 art::Ptr<recob::Hit>
const&
hit)
const
287 art::ServiceHandle<cheat::BackTrackerService> backTracker;
288 return backTracker->HitToEveTrackIDEs(clockData, hit);
294 art::ServiceHandle<cheat::BackTrackerService> backTracker;
295 return backTracker->GetSetOfEveIds();
301 art::ServiceHandle<cheat::BackTrackerService> backTracker;
302 return backTracker->GetSetOfTrackIds();
307 std::vector< art::Ptr<recob::Hit> >
const& hits)
const
309 art::ServiceHandle<cheat::BackTrackerService> backTracker;
310 return backTracker->GetSetOfEveIds(clockData, hits);
315 std::vector< art::Ptr<recob::Hit> >
const& hits)
const
317 art::ServiceHandle<cheat::BackTrackerService> backTracker;
318 return backTracker->GetSetOfTrackIds(clockData, hits);
323 std::set<int>
const& trackIDs,
324 std::vector< art::Ptr<recob::Hit> >
const& hits)
const
326 art::ServiceHandle<cheat::BackTrackerService> backTracker;
327 return backTracker->HitCollectionPurity(clockData, trackIDs, hits);
332 std::set<int>
const& trackIDs,
333 std::vector< art::Ptr<recob::Hit> >
const& hits)
const
335 art::ServiceHandle<cheat::BackTrackerService> backTracker;
336 return backTracker->HitChargeCollectionPurity(clockData, trackIDs, hits);
342 std::set<int>
const& trackIDs,
344 std::vector< art::Ptr<recob::Hit> >
const& allhits,
347 art::ServiceHandle<cheat::BackTrackerService> backTracker;
348 return backTracker->HitCollectionEfficiency(clockData, trackIDs, hits, allhits, view);
353 std::set<int>
const& trackIDs,
355 std::vector< art::Ptr<recob::Hit> >
const& allhits,
358 art::ServiceHandle<cheat::BackTrackerService> backTracker;
359 return backTracker->HitChargeCollectionEfficiency(clockData, trackIDs, hits, allhits, view);
364 art::Ptr<recob::Hit>
const&
hit)
const
366 art::ServiceHandle<cheat::BackTrackerService> backTracker;
367 return backTracker->HitToXYZ(clockData, hit);
372 art::Ptr<recob::SpacePoint>
const& spt,
373 art::Event
const&
evt,
374 std::string
const& label)
const
376 std::vector<double> hitVec = {0.,0.,0.};
378 art::ServiceHandle<cheat::BackTrackerService> backTracker;
386 art::PtrVector<recob::Hit>
const& hits)
const
388 std::vector<art::Ptr<recob::Hit>> hitVec;
389 for(
size_t idx=0; idx<hits.size(); idx++) hitVec.push_back(hits.at(idx));
391 art::ServiceHandle<cheat::BackTrackerService> backTracker;
392 return backTracker->SpacePointHitsToWeightedXYZ(clockData, hitVec);
void Rebuild(const art::Event &evt) override
This rebuilds the internal maps, is a noop for this module since the BackTracker is a service and reb...
Utilities related to art service access.
std::set< int > GetSetOfTrackIDs() const override
const simb::MCParticle * TrackIDToParticle(int const id) const override
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
const sim::ParticleList & ParticleList() const override
Get a reference to the ParticleList.
This provides an interface which defines truth matching functions made available to downstream analys...
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth(int const id) const override
void reconfigure(fhicl::ParameterSet const &pset) override
const simb::MCParticle * TrackIDToMotherParticle(int const id) const override
double HitChargeCollectionEfficiency(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIDs, std::vector< art::Ptr< recob::Hit > > const &hits, std::vector< art::Ptr< recob::Hit > > const &allhits, geo::View_t const view) const override
std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIDsToHits(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &allhits, std::vector< int > const &tkIDs) const override
std::vector< double > SpacePointToXYZ(detinfo::DetectorClocksData const &, art::Ptr< recob::SpacePoint > const &spt, art::Event const &evt, std::string const &label) const override
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const override
std::vector< sim::TrackIDE > HitToEveID(detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const override
BackTrackerTruth(fhicl::ParameterSet const &pset)
Constructor.
double HitCollectionPurity(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIDs, std::vector< art::Ptr< recob::Hit > > const &hits) const override
Description of geometry of one entire detector.
const art::Ptr< simb::MCTruth > & ParticleToMCTruth(const simb::MCParticle *p) const override
std::vector< sim::TrackIDE > HitToTrackID(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const override
Contains all timing reference information for the detector.
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector() const override
~BackTrackerTruth()
Destructor.
std::set< int > GetSetOfEveIDs() const override
art::InputTag fTrackProducerLabel
tag for finding the tracks
2D representation of charge deposited in the TDC/wire plane
const geo::GeometryCore * fGeometry
pointer to Geometry service
double HitChargeCollectionPurity(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIDs, std::vector< art::Ptr< recob::Hit > > const &hits) const override
std::vector< const simb::MCParticle * > MCTruthToParticles(art::Ptr< simb::MCTruth > const &mct) const override
std::vector< double > SpacePointHitsToXYZ(detinfo::DetectorClocksData const &clockData, art::PtrVector< recob::Hit > const &hits) const override
art framework interface to geometry description
double HitCollectionEfficiency(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIDs, std::vector< art::Ptr< recob::Hit > > const &hits, std::vector< art::Ptr< recob::Hit > > const &allhits, geo::View_t const view) const override