CbmRoot
CbmTrdParSet.cxx
Go to the documentation of this file.
1 #include "CbmTrdParSet.h"
2 
3 #include "CbmTrdParMod.h" // for CbmTrdParMod
4 
5 #include <FairParGenericSet.h> // for FairParGenericSet
6 #include <FairParamList.h> // for FairParamList
7 
8 #include <TGenericClassInfo.h> // for TGenericClassInfo
9 
10 #include <stdio.h> // for printf
11 #include <utility> // for pair
12 
13 using std::map;
14 //_______________________________________________________________________________
15 CbmTrdParSet::CbmTrdParSet(const char* name,
16  const char* title,
17  const char* context)
18  : FairParGenericSet(name, title, context), fNrOfModules(0), fModuleMap() {
19  //printf("%s (%s, %s, %s)\n", GetName(), name, title, context);
20 }
21 
22 //_______________________________________________________________________________
24  for (map<Int_t, CbmTrdParMod*>::iterator imod = fModuleMap.begin();
25  imod != fModuleMap.end();
26  imod++)
27  delete imod->second;
28  fModuleMap.clear();
29 }
30 
31 //_______________________________________________________________________________
32 Int_t CbmTrdParSet::GetModuleId(Int_t i) const {
33  if (i < 0 || i >= fNrOfModules) return -1;
34  Int_t j(0);
35  for (map<Int_t, CbmTrdParMod*>::const_iterator imod = fModuleMap.begin();
36  imod != fModuleMap.end();
37  imod++, j++) {
38  if (j < i) continue;
39  return imod->first;
40  }
41  return -1;
42 }
43 
44 //_______________________________________________________________________________
45 const CbmTrdParMod* CbmTrdParSet::GetModulePar(Int_t detId) const {
46  map<Int_t, CbmTrdParMod*>::const_iterator imod = fModuleMap.find(detId);
47  if (imod == fModuleMap.end()) return nullptr;
48  return imod->second;
49 }
50 
51 //_______________________________________________________________________________
52 Bool_t CbmTrdParSet::getParams(FairParamList* l) {
53  if (!l) return kFALSE;
54  l->print();
55  return kTRUE;
56 }
57 
58 
59 //_______________________________________________________________________________
60 void CbmTrdParSet::putParams(FairParamList* /*l*/) {
61  printf("%s(%s)::putParams not implemented \n", GetName(), GetTitle());
62 }
63 
64 //_______________________________________________________________________________
66  fModuleMap[mod->GetModuleId()] = mod;
67  fNrOfModules++;
68 }
69 
CbmTrdParSet::fModuleMap
std::map< Int_t, CbmTrdParMod * > fModuleMap
Definition: CbmTrdParSet.h:43
CbmTrdParMod::GetModuleId
virtual Int_t GetModuleId() const
Definition: CbmTrdParMod.h:15
CbmTrdParSet::~CbmTrdParSet
virtual ~CbmTrdParSet()
Destructor.
Definition: CbmTrdParSet.cxx:23
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTrdParSet::addParam
virtual void addParam(CbmTrdParMod *mod)
Definition: CbmTrdParSet.cxx:65
CbmTrdParSet
Definition: CbmTrdParSet.h:19
CbmTrdParSet::putParams
virtual void putParams(FairParamList *)
Definition: CbmTrdParSet.cxx:60
CbmTrdParSet::GetModuleId
virtual Int_t GetModuleId(Int_t i) const
Definition: CbmTrdParSet.cxx:32
CbmTrdParSet::fNrOfModules
Int_t fNrOfModules
no of modules in the current run
Definition: CbmTrdParSet.h:41
CbmTrdParSet::CbmTrdParSet
CbmTrdParSet(const char *name="CbmTrdParSet", const char *title="TRD parameters", const char *context="Default")
Definition: CbmTrdParSet.cxx:15
CbmTrdParMod
Definition of generic parameters for one TRD module.
Definition: CbmTrdParMod.h:9
CbmTrdParSet::GetModulePar
virtual const CbmTrdParMod * GetModulePar(Int_t detId) const
Definition: CbmTrdParSet.cxx:45
CbmTrdParSet::getParams
virtual Bool_t getParams(FairParamList *)
Definition: CbmTrdParSet.cxx:52
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmTrdParSet.h
CbmTrdParMod.h