LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
LArPseudoLayerPlugin.cc
Go to the documentation of this file.
1 
9 #include "Geometry/LArTPC.h"
10 
11 #include "Helpers/XmlHelper.h"
12 
13 #include "Managers/GeometryManager.h"
14 
15 #include "Pandora/Pandora.h"
16 #include "Pandora/PandoraInputTypes.h"
17 
19 
20 #include <limits>
21 
22 namespace lar_content
23 {
24 
25 using namespace pandora;
26 
28  m_zPitch(std::numeric_limits<float>::max()),
29  m_zOffset(0.01f),
30  m_zerothLayer(5000)
31 {
32 }
33 
34 //------------------------------------------------------------------------------------------------------------------------------------------
35 
36 unsigned int LArPseudoLayerPlugin::GetPseudoLayer(const pandora::CartesianVector &positionVector) const
37 {
38  const float zLayer((positionVector.GetZ() + m_zOffset) / m_zPitch + static_cast<float>(m_zerothLayer));
39 
40  if (zLayer < std::numeric_limits<float>::epsilon())
41  throw StatusCodeException(STATUS_CODE_FAILURE);
42 
43  return static_cast<unsigned int>(zLayer);
44 }
45 
46 //------------------------------------------------------------------------------------------------------------------------------------------
47 
49 {
50  const LArTPCMap &larTPCMap(this->GetPandora().GetGeometry()->GetLArTPCMap());
51 
52  if (larTPCMap.empty())
53  {
54  std::cout << "LArPseudoLayerPlugin::Initialize - LArTPC description not registered with Pandora as required " << std::endl;
55  return STATUS_CODE_NOT_INITIALIZED;
56  }
57 
58  const LArTPC *const pFirstLArTPC(larTPCMap.begin()->second);
59  m_zPitch = pFirstLArTPC->GetWirePitchW();
60 
61  for (const LArTPCMap::value_type &mapEntry : larTPCMap)
62  {
63  const LArTPC *const pLArTPC(mapEntry.second);
64 
65  if (std::fabs(m_zPitch - pLArTPC->GetWirePitchW()) > std::numeric_limits<float>::epsilon())
66  {
67  std::cout << "LArPseudoLayerPlugin::Initialize - Plugin does not support provided LArTPC configurations " << std::endl;
68  return STATUS_CODE_INVALID_PARAMETER;
69  }
70  }
71 
72  return STATUS_CODE_SUCCESS;
73 }
74 
75 //------------------------------------------------------------------------------------------------------------------------------------------
76 
77 pandora::StatusCode LArPseudoLayerPlugin::ReadSettings(const pandora::TiXmlHandle /*xmlHandle*/)
78 {
79  return STATUS_CODE_SUCCESS;
80 }
81 
82 } // namespace lar_content
unsigned int m_zerothLayer
The zeroth layer.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
STL namespace.
unsigned int GetPseudoLayer(const pandora::CartesianVector &positionVector) const
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
Header file for the lar pseudo layer plugin class.