File indexing completed on 2024-04-06 11:56:22
0001 #include <iostream>
0002 #include <vector>
0003 #include "string"
0004 #include "TROOT.h"
0005 #include "TString.h"
0006 #include "plotter.C"
0007
0008 using namespace std;
0009
0010 void splitOption(string rawoption, string& wish, string& value, char delimiter){
0011 size_t posEq = rawoption.find(delimiter);
0012 if (posEq!=string::npos){
0013 wish=rawoption;
0014 value=rawoption.substr(posEq+1);
0015 wish.erase(wish.begin()+posEq, wish.end());
0016 }
0017 else{
0018 wish="";
0019 value=rawoption;
0020 }
0021 }
0022 void splitOptionRecursive(string rawoption, vector<string>& splitoptions, char delimiter){
0023 string suboption=rawoption, result=rawoption;
0024 string remnant;
0025 while (result!=""){
0026 splitOption(suboption, result, remnant, delimiter);
0027 if (result!="") splitoptions.push_back(result);
0028 suboption = remnant;
0029 }
0030 if (remnant!="") splitoptions.push_back(remnant);
0031 }
0032
0033 void runplot(string full_path, int iov, int iter, string plotreq="", bool only_plotting=false){
0034 vector<string> pathseg;
0035 splitOptionRecursive(full_path, pathseg, '/');
0036 splitOptionRecursive(pathseg.at(pathseg.size()-1), pathseg, '/');
0037
0038 string obj = pathseg.at(pathseg.size()-1);
0039 string path = full_path; path.erase(path.find(obj.c_str()), obj.length());
0040
0041 cout << "Analyzing " << obj << " in path " << path << endl;
0042
0043
0044 vector<string> plottype;
0045 if (plotreq==""){
0046 plottype.push_back("cov");
0047 plottype.push_back("shift");
0048 plottype.push_back("chi2");
0049 plottype.push_back("param");
0050 plottype.push_back("hitmap");
0051 }
0052 else{
0053 if (plotreq=="cov") plottype.push_back("cov");
0054 else if (plotreq=="shift") plottype.push_back("shift");
0055 else if (plotreq=="chi2") plottype.push_back("chi2");
0056 else if (plotreq=="param") plottype.push_back("param");
0057 else if (plotreq=="hitmap") plottype.push_back("hitmap");
0058 else return;
0059 }
0060
0061
0062 bool MergeAllDet = 1;
0063
0064
0065
0066 const unsigned int Nplots = plottype.size();
0067
0068
0069
0070 if (MergeAllDet == 1){
0071 for (unsigned int i = 0; i < Nplots; i++) plotter(path.c_str(), obj.c_str(), iov, plottype.at(i).c_str(), iter, 0, only_plotting);
0072 }
0073
0074
0075 else{
0076
0077 for (unsigned int i = 0; i < Nplots; i++) {
0078 for (unsigned int det = 0; det < 6; det++) plotter(path.c_str(), obj.c_str(), iov, plottype.at(i).c_str(), iter, det, only_plotting);
0079 }
0080 }
0081 }
0082