CbmRoot
CbmStsContFact.cxx
Go to the documentation of this file.
1 
5 #include "CbmStsContFact.h"
6 
7 #include "CbmStsParSetModule.h" // for CbmStsParSetModule
8 #include "CbmStsParSetSensor.h" // for CbmStsParSetSensor
9 #include "CbmStsParSetSensorCond.h" // for CbmStsParSetSensorCond
10 #include "CbmStsParSim.h" // for CbmStsParSim
11 
12 #include <FairLogger.h> // for Logger, LOG
13 
14 #include <FairParSet.h> // for FairParSet
15 #include <FairRuntimeDb.h> // for FairRuntimeDb
16 #include <TList.h> // for TList
17 #include <TString.h> // for TString
18 
19 #include <string.h> // for strcmp
20 
22 
23  static CbmStsContFact gCbmStsContFact;
24 
25 
26 // ----- Constructor ----------------------------------------------------
28  SetName("CbmStsContFact");
29  SetTitle("STS parameter container factory");
31  FairRuntimeDb::instance()->addContFactory(this);
32 }
33 // --------------------------------------------------------------------------
34 
35 
36 // ----- Create a parameter set -----------------------------------------
37 FairParSet* CbmStsContFact::createContainer(FairContainer* container) {
38 
39  const char* contName = container->GetName();
40  FairParSet* parSet = nullptr;
41 
42  // --- Simulation settings
43  if (strcmp(contName, "CbmStsParSim") == 0) {
44  parSet = new CbmStsParSim(container->getConcatName().Data(),
45  container->GetTitle(),
46  container->getContext());
47  }
48 
49  // --- Module parameters
50  else if (strcmp(contName, "CbmStsParSetModule") == 0) {
51  parSet = new CbmStsParSetModule(container->getConcatName().Data(),
52  container->GetTitle(),
53  container->getContext());
54  }
55 
56  // --- Sensor parameters
57  else if (strcmp(contName, "CbmStsParSetSensor") == 0) {
58  LOG(info) << "createContainer " << container->getConcatName().Data() << " "
59  << container->GetTitle() << " " << container->getContext();
60  parSet = new CbmStsParSetSensor(container->getConcatName().Data(),
61  container->GetTitle(),
62  container->getContext());
63  LOG(info) << "Done";
64  }
65 
66 
67  // --- Sensor conditions
68  else if (strcmp(contName, "CbmStsParSetSensorCond") == 0) {
69  parSet = new CbmStsParSetSensorCond(container->getConcatName().Data(),
70  container->GetTitle(),
71  container->getContext());
72  }
73 
74  LOG(info) << GetName() << ": Create container " << contName
75  << " with parameter set " << parSet->GetName();
76  return parSet;
77 }
78 // --------------------------------------------------------------------------
79 
80 
81 // ---- Define containers and contexts ----------------------------------
83 
84  // --- Simulation settings
85  FairContainer* simPars =
86  new FairContainer("CbmStsParSim", "STS simulation settings", "Default");
87  simPars->addContext("Default");
88  containers->Add(simPars);
89 
90  // --- Module parameters
91  FairContainer* modulePars =
92  new FairContainer("CbmStsParSetModule", "STS module parameters", "Default");
93  modulePars->addContext("Default");
94  containers->Add(modulePars);
95 
96  // --- Sensor parameters
97  FairContainer* sensorPars =
98  new FairContainer("CbmStsParSetSensor", "STS sensor parameters", "Default");
99  sensorPars->addContext("Default");
100  containers->Add(sensorPars);
101 
102  // --- Sensor conditions
103  FairContainer* sensorCond = new FairContainer(
104  "CbmStsParSetSensorCond", "STS sensor conditions", "Default");
105  sensorCond->addContext("Default");
106  containers->Add(sensorCond);
107 }
108 // --------------------------------------------------------------------------
CbmStsParSetSensor.h
CbmStsContFact
Factory class for STS parameter container.
Definition: CbmStsContFact.h:27
CbmStsContFact::CbmStsContFact
CbmStsContFact()
Constructor.
Definition: CbmStsContFact.cxx:27
CbmStsParSetModule.h
CbmStsParSetSensorCond.h
CbmStsParSim.h
CbmStsParSetSensorCond
Parameters container for CbmStsParSensorCond.
Definition: CbmStsParSetSensorCond.h:30
CbmStsParSetSensor
Parameters container for CbmStsParSensor.
Definition: CbmStsParSetSensor.h:30
CbmStsContFact::createContainer
FairParSet * createContainer(FairContainer *)
Create a parameter set.
Definition: CbmStsContFact.cxx:37
ClassImp
ClassImp(CbmStsContFact) static CbmStsContFact gCbmStsContFact
CbmStsParSim
Settings for STS simulation (digitizer)
Definition: CbmStsParSim.h:25
CbmStsParSetModule
Parameters container for CbmStsParModule.
Definition: CbmStsParSetModule.h:30
CbmStsContFact.h
CbmStsContFact::setAllContainers
void setAllContainers()
Define parameter containers and their contexts.
Definition: CbmStsContFact.cxx:82