ATLAS Offline Software
ToString.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ToString.h"
6 #include <sstream>
7 
8 
9 namespace {
10 
11  template<typename T>
12  std::string ToString(const std::vector<T>& vv){
13  std::stringstream o;
14  std::string delim = "";
15  for(auto val: vv){
16  o << delim << int(val) << /*"(0x" << std::hex << int(val) << ")" << */ std::dec;
17  delim ="|";
18  }
19  return o.str();
20  }
21 }
22 
24  std::stringstream o;
25  if(tt.coolId() == 0) {
26  o << "xAOD::TriggerTower, coolId=0";
27  } else {
28  o << "xAOD::TriggerTower, coolId=" << std::hex << tt.coolId() << std::dec
29  << ", layer=" << int(tt.layer())
30  << ", sampling=" << int(tt.sampling())
31  << ", eta=" << tt.eta()
32  << ", phi=" << tt.phi()
33  << ", lut_cp=" << ::ToString(tt.lut_cp())
34  << ", lut_jep=" << ::ToString(tt.lut_jep())
35  << ", correction=" << ::ToString(tt.correction())
36  << ", correctionEnabled=" << ::ToString(tt.correctionEnabled())
37  << ", bcidVec=" << ::ToString(tt.bcidVec())
38  << ", adc=" << ::ToString(tt.adc())
39  << ", bcidExt=" << ::ToString(tt.bcidExt())
40  << ", errorWord=" << tt.errorWord()
41  << ", peak=" << int(tt.peak())
42  << ", adcPeak=" << int(tt.adcPeak());
43  if (!tt.lut_cp().empty()) {
44  o << ", cpET=" << int(tt.cpET());
45  }
46  if (!tt.lut_jep().empty()) {
47  o << ", jepET=" << int(tt.jepET());
48  }
49 
50  }
51 
52  return o.str();
53 }
54 
56  std::stringstream o;
58  iter != tt.end(); ++iter){
59  o << ToString(**iter) << std::endl;
60  }
61  return o.str();
62 }
63 
64 std::string LVL1BS::ToString(const xAOD::CPMTower& cpm){
65  std::stringstream o;
66 
67  o << "xAOD::CPMTower"
68  << ", eta=" << cpm.eta()
69  << ", phi=" << cpm.phi()
70  << ", em peak energy=" << cpm.emEnergy()
71  << ", had peak energy=" << cpm.hadEnergy()
72  ;
73 
74  return o.str();
75 }
76 
77 std::string LVL1BS::ToString(const xAOD::CPMTowerContainer& tt){
78  std::stringstream o;
79  for(auto iter = tt.begin();
80  iter != tt.end(); ++iter){
81  o << ToString(**iter) << std::endl;
82  }
83  return o.str();
84 }
85 
ToString.h
LVL1BS::ToString
std::string ToString(const xAOD::TriggerTower &tt)
Definition: ToString.cxx:23
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
xAOD::CPMTower_v2::phi
float phi() const
get phi (note that for L1Calo phi runs from 0 to 2pi)
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::CPMTower_v2::eta
float eta() const
get eta
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
PlotCalibFromCool.vv
vv
Definition: PlotCalibFromCool.py:716
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
xAOD::CPMTower_v2::hadEnergy
uint8_t hadEnergy() const
get hadEnergy for hadEnergyVec[peak] - time slice that (hopefully) contains the collision
Definition: CPMTower_v2.cxx:61
xAOD::CPMTower_v2::emEnergy
uint8_t emEnergy() const
get emEnergy for emEnergyVec[peak] - time slice that (hopefully) contains the collision
Definition: CPMTower_v2.cxx:56
xAOD::CPMTower_v2
Description of CPMTower_v2.
Definition: CPMTower_v2.h:26