ATLAS Offline Software
Classes | Public Member Functions | List of all members
CaloCellPacker_400_500 Class Reference

Calo cell packer/unpacker v400/500. More...

#include <CaloCellPacker_400_500.h>

Collaboration diagram for CaloCellPacker_400_500:

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...
 
CaloCellunpack_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...
 

Detailed Description

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.

Member Typedef Documentation

◆ header

The most recent header version.

Definition at line 284 of file CaloCellPacker_400_500.h.

Member Function Documentation

◆ clear_header()

void CaloCellPacker_400_500::clear_header ( header header) const
private

Clear the counters in the event header.

Parameters
headerThe header to clear.

Definition at line 104 of file CaloCellPacker_400_500.cxx.

105 {
106  header.m_ncells_larem = 0;
107  header.m_ncells_larhec = 0;
108  header.m_ncells_larfcal = 0;
109  header.m_ncells_tile = 0;
110  header.m_seq_larem = 0;
111  header.m_seq_larhec = 0;
112  header.m_seq_larfcal = 0;
113  header.m_seq_tile = 0;
114  header.m_lengthProvenance = 0;
115  header.m_status = 0;
116 }

◆ finish_seq()

void CaloCellPacker_400_500::finish_seq ( unsigned int  hash,
unsigned int  nseq,
CaloCompactCellContainer::compact_output_iterator it,
CaloCell_ID::SUBCALO  subcalo,
pars500 pars 
) const
inlineprivate

Finish up one cell sequence.

Parameters
hashThe hash of the first cell in the sequence.
nseqThe number of cells in the sequence.
itIterator pointing at the beginning of the sequence.
subcaloSubcalorimeter code for the sequence.
parsThe packing parameters.

Definition at line 424 of file CaloCellPacker_400_500.cxx.

430 {
431  // Pack the hash code and number of cells into a bitfield.
433  pars.m_hash_field.in(hash) | pars.m_nseq_field.in(nseq);
434 
435  // Write it into the output container.
436  it.set ((data>>16) & 0xffff);
437  it.set (data & 0xffff);
438 
439  // Update counters.
440  switch (subcalo) {
441  case CaloCell_ID::LAREM:
442  pars.m_ncells_larem += nseq;
443  ++pars.m_seq_larem;
444  break;
445  case CaloCell_ID::LARHEC:
446  pars.m_ncells_larhec += nseq;
447  ++pars.m_seq_larhec;
448  break;
450  pars.m_ncells_larfcal += nseq;
451  ++pars.m_seq_larfcal;
452  break;
453  case CaloCell_ID::TILE:
454  pars.m_ncells_tile += nseq;
455  ++pars.m_seq_tile;
456  break;
457  default:
458  std::abort();
459  }
460 }

◆ init_derived()

void CaloCellPacker_400_500::init_derived ( pars500 pars) const
private

Initialize the derived packing parameters from the constants in the header.

Parameters
parsThe packing parameters.

Definition at line 124 of file CaloCellPacker_400_500.cxx.

125 {
126  // Good quality flag.
127  pars.m_qgood = 1;
128 
129  // Set up parameters for packing/unpacking the sequence header.
130  pars.m_hash_field = CaloCellPackerUtils::Bitfield (0x0003ffff);
131  pars.m_nseq_field = CaloCellPackerUtils::Bitfield (0xfffc0000);
132  pars.m_nseq_max = 0x3fff;
133 
134  // Set up parameters for packing/unpacking the provenance list.
135  pars.m_prov_field = CaloCellPackerUtils::Bitfield (0xfff80000);
136  pars.m_prov_max = 0x1fff;
137  pars.m_prov_max_tile = 0x1f1f;
138 
139  // Cube roots of energy ranges.
140  pars.m_cbrt_e1_norm_res = cbrt(static_cast<double>(pars.m_e1_norm_res));
141  pars.m_cbrt_e1_high_res = cbrt(static_cast<double>(pars.m_e1_high_res));
142  pars.m_cbrt_low_tile = cbrt(static_cast<double>(pars.m_low_tile));
143  pars.m_cbrt_high_tile = cbrt(static_cast<double>(pars.m_high_tile));
144 
145  // Logarithms of time ranges.
146  pars.m_log_t0 = log(static_cast<double>(pars.m_t0));
147  pars.m_log_t1 = log(static_cast<double>(pars.m_t1));
148 
149  // Fill in remaining bit fields.
150  pars.m_qualy_field = CaloCellPackerUtils::Bitfield (pars.m_qualy_mask);
151  pars.m_egain_field = CaloCellPackerUtils::Bitfield (pars.m_egain_mask);
152  pars.m_crtae_norm_field =
154  pars.m_cbrt_e1_norm_res);
155  pars.m_crtae_high_field =
157  pars.m_cbrt_e1_high_res);
158  pars.m_logat_field =
160  pars.m_log_t0, pars.m_log_t1);
161  pars.m_egain_tile_field =
162  CaloCellPackerUtils::Bitfield (pars.m_egain_tile_mask);
163  pars.m_crtae_tile_high_field =
164  CaloCellPackerUtils::Floatfield2 (pars.m_crtae_tile_mask,
165  pars.m_cbrt_high_tile);
166  pars.m_crtae_tile_low_field =
167  CaloCellPackerUtils::Floatfield2 (pars.m_crtae_tile_mask,
168  pars.m_cbrt_low_tile);
169 
170  pars.m_tile_qual1_field = CaloCellPackerUtils::Bitfield (0x00ff);
171  pars.m_tile_qual2_field = CaloCellPackerUtils::Bitfield (0xff00);
172 
173  // Dummy flags.
174  pars.m_lar_dummy =
175  pars.m_egain_field.in (pars.m_enhig) |
176  pars.m_qualy_field.in (pars.m_qabad) |
177  pars.m_crtae_norm_field.in (cbrt (pars.m_e1_norm_res)) |
178  pars.m_esign_mask;
179 
180  pars.m_tile_dummy =
181  pars.m_egain_tile_field.in (pars.m_glow) |
182  pars.m_qualy_field.in (pars.m_qabad) |
183  pars.m_crtae_tile_high_field.in (pars.m_cbrt_high_tile) |
184  pars.m_esign_tile_mask;
185 
186 
187  {
188  CaloCellPackerUtils::Bitfield& elar = pars.m_crtae_norm_field;
189  pars.m_lar_dummy_subst = (pars.m_lar_dummy & ~pars.m_crtae_mask) |
190  elar.in (elar.out (pars.m_lar_dummy)-1);
191 
192  CaloCellPackerUtils::Bitfield& etile = pars.m_crtae_tile_high_field;
193  pars.m_tile_dummy_subst = (pars.m_tile_dummy & ~pars.m_crtae_tile_mask) |
194  etile.in (etile.out (pars.m_tile_dummy)-1);
195  }
196 }

