MpdTofContFact.cxx 1.9 KB

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