LDMX Software
ldmx::HgcrocDigiCollection Class Reference

Represents a collection of the digi hits readout by an HGCROC. More...

#include <HgcrocDigiCollection.h>

Classes

class  HgcrocDigi
 One DIGI signal coming from the HGC ROC. More...
 
class  Iterator
 iterator class so we can do range-based loops over digi collections More...
 
class  Sample
 One sample of a digi channel corresponding to one clock of the HGCROC chip. More...
 

Public Member Functions

 HgcrocDigiCollection ()
 Class constructor.
 
virtual ~HgcrocDigiCollection ()
 Class destructor.
 
void clear ()
 Clear the data in the object.
 
int getVersion () const
 Get the version of ROC we have read.
 
void setVersion (int v)
 Set the version of the ROC we have read.
 
unsigned int getNumSamplesPerDigi () const
 Get number of samples per digi.
 
void setNumSamplesPerDigi (unsigned int n)
 Set number of samples for each digi.
 
unsigned int getSampleOfInterestIndex () const
 Get index of sample of interest.
 
void setSampleOfInterestIndex (unsigned int n)
 Set index of sample of interest.
 
const HgcrocDigi getDigi (unsigned int digiIndex) const
 Get samples for the input digi index.
 
unsigned int getNumDigis () const
 Get total number of digis.
 
unsigned int size () const
 Get total number of digis.
 
void addDigi (unsigned int id, const std::vector< Sample > &digi)
 Add samples to collection.
 
void addDigi (unsigned int id, const std::vector< uint32_t > &digi)
 
Iterator begin ()
 The beginning of this collection.
 
Iterator end ()
 The end of this collection.
 

Private Member Functions

 ClassDef (HgcrocDigiCollection, 6)
 The ROOT class definition.
 

Private Attributes

std::vector< unsigned int > channel_ids_
 list of channel IDs that we have digis for
 
std::vector< uint32_t > samples_
 list of samples that we have been given
 
unsigned int num_samples_per_digi_
 number of samples for each digi
 
unsigned int sample_of_interest_
 index for the sample of interest in the samples list
 
int version_
 version of the ROC we have read
 

Static Private Attributes

static const int ONE_BIT_MASK = 1
 Mask for lowest order bit in an int.
 
static const int TEN_BIT_MASK = (1 << 10) - 1
 Mask for lowest order ten bits in an int.
 
static const int FIRSTFLAG_POS = 31
 Bit position of first flag.
 
static const int SECONFLAG_POS = 30
 Bit position of second flag.
 
static const int FIRSTMEAS_POS = 20
 Bit position of first measurement.
 
static const int SECONMEAS_POS = 10
 Bit position of second measurement.
 

Friends

std::ostream & operator<< (std::ostream &o, const HgcrocDigiCollection &d)
 Print out the object.
 

Detailed Description

Represents a collection of the digi hits readout by an HGCROC.

Note
This class represents the digitized signal information in the form of a series of samples for each channel of readout. Each channel is represented by an ID integer and each sample is a 32-bit word. The number of samples for each digi is configurable, but is required to be the same for all channels.

Each digi corresponds to one channel ID and numSamplesPerDigi_ samples.

A custom iterator class and begin() and end() methods are also implemented so that a user can loop through this collection similar to any other container in C++.

