ATLAS Offline Software
Loading...
Searching...
No Matches
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
16namespace 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
Scalar eta() const
pseudorapidity method
#define endmsg
std::string m_histogram_name
ascii histogram name
Definition HistogramId.h:55
std::pair< int, int > m_id
integer identity - value depends on the sort_by argument of the Initialize-Function
Definition HistogramId.h:53
static const int LAYER
Definition HistogramId.h:45
static const int TUBE
valid values of the sort_by argument of the Initialize function
Definition HistogramId.h:45
static const int MEZZ_CARD
Definition HistogramId.h:45
void Initialize(const MuonFixedId &id, int sort_by)
initialize
static const int MULTILAYER
Definition HistogramId.h:45
static const int CHAMBER
Definition HistogramId.h:45
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.