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,
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 
41  int
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 
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
std::string string
Definition: nybbler.cc:12
Point_t const & LocationAtPoint(size_t i) const
Definition: Track.h:126
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
STL namespace.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
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
ShowerTrackStartPosition(const fhicl::ParameterSet &pset)
Definition: types.h:32
Provides recob::Track data product.
int CalculateElement(const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder) override
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
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
QTextStream & endl(QTextStream &s)