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

Public Member Functions

 PDSPCTBRawDecoder (fhicl::ParameterSet const &p)
 
 PDSPCTBRawDecoder (PDSPCTBRawDecoder const &)=delete
 
 PDSPCTBRawDecoder (PDSPCTBRawDecoder &&)=delete
 
PDSPCTBRawDecoderoperator= (PDSPCTBRawDecoder const &)=delete
 
PDSPCTBRawDecoderoperator= (PDSPCTBRawDecoder &&)=delete
 
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 Member Functions

void _process_CTB_AUX (const artdaq::Fragment &frag)
 

Private Attributes

std::string fInputLabel
 
std::string fInputContainerInstance
 
std::string fInputNonContainerInstance
 
std::string fOutputLabel
 
std::vector< raw::ctb::TriggerfTrigs
 
std::vector< raw::ctb::ChStatusfChStats
 
std::vector< raw::ctb::FeedbackfFeedbacks
 
std::vector< raw::ctb::MiscfMiscs
 
std::vector< raw::ctb::WordIndexfWordIndexes
 

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 35 of file PDSPCTBRawDecoder_module.cc.

Constructor & Destructor Documentation

PDSPCTBRawDecoder::PDSPCTBRawDecoder ( fhicl::ParameterSet const &  p)
explicit

Definition at line 70 of file PDSPCTBRawDecoder_module.cc.

71  : EDProducer{p}
72 // Initialize member data here.
73 {
74  fInputLabel = p.get<std::string>("InputLabel");
75  fInputContainerInstance = p.get<std::string>("InputContainerInstance");
76  fInputNonContainerInstance = p.get<std::string>("InputNonContainerInstance");
77  fOutputLabel = p.get<std::string>("OutputLabel");
78 
79  produces<std::vector<raw::ctb::pdspctb> >(fOutputLabel);
80 }
std::string string
Definition: nybbler.cc:12
std::string fInputNonContainerInstance
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223
PDSPCTBRawDecoder::PDSPCTBRawDecoder ( PDSPCTBRawDecoder const &  )
delete
PDSPCTBRawDecoder::PDSPCTBRawDecoder ( PDSPCTBRawDecoder &&  )
delete

Member Function Documentation

void PDSPCTBRawDecoder::_process_CTB_AUX ( const artdaq::Fragment &  frag)
private

Definition at line 125 of file PDSPCTBRawDecoder_module.cc.

126 {
127  dune::CTBFragment ctbfrag(frag);
128 
129  // use the same logic in dune-raw-data/Overlays/CTBFragment.cc:operator<<
130 
131  for (size_t iword = 0; iword < ctbfrag.NWords(); ++iword)
132  {
133  size_t ix=0;
134  uint32_t wt=0;
135  if (ctbfrag.Trigger(iword))
136  {
137  raw::ctb::Trigger tstruct;
138  tstruct.word_type = ctbfrag.Trigger(iword)->word_type;
139  wt = tstruct.word_type;
140  tstruct.trigger_word = ctbfrag.Trigger(iword)->trigger_word;
141  tstruct.timestamp = ctbfrag.Trigger(iword)->timestamp;
142  ix = fTrigs.size();
143  fTrigs.push_back(tstruct);
144  }
145  else if (ctbfrag.ChStatus(iword))
146  {
147  raw::ctb::ChStatus cstruct;
148  cstruct.word_type = ctbfrag.ChStatus(iword)->word_type;
149  wt = cstruct.word_type;
150  cstruct.pds = ctbfrag.ChStatus(iword)->pds;
151  cstruct.crt = ctbfrag.ChStatus(iword)->crt;
152  cstruct.beam_hi = ctbfrag.ChStatus(iword)->beam_hi;
153  cstruct.beam_lo = ctbfrag.ChStatus(iword)->beam_lo;
154  cstruct.timestamp = ctbfrag.ChStatus(iword)->timestamp;
155  ix = fChStats.size();
156  fChStats.push_back(cstruct);
157  }
158  else if (ctbfrag.Feedback(iword))
159  {
160  raw::ctb::Feedback fstruct;
161  fstruct.word_type = ctbfrag.Feedback(iword)->word_type;
162  wt = fstruct.word_type;
163  fstruct.padding = ctbfrag.Feedback(iword)->padding;
164  fstruct.source = ctbfrag.Feedback(iword)->source;
165  fstruct.code = ctbfrag.Feedback(iword)->code;
166  fstruct.timestamp = ctbfrag.Feedback(iword)->timestamp;
167  ix = fFeedbacks.size();
168  fFeedbacks.push_back(fstruct);
169  }
170  else
171  {
172  raw::ctb::Misc mstruct;
173  mstruct.word_type = ctbfrag.Word(iword)->word_type;
174  wt = mstruct.word_type;
175  mstruct.payload = ctbfrag.Word(iword)->payload;
176  mstruct.timestamp = ctbfrag.Word(iword)->timestamp;
177  ix = fMiscs.size();
178  fMiscs.push_back(mstruct);
179  }
180 
181  raw::ctb::WordIndex wstruct;
182  wstruct.word_type = wt;
183  wstruct.index = ix;
184  fWordIndexes.push_back(wstruct);
185 
186  }
187 }
ULong64_t trigger_word
Definition: pdspctb.h:20
uint32_t index
Definition: pdspctb.h:49
ULong64_t payload
Definition: pdspctb.h:43
uint32_t crt
Definition: pdspctb.h:27
ULong64_t timestamp
Definition: pdspctb.h:38
std::vector< raw::ctb::Feedback > fFeedbacks
uint32_t padding
Definition: pdspctb.h:35
uint32_t code
Definition: pdspctb.h:37
std::vector< raw::ctb::Misc > fMiscs
ULong64_t timestamp
Definition: pdspctb.h:21
uint32_t source
Definition: pdspctb.h:36
uint32_t word_type
Definition: pdspctb.h:19
uint32_t word_type
Definition: pdspctb.h:48
uint32_t beam_lo
Definition: pdspctb.h:29
uint32_t beam_hi
Definition: pdspctb.h:28
std::vector< raw::ctb::Trigger > fTrigs
std::vector< raw::ctb::ChStatus > fChStats
uint32_t pds
Definition: pdspctb.h:26
std::vector< raw::ctb::WordIndex > fWordIndexes
uint32_t word_type
Definition: pdspctb.h:25
uint32_t word_type
Definition: pdspctb.h:34
ULong64_t timestamp
Definition: pdspctb.h:30
ULong64_t timestamp
Definition: pdspctb.h:44
uint32_t word_type
Definition: pdspctb.h:42
PDSPCTBRawDecoder& PDSPCTBRawDecoder::operator= ( PDSPCTBRawDecoder const &  )
delete
PDSPCTBRawDecoder& PDSPCTBRawDecoder::operator= ( PDSPCTBRawDecoder &&  )
delete
void PDSPCTBRawDecoder::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 82 of file PDSPCTBRawDecoder_module.cc.

