All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShowerTrackStartPosition_tool.cc
Go to the documentation of this file.
1 //############################################################################
2 //### Name: ShowerTrackStartPosition ###
3 //### Author: Dom Barker ###
4 //### Date: 13.05.19 ###
5 //### Description: Tool for settung the shower start position to the ###
6 // start of the fitted track ###
7 //############################################################################
8 
9 //Framework Includes
10 #include "art/Utilities/ToolMacros.h"
11 
12 //LArSoft Includes
15 
16 namespace ShowerRecoTools {
17 
19 
20  public:
21  ShowerTrackStartPosition(const fhicl::ParameterSet& pset);
22 
23  //Generic Direction Finder
24  int CalculateElement(const art::Ptr<recob::PFParticle>& pfparticle,
25  art::Event& Event,
26  reco::shower::ShowerElementHolder& ShowerEleHolder) override;
27 
28  private:
29  int fVerbose;
32  };
33 
34  ShowerTrackStartPosition::ShowerTrackStartPosition(const fhicl::ParameterSet& pset)
35  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
36  , fVerbose(pset.get<int>("Verbose"))
37  , fInitialTrackInputLabel(pset.get<std::string>("InitialTrackInputLabel"))
38  , fShowerStartPositionOutputLabel(pset.get<std::string>("ShowerStartPositionOutputLabel"))
39  {}
40 
41  int
42  ShowerTrackStartPosition::CalculateElement(const art::Ptr<recob::PFParticle>& pfparticle,
43  art::Event& Event,
44  reco::shower::ShowerElementHolder& ShowerEleHolder)
45  {
46 
47  //Check the Track has been defined
48  if (!ShowerEleHolder.CheckElement("InitialTrack")) {
49  if (fVerbose)
50  mf::LogError("ShowerTrackStartPosition") << "Initial track not set" << std::endl;
51  return 1;
52  }
53  recob::Track InitialTrack;
54  ShowerEleHolder.GetElement(fInitialTrackInputLabel, InitialTrack);
55 
56  //Set the shower start position as the
57  TVector3 StartPositionErr = {-999, -999, -999};
58 
59  geo::Point_t TrajPosition_vec = InitialTrack.LocationAtPoint(0);
60  TVector3 TrajPosition = {TrajPosition_vec.X(), TrajPosition_vec.Y(), TrajPosition_vec.Z()};
61  ShowerEleHolder.SetElement(TrajPosition, StartPositionErr, fShowerStartPositionOutputLabel);
62 
63  return 0;
64  }
65 }
66 
67 DEFINE_ART_CLASS_TOOL(ShowerRecoTools::ShowerTrackStartPosition)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
Point_t const & LocationAtPoint(size_t i) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
Provides recob::Track data product.
ShowerTrackStartPosition(const fhicl::ParameterSet &pset)
int CalculateElement(const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder) override
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track: