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