Project
Loading...
Searching...
No Matches
DetectorParameters.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
17
18#include <stdexcept>
19#include <sstream>
20#include <string>
21#include <fmt/format.h>
22
23namespace o2
24{
25namespace mid
26{
27namespace detparams
28{
29void assertDEId(int deId)
30{
31 if (deId < 0 || deId >= NDetectionElements) {
32 throw std::out_of_range(fmt::format("Detection element ID must be between 0 and %i", NDetectionElements - 1));
33 }
34}
35
36int getDEId(bool isRight, int chamber, int rpc)
37{
38 int deOffset = (isRight) ? 0 : NDetectionElementsPerSide;
39 return deOffset + NRPCLines * chamber + rpc;
40}
41
42std::string getDEName(int deId)
43{
44 int chId = getChamber(deId);
45 int stId = 1 + chId / 2;
46 int planeId = 1 + chId % 2;
47 std::stringstream deName;
48 deName << "MT" << stId << planeId << ((deId / NDetectionElementsPerSide == 0) ? "In" : "Out") << (deId % NRPCLines) + 1;
49 return deName.str();
50}
51
52} // namespace detparams
53} // namespace mid
54} // namespace o2
Useful detector parameters for MID.
constexpr int NDetectionElements
Number of RPCs.
constexpr int NRPCLines
Number of RPC lines.
std::string getDEName(int deId)
constexpr int NDetectionElementsPerSide
Number of detection elements per side.
int getDEId(bool isRight, int chamber, int rpc)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...