1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #include <iostream>
- #include <fstream>
- #include <TStopwatch.h>
- #include <TString.h>
- #include <TFile.h>
- #include <TH1F.h>
- #include "fmcTypes.h"
- #include "fmcFunctions.cxx"
- int main(int argc, char **argv)
- {
- TString inFileName, outFileName;
- if (argc < 5)
- {
- std::cerr << "./calcMult -i input -o output" << std::endl;
- return 10;
- }
- for (int i = 1; i < argc; i++)
- {
- if (std::string(argv[i]) != "-i" &&
- std::string(argv[i]) != "-o")
- {
- std::cerr << "\ncalcMult: Unknown parameter " << i
- << ": " << argv[i] << std::endl;
- return 11;
- }
- else
- {
- if (std::string(argv[i]) == "-i" && i != argc - 1)
- {
- inFileName = argv[++i];
- }
- if (std::string(argv[i]) == "-i" && i == argc - 1)
- {
- std::cerr << "\ncalcMult: Input file name was not specified!" << std::endl;
- return 20;
- }
- if (std::string(argv[i]) == "-o" && i != argc - 1)
- {
- outFileName = argv[++i];
- }
- if (std::string(argv[i]) == "-o" && i == argc - 1)
- {
- std::cerr << "\ncalcMult: Output file name was not specified!" << std::endl;
- return 21;
- }
- }
- }
- TFile *fi = new TFile(inFileName.Data(),"read");
- if (fi->IsZombie()) return 1;
- TH1I *histSTAR = (TH1I*) fi->Get("hRefMultSTAR");
- TH1I *histPHENIX = (TH1I*) fi->Get("hRefMultPHENIX");
- if (!histSTAR || !histPHENIX){
- std::cerr << "Error: histogram was not found!" << std::endl;
- return 2;
- }
- std::cout << std::endl;
- std::cout << "STAR-like refMult" << std::endl;
- fmc::Lim limSTAR = fmc::CentralityBorders(histSTAR,1.);
- std::cout << std::endl;
- std::cout << "PHENIX-like refMult" << std::endl;
- fmc::Lim limPHENIX = fmc::CentralityBorders(histPHENIX,0.93);
- std::ofstream file(outFileName.Data());
- file << "STAR" << std::endl;
- for (int i=0; i<limSTAR.L.size(); i++)
- {
- file << limSTAR.L.at(i) << " " << limSTAR.H.at(i) << std::endl;
- }
- file << "PHENIX" << std::endl;
- for (int i=0; i<limPHENIX.L.size(); i++)
- {
- file << limPHENIX.L.at(i) << " " << limPHENIX.H.at(i) << std::endl;
- }
- return 0;
- }
|