CbmRoot
Loading...
Searching...
No Matches
CbmMvdDetectorId.h
Go to the documentation of this file.
1/* Copyright (C) 2009-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer], Florian Uhlig */
4
5// -------------------------------------------------------------------------
6// ----- CbmMvdDetectorId header file -----
7// ----- Created 22/04/09 by V. Friese -----
8// -------------------------------------------------------------------------
9
10
24#ifndef CBMMVDDETECTORID_H
25#define CBMMVDDETECTORID_H 1
26
27
28#include "CbmDefs.h" // for ECbmModuleId::kMvd
29
30#include <Logger.h> // for LOG
31
32#include <Rtypes.h> // for ClassDef
33
34#include <cstdint>
35
36
38
39public:
42
43
45 virtual ~CbmMvdDetectorId() {}
46
47
49 int32_t DetectorId(int32_t iStation) const { return (ToIntegralType(ECbmModuleId::kMvd) | (iStation << 5)); }
50
51
53 int32_t SystemId(int32_t detectorId) const
54 {
55 int32_t iSystem = detectorId & 31;
56 if (iSystem != ToIntegralType(ECbmModuleId::kMvd)) {
57 LOG(error) << "wrong system ID " << iSystem;
58 return -1;
59 }
60 return iSystem;
61 }
62
63
65 int32_t StationNr(int32_t detectorId) const { return ((detectorId & (~31)) >> 5); }
66
67
69};
70
71
72#endif
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition CbmDefs.h:29
@ kMvd
Micro-Vertex Detector.
virtual ~CbmMvdDetectorId()
int32_t SystemId(int32_t detectorId) const
int32_t DetectorId(int32_t iStation) const
ClassDef(CbmMvdDetectorId, 1)
int32_t StationNr(int32_t detectorId) const