CbmRoot
CbmStsParSetModule.cxx
Go to the documentation of this file.
1 
5 #include "CbmStsParSetModule.h"
6 
7 #include "CbmStsParModule.h" // for CbmStsParModule
8 
9 #include <FairLogger.h> // for LOG, Logger
10 
11 #include <cassert> // for assert
12 #include <sstream> // for operator<<, basic_ostream, stringstream
13 #include <string> // for char_traits
14 
16 
17  // ----- Constructor ----------------------------------------------------
19  const char* title,
20  const char* context)
21  : FairParGenericSet(name, title, context) {}
22 // --------------------------------------------------------------------------
23 
24 
25 // ----- Destructor -----------------------------------------------------
27 // --------------------------------------------------------------------------
28 
29 
30 // ----- Reset ----------------------------------------------------------
32  fUseGlobal = kFALSE;
33  fParams.clear();
34  status = kFALSE;
35  resetInputVersions();
36 }
37 // --------------------------------------------------------------------------
38 
39 
40 // ----- Read parameters from ASCII file --------------------------------
41 Bool_t CbmStsParSetModule::getParams(FairParamList*) {
42  LOG(fatal) << GetName() << ": ASCII input is not defined!";
43  return kFALSE;
44 }
45 // --------------------------------------------------------------------------
46 
47 
48 // ----- Get condition parameters of a sensor ---------------------------
50  if (fUseGlobal) return fGlobalParams;
51  assert(fParams.count(address));
52  return fParams[address];
53 }
54 // --------------------------------------------------------------------------
55 
56 
57 // ----- Write parameters from ASCII file -------------------------------
58 void CbmStsParSetModule::putParams(FairParamList*) {
59  LOG(fatal) << GetName() << ": ASCII output is not defined!";
60 }
61 // --------------------------------------------------------------------------
62 
63 
64 // ----- Info to string ------------------------------------------------
65 std::string CbmStsParSetModule::ToString() const {
66  std::stringstream ss;
67  if (fUseGlobal)
68  ss << "(Global) " << fGlobalParams.ToString();
69  else {
70  if (fParams.empty())
71  ss << "Empty";
72  else
73  ss << "Parameters for " << fParams.size() << " sensors";
74  }
75  return ss.str();
76 }
77 // -------------------------------------------------------------------------
CbmStsParSetModule::fGlobalParams
CbmStsParModule fGlobalParams
Global parameters, used for all modules.
Definition: CbmStsParSetModule.h:115
CbmStsParSetModule::fParams
std::map< UInt_t, CbmStsParModule > fParams
Map of parameters. Key is sensor address.
Definition: CbmStsParSetModule.h:118
ClassImp
ClassImp(CbmStsParSetModule) CbmStsParSetModule
Definition: CbmStsParSetModule.cxx:15
CbmStsParSetModule::~CbmStsParSetModule
virtual ~CbmStsParSetModule()
Destructor.
Definition: CbmStsParSetModule.cxx:26
CbmStsParSetModule::GetParModule
const CbmStsParModule & GetParModule(UInt_t address)
Get condition parameters of a sensor.
Definition: CbmStsParSetModule.cxx:49
CbmStsParSetModule.h
CbmStsParSetModule::ToString
std::string ToString() const
Info to string.
Definition: CbmStsParSetModule.cxx:65
CbmStsParSetModule::clear
virtual void clear()
Reset all parameters.
Definition: CbmStsParSetModule.cxx:31
CbmStsParModule
Parameters for one STS module.
Definition: CbmStsParModule.h:28
CbmStsParModule.h
CbmStsParSetModule::putParams
virtual void putParams(FairParamList *parList)
Writing parameters to ASCII. Abstract in base class.
Definition: CbmStsParSetModule.cxx:58
CbmStsParSetModule::getParams
virtual Bool_t getParams(FairParamList *parList)
Reading parameters from ASCII. Abstract in base class.
Definition: CbmStsParSetModule.cxx:41
CbmStsParModule::ToString
std::string ToString() const
String output.
Definition: CbmStsParModule.cxx:59
CbmStsParSetModule
Parameters container for CbmStsParModule.
Definition: CbmStsParSetModule.h:30
CbmStsParSetModule::fUseGlobal
Bool_t fUseGlobal
Flag for using global parameters.
Definition: CbmStsParSetModule.h:112
CbmStsParSetModule::CbmStsParSetModule
CbmStsParSetModule(const char *name="CbmParSetModule", const char *title="STS parameters", const char *context="Default")
Constructor.