BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CbmStsContFact.cxx
Go to the documentation of this file.
1//*-- AUTHOR : Denis Bertini
2//*-- Created : 20/06/2005
3
4/////////////////////////////////////////////////////////////
5//
6// CbmStsContFact
7//
8// Factory for the parameter containers in libSts
9//
10/////////////////////////////////////////////////////////////
11
12#include "CbmStsContFact.h"
13
14#include "CbmGeoStsPar.h"
15#include "CbmParTest.h"
16#include "CbmStsDigiPar.h"
18#include "CbmStsParRootFileIo.h"
19#include "FairParAsciiFileIo.h"
20#include "FairParRootFileIo.h"
21#include "FairRuntimeDb.h"
22#include "TClass.h"
23
24#include <iomanip>
25#include <iostream>
26
27using std::cout;
28using std::endl;
29
31
33{
34 // Constructor (called when the library is loaded)
35 fName = "CbmStsContFact";
36 fTitle = "Factory for parameter containers in libSts";
38 FairRuntimeDb::instance()->addContFactory(this);
39}
40
42{
43 /** Creates the Container objects with all accepted contexts and adds them to
44 * the list of containers for the STS library.*/
45 FairContainer* p1 = new FairContainer("CbmStsDigiPar", "Sts Digitisation Parameters", "TestDefaultContext");
46 p1->addContext("TestNonDefaultContext");
47
48 FairContainer* p2 = new FairContainer("CbmGeoStsPar", "Sts Geometry Parameters", "TestDefaultContext");
49 p2->addContext("TestNonDefaultContext");
50
51 containers->Add(p1);
52 containers->Add(p2);
53}
54
56{
57 /** Calls the constructor of the corresponding parameter container.
58 * For an actual context, which is not an empty string and not the default context
59 * of this container, the name is concatinated with the context. */
60 const char* name = c->GetName();
61 // cout << " -I container name " << name << endl;
62 FairParSet* p = 0;
63 if (strcmp(name, "CbmStsDigiPar") == 0) {
64 p = new CbmStsDigiPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
65 }
66 if (strcmp(name, "CbmGeoStsPar") == 0) {
67 p = new CbmGeoStsPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
68 }
69 return p;
70}
71
73{
74 // activates the input/output class for the parameters
75 // needed by the Sts
76 if (strcmp(io->IsA()->GetName(), "FairParRootFileIo") == 0) {
77 CbmStsParRootFileIo* p = new CbmStsParRootFileIo(((FairParRootFileIo*)io)->getParRootFile());
78 io->setDetParIo(p);
79 }
80 if (strcmp(io->IsA()->GetName(), "FairParAsciiFileIo") == 0) {
81 CbmStsParAsciiFileIo* p = new CbmStsParAsciiFileIo(((FairParAsciiFileIo*)io)->getFile());
82 io->setDetParIo(p);
83 }
84}
static CbmStsContFact gCbmStsContFact
void activateParIo(FairParIo *io)
FairParSet * createContainer(FairContainer *)