28 (
"enable-tree-trim", po::value<bool>()->default_bool_value(
false),
29 "enable trimmed trees");
32 (
"enable-histo-trim", po::value<bool>()->default_bool_value(
false),
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"
70 if (options.
HasValue(
"tree-trim-file"))
72 if (options.
HasValue(
"histo-trim-file"))
88 if (tmptype !=
"TH1F" && tmptype !=
"TH2F"
89 && tmptype !=
"TProfile" && tmptype !=
"TProfile2D"){
90 QwError <<
"QwHistogramHelper::GetHistParamsFromFile: Unrecognized histogram type: "
91 << tmptype <<
" (tmpname==" << tmpname <<
")"<<
QwLog::endl;
95 tmpstruct.
type = tmptype;
99 if (tmptype ==
"TH2F") {
103 }
else if (tmptype ==
"TProfile") {
109 tmpstruct.
y_min = 0.0;
110 tmpstruct.
y_max = 0.0;
116 if (tmpmin.find_first_not_of(
"-+1234567890.eE") == std::string::npos) {
118 tmpstruct.
min = atof(tmpmin.c_str());
123 if (tmpmax.find_first_not_of(
"-+1234567890.eE") == std::string::npos) {
125 tmpstruct.
max = atof(tmpmax.c_str());
170 for (std::vector<HistParams>::const_iterator h =
fHistParams.begin();
181 TString subsystemname;
182 std::unique_ptr<QwParameterFile> section =
nullptr;
183 std::unique_ptr<QwParameterFile> module =
nullptr;
184 std::vector<TString> TrimmedList;
185 std::vector<std::vector<TString> > ModulebyTrimmedList;
186 std::vector<TString> ModuleList;
200 if (subsystemname==
"DEVICELIST")
206 ModulebyTrimmedList.clear();
207 while ( (module=section->ReadNextModule(moduletype)) ){
209 ModuleList.push_back(moduletype);
212 while (module->ReadNextLine()){
213 module->TrimComment('#');
214 module->TrimWhitespace();
215 if (module->LineIsEmpty())
continue;
216 devicename=(
module->GetLine()).c_str();
217 TrimmedList.push_back(devicename);
222 ModulebyTrimmedList.push_back(TrimmedList);
233 while (section->ReadNextLine()){
234 section->TrimComment(
'#');
235 section->TrimWhitespace();
236 if (section->LineIsEmpty())
continue;
237 devicename=(section->GetLine()).c_str();
238 fTreeParams.push_back(std::pair<TString,TRegexp>(devicename,devicename));
254 std::vector<int> matches;
259 tmpstruct = matchstruct;
261 matches.push_back(i);
263 }
else if (tmpstruct.
nbins == matchstruct.
nbins
264 && tmpstruct.
min == matchstruct.
min
265 && tmpstruct.
max == matchstruct.
max
278 if (matches.size() > 1) {
280 for (
size_t i = 0; i < matches.size(); i++) {
291 std::cerr <<
"GetHistParamsFromList: We haven't found a match of the histogram name: "
292 << histname << std::endl;
293 std::cerr <<
" Please check the input file "
328 const std::string& subsystemname,
329 const std::string& moduletype,
330 const std::string& elementname)
341 for (
size_t i = 0; i <
fModuleList.at(j).size(); i++) {
362 QwWarning <<
"Multiple identical matches for element name " <<elementname <<
":" <<
QwLog::endl;
372 const std::string& filename,
373 const TString& histname)
391 if (tmptype !=
"TH1F" && tmptype !=
"TH2F") {
392 QwError <<
"QwHistogramHelper::GetHistParamsFromFile: Unrecognized histogram type: "
393 << tmptype <<
" (tmpname==" << tmpname <<
")"<<
QwLog::endl;
409 QwError <<
"GetHistParamsFromFile: We haven't found a match of the histogram name: "
411 QwError <<
" Please check the input file "
425 static Ssiz_t len = 0;
426 if (wildcard.Index(s,&len) == 0 && len == s.Length()) {
509 Double_t(params.
x_min),Double_t(params.
x_max));
510 h1->SetXTitle(params.
xtitle);
511 h1->SetYTitle(params.
ytitle);
529 Double_t(params.
x_min),Double_t(params.
x_max),
531 Double_t(params.
y_min),Double_t(params.
y_max));
532 h2->SetXTitle(params.
xtitle);
533 h2->SetYTitle(params.
ytitle);
551 Double_t(params.
x_min),Double_t(params.
x_max),
552 Double_t(params.
y_min),Double_t(params.
y_max));
553 h1->SetMinimum(params.
y_min);
554 h1->SetMaximum(params.
y_max);
555 h1->SetXTitle(params.
xtitle);
556 h1->SetYTitle(params.
ytitle);
572 Double_t(params.
x_min),Double_t(params.
x_max),
574 Double_t(params.
y_min),Double_t(params.
y_max),
575 Double_t(params.
z_min),Double_t(params.
z_max));
576 h2->SetMinimum(params.
z_min);
577 h2->SetMaximum(params.
z_max);
578 h2->SetXTitle(params.
xtitle);
579 h2->SetYTitle(params.
ytitle);
A logfile class, based on an identical class in the Hermes analyzer.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
Helper functions and utilities for ROOT histogram management.
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
Utility class for histogram creation and management.
void PrintHistParams() const
void LoadHistParamsFromFile(const std::string &filename)
std::vector< HistParams > fHistParams
std::vector< TString > fSubsystemList
static const TString fInvalidName
const HistParams GetHistParamsFromFile(const std::string &filename, const TString &histname)
const HistParams GetHistParamsFromList(const TString &histname)
std::vector< std::vector< std::vector< TString > > > fVQWKTrimmedList
void LoadTreeParamsFromFile(const std::string &filename)
Bool_t MatchVQWKElementFromList(const std::string &subsystemname, const std::string &moduletype, const std::string &devicename)
std::vector< std::vector< TString > > fModuleList
static const Double_t fInvalidNumber
static void DefineOptions(QwOptions &options)
Define the configuration options.
Bool_t fTreeTrimFileLoaded
TProfile * Construct1DProf(const TString &name_title)
const HistParams GetHistParamsFromLine(QwParameterFile &mapstr)
Bool_t MatchDeviceParamsFromList(const std::string &devicename)
TProfile2D * Construct2DProf(const TString &name_title)
void ProcessOptions(QwOptions &options)
Process the configuration options.
TH1F * Construct1DHist(const TString &inputfile, const TString &name_title)
std::vector< std::pair< TString, TRegexp > > fTreeParams
Bool_t DoesMatch(const TString &s, const TRegexp &wildcard)
TH2F * Construct2DHist(const TString &inputfile, const TString &name_title)
Histogram parameter class.
static std::ostream & endl(std::ostream &)
End of the line.
Command-line and configuration file options processor.
T GetValue(const std::string &key)
Get a templated value.
bool HasValue(const std::string &key)
Has this key been defined.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Configuration file parser with flexible tokenization and search capabilities.
T GetTypedNextToken()
Get next token into specific type.
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
void TrimComment(const char commentchar)
std::unique_ptr< QwParameterFile > ReadNextSection(std::string &secname, const bool keep_header=false)