//*-- AUTHOR : Denis Bertini //*-- Created : 20/06/2005 ///////////////////////////////////////////////////////////// // // CbmMvdStripsContFact // // Factory for the parameter containers in libMvdStrips // ///////////////////////////////////////////////////////////// #include "CbmMvdStripsContFact.h" #include "CbmMvdStripsParRootFileIo.h" #include "CbmMvdStripsParAsciiFileIo.h" #include "CbmGeoMvdStripsPar.h" #include "CbmMvdStripsDigiPar.h" #include "FairRuntimeDb.h" #include "CbmParTest.h" #include "FairParRootFileIo.h" #include "FairParAsciiFileIo.h" #include "TClass.h" #include #include using std::cout; using std::endl; ClassImp(CbmMvdStripsContFact) static CbmMvdStripsContFact gCbmMvdStripsContFact; CbmMvdStripsContFact::CbmMvdStripsContFact() { // Constructor (called when the library is loaded) fName="CbmMvdStripsContFact"; fTitle="Factory for parameter containers in libMvdStrips"; setAllContainers(); FairRuntimeDb::instance()->addContFactory(this); } void CbmMvdStripsContFact::setAllContainers() { /** Creates the Container objects with all accepted contexts and adds them to * the list of containers for the MVDSTRIPS library.*/ FairContainer* p1= new FairContainer("CbmMvdStripsDigiPar", "MvdStrips Digitisation Parameters", "TestDefaultContext"); p1->addContext("TestNonDefaultContext"); FairContainer* p2= new FairContainer("CbmGeoMvdStripsPar", "MvdStrips Geometry Parameters", "TestDefaultContext"); p2->addContext("TestNonDefaultContext"); containers->Add(p1); containers->Add(p2); } FairParSet* CbmMvdStripsContFact::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(); cout << " -I container name " << name << endl; FairParSet* p=0; if (strcmp(name,"CbmMvdStripsDigiPar")==0) { p=new CbmMvdStripsDigiPar(c->getConcatName().Data(),c->GetTitle(),c->getContext()); } if (strcmp(name,"CbmGeoMvdStripsPar")==0) { p=new CbmGeoMvdStripsPar(c->getConcatName().Data(),c->GetTitle(),c->getContext()); } return p; } void CbmMvdStripsContFact::activateParIo(FairParIo* io) { // activates the input/output class for the parameters // needed by the MvdStrips if (strcmp(io->IsA()->GetName(),"FairParRootFileIo")==0) { CbmMvdStripsParRootFileIo* p=new CbmMvdStripsParRootFileIo(((FairParRootFileIo*)io)->getParRootFile()); io->setDetParIo(p); } if (strcmp(io->IsA()->GetName(),"FairParAsciiFileIo")==0) { CbmMvdStripsParAsciiFileIo* p=new CbmMvdStripsParAsciiFileIo(((FairParAsciiFileIo*)io)->getFile()); io->setDetParIo(p); } }