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

Public Member Functions

 ShowerPCAPropergationStartPosition (const fhicl::ParameterSet &pset)
 
int CalculateElement (const art::Ptr< recob::PFParticle > &pfparticle, art::Event &Event, reco::shower::ShowerElementHolder &ShowerEleHolder) override
 
- Public 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)
 

Private Attributes

art::InputTag fPFParticleLabel
 
int fVerbose
 
std::string fShowerStartPositionOutputLabel
 
std::string fShowerCentreInputLabel
 
std::string fShowerDirectionInputLabel
 
std::string fShowerStartPositionInputLabel
 

Additional Inherited Members

- Protected Member Functions inherited from ShowerRecoTools::IShowerTool
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 22 of file ShowerPCAPropergationStartPosition_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file ShowerPCAPropergationStartPosition_tool.cc.

44  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
45  , fPFParticleLabel(pset.get<art::InputTag>("PFParticleLabel"))
46  , fVerbose(pset.get<int>("Verbose"))
47  , fShowerStartPositionOutputLabel(pset.get<std::string>("ShowerStartPositionOutputLabel"))
48  , fShowerCentreInputLabel(pset.get<std::string>("ShowerCentreInputLabel"))
49  , fShowerDirectionInputLabel(pset.get<std::string>("ShowerDirectionInputLabel"))
50  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
51  {}
IShowerTool(const fhicl::ParameterSet &pset)
Definition: IShowerTool.h:29

Member Function Documentation

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

Implements ShowerRecoTools::IShowerTool.

Definition at line 54 of file ShowerPCAPropergationStartPosition_tool.cc.

58  {
59 
60  TVector3 ShowerCentre = {-999, -999, -999};
61 
62  //Get the start position and direction and center
63  if (!ShowerEleHolder.CheckElement(fShowerStartPositionInputLabel)) {
64  if (fVerbose)
65  mf::LogError("ShowerPCAPropergationStartPosition")
66  << "Start position not set, returning " << std::endl;
67  return 1;
68  }
69  if (!ShowerEleHolder.CheckElement(fShowerDirectionInputLabel)) {
70  if (fVerbose)
71  mf::LogError("ShowerPCAPropergationStartPosition")
72  << "Direction not set, returning " << std::endl;
73  return 1;
74  }
75  if (!ShowerEleHolder.CheckElement(fShowerCentreInputLabel)) {
76 
77  auto const clockData =
78  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(Event);
79  auto const detProp =
80  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(Event, clockData);
81 
82  // Get the assocated pfParicle vertex PFParticles
83  auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleLabel);
84 
85  const art::FindManyP<recob::SpacePoint>& fmspp =
86  ShowerEleHolder.GetFindManyP<recob::SpacePoint>(pfpHandle, Event, fPFParticleLabel);
87 
88  //Get the spacepoints handle and the hit assoication
89  auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(fPFParticleLabel);
90 
91  const art::FindManyP<recob::Hit>& fmh =
92  ShowerEleHolder.GetFindManyP<recob::Hit>(spHandle, Event, fPFParticleLabel);
93 
94  //SpacePoints
95  std::vector<art::Ptr<recob::SpacePoint>> spacePoints_pfp = fmspp.at(pfparticle.key());
96 
97  //We cannot progress with no spacepoints.
98  if (spacePoints_pfp.empty()) return 1;
99 
100  //Get the shower center
102  clockData, detProp, spacePoints_pfp, fmh);
103  }
104  else {
105  ShowerEleHolder.GetElement(fShowerCentreInputLabel, ShowerCentre);
106  }
107 
108  TVector3 ShowerStartPosition = {-999, -999, -999};
109  ShowerEleHolder.GetElement(fShowerStartPositionInputLabel, ShowerStartPosition);
110 
111  TVector3 ShowerDirection = {-999, -999, -999};
112  ShowerEleHolder.GetElement(fShowerDirectionInputLabel, ShowerDirection);
113 
114  //Get the projection
115  double projection = ShowerDirection.Dot(ShowerStartPosition - ShowerCentre);
116 
117  //Get the position.
118  TVector3 ShowerNewStartPosition = projection * ShowerDirection + ShowerCentre;
119  TVector3 ShowerNewStartPositionErr = {-999, -999, -999};
120 
121  ShowerEleHolder.SetElement(
122  ShowerNewStartPosition, ShowerNewStartPositionErr, fShowerStartPositionOutputLabel);
123 
124  return 0;
125  }
void SetElement(T &dataproduct, const std::string &Name, bool checktag=false)
const art::FindManyP< T1 > & GetFindManyP(const art::ValidHandle< std::vector< T2 > > &handle, const art::Event &evt, const art::InputTag &moduleTag)
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
const shower::LArPandoraShowerAlg & GetLArPandoraShowerAlg() const
Definition: IShowerTool.h:88
TVector3 ShowerCentre(std::vector< art::Ptr< recob::SpacePoint >> const &showersps) const
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
auto const detProp

Member Data Documentation

art::InputTag ShowerRecoTools::ShowerPCAPropergationStartPosition::fPFParticleLabel
private

Definition at line 34 of file ShowerPCAPropergationStartPosition_tool.cc.

std::string ShowerRecoTools::ShowerPCAPropergationStartPosition::fShowerCentreInputLabel
private

Definition at line 37 of file ShowerPCAPropergationStartPosition_tool.cc.

std::string ShowerRecoTools::ShowerPCAPropergationStartPosition::fShowerDirectionInputLabel
private

Definition at line 38 of file ShowerPCAPropergationStartPosition_tool.cc.

std::string ShowerRecoTools::ShowerPCAPropergationStartPosition::fShowerStartPositionInputLabel
private

Definition at line 39 of file ShowerPCAPropergationStartPosition_tool.cc.

std::string ShowerRecoTools::ShowerPCAPropergationStartPosition::fShowerStartPositionOutputLabel
private

Definition at line 36 of file ShowerPCAPropergationStartPosition_tool.cc.

int ShowerRecoTools::ShowerPCAPropergationStartPosition::fVerbose
private

Definition at line 35 of file ShowerPCAPropergationStartPosition_tool.cc.


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