DUNEAnaTrackUtils.cxx
Go to the documentation of this file.
1 /**
2 *
3 * @file dunereco/AnaUtils/DUNEAnaTrackUtils.cxx
4 *
5 * @brief Utility containing helpful functions for end users to access information about Tracks
6 */
7 
9 
15 
18 
19 namespace dune_ana
20 {
21 
22 //-----------------------------------------------------------------------------------------------------------------------------------------
23 
24 std::vector<art::Ptr<recob::Hit>> DUNEAnaTrackUtils::GetHits(const art::Ptr<recob::Track> &pTrack, const art::Event &evt, const std::string &label)
25 {
26  return DUNEAnaTrackUtils::GetAssocProductVector<recob::Hit>(pTrack,evt,label,label);
27 }
28 
29 //-----------------------------------------------------------------------------------------------------------------------------------------
30 
31 std::vector<art::Ptr<recob::SpacePoint>> DUNEAnaTrackUtils::GetSpacePoints(const art::Ptr<recob::Track> &pTrack, const art::Event &evt, const std::string &label)
32 {
33  return DUNEAnaTrackUtils::GetAssocProductVector<recob::SpacePoint>(pTrack,evt,label,label);
34 }
35 
36 //-----------------------------------------------------------------------------------------------------------------------------------------
37 
39 {
40  return DUNEAnaTrackUtils::GetAssocProduct<recob::PFParticle>(pTrack,evt,label,label);
41 }
42 
43 //-----------------------------------------------------------------------------------------------------------------------------------------
44 
46 {
47  std::vector<art::Ptr<anab::Calorimetry>> calos = DUNEAnaTrackUtils::GetAssocProductVector<anab::Calorimetry>(pTrack,evt,trackLabel,caloLabel);
48 
49  for (const art::Ptr<anab::Calorimetry> &caloObject : calos)
50  {
51  if (caloObject->PlaneID().Plane == geo::kW) return caloObject;
52  }
53 
54  // If we don't have the collection plane then give up
55  mf::LogError("DUNEAna") << "DUNEAnaTrackUtils::GetCalorimetry - no collection view calorimetry found. Returning first alternate view." << std::endl;
56 
57  return calos.at(0);
58 }
59 
60 //-----------------------------------------------------------------------------------------------------------------------------------------
61 
63 {
64  return DUNEAnaTrackUtils::GetAssocProduct<ctp::CTPResult>(pTrack,evt,trackLabel,squidLabel);
65 }
66 
67 } // namespace dune_ana
68 
static std::vector< art::Ptr< recob::SpacePoint > > GetSpacePoints(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the spacepoints associated with the track.
Class storing the result from the convolutional track PID.
Utility containing helpful functions for end users to access information about Tracks.
std::string string
Definition: nybbler.cc:12
static art::Ptr< ctp::CTPResult > GetSquIDResult(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &trackLabel, const std::string &squidLabel)
Get the SquID track PID associated with the track.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the hits associated with the track.
static art::Ptr< recob::PFParticle > GetPFParticle(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the particle associated with the track.
Declaration of signal hit object.
Provides recob::Track data product.
static art::Ptr< anab::Calorimetry > GetCalorimetry(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &trackLabel, const std::string &caloLabel)
Get the particle associated with the track.
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:131
TCEvent evt
Definition: DataStructs.cxx:7
QTextStream & endl(QTextStream &s)