MpdSftContFact.cxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //*-- AUTHOR : Ilse Koenig
  2. //*-- Created : 25/10/2004
  3. /////////////////////////////////////////////////////////////
  4. //
  5. // MpdSftContFact
  6. //
  7. // Factory for the parameter containers in libTof
  8. //
  9. /////////////////////////////////////////////////////////////
  10. using namespace std;
  11. #include "MpdSftContFact.h"
  12. #include "FairRuntimeDb.h"
  13. #include "MpdSftGeoPar.h"
  14. #include <iostream>
  15. #include <iomanip>
  16. ClassImp(MpdSftContFact)
  17. static MpdSftContFact gMpdSftContFact;
  18. MpdSftContFact::MpdSftContFact() {
  19. // Constructor (called when the library is loaded)
  20. fName="MpdSftContFact";
  21. fTitle="Factory for parameter containers in libSft";
  22. setAllContainers();
  23. FairRuntimeDb::instance()->addContFactory(this);
  24. }
  25. void MpdSftContFact::setAllContainers() {
  26. /** Creates the Container objects with all accepted contexts and adds them to
  27. * the list of containers for the Tof library.*/
  28. FairContainer* p= new FairContainer("MpdSftGeoPar",
  29. "Sft Geometry Parameters",
  30. "TestDefaultContext");
  31. p->addContext("TestNonDefaultContext");
  32. containers->Add(p);
  33. }
  34. FairParSet* MpdSftContFact::createContainer(FairContainer* c) {
  35. /** Calls the constructor of the corresponding parameter container.
  36. * For an actual context, which is not an empty string and not the default context
  37. * of this container, the name is concatinated with the context. */
  38. const char* name=c->GetName();
  39. cout << " -I container name " << name << endl;
  40. FairParSet* p=0;
  41. if (strcmp(name,"MpdSftGeoPar")==0) {
  42. p=new MpdSftGeoPar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
  43. }
  44. return p;
  45. }