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 17 of file ShowerTrackTrajPointDirection_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 43 of file ShowerTrackTrajPointDirection_tool.cc.

44  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
45  , fVerbose(pset.get<int>("Verbose"))
46  , fUsePandoraVertex(pset.get<bool>("UsePandoraVertex"))
47  , fUsePositonInfo(pset.get<bool>("UsePositonInfo"))
48  , fTrajPoint(pset.get<int>("TrajPoint"))
49  , fInitialTrackInputLabel(pset.get<std::string>("InitialTrackInputLabel"))
50  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
51  , fShowerDirectionOutputLabel(pset.get<std::string>("ShowerDirectionOutputLabel"))
52  {}
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::ShowerTrackTrajPointDirection::CalculateElement ( const art::Ptr< recob::PFParticle > &  pfparticle,
art::Event Event,
reco::shower::ShowerElementHolder ShowerEleHolder 
)
overridevirtual

Implements ShowerRecoTools::IShowerTool.

Definition at line 55 of file ShowerTrackTrajPointDirection_tool.cc.

59  {
60 
61  //Check the Track has been defined
62  if (!ShowerEleHolder.CheckElement(fInitialTrackInputLabel)) {
63  if (fVerbose)
64  mf::LogError("ShowerTrackTrajPointDirection") << "Initial track not set" << std::endl;
65  return 1;
66  }
67  recob::Track InitialTrack;
68  ShowerEleHolder.GetElement(fInitialTrackInputLabel, InitialTrack);
69 
70  if ((int)InitialTrack.NumberTrajectoryPoints() - 1 < fTrajPoint) {
71  if (fVerbose)
72  mf::LogError("ShowerTrackTrajPointDirection")
73  << "Less that fTrajPoint trajectory points, bailing." << std::endl;
74  fTrajPoint = InitialTrack.NumberTrajectoryPoints() - 1;
75  }
76 
77  //ignore bogus info.
78  auto flags = InitialTrack.FlagsAtPoint(fTrajPoint);
80  if (fVerbose)
81  mf::LogError("ShowerTrackTrajPointDirection")
82  << "Bogus trajectory point bailing." << std::endl;
83  return 1;
84  }
85 
86  geo::Vector_t Direction_vec;
87  //Get the difference between the point and the start position.
88  if (fUsePositonInfo) {
89  //Get the start position.
90  geo::Point_t StartPosition;
91  if (fUsePandoraVertex) {
92  //Check the Track has been defined
93  if (!ShowerEleHolder.CheckElement(fShowerStartPositionInputLabel)) {
94  if (fVerbose)
95  mf::LogError("ShowerTrackTrajPointDirection")
96  << "Shower start position not set" << std::endl;
97  return 1;
98  }
99  TVector3 StartPosition_vec = {-999, -999, -999};
100  ShowerEleHolder.GetElement(fShowerStartPositionInputLabel, StartPosition_vec);
101  StartPosition.SetCoordinates(
102  StartPosition_vec.X(), StartPosition_vec.Y(), StartPosition_vec.Z());
103  }
104  else {
105  StartPosition = InitialTrack.Start();
106  }
107  //Get the specific trajectory point and look and and the direction from the start position
108  geo::Point_t TrajPosition = InitialTrack.LocationAtPoint(fTrajPoint);
109  Direction_vec = (TrajPosition - StartPosition).Unit();
110  }
111  else {
112  //Use the direction of the trajection at tat point;
113  Direction_vec = InitialTrack.DirectionAtPoint(fTrajPoint);
114  }
115 
116  TVector3 Direction = {Direction_vec.X(), Direction_vec.Y(), Direction_vec.Z()};
117  TVector3 DirectionErr = {-999, -999, -999};
118  ShowerEleHolder.SetElement(Direction, DirectionErr, fShowerDirectionOutputLabel);
119  return 0;
120  }
static constexpr Flag_t NoPoint
The trajectory point is not defined.
Point_t const & LocationAtPoint(size_t i) const
Definition: Track.h:126
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.
Definition: Track.h:102
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
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Point_t const & Start() const
Access to track position at different points.
Definition: Track.h:123
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
PointFlags_t const & FlagsAtPoint(size_t i) const
Definition: Track.h:118
Vector_t DirectionAtPoint(size_t i) const
Definition: Track.h:134
Direction
Definition: AssnsIter.h:13
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)

Member Data Documentation

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

Definition at line 38 of file ShowerTrackTrajPointDirection_tool.cc.

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

Definition at line 40 of file ShowerTrackTrajPointDirection_tool.cc.

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

Definition at line 39 of file ShowerTrackTrajPointDirection_tool.cc.

int ShowerRecoTools::ShowerTrackTrajPointDirection::fTrajPoint
private

Definition at line 36 of file ShowerTrackTrajPointDirection_tool.cc.

bool ShowerRecoTools::ShowerTrackTrajPointDirection::fUsePandoraVertex
private

Definition at line 30 of file ShowerTrackTrajPointDirection_tool.cc.

bool ShowerRecoTools::ShowerTrackTrajPointDirection::fUsePositonInfo
private

Definition at line 33 of file ShowerTrackTrajPointDirection_tool.cc.

int ShowerRecoTools::ShowerTrackTrajPointDirection::fVerbose
private

Definition at line 29 of file ShowerTrackTrajPointDirection_tool.cc.


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