Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-22 00:50:15

0001 ////////////////////////////////////////////////////////////////////////////////
0002 //
0003 // void plotAll(std::string fname, std::string HLT, int var, int ien, int eta,
0004 //              bool varbin, int rebin, bool approve, bool logy, int pos,
0005 //              bool pv, int savePlot)
0006 // Gets a group of plots by calling plotEnergy or plotEnergyPV for a given
0007 // input file
0008 //   fname = name of the input file                             ["hlt.root"]
0009 //   HLT   = type of HLT used (to be given in the figure legend)["All HLTs"]
0010 //   var   = variable name (-1 means all variables)                 [-1]
0011 //   ien   = energy bin (-1 means all energy bins)                  [-1]
0012 //   eta   = eta bin (-1 means all eta bins)                        [-1]
0013 //   varbin= flag for using variable bin width                      [false]
0014 //   rebin = # of bins to be re-binned together                     [5]
0015 //   approve= If meant for approval talks                           [true]
0016 //   logy  = If y-axis scale shuld by linear/logarithmic            [true]
0017 //   pos   = position of the statistics boxes                       [0]
0018 //   pv    = flag deciding call to plotEnergyPV vs plotEnergy       [false]
0019 //   savePlot= Plot to be saved: no(-1), eps(0), gif(1), pdf(2), C(3) [-1]
0020 //
0021 // void plotEnergyAll(std::string fname, std::string hlt, int pv, int data,
0022 //                    bool varbin, int rebin, bool approve, bool logy, int pos,
0023 //                    int var, int ene, int eta, int savePlot)
0024 // Plots energy distributions for a number of variables, eta and energy bins
0025 //
0026 //   fname = name of the i/p root file                              [""]
0027 //   HLT   = type of HLT used (to be given in the figure legend)  ["All HLTs"]
0028 //   models= packed flag to select which files to be plotted        [15]
0029 //   pv    = selection of # of good PV's used                       [0]
0030 //   data  = flag to say if it is Data (1)/MC (2)/or comparison (4) [4]
0031 //   varbin= flag for using variable bin width                      [false]
0032 //   rebin = # of bins to be re-binned together                     [5]
0033 //   approve= If meant for approval talks                           [true]
0034 //   logy  = If y-axis scale shuld by linear/logarithmic            [true]
0035 //   pos   = position of the statistics boxes                       [0]
0036 //   var   = variable name (-1 means all variables)                 [-1]
0037 //   ene   = energy bin (-1 means all energy bins)                  [-1]
0038 //   eta   = eta bin (-1 means all eta bins)                        [-1]
0039 //   savePlot= Plot to be saved: no(-1), eps(0), gif(1), pdf(2), C(3) [-1]
0040 //
0041 // void plotEMeanAll(int data, int models, bool ratio, bool approve,
0042 //                   std::string postfix, int savePlot)
0043 //
0044 // Plots mean energy response as a function of track momentum or the ratio
0045 //
0046 //   data  = flag to say if it is Data (1)/MC (2)/or comparison (4) [4]
0047 //   models= packed flag to select which files to be plotted        [15]
0048 //   ratio = flag to say if raw mean will be shown or ratio         [false]
0049 //           wrt a reference
0050 //   approve= If meant for approval talks                           [true]
0051 //   postfix= String to be added in the name of saved file          [""]
0052 //   savePlot= Plot to be saved: no(-1), eps(0), gif(1), pdf(2), C(3) [-1]
0053 //
0054 // void plotEMean(std::string fname, std::string hlt, int models, int var,
0055 //                int eta, int pv, int data, bool ratio, bool approve,
0056 //                std::string postfix, int savePlot)
0057 //
0058 // Plots mean energy response as a function of track momentum or the ratio
0059 // MC/Data
0060 //
0061 //   fname = name of the i/p root file                              [""]
0062 //   HLT   = type of HLT used (to be given in the figure legend)   ["All HLTs"]
0063 //   models= packed flag to select which files to be plotted        [15]
0064 //   var   = type of energy reponse with values between 0:5         [0]
0065 //           E_{7x7}/p, H_{3x3}/p, (E_{7x7}+H_{3x3})/p,
0066 //           E_{11x11}/p, H_{5x5}/p, (E_{11x11}+H_{5x5})/p
0067 //   eta   = calorimeter cell where track will reach 0:3            [0]
0068 //           ieta (HCAL) values 1:7, 7-13, 13:17, 17:23
0069 //   pv    = selection of # of good PV's used                       [0]
0070 //   data  = flag to say if it is Data (1)/MC (2)/or comparison (4) [1]
0071 //   ratio = flag to say if raw mean will be shown or ratio wrt     [false]
0072 //           a reference
0073 //   approve= If meant for approval talks                           [true]
0074 //   postfix= String to be added in the name of saved file          [""]
0075 //   savePlot= Plot to be saved: no(-1), eps(0), gif(1), pdf(2), C(3) [-1]
0076 //
0077 // void plotEnergy(std::string fname, std::string HLT, int var, int ien,
0078 //                 int eta, bool varbin, int rebin, bool approve, bool logy,
0079 //                 int pos, int coloff)
0080 //
0081 // Plots energy response distribution measured energy/track momentum for tracks
0082 // of given momentum range in a eta window
0083 //
0084 //   fname = name of the i/p root file                            ["hlt.root"]
0085 //   HLT   = type of HLT used (to be given in the figure legend)  ["All HLTs"]
0086 //   var   = type of energy reponse with values between 0:5       [0]
0087 //           E_{7x7}/p, H_{3x3}/p, (E_{7x7}+H_{3x3})/p,
0088 //           E_{11x11}/p, H_{5x5}/p, (E_{11x11}+H_{5x5})/p
0089 //   ien   = Track momentum range with values between 0:9         [0]
0090 //           1:2,2:3,3:4,4:5,5:6,6:7,7:9,9:11,11:15,15:20
0091 //   eta   = calorimeter cell where track will reach 0:3          [0]
0092 //           ieta (HCAL) values 1:7, 7-13, 13:17, 17:23
0093 //   varbin= flag for using variable bin width                    [false]
0094 //   rebin = # of bins to be re-binned together                   [1]
0095 //   approve= If meant for approval talks                         [false]
0096 //   logy  = If y-axis scale shuld by linear/logarithmic          [true]
0097 //   pos   = position of the statistics boxes                     [0]
0098 //   coloff= color offset                                         [0]
0099 //
0100 // TCanvas* plotEnergyPV(std::string fname, std::string HLT, int var, int ien,
0101 //                       int eta, bool varbin, int rebin, bool approve,
0102 //                       bool logy, int pos)
0103 //
0104 // Plots energy response distribution measured energy/track momentum for tracks
0105 // of given momentum range in a eta window for 4 different selections of # of
0106 // primary vertex 1:2,2:3,3:5,5:100
0107 //
0108 //   fname = name of the i/p root file            ["StudyHLT_HLTZeroBias.root"]
0109 //   HLT   = type of HLT used (to be given in the figure legend) ["Zero Bias"]
0110 //   var   = type of energy reponse with values between 0:5      [0]
0111 //           E_{7x7}/p, H_{3x3}/p, (E_{7x7}+H_{3x3})/p,
0112 //           E_{11x11}/p, H_{5x5}/p, (E_{11x11}+H_{5x5})/p
0113 //   ien   = Track momentum range with values between 0:9        [0]
0114 //           1:2,2:3,3:4,4:5,5:6,6:7,7:9,9:11,11:15,15:20
0115 //   eta   = calorimeter cell where track will reach 0:3         [0]
0116 //           ieta (HCAL) values 1:7, 7-13, 13:17, 17:23
0117 //   varbin= flag for using variable bin width                   [false]
0118 //   rebin = # of bins to be re-binned together                  [1]
0119 //   approve= If meant for approval talks                        [false]
0120 //   logy  = If y-axis scale shuld by linear/logarithmic         [true]
0121 //   pos   = position of the statistics boxes                    [0]
0122 //
0123 // void plotTrack(std::string fname, std::string HLT, int var, bool varbin,
0124 //                int rebin, bool approve, bool logy, int pos)
0125 //
0126 // Plots kinematic propeties of the track
0127 //
0128 //   fname = name of the i/p root file                           ["hlt.root"]
0129 //   HLT   = type of HLT used (to be given in the figure legend  ["All HLTs"]
0130 //   var   = kinematic variable 0:3 --> p, pt, eta, phi          [0]
0131 //   varbin= flag for using variable bin width                   [false]
0132 //   rebin = # of bins to be re-binned together                  [1]
0133 //   approve= If meant for approval talks                        [false]
0134 //   logy  = If y-axis scale shuld by linear/logarithmic         [true]
0135 //   pos   = position of the statistics boxes                    [0]
0136 //
0137 // void plotIsolation(std::string fname, std::string HLT, int var, bool varbin,
0138 //                    int rebin, bool approve, bool logy, int pos)
0139 //
0140 // Plots variables used for deciding on track isolation
0141 //
0142 //   fname = name of the i/p root file                           ["hlt.root"]
0143 //   HLT   = type of HLT used (to be given in the figure legend  ["All HLTs"]
0144 //   var   = isolation variable 0:3 --> Charge isolation energy, [0]
0145 //     Neutral isolation energy, Energy in smaller cone,
0146 //     Energy in larger cone
0147 //   varbin= flag for using variable bin width                   [false]
0148 //   rebin = # of bins to be re-binned together                  [1]
0149 //   approve= If meant for approval talks                        [false]
0150 //   logy  = If y-axis scale shuld by linear/logarithmic         [true]
0151 //   pos   = position of the statistics boxes                    [0]
0152 //
0153 // void plotHLT(std::string fname, std::string HLT, int run, bool varbin,
0154 //                    int rebin, bool approve, bool logy, int pos)
0155 //
0156 // Plots HLT accept information for a given run or a summary
0157 //
0158 //   fname = name of the i/p root file                           ["hlt.root"]
0159 //   HLT   = type of HLT used (to be given in the figure legend  ["All HLTs"]
0160 //   run   = run number; if <=0 the overall summary              [-1]
0161 //   varbin= flag for using variable bin width                   [false]
0162 //   rebin = # of bins to be re-binned together                  [1]
0163 //   approve= If meant for approval talks                        [false]
0164 //   logy  = If y-axis scale shuld by linear/logarithmic         [true]
0165 //   pos   = position of the statistics boxes                    [0]
0166 //
0167 // void plotEMeanRatioXAll(std::string fname=, std::string hlt, std::string postfix="F", int savePlot=2);
0168 //
0169 //   fname    = name of the i/p root file       ["pikp/FBE4p3vMixStudyHLT.root"]
0170 //   hlt      = name of the tag for the file    ["10.4p03 FTFP_BERT_EMM"]
0171 //   postfix  = string fixed to the saved file  ["F"]
0172 //   savePlot = flag to save the canvas         [2]
0173 //
0174 ////////////////////////////////////////////////////////////////////////////////
0175 
0176 #include "TCanvas.h"
0177 #include "TDirectory.h"
0178 #include "TF1.h"
0179 #include "TFile.h"
0180 #include "TFitResult.h"
0181 #include "TGraph.h"
0182 #include "TGraphErrors.h"
0183 #include "TGraphAsymmErrors.h"
0184 #include "TH1D.h"
0185 #include "TH2D.h"
0186 #include "THStack.h"
0187 #include "TLegend.h"
0188 #include "TMath.h"
0189 #include "TPolyLine.h"
0190 #include "TProfile.h"
0191 #include "TPaveStats.h"
0192 #include "TPaveText.h"
0193 #include "TROOT.h"
0194 #include "TString.h"
0195 #include "TStyle.h"
0196 
0197 #include <iostream>
0198 #include <iomanip>
0199 #include <vector>
0200 #include <string>
0201 
0202 //const int nmodelm=1, nmodelx=2, nmodels=3;
0203 //const int nmodelm=15, nmodelx=16, nmodels=2;
0204 //const int nmodelm=3, nmodelx=4, nmodels=3;
0205 //const int nmodelm=4, nmodelx=5, nmodels=3;
0206 //const int nmodelm=4, nmodelx=5, nmodels=2;
0207 //const int nmodelm=2, nmodelx=3, nmodels=3;
0208 const int nmodelm = 5, nmodelx = 6, nmodels = 3;
0209 const int etaMax = 3;
0210 //int         styles[7]  = {20, 23, 22, 24, 25, 21, 33};
0211 //int         colors[7]  = {1, 2, 4, 6, 7, 46, 38};
0212 int styles[7] = {20, 23, 21, 22, 24, 25, 33};
0213 int colors[7] = {1, 2, 6, 4, 3, 7, 38};
0214 int lstyle[7] = {1, 2, 3, 4, 5, 6, 7};
0215 std::string names[7] = {"All", "Quality", "okEcal", "EcalCharIso", "HcalCharIso", "EcalNeutIso", "HcalNeutIso"};
0216 std::string namefull[7] = {"All tracks",
0217                            "Good quality tracks",
0218                            "Tracks reaching ECAL",
0219                            "Charge isolation in ECAL",
0220                            "Charge isolation in HCAL",
0221                            "Isolated in ECAL",
0222                            "Isolated in HCAL"};
0223 std::string nameEta[4] = {"i#eta 1:6", "i#eta 7:12", "i#eta 13:16", "i#eta 17:22"};
0224 std::string nameEtas[4] = {"|#eta| < 0.52", "0.52 < |#eta| < 1.04", "1.04 < |#eta| < 1.39", "1.39 < |#eta| < 2.01"};
0225 std::string namePV[5] = {"all PV", "PV 1:1", "PV 2:2", "PV 3:5", "PV > 5"};
0226 std::string varname[4] = {"p", "pt", "eta", "phi"};
0227 std::string vartitle[4] = {"p (GeV/c)", "p_{T} (GeV/c)", "#eta", "#phi"};
0228 std::string nameC[2] = {"Ecal", "Hcal"};
0229 std::string nameCF[2] = {"ECAL", "HCAL"};
0230 std::string varnameC[4] = {"maxNearP", "ediff", "ene1", "ene2"};
0231 std::string vartitlC[4] = {
0232     "Charge isolation energy", "Neutral isolation energy", "Energy in smaller cone", "Energy in larger cone"};
0233 std::string cmsP = "CMS Preliminary";
0234 //std::string cmsP = "CMS";
0235 std::string fileData = "AllDataStudyHLT.root";
0236 const int NPT = 10;
0237 double mom[NPT] = {1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 8.0, 10.0, 13.0, 17.5};
0238 double dmom[NPT] = {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 1.0, 2.0, 2.5};
0239 std::string varPs[NPT] = {"1:2", "2:3", "3:4", "4:5", "5:6", "6:7", "7:9", "9:11", "11:15", "15:20"};
0240 std::string varPs1[NPT] = {"1", "2", "3", "4", "5", "6", "7", "9", "11", "15"};
0241 std::string varPPs[NPT] = {
0242     "1-2 GeV", "2-3 GeV", "3-4 GeV", "4-5 GeV", "5-6 GeV", "6-7 GeV", "7-9 GeV", "9-11 GeV", "11-15 GeV", "15-20 GeV"};
0243 std::string varEta[4] = {"1:6", "7:12", "13:16", "17:23"};
0244 std::string varEta1[4] = {"1", "2", "3", "4"};
0245 std::string varEne[6] = {"E_{7x7}", "H_{3x3}", "(E_{7x7}+H_{3x3})", "E_{11x11}", "H_{5x5}", "(E_{11x11}+H_{5x5})"};
0246 std::string varEne1[6] = {"E7x7", "H3x3", "E7x7H3x3", "E11x11", "H5x5", "E11x11H5x5"};
0247 const int nbins = 100;
0248 double xbins[nbins + 1] = {0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14,
0249                            0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29,
0250                            0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44,
0251                            0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.52, 0.54, 0.56, 0.58, 0.60, 0.62, 0.64, 0.66, 0.68,
0252                            0.70, 0.72, 0.74, 0.76, 0.78, 0.80, 0.82, 0.84, 0.86, 0.88, 0.90, 0.92, 0.94, 0.96, 0.98,
0253                            1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70,
0254                            1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50};
0255 int ibins[nbins + 1] = {11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,
0256                         28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
0257                         45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,
0258                         63,  65,  67,  69,  71,  73,  75,  77,  79,  81,  83,  85,  87,  89,  91,  93,  95,
0259                         97,  99,  101, 103, 105, 107, 109, 111, 116, 121, 126, 131, 136, 141, 146, 151, 156,
0260                         161, 166, 171, 176, 181, 186, 191, 196, 201, 206, 211, 221, 231, 241, 251, 261};
0261 /*
0262 std::string files[nmodels]={"ZeroBiasStudyHLT.root","MinimumBiasStudyHLT.root"};
0263 std::string types[nmodels]={"Zero Bias Data","Minimum Bias Data"};
0264 */
0265 std::string files[nmodels] = {"2017C_ZB.root", "2017G_ZB.root", "2017H_ZB.root"};
0266 std::string types[nmodels] = {"Zero Bias (2017C)", "Zero Bias (2017G)", "Zero Bias (2017H)"};
0267 
0268 /*
0269 std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root",
0270                 "pikp/FBE3p3MixStudyHLT.root",
0271                 "pikp/FBE4bMixStudyHLT.root",
0272                 "pikp/FBE4r00MixStudyHLT.root",
0273                 "pikp/FBE4c01MixStudyHLT.root",
0274                 "pikp/FBE4c02MixStudyHLT.root",
0275                 "pikp/FBE3r11MixStudyHLT.root",
0276                 "pikp/FBE3r10MixStudyHLT.root",
0277                 "pikp/FBE3r8MixStudyHLT.root",
0278                 "pikp/FBE3r9MixStudyHLT.root",
0279                 "pikp/QFBE0p2StudyHLT.root",
0280                 "pikp/QFBE2p2StudyHLT.root",
0281                 "pikp/QFBE4bMixStudyHLT.root",
0282                 "pikp/FBAE2p2StudyHLT.root",
0283                 "pikp/FBAE4bMixStudyHLT.root"};
0284 std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM",
0285                 "10.3.p03 FTFP_BERT_EMM",
0286                 "10.4.beta FTFP_BERT_EMM",
0287                 "10.4 FTFP_BERT_EMM",
0288                 "10.4.cand01 FTFP_BERT_EMM",
0289                 "10.4.cand02 FTFP_BERT_EMM",
0290                 "10.3.ref11 FTFP_BERT_EMM",
0291                 "10.3.ref10 FTFP_BERT_EMM",
0292                 "10.3.ref08 FTFP_BERT_EMM",
0293                 "10.3.ref09 FTFP_BERT_EMM",
0294                 "10.0.p02 QGSP_FTFP_BERT_EML",
0295                 "10.2.p02 QGSP_FTFP_BERT_EMM",
0296                 "10.4.b01 QGSP_FTFP_BERT_EMM",
0297                 "10.2.p02 FTFP_BERT_ATL_EMM",
0298                 "10.4.b01 FTFP_BERT_ATL_EMM"};
0299 */
0300 /*
0301 std::string filem[nmodelm]={"pikp/FBE2p2MixStudyHLT10.root",
0302                 "pikp/FBE4MixStudyHLT10.root",
0303                 "pikp/FBE4vMixStudyHLT10.root",
0304                 "pikp/FBE4vcMixStudyHLT10.root"};
0305 std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM",
0306                 "10.4 FTFP_BERT_EMM",
0307                 "10.4 VecGeom FTFP_BERT_EMM",
0308                 "10.4 VecGeom+CLHEP FTFP_BERT_EMM"};
0309 */
0310 /*
0311 std::string filem[nmodelm]={"pikp/FBE4cMixStudyHLT10.root",
0312                 "pikp/FBE4vcMixStudyHLT10.root"};
0313 std::string typem[nmodelm]={"10.4 CLHEP FTFP_BERT_EMM",
0314                 "10.4 VecGeom+CLHEP FTFP_BERT_EMM"};
0315 */
0316 /*
0317 std::string filem[nmodelm]={"pikp/FBE3r9MixStudyHLT.root",
0318                 "pikp/FBE4r00MixStudyHLT.root",
0319                 "pikp/FBE4r01MixStudyHLT.root"};
0320 std::string typem[nmodelm]={"10.3.ref09 FTFP_BERT_EMM",
0321                 "10.4.ref00 FTFP_BERT_EMM",
0322                 "10.4.ref01 FTFP_BERT_EMM"};
0323 */
0324 /*
0325 std::string filem[nmodelm]={"pikp/QFB3r9MixStudyHLT.root",
0326                 "pikp/QFB4r00MixStudyHLT.root",
0327                 "pikp/QFB4r01MixStudyHLT.root"};
0328 std::string typem[nmodelm]={"10.3.ref09 QGSP_FTFP_BERT_EML",
0329                 "10.4.ref00 QGSP_FTFP_BERT_EML",
0330                 "10.4.ref01 QGSP_FTFP_BERT_EML"};
0331 */
0332 /*
0333 std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root",
0334                 "pikp/FBE4r00MixStudyHLT.root",
0335                 "pikp/FBE4r00vMixStudyHLT.root"};
0336 std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM",
0337                 "10.4 FTFP_BERT_EMM (Native)",
0338                 "10.4 FTFP_BERT_EMM (VecGeom)"};
0339 */
0340 /*
0341 std::string filem[nmodelm]={"pikp/FBE3r6MixStudyHLT.root",
0342                 "pikp/FBE3r6vMixStudyHLT.root",
0343                 "pikp/FBE3r6vRMixStudyHLT.root"};
0344 std::string typem[nmodelm]={"10.3.ref06 FTFP_BERT_EMM (Native)",
0345                 "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)",
0346                 "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"};
0347 */
0348 /*
0349 std::string filem[nmodelm]={"pikp/FBE4r00vMixStudyHLT.root",
0350                 "pikp/FBE4r01MixStudyHLT.root",
0351                 "pikp/FBE4r01vMixStudyHLT.root"};
0352 std::string typem[nmodelm]={"10.4 VecGeom FTFP_BERT_EMM",
0353                 "10.4.ref01 FTFP_BERT_EMM",
0354                 "10.4.ref01 VecGeom FTFP_BERT_EMM"};
0355 */
0356 /*
0357 std::string filem[nmodelm]={"pikp/FBE4MixStudyHLT10d.root",
0358                 "pikp/FBE4MixStudyHLT10s.root",
0359                 "pikp/FBE4MixStudyHLT10t.root",
0360                 "pikp/FBE4MixStudyHLT10st.root"};
0361 std::string typem[nmodelm]={"10.4 FTFP_BERT_EMM (Default)",
0362                 "10.4 FTFP_BERT_EMM (New StepIntegrator)",
0363                 "10.4 FTFP_BERT_EMM (Smart Track)",
0364                 "10.4 FTFP_BERT_EMM (New Stepper + Smart Track)"};
0365 */
0366 /*
0367 std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root",
0368                 "pikp/FBE4MixStudyHLT1025.root",
0369                 "pikp/FBE5c01vMixStudyHLT.root",
0370                 "pikp/FBE5c02vMixStudyHLT.root",
0371                 "pikp/QFB5c02vMixStudyHLT.root"};
0372 std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM",
0373                 "10.4 FTFP_BERT_EMM",
0374                 "10.5.cand01 FTFP_BERT_EMM",
0375                 "10.5.cand02 FTFP_BERT_EMM",
0376                 "10.5.cand02 QGSP_FTFP_BERT_EML"};
0377 */
0378 /*
0379 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root",
0380                 "pikp/FBE5r00vMixStudyHLT.root",
0381                 "pikp/FBE5r05vMixStudyHLT.root",
0382                 "pikp/FBE5r07vMixStudyHLT.root",
0383                 "pikp/FBE5r08vMixStudyHLT.root"};
0384 std::string typem[nmodelm]={"10.4.p03 FTFP_BERT_EMM",
0385                 "10.5 FTFP_BERT_EMM",
0386                 "10.5.ref05 FTFP_BERT_EMM",
0387                 "10.5.ref07 FTFP_BERT_EMM",
0388                 "10.5.ref08 FTFP_BERT_EMM"};
0389 */
0390 /*
0391 std::string filem[nmodelm]={"pikp/QFB4p3vMixStudyHLT.root",
0392                 "pikp/QFB5r00vMixStudyHLT.root",
0393                 "pikp/QFB5r05vMixStudyHLT.root",
0394                 "pikp/QFB5r07vMixStudyHLT.root",
0395                 "pikp/QFB5r08vMixStudyHLT.root"};
0396 std::string typem[nmodelm]={"10.4.p03 QGSP_FTFP_BERT_EML",
0397                 "10.5 QGSP_FTFP_BERT_EML",
0398                 "10.5.ref05 QGSP_FTFP_BERT_EML",
0399                 "10.5.ref07 QGSP_FTFP_BERT_EML",
0400                 "10.5.ref08 QGSP_FTFP_BERT_EML"};
0401 */
0402 /*
0403 std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root",
0404                 "pikp/FBE4p3vMixStudyHLT.root",
0405                 "pikp/FBE6p00vMixStudyHLT.root",
0406                 "pikp/FBE6r01vMixStudyHLT.root"};
0407 std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM",
0408                 "10.4.p03 FTFP_BERT_EMM",
0409                 "10.6.ref00 FTFP_BERT_EMM + Birk",
0410                 "10.6.ref01 FTFP_BERT_EMM + Birk"};
0411 */
0412 /*
0413 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root",
0414                 "pikp/FBE6p01AvMixStudyHLT.root",
0415                 "pikp/FBE6p01BvMixStudyHLT.root",
0416                 "pikp/FBE6p01CvMixStudyHLT.root"};
0417 std::string typem[nmodelm]={"10.4.p03 FTFP_BERT_EMM",
0418                 "10.6.p01 FTFP_BERT_EMM + Birk C1+C3",
0419                 "10.6.p01 FTFP_BERT_EMM + Birk C1",
0420                 "10.6.p01 FTFP_BERT_EMM + Birk C1 + #pi"};
0421 */
0422 /*
0423 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root",
0424                 "pikp/FBE6p01CvMixStudyHLT.root"};
0425 std::string typem[nmodelm]={"10.4.p03 FTFP_BERT_EMM",
0426                 "10.6.p01 FTFP_BERT_EMM + Birk C1 + #pi"};
0427 */
0428 /*
0429 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root",
0430                 "pikp/FBE5r08vMixStudyHLT.root"};
0431 std::string typem[nmodelm]={"10.4.p03 FTFP_BERT_EMM",
0432                 "10.5.ref08 FTFP_BERT_EMM"};
0433 */
0434 /*
0435 std::string filem[nmodelm]={"pikp/QFBE2p2StudyHLT.root",
0436                 "pikp/QFB4p3vMixStudyHLT.root",
0437                 "pikp/QFB6p00vMixStudyHLT.root",
0438                 "pikp/QFB6r01vMixStudyHLT.root"};
0439 std::string typem[nmodelm]={"10.2.p02 QGSP_FTFP_BERT_EMM",
0440                 "10.4.p03 QGSP_FTFP_BERT_EML",
0441                 "10.6.ref00 QGSP_FTFP_BERT_EML + Birk",
0442                 "10.6.ref01 QGSP_FTFP_BERT_EML + Birk"};
0443 */
0444 /*
0445 std::string filem[nmodelm]={"pikp/QFB4p3vMixStudyHLT.root",
0446                 "pikp/QFB6p01AvMixStudyHLT.root",
0447                 "pikp/QFB6p01BvMixStudyHLT.root",
0448                 "pikp/QFB6p01CvMixStudyHLT.root"};
0449 std::string typem[nmodelm]={"10.4.p03 QGSP_FTFP_BERT_EML",
0450                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1+C3",
0451                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1",
0452                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1 + #pi"};
0453 */
0454 std::string filem[nmodelm] = {"pikp/FBE4p3vMixStudyHLT.root",
0455                               "pikp/FBE7p02vMixStudyHLT.root",
0456                               "pikp/FBE110p01vMixStudyHLT.root",
0457                               "pikp/FBE110r05MixStudyHLT.root",
0458                               "pikp/FBE110r06vMixStudyHLT.root"};
0459 std::string typem[nmodelm] = {"10.4.p03 FTFP_BERT_EMM",
0460                               "10.7.p02 FTFP_BERT_EMM + Birk C1 + #pi",
0461                               "11.0.p01 FTFP_BERT_EMM + Birk C1 + #pi",
0462                               "11.0.ref05 FTFP_BERT_EMM + Birk C1 + #pi",
0463                               "11.0.ref06 FTFP_BERT_EMM + Birk C1 + #pi"};
0464 /*
0465 std::string filem[nmodelm]={"pikp/QFB4p3vMixStudyHLT.root",
0466                 "pikp/QFB7p02vMixStudyHLT.root",
0467                 "pikp/QFB110p01vMixStudyHLT.root",
0468                 "pikp/QFB110r05MixStudyHLT.root",
0469                 "pikp/QFB110r06vMixStudyHLT.root"};
0470 std::string typem[nmodelm]={"10.4.p03 QGSP_FTFP_BERT_EML",
0471                 "10.7.p02 QGSP_FTFP_BERT_EML + Birk C1",
0472                 "11.0.p01 QGSP_FTFP_BERT_EML + Birk C1",
0473                 "11.0.ref05 QGSP_FTFP_BERT_EML + Birk C1",
0474                 "11.0.ref06 QGSP_FTFP_BERT_EML + Birk C1"};
0475 */
0476 /*
0477 std::string filem[nmodelm]={"pikp/FBE7r00vMixStudyHLT.root",
0478                 "pikp/FBE7p01MixStudyHLT.root",
0479                 "pikp/FBE7p02vMixStudyHLT.root",
0480                 "pikp/FBE7p03vMixStudyHLT.root"};
0481 std::string typem[nmodelm]={"10.7 FTFP_BERT_EMM + Birk C1 + #pi",
0482                 "10.7.p01 FTFP_BERT_EMM + Birk C1 + #pi",
0483                 "10.7.p02 FTFP_BERT_EMM + Birk C1 + #pi",
0484                 "10.7.p03 FTFP_BERT_EMM + Birk C1 + #pi"};
0485 */
0486 /*
0487 std::string filem[nmodelm]={"pikp/QFB7r00vMixStudyHLT.root",
0488                 "pikp/QFB7p01MixStudyHLT.root",
0489                 "pikp/QFB7p02vMixStudyHLT.root",
0490                 "pikp/QFB7p03vMixStudyHLT.root"};
0491 std::string typem[nmodelm]={"10.7 QGSP_BERT_EML + Birk C1 + #pi",
0492                 "10.7.p01 QGSP_BERT_EML + Birk C1 + #pi",
0493                 "10.7.p02 QGSP_BERT_EML + Birk C1 + #pi",
0494                 "10.7.p03 QGSP_BERT_EML + Birk C1 + #pi"};
0495 */
0496 /*
0497 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root",
0498                 "pikp/FBE6p2vMixStudyHLT.root",
0499                 "pikp/FBE7p1vMixStudyHLT.root"};
0500 std::string typem[nmodelm]={"10.4p03 FTFP_BERT_EMM",
0501                 "10.6p02 FTFP_BERT_EMM",
0502                 "10.7p01 FTFP_BERT_EMM"};
0503 */
0504 /*
0505 std::string filem[nmodelm]={"pikp/FBE4p3vMixStudyHLT.root"};
0506 std::string typem[nmodelm]={"10.4p03 FTFP_BERT_EMM"};
0507 */
0508 /*
0509 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0510                 "pikp/FBE2p2StudyHLT.root",
0511                 "pikp/FBE3p3MixStudyHLT.root",
0512                 "pikp/FBE4bMixStudyHLT.root",
0513                 "pikp/FBE4r00MixStudyHLT.root",
0514                 "pikp/FBE4c01MixStudyHLT.root",
0515                 "pikp/FBE4c02MixStudyHLT.root",
0516                 "pikp/FBE3r11MixStudyHLT.root",
0517                 "pikp/FBE3r10MixStudyHLT.root",
0518                 "pikp/FBE3r8MixStudyHLT.root",
0519                 "pikp/FBE3r9MixStudyHLT.root",
0520                 "pikp/QFBE0p2StudyHLT.root",
0521                 "pikp/QFBE2p2StudyHLT.root",
0522                 "pikp/QFBE4bMixStudyHLT.root",
0523                 "pikp/FBAE2p2StudyHLT.root",
0524                 "pikp/FBAE4bMixStudyHLT.root"};
0525 std::string typex[nmodelx]={"Data (2016B)",
0526                 "10.2.p02 FTFP_BERT_EMM",
0527                 "10.3.p03 FTFP_BERT_EMM",
0528                 "10.4.beta FTFP_BERT_EMM",
0529                 "10.4 FTFP_BERT_EMM",
0530                 "10.4.cand01 FTFP_BERT_EMM",
0531                 "10.4.cand02 FTFP_BERT_EMM",
0532                 "10.3.ref11 FTFP_BERT_EMM",
0533                 "10.3.ref10 FTFP_BERT_EMM",
0534                 "10.3.ref08 FTFP_BERT_EMM",
0535                 "10.3.ref09 FTFP_BERT_EMM",
0536                 "10.0.p02 QGSP_FTFP_BERT_EML",
0537                 "10.2.p02 QGSP_FTFP_BERT_EMM",
0538                 "10.4.b01 QGSP_FTFP_BERT_EMM",
0539                 "10.2.p02 FTFP_BERT_ATL_EMM",
0540                 "10.4.b01 FTFP_BERT_ATL_EMM"};
0541 */
0542 /*
0543 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0544                 "pikp/FBE2p2MixStudyHLT10.root",
0545                 "pikp/FBE4MixStudyHLT10.root",
0546                 "pikp/FBE4vMixStudyHLT10.root",
0547                 "pikp/FBE4vcMixStudyHLT10.root"};
0548 std::string typex[nmodelx]={"Data (2016B)",
0549                 "10.2.p02 FTFP_BERT_EMM",
0550                 "10.4 FTFP_BERT_EMM",
0551                 "10.4 VecGeom FTFP_BERT_EMM",
0552                 "10.4 VecGeom+CLHEP FTFP_BERT_EMM"};
0553 */
0554 /*
0555 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0556                             "pikp/FBE4cMixStudyHLT10.root",
0557                 "pikp/FBE4vcMixStudyHLT10.root"};
0558 std::string typex[nmodelx]={"Data (2016B)",
0559                             "10.4 CLHEP FTFP_BERT_EMM",
0560                 "10.4 VecGeom+CLHEP FTFP_BERT_EMM"};
0561 */
0562 /*
0563 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0564                 "pikp/FBE3r9MixStudyHLT.root",
0565                 "pikp/FBE4r00MixStudyHLT.root",
0566                 "pikp/FBE4r01MixStudyHLT.root"};
0567 std::string typex[nmodelx]={"Data (2016B)",
0568                 "10.3.ref09 FTFP_BERT_EMM",
0569                 "10.4.ref00 FTFP_BERT_EMM",
0570                 "10.4.ref01 FTFP_BERT_EMM"};
0571 */
0572 /*
0573 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0574                 "pikp/QFB3r9MixStudyHLT.root",
0575                 "pikp/QFB4r00MixStudyHLT.root",
0576                 "pikp/QFB4r01MixStudyHLT.root"};
0577 std::string typex[nmodelx]={"Data (2016B)",
0578                 "10.3.ref09 QGSP_FTFP_BERT_EML",
0579                 "10.4.ref00 QGSP_FTFP_BERT_EML",
0580                 "10.4.ref01 QGSP_FTFP_BERT_EML"};
0581 */
0582 /*
0583 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0584                 "pikp/FBE2p2StudyHLT.root",
0585                 "pikp/FBE4r00MixStudyHLT.root",
0586                 "pikp/FBE4r00vMixStudyHLT.root"};
0587 std::string typex[nmodelx]={"Data (2016B)",
0588                 "10.2.p02 FTFP_BERT_EMM",
0589                 "10.4 FTFP_BERT_EMM (Native)",
0590                 "10.4 FTFP_BERT_EMM (VecGeom)"};
0591 */
0592 /*
0593 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0594                 "pikp/FBE3r6MixStudyHLT.root",
0595                 "pikp/FBE3r6vMixStudyHLT.root",
0596                 "pikp/FBE3r6vRMixStudyHLT.root"};
0597 std::string typex[nmodelx]={"Data (2016B)",
0598                 "10.3.ref06 FTFP_BERT_EMM (Native)",
0599                 "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)",
0600                 "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"};
0601 */
0602 /*
0603 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0604                 "pikp/FBE4r00vMixStudyHLT.root",
0605                 "pikp/FBE4r01MixStudyHLT.root",
0606                 "pikp/FBE4r01vMixStudyHLT.root"};
0607 std::string typex[nmodelx]={"Data (2016B)",
0608                 "10.4 VecGeom FTFP_BERT_EMM",
0609                 "10.4.ref01 FTFP_BERT_EMM",
0610                 "10.4.ref01 VecGeom FTFP_BERT_EMM"};
0611 */
0612 /*
0613 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0614                 "pikp/FBE4MixStudyHLT10d.root",
0615                 "pikp/FBE4MixStudyHLT10s.root",
0616                 "pikp/FBE4MixStudyHLT10t.root",
0617                 "pikp/FBE4MixStudyHLT10st.root"};
0618 std::string typex[nmodelx]={"Data (2016B)",
0619                 "10.4 FTFP_BERT_EMM (Default)",
0620                 "10.4 FTFP_BERT_EMM (New StepIntegrator)",
0621                 "10.4 FTFP_BERT_EMM (Smart Track)",
0622                 "10.4 FTFP_BERT_EMM (New Stepper + Smart Track)"};
0623 */
0624 /*
0625 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0626                 "pikp/FBE2p2StudyHLT.root",
0627                 "pikp/FBE4MixStudyHLT1025.root",
0628                 "pikp/FBE5c01vMixStudyHLT.root",
0629                 "pikp/FBE5c02vMixStudyHLT.root",
0630                 "pikp/QFB5c02vMixStudyHLT.root"};
0631 std::string typex[nmodelx]={"Data (2016B)",
0632                 "10.2.p02 FTFP_BERT_EMM",
0633                 "10.4 FTFP_BERT_EMM",
0634                 "10.5.cand01 FTFP_BERT_EMM",
0635                 "10.5.cand02 FTFP_BERT_EMM",
0636                 "10.5.cand02 QGSP_FTFP_BERT_EML"};
0637 */
0638 /*
0639 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0640                 "pikp/FBE4p3vMixStudyHLT.root",
0641                 "pikp/FBE5r00vMixStudyHLT.root",
0642                 "pikp/FBE5r05vMixStudyHLT.root",
0643                 "pikp/FBE5r07vMixStudyHLT.root",
0644                 "pikp/FBE5r08vMixStudyHLT.root"};
0645 std::string typex[nmodelx]={"Data (2016B)",
0646                 "10.4.p03 FTFP_BERT_EMM",
0647                 "10.5 FTFP_BERT_EMM",
0648                 "10.5.ref05 FTFP_BERT_EMM",
0649                 "10.5.ref07 FTFP_BERT_EMM",
0650                 "10.5.ref08 FTFP_BERT_EMM"};
0651 */
0652 /*
0653 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0654                 "pikp/QFB4p3vMixStudyHLT.root",
0655                 "pikp/QFB5r00vMixStudyHLT.root",
0656                 "pikp/QFB5r05vMixStudyHLT.root",
0657                 "pikp/QFB5r07vMixStudyHLT.root",
0658                 "pikp/QFB5r08vMixStudyHLT.root"};
0659 std::string typex[nmodelx]={"Data (2016B)",
0660                 "10.4.p03  QGSP_FTFP_BERT_EML",
0661                 "10.5  QGSP_FTFP_BERT_EML",
0662                 "10.5.ref05 QGSP_FTFP_BERT_EML",
0663                 "10.5.ref07 QGSP_FTFP_BERT_EML",
0664                 "10.5.ref08 QGSP_FTFP_BERT_EML"};
0665 */
0666 /*
0667 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0668                 "pikp/FBE4p3vMixStudyHLT.root",
0669                 "pikp/FBE5r10vMixStudyHLT.root"};
0670 std::string typex[nmodelx]={"Data (2016B)",
0671                 "10.4.p03 FTFP_BERT_EMM",
0672                 "10.5.ref10 FTFP_BERT_EMM"};
0673 */
0674 /*
0675 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0676                 "pikp/FBE2p2StudyHLT.root",
0677                 "pikp/FBE4p3vMixStudyHLT.root",
0678                 "pikp/FBE6p00vMixStudyHLT.root",
0679                 "pikp/FBE6r01vMixStudyHLT.root"};
0680 std::string typex[nmodelx]={"Data (2016B)",
0681                 "10.2.p02 FTFP_BERT_EMM",
0682                 "10.4.p03 FTFP_BERT_EMM",
0683                 "10.6.ref00 FTFP_BERT_EMM + Birk",
0684                 "10.6.ref01 FTFP_BERT_EMM + Birk"};
0685 */
0686 /*
0687 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0688                 "pikp/FBE4p3vMixStudyHLT.root",
0689                 "pikp/FBE6p01AvMixStudyHLT.root",
0690                 "pikp/FBE6p01BvMixStudyHLT.root",
0691                 "pikp/FBE6p01CvMixStudyHLT.root"};
0692 std::string typex[nmodelx]={"Data (2016B)",
0693                 "10.4.p03 FTFP_BERT_EMM",
0694                 "10.6.p01 FTFP_BERT_EMM + Birk C1+C3",
0695                 "10.6.p01 FTFP_BERT_EMM + Birk C1",
0696                 "10.6.p01 FTFP_BERT_EMM + Birk C1 + #pi"};
0697 */
0698 /*
0699 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0700                 "pikp/FBE4p3vMixStudyHLT.root",
0701                 "pikp/FBE6p01CvMixStudyHLT.root"};
0702 std::string typex[nmodelx]={"Data (2016B)",
0703                 "10.4.p03 FTFP_BERT_EMM",
0704                 "10.6.p01 FTFP_BERT_EMM + Birk C1 + #pi"};
0705 */
0706 /*
0707 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0708                 "pikp/QFB4p3vMixStudyHLT.root",
0709                 "pikp/QFB5r00vMixStudyHLT.root",
0710                 "pikp/QFB6p00vMixStudyHLT.root",
0711                 "pikp/QFB6r01vMixStudyHLT.root"};
0712 std::string typex[nmodelx]={"Data (2016B)",
0713                 "10.4.p03 QGSP_FTFP_BERT_EML",
0714                 "10.5     QGSP_FTFP_BERT_EML",
0715                 "10.6.ref00 QGSP_FTFP_BERT_EML + Birk",
0716                 "10.6.ref01 QGSP_FTFP_BERT_EML + Birk"};
0717 */
0718 /*
0719 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0720                 "pikp/QFB4p3vMixStudyHLT.root",
0721                 "pikp/QFB6p01AvMixStudyHLT.root",
0722                 "pikp/QFB6p01BvMixStudyHLT.root",
0723                 "pikp/QFB6p01CvMixStudyHLT.root"};
0724 std::string typex[nmodelx]={"Data (2016B)",
0725                 "10.4.p03 QGSP_FTFP_BERT_EML",
0726                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1+C3",
0727                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1",
0728                 "10.6.p01 QGSP_FTFP_BERT_EML + Birk C1 + #pi"};
0729 */
0730 /*
0731 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0732                 "pikp/FBE4p3vMixStudyHLT.root",
0733                 "pikp/FBE7p02vMixStudyHLT.root",
0734                 "pikp/FBE110p01vMixStudyHLT.root",
0735                 "pikp/FBE110r05MixStudyHLT.root",
0736                 "pikp/FBE110r06vMixStudyHLT.root"};
0737 std::string typex[nmodelx]={"Data (2016B)",
0738                 "10.4.p03 FTFP_BERT_EMM",
0739                 "10.7.p02 FTFP_BERT_EMM",
0740                 "11.0.p01 FTFP_BERT_EMM",
0741                 "11.0.ref05 FTFP_BERT_EMM",
0742                 "11.0.ref06 FTFP_BERT_EMM"};
0743 */
0744 std::string filex[nmodelx] = {"AllDataStudyHLT.root",
0745                               "pikp/QFB4p3vMixStudyHLT.root",
0746                               "pikp/QFB7p02vMixStudyHLT.root",
0747                               "pikp/QFB110p01vMixStudyHLT.root",
0748                               "pikp/QFB110r05MixStudyHLT.root",
0749                               "pikp/QFB110r06vMixStudyHLT.root"};
0750 std::string typex[nmodelx] = {"Data (2016B)",
0751                               "10.4.p03 QGSP_FTFP_BERT_EML",
0752                               "10.7.p02 QGSP_FTFP_BERT_EML",
0753                               "11.0.p01 QGSP_FTFP_BERT_EML",
0754                               "11.0.ref05 QGSP_FTFP_BERT_EML",
0755                               "11.0.ref06 QGSP_FTFP_BERT_EML"};
0756 /*
0757 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0758                 "pikp/QFB110p01vMixStudyHLT.root",
0759                 "pikp/QFB110r01vMixStudyHLT.root",
0760                 "pikp/QFB110r02vMixStudyHLT.root",
0761                 "pikp/QFB110r03MixStudyHLT.root",
0762                 "pikp/QFB110r04MixStudyHLT.root"};
0763 std::string typex[nmodelx]={"Data (2016B)",
0764                 "11.0.p01 QGSP_BERT_EMM + Birk C1 + #pi",
0765                 "11.0.ref01 QGSP_BERT_EMM + Birk C1 + #pi",
0766                 "11.0.ref02 QGSP_BERT_EMM + Birk C1 + #pi",
0767                 "11.0.ref03 QGSP_BERT_EMM + Birk C1 + #pi",
0768                 "11.0.ref04 QGSP_BERT_EMM + Birk C1 + #pi"};
0769 */
0770 /*
0771 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0772                 "pikp/QFB7r00vMixStudyHLT.root",
0773                 "pikp/QFB7p01vMixStudyHLT.root",
0774                 "pikp/QFB7p02vMixStudyHLT.root",
0775                 "pikp/QFB7p03vMixStudyHLT.root"};
0776 std::string typex[nmodelx]={"Data (2016B)",
0777                 "10.7 QGSP_BERT_EML + Birk C1 + #pi",
0778                 "10.7.p01 QGSP_BERT_EML + Birk C1 + #pi",
0779                 "10.7.p02 QGSP_BERT_EML + Birk C1 + #pi",
0780                 "10.7.p03 QGSP_BERT_EML + Birk C1 + #pi"};
0781 */
0782 /*
0783 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0784                 "pikp/FBE1250p30vMixStudyHLT.root",
0785                 "pikp/FBE1250p31vMixStudyHLT.root",
0786                 "pikp/FBE1250p32vMixStudyHLT.root"};
0787 std::string typex[nmodelx]={"Data (2016B)",
0788                 "10.7.p02 FTFP_BERT_EMM Default",
0789                 "10.7.p02 FTFP_BERT_EMM Emax = 0.02",
0790                 "10.7.p02 FTFP_BERT_EMM Emax = 0.04"};
0791 */
0792 /*
0793 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0794                 "pikp/FBE4p3vMixStudyHLT.root",
0795                 "pikp/FBE6p2MixStudyHLT.root",
0796                 "pikp/FBE7p1MixStudyHLT.root"};
0797 std::string typex[nmodelx]={"Data (2016B)",
0798                 "Geant4.10.4p03",
0799                 "Geant4.10.6p02",
0800                 "Geant4.10.7p01"};
0801 */
0802 /*
0803 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0804                 "pikp/FBE4p3vMixStudyHLT.root"};
0805 std::string typex[nmodelx]={"Data (2016B)",
0806                 "Geant4.10.4p03"};
0807 */
0808 /*
0809 std::string filex[nmodelx]={"AllDataStudyHLT.root",
0810                 "pikp/QFB4vp3vMixStudyHLT.root",
0811                 "pikp/QFB6vp2vMixStudyHLT.root",
0812                 "pikp/QFB7vb1vMixStudyHLT.root"};
0813 std::string typex[nmodelx]={"Data (2016B)",
0814                 "10.4.p03 QGSP_FTFP_BERT_EML",
0815                 "10.6.p02 QGSP_FTFP_BERT_EML",
0816                 "10.7.beta QGSP_FTFP_BERT_EML"};
0817 */
0818 /*
0819   std::string files[nmodelx]={"StudyHLT_ZeroBias_1PV.root","StudyHLT_PixelTrack_1PV.root","StudyHLT_1PV.root"};
0820   std::string types[nmodels]={"Zero Bias HLT","Pixel Track HLT","All HLTs"};
0821   std::string files[nmodels]={"StudyHLT_HLTZeroBias.root","StudyHLT_PixelTrack.root","StudyHLT_HLTJetE.root","StudyHLT_HLTPhysics.root","StudyHLT_All.root"};
0822   std::string types[nmodels]={"Zero Bias HLT","Pixel Track HLT","JetE HLT","Physics HLT","All HLTs"};
0823   std::string filem[nmodelm]={"StudyHLT_95p02_QGSP_FTFP_BERT.root", "StudyHLT_96p02_QGSP_FTFP_BERT.root", "StudyHLT_96p02_FTFP_BERT.root"};
0824   std::string typem[nmodelm]={"Pythia8 (9.5.p02 QGSP_FTFP_BERT)","Pythia8 (9.6.p02 QGSP_FTFP_BERT)","Pythia8 (9.6.p02 FTFP_BERT)"};
0825   std::string filex[nmodelx]={"AllDataStudyHLT.root","pikp/QFBE0p2StudyHLT.root", "pikp/FBE2p2StudyHLT.root"};
0826   std::string typex[nmodelx]={"Data (2016B)","10.0.p02 QGSP_FTFP_BERT_EML","10.2.p02 FTFP_BERT_EMM"};
0827 */
0828 
0829 void plotAll(std::string fname = "",
0830              std::string HLT = "",
0831              int var = -1,
0832              int ien = -1,
0833              int eta = -1,
0834              bool varbin = false,
0835              int rebin = 1,
0836              bool approve = true,
0837              bool logy = true,
0838              int pos = 0,
0839              bool pv = false,
0840              int savePlot = -1);
0841 void plotEnergyAll(std::string fname = "",
0842                    std::string hlt = "All HLTs",
0843                    int models = 15,
0844                    int pv = 0,
0845                    int data = 4,
0846                    bool varbin = false,
0847                    int rebin = 5,
0848                    bool approve = true,
0849                    bool logy = true,
0850                    int pos = 0,
0851                    int var = -1,
0852                    int ene = -1,
0853                    int eta = -1,
0854                    int savePlot = -1);
0855 void plotEMeanAll(
0856     int data = 4, int models = 63, bool ratio = true, bool approve = true, std::string postfix = "F", int savePlot = 2);
0857 void plotEMean(std::string fname = "",
0858                std::string hlt = "All HLTs",
0859                int models = 15,
0860                int var = 0,
0861                int eta = 0,
0862                int pv = 0,
0863                int dataMC = 1,
0864                bool raio = false,
0865                bool approve = true,
0866                std::string postfix = "",
0867                int savePlot = -1);
0868 TCanvas* plotEMeanDraw(std::vector<std::string> fnames,
0869                        std::vector<std::string> hlts,
0870                        int var,
0871                        int eta,
0872                        int pv = 0,
0873                        bool approve = false,
0874                        std::string dtype = "Data",
0875                        int coloff = 0);
0876 TCanvas* plotEMeanRatioDraw(std::vector<std::string> fnames,
0877                             std::vector<std::string> hlts,
0878                             int var,
0879                             int eta,
0880                             int pv = 0,
0881                             bool approve = false,
0882                             std::string dtype = "Data",
0883                             int coloff = 0);
0884 void plotEMeanRatioXAll(std::string fname = "pikp/FBE4p3vMixStudyHLT.root",
0885                         std::string hlt = "10.4p03 FTFP_BERT_EMM",
0886                         std::string postfix = "F",
0887                         int savePlot = 2);
0888 TCanvas* plotEMeanRatioDrawX(std::string fname = "pikp/FBE4p3vMixStudyHLT.root",
0889                              std::string hlt = "10.4p03 FTFP_BERT_EMM",
0890                              int var = 0,
0891                              int pv = 0);
0892 TCanvas* plotEnergies(std::vector<std::string> fnames,
0893                       std::vector<std::string> hlts,
0894                       int var = 0,
0895                       int ien = 0,
0896                       int eta = 0,
0897                       int pv = 0,
0898                       bool varbin = false,
0899                       int rebin = 1,
0900                       bool approve = false,
0901                       std::string dtype = "Data",
0902                       bool logy = true,
0903                       int pos = 0,
0904                       int coloff = 0);
0905 TCanvas* plotEnergy(std::string fname = "hlt.root",
0906                     std::string HLT = "All HLTs",
0907                     int var = 0,
0908                     int ien = 0,
0909                     int eta = 0,
0910                     bool varbin = false,
0911                     int rebin = 1,
0912                     bool approve = false,
0913                     bool logy = true,
0914                     int pos = 0,
0915                     int coloff = 0);
0916 void plotEMeanPVAll(std::string fname = "StudyHLT_ZeroBias_1PV.root",
0917                     std::string HLT = "Zero Bias",
0918                     int var = -1,
0919                     int eta = -1,
0920                     bool approve = true);
0921 TCanvas* plotEMeanDrawPV(std::string fname = "StudyHLT_ZeroBias_1PV.root",
0922                          std::string HLT = "Zero Bias",
0923                          int var = 0,
0924                          int eta = 0,
0925                          bool approve = true);
0926 TCanvas* plotEnergyPV(std::string fnamee = "StudyHLT_HLTZeroBias.root",
0927                       std::string HLT = "Zero Bias",
0928                       int var = 0,
0929                       int ien = 0,
0930                       int eta = 0,
0931                       bool varbin = false,
0932                       int rebin = 1,
0933                       bool approve = false,
0934                       bool logy = true,
0935                       int pos = 0);
0936 TCanvas* plotTrack(std::string fname = "hlt.root",
0937                    std::string HLT = "All HLTs",
0938                    int var = 0,
0939                    bool varbin = false,
0940                    int rebin = 1,
0941                    bool approve = false,
0942                    bool logy = true,
0943                    int pos = 0);
0944 TCanvas* plotIsolation(std::string fname = "hlt.root",
0945                        std::string HLT = "All HLTs",
0946                        int var = 0,
0947                        bool varbin = false,
0948                        int rebin = 1,
0949                        bool approve = false,
0950                        bool logy = true,
0951                        int pos = 0);
0952 TCanvas* plotHLT(std::string fname = "hlt.root",
0953                  std::string HLT = "All HLTs",
0954                  int run = -1,
0955                  bool varbin = false,
0956                  int rebin = 1,
0957                  bool approve = false,
0958                  bool logy = true,
0959                  int pos = 0);
0960 TCanvas* plotHisto(char* cname,
0961                    std::string HLT,
0962                    TObjArray& histArr,
0963                    std::vector<std::string>& labels,
0964                    std::vector<int>& color,
0965                    char* name,
0966                    double ymx0,
0967                    bool logy,
0968                    int pos,
0969                    double yloff,
0970                    double yhoff,
0971                    double xmax = -1,
0972                    bool varbin = false,
0973                    int rebin = 1,
0974                    bool approve = false);
0975 void getHistStats(TH1D* h,
0976                   int& entries,
0977                   int& integral,
0978                   double& mean,
0979                   double& meanE,
0980                   double& rms,
0981                   double& rmsE,
0982                   int& uflow,
0983                   int& oflow);
0984 TFitResultPtr getHistFitStats(
0985     TH1F* h, const char* formula, double xlow, double xup, unsigned int& nPar, double* par, double* epar);
0986 void setHistAttr(TH1F* h, int icol, int lwid = 1, int ltype = 1);
0987 double getWeightedMean(int npt, int Start, std::vector<double>& mean, std::vector<double>& emean);
0988 TH1D* rebin(TH1D* histin, int);
0989 
0990 void plotAll(std::string fname,
0991              std::string HLT,
0992              int var,
0993              int ien,
0994              int eta,
0995              bool varbin,
0996              int rebin,
0997              bool approve,
0998              bool logy,
0999              int pos,
1000              bool pv,
1001              int savePlot) {
1002   int varmin(0), varmax(5), enemin(0), enemax(9), etamin(0), etamax(etaMax);
1003   if (var >= 0)
1004     varmin = varmax = var;
1005   if (ien >= 0)
1006     enemin = enemax = ien;
1007   if (eta >= 0)
1008     etamin = etamax = eta;
1009   for (int var = varmin; var <= varmax; ++var) {
1010     for (int ene = enemin; ene <= enemax; ++ene) {
1011       for (int eta = etamin; eta <= etamax; ++eta) {
1012         TCanvas* c(0);
1013         if (pv) {
1014           c = plotEnergyPV(fname, HLT, var, ene, eta, varbin, rebin, approve, logy, pos);
1015         } else {
1016           c = plotEnergy(fname, HLT, var, ene, eta, varbin, rebin, approve, logy, pos);
1017         }
1018         if (c != 0 && savePlot >= 0 && savePlot <= 3) {
1019           std::string ext[4] = {"eps", "gif", "pdf", "C"};
1020           char name[200];
1021           sprintf(name, "%s.%s", c->GetName(), ext[savePlot].c_str());
1022           c->Print(name);
1023         }
1024       }
1025     }
1026   }
1027 }
1028 
1029 void plotEnergyAll(std::string fname,
1030                    std::string hlt,
1031                    int models,
1032                    int pv,
1033                    int data,
1034                    bool varbin,
1035                    int rebin,
1036                    bool approve,
1037                    bool logy,
1038                    int pos,
1039                    int var,
1040                    int ene,
1041                    int eta,
1042                    int savePlot) {
1043   std::vector<std::string> fnames, hlts;
1044   std::string dtype = (data == 1) ? "Data" : "MC";
1045   int modeluse(models);
1046   int coloff = (data == 4) ? 0 : 1;
1047   if (fname == "") {
1048     if (data == 1) {
1049       for (int i = 0; i < nmodels; ++i) {
1050         if (modeluse % 2 == 1) {
1051           fnames.push_back(files[i]);
1052           hlts.push_back(types[i]);
1053         }
1054         modeluse /= 2;
1055       }
1056     } else if (data == 4) {
1057       for (int i = 0; i < nmodelx; ++i) {
1058         if (modeluse % 2 == 1) {
1059           fnames.push_back(filex[i]);
1060           hlts.push_back(typex[i]);
1061         }
1062         modeluse /= 2;
1063       }
1064     } else {
1065       for (int i = 0; i < nmodelm; ++i) {
1066         if (modeluse % 2 == 1) {
1067           fnames.push_back(filem[i]);
1068           hlts.push_back(typem[i]);
1069         }
1070         modeluse /= 2;
1071       }
1072     }
1073   } else {
1074     fnames.push_back(fname);
1075     hlts.push_back(hlt);
1076   }
1077   int varmin(0), varmax(5), enemin(0), enemax(9), etamin(0), etamax(etaMax);
1078   if (var >= varmin && var <= varmax)
1079     varmin = varmax = var;
1080   if (ene >= enemin && ene <= enemax)
1081     enemin = enemax = ene;
1082   if (eta >= etamin && eta <= etamax)
1083     etamin = etamax = eta;
1084   for (int var = varmin; var <= varmax; ++var) {
1085     for (int ene = enemin; ene <= enemax; ++ene) {
1086       for (int eta = etamin; eta <= etamax; ++eta) {
1087         TCanvas* c = plotEnergies(fnames, hlts, var, ene, eta, pv, varbin, rebin, approve, dtype, logy, pos, coloff);
1088         if (c != 0 && savePlot >= 0 && savePlot <= 3) {
1089           std::string ext[4] = {"eps", "gif", "pdf", "C"};
1090           char name[200];
1091           sprintf(name, "%s.%s", c->GetName(), ext[savePlot].c_str());
1092           c->Print(name);
1093         }
1094       }
1095     }
1096   }
1097 }
1098 
1099 void plotEMeanAll(int data, int models, bool ratio, bool approve, std::string postfix, int savePlot) {
1100   int varmin(0), varmax(5), pvmin(0), pvmax(0), etamin(0), etamax(etaMax);
1101   for (int var = varmin; var <= varmax; ++var) {
1102     for (int eta = etamin; eta <= etamax; ++eta) {
1103       for (int pv = pvmin; pv <= pvmax; ++pv) {
1104         plotEMean("", "", models, var, eta, pv, data, ratio, approve, postfix, savePlot);
1105       }
1106     }
1107   }
1108 }
1109 
1110 void plotEMean(std::string fname,
1111                std::string hlt,
1112                int models,
1113                int var,
1114                int eta,
1115                int pv,
1116                int data,
1117                bool ratio,
1118                bool approve,
1119                std::string postfix,
1120                int savePlot) {
1121   std::vector<std::string> fnames, hlts;
1122   std::string dtype = (data == 1) ? "Data" : "MC";
1123   int modeluse(models);
1124   int coloff = (data == 4 || data == 3) ? 0 : 1;
1125   if (fname == "") {
1126     if (data == 1) {
1127       for (int i = 0; i < nmodels; ++i) {
1128         if (modeluse % 2 == 1) {
1129           fnames.push_back(files[i]);
1130           hlts.push_back(types[i]);
1131         }
1132         modeluse /= 2;
1133       }
1134     } else if (data == 4) {
1135       for (int i = 0; i < nmodelx; ++i) {
1136         if (modeluse % 2 == 1) {
1137           fnames.push_back(filex[i]);
1138           hlts.push_back(typex[i]);
1139         }
1140         modeluse /= 2;
1141       }
1142     } else if (data == 3) {
1143       for (int i = 0; i < nmodelx; ++i) {
1144         if (modeluse % 2 == 1) {
1145           fnames.push_back(filex[i]);
1146           hlts.push_back(typex[i]);
1147         }
1148         modeluse /= 2;
1149       }
1150     } else {
1151       for (int i = 0; i < nmodelm; ++i) {
1152         if (modeluse % 2 == 1) {
1153           fnames.push_back(filem[i]);
1154           hlts.push_back(typem[i]);
1155         }
1156         modeluse /= 2;
1157       }
1158     }
1159   } else {
1160     fnames.push_back(fname);
1161     hlts.push_back(hlt);
1162   }
1163   int varmin(0), varmax(5), etamin(0), etamax(etaMax), pvmin(0), pvmax(4);
1164   if (var >= 0)
1165     varmin = varmax = var;
1166   if (eta >= 0)
1167     etamin = etamax = eta;
1168   if (pv >= 0)
1169     pvmin = pvmax = pv;
1170   for (int var = varmin; var <= varmax; ++var) {
1171     for (int eta = etamin; eta <= etamax; ++eta) {
1172       for (int pv = pvmin; pv <= pvmax; ++pv) {
1173         TCanvas* c = ((ratio) ? plotEMeanRatioDraw(fnames, hlts, var, eta, pv, approve, dtype, coloff)
1174                               : plotEMeanDraw(fnames, hlts, var, eta, pv, approve, dtype, coloff));
1175         if (c != 0 && savePlot >= 0 && savePlot <= 3) {
1176           std::string ext[4] = {"eps", "gif", "pdf", "C"};
1177           char name[200];
1178           sprintf(name, "%s%s.%s", c->GetName(), postfix.c_str(), ext[savePlot].c_str());
1179           c->Print(name);
1180         }
1181       }
1182     }
1183   }
1184 }
1185 
1186 TCanvas* plotEMeanDraw(std::vector<std::string> fnames,
1187                        std::vector<std::string> hlts,
1188                        int var,
1189                        int eta,
1190                        int pv,
1191                        bool approve,
1192                        std::string dtype,
1193                        int coloff) {
1194   bool debug(false);
1195   std::vector<TGraphAsymmErrors*> graphs;
1196   double yminx = (fnames.size() < 3) ? 0.85 : 0.75;
1197   TLegend* legend = new TLegend(0.60, yminx, 0.975, 0.95);
1198   legend->SetBorderSize(1);
1199   legend->SetFillColor(kWhite);
1200   legend->SetMargin(0.2);
1201   for (unsigned int k = 0; k < fnames.size(); ++k) {
1202     TFile* file = TFile::Open(fnames[k].c_str());
1203     double mean[NPT], dmean[NPT];
1204     for (int i = 0; i < NPT; ++i) {
1205       char name[100];
1206       sprintf(name, "h_energy_%d_%d_%d_%d", pv + 3, i, eta, var);
1207       TH1D* histo = (TH1D*)file->FindObjectAny(name);
1208       if (histo) {
1209         mean[i] = histo->GetMean();
1210         dmean[i] = histo->GetMeanError();
1211       } else {
1212         mean[i] = -100.;
1213         dmean[i] = 0;
1214       }
1215     }
1216     if (debug) {
1217       std::cout << "Get mean for " << NPT << " points" << std::endl;
1218       for (int i = 0; i < NPT; ++i)
1219         std::cout << "[" << i << "]"
1220                   << " Momentum " << mom[i] << " +- " << dmom[i] << " Mean " << mean[i] << " +- " << dmean[i]
1221                   << std::endl;
1222     }
1223     TGraphAsymmErrors* graph = new TGraphAsymmErrors(NPT, mom, mean, dmom, dmom, dmean, dmean);
1224     graph->SetMarkerStyle(styles[coloff + k]);
1225     graph->SetMarkerColor(colors[coloff + k]);
1226     graph->SetMarkerSize(1.2);
1227     graph->SetLineColor(colors[coloff + k]);
1228     graph->SetLineWidth(2);
1229     graphs.push_back(graph);
1230     legend->AddEntry(graph, hlts[k].c_str(), "lp");
1231     if (debug)
1232       std::cout << "Complete " << hlts[k] << std::endl;
1233     file->Close();
1234   }
1235 
1236   char cname[100], name[200];
1237   sprintf(cname, "c_%s_%d_%d_%s", varEne1[var].c_str(), eta, pv, dtype.c_str());
1238   gStyle->SetCanvasBorderMode(0);
1239   gStyle->SetCanvasColor(kWhite);
1240   gStyle->SetPadColor(kWhite);
1241   gStyle->SetFillColor(kWhite);
1242   gStyle->SetOptTitle(kFALSE);
1243   gStyle->SetPadBorderMode(0);
1244   gStyle->SetCanvasBorderMode(0);
1245   TCanvas* canvas = new TCanvas(cname, cname, 500, 400);
1246   gStyle->SetOptStat(0);
1247   gPad->SetTopMargin(0.05);
1248   gPad->SetLeftMargin(0.15);
1249   gPad->SetRightMargin(0.025);
1250   gPad->SetBottomMargin(0.20);
1251   TH1F* vFrame = canvas->DrawFrame(0.0, 0.01, 50.0, 0.5);
1252   vFrame->GetYaxis()->SetRangeUser(0.0, 1.6);
1253   vFrame->GetXaxis()->SetLabelSize(0.06);
1254   vFrame->GetYaxis()->SetLabelSize(0.05);
1255   vFrame->GetXaxis()->SetTitleSize(0.06);
1256   vFrame->GetYaxis()->SetTitleSize(0.06);
1257   vFrame->GetYaxis()->SetTitleOffset(0.9);
1258   vFrame->GetXaxis()->SetRangeUser(1.0, 20.0);
1259   if (approve) {
1260     sprintf(name, "Mean of %s/p_{Track}", varEne[var].c_str());
1261   } else {
1262     sprintf(name, "<%s/p_{Track}>", varEne[var].c_str());
1263   }
1264   vFrame->GetYaxis()->SetTitle(name);
1265   sprintf(name, "p_{Track} (GeV/c)");
1266   vFrame->GetXaxis()->SetTitle(name);
1267   for (unsigned int ii = 0; ii < graphs.size(); ++ii)
1268     graphs[ii]->Draw("P");
1269   legend->Draw();
1270   TLine* line = new TLine(1.0, 1.0, 20.0, 1.0);
1271   line->SetLineStyle(2);
1272   line->SetLineWidth(2);
1273   line->SetLineColor(kRed);
1274   line->Draw();
1275   TPaveText* text = new TPaveText(0.25, 0.74, 0.55, 0.79, "brNDC");
1276   if (approve) {
1277     sprintf(name, "(%s)", nameEtas[eta].c_str());
1278   } else {
1279     sprintf(name, "(%s, %s)", nameEta[eta].c_str(), namePV[pv].c_str());
1280   }
1281   if (debug)
1282     std::cout << "Name " << name << " |" << std::endl;
1283   text->AddText(name);
1284   text->Draw("same");
1285   TPaveText* text2 = new TPaveText(0.55, yminx - 0.06, 0.97, yminx - 0.01, "brNDC");
1286   sprintf(name, cmsP.c_str());
1287   text2->AddText(name);
1288   text2->Draw("same");
1289   return canvas;
1290 }
1291 
1292 TCanvas* plotEMeanRatioDraw(std::vector<std::string> fnames,
1293                             std::vector<std::string> hlts,
1294                             int var,
1295                             int eta,
1296                             int pv,
1297                             bool approve,
1298                             std::string dtype,
1299                             int coloff) {
1300   bool debug(false);
1301   std::vector<TGraphAsymmErrors*> graphs;
1302   double yminx = (fnames.size() < 3) ? 0.88 : 0.80;
1303   TLegend* legend = new TLegend(0.60, yminx, 0.975, 0.95);
1304   legend->SetBorderSize(1);
1305   legend->SetFillColor(kWhite);
1306   legend->SetMargin(0.2);
1307   const int NPT2 = 2 * NPT + 2;
1308   double mean0[NPT], dmean0[NPT], ones[NPT];
1309   double pmom1[NPT2 + 1], dmean1[NPT2 + 1];
1310   for (unsigned int k = 0; k < fnames.size(); ++k) {
1311     TFile* file = TFile::Open(fnames[k].c_str());
1312     double mean[NPT], dmean[NPT];
1313     for (int i = 0; i < NPT; ++i) {
1314       char name[100];
1315       sprintf(name, "h_energy_%d_%d_%d_%d", pv + 3, i, eta, var);
1316       TH1D* histo = (TH1D*)file->FindObjectAny(name);
1317       if (histo) {
1318         mean[i] = histo->GetMean();
1319         dmean[i] = histo->GetMeanError();
1320       } else {
1321         mean[i] = -100.;
1322         dmean[i] = 0;
1323       }
1324     }
1325     if (debug) {
1326       std::cout << "Get mean for " << NPT << " points" << std::endl;
1327       for (int i = 0; i < NPT; ++i)
1328         std::cout << "[" << i << "]"
1329                   << " Momentum " << mom[i] << " +- " << dmom[i] << " Mean " << mean[i] << " +- " << dmean[i]
1330                   << std::endl;
1331     }
1332     if (k == 0) {
1333       for (int i = 0; i < NPT; ++i) {
1334         ones[i] = 1.0;
1335         mean0[i] = mean[i];
1336         dmean0[i] = dmean[i];
1337         pmom1[i] = mom[i] - dmom[i];
1338         pmom1[NPT2 - i - 1] = pmom1[i];
1339         dmean1[i] = (mean[i] > 0) ? dmean[i] / mean[i] : 0.0;
1340         dmean1[NPT2 - i - 1] = -dmean1[i];
1341       }
1342       pmom1[NPT + 1] = pmom1[NPT] = mom[NPT - 1] + dmom[NPT - 1];
1343       dmean1[NPT] = dmean1[NPT - 1];
1344       dmean1[NPT + 1] = -dmean1[NPT];
1345       pmom1[NPT2] = pmom1[0];
1346       dmean1[NPT2] = dmean1[0];
1347       if (debug)
1348         for (int k = 0; k < NPT2 + 1; ++k)
1349           std::cout << "[" << k << "] " << pmom1[k] << " " << dmean1[k] << "\n";
1350     } else {
1351       double sumNum(0), sumDen(0), sumNum1(0), sumDen1(0);
1352       for (int i = 0; i < NPT; ++i) {
1353         if (dmean[i] > 0 && dmean0[i] > 0) {
1354           double er1 = dmean[i] / mean[i];
1355           double er2 = dmean0[i] / mean0[i];
1356           mean[i] = mean[i] / mean0[i];
1357           dmean[i] = mean[i] * sqrt(er1 * er1 + er2 * er2);
1358           double temp1 = (mean[i] > 1.0) ? 1.0 / mean[i] : mean[i];
1359           double temp2 = (mean[i] > 1.0) ? dmean[i] / (mean[i] * mean[i]) : dmean[i];
1360           if (i > 0) {
1361             sumNum += (fabs(1 - temp1) / (temp2 * temp2));
1362             sumDen += (1.0 / (temp2 * temp2));
1363           }
1364           sumNum1 += (fabs(1 - temp1) / (temp2 * temp2));
1365           sumDen1 += (1.0 / (temp2 * temp2));
1366         } else {
1367           mean[i] = -100.;
1368           dmean[i] = 0;
1369         }
1370       }
1371       sumNum = (sumDen > 0) ? (sumNum / sumDen) : 0;
1372       sumDen = (sumDen > 0) ? 1.0 / sqrt(sumDen) : 0;
1373       sumNum1 = (sumDen1 > 0) ? (sumNum1 / sumDen1) : 0;
1374       sumDen1 = (sumDen1 > 0) ? 1.0 / sqrt(sumDen1) : 0;
1375       std::cout << "Get Ratio of mean for " << NPT << " points: Mean " << sumNum << " +- " << sumDen << " (" << sumNum1
1376                 << " +- " << sumDen1 << ") Input: " << fnames[k] << " var|eta|pv " << var << ":" << eta << ":" << pv
1377                 << std::endl;
1378       if (debug) {
1379         std::cout << "Get Ratio of mean for " << NPT << " points: Mean " << sumNum << " +- " << sumDen << std::endl;
1380         for (int i = 0; i < NPT; ++i)
1381           std::cout << "[" << i << "]"
1382                     << " Momentum " << mom[i] << " +- " << dmom[i] << " Mean " << mean[i] << " +- " << dmean[i]
1383                     << std::endl;
1384       }
1385       TGraphAsymmErrors* graph = new TGraphAsymmErrors(NPT, mom, mean, dmom, dmom, dmean, dmean);
1386       graph->SetMarkerStyle(styles[coloff + k]);
1387       graph->SetMarkerColor(colors[coloff + k]);
1388       graph->SetMarkerSize(1.2);
1389       graph->SetLineColor(colors[coloff + k]);
1390       graph->SetLineWidth(2);
1391       graphs.push_back(graph);
1392       char text[100];
1393       if (approve) {
1394         sprintf(text, "%s", hlts[k].c_str());
1395       } else {
1396         sprintf(text, "%5.3f #pm %5.3f  %s", sumNum, sumDen, hlts[k].c_str());
1397       }
1398       legend->AddEntry(graph, text, "lp");
1399       if (debug)
1400         std::cout << "Complete " << hlts[k] << std::endl;
1401     }
1402     file->Close();
1403   }
1404   TGraphErrors* graph = new TGraphErrors(NPT, mom, ones, dmean1);
1405   graph->SetFillColor(4);
1406   graph->SetFillStyle(3005);
1407   TPolyLine* pline = new TPolyLine(NPT2 + 1, pmom1, dmean1);
1408   pline->SetFillColor(5);
1409   pline->SetLineColor(6);
1410   pline->SetLineWidth(2);
1411 
1412   char cname[100], name[200];
1413   sprintf(cname, "cR_%s_%d_%d_%s", varEne1[var].c_str(), eta, pv, dtype.c_str());
1414   gStyle->SetCanvasBorderMode(0);
1415   gStyle->SetCanvasColor(kWhite);
1416   gStyle->SetPadColor(kWhite);
1417   gStyle->SetFillColor(kWhite);
1418   gStyle->SetOptTitle(kFALSE);
1419   gStyle->SetPadBorderMode(0);
1420   gStyle->SetCanvasBorderMode(0);
1421   TCanvas* canvas = new TCanvas(cname, cname, 500, 400);
1422   gStyle->SetOptStat(0);
1423   gPad->SetTopMargin(0.05);
1424   gPad->SetLeftMargin(0.15);
1425   gPad->SetRightMargin(0.025);
1426   gPad->SetBottomMargin(0.20);
1427   TH1F* vFrame = canvas->DrawFrame(0.0, 0.01, 50.0, 0.5);
1428   vFrame->GetYaxis()->SetRangeUser(0.4, 1.5);
1429   vFrame->GetXaxis()->SetLabelSize(0.06);
1430   vFrame->GetYaxis()->SetLabelSize(0.05);
1431   vFrame->GetXaxis()->SetTitleSize(0.06);
1432   vFrame->GetYaxis()->SetTitleSize(0.045);
1433   vFrame->GetYaxis()->SetTitleOffset(1.2);
1434   vFrame->GetXaxis()->SetRangeUser(1.0, 20.0);
1435   if (approve) {
1436     sprintf(name, "%s/Data for mean of %s/p_{Track}", dtype.c_str(), varEne[var].c_str());
1437   } else {
1438     sprintf(name, "#frac{%s}{%s} for #frac{%s}{p_{Track}}", dtype.c_str(), hlts[0].c_str(), varEne[var].c_str());
1439   }
1440   vFrame->GetYaxis()->SetTitle(name);
1441   sprintf(name, "p_{Track} (GeV/c)");
1442   vFrame->GetXaxis()->SetTitle(name);
1443   for (unsigned int ii = 0; ii < graphs.size(); ++ii)
1444     graphs[ii]->Draw("P");
1445   graph->Draw("3");
1446   legend->Draw();
1447   TLine* line = new TLine(1.0, 1.0, 20.0, 1.0);
1448   line->SetLineStyle(2);
1449   line->SetLineWidth(2);
1450   line->SetLineColor(kRed);
1451   line->Draw();
1452   pline->Draw("f L SAME");
1453   TPaveText* text = new TPaveText(0.55, 0.40, 0.95, 0.45, "brNDC");
1454   if (approve) {
1455     sprintf(name, "(%s)", nameEtas[eta].c_str());
1456   } else {
1457     sprintf(name, "(%s, %s)", nameEta[eta].c_str(), namePV[pv].c_str());
1458   }
1459   if (debug)
1460     std::cout << "Name " << name << " |" << std::endl;
1461   text->AddText(name);
1462   text->Draw("same");
1463   TPaveText* text2 = new TPaveText(0.55, 0.45, 0.95, 0.50, "brNDC");
1464   sprintf(name, cmsP.c_str());
1465   text2->AddText(name);
1466   text2->Draw("same");
1467   return canvas;
1468 }
1469 
1470 void plotEMeanRatioXAll(std::string fname, std::string hlt, std::string postfix, int savePlot) {
1471   int varmin(0), varmax(5), pvmin(0), pvmax(0);
1472   for (int var = varmin; var <= varmax; ++var) {
1473     for (int pv = pvmin; pv <= pvmax; ++pv) {
1474       TCanvas* c = plotEMeanRatioDrawX(fname, hlt, var, pv);
1475       if (savePlot >= 0 && savePlot <= 3) {
1476         std::string ext[4] = {"eps", "gif", "pdf", "C"};
1477         char name[200];
1478         sprintf(name, "%s%s.%s", c->GetName(), postfix.c_str(), ext[savePlot].c_str());
1479         c->Print(name);
1480       }
1481     }
1482   }
1483 }
1484 
1485 TCanvas* plotEMeanRatioDrawX(std::string fname, std::string hlt, int var, int pv) {
1486   bool debug(false);
1487   std::vector<TGraphAsymmErrors*> graphs;
1488   double yminx = 0.80;
1489   TLegend* legend = new TLegend(0.60, yminx, 0.975, 0.95);
1490   legend->SetBorderSize(1);
1491   legend->SetFillColor(kWhite);
1492   legend->SetMargin(0.2);
1493   double mean0[NPT], dmean0[NPT], mean[NPT], dmean[NPT];
1494   char name[200], cname[100];
1495   for (int eta = 0; eta <= etaMax; ++eta) {
1496     // First Data
1497     TFile* file = TFile::Open(fileData.c_str());
1498     for (int i = 0; i < NPT; ++i) {
1499       sprintf(name, "h_energy_%d_%d_%d_%d", pv + 3, i, eta, var);
1500       TH1D* histo = (TH1D*)file->FindObjectAny(name);
1501       if (histo) {
1502         mean0[i] = histo->GetMean();
1503         dmean0[i] = histo->GetMeanError();
1504       } else {
1505         mean0[i] = -100.;
1506         dmean0[i] = 0;
1507       }
1508     }
1509     file->Close();
1510     // Now MC
1511     file = TFile::Open(fname.c_str());
1512     for (int i = 0; i < NPT; ++i) {
1513       sprintf(name, "h_energy_%d_%d_%d_%d", pv + 3, i, eta, var);
1514       TH1D* histo = (TH1D*)file->FindObjectAny(name);
1515       if (histo) {
1516         mean[i] = histo->GetMean();
1517         dmean[i] = histo->GetMeanError();
1518       } else {
1519         mean[i] = -100.;
1520         dmean[i] = 0;
1521       }
1522     }
1523     file->Close();
1524     if (debug) {
1525       std::cout << "Get mean for " << NPT << " points" << std::endl;
1526       for (int i = 0; i < NPT; ++i)
1527         std::cout << "[" << i << "]"
1528                   << " Momentum " << mom[i] << " +- " << dmom[i] << " Data:Mean " << mean0[i] << " +- " << dmean0[i]
1529                   << " MC:Mean " << mean[i] << " +- " << dmean[i] << std::endl;
1530     }
1531     double sumNum(0), sumDen(0), sumNum1(0), sumDen1(0);
1532     for (int i = 0; i < NPT; ++i) {
1533       if (dmean[i] > 0 && dmean0[i] > 0) {
1534         double er1 = dmean[i] / mean[i];
1535         double er2 = dmean0[i] / mean0[i];
1536         mean[i] = mean[i] / mean0[i];
1537         dmean[i] = mean[i] * sqrt(er1 * er1 + er2 * er2);
1538         double temp1 = (mean[i] > 1.0) ? 1.0 / mean[i] : mean[i];
1539         double temp2 = (mean[i] > 1.0) ? dmean[i] / (mean[i] * mean[i]) : dmean[i];
1540         if (i > 0) {
1541           sumNum += (fabs(1 - temp1) / (temp2 * temp2));
1542           sumDen += (1.0 / (temp2 * temp2));
1543         }
1544         sumNum1 += (fabs(1 - temp1) / (temp2 * temp2));
1545         sumDen1 += (1.0 / (temp2 * temp2));
1546       } else {
1547         mean[i] = -100.;
1548         dmean[i] = 0;
1549       }
1550     }
1551     sumNum = (sumDen > 0) ? (sumNum / sumDen) : 0;
1552     sumDen = (sumDen > 0) ? 1.0 / sqrt(sumDen) : 0;
1553     sumNum1 = (sumDen1 > 0) ? (sumNum1 / sumDen1) : 0;
1554     sumDen1 = (sumDen1 > 0) ? 1.0 / sqrt(sumDen1) : 0;
1555     std::cout << "Get Ratio of mean for " << NPT << " points: Mean " << sumNum << " +- " << sumDen << " (" << sumNum1
1556               << " +- " << sumDen1 << ") Input: " << fname << " var|eta|pv " << var << ":" << eta << ":" << pv
1557               << std::endl;
1558     if (debug) {
1559       std::cout << "Get Ratio of mean for " << NPT << " points: Mean " << sumNum << " +- " << sumDen << std::endl;
1560       for (int i = 0; i < NPT; ++i)
1561         std::cout << "[" << i << "]"
1562                   << " Momentum " << mom[i] << " +- " << dmom[i] << " Mean " << mean[i] << " +- " << dmean[i]
1563                   << std::endl;
1564     }
1565     TGraphAsymmErrors* graph = new TGraphAsymmErrors(NPT, mom, mean, dmom, dmom, dmean, dmean);
1566     graph->SetMarkerStyle(styles[eta]);
1567     graph->SetMarkerColor(colors[eta]);
1568     graph->SetMarkerSize(1.2);
1569     graph->SetLineColor(colors[eta]);
1570     graph->SetLineWidth(2);
1571     graphs.push_back(graph);
1572     sprintf(cname, "%s", nameEtas[eta].c_str());
1573     legend->AddEntry(graph, cname, "lp");
1574   }
1575 
1576   sprintf(cname, "cR_%s_%d", varEne1[var].c_str(), pv);
1577   gStyle->SetCanvasBorderMode(0);
1578   gStyle->SetCanvasColor(kWhite);
1579   gStyle->SetPadColor(kWhite);
1580   gStyle->SetFillColor(kWhite);
1581   gStyle->SetOptTitle(kFALSE);
1582   gStyle->SetPadBorderMode(0);
1583   gStyle->SetCanvasBorderMode(0);
1584   TCanvas* canvas = new TCanvas(cname, cname, 750, 600);
1585   gStyle->SetOptStat(0);
1586   gPad->SetTopMargin(0.05);
1587   gPad->SetLeftMargin(0.15);
1588   gPad->SetRightMargin(0.025);
1589   gPad->SetBottomMargin(0.20);
1590   TH1F* vFrame = canvas->DrawFrame(0.0, 0.01, 50.0, 0.5);
1591   vFrame->GetYaxis()->SetRangeUser(0.4, 1.5);
1592   vFrame->GetXaxis()->SetLabelSize(0.06);
1593   vFrame->GetYaxis()->SetLabelSize(0.05);
1594   vFrame->GetXaxis()->SetTitleSize(0.06);
1595   vFrame->GetYaxis()->SetTitleSize(0.045);
1596   vFrame->GetYaxis()->SetTitleOffset(1.2);
1597   vFrame->GetXaxis()->SetRangeUser(1.0, 20.0);
1598   sprintf(name, "MC/Data for mean of %s/p_{Track}", varEne[var].c_str());
1599   vFrame->GetYaxis()->SetTitle(name);
1600   sprintf(name, "p_{Track} (GeV/c)");
1601   vFrame->GetXaxis()->SetTitle(name);
1602   for (unsigned int ii = 0; ii < graphs.size(); ++ii)
1603     graphs[ii]->Draw("P");
1604   legend->Draw();
1605   TLine* line = new TLine(1.0, 1.0, 20.0, 1.0);
1606   line->SetLineStyle(2);
1607   line->SetLineWidth(2);
1608   line->SetLineColor(kRed);
1609   line->Draw();
1610   TPaveText* text = new TPaveText(0.60, 0.40, 0.92, 0.45, "brNDC");
1611   sprintf(name, "%s", hlt.c_str());
1612   text->AddText(name);
1613   text->Draw("same");
1614   TPaveText* text2 = new TPaveText(0.55, 0.45, 0.95, 0.50, "brNDC");
1615   sprintf(name, "%s", cmsP.c_str());
1616   text2->AddText(name);
1617   text2->Draw("same");
1618   return canvas;
1619 }
1620 
1621 TCanvas* plotEnergies(std::vector<std::string> fnames,
1622                       std::vector<std::string> hlts,
1623                       int var,
1624                       int ien,
1625                       int eta,
1626                       int pv,
1627                       bool varbin,
1628                       int rebin,
1629                       bool approve,
1630                       std::string dtype,
1631                       bool logy,
1632                       int pos,
1633                       int coloff) {
1634   TLegend* legend = new TLegend(0.55, 0.70, 0.95, 0.85);
1635   legend->SetBorderSize(1);
1636   legend->SetFillColor(kWhite);
1637   legend->SetMargin(0.4);
1638   TObjArray histArr;
1639   char name[100];
1640   std::vector<std::string> labels;
1641   std::vector<int> color;
1642   double ymx0(0), ent0(0);
1643   sprintf(name, "h_energy_%d_%d_%d_%d", pv + 3, ien, eta, var);
1644   for (unsigned int k = 0; k < fnames.size(); ++k) {
1645     TFile* file = TFile::Open(fnames[k].c_str());
1646     TH1D* histo = (TH1D*)file->FindObjectAny(name);
1647     if (histo) {
1648       if (k == 0) {
1649         ent0 = histo->GetEntries();
1650       } else {
1651         double scale = (histo->GetEntries() > 0) ? ent0 / histo->GetEntries() : 1;
1652         histo->Scale(scale);
1653       }
1654       histArr.AddLast(histo);
1655       labels.push_back(hlts[k]);
1656       color.push_back(colors[coloff + k]);
1657       int ibin = histo->GetMaximumBin();
1658       if (histo->GetBinContent(ibin) > ymx0)
1659         ymx0 = histo->GetBinContent(ibin);
1660     }
1661   }
1662   TCanvas* c(0);
1663   if (histArr.GetEntries() > 0) {
1664     sprintf(name, "p=%s, %s", varPPs[ien].c_str(), nameEtas[eta].c_str());
1665     /*
1666     if (approve) {
1667       sprintf (name, "p=%s, %s", varPPs[ien].c_str(), nameEtas[eta].c_str());
1668     } else {
1669       sprintf (name, "p=%s, i#eta=%s, %s", varPs[ien].c_str(), varEta[eta].c_str(), namePV[pv].c_str());
1670     }
1671     */
1672     std::string clabel(name);
1673     char cname[50];
1674     sprintf(cname, "c_%s_%d_%d_%s", varEne1[var].c_str(), ien, eta, dtype.c_str());
1675     sprintf(name, "%s/p", varEne[var].c_str());
1676     c = plotHisto(
1677         cname, clabel, histArr, labels, color, name, ymx0, logy, pos, 0.10, 0.05, 2.5, varbin, rebin, approve);
1678   }
1679   return c;
1680 }
1681 
1682 TCanvas* plotEnergy(std::string fname,
1683                     std::string HLT,
1684                     int var,
1685                     int ien,
1686                     int eta,
1687                     bool varbin,
1688                     int rebin,
1689                     bool approve,
1690                     bool logy,
1691                     int pos,
1692                     int coloff) {
1693   TFile* file = TFile::Open(fname.c_str());
1694   char name[100];
1695   TObjArray histArr;
1696   std::vector<std::string> labels;
1697   std::vector<int> color;
1698   double ymx0(0);
1699   for (int i = 0; i < 4; ++i) {
1700     sprintf(name, "h_energy_%d_%d_%d_%d", i, ien, eta, var);
1701     TH1D* histo = (TH1D*)file->FindObjectAny(name);
1702     if (histo) {
1703       histArr.AddLast(histo);
1704       sprintf(name, "p=%s, #eta=%s %s", varPs[ien].c_str(), varEta[eta].c_str(), namefull[i + 3].c_str());
1705       labels.push_back(name);
1706       color.push_back(colors[coloff + i]);
1707       int ibin = histo->GetMaximumBin();
1708       if (histo->GetBinContent(ibin) > ymx0)
1709         ymx0 = histo->GetBinContent(ibin);
1710     }
1711   }
1712   TCanvas* c(0);
1713   if (histArr.GetEntries() > 0) {
1714     char cname[50];
1715     sprintf(cname, "c_%s_%d_%d", varEne1[var].c_str(), ien, eta);
1716     sprintf(name, "%s/p", varEne[var].c_str());
1717     c = plotHisto(cname, HLT, histArr, labels, color, name, ymx0, logy, pos, 0.10, 0.05, 2.5, varbin, rebin, approve);
1718   }
1719   return c;
1720 }
1721 
1722 void plotEMeanPVAll(std::string fname, std::string HLT, int var, int eta, bool approve) {
1723   int varmin(0), varmax(5), etamin(0), etamax(etaMax);
1724   if (var >= 0)
1725     varmin = varmax = var;
1726   if (eta >= 0)
1727     etamin = etamax = eta;
1728   for (int var = varmin; var <= varmax; ++var) {
1729     for (int eta = etamin; eta <= etamax; ++eta) {
1730       plotEMeanDrawPV(fname, HLT, var, eta, approve);
1731     }
1732   }
1733 }
1734 
1735 TCanvas* plotEMeanDrawPV(std::string fname, std::string HLT, int var, int eta, bool approve) {
1736   bool debug(false);
1737   std::vector<TGraphAsymmErrors*> graphs;
1738   TLegend* legend = new TLegend(0.575, 0.80, 0.975, 0.95);
1739   legend->SetBorderSize(1);
1740   legend->SetFillColor(kWhite);
1741   legend->SetMargin(0.4);
1742   TFile* file = TFile::Open(fname.c_str());
1743   const int nPVBin = 4;
1744   int pvBins[nPVBin + 1] = {1, 2, 3, 5, 100};
1745   for (int k = 0; k < nPVBin; ++k) {
1746     char name[100];
1747     double mean[NPT], dmean[NPT];
1748     for (int i = 0; i < NPT; ++i) {
1749       sprintf(name, "h_energy_%d_%d_%d_%d", k, i, eta, var);
1750       TH1D* histo = (TH1D*)file->FindObjectAny(name);
1751       if (histo) {
1752         mean[i] = histo->GetMean();
1753         dmean[i] = histo->GetMeanError();
1754       } else {
1755         mean[i] = -100.;
1756         dmean[i] = 0;
1757       }
1758     }
1759     if (debug) {
1760       std::cout << "Get mean for " << NPT << " points" << std::endl;
1761       for (int i = 0; i < NPT; ++i)
1762         std::cout << "[" << i << "]"
1763                   << " Momentum " << mom[i] << " +- " << dmom[i] << " Mean " << mean[i] << " +- " << dmean[i]
1764                   << std::endl;
1765     }
1766     TGraphAsymmErrors* graph = new TGraphAsymmErrors(NPT, mom, mean, dmom, dmom, dmean, dmean);
1767     graph->SetMarkerStyle(styles[k]);
1768     graph->SetMarkerColor(colors[k]);
1769     graph->SetMarkerSize(1.2);
1770     graph->SetLineColor(colors[k]);
1771     graph->SetLineWidth(2);
1772     graphs.push_back(graph);
1773     sprintf(name, "PV=%d:%d", pvBins[k], pvBins[k + 1] - 1);
1774     legend->AddEntry(graph, name, "lp");
1775     if (debug)
1776       std::cout << "Complete " << name << std::endl;
1777   }
1778   file->Close();
1779 
1780   char cname[100], name[200];
1781   sprintf(cname, "c_%s_PV_%d", varEne1[var].c_str(), eta);
1782   gStyle->SetCanvasBorderMode(0);
1783   gStyle->SetCanvasColor(kWhite);
1784   gStyle->SetPadColor(kWhite);
1785   gStyle->SetFillColor(kWhite);
1786   gStyle->SetOptTitle(kFALSE);
1787   gStyle->SetPadBorderMode(0);
1788   gStyle->SetCanvasBorderMode(0);
1789   TCanvas* canvas = new TCanvas(cname, cname, 500, 400);
1790   gStyle->SetOptStat(0);
1791   gPad->SetTopMargin(0.05);
1792   gPad->SetLeftMargin(0.15);
1793   gPad->SetRightMargin(0.025);
1794   gPad->SetBottomMargin(0.20);
1795   TH1F* vFrame = canvas->DrawFrame(0.0, 0.01, 50.0, 0.5);
1796   vFrame->GetYaxis()->SetRangeUser(0.0, 1.5);
1797   vFrame->GetXaxis()->SetLabelSize(0.06);
1798   vFrame->GetYaxis()->SetLabelSize(0.05);
1799   vFrame->GetXaxis()->SetTitleSize(0.06);
1800   vFrame->GetYaxis()->SetTitleSize(0.06);
1801   vFrame->GetYaxis()->SetTitleOffset(0.9);
1802   vFrame->GetXaxis()->SetRangeUser(1.0, 20.0);
1803   if (approve) {
1804     sprintf(name, "Mean of %s/p_{Track}", varEne[var].c_str());
1805   } else {
1806     sprintf(name, "<%s/p_{Track}>", varEne[var].c_str());
1807   }
1808   vFrame->GetYaxis()->SetTitle(name);
1809   sprintf(name, "p_{Track} (GeV/c)");
1810   vFrame->GetXaxis()->SetTitle(name);
1811   for (unsigned int ii = 0; ii < graphs.size(); ++ii)
1812     graphs[ii]->Draw("P");
1813   legend->Draw();
1814   TLine* line = new TLine(1.0, 1.0, 20.0, 1.0);
1815   line->SetLineStyle(2);
1816   line->SetLineWidth(2);
1817   line->SetLineColor(kRed);
1818   line->Draw();
1819   TPaveText* text = new TPaveText(0.575, 0.75, 0.97, 0.79, "brNDC");
1820   sprintf(name, "%s (%s)", HLT.c_str(), nameEtas[eta].c_str());
1821   if (debug)
1822     std::cout << "Name " << name << " |" << std::endl;
1823   text->AddText(name);
1824   text->Draw("same");
1825   TPaveText* text2 = new TPaveText(0.575, 0.71, 0.97, 0.75, "brNDC");
1826   sprintf(name, cmsP.c_str());
1827   text2->AddText(name);
1828   text2->Draw("same");
1829   return canvas;
1830 }
1831 
1832 TCanvas* plotEnergyPV(std::string fname,
1833                       std::string HLT,
1834                       int var,
1835                       int ien,
1836                       int eta,
1837                       bool varbin,
1838                       int rebin,
1839                       bool approve,
1840                       bool logy,
1841                       int pos) {
1842   const int nPVBin = 4;
1843   int pvBins[nPVBin + 1] = {1, 2, 3, 5, 100};
1844   TFile* file = TFile::Open(fname.c_str());
1845   char name[100];
1846   TObjArray histArr;
1847   std::vector<std::string> labels;
1848   std::vector<int> color;
1849   double ymx0(0);
1850   for (int i = 4; i < nPVBin + 4; ++i) {
1851     sprintf(name, "h_energy_%d_%d_%d_%d", i, ien, eta, var);
1852     TH1D* histo = (TH1D*)file->FindObjectAny(name);
1853     if (histo) {
1854       histArr.AddLast(histo);
1855       sprintf(name,
1856               "p=%s, #eta=%s, PV=%d:%d (%s)",
1857               varPs[ien].c_str(),
1858               varEta[eta].c_str(),
1859               pvBins[i - 4],
1860               pvBins[i - 3] - 1,
1861               namefull[6].c_str());
1862       labels.push_back(name);
1863       color.push_back(colors[i - 4]);
1864       int ibin = histo->GetMaximumBin();
1865       if (histo->GetBinContent(ibin) > ymx0)
1866         ymx0 = histo->GetBinContent(ibin);
1867     }
1868   }
1869   TCanvas* c(0);
1870   if (histArr.GetEntries() > 0) {
1871     char cname[50];
1872     sprintf(cname, "c_%s_%d_%d", varEne1[var].c_str(), ien, eta);
1873     sprintf(name, "%s/p", varEne[var].c_str());
1874     c = plotHisto(cname, HLT, histArr, labels, color, name, ymx0, logy, pos, 0.10, 0.05, 2.5, varbin, rebin, approve);
1875   }
1876   return c;
1877 }
1878 
1879 TCanvas* plotTrack(
1880     std::string fname, std::string HLT, int var, bool varbin, int rebin, bool approve, bool logy, int pos) {
1881   TFile* file = TFile::Open(fname.c_str());
1882   char name[100];
1883   TObjArray histArr;
1884   std::vector<std::string> labels;
1885   std::vector<int> color;
1886   double ymx0(0);
1887   for (int i = 0; i < 7; ++i) {
1888     sprintf(name, "h_%s_%s", varname[var].c_str(), names[i].c_str());
1889     TH1D* histo = (TH1D*)file->FindObjectAny(name);
1890     if (histo) {
1891       histArr.AddLast(histo);
1892       labels.push_back(namefull[i]);
1893       color.push_back(colors[i]);
1894       int ibin = histo->GetMaximumBin();
1895       if (histo->GetBinContent(ibin) > ymx0)
1896         ymx0 = histo->GetBinContent(ibin);
1897     }
1898   }
1899   if (histArr.GetEntries() > 0) {
1900     char cname[50];
1901     sprintf(cname, "c_%s", varname[var].c_str());
1902     sprintf(name, "%s", vartitle[var].c_str());
1903     return plotHisto(cname, HLT, histArr, labels, color, name, ymx0, logy, pos, 0.10, 0.05, -1, varbin, rebin, approve);
1904   } else {
1905     return 0;
1906   }
1907 }
1908 
1909 TCanvas* plotIsolation(
1910     std::string fname, std::string HLT, int var, bool varbin, int rebin, bool approve, bool logy, int pos) {
1911   TFile* file = TFile::Open(fname.c_str());
1912   char name[100];
1913   TObjArray histArr;
1914   std::vector<std::string> labels;
1915   std::vector<int> color;
1916   double ymx0(0);
1917   for (int i = 0; i < 2; ++i) {
1918     sprintf(name, "h_%s_%s", varnameC[var].c_str(), nameC[i].c_str());
1919     TH1D* histo = (TH1D*)file->FindObjectAny(name);
1920     if (histo) {
1921       histArr.AddLast(histo);
1922       labels.push_back(nameCF[i]);
1923       color.push_back(colors[i]);
1924       int ibin = histo->GetMaximumBin();
1925       if (histo->GetBinContent(ibin) > ymx0)
1926         ymx0 = histo->GetBinContent(ibin);
1927     }
1928   }
1929   if (histArr.GetEntries() > 0) {
1930     char cname[50];
1931     sprintf(cname, "c_%s", varnameC[var].c_str());
1932     sprintf(name, "%s (GeV)", vartitlC[var].c_str());
1933     return plotHisto(cname, HLT, histArr, labels, color, name, ymx0, logy, pos, 0.10, 0.05, -1, varbin, rebin, approve);
1934   } else {
1935     return 0;
1936   }
1937 }
1938 
1939 TCanvas* plotHLT(std::string fname, std::string HLT, int run, bool varbin, int rebin, bool approve, bool logy, int pos) {
1940   TFile* file = TFile::Open(fname.c_str());
1941   char name[100];
1942   TObjArray histArr;
1943   std::vector<std::string> labels;
1944   std::vector<int> color;
1945   double ymx0(0);
1946   if (run > 0)
1947     sprintf(name, "h_HLTAccepts_%d", run);
1948   else
1949     sprintf(name, "h_HLTAccept");
1950   TH1D* histo = (TH1D*)file->FindObjectAny(name);
1951   if (histo) {
1952     histArr.AddLast(histo);
1953     labels.push_back(HLT);
1954     color.push_back(colors[3]);
1955     int ibin = histo->GetMaximumBin();
1956     ymx0 = histo->GetBinContent(ibin);
1957   }
1958   if (histArr.GetEntries() > 0) {
1959     char cname[50], hname[50];
1960     if (run > 0) {
1961       sprintf(cname, "c_HLT_%d", run);
1962       sprintf(name, "Run %d", run);
1963     } else {
1964       sprintf(cname, "c_HLTs");
1965       sprintf(name, "All runs");
1966     }
1967     sprintf(hname, " ");
1968     return plotHisto(cname, "", histArr, labels, color, hname, ymx0, logy, pos, 0.40, 0.01, -1, varbin, rebin, approve);
1969   } else {
1970     return 0;
1971   }
1972 }
1973 
1974 TCanvas* plotHisto(char* cname,
1975                    std::string HLT,
1976                    TObjArray& histArr,
1977                    std::vector<std::string>& labels,
1978                    std::vector<int>& color,
1979                    char* name,
1980                    double ymx0,
1981                    bool logy,
1982                    int pos,
1983                    double yloff,
1984                    double yhoff,
1985                    double xmax,
1986                    bool varbin,
1987                    int rebin0,
1988                    bool approve) {
1989   int nentry = histArr.GetEntries();
1990   double ymax = 10.;
1991   for (int i = 0; i < 10; ++i) {
1992     if (ymx0 < ymax)
1993       break;
1994     ymax *= 10.;
1995   }
1996   double ystep = ymax * 0.1;
1997   for (int i = 0; i < 9; ++i) {
1998     if (ymax - ystep < ymx0)
1999       break;
2000     ymax -= ystep;
2001   }
2002   double ymin(0);
2003   if (logy)
2004     ymin = 1;
2005 
2006   gStyle->SetCanvasBorderMode(0);
2007   gStyle->SetCanvasColor(kWhite);
2008   gStyle->SetPadColor(kWhite);
2009   gStyle->SetFillColor(kWhite);
2010   gStyle->SetOptTitle(kFALSE);
2011   gStyle->SetPadBorderMode(0);
2012   gStyle->SetCanvasBorderMode(0);
2013   if (approve)
2014     gStyle->SetOptStat(0);
2015   else
2016     gStyle->SetOptStat(1110);
2017   TCanvas* canvas = new TCanvas(cname, cname, 500, 500);
2018   gPad->SetTopMargin(yhoff);
2019   gPad->SetLeftMargin(0.15);
2020   gPad->SetRightMargin(0.025);
2021   gPad->SetBottomMargin(yloff);
2022   if (logy)
2023     canvas->SetLogy();
2024   double height = 0.08;
2025   double dx = (nentry > 2) ? 0.50 : 0.30;
2026   double dy = (nentry > 2) ? 0.12 : 0.04;
2027   double dy2 = 0.035;
2028   double xmin1 = (pos > 1) ? 0.375 : 0.75 - dx;
2029   double xmin2 = (pos > 1) ? 0.12 : 0.65;
2030   double xmin3 = (pos > 1) ? 0.15 : 0.75;
2031   double ymin1 = (pos % 2 == 0) ? (1.0 - yhoff - dy) : (yloff + 0.02);
2032   double ymin2 = (pos % 2 == 0) ? (0.96 - yhoff - nentry * height) : (yloff + 0.025 + nentry * height);
2033   double ymin3 = (pos % 2 == 0) ? (ymin2 - dy2) : (ymin2 + dy2);
2034   double dx2 = (approve) ? dx : 0.32;
2035   double dx3 = (approve) ? dx : 0.22;
2036   if (approve) {
2037     xmin1 = xmin2 = xmin3 = 0.975 - dx;
2038     ymin1 = (1.0 - yhoff - dy);
2039     ymin2 = ymin1 - dy2 - 0.01;
2040     ymin3 = ymin2 - dy2;
2041   }
2042   TLegend* legend = new TLegend(xmin1, ymin1, xmin1 + dx, ymin1 + dy);
2043   TPaveText *text, *text2;
2044   if (varbin || rebin0 == 1) {
2045     text = new TPaveText(xmin2, ymin2, xmin2 + dx2, ymin2 + dy2, "brNDC");
2046     text2 = new TPaveText(xmin3, ymin3, xmin3 + dx3, ymin3 + dy2, "brNDC");
2047   } else {
2048     text = new TPaveText(0.10, 0.95, dx2 + 0.10, dy2 + 0.95, "brNDC");
2049     text2 = new TPaveText(dx2 + 0.10, 0.95, dx2 + dx3 + 0.10, dy2 + 0.95, "brNDC");
2050   }
2051   legend->SetBorderSize(1);
2052   legend->SetFillColor(kWhite);
2053   char texts[200];
2054   sprintf(texts, cmsP.c_str());
2055   text2->AddText(texts);
2056   THStack* Hs = new THStack("hs2", " ");
2057   for (int i = 0; i < nentry; i++) {
2058     TH1D* h = (varbin) ? rebin((TH1D*)histArr[i], i) : (TH1D*)((TH1D*)histArr[i])->Rebin(rebin0);
2059     h->SetLineColor(color[i]);
2060     h->SetLineStyle(lstyle[i]);
2061     h->SetLineWidth(2);
2062     h->SetMarkerSize(1.0);
2063     double ymax0 = (varbin) ? ymax : rebin0 * ymax;
2064     h->GetYaxis()->SetRangeUser(ymin, ymax0);
2065     if (xmax > 0 && (!varbin))
2066       h->GetXaxis()->SetRangeUser(0, xmax);
2067     Hs->Add(h, "hist sames");
2068     legend->AddEntry(h, labels[i].c_str(), "l");
2069   }
2070   Hs->Draw("nostack");
2071   canvas->Update();
2072   Hs->GetHistogram()->GetXaxis()->SetTitle(name);
2073   Hs->GetHistogram()->GetXaxis()->SetLabelSize(0.035);
2074   Hs->GetHistogram()->GetYaxis()->SetTitleOffset(1.6);
2075   if (varbin) {
2076     Hs->GetHistogram()->GetYaxis()->SetTitle("Tracks/0.01");
2077   } else {
2078     Hs->GetHistogram()->GetYaxis()->SetTitle("Tracks");
2079     if (xmax > 0)
2080       Hs->GetHistogram()->GetXaxis()->SetRangeUser(0, xmax);
2081   }
2082   canvas->Modified();
2083 
2084   canvas->Update();
2085   if (!approve) {
2086     for (int i = 0; i < nentry; i++) {
2087       TH1D* h = (TH1D*)histArr[i];
2088       if (h != NULL) {
2089         TPaveStats* st1 = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats");
2090         if (st1 != NULL) {
2091           if (pos % 2 == 0) {
2092             st1->SetY1NDC(1.0 - yhoff - (i + 1) * height);
2093             st1->SetY2NDC(1.0 - yhoff - i * height);
2094           } else {
2095             st1->SetY1NDC(yloff + 0.02 + i * height);
2096             st1->SetY2NDC(yloff + 0.02 + (i + 1) * height);
2097           }
2098           if (pos > 1) {
2099             st1->SetX1NDC(0.15);
2100             st1->SetX2NDC(.375);
2101           } else {
2102             st1->SetX1NDC(0.75);
2103             st1->SetX2NDC(.975);
2104           }
2105           st1->SetTextColor(colors[i]);
2106         }
2107       }
2108     }
2109   }
2110   legend->Draw("");
2111   if (HLT != "") {
2112     text->AddText(HLT.c_str());
2113     text->Draw("same");
2114   }
2115   text2->Draw("same");
2116 
2117   return canvas;
2118 }
2119 
2120 void getHistStats(TH1D* h,
2121                   int& entries,
2122                   int& integral,
2123                   double& mean,
2124                   double& meanE,
2125                   double& rms,
2126                   double& rmsE,
2127                   int& uflow,
2128                   int& oflow) {
2129   entries = h->GetEntries();
2130   integral = h->Integral();
2131   mean = h->GetMean();
2132   meanE = h->GetMeanError();
2133   rms = h->GetRMS();
2134   rmsE = h->GetRMSError();
2135   uflow = h->GetBinContent(0);
2136   oflow = h->GetBinContent(h->GetNbinsX() + 1);
2137 }
2138 
2139 TFitResultPtr getHistFitStats(
2140     TH1F* h, const char* formula, double xlow, double xup, unsigned int& nPar, double* par, double* epar) {
2141   TFitResultPtr fit = h->Fit(formula, "+qRB0", "", xlow, xup);
2142   nPar = fit->NPar();
2143   const std::vector<double> errors = fit->Errors();
2144   for (unsigned int i = 0; i < nPar; i++) {
2145     par[i] = fit->Value(i);
2146     epar[i] = errors[i];
2147   }
2148   return fit;
2149 }
2150 
2151 void setHistAttr(TH1F* h, int icol, int lwid, int ltype) {
2152   h->SetLineColor(icol);
2153   h->SetLineStyle(ltype);
2154   h->SetLineWidth(lwid);
2155   TF1* f = h->GetFunction("gaus");
2156   if (!f->IsZombie()) {
2157     f->SetLineColor(icol);
2158     f->SetLineStyle(2);
2159   }
2160 }
2161 
2162 double getWeightedMean(int npt, int Start, std::vector<double>& mean, std::vector<double>& emean) {
2163   double sumDen = 0, sumNum = 0;
2164   for (int i = Start; i < npt; i++) {
2165     if (mean[i] == 0.0 || emean[i] == 0.0) {
2166       sumNum += 0;
2167       sumDen += 0;
2168     } else {
2169       sumNum += mean[i] / (emean[i] * emean[i]);
2170       sumDen += 1.0 / (emean[i] * emean[i]);
2171     }
2172   }
2173   double WeightedMean = sumNum / sumDen;
2174   return WeightedMean;
2175 }
2176 
2177 TH1D* rebin(TH1D* histin, int indx) {
2178   std::string nameIn(histin->GetName());
2179   char name[200];
2180   sprintf(name, "%sRebin%d", nameIn.c_str(), indx);
2181   TH1D* hist = new TH1D(name, histin->GetXaxis()->GetTitle(), nbins, xbins);
2182   std::vector<double> cont;
2183   for (int i = 1; i <= histin->GetNbinsX(); ++i) {
2184     double value = histin->GetBinContent(i);
2185     cont.push_back(value);
2186   }
2187   for (int i = 0; i < nbins; ++i) {
2188     double totl = 0;
2189     int kount = 0;
2190     int klow = ibins[i];
2191     int khigh = ibins[i + 1];
2192     for (int k = klow; k < khigh; ++k) {
2193       totl += cont[k - 1];
2194       kount++;
2195     }
2196     if (kount > 0)
2197       totl /= kount;
2198     hist->SetBinContent(i + 1, totl);
2199   }
2200   return hist;
2201 }