29 "enable trimmed trees");
33 "enable trimmed histograms");
37 po::value<string>()->default_value(
"tree_trim.in"),
38 "trimmed tree file name"
45 po::value<string>()->default_value(
"parity_hist.in"),
46 "trimmed histo file name"
68 if (options.
HasValue(
"tree-trim-file"))
70 if (options.
HasValue(
"histo-trim-file"))
86 if (tmptype !=
"TH1F" && tmptype !=
"TH2F"
87 && tmptype !=
"TProfile" && tmptype !=
"TProfile2D"){
88 QwError <<
"QwHistogramHelper::GetHistParamsFromFile: Unrecognized histogram type: "
89 << tmptype <<
" (tmpname==" << tmpname <<
")"<<
QwLog::endl;
93 tmpstruct.
type = tmptype;
97 if (tmptype ==
"TH2F") {
101 }
else if (tmptype ==
"TProfile") {
107 tmpstruct.
y_min = 0.0;
108 tmpstruct.
y_max = 0.0;
114 if (tmpmin.find_first_not_of(
"-+1234567890.eE") == std::string::npos) {
116 tmpstruct.
min = atof(tmpmin.c_str());
121 if (tmpmax.find_first_not_of(
"-+1234567890.eE") == std::string::npos) {
123 tmpstruct.
max = atof(tmpmax.c_str());
168 for (std::vector<HistParams>::const_iterator h =
fHistParams.begin();
179 TString subsystemname;
182 std::vector<TString> TrimmedList;
183 std::vector<std::vector<TString> > ModulebyTrimmedList;
184 std::vector<TString> ModuleList;
198 if (subsystemname==
"DEVICELIST")
204 ModulebyTrimmedList.clear();
207 ModuleList.push_back(moduletype);
214 devicename=(module->
GetLine()).c_str();
215 TrimmedList.push_back(devicename);
220 ModulebyTrimmedList.push_back(TrimmedList);
235 devicename=(section->
GetLine()).c_str();
236 fTreeParams.push_back(std::pair<TString,TRegexp>(devicename,devicename));
252 std::vector<int> matches;
257 tmpstruct = matchstruct;
259 matches.push_back(i);
261 }
else if (tmpstruct.
nbins == matchstruct.
nbins
262 && tmpstruct.
min == matchstruct.
min
263 && tmpstruct.
max == matchstruct.
max
276 if (matches.size() > 1) {
278 for (
size_t i = 0; i < matches.size(); i++) {
289 std::cerr <<
"GetHistParamsFromList: We haven't found a match of the histogram name: "
290 << histname << std::endl;
291 std::cerr <<
" Please check the input file "
326 const std::string& subsystemname,
327 const std::string& moduletype,
328 const std::string& elementname)
339 for (
size_t i = 0; i <
fModuleList.at(j).size(); i++) {
360 QwWarning <<
"Multiple identical matches for element name " <<elementname <<
":" <<
QwLog::endl;
370 const std::string& filename,
371 const TString& histname)
382 while (mapstr.ReadNextLine()) {
384 mapstr.TrimWhitespace();
385 if (mapstr.LineIsEmpty())
continue;
387 TString tmpname = mapstr.GetTypedNextToken<TString>();
388 TString tmptype = mapstr.GetTypedNextToken<TString>();
389 if (tmptype !=
"TH1F" && tmptype !=
"TH2F") {
390 QwError <<
"QwHistogramHelper::GetHistParamsFromFile: Unrecognized histogram type: "
391 << tmptype <<
" (tmpname==" << tmpname <<
")"<<
QwLog::endl;
397 mapstr.RewindToLineStart();
407 QwError <<
"GetHistParamsFromFile: We haven't found a match of the histogram name: "
409 QwError <<
" Please check the input file "
423 static Ssiz_t len = 0;
424 if (wildcard.Index(s,&len) == 0 && len == s.Length()) {
507 Double_t(params.
x_min),Double_t(params.
x_max));
508 h1->SetXTitle(params.
xtitle);
509 h1->SetYTitle(params.
ytitle);
527 Double_t(params.
x_min),Double_t(params.
x_max),
529 Double_t(params.
y_min),Double_t(params.
y_max));
530 h2->SetXTitle(params.
xtitle);
531 h2->SetYTitle(params.
ytitle);
549 Double_t(params.
x_min),Double_t(params.
x_max),
550 Double_t(params.
y_min),Double_t(params.
y_max));
551 h1->SetMinimum(params.
y_min);
552 h1->SetMaximum(params.
y_max);
553 h1->SetXTitle(params.
xtitle);
554 h1->SetYTitle(params.
ytitle);
570 Double_t(params.
x_min),Double_t(params.
x_max),
572 Double_t(params.
y_min),Double_t(params.
y_max),
573 Double_t(params.
z_min),Double_t(params.
z_max));
574 h2->SetMinimum(params.
z_min);
575 h2->SetMaximum(params.
z_max);
576 h2->SetXTitle(params.
xtitle);
577 h2->SetYTitle(params.
ytitle);
static const Double_t fInvalidNumber
#define QwMessage
Predefined log drain for regular messages.
#define default_bool_value(b)
Histogram parameter class.
static void DefineOptions(QwOptions &options)
Define the configuration options.
bool HasValue(const std::string &key)
Has this key been defined.
const HistParams GetHistParamsFromList(const TString &histname)
const HistParams GetHistParamsFromLine(QwParameterFile &mapstr)
TH2F * Construct2DHist(const TString &inputfile, const TString &name_title)
void TrimComment(const char commentchar)
void LoadTreeParamsFromFile(const std::string &filename)
void PrintHistParams() const
std::vector< std::pair< TString, TRegexp > > fTreeParams
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
TProfile2D * Construct2DProf(const TString &name_title)
void ProcessOptions(QwOptions &options)
Process the configuration options.
T GetValue(const std::string &key)
Get a templated value.
std::vector< TString > fSubsystemList
Bool_t MatchDeviceParamsFromList(const std::string &devicename)
QwParameterFile * ReadNextModule(std::string &secname, bool keep_header=false)
A logfile class, based on an identical class in the Hermes analyzer.
Bool_t MatchVQWKElementFromList(const std::string &subsystemname, const std::string &moduletype, const std::string &devicename)
static const TString fInvalidName
Bool_t fTreeTrimFileLoaded
std::vector< std::vector< std::vector< TString > > > fVQWKTrimmedList
std::vector< HistParams > fHistParams
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
std::vector< std::vector< TString > > fModuleList
const HistParams GetHistParamsFromFile(const std::string &filename, const TString &histname)
static std::ostream & endl(std::ostream &)
End of the line.
Bool_t DoesMatch(const TString &s, const TRegexp &wildcard)
T GetTypedNextToken()
Get next token into specific type.
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
#define QwWarning
Predefined log drain for warnings.
TH1F * Construct1DHist(const TString &inputfile, const TString &name_title)
void LoadHistParamsFromFile(const std::string &filename)
#define QwError
Predefined log drain for errors.
TProfile * Construct1DProf(const TString &name_title)