MpdZdcContFact.cxx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*************************************************************************************
  2. *
  3. * Class MpdZdcContFact
  4. *
  5. * Adopted for MPD by: Elena Litvinenko
  6. * e-mail: litvin@nf.jinr.ru
  7. * Version: 8-Apr-2008
  8. *
  9. ************************************************************************************/
  10. using namespace std;
  11. #include "MpdZdcContFact.h"
  12. #include "FairRuntimeDb.h"
  13. #include "FairParRootFileIo.h"
  14. #include "FairParAsciiFileIo.h"
  15. #include "MpdZdcGeoPar.h"
  16. #include <iostream>
  17. #include <iomanip>
  18. ClassImp(MpdZdcContFact)
  19. static MpdZdcContFact gMpdZdcContFact;
  20. MpdZdcContFact::MpdZdcContFact() {
  21. // Constructor (called when the library is loaded)
  22. fName="MpdZdcContFact";
  23. fTitle="Factory for parameter containers in libZdc";
  24. setAllContainers();
  25. FairRuntimeDb::instance()->addContFactory(this);
  26. }
  27. void MpdZdcContFact::setAllContainers() {
  28. /** Creates the Container objects with all accepted contexts and adds them to
  29. * the list of containers for the ZDC library.*/
  30. FairContainer* p= new FairContainer("MpdZdcGeoPar",
  31. "Zdc Geometry Parameters",
  32. "ZdcDefaultContext");
  33. p->addContext("ZdcNonDefaultContext");
  34. containers->Add(p);
  35. // p->print();
  36. }
  37. FairParSet* MpdZdcContFact::createContainer(FairContainer* c) {
  38. /** Calls the constructor of the corresponding parameter container.
  39. * For an actual context, which is not an empty string and not the default context
  40. * of this container, the name is concatinated with the context. */
  41. const char* name=c->GetName();
  42. FairParSet* p=NULL;
  43. if (strcmp(name,"MpdZdcGeoPar")==0) {
  44. p=new MpdZdcGeoPar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
  45. }
  46. return p;
  47. }