forked from R3BRootGroup/R3BRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR3BPdcContFact.cxx
114 lines (95 loc) · 3.96 KB
/
R3BPdcContFact.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/
/////////////////////////////////////////////////////////////
//
// R3BPdcContFact
//
// Factory for the parameter containers in libR3BPdc
//
/////////////////////////////////////////////////////////////
#include "R3BPdcContFact.h"
#include "R3BGeoPdcPar.h"
#include "R3BTGeoPar.h"
#include "FairParAsciiFileIo.h"
#include "FairParRootFileIo.h"
#include "FairRuntimeDb.h"
#include "TClass.h"
#include <iomanip>
#include <iostream>
using std::cout;
using std::endl;
ClassImp(R3BPdcContFact)
static R3BPdcContFact gR3BPdcContFact;
R3BPdcContFact::R3BPdcContFact()
{
// Constructor (called when the library is loaded)
fName = "R3BPdcContFact";
fTitle = "Factory for parameter containers in libR3BPdc";
setAllContainers();
FairRuntimeDb::instance()->addContFactory(this);
}
void R3BPdcContFact::setAllContainers()
{
/** Creates the Container objects with all accepted contexts and adds them to
* the list of containers for the STS library.*/
/*
FairContainer* p1= new FairContainer("R3BPdcDigiPar",
"Sts Digitisation Parameters",
"TestDefaultContext");
p1->addContext("TestNonDefaultContext");
FairContainer* p2= new FairContainer("CbmGeoStsPar",
"Sts Geometry Parameters",
"TestDefaultContext");
p2->addContext("TestNonDefaultContext");
containers->Add(p1);
containers->Add(p2);
*/
FairContainer* p2 = new FairContainer("PdcGeoPar", "Pdc geometry parameters", "TestDefaultContext");
p2->addContext("TestNonDefaultContext");
containers->Add(p2);
}
FairParSet* R3BPdcContFact::createContainer(FairContainer* c)
{
/** Pdcls the constructor of the corresponding parameter container.
* For an actual context, which is not an empty string and not the default context
* of this container, the name is concatinated with the context. */
const char* name = c->GetName();
cout << " -I container name " << name << endl;
FairParSet* p = 0;
/*if (strcmp(name,"R3BPdcDigiPar")==0) {
p=new R3BPdcDigiPar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
}
if (strcmp(name,"CbmGeoStsPar")==0) {
p=new CbmGeoStsPar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
}*/
if (strcmp(name, "PdcGeoPar") == 0)
{
p = new R3BTGeoPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
}
return p;
}
void R3BPdcContFact::activateParIo(FairParIo* io)
{
// activates the input/output class for the parameters
// needed by the Sts
/*
if (strcmp(io->IsA()->GetName(),"FairParRootFileIo")==0) {
R3BPdcParRootFileIo* p=new R3BPdcParRootFileIo(((FairParRootFileIo*)io)->getParRootFile());
io->setDetParIo(p);
}
if (strcmp(io->IsA()->GetName(),"FairParAsciiFileIo")==0) {
R3BPdcParAsciiFileIo* p=new R3BPdcParAsciiFileIo(((FairParAsciiFileIo*)io)->getFile());
io->setDetParIo(p);
}
*/
}