CbmRoot
Loading...
Searching...
No Matches
CbmModuleList.cxx
Go to the documentation of this file.
1/* Copyright (C) 2013-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer], Florian Uhlig */
4
9#include "CbmModuleList.h"
10
11#include "CbmDefs.h" // for ECbmModuleId enumerator
12
13#include <Logger.h> // for LOG macro
14
15#include <utility> // for pair
16
17using std::map;
18
19// ----- Initialisation of the list of modules -------------------------
20map<ECbmModuleId, TString> CbmModuleList::DefineModules()
21{
22 map<ECbmModuleId, TString> data;
23
24 data[ECbmModuleId::kRef] = "ref";
25 data[ECbmModuleId::kBmon] = "bmon";
26 data[ECbmModuleId::kMvd] = "mvd";
27 data[ECbmModuleId::kSts] = "sts";
28 data[ECbmModuleId::kRich] = "rich";
29 data[ECbmModuleId::kMuch] = "much";
30 data[ECbmModuleId::kTrd] = "trd";
31 data[ECbmModuleId::kTof] = "tof";
32 data[ECbmModuleId::kEcal] = "ecal";
33 data[ECbmModuleId::kFsd] = "fsd";
34 data[ECbmModuleId::kHodo] = "hodo";
35 data[ECbmModuleId::kDummyDet] = "dummy";
36 data[ECbmModuleId::kPsd] = "psd";
37 data[ECbmModuleId::kMagnet] = "magnet";
38 data[ECbmModuleId::kTarget] = "target";
39 data[ECbmModuleId::kPipe] = "pipe";
40 data[ECbmModuleId::kShield] = "shield";
41 data[ECbmModuleId::kPlatform] = "platform";
42 data[ECbmModuleId::kCave] = "cave";
43
44 return data;
45}
46// -------------------------------------------------------------------------
47
48
49// ----- Initialise static map -------------------------- ----------------
50// This is done by using the copy constructor of std::map, calling the
51// method DefineModules, which actually fills the static map.
52map<ECbmModuleId, TString> CbmModuleList::fModules(CbmModuleList::DefineModules());
53// -------------------------------------------------------------------------
54
55
56// ------ Get module Id from module name ---------------------------------
58{
59
60 map<ECbmModuleId, TString>::iterator it = fModules.begin();
61 while (it != fModules.end()) {
62 if (!(it->second).CompareTo(moduleName, TString::kIgnoreCase)) return it->first;
63 it++;
64 }
66}
67// -------------------------------------------------------------------------
68
69
70// ------ Get module name from module Id --------------------------------
72{
73 if (fModules.find(moduleId) == fModules.end()) {
74 LOG(error) << "Module List: Illegal module Id " << moduleId;
75 return "";
76 }
77 return fModules.find(moduleId)->second;
78}
79// -------------------------------------------------------------------------
80
81
82// ------ Get module name in capitals from module Id -------------------
84{
85 TString name = GetModuleName(moduleId);
86 name.ToUpper();
87 return name;
88}
89// -------------------------------------------------------------------------
ECbmModuleId
Definition CbmDefs.h:39
@ kMvd
Micro-Vertex Detector.
@ kPipe
Beam pipe.
@ kHodo
Hodoscope (for test beam times)
@ kEcal
EM-Calorimeter.
@ kTrd
Transition Radiation Detector.
@ kShield
Beam pipe shielding in MUCH section.
@ kMagnet
Magnet.
@ kTof
Time-of-flight Detector.
@ kNotExist
If not found.
@ kTarget
Target.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
@ kDummyDet
Dummy for tutorials or tests.
@ kPlatform
RICH rail platform.
@ kRef
Reference plane.
@ kMuch
Muon detection system.
@ kFsd
Forward spectator detector.
@ kRich
Ring-Imaging Cherenkov Detector.
static TString GetModuleName(ECbmModuleId moduleId)
static ECbmModuleId GetModuleId(const char *moduleName)
static std::map< ECbmModuleId, TString > fModules
static TString GetModuleNameCaps(ECbmModuleId moduleId)
static std::map< ECbmModuleId, TString > DefineModules()