/
PndSensorNameContFact.cxx
67 lines (59 loc) · 2.15 KB
/
PndSensorNameContFact.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
/////////////////////////////////////////////////////////////
//
// PndSensorNameContFact
//
// Factory for the parameter containers in libPndMvd
//
/////////////////////////////////////////////////////////////
//using namespace std;
#include "PndSensorNameContFact.h"
#include "FairRuntimeDb.h"
#include "PndSensorNamePar.h"
#include "FairParRootFileIo.h"
#include "FairParAsciiFileIo.h"
#include "TList.h"
#include "TObjString.h"
#include <iostream>
#include <iomanip>
ClassImp(PndSensorNameContFact);
static PndSensorNameContFact gPndSensorNameContFact;
PndSensorNameContFact::PndSensorNameContFact(): fSensorParNames(), fContainerNames() {
// Constructor (called when the library is loaded)
fName="PndSensorNameContFact";
fTitle="Factory for parameter containers of the PndGeoHandler";
fSensorParNames = new TList();
fContainerNames.push_back("PndSensorNamePar");
setAllContainers();
FairRuntimeDb::instance()->addContFactory(this);
}
PndSensorNameContFact::~PndSensorNameContFact(){
if(0!=fSensorParNames)
{
fSensorParNames->Delete();
delete fSensorParNames;
}
}
void PndSensorNameContFact::setAllContainers() {
/** Creates the Container objects with all accepted contexts and adds them to
* the list of containers for the MVD library.*/
for (unsigned int i = 0; i < fContainerNames.size(); i++){
std::string description = "Match between GeoManager path and SensorId";
FairContainer* p = new FairContainer(fContainerNames[i].c_str(), description.c_str(), "TestDefaultContext");
fSensorParNames->Add(new TObjString(p->getConcatName()));
containers->Add(p);
}
}
FairParSet* PndSensorNameContFact::createContainer(FairContainer* c) {
/** Calls 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();
FairParSet* p=NULL;
for (unsigned int i = 0; i < fContainerNames.size(); i++){
if (strcmp(name,fContainerNames[i].c_str())==0) {
p=new PndSensorNamePar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
return p;
}
}
return p;
}