◆ init_header()

void CaloCellPacker_400_500::init_header ( header header,
int  version 
) const
private

Initialize header with the current version of the packing parameters.

(Almost) all the constants are defined here.

Parameters
headerThe header to initialize.
versionThe version of the header to initialize.

Definition at line 41 of file CaloCellPacker_400_500.cxx.

43 {
44  header.m_version = version;
45  switch (version) {
50  header.m_length = sizeof(header501)/sizeof(int);
51  break;
52 
54  header.m_length = sizeof(header500)/sizeof(int);
55  break;
57  header.m_length = sizeof(header400)/sizeof(int);
58  break;
59  default:
60  std::abort();
61  }
62 
63  header.m_qualy_mask = 0x8000;
64  header.m_egain_mask = 0x6000;
65  header.m_esign_mask = 0x1000;
66  // 12 bits for cbrt(|E|) and 2 ranges, one normal
67  // resolution range with upper limit 3.2 TeV and precision loss
68  // sigma_E'/E < 1.4%/sqrt(E/GeV) and one high-resolution range used
69  // whenever E < 50 GeV and the hardware gain is HIGH (HEC: MEDIUM)
70  // resulting in a precision loss of sigma_E'/E < 0.15%/sqrt(E/GeV)
71  header.m_crtae_mask = 0x0fff;
72  header.m_egain_tile_mask = 0x4000;
73  header.m_esign_tile_mask = 0x2000;
74  // 13 bits cbrt(|E|) and 2 ranges
75  // upper limit for low gain is 3.2 TeV,
76  // upper limit for high gain is 50 GeV (safety factor of ~3)
77  header.m_crtae_tile_mask = 0x1fff;
78  header.m_tsign_mask = 0x8000;
79  header.m_logat_mask = 0x7fff;
80 
81  header.m_qabad = 0;
82  header.m_enlow = 0; // normal resolution LOW gain
83  header.m_enmed = 1; // normal resolution MEDIUM gain
84  header.m_enhig = 2; // normal resolution HIGH gain
85  header.m_ehhig = 3; // high resolution HIGH (HEC: MEDIUM) gain
86  header.m_glow = TileID::LOWGAIN;
87  header.m_ghigh = TileID::HIGHGAIN;
88 
89  header.m_e1_norm_res = 3.2*Gaudi::Units::TeV;
90  header.m_e1_high_res = 50*Gaudi::Units::GeV;
91  header.m_high_tile = 50*Gaudi::Units::GeV;
92  header.m_low_tile = 3.2*Gaudi::Units::TeV;
93  header.m_t0 = 0.001*Gaudi::Units::ns;
94  header.m_t1 = 1250.0*Gaudi::Units::ns;
95 
97 }

◆ pack()

void CaloCellPacker_400_500::pack ( const CaloCellContainer cells,
CaloCompactCellContainer packed,
const SG::ThinningDecisionBase dec,
int  version 
) const

Pack cells.

Parameters
cellsThe input cell container.
packedThe output packed cell container.
decIf non-null, specification of elements to be thinned.
versionThe version of the header to initialize.

Definition at line 470 of file CaloCellPacker_400_500.cxx.

474 {
475  // Set up the header and derived parameters.
476  pars500 pars;
478  init_derived (pars);
479 
480  std::vector<short unsigned int> vProvenance;
481 
482  // Figure out an upper limit for the container size.
483  // Header, plus one word/cell for sequence, two words/cell for data,
484  // and another word/cell for provenance.
485  // Tile cells have two additional words/cell - energy and time for second PMT.
486  // Add one more to account for possible padding before the provenance info.
487  // We'll resize this down correctly when we're done.
488  unsigned int maxsize =
489  pars.m_length + 4 * cells.size() + 2 * cells.nCellsCalo (CaloCell_ID::TILE)+1;
490  packed.resize (maxsize);
491 
492  // Set up for loop over cells.
493 
494  // This is the output iterator, to which we write.
496  (packed.compact_begin_output (pars.m_length));
497 
498  // Here we save the output iterator at the beginning of each sequence.
499  // We'll use that to go back and plug in the count when we're done.
501  (packed.compact_begin_output (pars.m_length));
502 
503  // The hash of the first cell in the current sequence.
504  unsigned int seqhash = static_cast<unsigned int> (-1);
505 
506  // Number of cells so far in the current sequence.
507  // 0 if not in a sequence.
508  unsigned int nseq = 0;
509 
510  // The subcalorimeter code of the previous cell we looked at.
512 
513  // If all the cells have provenance 0, there is nothing in the vector.
514  short unsigned int prevCellProvenance=0;
515 
516  // check if it is a SuperCell
517  bool is_SC=false;
518  if (cells.size()>0){
519  // assuming no mixed SC and Cells.
520  const CaloDetDescrElement* dde = cells[0]->caloDDE();
521  const CaloCell_Base_ID* idhelper =
522  dde->descriptor()->get_calo_helper();
523  is_SC = idhelper->is_supercell(cells[0]->ID());
524  }
525 
526  if (is_SC)
527  pars.m_status |= header::STATUS_IS_SUPERCELL;
528 
529  // Loop over input cells.
530  size_t icell = static_cast<size_t>(-1);;
531  for (const CaloCell* cell : cells)
532  {
533  // Check for thinning.
534  ++icell;
535  if (dec && dec->thinned (icell)) {
536  continue;
537  }
538 
539  // Pick up values from the cell.
540  const CaloDetDescrElement* dde = cell->caloDDE();
541  unsigned int hash = dde->calo_hash();
542  CaloCell_ID::SUBCALO subcalo = dde->getSubCalo();
543 
544  // Test to see if we need to start a new sequence.
545  if (// Not in a sequence now?
546  nseq == 0 ||
547  // We're at the maximum sequence length?
548  nseq >= pars.m_nseq_max ||
549  // A skip in the cell hash codes?
550  seqhash + nseq != hash ||
551  // Moving to a new subcalorimeter?
552  subcalo != prevcalo)
553  {
554  // Mark if cells aren't ordered.
555  if (prevcalo != CaloCell_ID::NOT_VALID &&
556  subcalo < prevcalo)
557  pars.m_status |= header::STATUS_UNORDERED;
558 
559  // If we're already in a sequence, need to finish it.
560  if (nseq > 0)
561  finish_seq (seqhash, nseq, seqit, prevcalo, pars);
562 
563  // Start a new sequence.
564  nseq = 0;
565  seqhash = hash;
566  prevcalo = subcalo;
567  // Leave space to fill in the hash/count later.
568  seqit = outit;
569  ++outit;
570  ++outit;
571  }
572 
573  // Add the current cell on to sequence.
574  if (!is_SC && subcalo == CaloCell_ID::TILE) {
575  pack_tile (static_cast<const TileCell*>(cell), outit, pars);
576 
577  // Check to see if the provenance changed.
578  if (version >= 502 &&
579  (cell->provenance() & pars.m_prov_max_tile) != prevCellProvenance)
580  {
581  prevCellProvenance = cell->provenance() & pars.m_prov_max_tile;
583  pars.m_hash_field.in(hash) |
584  pars.m_prov_field.in(prevCellProvenance);
585  vProvenance.push_back ((data>>16) & 0xffff);
586  vProvenance.push_back (data & 0xffff);
587  }
588  }
589  else {
590  pack_lar (cell, subcalo, outit, pars);
591 
592  // Check to see if the provenance changed.
593  if (version >= 500 &&
594  (cell->provenance() & pars.m_prov_max) != prevCellProvenance)
595  {
596  prevCellProvenance = cell->provenance() & pars.m_prov_max;
598  pars.m_hash_field.in(hash) |
599  pars.m_prov_field.in(prevCellProvenance);
600  vProvenance.push_back ((data>>16) & 0xffff);
601  vProvenance.push_back (data & 0xffff);
602  }
603  }
604  ++nseq;
605  }
606 
607  // Finish the last sequence.
608  if (nseq != 0)
609  finish_seq (seqhash, nseq, seqit, prevcalo, pars);
610 
611  pars.m_lengthProvenance = vProvenance.size();
612 
613  assert (outit.used() + pars.m_length + vProvenance.size()/2 + 1 <= maxsize);
614 
615  if (pars.m_lengthProvenance > 0) {
616  // this part is making existing vector to have full number of 32 bit words.
617  int x=outit.used();
618  // dummy value of 0 is inserted
619  outit.set(0);
620  int y=outit.used();
621  // if size changed it means that vector was flat at the end and that we spoiled it.
622  // so we have to fix it.
623  if (x!=y) outit.set(0);
624  // now its surely flat.
625 
626  // add provenance stuff at the end.
627  for (unsigned short & iter : vProvenance)
628  {
629  outit.set (iter);
630  }
631  }
632 
633  // Now resize the container to the final size.
634  packed.resize (outit.used() + pars.m_length);
635 
636  // And copy the header to the front.
638 }

◆ pack_lar()

void CaloCellPacker_400_500::pack_lar ( const CaloCell cell,
CaloCell_ID::SUBCALO  subcalo,
CaloCompactCellContainer::compact_output_iterator it,
const pars500 pars 
) const
inlineprivate

Pack one LAr cell.

Parameters
cellThe cell to pack.
subcaloThe cell's subcalorimeter code.
itThe iterator into which to pack.
parsThe packing parameters.

Definition at line 245 of file CaloCellPacker_400_500.cxx.

250 {
251  // Get values from the cell.
252  double energy = cell->energy();
253  double time = cell->time();
254  int qualflag;
255  if( (cell->provenance() & 0x2000) == 0x2000 )
256  qualflag=pars.m_qgood;
257  else
258  qualflag=pars.m_qabad;
259 
260  int gain = cell->gain();
261 
262  // Figure out which gain to use.
263  // cbrt_flag is set to 1 for the high gain range (50 GeV) and 0 for
264  // the low gain range (3.2 TeV).
265  int gainflag = -999;
266  int cbrt_flag = 0;
267  switch ( gain ) {
269  gainflag = pars.m_enlow;
270  break;
272  if ( subcalo == CaloCell_ID::LARHEC &&
273  fabs(energy) < pars.m_e1_high_res )
274  {
275  gainflag = pars.m_ehhig;
276  cbrt_flag = 1;
277  }
278  else
279  gainflag = pars.m_enmed;
280  break;
282  if ( fabs(energy) < pars.m_e1_high_res &&
283  subcalo != CaloCell_ID::LARHEC )
284  {
285  gainflag = pars.m_ehhig;
286  cbrt_flag = 1;
287  }
288  else
289  gainflag = pars.m_enhig;
290  break;
291 
292  default:
293  // Some invalid gain. Mark as an error.
294  gainflag = -999;
295  }
296 
297  if (gainflag == -999) {
298  it.set (pars.m_lar_dummy);
299  }
300  else {
301  // Pack the energy, gain, and quality into the output word.
302  double crtae = cbrt(fabs(energy));
304  (cbrt_flag ? pars.m_crtae_high_field.in (crtae)
305  : pars.m_crtae_norm_field.in (crtae));
306 
307  // Set the sign bit.
308  // Only set the sign bit if saved value is non-zero.
309  // Otherwise, it'll be read as zero regardless, and if we write
310  // again, the sign bit'll be different.
311  if (energy < 0 && data != 0)
312  data |= pars.m_esign_mask;
313 
314  data |= pars.m_egain_field.in (gainflag) |
315  pars.m_qualy_field.in (qualflag);
316 
317  if (data == pars.m_lar_dummy)
318  data = pars.m_lar_dummy_subst;
319 
320  // Fill the output container.
321  it.set (data);
322 
323  // If quality is not bad there are time and quality (chi^2) measurements.
324  if ( qualflag != pars.m_qabad){
325  pack_time (time, it, pars);
326  if (pars.m_version >= 500)
327  it.set(cell->quality());
328  }
329  }
330 }

