Public Member Functions | Private Member Functions | Private Attributes | List of all members
cnn::RegCNNVtxHandler Class Reference

RegCNNVtxHandler, basic output of CNN neural net. More...

#include <RegCNNVtxHandler.h>

Public Member Functions

 RegCNNVtxHandler (const fhicl::ParameterSet &pset)
 
std::vector< float > GetVertex (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::Event &evt, const RegPixelMap &pixelmap)
 

Private Member Functions

void FindGlobalVertices (const RegPixelMap &pm, std::vector< float > &outputs)
 
void getCM (const RegPixelMap &pm, float *cm_list)
 

Private Attributes

std::string fHitsModuleLabel
 
cnn::TFRegNetHandler fTFHandler1st
 
cnn::TFRegNetHandler fTFHandler2nd
 
unsigned int fTdcWidth
 
unsigned int fWireLength
 
unsigned int fTimeResolution
 
unsigned int fWireResolution
 
unsigned int fGlobalWireMethod
 
RegPixelMapProducer fProducer
 

Detailed Description

RegCNNVtxHandler, basic output of CNN neural net.

Definition at line 23 of file RegCNNVtxHandler.h.

Constructor & Destructor Documentation

cnn::RegCNNVtxHandler::RegCNNVtxHandler ( const fhicl::ParameterSet pset)

Definition at line 21 of file RegCNNVtxHandler.cxx.

21  :
22  fHitsModuleLabel (pset.get<std::string> ("HitsModuleLabel")),
23  fTFHandler1st (pset.get<fhicl::ParameterSet> ("TFNetHandler1st")),
24  fTFHandler2nd (pset.get<fhicl::ParameterSet> ("TFNetHandler2nd")),
25  fTdcWidth (pset.get<unsigned short> ("TdcWidth")),
26  fWireLength (pset.get<unsigned short> ("WireLength")),
27  fTimeResolution (pset.get<unsigned short> ("TimeResolution")),
28  fWireResolution (pset.get<unsigned short> ("WireResolution")),
29  fGlobalWireMethod (pset.get<int> ("GlobalWireMethod")),
30 // fProngOnly (pset.get<bool> ("ProngOnly")),
32  {
33  }
RegPixelMapProducer fProducer
unsigned int fWireResolution
std::string string
Definition: nybbler.cc:12
unsigned int fGlobalWireMethod
cnn::TFRegNetHandler fTFHandler1st
cnn::TFRegNetHandler fTFHandler2nd
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::string fHitsModuleLabel
unsigned int fTimeResolution

Member Function Documentation

void cnn::RegCNNVtxHandler::FindGlobalVertices ( const RegPixelMap pm,
std::vector< float > &  outputs 
)
private

Definition at line 69 of file RegCNNVtxHandler.cxx.

70  {
71  for (int ii = 0; ii < 3; ii++){
72  float vtx_wire = outputs[ii*2+1];
73  float vtx_tick = outputs[ii*2];
74  float dwire = pm.fNWire/2-vtx_wire;
75  float dtick = (pm.fNTdc/2-vtx_tick)*pm.fNTRes;
76  float cm_wire = pm.fBound.fFirstWire[ii]+pm.fNWire/2-dwire;
77  float cm_tdc = pm.fBound.fFirstTDC[ii]+pm.fNTdc*pm.fNTRes/2-dtick;
78  outputs[ii*2+1] = cm_wire;
79  outputs[ii*2] = cm_tdc;
80  }
81  }
void cnn::RegCNNVtxHandler::getCM ( const RegPixelMap pm,
float *  cm_list 
)
private

Definition at line 82 of file RegCNNVtxHandler.cxx.

83  {
84  for (int ii = 0; ii < 3; ii++){
85  float mean_wire = pm.fBound.fFirstWire[ii]+pm.fNWire/2;
86  float mean_tdc = pm.fBound.fFirstTDC[ii]+pm.fNTdc*pm.fNTRes/2;
87  cm_list[2*ii] = mean_tdc;
88  cm_list[2*ii+1] = mean_wire;
89  }
90  }
std::vector< float > cnn::RegCNNVtxHandler::GetVertex ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
art::Event evt,
const RegPixelMap pixelmap 
)

Load in the pixel map

Definition at line 34 of file RegCNNVtxHandler.cxx.

36  {
37 
38  std::vector< art::Ptr< recob::Hit > > hitlist;
39  auto hitListHandle = evt.getHandle< std::vector< recob::Hit > >(fHitsModuleLabel);
40  if (hitListHandle)
41  art::fill_ptr_vector(hitlist, hitListHandle);
42  art::FindManyP<recob::Wire> fmwire(hitListHandle, evt, fHitsModuleLabel);
43 
44  /// Load in the pixel map
45  // get vertex
46  std::vector <float> Result(3, -99999);
47  if (pixelmap.fInPM){
48  std::vector<float> networkOutput(6, -99999);
49  networkOutput = fTFHandler1st.Predict(pixelmap);
50  FindGlobalVertices(pixelmap, networkOutput);
51  std::vector <float> center_of_mass(7,0);
52  for (int ii = 0; ii < 6; ii++){
53  center_of_mass[ii] = networkOutput[ii];
54  }
55  networkOutput[1] += 7; networkOutput[5] += 7;
56  networkOutput[3] -= 9;
57 
58  RegPixelMap pm;
59  pm = fProducer.CreateMap(clockData, detProp, hitlist, fmwire, networkOutput);
60  if (pm.fInPM){
61  center_of_mass[6] = (float)(pm.fTPC%4); // add TPC info
62  Result = fTFHandler2nd.Predict(pm, center_of_mass);
63  }
64  } // end of pixelmap
65  return Result;
66  } // end og GetVertex
RegPixelMapProducer fProducer
RegPixelMap CreateMap(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit > > const &cluster, art::FindManyP< recob::Wire > const &fmwire)
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
void FindGlobalVertices(const RegPixelMap &pm, std::vector< float > &outputs)
cnn::TFRegNetHandler fTFHandler1st
cnn::TFRegNetHandler fTFHandler2nd
std::vector< float > Predict(const RegPixelMap &pm)
Return prediction arrays for RegPixelMap.
std::string fHitsModuleLabel
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297

Member Data Documentation

unsigned int cnn::RegCNNVtxHandler::fGlobalWireMethod
private

Definition at line 43 of file RegCNNVtxHandler.h.

std::string cnn::RegCNNVtxHandler::fHitsModuleLabel
private

Definition at line 36 of file RegCNNVtxHandler.h.

RegPixelMapProducer cnn::RegCNNVtxHandler::fProducer
private

Definition at line 45 of file RegCNNVtxHandler.h.

unsigned int cnn::RegCNNVtxHandler::fTdcWidth
private

Definition at line 39 of file RegCNNVtxHandler.h.

cnn::TFRegNetHandler cnn::RegCNNVtxHandler::fTFHandler1st
private

Definition at line 37 of file RegCNNVtxHandler.h.

cnn::TFRegNetHandler cnn::RegCNNVtxHandler::fTFHandler2nd
private

Definition at line 38 of file RegCNNVtxHandler.h.

unsigned int cnn::RegCNNVtxHandler::fTimeResolution
private

Definition at line 41 of file RegCNNVtxHandler.h.

unsigned int cnn::RegCNNVtxHandler::fWireLength
private

Definition at line 40 of file RegCNNVtxHandler.h.

unsigned int cnn::RegCNNVtxHandler::fWireResolution
private

Definition at line 42 of file RegCNNVtxHandler.h.


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