23 const string myname =
"test_DataMap: ";
25 cout << myname <<
"NDEBUG must be off." <<
endl;
28 string line =
"-----------------------------";
30 cout << myname << line <<
endl;
31 cout << myname <<
"Creating failed result." <<
endl;
37 cout << myname << line <<
endl;
38 cout << myname <<
"Creating success data." <<
endl;
42 cout << myname << line <<
endl;
43 cout << myname <<
"Add int." <<
endl;
45 assert( ! res.
haveInt(
"myint") );
48 assert( ! res.
haveInt(
"nosuch") );
51 assert( res.
getInt(
"nosuch") == 0 );
52 assert( res.
getInt(
"myint") == 123 );
58 assert( res.
getInt(
"myint") == 456 );
61 cout << myname << line <<
endl;
62 cout << myname <<
"Add int vector." <<
endl;
66 myintvec.push_back(1);
67 myintvec.push_back(2);
68 myintvec.push_back(3);
82 cout << myname << line <<
endl;
83 cout << myname <<
"Add float." <<
endl;
90 assert( res.
getFloat(
"myflt") == fltval );
97 cout << myname << line <<
endl;
98 cout << myname << line <<
endl;
99 cout << myname <<
"Add float vector." <<
endl;
100 std::vector<float> flts;
101 flts.push_back(1.234);
102 flts.push_back(12.34);
103 flts.push_back(123.4);
116 cout << myname << line <<
endl;
117 cout << myname <<
"Add histogram." <<
endl;
118 TH1* ph = (TH1*) 0xdeadbeef;
123 assert( res.
getHist(
"myhst") == ph );
131 cout << myname << line <<
endl;
132 cout << myname <<
"Add histogram vector." <<
endl;
133 std::vector<TH1*> hsts = { (TH1*) 0xdeadbee1, (TH1*) 0xdeadbee2, (TH1*) 0xdeadbee3 };
149 cout << myname << line <<
endl;
150 cout << myname <<
"Add graph." <<
endl;
151 TGraph* pg =
new TGraph;
155 assert( res.
getGraph(
"mygrf") == pg );
164 cout << myname << line <<
endl;
165 cout << myname << line <<
endl;
166 cout << myname <<
"Extend data map." <<
endl;
168 TH1* ph2 = (TH1*) 0xdeadbee5;
169 std::vector<TH1*> hsts2 = { (TH1*) 0xdeadbee6, (TH1*) 0xdeadbee7 };
170 res2.
setInt(
"myint", 135);
171 res2.
setInt(
"myint2", 578);
172 float fltval2 = 5.78;
182 assert( res.
getInt(
"myint") == 135 );
183 assert( res.
getInt(
"myint2") == 578 );
184 assert( res.
getFloat(
"myflt") == fltval );
185 assert( res.
getFloat(
"myflt2") == fltval2 );
186 assert( res.
getHist(
"myhst") == ph );
187 assert( res.
getHist(
"myhst2") == ph2 );
192 cout << myname << line <<
endl;
193 cout << myname <<
"Done." <<
endl;
void setFloat(Name name, float val)
const IntVectorMap & getIntVectorMap() const
bool haveHist(Name name) const
bool haveInt(Name name) const
const IntVector & getIntVector(Name name) const
TGraph * getGraph(Name name) const
void setHist(Name name, TH1 *ph, bool own=false)
const FloatVector & getFloatVector(Name name) const
void print(std::ostream *pout) const
std::vector< int > IntVector
const FloatVectorMap & getFloatVectorMap() const
const HistVector & getHistVector(Name name) const
void setIntVector(Name name, const IntVector &val)
void setHistVector(Name name, const HistVector &hsts, bool own=false)
void extend(const DataMap &rhs)
const GraphMap & getGraphMap() const
const IntMap & getIntMap() const
void setInt(Name name, int val)
const FloatMap & getFloatMap() const
Float getFloat(Name name, Float def=0.0) const
const HistVectorMap & getHistVectorMap() const
int getInt(Name name, int def=0) const
bool haveFloat(Name name) const
void line(double t, double *p, double &x, double &y, double &z)
bool haveGraph(Name name) const
void setGraph(Name name, TGraph *pg)
TH1 * getHist(Name name, TH1 *def=nullptr) const
bool haveHistVector(Name name) const
void setFloatVector(Name name, const FloatVector &val)
const HistMap & getHistMap() const
bool haveFloatVector(Name name) const
bool haveIntVector(Name name) const
QTextStream & endl(QTextStream &s)