LDMX Software
|
Public Member Functions | |
HcalRawDecoder (const std::string &name, framework::Process &process) | |
void | configure (framework::config::Parameters &) override |
Callback for the EventProcessor to configure itself from the given set of parameters. | |
void | beforeNewRun (ldmx::RunHeader &rh) override |
add detector name if we are reading from file | |
void | produce (framework::Event &event) override |
use read function to decode data, then translate EIDs into DetIDs | |
Public Member Functions inherited from framework::Producer | |
Producer (const std::string &name, Process &process) | |
Class constructor. | |
Public Member Functions inherited from framework::EventProcessor | |
EventProcessor (const std::string &name, Process &process) | |
Class constructor. | |
virtual | ~EventProcessor () |
Class destructor. | |
virtual void | onNewRun (const ldmx::RunHeader &runHeader) |
Callback for the EventProcessor to take any necessary action when the run being processed changes. | |
virtual void | onFileOpen (EventFile &eventFile) |
Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened. | |
virtual void | onFileClose (EventFile &eventFile) |
Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed. | |
virtual void | onProcessStart () |
Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms. | |
virtual void | onProcessEnd () |
Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities. | |
template<class T > | |
const T & | getCondition (const std::string &condition_name) |
Access a conditions object for the current event. | |
TDirectory * | getHistoDirectory () |
Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples. | |
void | setStorageHint (framework::StorageControl::Hint hint) |
Mark the current event as having the given storage control hint from this module. | |
void | setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString) |
Mark the current event as having the given storage control hint from this module and the given purpose string. | |
int | getLogFrequency () const |
Get the current logging frequency from the process. | |
int | getRunNumber () const |
Get the run number from the process. | |
std::string | getName () const |
Get the processor name. | |
void | createHistograms (const std::vector< framework::config::Parameters > &histos) |
Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create. | |
Private Member Functions | |
template<typename ReaderType > | |
std::map< ldmx::HcalElectronicsID, std::vector< ldmx::HgcrocDigiCollection::Sample > > | read (ReaderType &reader, PolarfireEventHeader &eh) |
Assume input reader behaves like a binary data input stream where we can "pop" individual 32-bit words with operator>> and we can check if the reader is done using operator bool() | |
Private Attributes | |
std::string | input_file_ |
input file of encoded data | |
std::vector< std::string > | input_names_ |
input object of encoded data | |
std::string | input_pass_ |
input pass of creating encoded data | |
std::string | output_name_ |
output object to put onto event bus | |
std::string | detector_name_ |
the detector name if we are reading from a file | |
int | roc_version_ |
version of HGC ROC we are decoding | |
bool | translate_eid_ |
are get translating electronic IDs? | |
bool | read_from_file_ |
is the input_name a file or an event object | |
packing::utility::Reader | file_reader_ |
the file reader (if we are doing that) | |
Additional Inherited Members | |
Static Public Member Functions inherited from framework::EventProcessor | |
static void | declare (const std::string &classname, int classtype, EventProcessorMaker *) |
Internal function which is part of the PluginFactory machinery. | |
Static Public Attributes inherited from framework::Producer | |
static const int | CLASSTYPE {1} |
Constant used to track EventProcessor types by the PluginFactory. | |
Protected Member Functions inherited from framework::EventProcessor | |
void | abortEvent () |
Abort the event immediately. | |
Protected Attributes inherited from framework::EventProcessor | |
HistogramHelper | histograms_ |
Interface class for making and filling histograms. | |
NtupleManager & | ntuple_ {NtupleManager::getInstance()} |
Manager for any ntuples. | |
logging::logger | theLog_ |
The logger for this EventProcessor. | |
Definition at line 57 of file HcalRawDecoder.h.
|
inline |
Definition at line 59 of file HcalRawDecoder.h.
|
overridevirtual |
add detector name if we are reading from file
Reimplemented from framework::Producer.
Definition at line 89 of file HcalRawDecoder.cxx.
References detector_name_, read_from_file_, and ldmx::RunHeader::setDetectorName().
|
overridevirtual |
Callback for the EventProcessor to configure itself from the given set of parameters.
The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.
For an example, look at MyProcessor.
parameters | Parameters for configuration. |
Reimplemented from framework::EventProcessor.
Definition at line 75 of file HcalRawDecoder.cxx.
References detector_name_, file_reader_, framework::config::Parameters::getParameter(), input_file_, input_names_, input_pass_, packing::utility::Reader::open(), output_name_, read_from_file_, roc_version_, and translate_eid_.
|
overridevirtual |
use read function to decode data, then translate EIDs into DetIDs
Translation
Now the HgcrocDigiCollection::Sample class handles the unpacking of individual samples; however, we still need to translate electronic IDs into detector IDs.
DO NOTHING skip hits where the EID aren't in the detector mapping no zero supp during test beam on the front-end, so channels that aren't connected to anything are still being readout.
no EID translation, just add the digis to the digi collection with their raw electronic ID TODO: remove this, we shouldn't be able to get past the decoding stage without translating the EID into a detector ID to avoid confusion in recon
Implements framework::Producer.
Definition at line 96 of file HcalRawDecoder.cxx.
References ldmx::HgcrocDigiCollection::addDigi(), hcal::PolarfireEventHeader::board(), hcal::HcalDetectorMap::CONDITIONS_OBJECT_NAME, packing::utility::Reader::eof(), file_reader_, framework::Event::getCollection(), ldmx::HgcrocDigiCollection::getNumDigis(), ldmx::HgcrocDigiCollection::getNumSamplesPerDigi(), input_names_, input_pass_, output_name_, read(), read_from_file_, roc_version_, ldmx::HgcrocDigiCollection::setNumSamplesPerDigi(), ldmx::HgcrocDigiCollection::setSampleOfInterestIndex(), ldmx::HgcrocDigiCollection::setVersion(), and translate_eid_.
|
inlineprivate |
Assume input reader behaves like a binary data input stream where we can "pop" individual 32-bit words with operator>> and we can check if the reader is done using operator bool()
Note: Contains quite a lot of debug details and variables that aren't actually used but should be kept around. Could possibly be cleaned up at some point but for now, best to leave alone
Static parameters depending on ROC version
words for reading and decoding
Decode event header
For the time being, the number of sample lengths is fixed to make the firmware for DMA readout simpler. This means we readout the leftover dummy words to move the pointer on the reader.
extended event header in version 2
Re-sort the data from grouped by bunch to by channel
The readout chip streams the data off of it, so it doesn't have time to re-group the signals across multiple bunches (samples) by their channel ID. We need to do that here.
Decode Bunch Header We have a few words of header material before the actual data. This header material is assumed to be encoded as in Table 3 of the DAQ specs.
<name> (bits)
VERSION (4) | FPGA_ID (8) | NLINKS (6) | 00 | LEN (12) BX ID (12) | RREQ (10) | OR (10) RID ok (1) | CRC ok (1) | LEN3 (6) | RID ok (1) | CRC ok (1) | LEN2 (6) | RID ok (1) | CRC ok (1) | LEN1 (6) | RID ok (1) | CRC ok (1) | LEN0 (6) ... other listing of links ...
Decode Each Link in Sequence Now we should be decoding each link serially where each link was encoded as in Table 4 of the DAQ specs
ROC_ID (16) | CRC ok (1) | 0 (7) | RO Map (8) RO Map (32)
If minimum length of 2 is not written for this link, assume it went down and skip
Special "Header" Word from ROC
version 3: 0101 | BXID (12) | RREQ (6) | OR (3) | HE (3) | 0101
version 2: 10101010 | BXID (12) | WADD (9) | 1010
Common Mode Channels 10 | 0000000000 | Common Mode ADC 0 (10) | Common Mode ADC 1 (10)
DAQ Channels
The HGC ROC has some odd behavior in terms of reading out the different channels.
calib channel in row j = 20 This introduces a special shift for the channel number to "align" with the range 0-35 per link.
polarfire fpga = fpga readout roc = i_link / 2 // integer division channel = j - 1 - (j > common_mode_channel)*1 - (j > calib_channel)*1
Definition at line 81 of file HcalRawDecoder.h.
References hcal::PolarfireEventHeader::bunch, hcal::PolarfireEventHeader::DD, hcal::PolarfireEventHeader::fpga, packing::utility::CRC::get(), hcal::PolarfireEventHeader::good_bxheader, hcal::PolarfireEventHeader::good_trailer, hcal::PolarfireEventHeader::hh, hcal::PolarfireEventHeader::MM, hcal::PolarfireEventHeader::mm, hcal::PolarfireEventHeader::nsamples, hcal::PolarfireEventHeader::number, roc_version_, hcal::PolarfireEventHeader::run, hcal::PolarfireEventHeader::spill, hcal::PolarfireEventHeader::ticks, and hcal::PolarfireEventHeader::version.
Referenced by produce().
|
private |
the detector name if we are reading from a file
Definition at line 407 of file HcalRawDecoder.h.
Referenced by beforeNewRun(), and configure().
|
private |
the file reader (if we are doing that)
Definition at line 417 of file HcalRawDecoder.h.
Referenced by configure(), and produce().
|
private |
input file of encoded data
Definition at line 399 of file HcalRawDecoder.h.
Referenced by configure().
|
private |
input object of encoded data
Definition at line 401 of file HcalRawDecoder.h.
Referenced by configure(), and produce().
|
private |
input pass of creating encoded data
Definition at line 403 of file HcalRawDecoder.h.
Referenced by configure(), and produce().
|
private |
output object to put onto event bus
Definition at line 405 of file HcalRawDecoder.h.
Referenced by configure(), and produce().
|
private |
is the input_name a file or an event object
Definition at line 413 of file HcalRawDecoder.h.
Referenced by beforeNewRun(), configure(), and produce().
|
private |
version of HGC ROC we are decoding
Definition at line 409 of file HcalRawDecoder.h.
Referenced by configure(), produce(), and read().
|
private |
are get translating electronic IDs?
Definition at line 411 of file HcalRawDecoder.h.
Referenced by configure(), and produce().