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 19 of file Shower3DCylinderTrackHitFinder_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file Shower3DCylinderTrackHitFinder_tool.cc.

50  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
51  , fMaxProjectionDist(pset.get<float>("MaxProjectionDist"))
52  , fMaxPerpendicularDist(pset.get<float>("MaxPerpendicularDist"))
53  , fForwardHitsOnly(pset.get<bool>("ForwardHitsOnly"))
54  , fPFParticleLabel(pset.get<art::InputTag>("PFParticleLabel"))
55  , fVerbose(pset.get<int>("Verbose"))
56  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
57  , fInitialTrackHitsOutputLabel(pset.get<std::string>("InitialTrackHitsOutputLabel"))
59  pset.get<std::string>("InitialTrackSpacePointsOutputLabel"))
60  , fShowerDirectionInputLabel(pset.get<std::string>("ShowerDirectionInputLabel"))
61  {}
std::string string
Definition: nybbler.cc:12
T get(std::string const &key) const
Definition: ParameterSet.h:271
IShowerTool(const fhicl::ParameterSet &pset)
Definition: IShowerTool.h:28

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 64 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 138 of file Shower3DCylinderTrackHitFinder_tool.cc.

142  {
143 
144  // Make a vector to hold the output space points
145  std::vector<art::Ptr<recob::SpacePoint>> trackSpacePoints;
146 
147  for (const auto& spacePoint : spacePoints) {
148  // Calculate the projection along direction and perpendicular distance
149  // from "axis" of shower TODO: change alg to return a pair for efficiency
151  spacePoint, showerStartPosition, showerDirection);
153  spacePoint, showerStartPosition, showerDirection, proj);
154 
155  if (fForwardHitsOnly && proj < 0) continue;
156 
158  trackSpacePoints.push_back(spacePoint);
159  }
160  return trackSpacePoints;
161  }
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:87
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 37 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 44 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 45 of file Shower3DCylinderTrackHitFinder_tool.cc.

float ShowerRecoTools::Shower3DCylinderTrackHitFinder::fMaxPerpendicularDist
private

Definition at line 36 of file Shower3DCylinderTrackHitFinder_tool.cc.

float ShowerRecoTools::Shower3DCylinderTrackHitFinder::fMaxProjectionDist
private

Definition at line 35 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 40 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 46 of file Shower3DCylinderTrackHitFinder_tool.cc.

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

Definition at line 43 of file Shower3DCylinderTrackHitFinder_tool.cc.

int ShowerRecoTools::Shower3DCylinderTrackHitFinder::fVerbose
private

Definition at line 41 of file Shower3DCylinderTrackHitFinder_tool.cc.


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