KaliVeda
Toolkit for HIC analysis
KVDBParameterSet.cpp
1 /***************************************************************************
2 $Id: KVDBParameterSet.cpp,v 1.11 2007/04/18 14:30:20 ebonnet Exp $
3  KVDBParameterSet.cpp - description
4  -------------------
5  begin : jeu fév 13 2003
6  copyright : (C) 2003 by Alexis Mignon
7  email : mignon@ganil.fr
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #include "KVDBParameterSet.h"
19 #include <cstdarg>
20 #include <iostream>
21 #include "TString.h"
22 #include "TBuffer.h"
23 using std::cout;
24 using std::endl;
25 
27 
28 //___________________________________________________________________________
29 
31 
33 {
34  fParamNumber = 0;
35 }
36 
37 
38 
44 
46  const TString& title,
47  UShort_t pnum): KVDBRecord(name, title)
48 {
49  //Initialise a KVDBRecord for a set of "pnum" parameters.
50  //The names of the parameters are "par_1", "par_2", etc.
51  //The KVDBKey "Runs" is initialised to cross-reference the runs for which
52  //this set of parameters is valid.
53  fParamNumber = pnum;
54  for (UInt_t i = 0; i < pnum; i++) {
55  fParameters.SetValue(Form("par_%u", i + 1), 0.0);
56  }
57  AddKey("Runs", "List of Runs");
58  //Unique not used because it makes the setting up of the list horribly slow
59  // if(key) key->SetUniqueStatus(kTRUE);
60 }
61 
62 
63 
65 
66 KVDBParameterSet::~KVDBParameterSet()
67 {
68 }
69 
70 
71 
73 
74 void KVDBParameterSet::SetParameters(const std::vector<Double_t>& pars)
75 {
76  assert(pars.size() <= static_cast<UInt_t>(fParamNumber));
77 
78  UInt_t arg_n(0);
79  std::vector<Double_t>::const_iterator it;
80  for (auto p : pars) {
81  SetParameter(arg_n, p);
82  ++arg_n;
83  }
84 }
85 
86 
87 
89 
91 {
93 }
94 
95 
96 
98 
100 {
102 }
103 
104 
105 
107 
109 {
111 }
112 
113 
114 
116 
118 {
119  fParameters.SetValue(name, val);
120 }
121 
122 
123 
125 
126 void KVDBParameterSet::SetParameter(const TString& name, const TString& value)
127 {
129 }
130 
131 
132 
135 
136 void KVDBParameterSet::SetParamNames(const std::vector<TString>& name_list)
137 {
138  // Set names of numerical parameters using given list
139 
140  if(name_list.size() > fParamNumber)
141  {
142  TString concat_names;
143  for(auto& n : name_list)
144  {
145  if(concat_names.Length()) concat_names+=",";
146  concat_names+=n;
147  }
148  Warning("SetParamNames", "Too many names (%lu) given for %d parameter function: %s",
149  name_list.size(), fParamNumber, concat_names.Data());
150  return;
151  }
152  int arg_n = 0;
153  for(auto& n : name_list)
154  {
155  SetParamName(arg_n, n);
156  arg_n++;
157  }
158 }
159 
160 
161 
163 
165 {
167  cout << ">>>> KVParameterSet :" << endl
168  << GetName() << " " << GetTitle() << endl
169  << " Parameters :\t" << GetParamNumber() << endl;
170  fParameters.Print();
171  cout << endl << "<<<<<<<<<<" << endl;
172 }
173 
174 
unsigned int UInt_t
unsigned short UShort_t
double Double_t
const char Option_t
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
char * Form(const char *fmt,...)
To store calibration parameters in a database ,.
TString GetStringParameter(const TString &name) const
void SetParameters(const std::vector< Double_t > &pars)
void SetParamNames(const std::vector< TString > &name_list)
Set names of numerical parameters using given list.
Double_t GetParameter(UShort_t i=0) const
void SetParamName(UShort_t i, const TString &name)
void Print(Option_t *option="") const override
KVNameValueList fParameters
parameters
Int_t GetParamNumber() const
void SetParameter(UShort_t i, Double_t val)
Record folder for the database.
Definition: KVDBRecord.h:43
void Print(Option_t *option="") const override
Definition: KVDBRecord.cpp:222
virtual Bool_t AddKey(KVDBKey *key, Bool_t check=kTRUE)
Definition: KVDBRecord.cpp:65
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
void Print(Option_t *opt="") const override
TString GetTStringValue(const Char_t *name) const
const char * GetName() const override
const char * GetTitle() const override
virtual void SetName(const char *name)
virtual void Warning(const char *method, const char *msgfmt,...) const
Ssiz_t Length() const
const char * Data() const
const Int_t n
ClassImp(TPyArg)