for (auto digi : digi_collection) { // digi is of type HgcrocDigi }

Definition at line 43 of file HgcrocDigiCollection.h.

Constructor & Destructor Documentation

◆ HgcrocDigiCollection()

ldmx::HgcrocDigiCollection::HgcrocDigiCollection ( )
inline

Class constructor.

Definition at line 320 of file HgcrocDigiCollection.h.

320{}

◆ ~HgcrocDigiCollection()

virtual ldmx::HgcrocDigiCollection::~HgcrocDigiCollection ( )
inlinevirtual

Class destructor.

Definition at line 325 of file HgcrocDigiCollection.h.

325{}

Member Function Documentation

◆ addDigi() [1/2]

void ldmx::HgcrocDigiCollection::addDigi ( unsigned int id,
const std::vector< Sample > & digi )

Add samples to collection.

See also
Sample for how the valid measurements depend on the flags.
Parameters
[in]idglobal integer ID for this channel
[in]digilist of new samples to add

Referenced by ecal::EcalDigiProducer::produce(), ecal::EcalRawDecoder::produce(), hcal::HcalAlignPolarfires::produce(), hcal::HcalDigiProducer::produce(), and hcal::HcalRawDecoder::produce().

◆ addDigi() [2/2]

void ldmx::HgcrocDigiCollection::addDigi ( unsigned int id,
const std::vector< uint32_t > & digi )

Definition at line 81 of file HgcrocDigiCollection.cxx.

82 {
83 if (digi.size() != this->getNumSamplesPerDigi()) {
84 std::cerr << "[ WARN ] [ HgcrocDigiCollection ] Input list of samples "
85 "has size '"
86 << digi.size()
87 << "' that does not match the number of samples per digi '"
88 << this->getNumSamplesPerDigi() << "'!." << std::endl;
89 return;
90 }
91
92 channel_ids_.push_back(id);
93 for (auto const &s : digi) samples_.push_back(s);
94
95 return;
96}
std::vector< uint32_t > samples_
list of samples that we have been given
std::vector< unsigned int > channel_ids_
list of channel IDs that we have digis for
unsigned int getNumSamplesPerDigi() const
Get number of samples per digi.

◆ begin()

Iterator ldmx::HgcrocDigiCollection::begin ( )
inline

The beginning of this collection.

We just point the user to the zero'th entry.

Definition at line 481 of file HgcrocDigiCollection.h.

481{ return Iterator(*this, 0); }

◆ clear()

void ldmx::HgcrocDigiCollection::clear ( )

Clear the data in the object.

Clears the vectors of channel IDs and samples, but does not change the other settings of this collection.

Definition at line 43 of file HgcrocDigiCollection.cxx.

43 {
44 channel_ids_.clear();
45 samples_.clear();
46
47 return;
48}

References channel_ids_, and samples_.

◆ end()

Iterator ldmx::HgcrocDigiCollection::end ( )
inline

The end of this collection.

The end of the collection is the number of digis stored in it.

Definition at line 489 of file HgcrocDigiCollection.h.

489{ return Iterator(*this, getNumDigis()); }
unsigned int getNumDigis() const
Get total number of digis.

References getNumDigis().

◆ getDigi()

const HgcrocDigiCollection::HgcrocDigi ldmx::HgcrocDigiCollection::getDigi ( unsigned int digiIndex) const

Get samples for the input digi index.

Each "digi" is numSamplesPerDigi_ samples. The sample is a single 32-bit word that is then translated into the 10-bit measurements depending on the first two bits.

See also
Sample for how the valid measurements depend on the flags.
HgcrocDigi for how to use the object returned from this function
Parameters
[in]digiIndexindex of digi to decode
Returns
HgcrocDigi package with accessors

Definition at line 57 of file HgcrocDigiCollection.cxx.

58 {
59 return HgcrocDigiCollection::HgcrocDigi(
60 channel_ids_.at(digiIndex),
61 samples_.begin() + digiIndex * getNumSamplesPerDigi(), *this);
62}

References channel_ids_, getNumSamplesPerDigi(), and samples_.

Referenced by ldmx::HgcrocDigiCollection::Iterator::operator*(), operator<<(), ecal::EcalTrigPrimDigiProducer::produce(), and hcal::HcalTrigPrimDigiProducer::produce().

◆ getNumDigis()

unsigned int ldmx::HgcrocDigiCollection::getNumDigis ( ) const
inline

◆ getNumSamplesPerDigi()

unsigned int ldmx::HgcrocDigiCollection::getNumSamplesPerDigi ( ) const
inline

Get number of samples per digi.

Returns
unsigned int number of samples per digi

Definition at line 361 of file HgcrocDigiCollection.h.

361{ return num_samples_per_digi_; }
unsigned int num_samples_per_digi_
number of samples for each digi

References num_samples_per_digi_.

Referenced by getDigi(), and hcal::HcalRawDecoder::produce().

◆ getSampleOfInterestIndex()

unsigned int ldmx::HgcrocDigiCollection::getSampleOfInterestIndex ( ) const
inline

Get index of sample of interest.

Returns
unsigned int index for SOI

Definition at line 376 of file HgcrocDigiCollection.h.

376{ return sample_of_interest_; }
unsigned int sample_of_interest_
index for the sample of interest in the samples list

References sample_of_interest_.

Referenced by hcal::HcalSingleEndRecProducer::produce(), and ldmx::HgcrocDigiCollection::HgcrocDigi::soi().

◆ getVersion()

int ldmx::HgcrocDigiCollection::getVersion ( ) const
inline

Get the version of ROC we have read.

Returns
int version number of ROC

Definition at line 347 of file HgcrocDigiCollection.h.

347{ return version_; }
int version_
version of the ROC we have read

References version_.

Referenced by ldmx::HgcrocDigiCollection::HgcrocDigi::at().

◆ setNumSamplesPerDigi()

void ldmx::HgcrocDigiCollection::setNumSamplesPerDigi ( unsigned int n)
inline

Set number of samples for each digi.

Parameters
[in]nnumber of samples per digi

Definition at line 367 of file HgcrocDigiCollection.h.

367 {
369 return;
370 }

References num_samples_per_digi_.

Referenced by ecal::EcalDigiProducer::produce(), ecal::EcalRawDecoder::produce(), hcal::HcalDigiProducer::produce(), and hcal::HcalRawDecoder::produce().

◆ setSampleOfInterestIndex()

void ldmx::HgcrocDigiCollection::setSampleOfInterestIndex ( unsigned int n)
inline

Set index of sample of interest.

Note
Does not check if input is a valid index! (i.e. input less than numSamplesPerDigi_)
Parameters
[in]nindex for the sample of interest

Definition at line 386 of file HgcrocDigiCollection.h.

386 {
388 return;
389 }

References sample_of_interest_.

Referenced by ecal::EcalDigiProducer::produce(), ecal::EcalRawDecoder::produce(), hcal::HcalDigiProducer::produce(), and hcal::HcalRawDecoder::produce().

◆ setVersion()

void ldmx::HgcrocDigiCollection::setVersion ( int v)
inline

Set the version of the ROC we have read.

Definition at line 352 of file HgcrocDigiCollection.h.

352 {
353 version_ = v;
354 return;
355 }

References version_.

Referenced by ecal::EcalRawDecoder::produce(), and hcal::HcalRawDecoder::produce().

◆ size()

unsigned int ldmx::HgcrocDigiCollection::size ( ) const
inline

Get total number of digis.

Returns
unsigned int number of digis

Definition at line 416 of file HgcrocDigiCollection.h.

416{ return channel_ids_.size(); }

References channel_ids_.

Referenced by ecal::EcalTrigPrimDigiProducer::produce().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const HgcrocDigiCollection & d )
friend

