![]() |
ATLAS Offline Software
|
Calo cell packer/unpacker v400/500. More...
#include <CaloCellPacker_400_500.h>
Classes | |
struct | header400 |
Packing parameters header (v400). More... | |
struct | header500 |
Packing parameters header (v500). More... | |
struct | header501 |
Packing parameters header (v501). More... | |
struct | pars500 |
Derived packing parmeters. More... | |
Public Member Functions | |
void | pack (const CaloCellContainer &cells, CaloCompactCellContainer &packed, const SG::ThinningDecisionBase *dec, int version) const |
Pack cells. More... | |
void | unpack (const CaloCompactCellContainer &packed, const std::vector< CaloCompactCellContainer::value_type > &vheader, CaloCellContainer &cells, DataPool< LArCell > &larpool, DataPool< TileCell > &tilepool) const |
Unpack cells. More... | |
Private Member Functions | |
Packing. | |
void | pack_time (float time, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const |
Pack a time value. More... | |
void | pack_lar (const CaloCell *cell, CaloCell_ID::SUBCALO subcalo, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const |
Pack one LAr cell. More... | |
void | pack_tile (const TileCell *cell, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const |
Pack one tile cell. More... | |
void | finish_seq (unsigned int hash, unsigned int nseq, CaloCompactCellContainer::compact_output_iterator &it, CaloCell_ID::SUBCALO subcalo, pars500 &pars) const |
Finish up one cell sequence. More... | |
void | write_header (const header &header, CaloCompactCellContainer &packed) const |
Write the header to the output container. More... | |
Header and parameter definitions. | |
typedef header501 | header |
The most recent header version. More... | |
void | init_header (header &header, int version) const |
Initialize header with the current version of the packing parameters. More... | |
void | clear_header (header &header) const |
Clear the counters in the event header. More... | |
void | init_derived (pars500 &pars) const |
Initialize the derived packing parameters from the constants in the header. More... | |
Unpacking. | |
class | CaloCellPacker_400_500_test |
double | unpack_time (CaloCompactCellContainer::compact_input_iterator &it, const pars500 &pars) const |
Unpack the time word. More... | |
CaloCell * | unpack_lar (CaloCompactCellContainer::compact_input_iterator &it, CaloCell_ID::SUBCALO subcalo, LArCell *cell, const pars500 &pars, uint16_t provenance) const |
Unpack a LAr cell. More... | |
TileCell | unpack_tile (CaloCompactCellContainer::compact_input_iterator &it, const CaloDetDescrElement *dde, const pars500 &pars, uint16_t provenance) const |
Unpack a tile cell. More... | |
Calo cell packer/unpacker v400/500.
This class handles packing and unpacking of calorimeter cells into a CaloCompactCellContainer. This holds data as a vector of integers, but for our purposes, we treat it as an array of 16-bit values. We use the special iterator-like objects that that class defines for access.
A summary of the format is given here. Most constants and bit assignments are specified within the method init_header()
. Though some of them are spelled out here, the possibility is left open that they can change. The constants are stored in a header along with the data; for reading, those stored constants are the ones used to interpret the data.
The difference between versions 400 and 500 is the inclusion of quality and provenance data. Quality is like a chi**2 comparing the observed pulse shape (with 5 samples) to the expected one. It is different cell by cell, event by event (it is like energy and time from this point of view)
The idea to store provenance is to know when reading back the ESD how the energy was estimated. For instance, when doing the OFC iteration method on the cosmics on high energy cell there is one bit which tells if the iteration converges or not and this is useful when analyzing back the event (and this bit can vary from event to event for the same cell).
The packed data start with an instance of either header400
or header500
, containing the packing constants as well as cell/sequence counts. Note that the first word is the length of the header, in units of int
.
Following the header is a set of sequences, each containing a range of cells with consecutive hash IDs. The cells are stored in hash order, which implies that the subcalorimeters are strictly in the order LAREM, LARHEC, LARFCAL, TILE. A single sequence contains cells from only a single subcalorimeter.
Each sequence starts with a 32-bit value; where the high word is stored first, and the low word second. (Note that this is opposite from the order in which the x86 would naturally store the data.) The lower 18 bits of this give the hash value of the first cell in the sequence (others follow sequentially), and the upper 14 bits give the number of cells in the sequence. (Note: if the number of cells in a sequence is more than can be represented in 14 bits, the sequence is simply split into several.) Following this is the information for the cells themselves.
For LAr cells, there is a 16-bit word, containing, starting from the low bit, 12 bits of energy, one sign bit for energy, two bits for the gain, and one bit for the quality. The quality bit is 1 for good quality and 0 for bad quality. The gain bits are one of: 0 ENLOW for LARLOWGAIN 1 ENMED for LARMEDIUMGAIN, unless cell is in the HEC with e < e1_high 2 ENHIG for LARHIGHGAIN, unless cell is not in the HEC with e< e1_high 3 EHHIG for LARMEDIUMGAIN if cell is in the HEC with e < e1_high or for LARHIGHGAIN if cell is not in the HEC with e < e1_high
The maximum energy is taken to be 50 GeV (e1_high) for EHHIG and 3.2 TeV otherwise. We take the cube root of the absolute value of the energy, convert it into a fraction of fullscale (as a cube root), and store that fraction as a fixed-point number.
If the quality is good, this is followed by two additional 16-bit words. The first gives the time information. This has 15 bits of time information and one sign bit. We take the natural log of the time, and then encode this as a fraction of the range from 0.001ns to 1250ns. This is then followed by the quality word.
For tile cells, information for each of the two PMTs is stored separately. First is a 16-bit word containing 13 bits of energy information, one sign bit, one gain bit, and one quality bit. The quality bit is 1 for good quality and 0 for bad. The gain bit is 0 for low gain and 1 for high gain. The energy is again stored as a scaled cube root, where the upper limit is 50 GeV for high gain and 3.2 TeV for low gain. If the quality is good, this is followed by 16 bits of time information, encoded as before. Following both cells is a 16-bit quality word; the lower 8 bits are for the first PMT, and the upper eight bits are for the second PMT. If the quality flags for both PMTs are bad, then this word is omitted.
Following the cell information is the provenance information. Each provenance entry consists of a cell hash code (19 bits) plus a provenance word (13 bits) packed into two 16-bit words. The high 13 bits of the first word are the provenance; the low three bits of the first word plus the second word give the hash code. Each provenance entry says that cells starting at the given hash code have the given provenance value (until the hash code of the next provenance entry). Cells with a hash code less than that of the first provenance entry have a provenance word of 0.
Version 501 adds a status bitmask to the header, with the flag STATUS_UNORDERED. This is set if the packer finds that the cells are not in subcalo order. (This is the case for cell collections produced by the HLT, which are concatenations of per-ROI cell collections.)
Version 502 adds quality words and provenance for tile.
Version 503 reduces slightly the range for negative energies, to avoid confusion with error flags.
Version 504 introduces a flag for SuperCell
Definition at line 144 of file CaloCellPacker_400_500.h.
|
private |
The most recent header version.
Definition at line 284 of file CaloCellPacker_400_500.h.
|
private |
Clear the counters in the event header.
header | The header to clear. |
Definition at line 104 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Finish up one cell sequence.
hash | The hash of the first cell in the sequence. |
nseq | The number of cells in the sequence. |
it | Iterator pointing at the beginning of the sequence. |
subcalo | Subcalorimeter code for the sequence. |
pars | The packing parameters. |
Definition at line 424 of file CaloCellPacker_400_500.cxx.
|
private |
Initialize the derived packing parameters from the constants in the header.
pars | The packing parameters. |
Definition at line 124 of file CaloCellPacker_400_500.cxx.
|
private |
Initialize header with the current version of the packing parameters.
(Almost) all the constants are defined here.
header | The header to initialize. |
version | The version of the header to initialize. |
Definition at line 41 of file CaloCellPacker_400_500.cxx.
void CaloCellPacker_400_500::pack | ( | const CaloCellContainer & | cells, |
CaloCompactCellContainer & | packed, | ||
const SG::ThinningDecisionBase * | dec, | ||
int | version | ||
) | const |
Pack cells.
cells | The input cell container. |
packed | The output packed cell container. |
dec | If non-null, specification of elements to be thinned. |
version | The version of the header to initialize. |
Definition at line 470 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Pack one LAr cell.
cell | The cell to pack. |
subcalo | The cell's subcalorimeter code. |
it | The iterator into which to pack. |
pars | The packing parameters. |
Definition at line 245 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Pack one tile cell.
cell | The cell to pack. |
it | The iterator into which to pack. |
pars | The packing parameters. |
Definition at line 340 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Pack a time value.
time | The time to pack. |
it | The iterator into which to pack. |
pars | The packing parameters. |
Definition at line 212 of file CaloCellPacker_400_500.cxx.
void CaloCellPacker_400_500::unpack | ( | const CaloCompactCellContainer & | packed, |
const std::vector< CaloCompactCellContainer::value_type > & | vheader, | ||
CaloCellContainer & | cells, | ||
DataPool< LArCell > & | larpool, | ||
DataPool< TileCell > & | tilepool | ||
) | const |
Unpack cells.
packed | The input packed cell container. |
vheader | The header part of the packed data. |
cells | The output cell container. |
larpool | Pool for allocating LAr cells. |
tilepool | Pool for allocating Tile cells. |
Note that allocations will be done from the provided pools, and the pools retain ownership of the cells. The cells container will be changed to a view container.
Definition at line 880 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Unpack a LAr cell.
it | Input iterator. |
subcalo | Subcalorimeter code for the cell. |
cell | Pointer to the cell in which to write. |
pars | Unpacking parameters. |
provenance | The provenance word for this cell. |
CaloCell*
.The DDE and ID will be set in the cell separately; here, we need only fill in the cell data.
Definition at line 708 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Unpack a tile cell.
it | Input iterator. |
dde | Descriptor element for the cell. |
pars | Unpacking parameters. |
provenance | The provenance word for this cell. |
it | Input iterator. |
dde | Descriptor element for the cell. |
pars | Unpacking parameters. |
Definition at line 785 of file CaloCellPacker_400_500.cxx.
|
inlineprivate |
Unpack the time word.
it | Input iterator. |
pars | Unpacking parameters. |
Definition at line 671 of file CaloCellPacker_400_500.cxx.
|
private |
Write the header to the output container.
header | The header to write. |
packed | The container to which to write. |
Definition at line 647 of file CaloCellPacker_400_500.cxx.
|
friend |
Definition at line 483 of file CaloCellPacker_400_500.h.