///////////////////////////////////////////////////////////// // // MvdContFact // // Factory for the parameter containers in libMvd // ///////////////////////////////////////////////////////////// using namespace std; #include "MvdContFact.h" #include "CbmRuntimeDb.h" #include "MvdGeoPar.h" #include "MvdDigiPar.h" #include "MvdGeoMappingPar.h" #include "CbmParRootFileIo.h" #include "CbmParAsciiFileIo.h" //#include "CbmParIo.h" //#include "MvdParRootFileIo.h" //#include "MvdParAsciiFileIo.h" #include #include ClassImp(MvdContFact) static MvdContFact gMvdContFact; MvdContFact::MvdContFact() { // Constructor (called when the library is loaded) fName="MvdContFact"; fTitle="Factory for parameter containers in libMvd"; setAllContainers(); CbmRuntimeDb::instance()->addContFactory(this); } void MvdContFact::setAllContainers() { /** Creates the Container objects with all accepted contexts and adds them to * the list of containers for the MVD library.*/ CbmContainer* p= new CbmContainer("MvdGeoPar", "Mvd Geometry Parameters", "TestDefaultContext"); p->addContext("TestNonDefaultContext"); containers->Add(p); CbmContainer* p2 = new CbmContainer("MvdDigiPar", "Mvd Digitization Parameters", "TestDefaultContext"); p2->addContext("TestNonDefaultContext"); containers->Add(p2); CbmContainer* p3 = new CbmContainer("MvdGeoMappingPar", "Mvd DetID to DetName mapping", "TestDefaultContext"); p2->addContext("TestNonDefaultContext"); containers->Add(p3); } CbmParSet* MvdContFact::createContainer(CbmContainer* 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(); CbmParSet* p=NULL; if (strcmp(name,"MvdGeoPar")==0) { p=new MvdGeoPar(c->getConcatName().Data(),c->GetTitle(),c->getContext()); } if (strcmp(name,"MvdDigiPar")==0) { p=new MvdDigiPar(c->getConcatName().Data(),c->GetTitle(),c->getContext()); } if (strcmp(name,"MvdGeoMappingPar")==0) { p=new MvdGeoMappingPar(c->getConcatName().Data(),c->GetTitle(),c->getContext()); } return p; } /*void MvdContFact::activateParIo(CbmParIo* io) { // activates the input/output class for the parameters // needed by the Mvd if (strcmp(io->IsA()->GetName(),"CbmParRootFileIo")==0) { MvdParRootFileIo* p=new MvdParRootFileIo(((CbmParRootFileIo*)io)->getParRootFile()); io->setDetParIo(p); } if (strcmp(io->IsA()->GetName(),"CbmParAsciiFileIo")==0) { MvdParAsciiFileIo* p=new MvdParAsciiFileIo(((CbmParAsciiFileIo*)io)->getFile()); io->setDetParIo(p); } }*/