9#ifndef RECON_EVENT_HGCROCDIGICOLLECTION_H_
10#define RECON_EVENT_HGCROCDIGICOLLECTION_H_
82 Sample(
bool tot_progress,
bool tot_complete,
int firstMeas,
int seconMeas,
83 int toa,
int version = 3);
151 if (meas > 512) meas = (meas - 512) * 8;
240 HgcrocDigi(
unsigned int id, std::vector<uint32_t>::const_iterator first,
249 unsigned int id()
const {
return id_; }
283 if (not
isTOT())
return -1;
284 if (
soi().isTOTinProgress())
return -2;
309 std::vector<uint32_t>::const_iterator
first_;
341 friend std::ostream&
operator<<(std::ostream& o,
404 const HgcrocDigi
getDigi(
unsigned int digiIndex)
const;
426 void addDigi(
unsigned int id,
const std::vector<Sample>& digi);
427 void addDigi(
unsigned int id,
const std::vector<uint32_t>& digi);
std::ostream & operator<<(std::ostream &s, const ldmx::HgcrocDigiCollection::Sample &sample)
Streamer for the HgcrocDigiCollection::Sample.
One DIGI signal coming from the HGC ROC.
bool isADC() const
Check if this DIGI is an ADC measurement.
bool isTOT() const
Check if this DIGI is a TOT measurement.
unsigned int id_
channel ID where this signal is coming from
unsigned int id() const
Get the ID for this DIGI.
int tot() const
Get the 12-bit decoded TOT measurement from this DIGI.
HgcrocDigiCollection::Sample soi() const
Get the sample of interest from this DIGI.
const HgcrocDigiCollection & collection_
Reference to collection that owns this DIGI.
std::vector< uint32_t >::const_iterator first_
the location of the first sample that are in this digi
HgcrocDigi(unsigned int id, std::vector< uint32_t >::const_iterator first, const HgcrocDigiCollection &collection)
Constructor.
HgcrocDigiCollection::Sample at(unsigned int i_sample) const
get the sample at a specific index in the digi
iterator class so we can do range-based loops over digi collections
const HgcrocDigi operator*() const
De-reference this iterator by using the parent collection to get the actual digi at the index.
Iterator(HgcrocDigiCollection &c, long index=0)
Connect the parent collection with an index to this iterator.
HgcrocDigiCollection & coll_
the parent collection this iterator is looping over
bool operator!=(Iterator other) const
Check if two iterators are not on the same index.
Iterator & operator++()
Increment the digi index and return the iterator afterwards.
long digi_index_
the index of the digi this iterator represents
bool operator==(Iterator other) const
Check if two iterators are on the same index.
Iterator operator++(int)
Increment the digi index and return the iterator before.
One sample of a digi channel corresponding to one clock of the HGCROC chip.
int adcT() const
Get the ADC measurement from this sample.
int adcTm1() const
Get the last ADC measurement from this sample.
int secon() const
Get the second 10-bit measurement out of the sample.
int tot() const
Get the TOT measurement from this sample.
Sample(uint32_t w, int version=3)
Basic constructor.
int version_
version to use for {de,en}coding
uint32_t word_
The actual 32-bit word spit out by the chip.
Sample()
Default constructor.
int first() const
Get the first 10-bit measurement out of the sample.
int third() const
Get the third 10-bit measurement out of the smaple.
int toa() const
Get the Time Of Arrival of this sample which is always the third position in all readout modes.
uint32_t raw() const
Get the raw value of this sample.
bool isTOTinProgress() const
Get the first flag from the sample checking if TOT is in progress during this sample.
bool isTOTComplete() const
Get the second flag from the sample checking if TOT is complete at this sample.
Represents a collection of the digi hits readout by an HGCROC.
std::vector< uint32_t > samples_
list of samples that we have been given
Iterator begin()
The beginning of this collection.
static const int SECONFLAG_POS
Bit position of second flag.
static const int FIRSTFLAG_POS
Bit position of first flag.
int version_
version of the ROC we have read
const HgcrocDigi getDigi(unsigned int digiIndex) const
Get samples for the input digi index.
void clear()
Clear the data in the object.
int getVersion() const
Get the version of ROC we have read.
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.
static const int FIRSTMEAS_POS
Bit position of first measurement.
unsigned int num_samples_per_digi_
number of samples for each digi
void setNumSamplesPerDigi(unsigned int n)
Set number of samples for each digi.
static const int TEN_BIT_MASK
Mask for lowest order ten bits in an int.
Iterator end()
The end of this collection.
void setSampleOfInterestIndex(unsigned int n)
Set index of sample of interest.
static const int ONE_BIT_MASK
Mask for lowest order bit in an int.
unsigned int getSampleOfInterestIndex() const
Get index of sample of interest.
ClassDef(HgcrocDigiCollection, 6)
The ROOT class definition.
void setVersion(int v)
Set the version of the ROC we have read.
static const int SECONMEAS_POS
Bit position of second measurement.
HgcrocDigiCollection()
Class constructor.
void addDigi(unsigned int id, const std::vector< Sample > &digi)
Add samples to collection.
unsigned int sample_of_interest_
index for the sample of interest in the samples list
unsigned int getNumDigis() const
Get total number of digis.
unsigned int size() const
Get total number of digis.
friend std::ostream & operator<<(std::ostream &o, const HgcrocDigiCollection &d)
Print out the object.
virtual ~HgcrocDigiCollection()
Class destructor.