23bool ends_with(
string const& fullString,
string const& ending)
25 if (fullString.length() >= ending.length())
26 return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
31int main(
int argc,
char** argv)
35 string first_par = argv[1];
36 if ((first_par ==
"/?") || (first_par ==
"--help") || (first_par ==
"-h")) {
37 cout <<
"The utility shows event count for a given generator file or just ROOT file" << endl
38 <<
"The first parameter: case-insensitive generator name (urqmd, hsd (phsd), qgsm (laqgsm,dcm-gsqm) "
39 "or 'root' value (w/o quotes)"
41 <<
"The second parameter: generator file path" << endl
42 <<
"Example: show_event_count dcmqgsm /eos/nica/bmn/sim/DQGSM/" << endl
43 <<
"Example: show_event_count root example.root" << endl;
50 cout <<
"The ShowEventCount utility takes 2 parameters: " << endl
51 <<
"1st - generator name or 'root' value (w/o quotes); 2nd - generator or ROOT file path" << endl;
55 string generator_name = argv[1];
56 transform(generator_name.begin(), generator_name.end(), generator_name.begin(),
57 [](
unsigned char c) { return tolower(c); });
58 string file_path = argv[2];
60 if (generator_name ==
"urqmd") {
63 }
else if (
ends_with(generator_name,
"hsd")) {
66 }
else if (
ends_with(generator_name,
"qgsm")) {
69 }
else if (
ends_with(generator_name,
"smm")) {
72 }
else if ((generator_name ==
"jam") || (generator_name ==
"rqmd")) {
75 }
else if (
ends_with(generator_name,
"root")) {
78 }
else if (generator_name ==
"auto") {
82 cout <<
"The generator name (or 'root' value) is not defined. See possible values: show_event_count /?";
static Int_t GetNumROOTEvents(const char *filename, const char *treename="", int iVerbose=2)
static Int_t GetNumPHSDEvents(const char *filename, int iVerbose=2)
static Int_t GetNumQGSMEvents(const char *fileName, int iVerbose=2)
static Int_t GetNumEvents(const char *filename, int iVerbose=2)
static Int_t GetNumURQMDEvents(const char *fileName, int iVerbose=2)
static Int_t GetNumDCMSMMEvents(const char *fileName, int iVerbose=2)
bool ends_with(string const &fullString, string const &ending)