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 937 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 940 of file WebEVDServer.cxx.

941  : fEvt(&evt), fGeom(geom), fArena("wire")
942  {
943  }
const geo::GeometryCore * fGeom
TCEvent evt
Definition: DataStructs.cxx:7

Member Function Documentation

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

Implements evd::ILazy.

Definition at line 951 of file WebEVDServer.cxx.

952  {
953  Init();
954  return fArena;
955  }
template<class T>
void evd::LazyWires< T >::Init ( void  )
inlineprotected

Definition at line 958 of file WebEVDServer.cxx.

959  {
960  std::lock_guard guard(fLock);
961 
962  if(!fEvt || !fGeom) return; // already init'd
963 
964  for(art::InputTag tag: fEvt->template getInputTags<std::vector<recob::Wire>>()){
965  typename T::template HandleT<std::vector<recob::Wire>> wires; // deduce handle type
966  // This can fail in the case of dropped products
967  if(!fEvt->getByLabel(tag, wires)) continue;
968 
969  for(const recob::Wire& rbwire: *wires){
970  for(geo::WireID wire: fGeom->ChannelToWire(rbwire.Channel())){
971  // const geo::TPCID tpc(wire);
972  const geo::PlaneID plane(wire);
973 
974  const geo::WireID w0 = fGeom->GetBeginWireID(plane);
975 
976  if(fImgs[tag].count(plane) == 0){
977  fImgs[tag].emplace(plane, PNGView(fArena));
978  }
979 
980  PNGView& bytes = fImgs[tag].find(plane)->second;
981 
982  const auto adcs = rbwire.Signal();
983  for(unsigned int tick = 0; tick < adcs.size(); ++tick){
984  if(adcs[tick] <= 0) continue;
985 
986  // green channel
987  bytes(wire.Wire-w0.Wire, tick, 1) = 128; // dark green
988  // alpha channel
989  bytes(wire.Wire-w0.Wire, tick, 3) = std::max(0, std::min(int(10*adcs[tick]), 255));
990  } // end for tick
991  } // end for wire
992  } // end for rbwire
993  } // end for tag
994 
995  fEvt = 0;
996  fGeom = 0;
997  }
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
static int max(int a, int b)
std::mutex fLock
geo::WireID GetBeginWireID(geo::CryostatID const &id) const
Returns the ID of the first wire in the specified cryostat.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
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
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 945 of file WebEVDServer.cxx.

946  {
947  Init();
948  json << fImgs;
949  }
std::map< art::InputTag, std::map< geo::PlaneID, PNGView > > fImgs

Member Data Documentation

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

Definition at line 1004 of file WebEVDServer.cxx.

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

Definition at line 1000 of file WebEVDServer.cxx.

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

Definition at line 1001 of file WebEVDServer.cxx.

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

Definition at line 1006 of file WebEVDServer.cxx.

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

Definition at line 1003 of file WebEVDServer.cxx.


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