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

Classes

class  Config
 

Public Member Functions

 DaqDecoderIcarusPMTold (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 

Private Member Functions

void process_fragment (art::Event &event, const artdaq::Fragment &frag, std::unique_ptr< std::vector< raw::RawDigit >> &product_collectionf)
 

Private Attributes

art::InputTag _tag
 
Config _config
 

Detailed Description

Definition at line 37 of file DaqDecoderICARUSPMTold_module.cc.

Constructor & Destructor Documentation

daq::DaqDecoderIcarusPMTold::DaqDecoderIcarusPMTold ( fhicl::ParameterSet const &  p)
explicit

Definition at line 93 of file DaqDecoderICARUSPMTold_module.cc.

93  :
94  art::EDProducer{param},
95  _tag(param.get<art::InputTag>("FragmentsLabel", "daq:CAENV1730")),
96  _config(param)//,
97  //_last_event_number(0),
98  //_last_trig_frame_number(0)
99 {
100 
101  // produce stuff
102  produces<std::vector<raw::OpDetWaveform>>();
103  // if (_config.produce_header) {
104  // produces<std::vector<tpcAnalysis::HeaderData>>();
105  // }
106 }

Member Function Documentation

void daq::DaqDecoderIcarusPMTold::process_fragment ( art::Event &  event,
const artdaq::Fragment &  frag,
std::unique_ptr< std::vector< raw::RawDigit >> &  product_collectionf 
)
private

Definition at line 233 of file DaqDecoderICARUSPMTold_module.cc.

234 {
235  // convert fragment to Nevis fragment
236  icarus::PhysCrateFragment fragment(frag);
237  std::cout << " n boards " << fragment.nBoards() << std::endl;
238  //int channel_count=0;
239 
240  for(size_t i_b=0; i_b < fragment.nBoards(); i_b++)
241  {
242  //A2795DataBlock const& block_data = *(crate_data.BoardDataBlock(i_b));
243 
244  for(size_t i_ch=0; i_ch < fragment.nChannelsPerBoard(); ++i_ch)
245  {
246  //raw::ChannelID_t channel_num = (i_ch & 0xff ) + (i_b << 8);
247  raw::ChannelID_t channel_num = i_ch+i_b*64;
248  raw::RawDigit::ADCvector_t wvfm(fragment.nSamplesPerChannel());
249 
250  for(size_t i_t=0; i_t < fragment.nSamplesPerChannel(); ++i_t)
251  {
252  wvfm[i_t] = fragment.adc_val(i_b,i_ch,i_t);
253  // if(channel_num==1855) std::cout << " sample " << i_t << " wave " << wvfm[i_t] << std::endl;
254  }
255  // product_collection->emplace_back(channel_count++,fragment.nSamplesPerChannel(),wvfm);
256  product_collection->emplace_back(channel_num,fragment.nSamplesPerChannel(),wvfm);
257  //std::cout << " channel " << channel_num << " waveform size " << fragment.nSamplesPerChannel() << std::endl;
258 
259  }//loop over channels
260 
261  }//loop over boards
262  std::cout << "Total number of channels added is " << product_collection->size() << std::endl;
263 }
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:73
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
BEGIN_PROLOG could also be cout
void daq::DaqDecoderIcarusPMTold::produce ( art::Event &  e)
override

Definition at line 137 of file DaqDecoderICARUSPMTold_module.cc.

138 {
139  if (_config.wait_sec >= 0)
140  {
142  }
143  //auto const& daq_handle = event.getValidHandle<artdaq::Fragments>(_tag);
144 
145  // storage for waveform
146  std::unique_ptr<std::vector<raw::OpDetWaveform>> product_collection(new std::vector<raw::OpDetWaveform>());
147  // storage for header info
148  // std::unique_ptr<std::vector<tpcAnalysis::HeaderData>> header_collection(new std::vector<tpcAnalysis::HeaderData>);
149 
150  /************************************************************************************************/
151  art::Handle< std::vector<artdaq::Fragment> > rawFragHandle;
152  event.getByLabel(_tag, rawFragHandle);
153 
154  if (rawFragHandle.isValid()) {
155 
156  std::cout << "######################################################################\n";
157  std::cout << "Run " << event.run() << ", subrun " << event.subRun() << std::endl;
158 
159  for (size_t idx = 0; idx < rawFragHandle->size(); ++idx) /*loop over the fragments*/
160  {
161  //--use this fragment as a reference to the same data
162  const auto& frag((*rawFragHandle)[idx]);
163  sbndaq::CAENV1730Fragment bb(frag);
164  auto const* md = bb.Metadata();
165  sbndaq::CAENV1730Event const* event_ptr = bb.Event();
166  sbndaq::CAENV1730EventHeader header = event_ptr->Header;
167 
168  std::cout << "\tFragment ID: " << frag.fragmentID() << ", type: " << frag.typeString() << ", type: " << frag.type() << ", boardID: " << header.boardID << ", msk lo: " << header.channelMask_lo << ", hi: " << header.channelMask_hi << std::endl;
169  std::cout << "\tFrom header, event counter is " << header.eventCounter << "\n";
170  std::cout << "\tFrom header, triggerTimeTag is " << header.triggerTimeTag << "\n";
171  std::vector< std::vector<uint16_t> > fWvfmsVec;
172  size_t nChannels = md->nChannels;
173  std::cout <<"\tFrom header , no of channel is " << nChannels << "\n";
174 
175  uint32_t ev_size_quad_bytes = header.eventSize;
176  // std::cout << "Event size in quad bytes is: " << ev_size_quad_bytes << "\n";
177  uint32_t evt_header_size_quad_bytes = sizeof(sbndaq::CAENV1730EventHeader)/sizeof(uint32_t);
178  uint32_t data_size_double_bytes = 2*(ev_size_quad_bytes - evt_header_size_quad_bytes);
179  uint32_t wfm_length = data_size_double_bytes/nChannels;
180 
181  //--note, needs to take into account channel mask
182  // std::cout << "Channel waveform length = " << wfm_length << "\n";
183 
184  const uint16_t* data_begin = reinterpret_cast<const uint16_t*>(frag.dataBeginBytes()
185  + sizeof(sbndaq::CAENV1730EventHeader));
186 
187  const uint16_t* value_ptr = data_begin;
188  size_t ch_offset = 0;
189  uint16_t value;
190 
191  // loop over channels
192  for (size_t i_ch=0; i_ch<nChannels; ++i_ch)
193  {
194  //fWvfmsVec[i_ch].resize(wfm_length);
195  ch_offset = i_ch * wfm_length;
196 
197  raw::OpDetWaveform my_wf(0.00, i_ch, wfm_length);
198  my_wf.resize(wfm_length);
199  // Loop over waveform
200 
201  for(size_t i_t=0; i_t<wfm_length; ++i_t)
202  {
203  //fTicksVec[i_t] = t0*Ttt_DownSamp + i_t; /*timestamps, event level*/
204  value_ptr = data_begin + ch_offset + i_t; /*pointer arithmetic*/
205  //value_ptr = (i_t%2 == 0) ? (index+1) : (index-1);
206  value = *(value_ptr);
207  my_wf[i_t] = value;
208  //std::cout<<"Value is" << value << "and" << my_wf[i_t] << "\n";
209  //if (i_ch == 0 && fEvent == 0) h_wvfm_ev0_ch0->SetBinContent(i_t,value);
210  //fWvfmsVec[i_ch][i_t] = value;
211  } //--end loop samples
212 
213  product_collection->push_back(my_wf);
214  }// end loop over channels
215  // std::cout<<"product collection"<<product_collection->back().size()<<"\n";
216  } // end loop over fragments
217  }
218  event.put(std::move(product_collection));
219 }
microsecond microseconds
Alias for common language habits.
Definition: spacetime.h:122
second seconds
Alias for common language habits.
Definition: spacetime.h:88
temporary value
BEGIN_PROLOG could also be cout

Member Data Documentation

Config daq::DaqDecoderIcarusPMTold::_config
private

Definition at line 83 of file DaqDecoderICARUSPMTold_module.cc.

art::InputTag daq::DaqDecoderIcarusPMTold::_tag
private

Definition at line 82 of file DaqDecoderICARUSPMTold_module.cc.


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