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

Constructor & Destructor Documentation

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

Definition at line 37 of file ShowerPCAPropergationStartPosition_tool.cc.

39  : IShowerTool(pset.get<fhicl::ParameterSet>("BaseTools"))
40  , fPFParticleLabel(pset.get<art::InputTag>("PFParticleLabel"))
41  , fVerbose(pset.get<int>("Verbose"))
42  , fShowerStartPositionOutputLabel(pset.get<std::string>("ShowerStartPositionOutputLabel"))
43  , fShowerCentreInputLabel(pset.get<std::string>("ShowerCentreInputLabel"))
44  , fShowerDirectionInputLabel(pset.get<std::string>("ShowerDirectionInputLabel"))
45  , fShowerStartPositionInputLabel(pset.get<std::string>("ShowerStartPositionInputLabel"))
46  {}
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::ShowerPCAPropergationStartPosition::CalculateElement ( const art::Ptr< recob::PFParticle > &  pfparticle,
art::Event Event,
reco::shower::ShowerElementHolder ShowerEleHolder 
)
overridevirtual

Implements ShowerRecoTools::IShowerTool.

Definition at line 49 of file ShowerPCAPropergationStartPosition_tool.cc.

53  {
54 
55  TVector3 ShowerCentre = {-999, -999, -999};
56 
57  //Get the start position and direction and center
58  if (!ShowerEleHolder.CheckElement(fShowerStartPositionInputLabel)) {
59  if (fVerbose)
60  mf::LogError("ShowerPCAPropergationStartPosition")
61  << "Start position not set, returning " << std::endl;
62  return 1;
63  }
64  if (!ShowerEleHolder.CheckElement(fShowerDirectionInputLabel)) {
65  if (fVerbose)
66  mf::LogError("ShowerPCAPropergationStartPosition")
67  << "Direction not set, returning " << std::endl;
68  return 1;
69  }
70  if (!ShowerEleHolder.CheckElement(fShowerCentreInputLabel)) {
71 
72  auto const clockData =
74  auto const detProp =
76 
77  // Get the assocated pfParicle vertex PFParticles
78  auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(fPFParticleLabel);
79 
80  const art::FindManyP<recob::SpacePoint>& fmspp =
81  ShowerEleHolder.GetFindManyP<recob::SpacePoint>(pfpHandle, Event, fPFParticleLabel);
82 
83  //Get the spacepoints handle and the hit assoication
84  auto const spHandle = Event.getValidHandle<std::vector<recob::SpacePoint>>(fPFParticleLabel);
85 
86  const art::FindManyP<recob::Hit>& fmh =
87  ShowerEleHolder.GetFindManyP<recob::Hit>(spHandle, Event, fPFParticleLabel);
88 
89  //Spacepoints
90  std::vector<art::Ptr<recob::SpacePoint>> spacePoints_pfp = fmspp.at(pfparticle.key());
91 
92  //We cannot progress with no spacepoints.
93  if (spacePoints_pfp.empty()) return 1;
94 
95  //Get the shower center
97  clockData, detProp, spacePoints_pfp, fmh);
98  }
99  else {
100  ShowerEleHolder.GetElement(fShowerCentreInputLabel, ShowerCentre);
101  }
102 
103  TVector3 ShowerStartPosition = {-999, -999, -999};
104  ShowerEleHolder.GetElement(fShowerStartPositionInputLabel, ShowerStartPosition);
105 
106  TVector3 ShowerDirection = {-999, -999, -999};
107  ShowerEleHolder.GetElement(fShowerDirectionInputLabel, ShowerDirection);
108 
109  //Get the projection
110  double projection = ShowerDirection.Dot(ShowerStartPosition - ShowerCentre);
111 
112  //Get the position.
113  TVector3 ShowerNewStartPosition = projection * ShowerDirection + ShowerCentre;
114  TVector3 ShowerNewStartPositionErr = {-999, -999, -999};
115 
116  ShowerEleHolder.SetElement(
117  ShowerNewStartPosition, ShowerNewStartPositionErr, fShowerStartPositionOutputLabel);
118 
119  return 0;
120  }
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)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
key_type key() const noexcept
Definition: Ptr.h:216
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
bool CheckElement(const std::string &Name) const
int GetElement(const std::string &Name, T &Element) const
const shower::LArPandoraShowerAlg & GetLArPandoraShowerAlg() const
Definition: IShowerTool.h:87
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
QTextStream & endl(QTextStream &s)

Member Data Documentation

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

Definition at line 29 of file ShowerPCAPropergationStartPosition_tool.cc.

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

Definition at line 32 of file ShowerPCAPropergationStartPosition_tool.cc.

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

Definition at line 33 of file ShowerPCAPropergationStartPosition_tool.cc.

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

Definition at line 34 of file ShowerPCAPropergationStartPosition_tool.cc.

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

Definition at line 31 of file ShowerPCAPropergationStartPosition_tool.cc.

int ShowerRecoTools::ShowerPCAPropergationStartPosition::fVerbose
private

Definition at line 30 of file ShowerPCAPropergationStartPosition_tool.cc.


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