MpdFieldContFact.cxx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // -------------------------------------------------------------------------
  2. // MpdFieldContFact source file -----
  3. // Created 23/07/13 by P. Batyuk (MPD) <batyuk@jinr.ru> -----
  4. // from MpdFieldContFact (PNDROOT) -----
  5. // -------------------------------------------------------------------------
  6. /// Last modified: 24.07.2013, P.B.
  7. #include "MpdFieldContFact.h"
  8. #include "MpdFieldPar.h"
  9. #include "MpdConstPar.h"
  10. #include "FairParSet.h"
  11. #include "FairRuntimeDb.h"
  12. #include "MpdMultiFieldPar.h"
  13. #include <iostream>
  14. using namespace std;
  15. static MpdFieldContFact gMpdFieldContFact;
  16. // ----- Constructor ---------------------------------------------------
  17. MpdFieldContFact::MpdFieldContFact() {
  18. fName = "MpdFieldContFact";
  19. fTitle = "Factory for field parameter containers";
  20. SetAllContainers();
  21. FairRuntimeDb::instance()->addContFactory(this);
  22. }
  23. // ----- Destructor ----------------------------------------------------
  24. MpdFieldContFact::~MpdFieldContFact() { }
  25. // ----- Create containers ---------------------------------------------
  26. FairParSet* MpdFieldContFact::createContainer(FairContainer* container)
  27. {
  28. const char* name = container->GetName();
  29. cout << "create MpdFieldPar container " << name << endl;
  30. FairParSet* set = NULL;
  31. if ( strcmp(name, "MpdFieldPar") == 0 ) {
  32. set = new MpdFieldPar( container->getConcatName().Data(),
  33. container->GetTitle(),
  34. container->getContext() );
  35. }
  36. else if ( strcmp(name, "MpdConstPar") == 0 ) {
  37. set = new MpdConstPar( container->getConcatName().Data(),
  38. container->GetTitle(),
  39. container->getContext() );
  40. }
  41. else if ( strcmp(name, "MpdMultiFieldPar") == 0 ) {
  42. set = new MpdMultiFieldPar( container->getConcatName().Data(),
  43. container->GetTitle(),
  44. container->getContext() );
  45. }
  46. return set;
  47. }
  48. // ----- Set all containers (private) ----------------------------------
  49. void MpdFieldContFact::SetAllContainers() {
  50. FairContainer* con1 = new FairContainer("MpdFieldPar",
  51. "Field parameter container",
  52. "Default field");
  53. containers->Add(con1);
  54. FairContainer* con2 = new FairContainer("MpdConstPar",
  55. "Const Field parameter container",
  56. "Default field");
  57. containers->Add(con2);
  58. FairContainer* con3 = new FairContainer("MpdMultiFieldPar",
  59. "Multiple Field parameter container",
  60. "Default field");
  61. containers->Add(con3);
  62. }
  63. ClassImp(MpdFieldContFact)