Public Member Functions | Private Attributes | List of all members
cvn::GCNGraphMaker2D Class Reference
Inheritance diagram for cvn::GCNGraphMaker2D:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 GCNGraphMaker2D (fhicl::ParameterSet const &pset)
 
 ~GCNGraphMaker2D ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fPixelMapLabel
 Module label for input space points. More...
 
float fChargeThreshold
 Minimum charge to created a graph node from a pixel. More...
 
float fNeighbourPixels
 Radius for calculating number of neighbours. More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 32 of file GCNGraphMaker2D_module.cc.

Constructor & Destructor Documentation

cvn::GCNGraphMaker2D::GCNGraphMaker2D ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 58 of file GCNGraphMaker2D_module.cc.

58  : art::EDProducer(pset),
59  fPixelMapLabel (pset.get<std::string> ("PixelMapLabel")),
60  fChargeThreshold (pset.get<float> ("ChargeThreshold")),
61  fNeighbourPixels (pset.get<float>("NeighbourPixels"))
62  {
63  produces< std::vector<cvn::GCNGraph> >();
64  }
std::string string
Definition: nybbler.cc:12
std::string fPixelMapLabel
Module label for input space points.
float fNeighbourPixels
Radius for calculating number of neighbours.
float fChargeThreshold
Minimum charge to created a graph node from a pixel.
cvn::GCNGraphMaker2D::~GCNGraphMaker2D ( )

Definition at line 67 of file GCNGraphMaker2D_module.cc.

68  {
69  //======================================================================
70  // Clean up any memory allocated by your module
71  //======================================================================
72  }

Member Function Documentation

void cvn::GCNGraphMaker2D::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 75 of file GCNGraphMaker2D_module.cc.

76  { }
void cvn::GCNGraphMaker2D::endJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 79 of file GCNGraphMaker2D_module.cc.

80  {
81  }
void cvn::GCNGraphMaker2D::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 84 of file GCNGraphMaker2D_module.cc.

85  {
86  auto pixelMaps = evt.getValidHandle<std::vector<cvn::PixelMap>>(fPixelMapLabel);
87 
88  // Create the Graph vector and fill it if we have enough hits
89  std::unique_ptr<std::vector<cvn::GCNGraph>> graphs(new std::vector<cvn::GCNGraph>);
90 
91  if(pixelMaps->size() > 0){
92 
93  cvn::GCNFeatureUtils graphUtil;
94 
95  // Get the three graphs from the pixel map
96  // These graphs contain N nodes with (wire,time) position and (charge) features
97  std::vector<cvn::GCNGraph> graphs2D = graphUtil.ExtractGraphsFromPixelMap(pixelMaps->at(0),fChargeThreshold);
98 
99  // For each of the graphs we want to add a number of neighbours feature
100  for(cvn::GCNGraph g : graphs2D){
101  std::map<unsigned int, unsigned int> neighbourMap = graphUtil.Get2DGraphNeighbourMap(g,fNeighbourPixels);
102  std::cout << "Built graph with " << g.GetNumberOfNodes() << " nodes" << std::endl;
103  for(unsigned int n = 0; n < g.GetNumberOfNodes(); ++n){
104  cvn::GCNGraphNode &node = g.GetNodeEditable(n);
105  node.AddFeature(neighbourMap.at(n));
106  }
107  // Add the graph to the output vector
108  graphs->push_back(g);
109  }
110 
111  }
112  // Write our graph to the event
113  evt.put(std::move(graphs));
114  }
static constexpr double g
Definition: Units.h:144
GCNGraph, basic input for the GCN.
Definition: GCNGraph.h:18
std::string fPixelMapLabel
Module label for input space points.
float fNeighbourPixels
Radius for calculating number of neighbours.
float fChargeThreshold
Minimum charge to created a graph node from a pixel.
std::void_t< T > n
def move(depos, offset)
Definition: depos.py:107
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
void AddFeature(float feature)
Add a node feature.
std::vector< cvn::GCNGraph > ExtractGraphsFromPixelMap(const cvn::PixelMap &pm, const float chargeThreshold) const
Convert a pixel map into three 2D GCNGraph objects.
std::map< unsigned int, unsigned int > Get2DGraphNeighbourMap(const cvn::GCNGraph &g, const unsigned int npixel) const
Get the neighbours map <graph node, neighbours> for the three 2D graph in 2 box (npixel+1) around the...
QTextStream & endl(QTextStream &s)
Class containing some utility functions for all things CVN.

Member Data Documentation

float cvn::GCNGraphMaker2D::fChargeThreshold
private

Minimum charge to created a graph node from a pixel.

Definition at line 48 of file GCNGraphMaker2D_module.cc.

float cvn::GCNGraphMaker2D::fNeighbourPixels
private

Radius for calculating number of neighbours.

Definition at line 51 of file GCNGraphMaker2D_module.cc.

std::string cvn::GCNGraphMaker2D::fPixelMapLabel
private

Module label for input space points.

Definition at line 45 of file GCNGraphMaker2D_module.cc.


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