CbmRoot
CbmMvdDetectorId.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmMvdDetectorId header file -----
3 // ----- Created 22/04/09 by V. Friese -----
4 // -------------------------------------------------------------------------
5 
6 
20 #ifndef CBMMVDDETECTORID_H
21 #define CBMMVDDETECTORID_H 1
22 
23 
24 #include <Rtypes.h> // for ClassDef
25 #include <RtypesCore.h> // for Int_t
26 
27 #include <FairLogger.h> // for LOG
28 
29 #include "CbmDefs.h" // for ECbmModuleId::kMvd
30 
31 
33 
34 public:
37 
38 
40  virtual ~CbmMvdDetectorId() {}
41 
42 
44  Int_t DetectorId(Int_t iStation) const {
45  return (ToIntegralType(ECbmModuleId::kMvd) | (iStation << 5));
46  }
47 
48 
50  Int_t SystemId(Int_t detectorId) const {
51  Int_t iSystem = detectorId & 31;
52  if (iSystem != ToIntegralType(ECbmModuleId::kMvd)) {
53  LOG(error) << "wrong system ID " << iSystem;
54  return -1;
55  }
56  return iSystem;
57  }
58 
59 
61  Int_t StationNr(Int_t detectorId) const {
62  return ((detectorId & (~31)) >> 5);
63  }
64 
65 
67 };
68 
69 
70 #endif
CbmMvdDetectorId
Definition: CbmMvdDetectorId.h:32
CbmMvdDetectorId::CbmMvdDetectorId
CbmMvdDetectorId()
Definition: CbmMvdDetectorId.cxx:10
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
CbmMvdDetectorId::SystemId
Int_t SystemId(Int_t detectorId) const
Definition: CbmMvdDetectorId.h:50
CbmMvdDetectorId::~CbmMvdDetectorId
virtual ~CbmMvdDetectorId()
Definition: CbmMvdDetectorId.h:40
ToIntegralType
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition: CbmDefs.h:24
CbmMvdDetectorId::StationNr
Int_t StationNr(Int_t detectorId) const
Definition: CbmMvdDetectorId.h:61
CbmMvdDetectorId::DetectorId
Int_t DetectorId(Int_t iStation) const
Definition: CbmMvdDetectorId.h:44
CbmMvdDetectorId::ClassDef
ClassDef(CbmMvdDetectorId, 1)
CbmDefs.h