8 int firstMeas,
int seconMeas,
int toa,
16 (((seconMeas > 0xfff ? 0xfff : seconMeas) & 0xfff) << 20) +
22 if (not tot_progress and tot_complete) {
51 return o <<
"HgcrocDigiCollection { Num Channel IDs: "
58 unsigned int digiIndex)
const {
65 unsigned int id,
const std::vector<HgcrocDigiCollection::Sample> &digi) {
66 if (digi.size() != this->getNumSamplesPerDigi()) {
67 std::cerr <<
"[ WARN ] [ HgcrocDigiCollection ] Input list of samples "
70 <<
"' that does not match the number of samples per digi '"
76 for (
auto const &s : digi)
samples_.push_back(s.raw());
82 const std::vector<uint32_t> &digi) {
83 if (digi.size() != this->getNumSamplesPerDigi()) {
84 std::cerr <<
"[ WARN ] [ HgcrocDigiCollection ] Input list of samples "
87 <<
"' that does not match the number of samples per digi '"
93 for (
auto const &s : digi)
samples_.push_back(s);
99std::ostream &operator<<(std::ostream &s,
104 s <<
"adc t: " << sample.
adcT() <<
", " <<
"tot: " << sample.
tot() <<
", ";
106 s <<
"adc t-1: " << sample.
adcTm1() <<
", " <<
"tot: " << sample.
tot()
109 s <<
"adc t-1: " << sample.
adcTm1() <<
", " <<
"adc t: " << sample.
adcT()
112 s <<
"toa: " << sample.
toa() <<
" }";
116std::ostream &operator<<(std::ostream &s,
118 s <<
"HgcrocDigi { ";
120 s <<
" Id: 0x" << std::hex << digi.
id() << std::dec <<
" ";
123 s <<
"ADC Mode -> SOI: " << digi.
soi() <<
" }";
125 s <<
"TOT Mode -> " << digi.
tot() <<
" }";
130std::ostream &operator<<(std::ostream &s,
132 s <<
"HgcrocDigiCollection { " << std::endl;
133 for (
unsigned int i_digi = 0; i_digi < col.
getNumDigis(); i_digi++)
134 s <<
" " << col.
getDigi(i_digi) << std::endl;
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
One DIGI signal coming from the HGC ROC.
bool isADC() const
Check if this DIGI is an ADC measurement.
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.
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 tot() const
Get the TOT measurement from this sample.
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 toa() const
Get the Time Of Arrival of this sample which is always the third position in all readout modes.
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
static const int SECONFLAG_POS
Bit position of second flag.
static const int FIRSTFLAG_POS
Bit position of first flag.
const HgcrocDigi getDigi(unsigned int digiIndex) const
Get samples for the input digi index.
void clear()
Clear the data in the object.
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
static const int TEN_BIT_MASK
Mask for lowest order ten bits in an int.
static const int SECONMEAS_POS
Bit position of second measurement.
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.
friend std::ostream & operator<<(std::ostream &o, const HgcrocDigiCollection &d)
Print out the object.