ATLAS Offline Software
PileUpTimeEventIndex.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #include "GaudiKernel/GaudiException.h"
6 #include "GaudiKernel/MsgStream.h"
8 #include <cassert>
9 
10 #include <iostream>
11 
12 const std::string&
14  static const std::string typNam[PileUpTimeEventIndex::NTYPES + 1] =
15  {
16  "Unknown" /*-1*/, "Signal" /*0*/, "MinimumBias" /*1*/, "Cavern" /*2*/,
17  "HaloGas" /*3*/, "HighPtMinimumBias" /*4*/, "ZeroBias"/*5*/
18  };
19 
20  assert(typ < PileUpTimeEventIndex::NTYPES);
21  return typNam[typ + 1];
22 }
23 
25 PileUpTimeEventIndex::ushortToType(unsigned short uType) {
27  switch (uType) {
28  case 0: puType = PileUpTimeEventIndex::Signal;
29  break;
30 
31  case 1: puType = PileUpTimeEventIndex::MinimumBias;
32  break;
33 
34  case 2: puType = PileUpTimeEventIndex::Cavern;
35  break;
36 
37  case 3: puType = PileUpTimeEventIndex::HaloGas;
38  break;
39 
41  break;
42 
43  case 5: puType = PileUpTimeEventIndex::ZeroBias;
44  break;
45 
46  default:
47  std::ostringstream merr;
48  merr <<
49  "PileUpTimeEventIndex::ushortToType FATAL: invalid PileUpType specified "
50  << uType;
51  std::cerr << merr.str() << std::endl;
52  throw GaudiException(merr.str(), "PileUpTimeEventIndex::ushortToType", StatusCode::FAILURE);
53  }
54  return puType;
55 }
56 
58 
60  m_time((short) time), m_index(0), m_type(PileUpTimeEventIndex::Unknown) {}
61 
63  m_time((short) time), m_index((short) index), m_type(PileUpTimeEventIndex::Unknown) {}
64 
67  m_time((short) time), m_index((short) index), m_type(typ) {}
68 
69 
72  return m_time;
73 }
74 
77  return (index_type) m_index;
78 }
79 
82  return m_type;
83 }
84 
85 std::ostream&
86 operator << (std::ostream& os,
87  const PileUpTimeEventIndex& idx) {
88  return os << "event xing time (ns): " << idx.time()
89  << " - PileUpEventInfo subevt index: " << idx.index()
90  << " - PileupEventInfo subevt type: " << PileUpTimeEventIndex::typeName(idx.type());
91 }
92 
93 MsgStream&
94 operator << (MsgStream& os,
95  const PileUpTimeEventIndex& idx) {
96  return os << "event xing time (ns): " << idx.time()
97  << " - PileUpEventInfo subevt index: " << idx.index()
98  << " - PileupEventInfo subevt type: " << PileUpTimeEventIndex::typeName(idx.type());
99 }
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
xAOD::short
short
Definition: Vertex_v1.cxx:165
PileUpTimeEventIndex::Cavern
@ Cavern
Definition: PileUpTimeEventIndex.h:18
PileUpTimeEventIndex::index_type
unsigned long index_type
Definition: PileUpTimeEventIndex.h:25
index
Definition: index.py:1
PileUpTimeEventIndex::PileUpType
PileUpType
Definition: PileUpTimeEventIndex.h:14
PileUpTimeEventIndex::m_index
short m_index
Definition: PileUpTimeEventIndex.h:43
PileUpTimeEventIndex::index
index_type index() const
the index of the component event in PileUpEventInfo
Definition: PileUpTimeEventIndex.cxx:76
PileUpTimeEventIndex::m_time
short m_time
Definition: PileUpTimeEventIndex.h:42
PileUpTimeEventIndex.h
PileUpTimeEventIndex::MinimumBias
@ MinimumBias
Definition: PileUpTimeEventIndex.h:17
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
PileUpTimeEventIndex::HaloGas
@ HaloGas
Definition: PileUpTimeEventIndex.h:19
PileUpTimeEventIndex::ZeroBias
@ ZeroBias
Definition: PileUpTimeEventIndex.h:21
PileUpTimeEventIndex::time_type
long time_type
Definition: PileUpTimeEventIndex.h:24
PileUpTimeEventIndex::Signal
@ Signal
Definition: PileUpTimeEventIndex.h:16
operator<<
std::ostream & operator<<(std::ostream &os, const PileUpTimeEventIndex &idx)
Definition: PileUpTimeEventIndex.cxx:86
PileUpTimeEventIndex::PileUpTimeEventIndex
PileUpTimeEventIndex()
Definition: PileUpTimeEventIndex.cxx:57
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
PileUpTimeEventIndex::time
time_type time() const
bunch xing time in ns
Definition: PileUpTimeEventIndex.cxx:71
PileUpTimeEventIndex::typeName
static const std::string & typeName(PileUpType typ)
Definition: PileUpTimeEventIndex.cxx:13
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
PileUpTimeEventIndex::ushortToType
static PileUpType ushortToType(unsigned short)
Definition: PileUpTimeEventIndex.cxx:25
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
PileUpTimeEventIndex::m_type
PileUpType m_type
Definition: PileUpTimeEventIndex.h:44
PileUpTimeEventIndex::HighPtMinimumBias
@ HighPtMinimumBias
Definition: PileUpTimeEventIndex.h:20
PileUpTimeEventIndex
a struct encapsulating the identifier of a pile-up event
Definition: PileUpTimeEventIndex.h:12
PileUpTimeEventIndex::type
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
Definition: PileUpTimeEventIndex.cxx:81
PileUpTimeEventIndex::NTYPES
@ NTYPES
Definition: PileUpTimeEventIndex.h:22
PileUpTimeEventIndex::Unknown
@ Unknown
Definition: PileUpTimeEventIndex.h:15
index_type
unsigned int index_type
Definition: FPGATrackSimSGToRawHitsTool.h:37