Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
void makeAtable(string model, bool twiki, bool HLT) {
  
  //  TFile* file = new TFile(string("html/SUSYVal/histo_"+model+"/outputfile.root").c_str());
  TFile* file = new TFile(string("html/SUSYVal_168_vs_177/histo_"+model+"/outputfile.root").c_str());
  TH1D* histo1;
  TH1D* histo2;
  vector<string> tablelines;
  
  string code1 = "1_7_7";
  string code2 = "1_8_4";

  if(twiki == true) 
    tablelines.push_back(model+" | "+code1+" | "+code2+"|");
  else {
    tablelines.push_back("\\begin{table}");
    tablelines.push_back("\\begin{center}");
    tablelines.push_back("\\begin{tabular}{|c|c|c|}");
    tablelines.push_back("\\hline\\hline");
    tablelines.push_back(model+" & "+code1+" & "+code2+" \\\\");
    tablelines.push_back("\\hline");
  }    

  vector<int> e_index;
  vector<string> e_line;

  vector<int> jet_index;
  vector<string> jet_line;

  vector<int> mu_index;
  vector<string> mu_line;

  for(int iplot=0; iplot<8;iplot++) {
    char name[256];
    if(HLT == true) 
      sprintf(name,"HltPaths_eff_%i",iplot);
    else
      sprintf(name,"L1Paths_eff_%i",iplot);
    histo1 = (TH1D*) file->Get(name);
    if(HLT == true) 
      sprintf(name,"HltPaths_eff_%i",iplot+8);
    else
      sprintf(name,"L1Paths_eff_%i",iplot+8);
    histo2 = (TH1D*) file->Get(name);

    for(int iline=0; iline< histo1->GetXaxis()->GetNbins(); iline++) {
      if(string(histo1->GetXaxis()->GetBinLabel(iline+1)).find("Total") 
	 != string::npos) 
	break;
      
      double eff1 = histo1->GetBinContent(iline+1);
      double err1 = histo1->GetBinError(iline+1);
      double eff2 = histo2->GetBinContent(iline+1);
      double err2 = histo2->GetBinError(iline+1);
      
      if(twiki == true) {
	sprintf(name,"%s | %f +/- %f | %f +/- %f|",
		histo1->GetXaxis()->GetBinLabel(iline+1),
		eff1, err1, eff2, err2);
      } else {
	sprintf(name,"%s & %f \pm %f & %f \pm %f \\\\",
		histo1->GetXaxis()->GetBinLabel(iline+1),
		eff1, err1, eff2, err2);
      }

      string pathname(histo1->GetXaxis()->GetBinLabel(iline+1));
      if(HLT == true) {
      } else {
	if(pathname.find("EG") != string::npos) {
	  
	}
	  }

      tablelines.push_back(string(name));
    }
  }
  if(twiki == false) {
    tablelines.push_back("\\hline");
    tablelines.push_back("\\end{tabular}");
    tablelines.push_back("\\caption{\label{}}");
    tablelines.push_back("\\end{center}");
    tablelines.push_back("\\end{table}");
  }
  
  string options;
  if(twiki == true)
    if(HLT == true)
      options = "HLT_twiki";
    else
      options = "L1_twiki";
  else
    if(HLT == true)
      options = "HLT_latex";
    else
      options = "L1_latex";
    

  FILE*  f=fopen(string(model+"_table_"+options+".txt").c_str(),"w");
  for(int j = 0; j< int(tablelines.size()); j++) {
    fprintf(f,"%s\n",tablelines[j].c_str());
  }
  fclose(f);

}

void maketable(string model) {
  makeAtable(model,true,true);
  makeAtable(model,true,false);
  makeAtable(model,false,true);
  makeAtable(model,false,false);
}