CbmRoot
CbmTofContFact.cxx
Go to the documentation of this file.
1 //*-- AUTHOR : Ilse Koenig
2 //*-- Created : 25/10/2004
3 
5 //
6 // CbmTofContFact
7 //
8 // Factory for the parameter containers in libTof
9 //
11 #include "CbmTofContFact.h"
12 
13 #include "CbmTofDigiBdfPar.h" // for CbmTofDigiBdfPar
14 #include "CbmTofDigiPar.h" // for CbmTofDigiPar
15 
16 #include <FairContFact.h> // for FairContainer
17 #include <FairLogger.h> // for LOG
18 #include <FairRuntimeDb.h> // for FairRuntimeDb
19 
20 #include <TList.h> // for TList
21 #include <TString.h> // for TString
22 
23 #include <string.h> // for strcmp
24 
26 
27  static CbmTofContFact gCbmTofContFact;
28 
30  // Constructor (called when the library is loaded)
31  fName = "CbmTofContFact";
32  fTitle = "Factory for parameter containers in libTof";
34  FairRuntimeDb::instance()->addContFactory(this);
35 }
36 
41  FairContainer* p1 = new FairContainer(
42  "CbmTofDigiPar", "TOF Digitization parameters", "TestDefaultContext");
43  p1->addContext("TestNonDefaultContext");
44 
45  containers->Add(p1);
46 
47  FairContainer* p2 = new FairContainer("CbmTofDigiBdfPar",
48  "TOF BDF Digitization parameters",
49  "TestDefaultContext");
50  p2->addContext("TestNonDefaultContext");
51 
52  containers->Add(p2);
53 }
54 
55 FairParSet* CbmTofContFact::createContainer(FairContainer* c) {
59  const char* name = c->GetName();
60  LOG(info) << "container name " << name;
61  FairParSet* p = nullptr;
62  if (strcmp(name, "CbmTofDigiPar") == 0) {
63  p = new CbmTofDigiPar(
64  c->getConcatName().Data(), c->GetTitle(), c->getContext());
65  }
66  if (strcmp(name, "CbmTofDigiBdfPar") == 0) {
67  p = new CbmTofDigiBdfPar(
68  c->getConcatName().Data(), c->GetTitle(), c->getContext());
69  }
70  return p;
71 }
CbmTofDigiBdfPar.h
CbmTofContFact::CbmTofContFact
CbmTofContFact()
Definition: CbmTofContFact.cxx:29
CbmTofContFact::createContainer
FairParSet * createContainer(FairContainer *)
Definition: CbmTofContFact.cxx:55
CbmTofDigiPar.h
CbmTofContFact::setAllContainers
void setAllContainers()
Definition: CbmTofContFact.cxx:37
ClassImp
ClassImp(CbmTofContFact) static CbmTofContFact gCbmTofContFact
CbmTofDigiBdfPar
Parameters class for the CBM ToF digitizer using beam data distributions.
Definition: CbmTofDigiBdfPar.h:30
CbmTofContFact.h
CbmTofDigiPar
Definition: CbmTofDigiPar.h:18
CbmTofContFact
Definition: CbmTofContFact.h:11