Public Member Functions | Private Attributes | List of all members
PackedDump Class Reference
Inheritance diagram for PackedDump:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 PackedDump (fhicl::ParameterSet const &p)
 
 PackedDump (PackedDump const &)=delete
 
 PackedDump (PackedDump &&)=delete
 
PackedDumpoperator= (PackedDump const &)=delete
 
PackedDumpoperator= (PackedDump &&)=delete
 
void analyze (art::Event const &e) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
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::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- 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 Attributes

art::ServiceHandle< dune::PdspChannelMapServicem_channelMap
 
std::string m_outputFilename
 
std::ofstream m_outputFile
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- 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 29 of file PackedDump_module.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file PackedDump_module.cc.

53  :
54  EDAnalyzer(p),
55  m_outputFilename(p.get<std::string>("OutputFile")),
56  m_outputFile(m_outputFilename, std::ios::out | std::ios::binary)
57 {
58  // A little test code to check we can do the bit packing properly
59 
60  // const size_t nsamples=16;
61  // const uint16_t samples[nsamples]={
62  // 0, 1, 2, 3, 4, 5, 6, 7,
63  // 8, 9, 10, 11, 12, 13, 14, 15
64  // };
65  // for(size_t i=0; i<nsamples; i+=8){
66  // uint32_t word0=samples[i] | (samples[i+1] << 12) | (samples[i+2] << 24);
67  // uint32_t word1=(samples[i+2] >> 4) | (samples[i+3] << 4) | (samples[i+4] << 16) | (samples[i+5] << 28);
68  // uint32_t word2=(samples[i+5] >> 4) | (samples[i+6] << 8) | (samples[i+7] << 20);
69 
70  // m_outputFile.write((char*)&word0, sizeof(uint32_t));
71  // m_outputFile.write((char*)&word1, sizeof(uint32_t));
72  // m_outputFile.write((char*)&word2, sizeof(uint32_t));
73 
74  // uint32_t word0_net=htonl(word0);
75  // uint32_t word1_net=htonl(word1);
76  // uint32_t word2_net=htonl(word2);
77 
78  // m_outputFile.write((char*)&word0_net, sizeof(uint32_t));
79  // m_outputFile.write((char*)&word1_net, sizeof(uint32_t));
80  // m_outputFile.write((char*)&word2_net, sizeof(uint32_t));
81  // }
82 }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::ofstream m_outputFile
p
Definition: test.py:223
std::string m_outputFilename
PackedDump::PackedDump ( PackedDump const &  )
delete
PackedDump::PackedDump ( PackedDump &&  )
delete

Member Function Documentation

void PackedDump::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 84 of file PackedDump_module.cc.

85 {
86  // Create a map from offline channel number to RawDigit
87  std::vector<const raw::RawDigit*> inputDigitsHandle;
88  std::map<unsigned int, const raw::RawDigit*> channelToDigit;
89  e.getView("daq", inputDigitsHandle);
90  for(size_t c=0; c<inputDigitsHandle.size(); ++c){
91  const raw::RawDigit* dig=inputDigitsHandle[c];
92  channelToDigit[dig->Channel()] = dig;
93  }
94 
95  // Set a bunch of these to 1 to just do a subset to start with
96  const size_t nCrate=1;
97  const size_t nSlot=1;
98  const size_t nFiber=1;
99  const size_t nFEMBChannel=128;
100  const size_t nTDC=4492;
101 
102  // We loop down to the level of a board and then, for a given
103  // board, emit frame. Each frame starts with 0xdeadbeef, followed
104  // by the tdc, followed by each 12-bit FMB channel value, in order
105  // of FEMB channel
106  for(unsigned int crate=0; crate<nCrate; ++crate){
107  for(unsigned int slot=0; slot<nSlot; ++slot){
108  for(unsigned int fiber=0; fiber<nFiber; ++fiber){
109  for(uint32_t tdc=0; tdc<nTDC; ++tdc){
110  uint32_t header=0xdeadbeef;
111  m_outputFile.write((char*)&header, sizeof(uint32_t));
112  m_outputFile.write((char*)&tdc, sizeof(uint32_t));
113  for(unsigned int fembChannel=0; fembChannel<nFEMBChannel-1; fembChannel+=8){
114 
115  unsigned short samples[8];
116  for(int i=0; i<8; ++i){
117  // args are: unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel
118  unsigned int offlineChan=m_channelMap->GetOfflineNumberFromDetectorElements(crate, slot, fiber, fembChannel+i, dune::PdspChannelMapService::kRCE);
119  // std::cout << "Fiber " << fiber << " FEMB channel " << (fembChannel+8) << " maps to offline " << offlineChan << std::endl;
120  samples[i]=channelToDigit[offlineChan]->ADC(tdc);
121  }
122  uint32_t word0=samples[0] | (samples[1] << 12) | (samples[2] << 24);
123  uint32_t word1=(samples[2] >> 8) | (samples[3] << 4) | (samples[4] << 16) | (samples[5] << 28);
124  uint32_t word2=(samples[5] >> 4) | (samples[6] << 8) | (samples[7] << 20);
125 
126  m_outputFile.write((char*)&word0, sizeof(uint32_t));
127  m_outputFile.write((char*)&word1, sizeof(uint32_t));
128  m_outputFile.write((char*)&word2, sizeof(uint32_t));
129  }
130  }
131  }
132  }
133  }
134  uint32_t eof=0xffffffff;
135  m_outputFile.write((char*)&eof, sizeof(uint32_t));
136 }
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
art::ServiceHandle< dune::PdspChannelMapService > m_channelMap
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
unsigned int GetOfflineNumberFromDetectorElements(unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel, FelixOrRCE frswitch)
const double e
struct dune::tde::crate crate
std::ofstream m_outputFile
PackedDump& PackedDump::operator= ( PackedDump const &  )
delete
PackedDump& PackedDump::operator= ( PackedDump &&  )
delete

Member Data Documentation

art::ServiceHandle<dune::PdspChannelMapService> PackedDump::m_channelMap
private

Definition at line 46 of file PackedDump_module.cc.

std::ofstream PackedDump::m_outputFile
private

Definition at line 48 of file PackedDump_module.cc.

std::string PackedDump::m_outputFilename
private

Definition at line 47 of file PackedDump_module.cc.


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