Print out the object.

Prints out the lengths of the stored vectors and the other settings of this collection.

Prints all of the digi's using their streamer.

Parameters
[in]sostream to print sample to
[in]colHgcrocDigiCollection to print
Returns
modified ostream

Definition at line 50 of file HgcrocDigiCollection.cxx.

50 {
51 return o << "HgcrocDigiCollection { Num Channel IDs: "
52 << c.channel_ids_.size() << ", Num Samples: " << c.samples_.size()
53 << ", Samples Per Digi: " << c.num_samples_per_digi_
54 << ", Index for SOI: " << c.sample_of_interest_ << "}";
55}

Member Data Documentation

◆ channel_ids_

std::vector<unsigned int> ldmx::HgcrocDigiCollection::channel_ids_
private

list of channel IDs that we have digis for

Definition at line 512 of file HgcrocDigiCollection.h.

Referenced by clear(), getDigi(), getNumDigis(), and size().

◆ FIRSTFLAG_POS

const int ldmx::HgcrocDigiCollection::FIRSTFLAG_POS = 31
staticprivate

◆ FIRSTMEAS_POS

const int ldmx::HgcrocDigiCollection::FIRSTMEAS_POS = 20
staticprivate

◆ num_samples_per_digi_

unsigned int ldmx::HgcrocDigiCollection::num_samples_per_digi_
private

number of samples for each digi

Definition at line 518 of file HgcrocDigiCollection.h.

Referenced by getNumSamplesPerDigi(), and setNumSamplesPerDigi().

◆ ONE_BIT_MASK

const int ldmx::HgcrocDigiCollection::ONE_BIT_MASK = 1
staticprivate

◆ sample_of_interest_

unsigned int ldmx::HgcrocDigiCollection::sample_of_interest_
private

index for the sample of interest in the samples list

Definition at line 521 of file HgcrocDigiCollection.h.

Referenced by getSampleOfInterestIndex(), and setSampleOfInterestIndex().

◆ samples_

std::vector<uint32_t> ldmx::HgcrocDigiCollection::samples_
private

list of samples that we have been given

Definition at line 515 of file HgcrocDigiCollection.h.

Referenced by clear(), and getDigi().

◆ SECONFLAG_POS

const int ldmx::HgcrocDigiCollection::SECONFLAG_POS = 30
staticprivate

Bit position of second flag.

Definition at line 502 of file HgcrocDigiCollection.h.

Referenced by ldmx::HgcrocDigiCollection::Sample::isTOTComplete(), and ldmx::HgcrocDigiCollection::Sample::Sample().

◆ SECONMEAS_POS

const int ldmx::HgcrocDigiCollection::SECONMEAS_POS = 10
staticprivate

Bit position of second measurement.

Definition at line 508 of file HgcrocDigiCollection.h.

Referenced by ldmx::HgcrocDigiCollection::Sample::Sample(), and ldmx::HgcrocDigiCollection::Sample::secon().

◆ TEN_BIT_MASK

const int ldmx::HgcrocDigiCollection::TEN_BIT_MASK = (1 << 10) - 1
staticprivate

◆ version_

int ldmx::HgcrocDigiCollection::version_
private

version of the ROC we have read

Definition at line 524 of file HgcrocDigiCollection.h.

Referenced by getVersion(), and setVersion().


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