LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
StandardLoader Class Reference
Inheritance diagram for StandardLoader:
LoaderToolBase

Public Member Functions

 StandardLoader (const fhicl::ParameterSet &pset)
 Constructor. More...
 
virtual ~StandardLoader () noexcept=default
 Virtual Destructor. More...
 
void loadData (art::Event &e, vector< art::Ptr< recob::Hit >> &hitlist, vector< NuGraphInput > &inputs, vector< vector< size_t >> &idsmap) override
 loadData function More...
 
void setDebugAndPlanes (bool d, vector< std::string > &p)
 

Protected Attributes

bool debug
 
vector< std::string > planes
 

Private Attributes

art::InputTag hitInput
 
art::InputTag spsInput
 

Detailed Description

Definition at line 9 of file StandardLoader_tool.cc.

Constructor & Destructor Documentation

StandardLoader::StandardLoader ( const fhicl::ParameterSet pset)

Constructor.

Parameters
pset

Definition at line 39 of file StandardLoader_tool.cc.

References fhicl::ParameterSet::get(), and spsInput.

40  : hitInput{p.get<art::InputTag>("hitInput")}, spsInput{p.get<art::InputTag>("spsInput")}
41 {}
art::InputTag spsInput
art::InputTag hitInput
virtual StandardLoader::~StandardLoader ( )
virtualdefaultnoexcept

Virtual Destructor.

Member Function Documentation

void StandardLoader::loadData ( art::Event e,
vector< art::Ptr< recob::Hit >> &  hitlist,
vector< NuGraphInput > &  inputs,
vector< vector< size_t >> &  idsmap 
)
overridevirtual

loadData function

Parameters
art::Eventevent record, list of input, idsmap

Implements LoaderToolBase.

Definition at line 43 of file StandardLoader_tool.cc.

References DEFINE_ART_CLASS_TOOL, art::fill_ptr_vector(), art::ProductRetriever::getByLabel(), hitInput, LoaderToolBase::planes, and spsInput.

47 {
48  //
49  art::Handle<vector<recob::Hit>> hitListHandle;
50  if (e.getByLabel(hitInput, hitListHandle)) { art::fill_ptr_vector(hitlist, hitListHandle); }
51  //
52  idsmap = std::vector<std::vector<size_t>>(planes.size(), std::vector<size_t>());
53  for (auto h : hitlist) {
54  idsmap[h->View()].push_back(h.key());
55  }
56 
57  vector<int32_t> hit_table_hit_id_data;
58  vector<int32_t> hit_table_local_plane_data;
59  vector<float> hit_table_local_time_data;
60  vector<int32_t> hit_table_local_wire_data;
61  vector<float> hit_table_integral_data;
62  vector<float> hit_table_rms_data;
63  vector<int32_t> spacepoint_table_spacepoint_id_data;
64  vector<int32_t> spacepoint_table_hit_id_u_data;
65  vector<int32_t> spacepoint_table_hit_id_v_data;
66  vector<int32_t> spacepoint_table_hit_id_y_data;
67 
68  // hit table
69  for (auto h : hitlist) {
70  hit_table_hit_id_data.push_back(h.key());
71  hit_table_local_plane_data.push_back(h->View());
72  hit_table_local_time_data.push_back(h->PeakTime());
73  hit_table_local_wire_data.push_back(h->WireID().Wire);
74  hit_table_integral_data.push_back(h->Integral());
75  hit_table_rms_data.push_back(h->RMS());
76  }
77 
78  // Get spacepoints from the event record
80  vector<art::Ptr<recob::SpacePoint>> splist;
81  if (e.getByLabel(spsInput, spListHandle)) { art::fill_ptr_vector(splist, spListHandle); }
82  // Get assocations from spacepoints to hits
83  vector<vector<art::Ptr<recob::Hit>>> sp2Hit(splist.size());
84  if (splist.size() > 0) {
85  art::FindManyP<recob::Hit> fmp(spListHandle, e, spsInput);
86  for (size_t spIdx = 0; spIdx < sp2Hit.size(); ++spIdx) {
87  sp2Hit[spIdx] = fmp.at(spIdx);
88  }
89  }
90 
91  // space point table
92  for (size_t i = 0; i < splist.size(); ++i) {
93  spacepoint_table_spacepoint_id_data.push_back(i);
94  spacepoint_table_hit_id_u_data.push_back(-1);
95  spacepoint_table_hit_id_v_data.push_back(-1);
96  spacepoint_table_hit_id_y_data.push_back(-1);
97  for (size_t j = 0; j < sp2Hit[i].size(); ++j) {
98  if (sp2Hit[i][j]->View() == 0) spacepoint_table_hit_id_u_data.back() = sp2Hit[i][j].key();
99  if (sp2Hit[i][j]->View() == 1) spacepoint_table_hit_id_v_data.back() = sp2Hit[i][j].key();
100  if (sp2Hit[i][j]->View() == 2) spacepoint_table_hit_id_y_data.back() = sp2Hit[i][j].key();
101  }
102  }
103 
104  inputs.emplace_back("hit_table_hit_id", hit_table_hit_id_data);
105  inputs.emplace_back("hit_table_local_plane", hit_table_local_plane_data);
106  inputs.emplace_back("hit_table_local_time", hit_table_local_time_data);
107  inputs.emplace_back("hit_table_local_wire", hit_table_local_wire_data);
108  inputs.emplace_back("hit_table_integral", hit_table_integral_data);
109  inputs.emplace_back("hit_table_rms", hit_table_rms_data);
110 
111  inputs.emplace_back("spacepoint_table_spacepoint_id", spacepoint_table_spacepoint_id_data);
112  inputs.emplace_back("spacepoint_table_hit_id_u", spacepoint_table_hit_id_u_data);
113  inputs.emplace_back("spacepoint_table_hit_id_v", spacepoint_table_hit_id_v_data);
114  inputs.emplace_back("spacepoint_table_hit_id_y", spacepoint_table_hit_id_y_data);
115 }
vector< std::string > planes
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
art::InputTag spsInput
art::InputTag hitInput
void LoaderToolBase::setDebugAndPlanes ( bool  d,
vector< std::string > &  p 
)
inlineinherited

Definition at line 52 of file LoaderToolBase.h.

References d, and tca::debug.

53  {
54  debug = d;
55  planes = p;
56  }
vector< std::string > planes
Float_t d
Definition: plot.C:235

Member Data Documentation

bool LoaderToolBase::debug
protectedinherited

Definition at line 59 of file LoaderToolBase.h.

art::InputTag StandardLoader::hitInput
private

Definition at line 35 of file StandardLoader_tool.cc.

Referenced by loadData().

vector<std::string> LoaderToolBase::planes
protectedinherited

Definition at line 60 of file LoaderToolBase.h.

Referenced by loadData().

art::InputTag StandardLoader::spsInput
private

Definition at line 36 of file StandardLoader_tool.cc.

Referenced by loadData(), and StandardLoader().


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