9 #include "art/Utilities/ToolMacros.h"
16 namespace ShowerRecoTools {
45 , fPFParticleLabel(pset.
get<art::InputTag>(
"PFParticleLabel"))
46 , fVerbose(pset.
get<int>(
"Verbose"))
53 InitialiseProduct<std::vector<recob::Vertex>>(
"myvertex");
56 InitialiseProduct<art::Assns<recob::Shower, recob::Vertex>>(
"myvertexassan");
69 auto const vtxHandle = Event.getValidHandle<std::vector<recob::Vertex>>(
fPFParticleLabel);
70 std::vector<art::Ptr<recob::Vertex>> vertices;
71 art::fill_ptr_vector(vertices, vtxHandle);
74 bool shower_direction_set = ShowerEleHolder.
CheckElement(
"ShowerDirection");
76 TVector3 ShowerDirection = {-999, -999, -999};
79 if (shower_direction_set) { ShowerEleHolder.
GetElement(
"ShowerDirection", ShowerDirection); }
82 art::Ptr<recob::Vertex> proposed_vertex = vertices[0];
83 double xyz[3] = {-999, -999, -999};
84 proposed_vertex->XYZ(xyz);
86 if (ShowerDirection.X() < 0) {
92 TVector3 recobshower_vertex = {xyz[0], xyz[1], xyz[2]};
93 TVector3 recobshower_err = {xyz[0] * 0.1, xyz[1] * 0.1, xyz[2] * 0.1};
95 ShowerEleHolder.
SetElement(recobshower_vertex, recobshower_err,
"ShowerStartPosition");
100 recobshower_vertex, recobshower_err,
"ShowerExampleTool_ShowerStartPosition");
103 ShowerEleHolder.
SetElement(new_vertex,
"myvertex");
106 std::vector<double> xyz_vec = {xyz[0], xyz[1], xyz[2]};
110 ShowerEleHolder.
SetElement(xyz_vec,
"xyz",
true);
115 if (will_be_checked) {
std::cout <<
"Element checked at save time" << std::endl; }
145 if (
fVerbose) mf::LogError(
"ShowerExampleTooAddAssn") <<
"vertex not set." << std::endl;
152 const art::Ptr<recob::Vertex> vertexptr =
153 GetProducedElementPtr<recob::Vertex>(
"myvertex", ShowerEleHolder, ptrsize);
154 const art::Ptr<recob::Shower> showerptr =
155 GetProducedElementPtr<recob::Shower>(
"shower", ShowerEleHolder);
156 AddSingle<art::Assns<recob::Shower, recob::Vertex>>(showerptr, vertexptr,
"myvertexassan");
int GetShowerNumber() const
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
void SetElementTag(const std::string &Name, bool checkelement)
Definition of vertex object for LArSoft.
void PrintElements() const
bool CheckElement(const std::string &Name) const
bool CheckElementTag(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
BEGIN_PROLOG could also be cout