83 {
84 
85  fTrigs.clear();
86  fChStats.clear();
87  fFeedbacks.clear();
88  fMiscs.clear();
89  fWordIndexes.clear();
90 
91  // look first for container fragments and then non-container fragments
92 
93  std::vector<raw::ctb::pdspctb> pdspctbs;
94 
96  auto cont_frags = evt.getHandle<artdaq::Fragments>(itag1);
97  if (cont_frags)
98  {
99  for (auto const& cont : *cont_frags)
100  {
101  artdaq::ContainerFragment cont_frag(cont);
102  for (size_t ii = 0; ii < cont_frag.block_count(); ++ii)
103  {
104  _process_CTB_AUX(*cont_frag[ii]);
105  }
106  }
107  }
108 
110  auto frags = evt.getHandle<artdaq::Fragments>(itag2);
111  if (frags)
112  {
113  for(auto const& frag: *frags)
114  {
115  _process_CTB_AUX(frag);
116  }
117  }
118 
120  pdspctbs.push_back(ctbdp); // just one for now
121  evt.put(std::make_unique<std::vector<raw::ctb::pdspctb>>(std::move(pdspctbs)),fOutputLabel);
122 
123 }
std::string fInputNonContainerInstance
std::vector< raw::ctb::Feedback > fFeedbacks
def move(depos, offset)
Definition: depos.py:107
std::vector< raw::ctb::Misc > fMiscs
std::vector< raw::ctb::Trigger > fTrigs
std::vector< raw::ctb::ChStatus > fChStats
void _process_CTB_AUX(const artdaq::Fragment &frag)
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< raw::ctb::WordIndex > fWordIndexes
std::vector< Fragment > Fragments
Definition: HDF5Utils.h:57

Member Data Documentation

std::vector<raw::ctb::ChStatus> PDSPCTBRawDecoder::fChStats
private

Definition at line 62 of file PDSPCTBRawDecoder_module.cc.

std::vector<raw::ctb::Feedback> PDSPCTBRawDecoder::fFeedbacks
private

Definition at line 63 of file PDSPCTBRawDecoder_module.cc.

std::string PDSPCTBRawDecoder::fInputContainerInstance
private

Definition at line 55 of file PDSPCTBRawDecoder_module.cc.

std::string PDSPCTBRawDecoder::fInputLabel
private

Definition at line 54 of file PDSPCTBRawDecoder_module.cc.

std::string PDSPCTBRawDecoder::fInputNonContainerInstance
private

Definition at line 56 of file PDSPCTBRawDecoder_module.cc.

std::vector<raw::ctb::Misc> PDSPCTBRawDecoder::fMiscs
private

Definition at line 64 of file PDSPCTBRawDecoder_module.cc.

std::string PDSPCTBRawDecoder::fOutputLabel
private

Definition at line 57 of file PDSPCTBRawDecoder_module.cc.

std::vector<raw::ctb::Trigger> PDSPCTBRawDecoder::fTrigs
private

Definition at line 61 of file PDSPCTBRawDecoder_module.cc.

std::vector<raw::ctb::WordIndex> PDSPCTBRawDecoder::fWordIndexes
private

Definition at line 65 of file PDSPCTBRawDecoder_module.cc.


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