ATLAS Offline Software
CaloCellPacker_400_500.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: CaloCellPacker_400_500.cxx,v 1.5 2009-03-31 19:04:04 ssnyder Exp $
14 #include "CaloCellPacker_400_500.h"
15 #include "CaloCompactCellTool.h"
18 #include "CaloEvent/CaloCell.h"
19 #include "TileEvent/TileCell.h"
24 #include "GaudiKernel/SystemOfUnits.h"
25 
29 
30 //============================================================================
31 // Common methods.
32 //
33 
34 
42  int version) const
43 {
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
88 
94  header.m_t1 = 1250.0*Gaudi::Units::ns;
95 
97 }
98 
99 
105 {
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;
115  header.m_status = 0;
116 }
117 
118 
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 }
197 
198 
199 //============================================================================
200 // Packing.
201 // To ensure full inlining, don't reorder these.
202 //
203 
204 
211 inline
213  (float time,
215  const pars500& pars) const
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 }
235 
236 
244 inline
246  (const CaloCell* cell,
247  CaloCell_ID::SUBCALO subcalo,
249  const pars500& pars) const
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 }
331 
332 
339 inline
341  (const TileCell* cell,
343  const pars500& pars) const
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 }
413 
414 
423 inline
425  (unsigned int hash,
426  unsigned int nseq,
428  CaloCell_ID::SUBCALO subcalo,
429  pars500& pars) const
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 }
461 
462 
472  const SG::ThinningDecisionBase* dec,
473  int version) const
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 }
639 
640 
646 void
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 }
655 
656 
657 
658 //============================================================================
659 // Unpacking.
660 // To ensure full inlining, don't reorder these.
661 //
662 
663 
670 inline
673  const pars500& pars) const
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 }
692 
693 
706 inline
707 CaloCell*
710  CaloCell_ID::SUBCALO subcalo,
711  LArCell* cell,
712  const pars500& pars,
713  uint16_t provenance) const
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 }
775 
776 
784 inline
787  const CaloDetDescrElement* dde,
788  const pars500& pars,
789  uint16_t provenance) const
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 }
866 
867 
882  const std::vector<int>& vheader,
884  DataPool<LArCell>& larpool,
885  DataPool<TileCell>& tilepool) const
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 }
1181 
1182 
1183 //============================================================================
CaloCellPacker_400_500::header500::m_lengthProvenance
unsigned int m_lengthProvenance
Definition: CaloCellPacker_400_500.h:256
TileCell
Definition: TileCell.h:57
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
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
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
CaloCellPackerUtils::Floatfield2
Helper for packing a float into/out of a bit field, with a minimum of 0.
Definition: CaloCellPackerUtils.h:132
CaloCellPacker_400_500::header400::m_enmed
int m_enmed
Definition: CaloCellPacker_400_500.h:222
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
CaloCompactCellContainer.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
CaloCompactCellTool::VERSION_500
@ VERSION_500
Definition: CaloCompactCellTool.h:33
CaloCellPacker_400_500::header400::m_esign_mask
unsigned int m_esign_mask
Definition: CaloCellPacker_400_500.h:211
CaloCell_ID::size_type
CaloCell_Base_ID::size_type size_type
Definition: CaloCell_ID.h:38
CaloCellPacker_400_500::header400::m_e1_high_res
float m_e1_high_res
Definition: CaloCellPacker_400_500.h:238
CaloCompactCellContainer::compact_output_iterator::used
int used() const
Return the number of underlying value_type words used.
Definition: CaloCompactCellContainer.h:394
CaloCellPacker_400_500::header400::m_ncells_larem
int m_ncells_larem
Counters of number of cells in each subcalo.
Definition: CaloCellPacker_400_500.h:202
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
CaloCellPacker_400_500.h
Calo cell packer/unpacker v400/500.
CaloCompactCellContainer::value_type
int value_type
value type for the internal data
Definition: CaloCompactCellContainer.h:40
SG::ThinningDecisionBase
Hold thinning decisions for one container.
Definition: ThinningDecisionBase.h:39
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::header400::m_length
int m_length
Definition: CaloCellPacker_400_500.h:197
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
CaloCellPacker_400_500::header400::m_e1_norm_res
float m_e1_norm_res
Packing ranges for floats.
Definition: CaloCellPacker_400_500.h:237
CaloCellPacker_400_500::header400::m_glow
int m_glow
Definition: CaloCellPacker_400_500.h:225
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:396
CaloCellPacker_400_500::header400::m_t1
float m_t1
Definition: CaloCellPacker_400_500.h:242
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
CaloCell.h
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
CaloCellPacker_400_500::header400::m_seq_larem
int m_seq_larem
Counts of number of sequences in each subcalo.
Definition: CaloCellPacker_400_500.h:231
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
CaloCellPacker_400_500::header400::m_egain_mask
unsigned int m_egain_mask
Definition: CaloCellPacker_400_500.h:210
CaloCellPacker_400_500::header400::m_seq_larfcal
int m_seq_larfcal
Definition: CaloCellPacker_400_500.h:233
ThinningDecisionBase.h
Hold thinning decisions for one container.
CaloCellPacker_400_500::header400::m_qabad
int m_qabad
Various enumeration constants.
Definition: CaloCellPacker_400_500.h:220
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
ReadCondHandle.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCellPacker_400_500::header400::m_seq_tile
int m_seq_tile
Definition: CaloCellPacker_400_500.h:234
CaloCellPacker_400_500::header400::m_t0
float m_t0
Definition: CaloCellPacker_400_500.h:241
CaloCellPacker_400_500::header400::m_high_tile
float m_high_tile
Definition: CaloCellPacker_400_500.h:239
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
AthUnlikelyMacros.h
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
CaloCompactCellContainer
container class for CaloCompactCell objects
Definition: CaloCompactCellContainer.h:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloCellPacker_400_500::header501
Packing parameters header (v501).
Definition: CaloCellPacker_400_500.h:269
CaloDetDescrManager_Base::getCaloCell_ID
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:94
CaloCellPacker_400_500::unpack
void unpack(const CaloCompactCellContainer &packed, const std::vector< CaloCompactCellContainer::value_type > &vheader, CaloCellContainer &cells, DataPool< LArCell > &larpool, DataPool< TileCell > &tilepool) const
Unpack cells.
Definition: CaloCellPacker_400_500.cxx:881
CaloCellPacker_400_500::pack
void pack(const CaloCellContainer &cells, CaloCompactCellContainer &packed, const SG::ThinningDecisionBase *dec, int version) const
Pack cells.
Definition: CaloCellPacker_400_500.cxx:470
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
CaloCellPacker_400_500::header400::m_crtae_mask
unsigned int m_crtae_mask
Definition: CaloCellPacker_400_500.h:212
TileCell.h
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...
CaloCellPacker_400_500::header400::m_low_tile
float m_low_tile
Definition: CaloCellPacker_400_500.h:240
python.TriggerConfigAccess.maxsize
maxsize
Definition: TriggerConfigAccess.py:51
min
#define min(a, b)
Definition: cfImp.cxx:40
ReadCondHandleKey.h
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
CaloCompactCellContainer::compact_input_iterator::next
CaloCompactCell::value_type next()
Return the current value and advance to the next one.
Definition: CaloCompactCellContainer.h:298
CaloCellPacker_400_500::header400::m_ncells_tile
int m_ncells_tile
Definition: CaloCellPacker_400_500.h:205
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
CaloCellPacker_400_500::header400::m_esign_tile_mask
unsigned int m_esign_tile_mask
Definition: CaloCellPacker_400_500.h:214
CaloCellPacker_400_500::header400::m_version
int m_version
Definition: CaloCellPacker_400_500.h:199
CaloCellPacker_400_500::header400::m_ghigh
int m_ghigh
Definition: CaloCellPacker_400_500.h:226
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
CaloCellPacker_400_500::header400::m_tsign_mask
unsigned int m_tsign_mask
Definition: CaloCellPacker_400_500.h:216
TileCell::KEEP_TIME
@ KEEP_TIME
Definition: TileCell.h:83
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CaloCellPacker_400_500::header400
Packing parameters header (v400).
Definition: CaloCellPacker_400_500.h:196
CaloCompactCellContainer::compact_input_iterator
Simple iterator-like object for reading from the container.
Definition: CaloCompactCellContainer.h:156
CaloCellPacker_400_500::header400::m_seq_larhec
int m_seq_larhec
Definition: CaloCellPacker_400_500.h:232
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
CaloCellPacker_400_500::header500
Packing parameters header (v500).
Definition: CaloCellPacker_400_500.h:253
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
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
CaloCompactCellContainer::compact_output_iterator::set
void set(CaloCompactCell::value_type x)
Set the next value, and advance the iterator.
Definition: CaloCompactCellContainer.h:364
CaloCellPacker_400_500::header400::m_enlow
int m_enlow
Definition: CaloCellPacker_400_500.h:221
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
CaloCellPacker_400_500::header400::m_enhig
int m_enhig
Definition: CaloCellPacker_400_500.h:223
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
CaloCellPacker_400_500::header501::STATUS_IS_SUPERCELL
@ STATUS_IS_SUPERCELL
Definition: CaloCellPacker_400_500.h:278
y
#define y
CaloCellPacker_400_500::header400::m_egain_tile_mask
unsigned int m_egain_tile_mask
Definition: CaloCellPacker_400_500.h:213
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCellPacker_400_500::header501::m_status
unsigned int m_status
Definition: CaloCellPacker_400_500.h:272
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
CaloCellPacker_400_500::header400::m_crtae_tile_mask
unsigned int m_crtae_tile_mask
Definition: CaloCellPacker_400_500.h:215
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
CaloCellPacker_400_500::header400::m_qualy_mask
unsigned int m_qualy_mask
Masks defining the bit positions used for various quantities.
Definition: CaloCellPacker_400_500.h:209
CaloDetDescrElement::descriptor
const CaloDetDescriptor * descriptor() const
cell descriptor
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:428
CaloCellPacker_400_500::header400::m_ehhig
int m_ehhig
Definition: CaloCellPacker_400_500.h:224
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
beamspotman.qual
qual
Definition: beamspotman.py:481
CaloCellPacker_400_500::pars500
Derived packing parmeters.
Definition: CaloCellPacker_400_500.h:298
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloCellPacker_400_500::header400::m_ncells_larfcal
int m_ncells_larfcal
Definition: CaloCellPacker_400_500.h:204
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
CaloCell_Base_ID::NOT_VALID
@ NOT_VALID
Definition: CaloCell_Base_ID.h:46
CaloCompactCellTool.h
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:41
CaloCellPacker_400_500::header400::m_logat_mask
unsigned int m_logat_mask
Definition: CaloCellPacker_400_500.h:217
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
CaloCellPacker_400_500::header400::m_ncells_larhec
int m_ncells_larhec
Definition: CaloCellPacker_400_500.h:203
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