LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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
11 
12 //LArSoft Includes
15 
16 namespace ShowerRecoTools {
17 
19 
20  public:
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 
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 
42  art::Event& Event,
43  reco::shower::ShowerElementHolder& ShowerEleHolder)
44  {
45 
46  //Check the Track has been defined
47  if (!ShowerEleHolder.CheckElement("InitialTrack")) {
48  if (fVerbose)
49  mf::LogError("ShowerTrackStartPosition") << "Initial track not set" << std::endl;
50  return 1;
51  }
52  recob::Track InitialTrack;
53  ShowerEleHolder.GetElement(fInitialTrackInputLabel, InitialTrack);
54 
55  //Set the shower start position as the
56  geo::Point_t StartPositionErr = {-999, -999, -999};
57 
58  geo::Point_t TrajPosition = InitialTrack.LocationAtPoint(0);
59  ShowerEleHolder.SetElement(TrajPosition, StartPositionErr, fShowerStartPositionOutputLabel);
60 
61  return 0;
62  }
63 }
64 
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
Definition: Track.h:160
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
STL namespace.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
parameter set interface
bool CheckElement(const std::string &Name) const
Provides recob::Track data product.
int GetElement(const std::string &Name, T &Element) const
ShowerTrackStartPosition(const fhicl::ParameterSet &pset)
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:180
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120
int CalculateElement(const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder) override
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49