All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
evd::LazyWires< T > Class Template Reference
Inheritance diagram for evd::LazyWires< T >:
evd::ILazy

Public Member Functions

 LazyWires (const T &evt, const geo::GeometryCore *geom)
 
virtual void Serialize (JSONFormatter &json) override
 
virtual PNGArenaGetArena () override
 

Protected Member Functions

void Init ()
 

Protected Attributes

const T * fEvt
 
const geo::GeometryCorefGeom
 
std::mutex fLock
 
PNGArena fArena
 
std::map< art::InputTag,
std::map< geo::PlaneID,
PNGView > > 
fImgs
 

Detailed Description

template<class T>
class evd::LazyWires< T >

Definition at line 956 of file WebEVDServer.cxx.

Constructor & Destructor Documentation

template<class T>
evd::LazyWires< T >::LazyWires ( const T &  evt,
const geo::GeometryCore geom 
)
inline

Definition at line 959 of file WebEVDServer.cxx.

960  : fEvt(&evt), fGeom(geom), fArena("wire")
961  {
962  }
const geo::GeometryCore * fGeom
TCEvent evt
Definition: DataStructs.cxx:8

Member Function Documentation

template<class T>
virtual PNGArena& evd::LazyWires< T >::GetArena ( )
inlineoverridevirtual

Implements evd::ILazy.

Definition at line 970 of file WebEVDServer.cxx.

971  {
972  Init();
973  return fArena;
974  }
template<class T>
void evd::LazyWires< T >::Init ( )
inlineprotected

Definition at line 977 of file WebEVDServer.cxx.

978  {
979  std::lock_guard guard(fLock);
980 
981  if(!fEvt || !fGeom) return; // already init'd
982 
983  for(art::InputTag tag: fEvt->template getInputTags<std::vector<recob::Wire>>()){
984  typename T::template HandleT<std::vector<recob::Wire>> wires; // deduce handle type
985  // This can fail in the case of dropped products
986  if(!fEvt->getByLabel(tag, wires)) continue;
987 
988  for(const recob::Wire& rbwire: *wires){
989  for(geo::WireID wire: fGeom->ChannelToWire(rbwire.Channel())){
990  // const geo::TPCID tpc(wire);
991  const geo::PlaneID plane(wire);
992 
993  const geo::WireID w0 = fGeom->GetBeginWireID(plane);
994 
995  if(fImgs[tag].count(plane) == 0){
996  fImgs[tag].emplace(plane, PNGView(fArena));
997  }
998 
999  PNGView& bytes = fImgs[tag].find(plane)->second;
1000 
1001  const auto adcs = rbwire.Signal();
1002  for(unsigned int tick = 0; tick < adcs.size(); ++tick){
1003  if(adcs[tick] <= 0) continue;
1004 
1005  // green channel
1006  bytes(wire.Wire-w0.Wire, tick, 1) = 128; // dark green
1007  // alpha channel
1008  bytes(wire.Wire-w0.Wire, tick, 3) = std::max(0, std::min(int(10*adcs[tick]), 255));
1009  } // end for tick
1010  } // end for wire
1011  } // end for rbwire
1012  } // end for tag
1013 
1014  fEvt = 0;
1015  fGeom = 0;
1016  }
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
const geo::GeometryCore * fGeom
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
std::mutex fLock
geo::WireID GetBeginWireID(geo::CryostatID const &id) const
Returns the ID of the first wire in the specified cryostat.
Class holding the regions of interest of signal from a channel.
Definition: Wire.h:118
std::map< art::InputTag, std::map< geo::PlaneID, PNGView > > fImgs
std::size_t count(Cont const &cont)
byte bytes
Alias for common language habits.
Definition: datasize.h:101
template<class T>
virtual void evd::LazyWires< T >::Serialize ( JSONFormatter json)
inlineoverridevirtual

Implements evd::ILazy.

Definition at line 964 of file WebEVDServer.cxx.

965  {
966  Init();
967  json << fImgs;
968  }
std::map< art::InputTag, std::map< geo::PlaneID, PNGView > > fImgs
basic_json<> json
default JSON class
Definition: json.hpp:2445

Member Data Documentation

template<class T>
PNGArena evd::LazyWires< T >::fArena
protected

Definition at line 1023 of file WebEVDServer.cxx.

template<class T>
const T* evd::LazyWires< T >::fEvt
protected

Definition at line 1019 of file WebEVDServer.cxx.

template<class T>
const geo::GeometryCore* evd::LazyWires< T >::fGeom
protected

Definition at line 1020 of file WebEVDServer.cxx.

template<class T>
std::map<art::InputTag, std::map<geo::PlaneID, PNGView> > evd::LazyWires< T >::fImgs
protected

Definition at line 1025 of file WebEVDServer.cxx.

template<class T>
std::mutex evd::LazyWires< T >::fLock
protected

Definition at line 1022 of file WebEVDServer.cxx.


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