Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:59

0001 void makeAtable(string model, bool twiki, bool HLT) {
0002   
0003   //  TFile* file = new TFile(string("html/SUSYVal/histo_"+model+"/outputfile.root").c_str());
0004   TFile* file = new TFile(string("html/SUSYVal_168_vs_177/histo_"+model+"/outputfile.root").c_str());
0005   TH1D* histo1;
0006   TH1D* histo2;
0007   vector<string> tablelines;
0008   
0009   string code1 = "1_7_7";
0010   string code2 = "1_8_4";
0011 
0012   if(twiki == true) 
0013     tablelines.push_back(model+" | "+code1+" | "+code2+"|");
0014   else {
0015     tablelines.push_back("\\begin{table}");
0016     tablelines.push_back("\\begin{center}");
0017     tablelines.push_back("\\begin{tabular}{|c|c|c|}");
0018     tablelines.push_back("\\hline\\hline");
0019     tablelines.push_back(model+" & "+code1+" & "+code2+" \\\\");
0020     tablelines.push_back("\\hline");
0021   }    
0022 
0023   vector<int> e_index;
0024   vector<string> e_line;
0025 
0026   vector<int> jet_index;
0027   vector<string> jet_line;
0028 
0029   vector<int> mu_index;
0030   vector<string> mu_line;
0031 
0032   for(int iplot=0; iplot<8;iplot++) {
0033     char name[256];
0034     if(HLT == true) 
0035       sprintf(name,"HltPaths_eff_%i",iplot);
0036     else
0037       sprintf(name,"L1Paths_eff_%i",iplot);
0038     histo1 = (TH1D*) file->Get(name);
0039     if(HLT == true) 
0040       sprintf(name,"HltPaths_eff_%i",iplot+8);
0041     else
0042       sprintf(name,"L1Paths_eff_%i",iplot+8);
0043     histo2 = (TH1D*) file->Get(name);
0044 
0045     for(int iline=0; iline< histo1->GetXaxis()->GetNbins(); iline++) {
0046       if(string(histo1->GetXaxis()->GetBinLabel(iline+1)).find("Total") 
0047      != string::npos) 
0048     break;
0049       
0050       double eff1 = histo1->GetBinContent(iline+1);
0051       double err1 = histo1->GetBinError(iline+1);
0052       double eff2 = histo2->GetBinContent(iline+1);
0053       double err2 = histo2->GetBinError(iline+1);
0054       
0055       if(twiki == true) {
0056     sprintf(name,"%s | %f +/- %f | %f +/- %f|",
0057         histo1->GetXaxis()->GetBinLabel(iline+1),
0058         eff1, err1, eff2, err2);
0059       } else {
0060     sprintf(name,"%s & %f \pm %f & %f \pm %f \\\\",
0061         histo1->GetXaxis()->GetBinLabel(iline+1),
0062         eff1, err1, eff2, err2);
0063       }
0064 
0065       string pathname(histo1->GetXaxis()->GetBinLabel(iline+1));
0066       if(HLT == true) {
0067       } else {
0068     if(pathname.find("EG") != string::npos) {
0069       
0070     }
0071       }
0072 
0073       tablelines.push_back(string(name));
0074     }
0075   }
0076   if(twiki == false) {
0077     tablelines.push_back("\\hline");
0078     tablelines.push_back("\\end{tabular}");
0079     tablelines.push_back("\\caption{\label{}}");
0080     tablelines.push_back("\\end{center}");
0081     tablelines.push_back("\\end{table}");
0082   }
0083   
0084   string options;
0085   if(twiki == true)
0086     if(HLT == true)
0087       options = "HLT_twiki";
0088     else
0089       options = "L1_twiki";
0090   else
0091     if(HLT == true)
0092       options = "HLT_latex";
0093     else
0094       options = "L1_latex";
0095     
0096 
0097   FILE*  f=fopen(string(model+"_table_"+options+".txt").c_str(),"w");
0098   for(int j = 0; j< int(tablelines.size()); j++) {
0099     fprintf(f,"%s\n",tablelines[j].c_str());
0100   }
0101   fclose(f);
0102 
0103 }
0104 
0105 void maketable(string model) {
0106   makeAtable(model,true,true);
0107   makeAtable(model,true,false);
0108   makeAtable(model,false,true);
0109   makeAtable(model,false,false);
0110 }