ATLAS Offline Software
HistogramId.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <algorithm>
8 
10 #include "GaudiKernel/MsgStream.h"
12 #include "iomanip"
13 #include "iostream"
14 #include "sstream"
15 
16 namespace MuonCalib {
17 
18  void HistogramId::Initialize(const MuonFixedId &id, int sort_by) {
19  m_id.first = sort_by;
20  static const unsigned int kStationNameShift = 24;
21 
22  static const unsigned int kStationEtaShift = 19;
23 
24  static const unsigned int kStationPhiShift = 13;
25 
26  // Mdt specific code
27 
28  static const unsigned int kMdtMultilayerShift = 9;
29 
30  static const unsigned int kMdtTubeLayerShift = 7;
31 
32  // static const unsigned int kMdtTubeShift = 0;
33  switch (sort_by) {
34  case TUBE: {
35  m_id.second = id.getIdInt();
36  break;
37  }
38  case LAYER: {
39  m_id.second = (id.stationNameIndex() << kStationNameShift) | (id.etaIndex() << kStationEtaShift) |
40  (id.phiIndex() << kStationPhiShift) | (id.mdtMultilayerIndex() << kMdtMultilayerShift) |
41  (id.mdtTubeLayerIndex() << kMdtTubeLayerShift);
42  break;
43  }
44  case MULTILAYER: {
45  m_id.second = (id.stationNameIndex() << kStationNameShift) | (id.etaIndex() << kStationEtaShift) |
46  (id.phiIndex() << kStationPhiShift) | (id.mdtMultilayerIndex() << kMdtMultilayerShift);
47  break;
48  }
49  case CHAMBER: {
50  m_id.second = (id.stationNameIndex() << kStationNameShift) | (id.etaIndex() << kStationEtaShift) |
51  (id.phiIndex() << kStationPhiShift);
52  break;
53  }
54  case MEZZ_CARD: {
55  // first part is like multilayer
56  m_id.second = id.mdtMezzanine();
57  break;
58  }
59  default: {
60  MsgStream log(Athena::getMessageSvc(), "HistogramId");
61  log << MSG::WARNING << "HistogramId :: Initialize: sort_by arguemnt is invalid!" << endmsg;
62  }
63  }
64  // create histogram name
65  std::ostringstream os;
66  if (m_id.second == -999999) {
67  os << "Summary";
68  } else {
69  // chamber name
70  os << id.stationNumberToFixedStationString(id.stationName()) << "_eta";
71  if (id.eta() < 0)
72  os << "C";
73  else
74  os << "A";
75  os << std::abs(id.eta()) << "_phi" << id.phi();
76  // multilayer name
77  if (sort_by != CHAMBER) os << "_ml" << id.mdtMultilayer();
78  // layer name
79  if (sort_by != CHAMBER && sort_by != MULTILAYER && sort_by != MEZZ_CARD) os << "_ly" << id.mdtTubeLayer();
80  // tube name
81  if (sort_by == TUBE) os << "_tb" << id.mdtTube();
82  // mezz-id
83  if (sort_by == MEZZ_CARD) { os << "_mez" << (id.mdtMezzanine() % 100); }
84  // numeric_id
85  os << "_num" << m_id.second << "_" << sort_by;
86  }
87  // store
88  m_histogram_name = os.str();
89  MsgStream log(Athena::getMessageSvc(), "HistogramId");
90  log << MSG::INFO << sort_by << " " << m_histogram_name << endmsg;
91  }
92 
93 } // namespace MuonCalib
MuonCalib::HistogramId::m_id
std::pair< int, int > m_id
integer identity - value depends on the sort_by argument of the Initialize-Function
Definition: HistogramId.h:53
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::HistogramId::MEZZ_CARD
static const int MEZZ_CARD
Definition: HistogramId.h:45
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MuonCalib::HistogramId::TUBE
static const int TUBE
valid values of the sort_by argument of the Initialize function
Definition: HistogramId.h:45
MuonCalib::HistogramId::Initialize
void Initialize(const MuonFixedId &id, int sort_by)
initialize
Definition: HistogramId.cxx:18
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
MuonCalib::HistogramId::LAYER
static const int LAYER
Definition: HistogramId.h:45
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::HistogramId::MULTILAYER
static const int MULTILAYER
Definition: HistogramId.h:45
HistogramId.h
MuonCalib::HistogramId::CHAMBER
static const int CHAMBER
Definition: HistogramId.h:45
MuonFixedId.h
MuonCalib::HistogramId::m_histogram_name
std::string m_histogram_name
ascii histogram name
Definition: HistogramId.h:55