MpdEmcContFact.cxx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "MpdEmcContFact.h"
  2. #include "MpdEmcGeoPar.h"
  3. #include "FairRuntimeDb.h"
  4. #include <iostream>
  5. ClassImp(MpdEmcContFact)
  6. static MpdEmcContFact gMpdEmcContFact;
  7. MpdEmcContFact::MpdEmcContFact() {
  8. /** Constructor (called when the library is loaded) */
  9. fName="MpdEmcContFact";
  10. fTitle="Factory for parameter containers in libTutorial1";
  11. setAllContainers();
  12. FairRuntimeDb::instance()->addContFactory(this);
  13. }
  14. void MpdEmcContFact::setAllContainers() {
  15. /** Creates the Container objects with all accepted
  16. contexts and adds them to
  17. the list of containers for the Tutorial1 library.
  18. */
  19. FairContainer* p= new FairContainer("MpdEmcGeoPar",
  20. "MpdEmc Geometry Parameters",
  21. "TestDefaultContext");
  22. p->addContext("TestNonDefaultContext");
  23. containers->Add(p);
  24. }
  25. FairParSet* MpdEmcContFact::createContainer(FairContainer* c) {
  26. /** Calls the constructor of the corresponding parameter container.
  27. For an actual context, which is not an empty string and not
  28. the default context
  29. of this container, the name is concatinated with the context.
  30. */
  31. const char* name=c->GetName();
  32. FairParSet* p=NULL;
  33. if (strcmp(name,"MpdEmcGeoPar")==0) {
  34. p=new MpdEmcGeoPar(c->getConcatName().Data(),
  35. c->GetTitle(),c->getContext());
  36. }
  37. return p;
  38. }