All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ShowerRecoTools::Shower3DCylinderTrackHitFinder Class Reference
Inheritance diagram for ShowerRecoTools::Shower3DCylinderTrackHitFinder:
ShowerRecoTools::IShowerTool

Public Member Functions

 Shower3DCylinderTrackHitFinder (const fhicl::ParameterSet &pset)
 
int CalculateElement (const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder) override
 

Private Member Functions

std::vector< art::Ptr
< recob::SpacePoint > > 
FindTrackSpacePoints (std::vector< art::Ptr< recob::SpacePoint >> &spacePoints, TVector3 &showerStartPosition, TVector3 &showerDirection)
 
- Private Member Functions inherited from ShowerRecoTools::IShowerTool
 IShowerTool (const fhicl::ParameterSet &pset)
 
virtual ~IShowerTool () noexcept=default
 
int RunShowerTool (const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder, std::string evd_display_name_append="")
 
virtual void InitialiseProducers ()
 
void SetPtr (art::ProducesCollector *collector)
 
void InitaliseProducerPtr (reco::shower::ShowerProducedPtrsHolder &uniqueproducerPtrs)
 
virtual int AddAssociations (const art::Ptr< recob::PFParticle > &pfpPtr, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder)
 
const shower::LArPandoraShowerAlgGetLArPandoraShowerAlg () const
 
template<class T >
art::Ptr< T > GetProducedElementPtr (std::string Name, reco::shower::ShowerElementHolder &ShowerEleHolder, int iter=-1)
 
template<class T >
void InitialiseProduct (std::string Name, std::string InstanceName="")
 
template<class T , class A , class B >
void AddSingle (A &a, B &b, std::string Name)
 
int GetVectorPtrSize (std::string Name)
 
void PrintPtrs ()
 
void PrintPtr (std::string Name)
 

Private Attributes

float fMaxProjectionDist
 
float fMaxPerpendicularDist
 
bool fForwardHitsOnly
 
art::InputTag fPFParticleLabel
 
int fVerbose
 
std::string fShowerStartPositionInputLabel
 
std::string fInitialTrackHitsOutputLabel
 
std::string fInitialTrackSpacePointsOutputLabel
 
std::string fShowerDirectionInputLabel
 

Detailed Description

Definition at line 22 of file Shower3DCylinderTrackHitFinder_tool.cc.

Constructor & Destructor Documentation

ShowerRecoTools::Shower3DCylinderTrackHitFinder::Shower3DCylinderTrackHitFinder ( const fhicl::ParameterSet &  pset)

Definition at line 52 of file Shower3DCylinderTrackHitFinder_tool.cc.

53  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
54  , fMaxProjectionDist(pset.get<float>("MaxProjectionDist"))
55  , fMaxPerpendicularDist(pset.get<float>("MaxPerpendicularDist"))
56  , fForwardHitsOnly(pset.get<bool>("ForwardHitsOnly"))
57  , fPFParticleLabel(pset.get<art::InputTag>("PFParticleLabel"))
58  , fVerbose(pset.get<int>("Verbose"))
59  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
60  , fInitialTrackHitsOutputLabel(pset.get<std::string>("InitialTrackHitsOutputLabel"))
62  pset.get<std::string>("InitialTrackSpacePointsOutputLabel"))
63  , fShowerDirectionInputLabel(pset.get<std::string>("ShowerDirectionInputLabel"))
64  {}
IShowerTool(const fhicl::ParameterSet &pset)
Definition: IShowerTool.h:29

Member Function Documentation

int ShowerRecoTools::Shower3DCylinderTrackHitFinder::CalculateElement ( const art::Ptr< recob::PFParticle > &  pfparticle,
art::Event &  Event,
reco::shower::ShowerElementHolder ShowerEleHolder 
)
overridevirtual

Implements ShowerRecoTools::IShowerTool.

Definition at line 67 of file Shower3DCylinderTrackHitFinder_tool.cc.