◆ pack_tile()

void CaloCellPacker_400_500::pack_tile ( const TileCell cell,
CaloCompactCellContainer::compact_output_iterator it,
const pars500 pars 
) const
inlineprivate

Pack one tile cell.

Parameters
cellThe cell to pack.
itThe iterator into which to pack.
parsThe packing parameters.

Definition at line 340 of file CaloCellPacker_400_500.cxx.

344 {
345  // Tile cells have two separate measurements to pack.
346  // Retrieve them both:
347  double ene[2] = {cell->ene1(), cell->ene2()};
348  double time[2] = {cell->time1(), cell->time2()};
349  int qbit[2] = {cell->qbit1(), cell->qbit2()};
350  int gain[2] = {cell->gain1(), cell->gain2()};
351 
352  // Loop over the two measurements (PMTs).
353  // If no cell both gains are bad;
354  // if only one pmt per cell, second gain is bad.
355  bool write_qual = false;
356  for (int ipmt=0; ipmt<2; ++ipmt) {
357  // We'll set this to true if we want to write time information.
358  bool write_time = false;
359 
360  // The data word we're building.
362 
363  // Does this measurement exist?
364  if (gain[ipmt] == CaloGain::INVALIDGAIN) {
365  // No --- make a dummy.
366  data = pars.m_tile_dummy;
367  }
368  else {
369  // Yes --- we have a measurement. See if the quality's good.
370  // If so, then we'll want to write the time too.
371  int qualflag = pars.m_qabad;
372  if (qbit[ipmt] >= TileCell::KEEP_TIME) {
373  qualflag = pars.m_qgood;
374  write_time = true;
375  write_qual = true;
376  }
377 
378  // Pack the energy, with the proper range, depending on the gain.
379  double crtae = cbrt(fabs(ene[ipmt]));
380  if (gain[ipmt] != pars.m_glow)
381  data = pars.m_crtae_tile_high_field.in (crtae);
382  else
383  data = pars.m_crtae_tile_low_field.in (crtae);
384 
385  // Add the sign bit.
386  // Only set the sign bit if saved value is non-zero.
387  // Otherwise, it'll be read as zero regardless, and if we write
388  // again, the sign bit'll be different.
389  if (ene[ipmt] < 0 && data != 0)
390  data |= pars.m_esign_tile_mask;
391 
392  // Add in the gain and quality.
393  data |=
394  pars.m_egain_tile_field.in (gain[ipmt]) |
395  pars.m_qualy_field.in (qualflag);
396 
397  if (data == pars.m_tile_dummy)
398  data = pars.m_tile_dummy_subst;
399  }
400 
401  // Fill to the output container.
402  it.set (data);
403 
404  // Fill the time and quality, if needed.
405  if (write_time)
406  pack_time (time[ipmt], it, pars);
407  }
408 
409  if (pars.m_version >= 502 && write_qual) {
410  it.set (cell->quality());
411  }
412 }

◆ pack_time()

void CaloCellPacker_400_500::pack_time ( float  time,
CaloCompactCellContainer::compact_output_iterator it,
const pars500 pars 
) const
inlineprivate

Pack a time value.

Parameters
timeThe time to pack.
itThe iterator into which to pack.
parsThe packing parameters.

Definition at line 212 of file CaloCellPacker_400_500.cxx.

216 {
217  // We want to pack log(abs(time)).
218  float ltime = pars.m_log_t0;
219  if (time != 0)
220  ltime = log(fabs(time));
221 
222  // Pack it into the bitfield.
223  CaloCompactCell::value_type data = pars.m_logat_field.in (ltime);
224 
225  // Set the sign bit.
226  // Only set the sign bit if saved value is non-zero.
227  // Otherwise, it'll be read as zero regardless, and if we write
228  // again, the sign bit'll be different.
229  if ( time < 0 && data != 0 )
230  data |= pars.m_tsign_mask;
231 
232  // Fill output.
233  it.set (data);
234 }

◆ unpack()

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.

Parameters
packedThe input packed cell container.
vheaderThe header part of the packed data.
cellsThe output cell container.
larpoolPool for allocating LAr cells.
tilepoolPool 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.

886 {
887  // Convert the header.
888  pars500 pars;
889  pars.m_status = 0;
890  pars.m_seq_tile = 0;
891  pars.m_seq_larem = 0;
892  pars.m_seq_larhec = 0;
893  pars.m_seq_larfcal = 0;
894  pars.m_lengthProvenance = 0;
895  pars.m_ncells_tile = 0;
896  pars.m_ncells_larhec = 0;
897  pars.m_ncells_larfcal = 0;
898  pars.m_ncells_larem = 0;
899 
900  {
901  const int* headerbeg = &*vheader.begin();
902  const int* headerend = headerbeg + vheader.size();
903  size_t nheader = headerend - headerbeg;
904  size_t parsize = sizeof(header) / sizeof(int);
905  size_t ncopy = std::min (nheader, parsize);
906  int* parsbeg = reinterpret_cast<int*>(&pars);
907  std::copy (headerbeg, headerbeg+ncopy, parsbeg);
908  if (nheader > parsize) {
909  // Header was longer than we expected --- there's something
910  // wrong with the data. Issue a warning.
911  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
912  "CaloCellPacker_400_500 ")
913  << "Corrupted data: Compact cell header is "
914  << nheader << " words long, longer than the largest expected value of "
915  << parsize << ".";
916  }
917  else if (ncopy < parsize) {
918  // Header was shorter than we expected.
919  // It may be a previous version --- clear out the remainder of pars.
920  // TODO: Cross-check the size we got with what we expect based
921  // on the version number in the header.
922  std::fill (parsbeg + ncopy, parsbeg + parsize, 0);
923  }
924  }
925 
926  // Initialize derived parameters from the header.
927  init_derived (pars);
928 
929  // Bounds check on size of provenance.
930  unsigned nprov = pars.m_lengthProvenance/2;
931  if (nprov + vheader.size() > packed.getData().size()) {
932  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
933  "CaloCellPacker_400_500 ")
934  << "Corrupted data: Provenance count too large "
935  << pars.m_lengthProvenance << ".";
936  pars.m_lengthProvenance = 0;
937  nprov = 0;
938  }
939 
940  // need to make a new iterator and use it for provenance.
942  packed.compact_begin_input_from(pars.m_lengthProvenance/2);
943  unsigned iprov=0;
944 
945  // getting starting values
946  short unsigned int currProvValue=0;
947  int nextProvHash=-1;
948  short unsigned int nextProvValue=0;
949  if (pars.m_lengthProvenance) {
950  unsigned int provhash = provIt.next();
951  provhash = (provhash<<16) | provIt.next();
952  nextProvValue = pars.m_prov_field.out (provhash);
953  nextProvHash = pars.m_hash_field.out (provhash);
954  iprov++;
955  }
956 
957  bool is_SC = (pars.m_status & header::STATUS_IS_SUPERCELL);
958 
959  // We need the detector description.
960  const CaloDetDescrManager_Base *ddmgr = nullptr;
961  if (is_SC){
962  SG::ReadCondHandleKey<CaloSuperCellDetDescrManager> caloSuperCellMgrKey {"CaloSuperCellDetDescrManager"};
963  StatusCode sc = caloSuperCellMgrKey.initialize();
964  if(sc.isFailure()) {
965  throw std::runtime_error("Failed to initialize ReadCondHandleKey for CaloSuperCellDetDescrManager");
966  }
967  SG::ReadCondHandle<CaloSuperCellDetDescrManager> caloSuperCellMgrHandle{caloSuperCellMgrKey};
968  ddmgr = *caloSuperCellMgrHandle;
969  }
970  else {
971  SG::ReadCondHandleKey<CaloDetDescrManager> caloMgrKey {"CaloDetDescrManager"};
972  StatusCode sc = caloMgrKey.initialize();
973  if(sc.isFailure()) {
974  throw std::runtime_error("Failed to initialize ReadCondHandleKey for CaloDetDescrManager");
975  }
976  SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{caloMgrKey};
977  ddmgr = *caloMgrHandle;
978  }
979  const CaloCell_Base_ID *calo_id = ddmgr->getCaloCell_ID();
980 
981  // Clear the output container and reserve the right number of elements.
982  cells.clear(SG::VIEW_ELEMENTS);
983  CaloCell_ID::size_type totcells =
984  pars.m_ncells_larem + pars.m_ncells_larhec +
985  pars.m_ncells_larfcal + pars.m_ncells_tile;
986  if (totcells > calo_id->calo_cell_hash_max()) {
987  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
988  "CaloCellPacker_400_500 ")
989  << "Corrupted data: Too many cells " << totcells << ".";
990  totcells = calo_id->calo_cell_hash_max();
991  }
992  cells.reserve (totcells);
993 
994  // Iterator for scanning the input.
996  packed.compact_begin_input();
997 
998  // To test for falling off the end.
999  std::vector<CaloCompactCellContainer::value_type>::const_iterator pend =
1000  packed.getData().end() - (pars.m_lengthProvenance+1)/2;
1001 
1002  // Sum up the total number of cells/sequences over all subcalos.
1003  unsigned int ncells =
1004  pars.m_ncells_larem +
1005  pars.m_ncells_larhec +
1006  pars.m_ncells_larfcal +
1007  pars.m_ncells_tile;
1008  unsigned int nseqs =
1009  pars.m_seq_larem +
1010  pars.m_seq_larhec +
1011  pars.m_seq_larfcal +
1012  pars.m_seq_tile;
1013 
1014  // Note: In the first version of the v400 packer, the sequence counts
1015  // would be left uninitialized if ncells==0.
1016  if (ncells == 0)
1017  nseqs = 0;
1018 
1019  // Warn if there are too many cells/sequences.
1020  IdentifierHash hashmax = calo_id->calo_cell_hash_max();
1021  if (ncells > hashmax || nseqs > hashmax || nseqs > ncells) {
1022  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1023  "CaloCellPacker_400_500 ")
1024  << "Corrupted data: Bad counts"
1025  << ": ncells " << ncells << " nseqs " << nseqs << " hashmax " << hashmax;
1026  }
1027 
1029 
1030  // Loop over sequences.
1031  while (nseqs--) {
1032 
1033  // Check for overrun.
1034  if (it.base() >= pend) {
1035  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1036  "CaloCellPacker_400_500 ")
1037  << "Corrupted data: cell vector overrun.";
1038  break;
1039  }
1040 
1041  // Get the starting hash code and count.
1043  unsigned int hashlength = data << 16;
1044  hashlength |= it.next();
1045 
1046  unsigned int hash = pars.m_hash_field.out (hashlength);
1047  unsigned int nseq = pars.m_nseq_field.out (hashlength);
1048 
1049  if (nseq > ncells || hash+nseq > hashmax)
1050  {
1051  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1052  "CaloCellPacker_400_500 ")
1053  << "Corrupted data: bad sequence. "
1054  << "nseq " << nseq << " hash " << hash << " ncells " << ncells
1055  << " hashmax " << hashmax;
1056  break;
1057  }
1058 
1059  // Subcalo code for this cell.
1060  CaloCell_ID::SUBCALO subcalo =
1061  static_cast<CaloCell_ID::SUBCALO> (calo_id->sub_calo (hash));
1062 
1063  // Maintain the cell container's pointers --- only if cells were ordered!
1064  if (subcalo != prevcalo) {
1065  if ((pars.m_status & header::STATUS_UNORDERED) == 0) {
1066  if (prevcalo != CaloCell_ID::NOT_VALID) {
1067  cells.updateCaloEndIterators (prevcalo, cells.size());
1068  if (subcalo < prevcalo) {
1069  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1070  "CaloCellPacker_400_500 ")
1071  << "Cells not in subcalo order; iterators will be wrong.";
1072  }
1073  }
1074  cells.updateCaloBeginIterators (subcalo, cells.size());
1075  }
1076  cells.setHasCalo (subcalo);
1077  prevcalo = subcalo;
1078  }
1079 
1080  // Loop over cells in the sequence.
1081  while (nseq--) {
1082  // Find the descriptor element for this cell.
1083  const CaloDetDescrElement *dde = ddmgr->get_element(hash);
1084 
1085  if (dde == nullptr) {
1086  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1087  "CaloCellPacker_400_500 ")
1088  << "Corrupted data: can't find DDE for cell with hash " << hash;
1089  }
1090 
1091  // Unpack the cell.
1092  //
1093  // One point here that needs explaining.
1094  // The pack_tile method returns a TileCell by value.
1095  // Normally, this would involve a copy; however, we're careful
1096  // to allow the compiler to use the `return value optimization'
1097  // to avoid this copy. That way, we can use the TileCell constructor
1098  // directly, without having to add extra set methods (or violate
1099  // encapsulation, as the previous version of this code did).
1100  // We get a pointer to a TileCell from the data pool and
1101  // use this in a placement new to initialize a TileCell
1102  // using the value returned from unpack_tile. Due to the RVO,
1103  // the copy is avoided, and the constructor in unpack_tile
1104  // will run its constructor directly on the pointer gotten
1105  // from the pool. For this to work correctly, we rely
1106  // on the fact that TileCell has only a trivial destructor ---
1107  // thus it's safe to rerun the constructor on an object that
1108  // has already been constructed.
1109  //
1110  // You'll notice, however, that CaloCell is done differently.
1111  // CaloCell is not a simple class; it has a complicated inheritance
1112  // structure. It was found that setting up all the vtable pointers
1113  // in CaloCell was taking a considerable amount of time
1114  // (comparable to filling in the cell data). So, for CaloCell,
1115  // we instead add a couple new (inlined) set methods to fill
1116  // in the data directly, without having to redo the vtable pointers.
1117  // We split it in two, one for dde/id and the other for the cell data,
1118  // to reduce the amount of data we need to pass to unpack_lar.
1119  //
1120  // Why wasn't the same thing done for TileCell, then?
1121  // - I don't have TC rights for TileEvent, so changing that
1122  // is more of a hassle.
1123  // - There are many fewer tile cells than LAr cells.
1124  // - The TileCell constructor we use is significantly
1125  // more complicated than LArCell. We'd have to duplicate
1126  // this code. Further, this, together with the previous
1127  // point, implies that the performance implications
1128  // of rebuilding the vtable pointers is much less
1129  // for tile cells than for LAr cells.
1130 
1131  // New provenance?
1132  if (hash==static_cast<unsigned int>(nextProvHash)){
1133  currProvValue = nextProvValue;
1134  if (iprov<nprov) {
1135  unsigned int provhash = provIt.next();
1136  provhash = (provhash<<16) | provIt.next();
1137  nextProvValue = pars.m_prov_field.out (provhash);
1138  nextProvHash = pars.m_hash_field.out (provhash);
1139  iprov++;
1140  } else {
1141  nextProvHash = -1;
1142  }
1143  }
1144 
1145  CaloCell* cell;
1146  if (!is_SC && subcalo == CaloCell_ID::TILE)
1147  cell = new (tilepool.nextElementPtr())
1149  dde,
1150  pars, currProvValue));
1151  else {
1152  cell = unpack_lar (it,
1153  subcalo,
1154  larpool.nextElementPtr(),
1155  pars,
1156  currProvValue);
1157  cell->set (dde, calo_id->cell_id(hash));
1158  }
1159 
1160  // Add the cell to the container.
1161  if (dde)
1162  cells.push_back (cell);
1163 
1164  // Move to next cell.
1165  ++hash;
1166  }
1167  }
1168 
1169  // Finish off the last iterator.
1170  if (prevcalo != CaloCell_ID::NOT_VALID)
1171  cells.updateCaloEndIterators (prevcalo, cells.size());
1172 
1173  // Check that we've consumed all the data.
1174  // Note that there may be a padding word before the provenance word.
1175  if (it.base() < pend-2) {
1176  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING,
1177  "CaloCellPacker_400_500 ")
1178  << "Corrupted data: didn't consume all packed data.";
1179  }
1180 }

◆ unpack_lar()

CaloCell * CaloCellPacker_400_500::unpack_lar ( CaloCompactCellContainer::compact_input_iterator it,
CaloCell_ID::SUBCALO  subcalo,
LArCell cell,
const pars500 pars,
uint16_t  provenance 
) const
inlineprivate

Unpack a LAr cell.

Parameters
itInput iterator.
subcaloSubcalorimeter code for the cell.
cellPointer to the cell in which to write.
parsUnpacking parameters.
provenanceThe provenance word for this cell.
Returns
cell, as a 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.

714 {
715  // Get the data word from the input.
717 
718  // Recognize cells filled with dummy values.
719  if (data == pars.m_lar_dummy)
720  {
721  cell->set (0, 0, 0, provenance, CaloGain::INVALIDGAIN);
722  return cell;
723  }
724 
725  // Unpack the gain flag.
726  int gainflag = pars.m_egain_field.out (data);
727  int qualflag = pars.m_qualy_field.out (data);
728 
730 
731  // Convert to the CaloCell gain, and convert the energy back to a float
732  // using the proper range.
733  double energy;
734  if ( gainflag == pars.m_ehhig ) {
735  if ( subcalo == CaloCell_ID::LARHEC )
737  else
739  energy = pars.m_crtae_high_field.out (data);
740  }
741  else {
742  if ( gainflag == pars.m_enhig ) {
744  }
745  else if ( gainflag == pars.m_enmed ) {
747  }
748  else if ( gainflag == pars.m_enlow) {
750  }
751  energy = pars.m_crtae_norm_field.out (data);
752  }
753 
754  // Now undo the cube root and apply the sign bit.
756  if (data & pars.m_esign_mask)
757  energy = -energy;
758 
759  // If the quality's good, then we need to unpack the time/chi2 too.
760  double time = 0;
761  uint16_t quality=0;
762  if ( qualflag != pars.m_qabad ) {
763  time = unpack_time (it, pars);
764  if (pars.m_version >= 500)
765  quality=it.next();
766  provenance = provenance | 0x2000;
767  }
768 
769  // Fill the data into the cell.
770  cell->set (energy, time, quality, provenance, gain);
771 
772  // Return it.
773  return cell;
774 }

◆ unpack_tile()

TileCell CaloCellPacker_400_500::unpack_tile ( CaloCompactCellContainer::compact_input_iterator it,
const CaloDetDescrElement dde,
const pars500 pars,
uint16_t  provenance 
) const
inlineprivate

Unpack a tile cell.

Parameters
itInput iterator.
ddeDescriptor element for the cell.
parsUnpacking parameters.
provenanceThe provenance word for this cell.
Returns
The new cell.
Parameters
itInput iterator.
ddeDescriptor element for the cell.
parsUnpacking parameters.
Returns
The new cell.

Definition at line 785 of file CaloCellPacker_400_500.cxx.

790 {
791  // Loop over the two elements for the cell.
792  double ene[2];
793  double time[2];
794  int gain[2];
795  int qbit[2];
796 
797  bool read_qual = false;
798 
799  for (int ipmt = 0; ipmt < 2; ++ipmt) {
800  // Unpack the data word.
802 
803  // Is this measurement a dummy?
804  if (data == pars.m_tile_dummy)
805  {
806  // Yeah --- fill in dummy values and skip the rest.
807  ene[ipmt] = 0;
808  gain[ipmt] = CaloGain::INVALIDGAIN;
809  qbit[ipmt] = 0;
810  if (ipmt == 1)
811  time[ipmt] = time[0];
812  else
813  time[ipmt] = 0;
814  continue;
815  }
816 
817  // Get the quality and gain.
818  int qualflag = pars.m_qualy_field.out (data);
819  int gainflag = pars.m_egain_tile_field.out (data);
820 
821  gain[ipmt] = gainflag;
822 
823  // Unpack the energy, using the range appropriate to the gain.
824  double e;
825  if (gainflag != pars.m_glow)
826  e = pars.m_crtae_tile_high_field.out (data);
827  else
828  e = pars.m_crtae_tile_low_field.out (data);
829  ene[ipmt] = e*e*e;
830  if (data & pars.m_esign_tile_mask)
831  ene[ipmt] = -ene[ipmt];
832 
833  // If the quality is good, we need to unpack the time too.
834  if (qualflag != pars.m_qabad) {
835  read_qual = true;
836  time[ipmt] = unpack_time (it, pars);
838  }
839  else {
840  time[ipmt] = 0;
841  qbit[ipmt] = TileCell::MASK_CMPC;
842  }
843  }
844 
845  uint8_t qual[2];
846  if (pars.m_version >= 502) {
847  qbit[0] |= pars.m_tile_qual1_field.out (provenance);
848  qbit[1] |= pars.m_tile_qual2_field.out (provenance);
849  if (read_qual) {
850  uint16_t qualp = it.next();
851  qual[0] = pars.m_tile_qual1_field.out (qualp);
852  qual[1] = pars.m_tile_qual2_field.out (qualp);
853  } else {
854  qual[0] = ((qbit[0] & TileCell::MASK_BADCH) != 0) ? 255 : 0;
855  qual[1] = ((qbit[1] & TileCell::MASK_BADCH) != 0) ? 255 : 0;
856  }
857  }
858  else {
859  qual[0] = qual[1] = 0;
860  }
861 
862  // Make the cell.
863  return TileCell (dde, ene[0], ene[1], time[0], time[1],
864  qual[0], qual[1], qbit[0], qbit[1], gain[0], gain[1]);
865 }

◆ unpack_time()

double CaloCellPacker_400_500::unpack_time ( CaloCompactCellContainer::compact_input_iterator it,
const pars500 pars 
) const
inlineprivate

Unpack the time word.

Parameters
itInput iterator.
parsUnpacking parameters.
Returns
The unpacked time.

Definition at line 671 of file CaloCellPacker_400_500.cxx.

674 {
675  // Get the word from the input container.
677 
678  // Unpack to a float.
679  int underflow;
680  double time = pars.m_logat_field.out (data, underflow);
681  if (ATH_UNLIKELY(underflow))
682  return 0;
683 
684  // Exponentiate, and restore the sign.
685  // (nb. introducing `ee' helps the gcc optimizer avoid a redundant
686  // test on the underflow flag.)
687  double ee = std::exp (time);
688  if (data & pars.m_tsign_mask)
689  return -ee;
690  return ee;
691 }

◆ write_header()

void CaloCellPacker_400_500::write_header ( const header header,
CaloCompactCellContainer packed 
) const
private

Write the header to the output container.

Parameters
headerThe header to write.
packedThe container to which to write.

Definition at line 647 of file CaloCellPacker_400_500.cxx.

649 {
650  const int * phead = &(header.m_length);
651  std::vector<CaloCompactCellContainer::value_type>
652  vhead (phead, phead + header.m_length);
653  packed.setHeader(vhead);
654 }

Friends And Related Function Documentation

◆ CaloCellPacker_400_500_test

friend class CaloCellPacker_400_500_test
friend

Definition at line 483 of file CaloCellPacker_400_500.h.


The documentation for this class was generated from the following files:
TileCell
Definition: TileCell.h:57
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
CaloCell_Base_ID::is_supercell
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
CaloCellPackerUtils::Floatfield
Helper for packing a float into/out of a bit field.
Definition: CaloCellPackerUtils.h:81
CaloCellPackerUtils::Floatfield2
Helper for packing a float into/out of a bit field, with a minimum of 0.
Definition: CaloCellPackerUtils.h:132
header
Definition: hcg.cxx:526
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloCellPacker_400_500::unpack_tile
TileCell unpack_tile(CaloCompactCellContainer::compact_input_iterator &it, const CaloDetDescrElement *dde, const pars500 &pars, uint16_t provenance) const
Unpack a tile cell.
Definition: CaloCellPacker_400_500.cxx:786
CaloCellPacker_400_500::init_header
void init_header(header &header, int version) const
Initialize header with the current version of the packing parameters.
Definition: CaloCellPacker_400_500.cxx:41
CaloCompactCellTool::VERSION_501
@ VERSION_501
Definition: CaloCompactCellTool.h:34
WriteCellNoiseToCool.icell
icell
Definition: WriteCellNoiseToCool.py:339
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
CaloCompactCellTool::VERSION_500
@ VERSION_500
Definition: CaloCompactCellTool.h:33
CaloCell_ID::size_type
CaloCell_Base_ID::size_type size_type
Definition: CaloCell_ID.h:38
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
CaloCompactCellContainer::value_type
int value_type
value type for the internal data
Definition: CaloCompactCellContainer.h:40
CaloGain::UNKNOWNGAIN
@ UNKNOWNGAIN
Definition: CaloGain.h:20
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloCellPacker_400_500::pack_lar
void pack_lar(const CaloCell *cell, CaloCell_ID::SUBCALO subcalo, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const
Pack one LAr cell.
Definition: CaloCellPacker_400_500.cxx:246
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
CaloCellPacker_400_500::clear_header
void clear_header(header &header) const
Clear the counters in the event header.
Definition: CaloCellPacker_400_500.cxx:104
skel.it
it
Definition: skel.GENtoEVGEN.py:423
SG::ThinningDecisionBase::thinned
bool thinned(size_t ndx) const
Return true if element ndx should be thinned.
CaloCellPacker_400_500::unpack_lar
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.
Definition: CaloCellPacker_400_500.cxx:709
CaloCellPacker_400_500::unpack_time
double unpack_time(CaloCompactCellContainer::compact_input_iterator &it, const pars500 &pars) const
Unpack the time word.
Definition: CaloCellPacker_400_500.cxx:672
CaloCompactCellTool::VERSION_400
@ VERSION_400
Definition: CaloCompactCellTool.h:32
CaloDetDescrManager_Base
Definition: CaloDetDescrManager.h:147
Tile_Base_ID::HIGHGAIN
@ HIGHGAIN
Definition: Tile_Base_ID.h:57
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
python.SystemOfUnits.TeV
int TeV
Definition: SystemOfUnits.py:158
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
CaloCellPackerUtils::Bitfield
Helper for packing into/out of a bit field.
Definition: CaloCellPackerUtils.h:37
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
TileCell::MASK_BADCH
@ MASK_BADCH
Definition: TileCell.h:63
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCellPackerUtils::Bitfield::in
unsigned int in(unsigned int x) const
Shift and mask a value into the bitfield.
CaloDetDescrElement::getSubCalo
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:433
CaloCompactCellTool::VERSION_503
@ VERSION_503
Definition: CaloCompactCellTool.h:36
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
CaloDetDescriptor::get_calo_helper
const CaloCell_Base_ID * get_calo_helper() const
get Calo Cell ID helper
Definition: CaloDetDescriptor.h:523
H5Utils::internal::packed
H5::CompType packed(H5::CompType in)
Definition: common.cxx:16
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloDetDescrManager_Base::getCaloCell_ID
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:94
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
CaloCellPacker_400_500::write_header
void write_header(const header &header, CaloCompactCellContainer &packed) const
Write the header to the output container.
Definition: CaloCellPacker_400_500.cxx:647
CaloCompactCellTool::VERSION_504
@ VERSION_504
Definition: CaloCompactCellTool.h:37
CaloCell_Base_ID::sub_calo
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
TileCell::MASK_CMPC
@ MASK_CMPC
Definition: TileCell.h:66
CaloCellPacker_400_500::pack_time
void pack_time(float time, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const
Pack a time value.
Definition: CaloCellPacker_400_500.cxx:213
CaloCompactCellTool::VERSION_502
@ VERSION_502
Definition: CaloCompactCellTool.h:35
Tile_Base_ID::LOWGAIN
@ LOWGAIN
Definition: Tile_Base_ID.h:57
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
CaloCellPacker_400_500::init_derived
void init_derived(pars500 &pars) const
Initialize the derived packing parameters from the constants in the header.
Definition: CaloCellPacker_400_500.cxx:124
DataPool::nextElementPtr
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
python.TriggerConfigAccess.maxsize
maxsize
Definition: TriggerConfigAccess.py:51
min
#define min(a, b)
Definition: cfImp.cxx:40
CaloCompactCellContainer::compact_input_iterator::next
CaloCompactCell::value_type next()
Return the current value and advance to the next one.
Definition: CaloCompactCellContainer.h:298
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
CaloCellPacker_400_500::header
header501 header
The most recent header version.
Definition: CaloCellPacker_400_500.h:284
CaloCompactCell::value_type
unsigned short value_type
value type for the compact CaloCell data
Definition: CaloCompactCell.h:34
CaloCellPacker_400_500::finish_seq
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.
Definition: CaloCellPacker_400_500.cxx:425
TileCell::KEEP_TIME
@ KEEP_TIME
Definition: TileCell.h:83
CaloCompactCellContainer::compact_input_iterator
Simple iterator-like object for reading from the container.
Definition: CaloCompactCellContainer.h:156
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
CaloCellPacker_400_500::header501::STATUS_UNORDERED
@ STATUS_UNORDERED
Definition: CaloCellPacker_400_500.h:276
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
CaloCellPackerUtils::Bitfield::out
unsigned int out(unsigned int x) const
Extract a value from the bitfield.
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager >
get_generator_info.version
version
Definition: get_generator_info.py:33
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition: CaloGain.h:18
TileCell::MASK_TIME
@ MASK_TIME
Definition: TileCell.h:67
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
CaloCellPacker_400_500::header501::STATUS_IS_SUPERCELL
@ STATUS_IS_SUPERCELL
Definition: CaloCellPacker_400_500.h:278
y
#define y
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
lumiFormat.fill
fill
Definition: lumiFormat.py:111
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloDetDescrElement::descriptor
const CaloDetDescriptor * descriptor() const
cell descriptor
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:428
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
beamspotman.qual
qual
Definition: beamspotman.py:481
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
IdentifierHash
Definition: IdentifierHash.h:38
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::NOT_VALID
@ NOT_VALID
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
CaloCellPacker_400_500::pack_tile
void pack_tile(const TileCell *cell, CaloCompactCellContainer::compact_output_iterator &it, const pars500 &pars) const
Pack one tile cell.
Definition: CaloCellPacker_400_500.cxx:341
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size
CaloCompactCellContainer::compact_output_iterator
Simple iterator-like object for writing to the container.
Definition: CaloCompactCellContainer.h:211