Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArPseudoLayerPlugin.cc
Go to the documentation of this file.
1
9#include "Geometry/LArTPC.h"
10
11#include "Helpers/XmlHelper.h"
12
14
15#include "Pandora/Pandora.h"
17
19
20#include <limits>
21
22namespace lar_content
23{
24
25using namespace pandora;
26
27LArPseudoLayerPlugin::LArPseudoLayerPlugin() : m_zPitch(std::numeric_limits<float>::max()), m_zOffset(0.01f), m_zerothLayer(5000)
28{
29}
30
31//------------------------------------------------------------------------------------------------------------------------------------------
32
33unsigned int LArPseudoLayerPlugin::GetPseudoLayer(const pandora::CartesianVector &positionVector) const
34{
35 const float zLayer((positionVector.GetZ() + m_zOffset) / m_zPitch + static_cast<float>(m_zerothLayer));
36
37 if (zLayer < std::numeric_limits<float>::epsilon())
38 throw StatusCodeException(STATUS_CODE_FAILURE);
39
40 return static_cast<unsigned int>(zLayer);
41}
42
43//------------------------------------------------------------------------------------------------------------------------------------------
44
46{
47 const LArTPCMap &larTPCMap(this->GetPandora().GetGeometry()->GetLArTPCMap());
48
49 if (larTPCMap.empty())
50 {
51 std::cout << "LArPseudoLayerPlugin::Initialize - LArTPC description not registered with Pandora as required " << std::endl;
52 return STATUS_CODE_NOT_INITIALIZED;
53 }
54
55 const LArTPC *const pFirstLArTPC(larTPCMap.begin()->second);
56 m_zPitch = pFirstLArTPC->GetWirePitchW();
57
58 for (const LArTPCMap::value_type &mapEntry : larTPCMap)
59 {
60 const LArTPC *const pLArTPC(mapEntry.second);
61
62 if (std::fabs(m_zPitch - pLArTPC->GetWirePitchW()) > std::numeric_limits<float>::epsilon())
63 {
64 std::cout << "LArPseudoLayerPlugin::Initialize - Plugin does not support provided LArTPC configurations " << std::endl;
65 return STATUS_CODE_INVALID_PARAMETER;
66 }
67 }
68
69 return STATUS_CODE_SUCCESS;
70}
71
72//------------------------------------------------------------------------------------------------------------------------------------------
73
75{
76 return STATUS_CODE_SUCCESS;
77}
78
79} // namespace lar_content
Header file for the geometry manager class.
Header file for the lar pseudo layer plugin class.
Header file for the lar tpc class.
Header file for the pandora class.
Header file for pandora input types and associated external typedefs exposed via the PandoraApi.
Header file for the xml helper class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
unsigned int m_zerothLayer
The zeroth layer.
unsigned int GetPseudoLayer(const pandora::CartesianVector &positionVector) const
Get the appropriate pseudolayer for a specified position vector.
pandora::StatusCode Initialize()
Perform any operations that must occur after reading settings, but before running the process.
CartesianVector class.
float GetZ() const
Get the cartesian z coordinate.
LArTPC class.
Definition LArTPC.h:26
float GetWirePitchW() const
Get the w wire pitch, units mm.
Definition LArTPC.h:231
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
StatusCodeException class.
std::map< unsigned int, const LArTPC * > LArTPCMap
StatusCode
The StatusCode enum.