71  {
72 
73  //This is all based on the shower vertex being known. If it is not lets not do the track
74  if (!ShowerEleHolder.CheckElement(fShowerStartPositionInputLabel)) {
75  if (fVerbose)
76  mf::LogError("Shower3DCylinderTrackHitFinder")
77  << "Start position not set, returning " << std::endl;
78  return 1;
79  }
80  if (!ShowerEleHolder.CheckElement("ShowerDirection")) {
81  if (fVerbose)
82  mf::LogError("Shower3DCylinderTrackHitFinder")
83  << "Direction not set, returning " << std::endl;
84  return 1;
85  }
86 
87  TVector3 ShowerStartPosition = {-999, -999, -999};
88  ShowerEleHolder.GetElement(fShowerStartPositionInputLabel, ShowerStartPosition);
89 
90  TVector3 ShowerDirection = {-999, -999, -999};
91  ShowerEleHolder.GetElement(fShowerDirectionInputLabel, ShowerDirection);
92 
93  // Get the assocated pfParicle Handle
94  auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleLabel);
95 
96  // Get the spacepoint - PFParticle assn
97  const art::FindManyP<recob::SpacePoint>& fmspp =
98  ShowerEleHolder.GetFindManyP<recob::SpacePoint>(pfpHandle, Event, fPFParticleLabel);
99 
100  // Get the spacepoints
101  auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(fPFParticleLabel);
102 
103  // Get the hits associated with the space points
104  const art::FindManyP<recob::Hit>& fmhsp =
105  ShowerEleHolder.GetFindManyP<recob::Hit>(spHandle, Event, fPFParticleLabel);
106 
107  // Get the SpacePoints
108  std::vector<art::Ptr<recob::SpacePoint>> spacePoints = fmspp.at(pfparticle.key());
109 
110  //We cannot progress with no spacepoints.
111  if (spacePoints.empty()) {
112  if (fVerbose)
113  mf::LogError("Shower3DCylinderTrackHitFinder")
114  << "No space points, returning " << std::endl;
115  return 1;
116  }
117 
118  // Order the spacepoints
120  spacePoints, ShowerStartPosition, ShowerDirection);
121 
122  // Get only the space points from the track
123  std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
124  trackSpacePoints = FindTrackSpacePoints(spacePoints, ShowerStartPosition, ShowerDirection);
125 
126  // Get the hits associated to the space points and seperate them by planes
127  std::vector<art::Ptr<recob::Hit>> trackHits;
128  for (auto const& spacePoint : trackSpacePoints) {
129  const art::Ptr<recob::Hit> hit = fmhsp.at(spacePoint.key()).front();
130  // const art::Ptr<recob::Hit> hit = fohsp.at(spacePoint.key());
131  trackHits.push_back(hit);
132  }
133 
134  ShowerEleHolder.SetElement(trackHits, fInitialTrackHitsOutputLabel);
135  ShowerEleHolder.SetElement(trackSpacePoints, fInitialTrackSpacePointsOutputLabel);
136 
137  return 0;
138  }
std::vector< art::Ptr< recob::SpacePoint > > FindTrackSpacePoints(std::vector< art::Ptr< recob::SpacePoint >> &spacePoints, TVector3 &showerStartPosition, TVector3 &showerDirection)
void OrderShowerSpacePoints(std::vector< art::Ptr< recob::SpacePoint >> &showersps, TVector3 const &vertex, TVector3 const &direction) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
process_name hit
Definition: cheaterreco.fcl:51
walls no front
Definition: selectors.fcl:105
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
const shower::LArPandoraShowerAlg & GetLArPandoraShowerAlg() const
Definition: IShowerTool.h:88
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
std::vector< art::Ptr< recob::SpacePoint > > ShowerRecoTools::Shower3DCylinderTrackHitFinder::FindTrackSpacePoints ( std::vector< art::Ptr< recob::SpacePoint >> &  spacePoints,
TVector3 &  showerStartPosition,
TVector3 &  showerDirection 
)
private

Definition at line 141 of file Shower3DCylinderTrackHitFinder_tool.cc.

145  {
146 
147  // Make a vector to hold the output space points
148  std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
149 
150  for (const auto& spacePoint : spacePoints) {
151  // Calculate the projection along direction and perpendicular distance
152  // from "axis" of shower TODO: change alg to return a pair for efficiency
154  spacePoint, showerStartPosition, showerDirection);
156  spacePoint, showerStartPosition, showerDirection, proj);
157 
158  if (fForwardHitsOnly && proj < 0) continue;
159 
161  trackSpacePoints.push_back(spacePoint);
162  }
163  return trackSpacePoints;
164  }
T abs(T value)
double SpacePointProjection(art::Ptr< recob::SpacePoint > const &sp, TVector3 const &vertex, TVector3 const &direction) const
const shower::LArPandoraShowerAlg & GetLArPandoraShowerAlg() const
Definition: IShowerTool.h:88
double SpacePointPerpendicular(art::Ptr< recob::SpacePoint > const &sp, TVector3 const &vertex, TVector3 const &direction) const

Member Data Documentation

bool ShowerRecoTools::Shower3DCylinderTrackHitFinder::fForwardHitsOnly
private

Definition at line 40 of file Shower3DCylinderTrackHitFinder_tool.cc.

std::string ShowerRecoTools::Shower3DCylinderTrackHitFinder::fInitialTrackHitsOutputLabel
private

Definition at line 47 of file Shower3DCylinderTrackHitFinder_tool.cc.

std::string ShowerRecoTools::Shower3DCylinderTrackHitFinder::fInitialTrackSpacePointsOutputLabel
private

Definition at line 48 of file Shower3DCylinderTrackHitFinder_tool.cc.

float ShowerRecoTools::Shower3DCylinderTrackHitFinder::fMaxPerpendicularDist
private

Definition at line 39 of file Shower3DCylinderTrackHitFinder_tool.cc.

float ShowerRecoTools::Shower3DCylinderTrackHitFinder::fMaxProjectionDist
private

Definition at line 38 of file Shower3DCylinderTrackHitFinder_tool.cc.

art::InputTag ShowerRecoTools::Shower3DCylinderTrackHitFinder::fPFParticleLabel
private

Definition at line 43 of file Shower3DCylinderTrackHitFinder_tool.cc.

std::string ShowerRecoTools::Shower3DCylinderTrackHitFinder::fShowerDirectionInputLabel
private

Definition at line 49 of file Shower3DCylinderTrackHitFinder_tool.cc.

std::string ShowerRecoTools::Shower3DCylinderTrackHitFinder::fShowerStartPositionInputLabel
private

Definition at line 46 of file Shower3DCylinderTrackHitFinder_tool.cc.

int ShowerRecoTools::Shower3DCylinderTrackHitFinder::fVerbose
private

Definition at line 44 of file Shower3DCylinderTrackHitFinder_tool.cc.


The documentation for this class was generated from the following file: