ATLAS Offline Software
MuonFixedIdPrinter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <sstream>
8 
9 namespace MuonCalib {
10 
13  return stationLayerIdentifier(stIndex);
14  }
15 
17  std::string stName = "UnKnown";
18  if (stIndex == MuonFixedIdManipulator::BI)
19  stName = "BI";
20  else if (stIndex == MuonFixedIdManipulator::BM)
21  stName = "BM";
22  else if (stIndex == MuonFixedIdManipulator::BO)
23  stName = "BO";
24  else if (stIndex == MuonFixedIdManipulator::BE)
25  stName = "BE";
26  else if (stIndex == MuonFixedIdManipulator::EIA)
27  stName = "EIA";
28  else if (stIndex == MuonFixedIdManipulator::EMA)
29  stName = "EMA";
30  else if (stIndex == MuonFixedIdManipulator::EOA)
31  stName = "EOA";
32  else if (stIndex == MuonFixedIdManipulator::EEA)
33  stName = "EEA";
34  else if (stIndex == MuonFixedIdManipulator::EIC)
35  stName = "EIC";
36  else if (stIndex == MuonFixedIdManipulator::EMC)
37  stName = "EMC";
38  else if (stIndex == MuonFixedIdManipulator::EOC)
39  stName = "EOC";
40  else if (stIndex == MuonFixedIdManipulator::EEC)
41  stName = "EEC";
42  return stName;
43  }
44 
45  std::string MuonFixedIdPrinter::stationIdentifier(const MuonFixedId& id) const {
46  std::ostringstream sout;
47  if (!id.isValid()) return " Invalid Identifier";
48  sout << id.technologyString() << " " << id.stationNameString() << " eta " << std::setw(2) << id.eta() << " phi " << std::setw(2)
49  << id.phi();
50  return sout.str();
51  }
52 
53  std::string MuonFixedIdPrinter::chamberIdentifier(const MuonFixedId& id) const {
54  std::ostringstream sout;
55  if (!id.isValid()) return " Invalid Identifier";
56  sout << stationIdentifier(id);
57  if (id.is_rpc()) sout << " doubR " << id.rpcDoubletR();
58 
59  return sout.str();
60  }
61 
62  std::string MuonFixedIdPrinter::moduleIdentifier(const MuonFixedId& id) const {
63  std::ostringstream sout;
64  if (!id.isValid()) return " Invalid Identifier";
65  sout << chamberIdentifier(id);
66  if (id.is_rpc())
67  sout << " doubZ " << id.rpcDoubletZ() << " doubPhi " << id.rpcDoubletPhi();
68  else if (id.is_mdt())
69  sout << " ml " << id.mdtMultilayer();
70  return sout.str();
71  }
72 
73  std::string MuonFixedIdPrinter::gasGapIdentifier(const MuonFixedId& id, bool includeMeasuresPhi) const {
74  if (!id.isValid()) return " Invalid Identifier";
75 
76  std::ostringstream sout;
77  sout << moduleIdentifier(id);
78  bool measuresPhi = false;
79  if (id.is_rpc()) {
80  sout << " gap " << id.rpcGasGap();
81  measuresPhi = id.rpcMeasuresPhi();
82  } else if (id.is_tgc()) {
83  sout << " gap " << id.tgcGasGap();
84  measuresPhi = id.tgcIsStrip();
85  } else if (id.is_csc()) {
86  sout << " lay " << id.cscWireLayer();
87  measuresPhi = id.cscMeasuresPhi();
88  } else {
89  sout << " lay " << id.mdtTubeLayer() << " tube " << std::setw(2) << id.mdtTube();
90  }
91 
92  if (measuresPhi && includeMeasuresPhi) sout << " measuresPhi";
93 
94  return sout.str();
95  }
96 
97  std::string MuonFixedIdPrinter::gasGapIdentifierForMap(const MuonFixedId& id, bool includeMeasuresPhi) const {
98  std::string st = id.stationNumberToFixedStationString(id.stationName());
99  std::ostringstream secondPart;
100  bool measuresPhi = false;
101  bool addSecondPart = false;
102  std::ostringstream station;
103  station << st << "_" << id.phi() << "_" << id.eta();
104  if (id.is_rpc()) {
105  int doublet = 2 * (id.rpcDoubletZ() - 1) + (id.rpcDoubletPhi() - 1);
106 
107  if (id.rpcMeasuresPhi()) measuresPhi = true;
108  addSecondPart = true;
109  secondPart << "_d_" << doublet;
110 
111  } else if (id.is_tgc()) {
112  if (id.tgcIsStrip()) measuresPhi = true;
113  addSecondPart = true;
114  secondPart << "_gg_" << id.tgcGasGap();
115 
116  } else if (id.is_csc()) {
117  if (id.cscMeasuresPhi()) measuresPhi = true;
118  addSecondPart = true;
119  secondPart << "_wl_" << id.cscWireLayer();
120  }
121  std::string rst = station.str();
122  if (addSecondPart) { rst += secondPart.str(); }
123  if (includeMeasuresPhi) {
124  if (measuresPhi)
125  rst += "_phi";
126  else
127  rst += "_eta";
128  }
129  return rst;
130  }
131 
132  std::string MuonFixedIdPrinter::fullIdentifier(const MuonFixedId& id) const {
133  std::ostringstream sout;
134  if (!id.isValid()) return " Invalid Identifier";
135  sout << gasGapIdentifier(id, false);
136  bool measuresPhi = m_manipulator.measuresPhi(id);
137  if (id.is_rpc())
138  sout << " strip " << std::setw(2) << id.rpcStrip();
139  else if (id.is_tgc())
140  sout << " strip " << std::setw(2) << id.tgcChannel();
141  else if (id.is_csc())
142  sout << " strip " << std::setw(2) << id.cscStrip();
143 
144  if (measuresPhi) sout << " measuresPhi";
145 
146  return sout.str();
147  }
148 
149 } // namespace MuonCalib
MuonCalib::MuonFixedIdManipulator::EMA
@ EMA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdPrinter::stationIdentifier
std::string stationIdentifier(const MuonFixedId &id) const
prints station Identifier for the give id MDT: station name (BMS)/eta/phi RPC: name of associated MDT...
Definition: MuonFixedIdPrinter.cxx:45
MuonCalib::MuonFixedIdManipulator::StationIndex
StationIndex
enum defining station layers
Definition: MuonFixedIdManipulator.h:17
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
MuonCalib::MuonFixedIdManipulator::BM
@ BM
Definition: MuonFixedIdManipulator.h:17
MuonFixedIdPrinter.h
MuonCalib::MuonFixedIdPrinter::fullIdentifier
std::string fullIdentifier(const MuonFixedId &id) const
prints full Identifier for the give id
Definition: MuonFixedIdPrinter.cxx:132
MuonCalib::MuonFixedIdManipulator::BO
@ BO
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdManipulator::EOC
@ EOC
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdPrinter::gasGapIdentifier
std::string gasGapIdentifier(const MuonFixedId &id, bool includeMeasuresPhi=false) const
prints gas gap Identifier for the give id MDT: same as tube identifier RPC: station name/eta/phi/doub...
Definition: MuonFixedIdPrinter.cxx:73
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:225
MuonCalib::MuonFixedIdManipulator::EMC
@ EMC
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdManipulator::EEC
@ EEC
Definition: MuonFixedIdManipulator.h:17
createDCubeDigitHistograms.rpcMeasuresPhi
rpcMeasuresPhi
Definition: createDCubeDigitHistograms.py:67
MuonCalib::MuonFixedIdManipulator::BI
@ BI
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdManipulator::measuresPhi
bool measuresPhi(const MuonFixedId &id) const
returns whether this is a phi measurement
Definition: MuonFixedIdManipulator.h:67
MuonCalib::MuonFixedIdManipulator::EIA
@ EIA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdPrinter::moduleIdentifier
std::string moduleIdentifier(const MuonFixedId &id) const
prints layer Identifier for the give id MDT: station name/eta/phi/ml/lay RPC: station name/eta/phi/do...
Definition: MuonFixedIdPrinter.cxx:62
MuonCalib::MuonFixedIdPrinter::m_manipulator
MuonFixedIdManipulator m_manipulator
Definition: MuonFixedIdPrinter.h:54
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::MuonFixedIdManipulator::EEA
@ EEA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdPrinter::stationLayerIdentifier
std::string stationLayerIdentifier(const MuonFixedId &id) const
prints a station layer identifier for the give identifier
Definition: MuonFixedIdPrinter.cxx:11
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
MuonCalib::MuonFixedIdManipulator::stationLayerIndex
StationIndex stationLayerIndex(const MuonFixedId &id) const
returns station layer index for a give identifier
Definition: MuonFixedIdManipulator.cxx:87
MuonCalib::MuonFixedIdManipulator::EIC
@ EIC
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdManipulator::EOA
@ EOA
Definition: MuonFixedIdManipulator.h:17
MuonCalib::MuonFixedIdPrinter::gasGapIdentifierForMap
std::string gasGapIdentifierForMap(const MuonFixedId &id, bool includeMeasuresPhi=false) const
print gapGap Id to be used in map
Definition: MuonFixedIdPrinter.cxx:97
MuonCalib::MuonFixedIdPrinter::chamberIdentifier
std::string chamberIdentifier(const MuonFixedId &id) const
prints chamber Identifier for the give id.
Definition: MuonFixedIdPrinter.cxx:53
MuonCalib::MuonFixedIdManipulator::BE
@ BE
Definition: MuonFixedIdManipulator.h:17