BmnRoot
Loading...
Searching...
No Matches
CbmModuleList.cxx
Go to the documentation of this file.
1
6#include "CbmModuleList.h"
7
8#include "FairLogger.h"
9
10#include <boost/algorithm/string.hpp>
11
12using std::map;
13
14// ----- Initialisation of the list of modules -------------------------
15map<Int_t, TString> CbmModuleList::DefineModules() {
16 map<Int_t, TString> data;
17
18 data[kRef] = "ref";
19 data[kMvd] = "mvd";
20 data[kSts] = "sts";
21 data[kRich] = "rich";
22 data[kMuch] = "much";
23 data[kTrd] = "trd";
24 data[kTof] = "tof";
25 data[kEcal] = "ecal";
26 data[kDummyDet] = "dummy";
27 data[kMagnet] = "magnet";
28 data[kTarget] = "target";
29 data[kPipe] = "pipe";
30 data[kShield] = "shield";
31 data[kPlatform] = "platform";
32
33 return data;
34}
35// -------------------------------------------------------------------------
36
37
38
39// ----- Initialise static map -------------------------- ----------------
40// This is done by using the copy constructor of std::map, calling the
41// method DefineModules, which actually fills the static map.
42map<Int_t, TString> CbmModuleList::fModules(CbmModuleList::DefineModules());
43// -------------------------------------------------------------------------
44
45
46
47// ------ Get module Id from module name ---------------------------------
48Int_t CbmModuleList::GetModuleId(const char* moduleName) {
49
50 map<Int_t, TString>::iterator it = fModules.begin();
51 while ( it != fModules.end() ) {
52 if ( ! (it->second).CompareTo(moduleName, TString::kIgnoreCase) )
53 return it->first;
54 it++;
55 }
56 return -1;
57
58}
59// -------------------------------------------------------------------------
60
61
62
63// ------ Get module name from module Id --------------------------------
64TString CbmModuleList::GetModuleName(Int_t moduleId) {
65 if ( fModules.find(moduleId) == fModules.end() ) {
66 LOG(error) << "Module List: Illegal module Id " << moduleId;
67 return "";
68 }
69 return fModules.find(moduleId)->second;
70}
71// -------------------------------------------------------------------------
72
73
74
75// ------ Get module name in capitals from module Id -------------------
76TString CbmModuleList::GetModuleNameCaps(Int_t moduleId) {
77 TString name = GetModuleName(moduleId);
78 name.ToUpper();
79 return name;
80}
81// -------------------------------------------------------------------------
82
83
name
Definition setup.py:7