ATLAS Offline Software
Loading...
Searching...
No Matches
NtupleStationId.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include "GaudiKernel/MsgStream.h"
13
14namespace MuonCalib {
15
16 bool NtupleStationId::Initialize(const std::string& station, const int& eta, const int& phi, const int& ml, const int& author) {
17 MuonFixedId id;
18 if (station == "ANY") {
19 m_station = -1;
20 } else {
21 m_station = id.stationStringToFixedStationNumber(station);
22 if (m_station < 0) return false;
23 }
24 m_eta = eta;
25 m_phi = phi;
26 m_ml = ml;
27 m_author = author;
28 m_geom_ok = false;
29 return true;
30 }
31
32 void NtupleStationId::SetStation(const std::string& station) {
33 MuonFixedId id;
34 m_station = id.stationStringToFixedStationNumber(station);
35 }
36
38 MuonFixedId fid;
39 MsgStream log(Athena::getMessageSvc(), "NtupleStationId");
40 if (m_station == -1 || m_phi < 0 || m_eta == -99) {
41 log << MSG::WARNING << "NtupleStationId::InitializeGeometry: Cannot initialize geometry for multi station id" << endmsg;
42 m_geom_ok = false;
43 return false;
44 }
46 m_n_ml = mdtIdHelper.numberOfMultilayers(id);
47 // loop on multilayers
48 for (int i = 0; i < m_n_ml; i++) {
49 const MuonGM::MdtReadoutElement* detEl_ml = detMgr->getMdtReadoutElement(mdtIdHelper.channelID(id, 1 + i, 1, 1));
50 m_layer_min[i] = 1;
51 if (!detEl_ml) {
52 log << MSG::WARNING << regionId() << " ml " << i << "does not exist in current geometry" << endmsg;
53 return false;
54 }
55 m_layer_max[i] = detEl_ml->getNLayers();
56 m_n_layer[i] = m_layer_max[i] - m_layer_min[i] + 1;
57 m_tube_min[i] = 1;
58 m_tube_max[i] = detEl_ml->getNtubesperlayer();
59 m_n_tubes[i] = m_tube_max[i] - m_tube_min[i] + 1;
60 }
62 IdContext idCont = mdtIdHelper.module_context();
63 mdtIdHelper.get_hash(id, hash, &idCont);
64 m_region_hash = static_cast<int>(hash);
65 m_geom_ok = true;
66 return true;
67 }
68
69 std::string NtupleStationId::regionId() const {
70 MuonFixedId id;
71 std::ostringstream id_stream;
72 if (m_station < 0) {
73 id_stream << "ANY";
74 } else {
75 id_stream << id.stationNumberToFixedStationString(m_station);
76 }
77 id_stream << "_";
78 if (m_phi >= 0) {
79 id_stream << m_phi;
80 } else {
81 id_stream << "ANY";
82 }
83 id_stream << "_";
84 if (m_eta != -99) {
85 id_stream << m_eta;
86 } else {
87 id_stream << "ANY";
88 }
89 if (m_ml > 0) { id_stream << "_" << m_ml; }
90 return id_stream.str();
91 }
92
94 if (m_station < 0 || m_eta == -99 || m_phi < 0) return -1;
95 MuonFixedId id;
96 id.set_mdt();
97 if (!id.setStationName(m_station)) return -1;
98 if (!id.setStationEta(m_eta)) return -1;
99 if (!id.setStationPhi(m_phi)) return -1;
100 return id.mdtChamberId().getIdInt();
101 }
102
103} // namespace MuonCalib
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
Identifier elementID(int stationName, int stationEta, int stationPhi) const
int numberOfMultilayers(const Identifier &id) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
static std::string stationNumberToFixedStationString(const int station)
void Initialize(const MuonFixedId &id)
initialize function
bool InitializeGeometry(const MdtIdHelper &mdtIdHelper, const MuonGM::MuonDetectorManager *detMgr)
initialize geometry information
void SetStation(const std::string &station)
set station, eta or phi seperately
int m_region_hash
geo model information
std::string regionId() const
return the region id string
int getNLayers() const
Returns the number of tube layers inside the multilayer.
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
IdContext module_context() const
id for module
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override
Create hash id from compact id (return == 0 for OK)
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.
IdentifierHash MdtBasicRegionHash
define type MdtBasicRegionHash for the smallest possible MDT calibration region