All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Attributes | List of all members
daq::TPCDecoder Class Reference

TPCDecoder class definiton. More...

Inheritance diagram for daq::TPCDecoder:
daq::IDecoder

Public Member Functions

 TPCDecoder (fhicl::ParameterSet const &pset)
 Constructor. More...
 
 ~TPCDecoder ()
 Destructor. More...
 
virtual void produces (art::ProducesCollector &) override
 Each algorithm may have different objects it wants "produced" so use this to let the top level producer module "know" what it is outputting. More...
 
virtual void configure (const fhicl::ParameterSet &) override
 Interface for configuring the particular algorithm tool. More...
 
virtual void initializeDataProducts () override
 Initialize any data products the tool will output. More...
 
virtual void process_fragment (const artdaq::Fragment &fragment) override
 Given a set of recob hits, run DBscan to form 3D clusters. More...
 
virtual void outputDataProducts (art::Event &event) override
 Output the data products to the event store. More...
 
- Public Member Functions inherited from daq::IDecoder
virtual ~IDecoder () noexcept=default
 Virtual Destructor. More...
 
virtual void consumes (art::ConsumesCollector &)
 Declare to the framework what you expect to read. More...
 
virtual void setupRun (art::Run const &run)
 Preparation to process a new run. More...
 
virtual void setupEvent (art::Event const &event)
 Preparation to process a new event. More...
 

Private Types

using RawDigitCollectionPtr = std::unique_ptr< std::vector< raw::RawDigit >>
 

Private Attributes

uint32_t fFragment_id_offset
 
RawDigitCollectionPtr fRawDigitCollection
 
const geo::GeometryfGeometry
 

Detailed Description

TPCDecoder class definiton.

Definition at line 39 of file TPCDecoder_tool.cc.

Member Typedef Documentation

using daq::TPCDecoder::RawDigitCollectionPtr = std::unique_ptr<std::vector<raw::RawDigit>>
private

Definition at line 90 of file TPCDecoder_tool.cc.

Constructor & Destructor Documentation

daq::TPCDecoder::TPCDecoder ( fhicl::ParameterSet const &  pset)
explicit

Constructor.

Parameters
pset

Definition at line 99 of file TPCDecoder_tool.cc.

100 {
101  this->configure(pset);
102 }
virtual void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
daq::TPCDecoder::~TPCDecoder ( )

Destructor.

Definition at line 106 of file TPCDecoder_tool.cc.

107 {
108 }

Member Function Documentation

void daq::TPCDecoder::configure ( const fhicl::ParameterSet &  pset)
overridevirtual

Interface for configuring the particular algorithm tool.

Parameters
ParameterSetThe input set of parameters for configuration

Implements daq::IDecoder.

Definition at line 116 of file TPCDecoder_tool.cc.

117 {
118  fFragment_id_offset = pset.get<uint32_t>("fragment_id_offset");
119 
120  fGeometry = art::ServiceHandle<geo::Geometry const>{}.get();
121 
122  return;
123 }
uint32_t fFragment_id_offset
const geo::Geometry * fGeometry
void daq::TPCDecoder::initializeDataProducts ( )
overridevirtual

Initialize any data products the tool will output.

Implements daq::IDecoder.

Definition at line 125 of file TPCDecoder_tool.cc.

126 {
127  fRawDigitCollection = RawDigitCollectionPtr(new std::vector<raw::RawDigit>);
128 
129  return;
130 }
RawDigitCollectionPtr fRawDigitCollection
std::unique_ptr< std::vector< raw::RawDigit >> RawDigitCollectionPtr
void daq::TPCDecoder::outputDataProducts ( art::Event &  event)
overridevirtual

Output the data products to the event store.

Parameters
eventThe event store objects

Implements daq::IDecoder.

Definition at line 172 of file TPCDecoder_tool.cc.

173 {
174  // Want the RawDigits to be sorted in channel order... has to be done somewhere so why not now?
175  std::sort(fRawDigitCollection->begin(),fRawDigitCollection->end(),[](const auto& left,const auto&right){return left.Channel() < right.Channel();});
176 
177  // Now transfer ownership to the event store
178  event.put(std::move(fRawDigitCollection));
179 
180  return;
181 }
walls no right
Definition: selectors.fcl:105
RawDigitCollectionPtr fRawDigitCollection
walls no left
Definition: selectors.fcl:105
void daq::TPCDecoder::process_fragment ( const artdaq::Fragment &  fragment)
overridevirtual

Given a set of recob hits, run DBscan to form 3D clusters.

Parameters
fragmentThe artdaq fragment to process
rawDigitColllectionThe output RawDigits

Implements daq::IDecoder.

Definition at line 132 of file TPCDecoder_tool.cc.

133 {
134  size_t fragment_id = fragment.fragmentID() - fFragment_id_offset;
135 
136  // convert fragment to Nevis fragment
137  icarus::PhysCrateFragment physCrateFragment(fragment);
138 
139  size_t nBoardsPerFragment = physCrateFragment.nBoards();
140  size_t nChannelsPerBoard = physCrateFragment.nChannelsPerBoard();
141 
142  //int channel_count=0;
143  for(size_t board = 0; board < physCrateFragment.nBoards(); board++)
144  {
145 // size_t event_number = physCrateFragment.BoardEventNumber(i_b);
146 // size_t timestamp = physCrateFragment.BoardTimeStamp(board);
147 
148  size_t boardId = nChannelsPerBoard * (nBoardsPerFragment * fragment_id + board);
149 
150  // Get the pointer to the start of this board's block of data
151  const icarus::A2795DataBlock::data_t* dataBlock = physCrateFragment.BoardData(board);
152 
153  //A2795DataBlock const& block_data = *(crate_data.BoardDataBlock(i_b));
154  for(size_t channel = 0; channel < physCrateFragment.nChannelsPerBoard(); channel++)
155  {
156  //raw::ChannelID_t channel_num = (i_ch & 0xff ) + (i_b << 8);
157  raw::ChannelID_t channel_num = boardId + channel;
158  raw::RawDigit::ADCvector_t wvfm(physCrateFragment.nSamplesPerChannel());
159 
160  // It seems that the data is read from each channel for each tick so the
161  // loop indices below are chosen to pick out the "right" ticks for a given channel
162  for(size_t tick = 0; tick < physCrateFragment.nSamplesPerChannel(); tick++)
163  wvfm[tick] = dataBlock[channel + tick * physCrateFragment.nChannelsPerBoard()];
164 
165  fRawDigitCollection->emplace_back(channel_num,physCrateFragment.nSamplesPerChannel(),wvfm);
166  }//loop over channels
167  }//loop over boards
168 
169  return;
170 }
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:73
uint32_t fFragment_id_offset
RawDigitCollectionPtr fRawDigitCollection
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void daq::TPCDecoder::produces ( art::ProducesCollector &  collector)
overridevirtual

Each algorithm may have different objects it wants "produced" so use this to let the top level producer module "know" what it is outputting.

Implements daq::IDecoder.

Definition at line 110 of file TPCDecoder_tool.cc.

111 {
112  collector.produces< std::vector<raw::RawDigit>>();
113 }

Member Data Documentation

uint32_t daq::TPCDecoder::fFragment_id_offset
private

Definition at line 92 of file TPCDecoder_tool.cc.

const geo::Geometry* daq::TPCDecoder::fGeometry
private

Definition at line 96 of file TPCDecoder_tool.cc.

RawDigitCollectionPtr daq::TPCDecoder::fRawDigitCollection
private

Definition at line 94 of file TPCDecoder_tool.cc.


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