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

Public Member Functions

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

Private Attributes

int fVerbose
 
bool fUsePandoraVertex
 
bool fUsePositonInfo
 
int fTrajPoint
 
std::string fInitialTrackInputLabel
 
std::string fShowerStartPositionInputLabel
 
std::string fShowerDirectionOutputLabel
 

Additional Inherited Members

- 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)
 

Detailed Description

Definition at line 19 of file ShowerTrackTrajPointDirection_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file ShowerTrackTrajPointDirection_tool.cc.

46  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
47  , fVerbose(pset.get<int>("Verbose"))
48  , fUsePandoraVertex(pset.get<bool>("UsePandoraVertex"))
49  , fUsePositonInfo(pset.get<bool>("UsePositonInfo"))
50  , fTrajPoint(pset.get<int>("TrajPoint"))
51  , fInitialTrackInputLabel(pset.get<std::string>("InitialTrackInputLabel"))
52  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
53  , fShowerDirectionOutputLabel(pset.get<std::string>("ShowerDirectionOutputLabel"))
54  {}
IShowerTool(const fhicl::ParameterSet &pset)
Definition: IShowerTool.h:29

Member Function Documentation

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

Implements ShowerRecoTools::IShowerTool.

Definition at line 57 of file ShowerTrackTrajPointDirection_tool.cc.

61  {
62 
63  //Check the Track has been defined
64  if (!ShowerEleHolder.CheckElement(fInitialTrackInputLabel)) {
65  if (fVerbose)
66  mf::LogError("ShowerTrackTrajPointDirection") << "Initial track not set" << std::endl;
67  return 1;
68  }
69  recob::Track InitialTrack;
70  ShowerEleHolder.GetElement(fInitialTrackInputLabel, InitialTrack);
71 
72  if ((int)InitialTrack.NumberTrajectoryPoints() - 1 < fTrajPoint) {
73  if (fVerbose)
74  mf::LogError("ShowerTrackTrajPointDirection")
75  << "Less that fTrajPoint trajectory points, bailing." << std::endl;
76  fTrajPoint = InitialTrack.NumberTrajectoryPoints() - 1;
77  }
78 
79  //ignore bogus info.
80  auto flags = InitialTrack.FlagsAtPoint(fTrajPoint);
82  if (fVerbose)
83  mf::LogError("ShowerTrackTrajPointDirection")
84  << "Bogus trajectory point bailing." << std::endl;
85  return 1;
86  }
87 
88  geo::Vector_t Direction_vec;
89  //Get the difference between the point and the start position.
90  if (fUsePositonInfo) {
91  //Get the start position.
92  geo::Point_t StartPosition;
93  if (fUsePandoraVertex) {
94  //Check the Track has been defined
95  if (!ShowerEleHolder.CheckElement(fShowerStartPositionInputLabel)) {
96  if (fVerbose)
97  mf::LogError("ShowerTrackTrajPointDirection")
98  << "Shower start position not set" << std::endl;
99  return 1;
100  }
101  TVector3 StartPosition_vec = {-999, -999, -999};
102  ShowerEleHolder.GetElement(fShowerStartPositionInputLabel, StartPosition_vec);
103  StartPosition.SetCoordinates(
104  StartPosition_vec.X(), StartPosition_vec.Y(), StartPosition_vec.Z());
105  }
106  else {
107  StartPosition = InitialTrack.Start();
108  }
109  //Get the specific trajectory point and look and and the direction from the start position
110  geo::Point_t TrajPosition = InitialTrack.LocationAtPoint(fTrajPoint);
111  Direction_vec = (TrajPosition - StartPosition).Unit();
112  }
113  else {
114  //Use the direction of the trajection at tat point;
115  Direction_vec = InitialTrack.DirectionAtPoint(fTrajPoint);
116  }
117 
118  TVector3 Direction = {Direction_vec.X(), Direction_vec.Y(), Direction_vec.Z()};
119  TVector3 DirectionErr = {-999, -999, -999};
120  ShowerEleHolder.SetElement(Direction, DirectionErr, fShowerDirectionOutputLabel);
121  return 0;
122  }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
static constexpr Flag_t NoPoint
The trajectory point is not defined.
Point_t const & LocationAtPoint(size_t i) const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Point_t const & Start() const
Access to track position at different points.
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
PointFlags_t const & FlagsAtPoint(size_t i) const
Vector_t DirectionAtPoint(size_t i) 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
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:

Member Data Documentation

std::string ShowerRecoTools::ShowerTrackTrajPointDirection::fInitialTrackInputLabel
private

Definition at line 40 of file ShowerTrackTrajPointDirection_tool.cc.

std::string ShowerRecoTools::ShowerTrackTrajPointDirection::fShowerDirectionOutputLabel
private

Definition at line 42 of file ShowerTrackTrajPointDirection_tool.cc.

std::string ShowerRecoTools::ShowerTrackTrajPointDirection::fShowerStartPositionInputLabel
private

Definition at line 41 of file ShowerTrackTrajPointDirection_tool.cc.

int ShowerRecoTools::ShowerTrackTrajPointDirection::fTrajPoint
private

Definition at line 38 of file ShowerTrackTrajPointDirection_tool.cc.

bool ShowerRecoTools::ShowerTrackTrajPointDirection::fUsePandoraVertex
private

Definition at line 32 of file ShowerTrackTrajPointDirection_tool.cc.

bool ShowerRecoTools::ShowerTrackTrajPointDirection::fUsePositonInfo
private

Definition at line 35 of file ShowerTrackTrajPointDirection_tool.cc.

int ShowerRecoTools::ShowerTrackTrajPointDirection::fVerbose
private

Definition at line 31 of file ShowerTrackTrajPointDirection_tool.cc.


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