24 if (jamesbrown == 0) jamesbrown =
new HistoTable();
25 if (f != 0) jamesbrown->
ReadFile(f, d);
36 if ( (*s.begin())==
'"' && (*s.rbegin()==
'"') ) {
38 ss = s.substr(1,s.length()-2);
52 std::ifstream
file(f);
54 getline(file, linux_line,
'\n');
63 std::ifstream
file(f);
65 getline(file, windows_line,
'\r');
69 if (windows_line.length() < linux_line.length())
return '\r';
102 std::ifstream
file(f);
103 bool haveheader =
false;
104 while (file.good()) {
105 getline(file, name,
',');
106 getline(file, title,
',');
107 getline(file, category,
',');
108 getline(file, type,
',');
109 getline(file, nx,
',');
110 getline(file, x1,
',');
111 getline(file, x2,
',');
112 getline(file, ny,
',');
113 getline(file, y1,
',');
114 getline(file, y2,
',');
115 getline(file, option,
',');
116 getline(file, detector,
',');
117 getline(file, reset,
',');
118 getline(file, lookback,
',');
119 getline(file, caption, newline);
148 if (name ==
"Name" &&
150 category ==
"Category" &&
158 option ==
"Option" &&
159 detector ==
"Detector" &&
161 lookback ==
"Look back" &&
162 caption ==
"Caption") {
163 if (haveheader==
false) {
177 h.
fNx = atoi(nx.c_str());
178 h.
fX1 = atof(x1.c_str());
179 h.
fX2 = atof(x2.c_str());
181 h.
fNy = atoi(ny.c_str());
182 h.
fY1 = atof(y1.c_str());
183 h.
fY2 = atof(y2.c_str());
186 const char* detstr[] = {
"all",
"test",
"far",
"near",
"NDOS",0};
188 for (i=0; detstr[
i]!=0; ++
i) {
189 if (detector==detstr[i]) { h.
fDetector = detind[
i];
break; }
193 const char* typestr[] = {
"TH1F",
"TH2F",0};
195 for (i=0; typestr[
i]!=0; ++
i) {
196 if (type==typestr[i]) { h.
fType = typeind[
i];
break; }
199 const char* rstr[] = {
212 unsigned int rind[] = {
224 for (i=0; rstr[
i]!=0; ++
i) {
225 if (reset==rstr[i]) { h.
fReset = rind[
i];
break; }
233 bool iswildcard = (name.find(
'*')!=name.npos);
243 std::stringstream
cat(category);
246 getline(cat, c,
':');
251 std::stringstream
opt(option);
254 getline(opt, o,
':');
262 std::cerr << __FILE__ <<
":" << __LINE__ <<
263 " Bad entry at line " << lineno <<
" in file " << f <<
std::endl;
276 std::cerr <<
"Duplicate entries for histogram " 282 if (haveheader==
false) {
284 <<
" Bad csv file read " << f
285 <<
". Header has incorrect format." 298 std::map<std::string,HistoData>::const_iterator itr(
fTable.find(nm));
299 if (itr!=
fTable.end())
return (&itr->second);
305 unsigned int nmatch = 0;
307 std::map<std::string,HistoData>::const_iterator
i(
fTable.begin());
308 std::map<std::string,HistoData>::const_iterator
e(
fTable.end());
318 if (nmatch==1)
return hd;
324 std::cerr <<
"Match to histogram " << nm <<
" is not unique, nmatch=" 338 std::cerr << __FILE__ <<
" " << __LINE__ <<
": " double fX1
Low edge of x range.
unsigned int fLookBack
How many copies to save in history.
std::vector< std::string > fCategory
Categories this hist. belongs to.
char NewLineChar(const char *f)
const HistoData * LookUp(const char *nm) const
Float_t y1[n_points_granero]
Float_t x1[n_points_granero]
static constexpr Double_t nm
std::string fCaption
What does this histogram show?
std::string fTitle
Titles for histogram.
int fNx
Number of bins in x.
Base class for subscribers to ticker updates.
Class to read, hold, and deliver histogram data.
std::vector< std::string > fOption
Booking/drawing options.
void ReadFile(const char *file, Detector_t d)
double fY2
High edge of y range.
std::string fName
C++ name of this histogram.
double fX2
High edge of x range.
const HistoData & operator[](const char *nm) const
Histo_t fType
What kind of histogram is this?
int regex_match(const std::string &s, const std::string &p)
std::map< std::string, HistoData > fTable
Histogram data by C++ name.
double fNy
Number of bins in y.
Detector_t fDetector
Detector these settings apply to.
static HistoTable & Instance(const char *f=0, Detector_t d=kALLDET)
unsigned int fReset
Reset schedule (see TickerSubscriber.h)
double fY1
Low edge of y range.
enum om::_det_types Detector_t
void Unquote(std::string &s)
Online Monitoring package header.
enum om::_histo_types Histo_t