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_;
426 void addDigi(
unsigned int id,
const std::vector<Sample>& digi);
427 void addDigi(
unsigned int id,
const std::vector<uint32_t>& digi);
441 :
public std::iterator<std::input_iterator_tag, HgcrocDigi, long> {
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
One sample of a digi channel corresponding to one clock of the HGCROC chip.
Sample(bool tot_progress, bool tot_complete, int firstMeas, int seconMeas, int toa, int version=3)
Helpful alternative constructor.
int adc_t() const
Get the 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 adc_tm1() const
Get the last ADC measurement from this sample.
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.
iterator class so we can do range-based loops over digi collections
iterator(HgcrocDigiCollection &c, long index=0)
Connect the parent collection with an index to this iterator.
iterator & operator++()
Increment the digi index and return the iterator afterwards.
iterator operator++(int)
Increment the digi index and return the iterator before.
bool operator!=(iterator other) const
Check if two iterators are not on the same index.
long digi_index_
the index of the digi this iterator represents
const HgcrocDigi operator*() const
De-reference this iterator by using the parent collection to get the actual digi at the index.
bool operator==(iterator other) const
Check if two iterators are on the same index.
HgcrocDigiCollection & coll_
the parent collection this iterator is looping over
Represents a collection of the digi hits readout by an HGCROC.
std::vector< uint32_t > samples_
list of samples that we have been given
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
int getVersion() const
Get the version of ROC we have read.
unsigned int numSamplesPerDigi_
number of samples for each digi
unsigned int getNumSamplesPerDigi() const
Get number of samples per digi.
static const int FIRSTMEAS_POS
Bit position of first measurement.
iterator end()
The end of this collection.
void setNumSamplesPerDigi(unsigned int n)
Set number of samples for each digi.
void Print() const
Print out the object.
static const int TEN_BIT_MASK
Mask for lowest order ten bits in an int.
void setSampleOfInterestIndex(unsigned int n)
Set index of sample of interest.
std::vector< unsigned int > channelIDs_
list of channel IDs that we have digis for
static const int ONE_BIT_MASK
Mask for lowest order bit in an int.
unsigned int getSampleOfInterestIndex() const
Get index of sample of interest.
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.
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 sampleOfInterest_
index for the sample of interest in the samples list
iterator begin()
The beginning of this collection.
unsigned int size() const
Get total number of digis.
virtual ~HgcrocDigiCollection()
Class destructor.
ClassDef(HgcrocDigiCollection, 4)
The ROOT class definition.
void Clear()
Clear the data in the object.