MpdNDetParam.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /** I am desperate for usable parameter handle class.
  2. ** So we will have it only for neutron detector. :(**/
  3. #ifndef MPDNDETPARAM_H
  4. #define MPDNDETPARAM_H
  5. #include "TObjArray.h"
  6. #include <list>
  7. #include "TString.h"
  8. #include "TObjString.h"
  9. #include "TNamed.h"
  10. #include "TMap.h"
  11. class MpdNDetParam : public TNamed
  12. {
  13. public:
  14. /** This is ROOT requirement **/
  15. MpdNDetParam() {};
  16. /** Text file constructor **/
  17. MpdNDetParam(const char* name, const char* filename);
  18. virtual ~MpdNDetParam();
  19. void DumpContainer() const;
  20. void DumpContainer(std::ostream& stream) const;
  21. /** Various getters **/
  22. /** key must be lower case. For example, if have in
  23. ** configuration file AaaA=90, then you should call
  24. ** GetVariableStrict("aaaa").
  25. ** If variable not found, will generate Fatal **/
  26. TString GetString(const char* key) const;
  27. Double_t GetDouble(const char* key) const;
  28. Int_t GetInteger(const char* key) const;
  29. void AddVariable(const char* key, const char* value);
  30. Bool_t Differs(const MpdNDetParam* info) const;
  31. private:
  32. /** A map containing all variables
  33. ** This variable should be saved in parameter file **/
  34. TMap fVariables;
  35. Int_t fSuccess;
  36. TString fFileName;
  37. public:
  38. /** DO NOT USE THIS UNLESS YOU ARE COMPLETELY SURE.
  39. ** key must be lower case. For example, if have in
  40. ** configuration file AaaA=90, then you should call
  41. ** GetVariableStrict("aaaa").
  42. ** If variable not found, will return -1111 **/
  43. Double_t GetDoubleSlack(const char* key) const;
  44. Int_t GetIntegerSlack(const char* key) const;
  45. TString GetStringSlack(const char* key) const;
  46. ClassDef(MpdNDetParam,1);
  47. };
  48. #endif