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

Public Member Functions

 GCNHitGraphMaker (fhicl::ParameterSet const &p)
 
 GCNHitGraphMaker (GCNHitGraphMaker const &)=delete
 
 GCNHitGraphMaker (GCNHitGraphMaker &&)=delete
 
GCNHitGraphMakeroperator= (GCNHitGraphMaker const &)=delete
 
GCNHitGraphMakeroperator= (GCNHitGraphMaker &&)=delete
 
void configure (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 
- 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 fHitModuleLabel
 

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 30 of file GCNHitGraphMaker_module.cc.

Constructor & Destructor Documentation

cvn::GCNHitGraphMaker::GCNHitGraphMaker ( fhicl::ParameterSet const &  p)
explicit

Definition at line 50 of file GCNHitGraphMaker_module.cc.

51  : EDProducer{p}
52  {
53  configure(p);
54  produces<std::vector<cvn::GCNGraph>>();
55  consumes<std::vector<recob::Hit>>(fHitModuleLabel);
56  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void configure(fhicl::ParameterSet const &p)
p
Definition: test.py:223
cvn::GCNHitGraphMaker::GCNHitGraphMaker ( GCNHitGraphMaker const &  )
delete
cvn::GCNHitGraphMaker::GCNHitGraphMaker ( GCNHitGraphMaker &&  )
delete

Member Function Documentation

void cvn::GCNHitGraphMaker::configure ( fhicl::ParameterSet const &  p)

Definition at line 58 of file GCNHitGraphMaker_module.cc.

59  {
60  fHitModuleLabel = p.get<std::string>("HitModuleLabel");
61  }
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
GCNHitGraphMaker& cvn::GCNHitGraphMaker::operator= ( GCNHitGraphMaker const &  )
delete
GCNHitGraphMaker& cvn::GCNHitGraphMaker::operator= ( GCNHitGraphMaker &&  )
delete
void cvn::GCNHitGraphMaker::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 63 of file GCNHitGraphMaker_module.cc.

64  {
65  // Retrieve hits
66  std::vector<art::Ptr<recob::Hit>> hits;
67  auto hitHandle = e.getHandle<std::vector<recob::Hit>>(fHitModuleLabel);
68  if (!hitHandle) {
70  << "Could not find hits with module label " << fHitModuleLabel;
71  }
72  art::fill_ptr_vector(hits, hitHandle);
73 
74  // Create output
75  std::unique_ptr<std::vector<cvn::GCNGraph>> graphs(new std::vector<cvn::GCNGraph>(1));
76 
77  // Helper classes and services
78  cvn::PixelMapProducer pixelUtil;
80 
81  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(e);
82  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(e, clockData);
83 
84  // Loop over hits
85  for (art::Ptr<recob::Hit> hit : hits) {
86 
87  // Get global coordinates
88  geo::WireID wireid = hit->WireID();
89  if (wireid.TPC%6 == 0 or wireid.TPC%6 == 5) continue; // skip dummy TPCs
90  unsigned int wire, plane;
91  double time;
92  pixelUtil.GetDUNE10ktGlobalWireTDC(detProp, wireid.Wire, hit->PeakTime(),
93  wireid.Plane, wireid.TPC, wire, plane, time);
94  std::vector<float> pos = {(float)plane, (float)wire, (float)time};
95  std::vector<float> feats = {hit->Integral(), hit->RMS(), (float)wireid.Wire,
96  hit->PeakTime(), (float)wireid.Plane, (float)wireid.TPC};
97 
98  // Get true particle
99  std::vector<sim::TrackIDE> ides = bt->HitToTrackIDEs(clockData, hit);
100  if (ides.size() == 0) continue; // skip hits with no truth
101  float trueID = abs(std::max_element(ides.begin(), ides.end(), [](const sim::TrackIDE &lhs,
102  const sim::TrackIDE &rhs) { return lhs.energy < rhs.energy; })->trackID);
103  std::vector<float> truth = {trueID};
104 
105  // Get
106  graphs->at(0).AddNode(pos, feats, truth);
107  // std::cout << "Adding node with plane " << plane << ", wire " << wire << ", time " << time
108  // << ", integral " << hit->Integral() << ", RMS " << hit->RMS() << ", raw wire " << wireid.Wire
109  // << ", raw time " << hit->PeakTime() << ", raw plane " << wireid.Plane << ", TPC " << wireid.TPC
110  // << " and true ID " << trueID << std::endl;
111  } // for hit
112 
113  e.put(std::move(graphs));
114 
115  }
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
float energy
energy from the particle with this trackID [MeV]
Definition: SimChannel.h:28
void GetDUNE10ktGlobalWireTDC(detinfo::DetectorPropertiesData const &detProp, unsigned int localWire, double localTDC, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane, double &globalTDC) const
T abs(T value)
bt
Definition: tracks.py:83
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
Detector simulation of raw signals on wires.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Producer algorithm for PixelMap, input to CVN neural net.
Ionization energy from a Geant4 track.
Definition: SimChannel.h:25

Member Data Documentation

std::string cvn::GCNHitGraphMaker::fHitModuleLabel
private

Definition at line 45 of file GCNHitGraphMaker_module.cc.


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