31#include "TApplication.h"
35int main(
int argc,
char* argv[] ) {
37 std::cout << std::endl <<
"*** Running the calibration ***" << std::endl << std::endl;
39 std::string configfile(
"");
40 TString inputfile(
"");
42 std::string parfile(
"parameters.txt");
50 for (
int i = 1; i < argc; i++){
52 std::string
arg(argv[i]);
55 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
56 else configfile = argv[++i]; }
58 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
59 else inputfile = argv[++i]; }
61 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
62 else parfile = argv[++i]; }
64 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
65 else part = atoi(argv[++i]); }
67 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
68 else ask = atoi(argv[++i]); }
70 if ((i+1 == argc) || (argv[i+1][0] ==
'-'))
arg =
"-h";
71 else saveas = argv[++i]; }
73 std::cout << std::endl <<
" Usage for: " << argv[0] << std::endl << std::endl;
74 std::cout <<
"\t -c <file>\t Configuration file" << std::endl;
75 std::cout <<
"\t -s <file>\t Save output as" << std::endl;
76 std::cout <<
"\t -f <file>\t Input file" << std::endl;
77 std::cout <<
"\t -p <file>\t Curve parameter file" << std::endl;
78 std::cout <<
"\t -t <int>\t Particle type (-1 = all)" << std::endl;
79 std::cout <<
"\t -i <int>\t Ask before each step? (0 = no, 1 = yes)" << std::endl;
84 if( configfile ==
"" && inputfile ==
"" ){
85 std::cout <<
"ERROR: No input file was given..." << std::endl;
90 std::string ready(
"y");
95 std::vector< TString > types;
96 types.push_back(
"pion");
97 types.push_back(
"kaon");
98 types.push_back(
"proton");
99 types.push_back(
"muon");
100 types.push_back(
"electron");
105 if( configfile !=
"" ){
110 std::cout <<
"No configuration file provided, ";
111 std::cout <<
"are you sure you want to use the default values (y/n)? ";
112 std::cin >> ready; std::cout << std::endl;
113 if( ready !=
"y" )
return 1;
121 bgmax[0] = 2.12/Widget::mpion;
122 bgmin[0] = 0.12/Widget::mpion;
124 bgmax[1] = 1.8/Widget::mkaon;
125 bgmin[1] = 0.35/Widget::mkaon;
127 bgmax[2] = 1.7/Widget::mproton;
128 bgmin[2] = 0.5/Widget::mproton;
130 bgmax[3] = 1.92/Widget::mmuon;
131 bgmin[3] = 1.76/Widget::mmuon;
133 bgmax[4] = 2.3/Widget::melectron;
134 bgmin[4] = 0.3/Widget::melectron;
139 for(
int i = 0; i < 4; ++i ){
149 for(
int i = 0; i < 5; ++i ){
150 if( inputfile !=
"" )
151 widget.
AddParticle(types[i],inputfile+types[i]+
".root",0.0,
152 bgbins[i],bgmax[i],bgmin[i],
153 cosbins[i],cosmax[i],cosmin[i]);
155 widget.
AddParticle(types[i],
"widget."+types[i]+
".root",0.0,
156 bgbins[i],bgmax[i],bgmin[i],
157 cosbins[i],cosmax[i],cosmin[i]);
167 std::streambuf *coutbuf = std::cout.rdbuf();
168 std::ofstream out(
"widget.log");
173 std::cout.rdbuf( out.rdbuf() );
175 std::cout.rdbuf( coutbuf );
double arg(const EvtComplex &c)
void SetParamFile(std::string paramfile)
void PlotEfficiency(TString saveas)
void SetupFromConfigFile(std::string configfile)
void AddParticle(TString particle, TString filename, int nevents, int bgbins, double upperbg, double lowerbg, int cosbins, double uppercos, double lowercos)