BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
show_event_count.cxx
Go to the documentation of this file.
1
//============================================================================
2
// Name : show_event_count.cxx
3
// Author : Konstantin Gertsenberger
4
// Copyright : JINR
5
// Description : Get event count for the generator file
6
//============================================================================
7
8
// own headers
9
#include "
MpdGetNumEvents.h
"
10
11
// ROOT includes
12
#include "
TString.h
"
13
#include "
TSystem.h
"
14
15
// C++ includes
16
#include <algorithm>
17
#include <iostream>
18
#include <sstream>
19
#include <string>
20
21
using namespace
std
;
22
23
bool
ends_with
(
string
const
& fullString,
string
const
& ending)
24
{
25
if
(fullString.length() >= ending.length())
26
return
(0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
27
else
28
return
false
;
29
}
30
31
int
main
(
int
argc,
char
** argv)
32
{
33
// help information
34
if
(argc > 1) {
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)"
40
<< endl
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;
44
45
return
0;
46
}
47
}
48
49
if
(argc != 3) {
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;
52
return
-1;
53
}
54
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];
59
60
if
(generator_name ==
"urqmd"
) {
61
cout <<
MpdGetNumEvents::GetNumURQMDEvents
(file_path.c_str(), 1);
62
return
0;
63
}
else
if
(generator_name ==
"unigen"
) {
64
cout <<
MpdGetNumEvents::GetNumROOTEvents
(file_path.c_str(),
nullptr
, 1);
65
return
0;
66
}
else
if
(
ends_with
(generator_name,
"hsd"
)) {
67
cout <<
MpdGetNumEvents::GetNumPHSDEvents
(file_path.c_str(), 1);
68
return
0;
69
}
else
if
(
ends_with
(generator_name,
"qgsm"
)) {
70
cout <<
MpdGetNumEvents::GetNumQGSMEvents
(file_path.c_str(), 1);
71
return
0;
72
}
else
if
(
ends_with
(generator_name,
"smm"
)) {
73
cout <<
MpdGetNumEvents::GetNumDCMSMMEvents
(file_path.c_str(), 1);
74
return
0;
75
}
else
if
((generator_name ==
"jam"
) || (generator_name ==
"rqmd"
)) {
76
cout <<
MpdGetNumEvents::GetNumROOTEvents
(file_path.c_str(),
"events"
, 1);
77
return
0;
78
}
else
if
(
ends_with
(generator_name,
"root"
)) {
79
cout <<
MpdGetNumEvents::GetNumROOTEvents
(file_path.c_str(),
nullptr
, 1);
80
return
0;
81
}
else
if
(generator_name ==
"auto"
) {
82
cout <<
MpdGetNumEvents::GetNumEvents
(file_path.c_str(), 1);
83
return
0;
84
}
else
{
85
cout <<
"The generator name (or 'root' value) is not defined. See possible values: show_event_count /?"
;
86
return
-2;
87
}
88
89
return
0;
90
}
TString.h
TSystem.h
MpdGetNumEvents::GetNumROOTEvents
static Int_t GetNumROOTEvents(const char *filename, const char *treename="", int iVerbose=2)
Definition
MpdGetNumEvents.cxx:511
MpdGetNumEvents::GetNumPHSDEvents
static Int_t GetNumPHSDEvents(const char *filename, int iVerbose=2)
Definition
MpdGetNumEvents.cxx:146
MpdGetNumEvents::GetNumQGSMEvents
static Int_t GetNumQGSMEvents(const char *fileName, int iVerbose=2)
Definition
MpdGetNumEvents.cxx:311
MpdGetNumEvents::GetNumEvents
static Int_t GetNumEvents(const char *filename, int iVerbose=2)
Definition
MpdGetNumEvents.cxx:545
MpdGetNumEvents::GetNumURQMDEvents
static Int_t GetNumURQMDEvents(const char *fileName, int iVerbose=2)
Definition
MpdGetNumEvents.cxx:357
MpdGetNumEvents::GetNumDCMSMMEvents
static Int_t GetNumDCMSMMEvents(const char *fileName, int iVerbose=2)
Definition
MpdGetNumEvents.cxx:419
MpdGetNumEvents.h
std
Definition
json.hpp:4446
ends_with
bool ends_with(string const &fullString, string const &ending)
Definition
show_event_count.cxx:23
main
int main(void)
Definition
test_FC.cpp:33
generators
show_event_count.cxx
Generated on
for BmnRoot by
1.17.0