Beispiel #1
0
void GUIApp::draw()
{
    if (currentGuiIndex >= 0)
        guis[currentGuiIndex]->draw();

    drawLegend();
    drawSceneName();

    ofSetColor(ofColor::white);
    ofDrawBitmapStringHighlight(ofToString(roundf(ofGetFrameRate())) + "fps", ofGetWidth() - 55, ofGetHeight()/2 - 70);
}
Beispiel #2
0
///
/// reimplemented functions
///
void MemChartPrivate::paintEvent(QPaintEvent *e)
{

    QPainter painter(this);
    drawBackground(&painter);
    drawCaption(&painter);
    drawFrame(&painter);
    drawLegend(&painter);
    drawHistogram(&painter);
    drawSelectedRegion(&painter);
}
Beispiel #3
0
void Graphics::paintEvent(QPaintEvent *)
{
    drawBackground();

    if (data.length() > 0){
        if (type == Graphics::Lines){
            drawLines();
            drawMask();
        }else
            if (type == Graphics::Sectors)
                drawSectors();
        drawLegend();
    }
}
void markupEllipse::drawMarkup( QPainter& p )
{
    // Scale markup
    QRect scaledRect = rect;
    double scale = getZoomScale();
    scaledRect.moveTo( rect.x() * scale, rect.y() * scale );

    scaledRect.setWidth( rect.width() * scale );
    scaledRect.setHeight( rect.height() * scale );

    // Draw markup
    p.drawEllipse( scaledRect );

    // Draw markup legend
    drawLegend( p, scaledRect.topLeft() );
}
Beispiel #5
0
void TimelineWidget::paintEvent(QPaintEvent* event) {
    QPainter painter(this);

    QRectF fullRect = contentsRect();
    QRectF contentRect(0, 0, fullRect.width() - 1, fullRect.height() - LegendHeight);
    QRectF legendRect(0, fullRect.bottom() - LegendHeight, fullRect.right(), fullRect.bottom());

    painter.save();
    drawContent(painter, contentRect);
    painter.restore();

    painter.save();
    painter.translate(0, fullRect.height() - LegendHeight);
    drawLegend(painter, QRectF(legendRect));
    painter.restore();
}
Beispiel #6
0
void TempChart::paintEvent(QPaintEvent *pe)
{
    WeatherChart::paintEvent(pe);
//    resetPaintRect();

    QPainter p;
    p.begin(this);

//    p.setBrush(QColor(20,20,20));
//    p.setPen(QColor(20,20,20));
//    p.drawRect(0, 0, width(), height());
//    setMinMax();
//    drawAxes(&p);
//    drawChart(&p);
    drawLegend(&p);

    p.end();
}
void tagAndProbePlotsRun2011_IsoMu17_IsoMu24_differentRunRanges(bool save=false)
{
  /// set style
  // ============================
  //  Set ROOT Style
  // ============================
 
  gROOT->Reset();
//   gROOT->SetStyle("Plain");
//   
//   TStyle myStyle("HHStyle","HHStyle");
//   setHHStyle(myStyle);
//   TGaxis::SetMaxDigits(2);
//   myStyle.cd();
//   gROOT->SetStyle("HHStyle");
//   gROOT->ForceStyle();  
  
  gStyle->SetOptStat(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetLegendBorderSize(0);
  gStyle->SetPadBottomMargin(0.11);
  gStyle->SetLabelSize(0.05,"XY");
  gStyle->SetTitleSize(0.05,"XY");
  gStyle->SetFillColor(0);
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  
//   const int fontstyle1=62;
  const int fontstyle1=42;
  gStyle->SetTitleFont(fontstyle1);
  gStyle->SetTitleFont(fontstyle1, "XYZ");
  gStyle->SetLabelFont(fontstyle1, "XYZ");
  gStyle->SetTextFont(fontstyle1);
  
  /// path where input files are stored
  TString inputPathScratch  ="/scratch/hh/current/cms/user/jlange/output_4_2_4/fullLeptonic";
  TString inputPath42       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_4/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  TString inputPath428       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_8_patch7/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  
  TString outputFolder   = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/2011/singleMu/Fall11/DataMCcomp_IsoMu17-24_DifferentRunRanges";
  TString outputFileName = "/DataMCcomp_IsoMu17-24_DifferentRunRanges_";

  TString fileFormatArr []= {"root", "png", "eps"};
  std::vector<TString> fileFormat(fileFormatArr, fileFormatArr + sizeof(fileFormatArr)/sizeof(TString));
  
  /// if set to 0: all plots (probe, test, eff) are drawn; to 1: only eff plots
  int onlyEffPlots =0;
  /// method ID of MC file to normalise scale factors to
  TString mIDnorm = "mfull";
  std::cout<< "Efficiency wrt. which SF is supposed to be normalized " <<  mIDnorm << std::endl;

  
   /// map with structure that keeps features of methods, like file, filename, legend etc.
  std::map<TString, method*> method_;
  
  //TString mIDarr []= {"m1","m2"};
  TString mIDarr []= {"mfull", "m5e32", "m1e33", "m2e33", "m3e33A", "m3e33B", "m5e33"};
  std::vector<TString> mID(mIDarr, mIDarr + sizeof(mIDarr)/sizeof(TString));
  int mIDNum = mID.size();
  std::cout<< "Number of considered methods (i.e. files): " <<  mIDNum << std::endl;
  
  // check if mIDnorm is in vector and give error if not
  bool inVector=false;
  for(int i=0; i< mIDNum; i++) if(mID[i]==mIDnorm) inVector=true;
  if(!inVector) {
    std::cout<<"ERROR!!!! Efficiency wrt. which SF is supposed to be normalized is not in mID vector!!! "<<std::endl; 
    return;
  }
  
  TString fileName ;
  
    /// Define histo and legend styles and options
//   int lineStyle   []= {1,1,1,1,1,1};
//   int lineColor   []= {2,1,4,kGreen+2,kGray+2,3};
//   int markerStyle []={1,21,22,20,22,23};
//   int markerColor []= {2,1,4,kGreen+2,kGray+2,3};
//   TString drawOpt []= {"","E X0 P same","E X0 P same","E X0 same","E X0 same","E same"};
//   TString legOpt  []= {"L","P","P","P","P","P"};
//   bool legOnPlot = false;
  
  /// Constructor for struct method(TString iniFileName, TString iniLegName, int iniLineStyle, int iniLineColor, int iniMarkerStyle, int iniMarkerColor, TString iniDrawOpt, TString iniLepOpt, TString source)
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17eta2p1TriJet.root";
  method_["m1"] = new method(fileName, "Simulation IsoMu24eta2p1", 1, 2, 1, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1","eventWeightPUeventWeightPU");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17eta2p1TriJet.root";
  method_["m1b"] = new method(fileName, "Fall11 IsoMu24eta2p1 no PUrew", 2, 2, 1, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["mfull"] = new method(fileName, "Data All IsoMu17(24)(eta2p1)", 1, 1, 21, 1, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m5e32"] = new method(fileName, "Data 5e32 IsoMu17", 1, 4, 23, 4, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run<=163869");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m1e33"] = new method(fileName, "Data 1e33 IsoMu17", 1, 4, 25, 4, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>163869 &&run<=167913");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2e33"] = new method(fileName, "Data 2e33 IsoMu24", 1, 8, 20, 8, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>167913 &&run<=173198");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m3e33A"] = new method(fileName, "Data 3e33A IsoMu24eta2p1", 1, 6, 22, 6, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>173198 &&run<=175770");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m3e33B"] = new method(fileName, "Data 3e33B IsoMu24eta2p1", 1, 6, 21, 6, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>175770 &&run<=178380");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m5e33"] = new method(fileName, "Data 5e33 IsoMu24eta2p1", 1, 6, 24, 6, "E", "LP", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>178380 &&run<=180252");
  

  
  
  /// different tap studies (different efficiencies)
//    const int folderNum=5;
//    TString folderID[]={"tapTrkQ", "tapIso", "tapMinDR", "tapTotalSelection", "tapTrigger"};
//    TString foldersTitle[]={"ID", "Isolation", "#DeltaR (after Iso Cut)","Overall Selection", "Trigger"};
  
//   const int folderNum=3;
//   TString folderID[]={"tapTotalSelection", "tapTrigger", "tapAll"};
//   TString foldersTitle[]={"Overall Selection", "Trigger", "Combined Selection and Trigger"};
  
    const int folderNum=2;
  TString folderID[]={"tapTotalSelection", "tapTrigger"};
  TString foldersTitle[]={"Muon Selection", "Muon Trigger"};
  
//     const int folderNum=1;
//     /// to combine selection and trigger efficiencies use tapAll:
//   TString folderID[]={"tapAll"};
//   TString foldersTitle[]={"Combined Selection and Trigger"};
  
//   const int folderNum=1;
//   TString folderID[]={"tapTrigger"};
//   TString foldersTitle[]={"Trigger"};


  /// effName = name of the effHisto; variables: corresponding variable to effName; cuts: corresponding cut to effName

   TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR","lepLepMass"};
  //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "PtEta0to1p5", "PtEta1p5to2p1"};
  //TString effIDarr[]      = {"Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR"};
  //TString effIDarr[]      = {"Pt"};
  std::vector<TString> effID(effIDarr, effIDarr + sizeof(effIDarr)/sizeof(TString));
  int effIDNum = effID.size();
  std::cout<< "Number of considered plots: " <<  effIDNum << std::endl;
  
  
   TString effIDarr2[]      = {};
  //TString effIDarr2[]      = {"PtEta0to1p2", "PtEta1p2to2p1", "EtaPt30to45", "EtaPt45to60", "EtaPtGreater60", "PtMedian", "Pt3bins"};
  std::vector<TString> effID2(effIDarr2, effIDarr2 + sizeof(effIDarr2)/sizeof(TString));
  int effIDNum2 = effID2.size();
  std::cout<< "Number of considered plots 2: " <<  effIDNum2 << std::endl;
    
  /// map with structure that keeps features of histograms
  std::map<TString, std::map<TString, eff*> > eff_;
  
  /// title for histo, x and y axis (separated by "/")
  TString title0 ="";
  TString title ="";
  
  /// axis range
  //double yLo = 0.5, yHi = 1.1;
  double yLo = 0.7, yHi = 1.;
  double yLoSF = 0.9, yHiSF = 1.1;
  
  /// Constructor for struct eff(TString iniVar, T  iniCuts, TString iniBins, TString iniTitles, double iniYLo=-9999., double iniYHi=-9999., double iniXLo=-9999., double iniXHi=-9999.)
  TCut cutPt  = "probePt>30."; /*"(probePt>30. || testPt>30. )";*/
  TCut cutEta = "TMath::Abs(probeEta)<2.1"; /*"(TMath::Abs(probeEta)<2.1 || TMath::Abs(testEta)<2.1)";*/
  TCut cutPtEta = cutPt && cutEta;
  for(int iFolder=0; iFolder < folderNum; iFolder++){
    title = foldersTitle[iFolder]+" Efficiency/ / ";
    eff_["Control"][folderID[iFolder]]        =new eff("Control", cutPtEta, mBinsControl, binsControl_, title, yLo, yHi, -9999.,-9999.);
    title = foldersTitle[iFolder]+" Efficiency/p_{T} [GeV]/ ";
    eff_["Pt"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 30.,200.);
    title = foldersTitle[iFolder]+" Efficiency/#eta/ ";
    eff_["Eta"][folderID[iFolder]]             =new eff("Eta", cutPt, mBinsEta, binsEta_, title, yLo, yHi,-2.1,2.1);
    title = foldersTitle[iFolder]+" Efficiency/relIso/ ";
    eff_["RelIso"][folderID[iFolder]]          =new eff("RelIso", cutPtEta, mBinsRelIso, binsRelIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/absIso/ ";
    eff_["AbsIso"][folderID[iFolder]]          =new eff("AbsIso", cutPtEta, mBinsAbsIso, binsAbsIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Primary Vertices/ ";
    eff_["PVMult"][folderID[iFolder]]          =new eff("PVMult", cutPtEta, mBinsPVMult, binsPVMult_, title, yLo, yHi,0.,20.);
    title = foldersTitle[iFolder]+" Efficiency/N_{jet}/ ";
    eff_["Mult"][folderID[iFolder]]            =new eff("Mult", cutPtEta, mBinsMult, binsMult_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Minimum #DeltaR(#mu,jet)/ ";
    eff_["MinDR"][folderID[iFolder]]            =new eff("MinDR", cutPtEta, mBinsMinDR, binsMinDR_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Minimum M_{lep,lep}/ ";
    eff_["lepLepMass"][folderID[iFolder]]            =new eff("lepLepMass", cutPtEta, mBinsLepLepMass, binsLepLepMass_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 0<#eta<1.2/p_{T} [GeV]/ ";
    eff_["PtEta0to1p2"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)<1.2", mBinsPt, binsPt_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 1.2<#eta<2.1/p_{T} [GeV]/ ";
    eff_["PtEta1p2to2p1"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)>1.2 && TMath::Abs(probeEta)<2.1", mBinsPt, binsPt_, title, yLo, yHi, 30.,200.,true);
    
    title = foldersTitle[iFolder]+" Efficiency, 30<p_{T}<45/#eta/ ";
    eff_["EtaPt30to45"][folderID[iFolder]]             =new eff("Eta", "probePt>30. && probePt<45.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 45<p_{T}<60/#eta/ ";
    eff_["EtaPt45to60"][folderID[iFolder]]             =new eff("Eta", "probePt>45. && probePt<60.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 60<p_{T}/#eta/ ";
    eff_["EtaPtGreater60"][folderID[iFolder]]             =new eff("Eta", "probePt>60.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency AN/p_{T} [GeV]/ ";
    eff_["PtAN"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency Median/p_{T} [GeV]/ ";
    eff_["PtMedian"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtMedian_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 3 bins/p_{T} [GeV]/ ";
    eff_["Pt3bins"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPt3bins_, title, yLo, yHi, 30.,200.);
  }

  /// ---
  /// get efficiencies from tree or histo
  ///  ---
  for(int iMethod=0; iMethod<mIDNum; iMethod++){
    for(int iEff=0; iEff<effIDNum; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	getEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
      }
    }
      
      for(int iEff=0; iEff<effIDNum2; iEff++){
	for(int iFolder=0; iFolder<folderNum; iFolder++){
	  getEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
	}
	
    }
  }

 /// Draw one Canvas for each folder comparing different methods.
 /// Each canvas shows test (1st row) and probe collection (2nd) and efficiency (3rd) for different variables (columns)
  TCanvas* CanvComp [folderNum];
  TCanvas* CanvSFComp [folderNum];
  TCanvas* CanvEvtsComp [folderNum];
  TCanvas* CanvEvtsNormComp [folderNum];
  TCanvas* CanvLeg = new TCanvas("CanvLeg", "CanvLeg", 350,200);
  
  TCanvas* CanvComp2 [folderNum];
  TCanvas* CanvSFComp2 [folderNum];

  std::cout<< "Drawing eff. and SF"<<std::endl;
  for(int iFolder=0; iFolder<folderNum; iFolder++) {

    CanvComp[iFolder] = new TCanvas("Comparison"+folderID[iFolder], "Comparison"+folderID[iFolder], 1700,1000);
    CanvSFComp[iFolder] = new TCanvas("ComparisonSF"+folderID[iFolder], "ComparisonSF"+folderID[iFolder], 1700,1000);
    CanvEvtsComp[iFolder] = new TCanvas("ComparisonEvts"+folderID[iFolder], "ComparisonEvts"+folderID[iFolder], 1700,1000);
    CanvEvtsNormComp[iFolder] = new TCanvas("ComparisonEvtsNorm"+folderID[iFolder], "ComparisonEvtsNorm"+folderID[iFolder], 1700,1000);
    
    CanvComp2[iFolder] = new TCanvas("Comparison2"+folderID[iFolder], "Comparison2"+folderID[iFolder], 1700,1000);
    CanvSFComp2[iFolder] = new TCanvas("ComparisonSF2"+folderID[iFolder], "ComparisonSF2"+folderID[iFolder], 1700,1000);
    
    CanvComp[iFolder]->Divide(4,2);
    CanvSFComp[iFolder]->Divide(4,2);
    CanvEvtsComp[iFolder]->Divide(4,2);
    CanvEvtsNormComp[iFolder]->Divide(4,2);
    
    CanvComp2[iFolder]->Divide(4,2);
    CanvSFComp2[iFolder]->Divide(4,2);
  
    for(int iEff=0; iEff<effIDNum; iEff++){
      CanvComp[iFolder]->cd(iEff+1);
//       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
      std::cout<< "Drawing eff."<<std::endl;
      drawEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
      CanvSFComp[iFolder]->cd(iEff+1);
      std::cout<< "Drawing SF"<<std::endl;
      drawSF          (eff_[effID[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID[iEff]][folderID[iFolder]]->xLo, eff_[effID[iEff]][folderID[iFolder]]->xHi);
    // if desired plot also raw event number histos
      if(onlyEffPlots!=1) {
	std::cout<< "Drawing event numbers"<<std::endl;
	CanvEvtsComp[iFolder]->cd(iEff+1);
	drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
	CanvEvtsNormComp[iFolder]->cd(iEff+1);
	drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend,"normInt");
      }
    }
    
    for(int iEff=0; iEff<effIDNum2; iEff++){
      CanvComp2[iFolder]->cd(iEff+1);
//       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
      std::cout<< "Drawing eff. 2"<<std::endl;
      drawEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend);
      CanvSFComp2[iFolder]->cd(iEff+1);
      std::cout<< "Drawing SF"<<std::endl;
      drawSF          (eff_[effID2[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.15,0.15,0.9,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID2[iEff]][folderID[iFolder]]->xLo, eff_[effID2[iEff]][folderID[iFolder]]->xHi);
    }
    
    
  // draw legend
    CanvLeg->cd();
    if(iFolder==0) drawLegend(eff_[effID[0]][folderID[0]], method_, mID, 0.,0.,1.,1.);
  
//   effControl[iMethod][iFolder]->GetXaxis()->SetNdivisions(0);
//   effRelIso[iMethod][iFolder]->GetXaxis()->SetNdivisions(505);
 
    if(save){
      for(unsigned int iFileFormat=0; iFileFormat < fileFormat.size(); iFileFormat++){
	CanvComp[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_overview."+fileFormat[iFileFormat]);
	for(int iEff=0; iEff<effIDNum; iEff++){
	  CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	  CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	}
	
	for(int iEff=0; iEff<effIDNum2; iEff++){
	  CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	  CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	}
	
	if(iFolder==0) CanvLeg->Print(outputFolder+outputFileName+"_Legend."+fileFormat[iFileFormat]);
	std::cout<<"Canvas with plots is saved in "<<outputFolder<<std::endl;
      }
    }
  }
  std::cout<< "Done"<<std::endl;
}
void tagAndProbePlotsRun2011A_MCdataCom_IsoEle25_27_32_TaP_and_subtrigger(bool save=false)
{
  /// set style
  // ============================
  //  Set ROOT Style
  // ============================
 
  gROOT->Reset();
//   gROOT->SetStyle("Plain");
  //   
//   TStyle myStyle("HHStyle","HHStyle");
//   setHHStyle(myStyle);
//   TGaxis::SetMaxDigits(2);
//   myStyle.cd();
//   gROOT->SetStyle("HHStyle");
//   gROOT->ForceStyle();  
  
  gStyle->SetOptStat(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetLegendBorderSize(0);
  gStyle->SetPadBottomMargin(0.11);
  gStyle->SetLabelSize(0.05,"XY");
  gStyle->SetTitleSize(0.05,"XY");
  gStyle->SetFillColor(0);
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  
//   const int fontstyle1=62;
  const int fontstyle1=42;
  gStyle->SetTitleFont(fontstyle1);
  gStyle->SetTitleFont(fontstyle1, "XYZ");
  gStyle->SetLabelFont(fontstyle1, "XYZ");
  gStyle->SetTextFont(fontstyle1);
  
  /// path where input files are stored
  TString inputPathScratch  ="/scratch/hh/current/cms/user/jlange/output_4_2_4/fullLeptonic";
  TString inputPath42       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_4/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  TString inputPath428       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_8_patch7/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  
  TString outputFolder   = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/2011/singleEle/Fall11/DataMCcomp_IsoEle25subTrigger";
  TString outputFileName = "/IsoEle25subTrigger_WP70_CiCcomp_";
//   TString outputFileName = "/IsoEle27-32_5GeVaboveThresholdInclCombinedData";
  //TString outputFileName = "/IsoEle27-32_5GeVaboveThreshold";
  //TString outputFileName = "/IsoEle27-32_";

  TString fileFormatArr []= {"root", "png", "eps"};
  std::vector<TString> fileFormat(fileFormatArr, fileFormatArr + sizeof(fileFormatArr)/sizeof(TString));
  
  /// if set to 0: all plots (probe, test, eff) are drawn; to 1: only eff plots
  int onlyEffPlots =0;
  /// method ID of MC file to normalise scale factors to
  TString mIDnorm = "refTr1MCJet110";
  std::cout<< "Efficiency wrt. which SF is supposed to be normalized " <<  mIDnorm << std::endl;

  
   /// map with structure that keeps features of methods, like file, filename, legend etc.
  std::map<TString, method*> method_;
  
  //TString mIDarr []= {"m1","m2"};
  //TString mIDarr []= {"m1", "m1noPU", "m1PUEPS", "m1PUup", "m1PUdown","m2"};
//   TString mIDarr []= {"m1","m2", "m2-27", "m2-32EPS", "m2-32ApostEPS", "m2-32B", "m2-32WP70B"};
//    TString mIDarr []= {"m1", "refTr1MCJet110", "refTr1MCAll", "refTr1", "refTr2"};
  TString mIDarr []= {"refTr1MCJet110", "refTr1MCJet110WP70", "m1", "refTr2EPSnew", "refTr2EPSnewWP70"};
  //TString mIDarr []= {"m1", "refTr1MCJet110", "refTr1MCAll", "refTr1", "refTr1424"};
//  TString mIDarr []= {"refTr1", "refTr2"};
  //TString mIDarr []= {"m1"};
  std::vector<TString> mID(mIDarr, mIDarr + sizeof(mIDarr)/sizeof(TString));
  int mIDNum = mID.size();
  std::cout<< "Number of considered methods (i.e. files): " <<  mIDNum << std::endl;
  
  // check if mIDnorm is in vector and give error if not
  bool inVector=false;
  for(int i=0; i< mIDNum; i++) if(mID[i]==mIDnorm) inVector=true;
  if(!inVector) {
    std::cout<<"ERROR!!!! Efficiency wrt. which SF is supposed to be normalized is not in mID vector!!! "<<std::endl; 
    return;
  }
  
  TString fileName ;
  
    /// Define histo and legend styles and options
//   int lineStyle   []= {1,1,1,1,1,1};
//   int lineColor   []= {2,1,4,kGreen+2,kGray+2,3};
//   int markerStyle []={1,21,22,20,22,23};
//   int markerColor []= {2,1,4,kGreen+2,kGray+2,3};
//   TString drawOpt []= {"","E X0 P same","E X0 P same","E X0 same","E X0 same","E same"};
//   TString legOpt  []= {"L","P","P","P","P","P"};
//   bool legOnPlot = false;
  
  /// Constructor for struct method(TString iniFileName, TString iniLegName, int iniLineStyle, int iniLineColor, int iniMarkerStyle, int iniMarkerColor, TString iniDrawOpt, TString iniLepOpt, TString source)
  
   /// Fall11 MC
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1"] = new method(fileName, "Simulation IsoEle32", 3, 2, 1, 1, "E", "L", "treeV2","probePt>37. && TMath::Abs(probeEta)<2.1","eventWeightPUeventWeightPU");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1noPU"] = new method(fileName, "Fall11 IsoEle32 no PUrew", 2, 2, 1, 1, "E", "L", "treeV2","probePt>37. && TMath::Abs(probeEta)<2.1","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1PUEPS"] = new method(fileName, "Fall11 IsoEle32 PUrew EPS", 3, 8, 1, 1, "E", "L", "treeV2","probePt>37.","eventWeightPUEPSeventWeightPUEPS");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1PUup"] = new method(fileName, "Fall11 IsoEle32 PUrew UP", 2, 4, 1, 1, "E", "L", "treeV2","probePt>37.","eventWeightPUsysUpeventWeightPUUp");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1PUdown"] = new method(fileName, "Fall11 IsoEle32 PUrew DOWN", 2, 7, 1, 1, "E", "L", "treeV2","probePt>37.","eventWeightPUsysDowneventWeightPUDown");
  
  /// data
//   fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
//   method_["m2"] = new method(fileName, "2011 Data IsoEle27/32", 1, 1, 21, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run<=178380");
//   
//   fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
//   method_["m2-27"] = new method(fileName, "2011 Data IsoEle27, run<=161176", 1, 1, 22, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run<=161176");
//   
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2-32EPS"] = new method(fileName, "2011 Data IsoEle32 EPS", 1, 1, 23, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>161176 && run<=167913");
//   
//   fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
//   method_["m2-32ApostEPS"] = new method(fileName, "2011 Data IsoEle32 A post EPS", 1, 1, 24, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>167913 && run<=175570");
//   
//   fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
//   method_["m2-32B"] = new method(fileName, "2011 Data IsoEle32 B", 1, 1, 25, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>175570 && run<=178380");
//   
//   fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
//   method_["m2-32WP70B"] = new method(fileName, "2011 Data IsoEle32WP70 B", 1, 1, 26, 1, "E", "L", "treeV2","probePt>30. && TMath::Abs(probeEta)<2.1 && run>178380");
  
  
  /// subtrigger method on jet PD:
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_Jet110_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosMCFall11_Jet110_IsoEle25.root";
  method_["refTr1MCJet110"] = new method(fileName, "MC ttbar Jet110 CiC IsoEle25", 1, 2, 1, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_Fall11MC_Jet_IsoEle25SubBit_OldWP70eID/analyzeCrossTriggerRatiosMCFall11_Jet110_IsoEle25.root";
  method_["refTr1MCJet110WP70"] = new method(fileName, "MC ttbar Jet110 WP70 IsoEle25", 2, 2, 1, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_Fall11MC_Jet_IsoEle25SubBit_OldWP70eID_TrigMatch/analyzeCrossTriggerRatiosMCFall11_Jet110_IsoEle25.root";
  method_["refTr1MCJet110WP70TrigMatch"] = new method(fileName, "MC ttbar Jet110 WP70 TrigMatch IsoEle25", 4, 2, 1, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_Fall11MC_Jet_IsoEle25SubBit_CiCeID_TrigMatch/analyzeCrossTriggerRatiosMCFall11_Jet110_IsoEle25.root";
  method_["refTr1MCJet110CiCTrigMatch"] = new method(fileName, "MC ttbar Jet110 CiC TrigMatch IsoEle25", 5, 2, 1, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_All_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosMCFall11_All_IsoEle25TriJet.root";
  method_["refTr1MCAll"] = new method(fileName, "MC ttbar all IsoEle25", 3, 2, 1, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosRun2011APromptRecoV4_Jet_Ele25SubBit_cfg/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165088_165633_Trig1_Jet_Ele25TriJet.root";
  method_["refTr1"] = new method(fileName, "Run PromptV4 Ele25", 2, 4, 20, 4, "E same", "LP","treeV2","","");
  
  fileName=inputPath42+"/naf_analyzeCrossTriggerRatiosRun2011APromptRecoV4_Jet_Ele25SubBit_cfg/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165088_165633_Trig1_Jet_Ele25TriJet.root";
  method_["refTr1424"] = new method(fileName, "Run PromptV4 Ele25", 2, 4, 21, 4, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosRun2011All_Jet_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosRun2011All_165970_180252_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2"] = new method(fileName, "2011 all IsoEle25", 2, 8, 21, 8, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosRun2011All_Jet_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosRun2011All_165970_180252_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPS"] = new method(fileName, "2011 EPS IsoEle25", 2, 8, 22, 8, "E same", "LP","treeV2","runNumber<=167913 && runNumber>=165970","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosRun2011APromptRecoV4_Jet_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165970_167913_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPSnew"] = new method(fileName, "2011 EPS CiC IsoEle25", 1, 8, 21, 8, "E same", "LP","treeV2","runNumber<=167913 && runNumber>=165970","");
  
  fileName=inputPath428+"/naf_Jet_IsoEle25SubBit_OldWP70eID/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165970_167913_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPSnewWP70"] = new method(fileName, "2011 EPS WP70 IsoEle25", 1, 1, 22, 1, "E same", "LP","treeV2","runNumber<=167913 && runNumber>=165970","");
  
  fileName=inputPath428+"/naf_Jet_IsoEle25SubBit_OldWP70eID_TrigMatch/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165970_167913_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPSnewWP70TrigMatch"] = new method(fileName, "2011 EPS new WP70 TrigMatch IsoEle25", 2, 1, 21, 1, "E same", "LP","treeV2","runNumber<=167913 && runNumber>=165970","");
  
  fileName=inputPath428+"/naf_Jet_IsoEle25SubBit_CiCeID_TrigMatch/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165970_167913_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPSCiCTrigMatch"] = new method(fileName, "2011 EPS CiC TrigMatch IsoEle25", 2, 1, 22, 1, "E same", "LP","treeV2","runNumber<=167913 && runNumber>=165970","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosRun2011All_Jet_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosRun2011All_165970_180252_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2postEPS"] = new method(fileName, "2011 postEPS IsoEle25", 2, 8, 23, 8, "E same", "LP","treeV2","runNumber>167913","");
  
  fileName=inputPath42+"/naf_analyzeCrossTriggerRatiosRun2011APromptRecoV4_Jet_IsoEle25SubBit_cfg/analyzeCrossTriggerRatiosRun2011APromptRecoV4_165970_167913_Trig2_Jet_IsoEle25TriJet.root";
  method_["refTr2EPS424"] = new method(fileName, "Run PromptV4 IsoEle25", 2, 8, 25, 8, "E same", "LP","treeV2","TMath::Abs(eta)<2.1","");
  

  
  /// different tap studies (different efficiencies)

//    const int folderNum=6;
//    TString folderID[]={"tapTrkQEle", "tapIDEle", "tapIsoEle", "tapConvRejEle", "tapTotalSelectionEle", "tapTriggerEle"};
//    TString foldersTitle[]={"Track Quality", "ID", "Isolation", "Conversion Rejection", "Overall Selection", "Trigger"};
   
//    const int folderNum=2;
//    TString folderID[]={"tapTotalSelectionEle", "tapTriggerEle"};
//    TString foldersTitle[]={"Overall Selection", "Trigger"};
  
//   const int folderNum=1;
//   TString folderID[]={"tapTotalSelectionEle"};
//   TString foldersTitle[]={"Overall Selection"};
  
  const int folderNum=1;
  TString folderID[]={"tapTriggerEle"};
  TString foldersTitle[]={"Trigger"};
  
//   const int folderNum=1;
//     /// to combine selection and trigger efficiencies use tapAll:
//   TString folderID[]={"tapAllEle"};
//   TString foldersTitle[]={"Combined Selection and Trigger"};
  
//   const int folderNum=1;
//   TString folderID[]={"tapTrigger"};
//   TString foldersTitle[]={"Trigger"};
  
  /// for reference trigger method:
  TString folderIDrefTriggerPass="******";
  TString folderIDrefTriggerAll="analyzeElectronKinematicsTrig1";


  /// effName = name of the effHisto; variables: corresponding variable to effName; cuts: corresponding cut to effName

  //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR","lepLepMass"};
  //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "PtEta0to1p5", "PtEta1p5to2p1"};
  //TString effIDarr[]      = {"Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR"};
  //TString effIDarr[]      = {"Pt"};
  TString effIDarr[]      = {"Pt", "Eta"};
  std::vector<TString> effID(effIDarr, effIDarr + sizeof(effIDarr)/sizeof(TString));
  int effIDNum = effID.size();
  std::cout<< "Number of considered plots: " <<  effIDNum << std::endl;
  
  
  TString effIDarr2[]      = {};
  //TString effIDarr2[]      = {"PtEta0to1p2", "PtEta1p2to2p1", "EtaPt30to45", "EtaPt45to60", "EtaPtGreater60", "PtMedian", "Pt3bins"};
  std::vector<TString> effID2(effIDarr2, effIDarr2 + sizeof(effIDarr2)/sizeof(TString));
  int effIDNum2 = effID2.size();
  std::cout<< "Number of considered plots 2: " <<  effIDNum2 << std::endl;
    
  /// map with structure that keeps features of histograms
  std::map<TString, std::map<TString, eff*> > eff_;
  
  /// title for histo, x and y axis (separated by "/")
  TString title0 ="";
  TString title ="";
  
  /// axis range
  //double yLo = 0.5, yHi = 1.1;
  double yLo = 0.8, yHi = 1.;
  double yLoSF = 0.9, yHiSF = 1.1;
  
  /// Constructor for struct eff(TString iniVar, T  iniCuts, TString iniBins, TString iniTitles, double iniYLo=-9999., double iniYHi=-9999., double iniXLo=-9999., double iniXHi=-9999.)
  TCut cutPt  = ""; /*"(probePt>30. || testPt>30. )";*/
  TCut cutEta = ""; /*"(TMath::Abs(probeEta)<2.1 || TMath::Abs(testEta)<2.1)";*/
  TCut cutPtEta = cutPt && cutEta;
  for(int iFolder=0; iFolder < folderNum; iFolder++){
    title = foldersTitle[iFolder]+" Efficiency/ / ";
    eff_["Control"][folderID[iFolder]]        =new eff("Control", cutPtEta, mBinsControl, binsControl_, title, yLo, yHi, -9999.,-9999.);
    title = foldersTitle[iFolder]+" Efficiency/p_{T} [GeV]/ ";
    eff_["Pt"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 30.,200.);
//     eff_["Pt"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPt_, title, yLo, yHi, 30.,200.);
    title = foldersTitle[iFolder]+" Efficiency/#eta/ ";
    eff_["Eta"][folderID[iFolder]]             =new eff("Eta", cutPt, mBinsEta, binsEta_, title, yLo, yHi);
//     eff_["Eta"][folderID[iFolder]]             =new eff("Eta", cutPt, mBinsEta, binsEtaEle_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/relIso/ ";
    eff_["RelIso"][folderID[iFolder]]          =new eff("RelIso", cutPtEta, mBinsRelIso, binsRelIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/absIso/ ";
    eff_["AbsIso"][folderID[iFolder]]          =new eff("AbsIso", cutPtEta, mBinsAbsIso, binsAbsIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Primary Vertices/ ";
    eff_["PVMult"][folderID[iFolder]]          =new eff("PVMult", cutPtEta, mBinsPVMult, binsPVMult_, title, yLo, yHi,0.,20.);
    title = foldersTitle[iFolder]+" Efficiency/N_{jet}/ ";
    eff_["Mult"][folderID[iFolder]]            =new eff("Mult", cutPtEta, mBinsMult, binsMult_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Minimum #DeltaR(#mu,jet)/ ";
    eff_["MinDR"][folderID[iFolder]]            =new eff("MinDR", cutPtEta, mBinsMinDR, binsMinDR_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Minimum M_{lep,lep}/ ";
    eff_["lepLepMass"][folderID[iFolder]]            =new eff("lepLepMass", cutPtEta, mBinsLepLepMass, binsLepLepMass_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 0<#eta<1.2/p_{T} [GeV]/ ";
    eff_["PtEta0to1p2"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)<1.2", mBinsPt, binsPt_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 1.2<#eta<2.1/p_{T} [GeV]/ ";
    eff_["PtEta1p2to2p1"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)>1.2 && TMath::Abs(probeEta)<2.1", mBinsPt, binsPt_, title, yLo, yHi, 30.,200.,true);
    
    title = foldersTitle[iFolder]+" Efficiency, 30<p_{T}<45/#eta/ ";
    eff_["EtaPt30to45"][folderID[iFolder]]             =new eff("Eta", "probePt>30. && probePt<45.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 45<p_{T}<60/#eta/ ";
    eff_["EtaPt45to60"][folderID[iFolder]]             =new eff("Eta", "probePt>45. && probePt<60.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 60<p_{T}/#eta/ ";
    eff_["EtaPtGreater60"][folderID[iFolder]]             =new eff("Eta", "probePt>60.", mBinsEta, binsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency AN/p_{T} [GeV]/ ";
    eff_["PtAN"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency Median/p_{T} [GeV]/ ";
    eff_["PtMedian"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtMedian_, title, yLo, yHi, 30.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 3 bins/p_{T} [GeV]/ ";
    eff_["Pt3bins"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPt3bins_, title, yLo, yHi, 30.,200.);
  }

  /// ---
  /// get efficiencies from tree or histo
  ///  ---
  for(int iMethod=0; iMethod<mIDNum; iMethod++){
    for(int iEff=0; iEff<effIDNum; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	if(!mID[iMethod].Contains("refTr")) getEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
	else                               getEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderIDrefTriggerPass, folderIDrefTriggerAll);
      }
    }
      
    for(int iEff=0; iEff<effIDNum2; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	getEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
      }
	
    }
  }

 /// Draw one Canvas for each folder comparing different methods.
 /// Each canvas shows test (1st row) and probe collection (2nd) and efficiency (3rd) for different variables (columns)
  TCanvas* CanvComp [folderNum];
  TCanvas* CanvSFComp [folderNum];
  TCanvas* CanvEvtsComp [folderNum];
  TCanvas* CanvEvtsNormComp [folderNum];
  TCanvas* CanvLeg = new TCanvas("CanvLeg", "CanvLeg", 350,200);
  
  TCanvas* CanvComp2 [folderNum];
  TCanvas* CanvSFComp2 [folderNum];

  std::cout<< "Drawing eff. and SF"<<std::endl;
  for(int iFolder=0; iFolder<folderNum; iFolder++) {

    CanvComp[iFolder] = new TCanvas("Comparison"+folderID[iFolder], "Comparison"+folderID[iFolder], 1700,1000);
    CanvSFComp[iFolder] = new TCanvas("ComparisonSF"+folderID[iFolder], "ComparisonSF"+folderID[iFolder], 1700,1000);
    CanvEvtsComp[iFolder] = new TCanvas("ComparisonEvts"+folderID[iFolder], "ComparisonEvts"+folderID[iFolder], 1700,1000);
    CanvEvtsNormComp[iFolder] = new TCanvas("ComparisonEvtsNorm"+folderID[iFolder], "ComparisonEvtsNorm"+folderID[iFolder], 1700,1000);
    
    CanvComp2[iFolder] = new TCanvas("Comparison2"+folderID[iFolder], "Comparison2"+folderID[iFolder], 1700,1000);
    CanvSFComp2[iFolder] = new TCanvas("ComparisonSF2"+folderID[iFolder], "ComparisonSF2"+folderID[iFolder], 1700,1000);
    
    CanvComp[iFolder]->Divide(4,2);
    CanvSFComp[iFolder]->Divide(4,2);
    CanvEvtsComp[iFolder]->Divide(4,2);
    CanvEvtsNormComp[iFolder]->Divide(4,2);
    
    CanvComp2[iFolder]->Divide(4,2);
    CanvSFComp2[iFolder]->Divide(4,2);
  
    for(int iEff=0; iEff<effIDNum; iEff++){
      CanvComp[iFolder]->cd(iEff+1);
//       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
      std::cout<< "Drawing eff."<<std::endl;
      drawEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
      CanvSFComp[iFolder]->cd(iEff+1);
      std::cout<< "Drawing SF"<<std::endl;
      drawSF          (eff_[effID[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID[iEff]][folderID[iFolder]]->xLo, eff_[effID[iEff]][folderID[iFolder]]->xHi);
    // if desired plot also raw event number histos
      if(onlyEffPlots!=1) {
	std::cout<< "Drawing event numbers"<<std::endl;
	CanvEvtsComp[iFolder]->cd(iEff+1);
	drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
	CanvEvtsNormComp[iFolder]->cd(iEff+1);
	drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend,"normInt");
      }
    }
    
    for(int iEff=0; iEff<effIDNum2; iEff++){
      CanvComp2[iFolder]->cd(iEff+1);
//       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
      std::cout<< "Drawing eff. 2"<<std::endl;
      drawEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend);
      CanvSFComp2[iFolder]->cd(iEff+1);
      std::cout<< "Drawing SF"<<std::endl;
      drawSF          (eff_[effID2[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.15,0.15,0.9,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID2[iEff]][folderID[iFolder]]->xLo, eff_[effID2[iEff]][folderID[iFolder]]->xHi);
    }
    
    
  // draw legend
    CanvLeg->cd();
    if(iFolder==0) drawLegend(eff_[effID[0]][folderID[0]], method_, mID, 0.,0.,1.,1.);
  
//   effControl[iMethod][iFolder]->GetXaxis()->SetNdivisions(0);
//   effRelIso[iMethod][iFolder]->GetXaxis()->SetNdivisions(505);
 
    if(save){
      for(unsigned int iFileFormat=0; iFileFormat < fileFormat.size(); iFileFormat++){
	CanvComp[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_overview."+fileFormat[iFileFormat]);
	for(int iEff=0; iEff<effIDNum; iEff++){
	  CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	  CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	}
	
	for(int iEff=0; iEff<effIDNum2; iEff++){
	  CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	  CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	}
	
	if(iFolder==0) CanvLeg->Print(outputFolder+outputFileName+"_Legend."+fileFormat[iFileFormat]);
	std::cout<<"Canvas with plots is saved in "<<outputFolder<<std::endl;
      }
      /// save graph in root file
//       TFile f("MuonEffSF2011.root", "new");
//       eff_["Eta"]["tapAll"]->graphSF["m2"]->SetName("tapAllSFeta");
//       //eff_["Eta"]["tapAll"]->graphSF["m2"]->SetTitle("tapAllSFeta");
//       eff_["Eta"]["tapAll"]->graphSF["m2"]->Write();
//       std::cout<<"MuonEffSF.root with TGraphErrors is saved in "<<outputFolder<<std::endl;
    }
  }
  std::cout<< "Done"<<std::endl;
}
Beispiel #9
0
 /**
  * Draw the Palette key to this frame. dir is the direction from negative
  * to positive for the key.  You probably want to supply a tall, skinny
  * frame for North or South directions and a short and wide frame for East
  * and West directions.
  */
 inline void drawKey(Frame* frame, unsigned int columns = 1)
 {
     drawLegend(frame,&sl, columns);
 }
Beispiel #10
0
	void GraphPlotter::updateVertexArrays() {
		if (!valid)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] no valid graph set!" << std::endl;
			return;
		}

		if (g.AxisSize.x <= 0 || g.AxisSize.y <= 0)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] Invalid Settings ( AxisSize < 0 ) !" << std::endl;
			return;
		}

		if (g.AxesPoints.x <= 0 || g.AxesPoints.y <= 0)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] Invalid Settings ( AxesPoints < 0 ) !" << std::endl;
			return;
		}

		if (g.MinPointDist <= 0)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] Invalid Settings ( MinPointDist < 0 ) !" << std::endl;
			return;
		}

		if (g.Size.x <= 0 || g.Size.y <= 0)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] Invalid Settings ( Size < 0 ) !" << std::endl;
			return;
		}

		RenderArrays.clear();
		AxisLabels.clear();
		Legend.clear();
		Axes.clear();
		Axes.setPrimitiveType(sf::Lines);
		RenderArrays.insert(RenderArrays.end(), 2 + g.Curves.size(), sf::VertexArray());
		for (sf::VertexArray& vA : RenderArrays)
		{
			vA.clear();
			vA.setPrimitiveType(sf::Lines);
		}

		boost::mutex::scoped_lock data_mutex_lock(data_mutex);

		glm::ipoint2 maximas = g.getMaximas();

		dynScaleAxes(maximas);
		if (g.AxisStart.x > maximas.x) g.AxisStart.x = maximas.x;
		//if ( g.AxisStart.x < 0) g.AxisStart.x = maximas.x + g.AxisStart.x;

		if (g.AxisStart.y > maximas.y) g.AxisStart.y = maximas.y;
		//if ( g.AxisStart.y < 0) g.AxisStart.y = maximas.y + g.AxisStart.y;


		if (g.AxisSize.x <= 0 || g.AxisSize.y <= 0)
		{
			Engine::out(Engine::ERROR) << "[GraphPlotter] Invalid Settings ( AxisSize < 0 ) !" << std::endl;
			//printSettings();
			return;
		}

		if (g.drawLegend) drawLegend();
		if (g.drawAxisLabels) drawAxisLabels();
		if (g.drawAxes) drawAxes();

		for (unsigned int i = 0; i < g.Curves.size(); ++i)
		{
			drawCurve(g.Curves[i], RenderArrays[i]);
		}
	}
Beispiel #11
0
void cytosineGuanine()
{
    float hex1[6][2], hex2[6][2];
    float rx=512;
    //radius and color declarations
    GLubyte red[] = {15, 231, 76, 60};          //oxygen
    GLubyte green[] = {20, 39, 174, 96};        //carbon
    GLubyte blue[] = {20, 52, 152, 219};         //nitrogen
    GLubyte yellow[] = {10, 241, 196, 15};    //hydrogen
    getHexagonPoints(hex1, -192, 350, 75);
    getHexagonPoints(hex2, 192, 350, 75);
    
    glPushMatrix();

    	glTranslatef(rx, 0, 0);
    	glRotatef(theta, 0.0, 1.0, 0.0);
   		
   		 //hexagon 1
	    drawAtom(hex1[0][0], hex1[0][1], 0, green);
	    drawAtom(hex1[1][0], hex1[1][1], 0, blue);
	    drawAtom(hex1[2][0], hex1[2][1], 0, green);
	    drawAtom(hex1[3][0], hex1[3][1], 0, green);
	    drawAtom(hex1[4][0], hex1[4][1], 0, green);
	    drawAtom(hex1[5][0], hex1[5][1], 0, blue);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[1][0],hex1[1][1],0);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[2][0],hex1[2][1],0);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[3][0],hex1[3][1],0);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[4][0],hex1[4][1],0);
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[5][0],hex1[5][1],0);
	    drawBondLine(hex1[5][0],hex1[5][1],0, hex1[0][0],hex1[0][1],0);

	    drawAtom(hex1[0][0], hex1[0][1]-50, 0, red);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[0][0],hex1[0][1]-50,0);

	    drawAtom(hex1[2][0]+50, hex1[2][1]+25, -50, blue);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[2][0]+50,hex1[2][1]+25,-50);
		    drawAtom(hex1[2][0]+50,hex1[2][1]+67.5, -50, yellow);
		    drawBondLine(hex1[2][0]+50,hex1[2][1]+25,-50, hex1[2][0]+50,hex1[2][1]+67.5,-50);
		    drawAtom(hex1[2][0]+85,hex1[2][1],-50, yellow);
		    drawBondLine(hex1[2][0]+50,hex1[2][1]+25,-50, hex1[2][0]+85,hex1[2][1],-50);
		    
	    drawAtom(hex1[3][0],hex1[3][1]+25, -50, yellow);   
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[3][0],hex1[3][1]+25,-50);

		drawAtom(hex1[4][0]-15,hex1[4][1]+15, 50, yellow);   
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[4][0]-15,hex1[4][1]+15,50);


	    //hexagon 2
	    drawAtom(hex2[0][0], hex2[0][1], 0, blue);
	    drawAtom(hex2[1][0], hex2[1][1], 0, green);
	    drawAtom(hex2[2][0], hex2[2][1], 0, green);
	    drawAtom(hex2[3][0], hex2[3][1], 0, green);
	    drawAtom(hex2[4][0], hex2[4][1], 0, blue);
	    drawAtom(hex2[5][0], hex2[5][1], 0, green);
	    drawBondLine(hex2[0][0],hex2[0][1],0, hex2[1][0],hex2[1][1],0);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[2][0],hex2[2][1],0);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[3][0],hex2[3][1],0);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[4][0],hex2[4][1],0);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[5][0],hex2[5][1],0);
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[0][0],hex2[0][1],0);

	    drawAtom(hex2[1][0]+50, hex2[0][1]+25, 50, blue);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[1][0]+50,hex2[0][1]+25,50);
	    drawAtom(hex2[2][0]+50, hex2[3][1]-25, 50, blue);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[2][0]+50,hex2[3][1]-25,50);
		    drawAtom(hex2[2][0]+100,hex2[2][1]-37.5,75, green);
		    drawBondLine(hex2[1][0]+50, hex2[0][1]+25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75); 
		    drawBondLine(hex2[2][0]+50, hex2[3][1]-25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75);
			    drawAtom(hex2[2][0]+142.5,hex2[2][1]-37.5,75, yellow);
			    drawBondLine(hex2[2][0]+100,hex2[2][1]-37.5,75, hex2[2][0]+142.5,hex2[2][1]-37.5,75);

	    drawAtom(hex2[3][0], hex2[3][1]+50, 0, red);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[3][0],hex2[3][1]+50,0);

	    drawAtom(hex2[4][0]-25, hex2[4][1]+25, 0, yellow);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[4][0]-25,hex2[4][1]+25,0);
		
		drawAtom(hex2[5][0]-50, hex2[0][1]+25, 50, blue);   
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[5][0]-50,hex2[0][1]+25,50);
		    drawAtom(hex2[5][0]-50, hex2[0][1]-15, 50, yellow);
		    drawBondLine(hex2[5][0]-50,hex2[0][1]+25,50, hex2[5][0]-50,hex2[0][1]-15,50);
		    drawAtom(hex2[5][0]-85, hex2[0][1]+60, 50, yellow);
		    drawBondLine(hex2[5][0]-50,hex2[0][1]+25,50, hex2[5][0]-85,hex2[0][1]+60,50);
	    

	    //H-bonds
	    glLineWidth(1.5);
	    glBegin(GL_LINES);
		    glVertex3f(hex1[0][0],hex1[0][1]-50,0);
		    glVertex3f(hex2[5][0]-85,hex2[0][1]+60,50);

		    glVertex3f(hex1[1][0],hex1[1][1],0);
		    glVertex3f(hex2[4][0]-25,hex2[4][1]+25,0);

		    glVertex3f(hex1[2][0]+85,hex1[2][1],-50);
		    glVertex3f(hex2[3][0],hex2[3][1]+50,0);
		glEnd();

	    glTranslatef(-rx, 0, 0);

	glPopMatrix();
	theta+=0.25;

    drawLegend();
    glColor3ub(52, 73, 94);
    output(300, 190, "Cytosine recognizes specific DNA sequences and catalyzes", fonts[2]);
    output(300, 170, "the transfer of a methyl group.", fonts[2]);
    output(300, 130, "Guanine can carry energy and if bound to special receptors,", fonts[2]);
    output(300, 110, "can help carry signals from one part of the cell to another.", fonts[2]);
}
Beispiel #12
0
void adenineThymine()
{
	float hex1[6][2], hex2[6][2];
	float rx=512;
    //radius and colors declarations
    GLubyte red[] = {15, 231, 76, 60};          //oxygen
    GLubyte green[] = {20, 39, 174, 96};        //carbon
    GLubyte blue[] = {20, 52, 152, 219};         //nitrogen
    GLubyte yellow[] = {10, 241, 196, 15};    //hydrogen
    getHexagonPoints(hex1, -128, 350, 75);
    getHexagonPoints(hex2, 128, 350, 75);
    
    glPushMatrix();

    	glTranslatef(rx, 0, 0);
    	glRotatef(theta, 0.0, 1.0, 0.0);

	    //hexagon 1
	    drawAtom(hex1[0][0], hex1[0][1], 0, green);
	    drawAtom(hex1[1][0], hex1[1][1], 0, blue);
	    drawAtom(hex1[2][0], hex1[2][1], 0, green);
	    drawAtom(hex1[3][0], hex1[3][1], 0, green);
	    drawAtom(hex1[4][0], hex1[4][1], 0, green);
	    drawAtom(hex1[5][0], hex1[5][1], 0, blue);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[1][0],hex1[1][1],0);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[2][0],hex1[2][1],0);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[3][0],hex1[3][1],0);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[4][0],hex1[4][1],0);
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[5][0],hex1[5][1],0);
	    drawBondLine(hex1[5][0],hex1[5][1],0, hex1[0][0],hex1[0][1],0);

	    drawAtom(hex1[0][0], hex1[0][1]-50, 0, red);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[0][0],hex1[0][1]-50,0);

	    drawAtom(hex1[1][0]+15, hex1[1][1]-15, -50, yellow);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[1][0]+15,hex1[1][1]-15,-50);

	    drawAtom(hex1[2][0]+40, hex1[2][1]+40, 0, red);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[2][0]+40,hex1[2][1]+40,0);
	    
	    drawAtom(hex1[3][0], hex1[3][1]+50, 0, green);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[3][0],hex1[3][1]+50,0);
		    drawAtom(hex1[3][0], hex1[3][1]+75, 50, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0],hex1[3][1]+75,50);
		    drawAtom(hex1[3][0]+35, hex1[3][1]+75, -35, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0]+35,hex1[3][1]+75,-35);
		    drawAtom(hex1[3][0]-35, hex1[3][1]+75, -35, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0]-35,hex1[3][1]+75,-35);

		drawAtom(hex1[4][0]-15,hex1[4][1]+15, 50, yellow);   
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[4][0]-15,hex1[4][1]+15,50);


	    //hexagon 2
	    drawAtom(hex2[0][0], hex2[0][1], 0, blue);
	    drawAtom(hex2[1][0], hex2[1][1], 0, green);
	    drawAtom(hex2[2][0], hex2[2][1], 0, green);
	    drawAtom(hex2[3][0], hex2[3][1], 0, green);
	    drawAtom(hex2[4][0], hex2[4][1], 0, blue);
	    drawAtom(hex2[5][0], hex2[5][1], 0, green);
	    drawBondLine(hex2[0][0],hex2[0][1],0, hex2[1][0],hex2[1][1],0);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[2][0],hex2[2][1],0);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[3][0],hex2[3][1],0);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[4][0],hex2[4][1],0);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[5][0],hex2[5][1],0);
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[0][0],hex2[0][1],0);

	    drawAtom(hex2[1][0]+50, hex2[0][1]+25, 50, blue);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[1][0]+50,hex2[0][1]+25,50);
	    drawAtom(hex2[2][0]+50, hex2[3][1]-25, 50, blue);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[2][0]+50,hex2[3][1]-25,50);
		    drawAtom(hex2[2][0]+100,hex2[2][1]-37.5,75, green);
		    drawBondLine(hex2[1][0]+50, hex2[0][1]+25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75); 
		    drawBondLine(hex2[2][0]+50, hex2[3][1]-25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75);
			    drawAtom(hex2[2][0]+142.5,hex2[2][1]-37.5,75, yellow);
			    drawBondLine(hex2[2][0]+100,hex2[2][1]-37.5,75, hex2[2][0]+142.5,hex2[2][1]-37.5,75);

	    drawAtom(hex2[3][0], hex2[3][1]+50, 0, blue);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[3][0],hex2[3][1]+50,0);
		    drawAtom(hex2[3][0], hex2[3][1]+75, 50, yellow);
		    drawBondLine(hex2[3][0], hex2[3][1]+50,0, hex2[3][0],hex2[3][1]+75,50);
		    drawAtom(hex2[3][0], hex2[3][1]+75, -50, yellow);
		    drawBondLine(hex2[3][0],hex2[3][1]+50,0, hex2[3][0],hex2[3][1]+75,-50);
	    
		drawAtom(hex2[5][0]-30,hex2[5][1]-30, 0, yellow);   
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[5][0]-30,hex2[5][1]-30,0);


	    //H-bonds
	    glLineWidth(1.5);
	    glBegin(GL_LINES);
	    	glVertex3f(hex1[2][0]+40,hex1[2][1]+40,0);
	    	glVertex3f(hex2[3][0], hex2[3][1]+75, 50);

	    	glVertex3f(hex1[1][0]+15, hex1[1][1]-15, -50);
	    	glVertex3f(hex2[4][0],hex2[4][1],0);
	    glEnd();

	    glTranslatef(-rx, 0, 0);

	glPopMatrix();
	theta+=0.25;

    drawLegend();
    glColor3ub(52, 73, 94);
    output(300, 190, "Adenine is a nucleobase which plays a major role in", fonts[2]);
    output(300, 170, "cellular respiration and is rich in adenosine.", fonts[2]);
    output(300, 130, "Thymine is a pyrimidine nucleobase and it", fonts[2]);
    output(300, 110, "assists in stabalizing the nucleic acid structures.", fonts[2]);

}
Beispiel #13
0
bool Viewport::drawScene(QPainter *painter, bool withDynamics)
{
	bool disabled = false;
	{
		/* TODO: disabled member state instead? */
		SharedDataLock ctxlock(ctx->mutex);
		SharedDataLock setslock(sets->mutex);
		if ((*sets)->empty() || (*ctx)->wait)
			disabled = true;
	}

	target->makeCurrent();

	/* draw background */
	QRect rect(0, 0, width, height);
	/* Hack: without dynamics, we typically also want a boring background */
	if (withDynamics)
		painter->fillRect(rect, QColor(15, 7, 15));
	else
		painter->fillRect(rect, Qt::black);
	painter->setRenderHint(QPainter::Antialiasing);

	if (disabled) {
		drawWaitMessage(painter);
		return false;
	}

	painter->save();
	painter->setWorldTransform(modelview);
	drawAxesBg(painter);
	painter->restore();

	/* determine if we draw the highlight part */
	// only draw when active and dynamic content is desired
	bool drawHighlight = active && withDynamics;
	// only draw if not implicitely empty
	drawHighlight = drawHighlight && (hover > -1 || limiterMode);
	// do not draw when in single pixel overlay mode
	drawHighlight = drawHighlight && (!overlayMode);
	// do not draw when in single label mode
	drawHighlight = drawHighlight && (highlightLabels.empty());

	for (int i = 0; i < (drawHighlight ? 2 : 1); ++i) {

		renderbuffer &b = buffers[i];
		if (b.dirty) {
			drawWaitMessage(painter);
			// nothing to draw yet, don't even bother with other buffer,
			disabled = true;
			break;
		}

		// blit first to get from multisample to regular buffer. then draw that
		QGLFramebufferObject::blitFramebuffer(b.blit, rect, b.fbo, rect);
		target->drawTexture(rect, b.blit->texture());
	}

	// only provide selection for view with dynamic components (selected band)
	if (withDynamics)
		drawLegend(painter, selection);
	else
		drawLegend(painter);

	// foreground axes are a dynamic part
	if (withDynamics) {
		painter->save();
		painter->setWorldTransform(modelview);
		drawAxesFg(painter);
		painter->restore();
	}

	if (overlayMode && withDynamics)
		drawOverlay(painter);

	// return success if nothing was omited
	return !disabled;
}
//This function controls drawing of bore holes and the Legend
void drawGraphics(struct holeStruct holeData[MAX_HOLES],int holeIndex, int soilIndex,int choice,struct dimenssionStruct*dimenPtr,int legend)
{
						
		
				int i;
			
				//If the legend parameter=1, then drawLegend proceedure is called
				if(legend==1)
				{
								drawLegend(dimenPtr);
	
				}



				//Dpending on the value of choice parameter, appropriate proccedure to draw bore hole circles is called,
				switch (choice)
				{
								case 1:
								{
				
						
												drawSoilType(holeData,holeIndex,soilIndex);
								
												labelHole(holeData,holeIndex,15);
						
												break;
									
								}
				
								case 2:
								{
				
												drawSoilClr(holeData,holeIndex,soilIndex);
								
												labelHole(holeData,holeIndex,10);
					
												break;
								}
								
								case 3:
								{
												drawSoilStr(holeData,holeIndex,soilIndex);
											
												labelHole(holeData,holeIndex,5);
												
												break;
								}
								case 12:
				
								{
						
												drawSoilType(holeData,holeIndex,soilIndex);
							
												drawSoilClr(holeData,holeIndex,soilIndex);
				
												labelHole(holeData,holeIndex,15);
						
									
												break;
								}
								case 13:
								{
												drawSoilType(holeData,holeIndex,soilIndex);
									
												drawSoilStr(holeData,holeIndex,soilIndex);
									
												labelHole(holeData,holeIndex,15);

												break;
								
								}
								
								case 23:
								{
												drawSoilClr(holeData,holeIndex,soilIndex);
							
												drawSoilStr(holeData,holeIndex,soilIndex);
														
												labelHole(holeData,holeIndex,10);
							
												break;
								}
								
								case 123:
								{
												drawSoilType(holeData,holeIndex,soilIndex);
							
												drawSoilClr(holeData,holeIndex,soilIndex);
							
												drawSoilStr(holeData,holeIndex,soilIndex);
									
												labelHole(holeData,holeIndex,15);
									
									
				
												break;
												
								}
								
								default:
								{
									printf("\nUnexpected parameter passed\n");
									break;
								
								}
				};
			
			
}
void tagAndProbePlotsRun2012_MCdataCom_Ele27WP80(bool save=false, bool saveRoot=false)
{
  /// decide whether to do 1D or 2D plots or both
  bool do1D = true;
  bool do2D = true;
  
  /// set style
  // ============================
  //  Set ROOT Style
  // ============================
 
  gROOT->Reset();
//   gROOT->SetStyle("Plain");
//   
//   TStyle myStyle("HHStyle","HHStyle");
//   setHHStyle(myStyle);
//   TGaxis::SetMaxDigits(2);
//   myStyle.cd();
//   gROOT->SetStyle("HHStyle");
//   gROOT->ForceStyle();  
  
  gStyle->SetOptStat(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetLegendBorderSize(0);
  gStyle->SetPadBottomMargin(0.11);
  gStyle->SetLabelSize(0.05,"XY");
  gStyle->SetTitleSize(0.05,"XY");
  gStyle->SetFillColor(0);
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  
//   const int fontstyle1=62;
  const int fontstyle1=42;
  gStyle->SetTitleFont(fontstyle1);
  gStyle->SetTitleFont(fontstyle1, "XYZ");
  gStyle->SetLabelFont(fontstyle1, "XYZ");
  gStyle->SetTextFont(fontstyle1);
  
  // for 2D histo text
  gStyle->SetPaintTextFormat("3.3f");
  gStyle->SetPalette(1);
  
  /// path where input files are stored
  TString inputPathScratch  ="/afs/naf.desy.de/group/cms/scratch/tophh/efficiencies";
  
//   TString outputFolder   = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/2012/singleEle";
  TString outputFolder   = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/2012/singleEleFineBinned";
 TString outputFileName = "/DataMCcomp_Ele27WP80_";

  TString fileFormatArr []= {"root", "png", "eps"};
  std::vector<TString> fileFormat(fileFormatArr, fileFormatArr + sizeof(fileFormatArr)/sizeof(TString));
  
  /// if set to 0: all plots (probe, test, eff) are drawn; to 1: only eff plots
  int onlyEffPlots =1;
  /// method ID of MC file to normalise scale factors to
   TString mIDnorm = "m1";
  //TString mIDnorm = "m1-25TriJetPUEPS";
  std::cout<< "Efficiency wrt. which SF is supposed to be normalized " <<  mIDnorm << std::endl;

  
   /// map with structure that keeps features of methods, like file, filename, legend etc.
  std::map<TString, method*> method_;
  
  /// standard for nice plots:
//   TString mIDarr []= {"m1","m2"};
  /// for different PU scenarios: (also savable in root file)
  TString mIDarr []= {"m1", "m1PUup", "m1PUdown", "m2", "m2PUup", "m2PUdown"};

  std::vector<TString> mID(mIDarr, mIDarr + sizeof(mIDarr)/sizeof(TString));
  int mIDNum = mID.size();
  std::cout<< "Number of considered methods (i.e. files): " <<  mIDNum << std::endl;
  
  // check if mIDnorm is in vector and give error if not
  bool inVector=false;
  for(int i=0; i< mIDNum; i++) if(mID[i]==mIDnorm) inVector=true;
  if(!inVector) {
    std::cout<<"ERROR!!!! Efficiency wrt. which SF is supposed to be normalized is not in mID vector!!! "<<std::endl; 
    return;
  }
  
  TString fileName ;
  
    /// Define histo and legend styles and options
//   int lineStyle   []= {1,1,1,1,1,1};
//   int lineColor   []= {2,1,4,kGreen+2,kGray+2,3};
//   int markerStyle []={1,21,22,20,22,23};
//   int markerColor []= {2,1,4,kGreen+2,kGray+2,3};
//   TString drawOpt []= {"","E X0 P same","E X0 P same","E X0 same","E X0 same","E same"};
//   TString legOpt  []= {"L","P","P","P","P","P"};
//   bool legOnPlot = false;
  
  /// Define pt and eta cuts for TH2 
  /// TCut does not work for TH2
  double cutPt2D  = 33.;
  double cutEta2D = 2.1;
  
  /// option to select different cuts 
  TCut cutEle = "probePt>33. && TMath::Abs(probeEta)<2.1";
  
  /// Constructor for struct method(TString iniFileName, TString iniLegName, int iniLineStyle, int iniLineColor, int iniMarkerStyle, int iniMarkerColor, TString iniDrawOpt, TString iniLepOpt, TString source)
  
   /// Summer12 MC
  fileName=inputPathScratch+"/analyzeZEleEleTagAndProbeMCSummer12_HLT_Ele27WP80.root";
  method_["m1"] = new method(fileName, "Simulation Ele27WP80", 1, 2, 1, 1, "E", "L", "treeV2",cutEle,"eventWeightPUeventWeightPU");
  
  method_["m1PUup"] = new method(fileName, "Simulation Ele27WP80 PUrew UP", 1, 2, 1, 1, "E", "L", "treeV2",cutEle,"eventWeightPUsysUpeventWeightPUUp","m1PUup");
  
  method_["m1PUdown"] = new method(fileName, "Simulation Ele27WP80 PUrew DOWN", 1, 2, 1, 1, "E", "L", "treeV2", cutEle, "eventWeightPUsysDowneventWeightPUDown","m1PUdown");
  
 
  /// data
  fileName=inputPathScratch+"/analyzeZEleEleTagAndProbeRun2012ABCDJan22ReReco_HLT_Ele27WP80.root";
  method_["m2"] = new method(fileName, "Data Ele27WP80", 1, 1, 24, 1, "E", "PL", "treeV2",cutEle, "","m1");
  
  method_["m2PUup"] = new method(fileName, "Data Ele27WP80 PU up", 1, 1, 25, 1, "E", "LP", "treeV2",cutEle,"","m1PUup");
  
  method_["m2PUdown"] = new method(fileName, "Data Ele27WP80 PU down", 1, 1, 26, 1, "E", "LP", "treeV2",cutEle,"","m1PUdown");
  
  /// different tap studies (different efficiencies)

//   const int folderNum=6;
//    TString folderID[]={"tapTrkQEle", "tapIDEle", "tapIsoEle", "tapConvRejEle", "tapTotalSelectionEle", "tapTriggerEle"};
//    TString foldersTitle[]={"Electron Track Quality", "Electron ID", "Electron Isolation", "Electron Conversion Rejection", "Electron Selection", "Electron Trigger"};
  
//      const int folderNum=6;
//    TString folderID[]={"tapTrkQEle", "tapIDEle", "tapIsoEle", "tapConvRejEle", "tapTotalSelectionEle", "tapTriggerEle"};
//    TString foldersTitle[]={"Electron d_{0}", "Electron ID_{CiC}", "Electron Isolation", "Electron Conversion Rejection", "Electron Selection", "Electron Trigger"};
  
//   const int folderNum=4;
//   TString folderID[]={"tapTrkQEle", "tapIDEle", "tapIsoEle", "tapConvRejEle"};
//   TString foldersTitle[]={"Electron d_{0}", "Electron ID_{CiC}", "Electron Isolation", "Electron Conversion Rejection"};
   
//    const int folderNum=2;
//    TString folderID[]={"tapTotalSelectionEle", "tapTriggerEle"};
//    TString foldersTitle[]={"Electron Selection", "Electron Trigger"};
  
//   const int folderNum=1;
//   TString folderID[]={"tapTotalSelectionEle"};
//   TString foldersTitle[]={"Electron Selection"};
  
//   const int folderNum=1;
//   TString folderID[]={"tapTriggerEle"};
//   TString foldersTitle[]={"Trigger"};
  
//      const int folderNum=3;
//    TString folderID[]={"tapTotalSelectionEle", "tapTriggerEle", "tapAllEle"};
//    TString foldersTitle[]={"Overall Selection", "Trigger", "Combined Selection and Trigger"};
  
/// to combine selection and trigger efficiencies use tapAll:
    const int folderNum=1;
  TString folderID[]={"tapAllEle"};
  TString foldersTitle[]={"Combined Selection and Trigger"};



  /// effName = name of the effHisto; variables: corresponding variable to effName; cuts: corresponding cut to effName

//    TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR","Pt_inclLegend"};
  TString effIDarr[]      = {"Control", "Pt", "Eta", "PVMult", "MinDR","EtaPt33to39","EtaPt39to45","EtaPtGreater45"};
//  TString effIDarr[]      = {"Pt_inclLegend"};
   //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR","lepLepMass"};
  //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "PtEta0to1p5", "PtEta1p5to2p1"};
  //TString effIDarr[]      = {"Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR"};
  //TString effIDarr[]      = {"Pt"};
  std::vector<TString> effID(effIDarr, effIDarr + sizeof(effIDarr)/sizeof(TString));
  int effIDNum = effID.size();
  std::cout<< "Number of considered plots: " <<  effIDNum << std::endl;
  
  
  TString effIDarr2[]      = {};
  //TString effIDarr2[]      = {"PtEta0to1p2", "PtEta1p2to2p1", "EtaPt30to45", "EtaPt45to60", "EtaPtGreater60", "PtMedian", "Pt3bins"};
  std::vector<TString> effID2(effIDarr2, effIDarr2 + sizeof(effIDarr2)/sizeof(TString));
  int effIDNum2 = effID2.size();
  std::cout<< "Number of considered plots 2: " <<  effIDNum2 << std::endl;
    
  /// map with structure that keeps features of histograms
  std::map<TString, std::map<TString, eff*> > eff_;
  std::map<TString, eff2D*> eff2DPtEta_;
  
  /// title for histo, x and y axis (separated by "/")
  TString title0 ="";
  TString title ="";
  
  /// axis range
  //double yLo = 0.5, yHi = 1.1;
  double yLo = 0.45, yHi = 1.;
  double yLoSF = 0.9, yHiSF = 1.1-0.0001;
  
  /// Constructor for struct eff(TString iniVar, T  iniCuts, TString iniBins, TString iniTitles, double iniYLo=-9999., double iniYHi=-9999., double iniXLo=-9999., double iniXHi=-9999.)
  TCut cutPt  = "probePt>33."; // && probeRelIso<0.2 "; //&& probeMult>1"; /*"(probePt>30. || testPt>30. )";*/
  TCut cutEta = "TMath::Abs(probeEta)<2.1 "; //&& probeRelIso<0.2 "; //&& probeMult>1"; /*"(TMath::Abs(probeEta)<2.1 || TMath::Abs(testEta)<2.1)";*/
  TCut cutPtEta = cutPt && cutEta;
  for(int iFolder=0; iFolder < folderNum; iFolder++){
    title = foldersTitle[iFolder]+" Efficiency/ / ";
    eff_["Control"][folderID[iFolder]]        =new eff("Control", cutPtEta, mBinsControl, binsControl_, title, yLo, yHi, -9999.,-9999.);
    title = foldersTitle[iFolder]+" Efficiency/p_{T} [GeV]/ ";
    eff_["Pt"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtEle_, title, yLo, yHi, 33.,200.);
    title = foldersTitle[iFolder]+" Efficiency/p_{T} [GeV]/ ";
    eff_["Pt_inclLegend"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 33.,200.,true);
    title = foldersTitle[iFolder]+" Efficiency/#eta/ ";
    eff_["Eta"][folderID[iFolder]]             =new eff("Eta", cutPt, mBinsEtaEle, binsEtaEle_, title, yLo, yHi,-2.1,2.1);
    title = foldersTitle[iFolder]+" Efficiency/relIso/ ";
    eff_["RelIso"][folderID[iFolder]]          =new eff("RelIso", cutPtEta, mBinsRelIso, binsRelIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/absIso/ ";
    eff_["AbsIso"][folderID[iFolder]]          =new eff("AbsIso", cutPtEta, mBinsAbsIso, binsAbsIso_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/N_{PV}/ ";
    eff_["PVMult"][folderID[iFolder]]          =new eff("PVMult", cutPtEta, mBinsPVMult, binsPVMult_, title, yLo, yHi,0.,40.);
    title = foldersTitle[iFolder]+" Efficiency/N_{jet}/ ";
    eff_["Mult"][folderID[iFolder]]            =new eff("Mult", cutPtEta, mBinsMult, binsMult_, title, yLo, yHi);
    title = foldersTitle[iFolder]+" Efficiency/Minimum #DeltaR(e,jet)/ ";
    eff_["MinDR"][folderID[iFolder]]            =new eff("MinDR", cutPtEta && "probeRelIso<0.2", mBinsMinDR, binsMinDR_, title, yLo, yHi,0.,5.);
    title = foldersTitle[iFolder]+" Efficiency/Minimum M_{lep,lep}/ ";
    eff_["lepLepMass"][folderID[iFolder]]            =new eff("lepLepMass", cutPtEta, mBinsLepLepMass, binsLepLepMass_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 0<#eta<1.2/p_{T} [GeV]/ ";
    eff_["PtEta0to1p2"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)<1.2", mBinsPt, binsPt_, title, yLo, yHi, 33.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 1.2<#eta<2.1/p_{T} [GeV]/ ";
    eff_["PtEta1p2to2p1"][folderID[iFolder]]             =new eff("Pt", "TMath::Abs(probeEta)>1.2 && TMath::Abs(probeEta)<2.1", mBinsPt, binsPt_, title, yLo, yHi, 33.,200.,true);
    
    title = foldersTitle[iFolder]+" Efficiency, 30<p_{T}<32/#eta/ ";
    eff_["EtaPt30to32"][folderID[iFolder]]             =new eff("Eta", "probePt>30. && probePt<32.", mBinsEtaEle2, binsEtaEle2_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 33<p_{T}<39/#eta/ ";
    eff_["EtaPt33to39"][folderID[iFolder]]             =new eff("Eta", "probePt>33. && probePt<39.", mBinsEtaEle2, binsEtaEle2_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 39<p_{T}<45/#eta/ ";
    eff_["EtaPt39to45"][folderID[iFolder]]             =new eff("Eta", "probePt>39. && probePt<45.", mBinsEtaEle2, binsEtaEle2_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, 45<p_{T}/#eta/ ";
    eff_["EtaPtGreater45"][folderID[iFolder]]             =new eff("Eta", "probePt>45.", mBinsEtaEle2, binsEtaEle2_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency AN/p_{T} [GeV]/ ";
    eff_["PtAN"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtAN_, title, yLo, yHi, 33.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency Median/p_{T} [GeV]/ ";
    eff_["PtMedian"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPtMedian_, title, yLo, yHi, 33.,200.);
    
    title = foldersTitle[iFolder]+" Efficiency 3 bins/p_{T} [GeV]/ ";
    eff_["Pt3bins"][folderID[iFolder]]             =new eff("Pt", cutEta, mBinsPt, binsPt3bins_, title, yLo, yHi, 33.,200.);
    
    /// 2D pt:eta
    title = foldersTitle[iFolder]+" Efficiency/p_{T} [GeV]/#eta/ ";
    eff2DPtEta_[folderID[iFolder]]             =new eff2D("Pt", "Eta", cutPtEta, mBinsPtEle2D, binsPtEle2D_, mBinsEtaEle2D, binsEtaEle2D_, title, yLo, yHi, 33.+0.001,200.-0.001, -2.1+0.001, 2.1-0.001);
  }

  /// ---
  /// get efficiencies from tree or histo
  ///  ---
  for(int iMethod=0; iMethod<mIDNum; iMethod++){
    /// 1D
    if(do1D){
      for(int iEff=0; iEff<effIDNum; iEff++){
	for(int iFolder=0; iFolder<folderNum; iFolder++){
	  getEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
	}
      }
	for(int iEff=0; iEff<effIDNum2; iEff++){
	  for(int iFolder=0; iFolder<folderNum; iFolder++){
	    getEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder]);
	  }
      }
    }
    /// 2D
    if(do2D){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	getEfficiencies2D(eff2DPtEta_[folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderID[iFolder], folderID[iFolder], cutPt2D, cutEta2D);
      }
    }    
  }

 /// Draw one Canvas for each folder comparing different methods.
 /// Each canvas shows test (1st row) and probe collection (2nd) and efficiency (3rd) for different variables (columns)
  TCanvas* CanvComp [folderNum];
  TCanvas* CanvSFComp [folderNum];
  TCanvas* CanvEffAndSFComp [folderNum];
  TCanvas* CanvEvtsComp [folderNum];
  TCanvas* CanvEvtsNormComp [folderNum];
  TCanvas* CanvLeg = new TCanvas("CanvLeg", "CanvLeg", 350,200);
  
  TCanvas* CanvComp2 [folderNum];
  TCanvas* CanvSFComp2 [folderNum];
  
  TCanvas* CanvComp2DPtEta [folderNum];
  TCanvas* CanvComp2DPtEtaSF [folderNum];
  TCanvas* CanvComp2DPtEtaSFerr [folderNum];
  TCanvas* CanvComp2DPtEtaPass [folderNum];
  TCanvas* CanvComp2DPtEtaAll [folderNum];

  std::cout<< "Drawing eff. and SF"<<std::endl;
  for(int iFolder=0; iFolder<folderNum; iFolder++) {

    CanvComp[iFolder] = new TCanvas("Comparison"+folderID[iFolder], "Comparison"+folderID[iFolder], 1700,1000);
    CanvSFComp[iFolder] = new TCanvas("ComparisonSF"+folderID[iFolder], "ComparisonSF"+folderID[iFolder], 1700,1000);
    CanvEffAndSFComp[iFolder] = new TCanvas("ComparisonEffAndSF"+folderID[iFolder], "ComparisonEffAndSF"+folderID[iFolder], 1700,1000);
    CanvEvtsComp[iFolder] = new TCanvas("ComparisonEvts"+folderID[iFolder], "ComparisonEvts"+folderID[iFolder], 1700,1000);
    CanvEvtsNormComp[iFolder] = new TCanvas("ComparisonEvtsNorm"+folderID[iFolder], "ComparisonEvtsNorm"+folderID[iFolder], 1700,1000);
    
    CanvComp2[iFolder] = new TCanvas("Comparison2"+folderID[iFolder], "Comparison2"+folderID[iFolder], 1700,1000);
    CanvSFComp2[iFolder] = new TCanvas("ComparisonSF2"+folderID[iFolder], "ComparisonSF2"+folderID[iFolder], 1700,1000);
    
    CanvComp[iFolder]->Divide(4,2);
    CanvSFComp[iFolder]->Divide(4,2);
    CanvEffAndSFComp[iFolder]->Divide(4,2);
    CanvEvtsComp[iFolder]->Divide(4,2);
    CanvEvtsNormComp[iFolder]->Divide(4,2);
    
    CanvComp2[iFolder]->Divide(4,2);
    CanvSFComp2[iFolder]->Divide(4,2);
  
    /// 1D
    if(do1D){
      for(int iEff=0; iEff<effIDNum; iEff++){
	CanvComp[iFolder]->cd(iEff+1);
  //       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
  //       std::cout<< "Drawing eff."<<std::endl;
  //       drawEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.12,0.6,1.0,0.9,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
  //       CanvSFComp[iFolder]->cd(iEff+1);
  //       std::cout<< "Drawing SF"<<std::endl;
  //       drawSF          (eff_[effID[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.12,0.15,1.0,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID[iEff]][folderID[iFolder]]->xLo, eff_[effID[iEff]][folderID[iFolder]]->xHi);
	std::cout<< "Drawing Eff. and SF"<<std::endl;
	CanvEffAndSFComp[iFolder]->cd(iEff+1);
	drawEffAndSFinOne          (eff_[effID[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.12,0.15,1.0,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID[iEff]][folderID[iFolder]]->xLo, eff_[effID[iEff]][folderID[iFolder]]->xHi);
      /// if desired plot also raw event number histos
	if(onlyEffPlots!=1) {
	  std::cout<< "Drawing event numbers"<<std::endl;
	  CanvEvtsComp[iFolder]->cd(iEff+1);
	  drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.12,0.15,1.0,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
	  CanvEvtsNormComp[iFolder]->cd(iEff+1);
	  drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.12,0.15,1.0,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend,"normInt");
	}
      }
      for(int iEff=0; iEff<effIDNum2; iEff++){
	CanvComp2[iFolder]->cd(iEff+1);
  //       CanvComp[iFolder]->cd(iEff+1)->SetGrid(1,1);
	std::cout<< "Drawing eff. 2"<<std::endl;
	drawEfficiencies(eff_[effID2[iEff]][folderID[iFolder]], method_, mID, 0.12,0.15,1.0,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend);
	CanvSFComp2[iFolder]->cd(iEff+1);
	std::cout<< "Drawing SF"<<std::endl;
	drawSF          (eff_[effID2[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.12,0.15,1.0,0.45,eff_[effID2[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID2[iEff]][folderID[iFolder]]->xLo, eff_[effID2[iEff]][folderID[iFolder]]->xHi);
      }
    }
    
    /// draw 2D efficiencies
    if(do2D){

      CanvComp2DPtEta[iFolder] = new TCanvas("Comparison2DPtEta"+folderID[iFolder], "Comparison2DPtEta"+folderID[iFolder], 1700,1000);
      CanvComp2DPtEta[iFolder]->Divide((mIDNum+1)/2,2);
      
      CanvComp2DPtEtaSF[iFolder] = new TCanvas("Comparison2DPtEtaSF"+folderID[iFolder], "Comparison2DPtEtaSF"+folderID[iFolder], 1700,1000);
      CanvComp2DPtEtaSF[iFolder]->Divide((mIDNum+1)/2,2);
      
      CanvComp2DPtEtaSFerr[iFolder] = new TCanvas("Comparison2DPtEtaSFerr"+folderID[iFolder], "Comparison2DPtEtaSFerr"+folderID[iFolder], 1700,1000);
      CanvComp2DPtEtaSFerr[iFolder]->Divide((mIDNum+1)/2,2);
      
      CanvComp2DPtEtaPass[iFolder] = new TCanvas("Comparison2DPtEtaPass"+folderID[iFolder], "Comparison2DPtEtaPass"+folderID[iFolder], 1700,1000);
      CanvComp2DPtEtaPass[iFolder]->Divide((mIDNum+1)/2,2);
      
      CanvComp2DPtEtaAll[iFolder] = new TCanvas("Comparison2DPtEtaAll"+folderID[iFolder], "Comparison2DPtEtaAll"+folderID[iFolder], 1700,1000);
      CanvComp2DPtEtaAll[iFolder]->Divide((mIDNum+1)/2,2);
      
      std::cout<< "Drawing 2D Pt Eta Eff."<<std::endl;
      for(unsigned int iMethod=0; iMethod<mID.size(); iMethod++){
	CanvComp2DPtEta[iFolder]->cd(iMethod+1);
	eff2DPtEta_[folderID[iFolder]]->his[mID[iMethod]]->Draw("colz text");
	
	CanvComp2DPtEtaPass[iFolder]->cd(iMethod+1);
	eff2DPtEta_[folderID[iFolder]]->hisPass[mID[iMethod]]->Draw("colz text");
	
	CanvComp2DPtEtaAll[iFolder]->cd(iMethod+1);
	eff2DPtEta_[folderID[iFolder]]->hisAll[mID[iMethod]]->Draw("colz text");

	/// 2D SF!!!
	std::cout<< "Drawing 2D SF"<<std::endl;
	
	CanvComp2DPtEtaSF[iFolder]->cd(iMethod+1);
	getSF2D (eff2DPtEta_[folderID[iFolder]], method_, mID, mIDnorm, 0.8, 1.2);
	eff2DPtEta_[folderID[iFolder]]->hisSF[mID[iMethod]]->Draw("colz text");
	
	CanvComp2DPtEtaSFerr[iFolder]->cd(iMethod+1);
	eff2DPtEta_[folderID[iFolder]]->hisSFerr[mID[iMethod]]->Draw("colz text");
      }
    }
    
  // draw legend
    CanvLeg->cd();
    if(iFolder==0) drawLegend(eff_[effID[0]][folderID[0]], method_, mID, 0.,0.,1.,1.);
  
//   effControl[iMethod][iFolder]->GetXaxis()->SetNdivisions(0);
//   effRelIso[iMethod][iFolder]->GetXaxis()->SetNdivisions(505);
 
    if(save){
      for(unsigned int iFileFormat=0; iFileFormat < fileFormat.size(); iFileFormat++){
	if(do1D){
	  CanvComp[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_overview."+fileFormat[iFileFormat]);
	  for(int iEff=0; iEff<effIDNum; iEff++){
	  // 	  CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	  // 	  CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	    CanvEffAndSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_EffAndSF_"+effID[iEff]+"."+fileFormat[iFileFormat]);
	  }
	  for(int iEff=0; iEff<effIDNum2; iEff++){
	    CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	    CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID2[iEff]+"."+fileFormat[iFileFormat]);
	  }
	}
	/// 2D
	if(do2D){
	  CanvComp2DPtEta[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+"Eff2DPtEta."+fileFormat[iFileFormat]);
	  CanvComp2DPtEtaSF[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+"SF2DPtEta."+fileFormat[iFileFormat]);
	}
	if(iFolder==0) CanvLeg->Print(outputFolder+outputFileName+"_Legend."+fileFormat[iFileFormat]);
	std::cout<<"Canvas with plots is saved in "<<outputFolder<<std::endl;
      }
    }
    /// save graph in root file
    /// 1D
    if(saveRoot && do1D){
      TFile f("EleEffSF2012.root", "recreate");
      eff_["Eta"]["tapAllEle"]->graphSF["m2"]->SetName("tapAllSFeta");
      eff_["Eta"]["tapAllEle"]->graphSF["m2"]->Write();
      eff_["Eta"]["tapAllEle"]->graphSF["m2PUup"]->SetName("tapAllSFetaPUup");
      eff_["Eta"]["tapAllEle"]->graphSF["m2PUup"]->Write();
      eff_["Eta"]["tapAllEle"]->graphSF["m2PUdown"]->SetName("tapAllSFetaPUdown");
      eff_["Eta"]["tapAllEle"]->graphSF["m2PUdown"]->Write();
      std::cout<<"EleEffSF2012.root with TGraphErrors is saved "<<std::endl;
    }
    /// 2D
    if(saveRoot && do2D){
      TFile f("EleEffSF2D2012.root", "recreate");
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2"]->SetName("tapAllSFeta");
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2"]->Write();
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2PUup"]->SetName("tapAllSFetaPUup");
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2PUup"]->Write();
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2PUdown"]->SetName("tapAllSFetaPUdown");
      eff2DPtEta_[ "tapAllEle"]->hisSF["m2PUdown"]->Write();
      std::cout<<"EleEffSF2D2012.root with 2D SF Histos is saved in "<<std::endl;
    }
  }
  std::cout<< "Done"<<std::endl;
}
Beispiel #16
0
void patternPrinter::save(bool usePdfViewer, const QString& pdfViewerPath) {

  printer_.setOutputFormat(QPrinter::PdfFormat);  // actually default
  //qreal l,r,t,b;
  //printer_.getPageMargins(&l, &t, &r, &b, QPrinter::Point);
  printer_.setPageMargins(.35, .35, .35, .35, QPrinter::Inch);
  const QRect printerRect = printer_.pageRect();
  printerWidth_ = printerRect.width();
  printerHeight_ = printerRect.height();
  patternMetadata metadata(printerWidth_, 20, 8, 8, NULL);
  const int metadataReturnCode = metadata.exec();
  if (metadataReturnCode == QDialog::Rejected) {
    return;
  }
  metadata.saveSettings();

  const QString outputFile =
    QFileDialog::getSaveFileName(NULL, QObject::tr("Save pattern"), ".",
                                 QObject::tr("Pdf files (*.pdf)\n"
                                             "All (*)"));
  if (outputFile.isEmpty()) {
    return;
  }

  printer_.setOutputFileName(outputFile);

  // to "print", you draw on the printer object
  // do printer.newPage() for each new page
  painter_.begin(&printer_);
  fontMetrics_ = painter_.fontMetrics();

  //// draw title pages with the original and squared images
  drawTitlePage(metadata);

  pdfSymbolDim_ = metadata.pdfSymbolSize();
  patternImageWidth_ = (squareImage_.width()/squareDim_) * pdfSymbolDim_;
  patternImageHeight_ = (squareImage_.height()/squareDim_) * pdfSymbolDim_;
  // horizontal boxes per pdf page
  xBoxesPerPage_ = printerWidth_/pdfSymbolDim_;
  xBoxes_ = squareImage_.width()/squareDim_;
  // vertical boxes per pdf page
  yBoxesPerPage_ = printerHeight_/pdfSymbolDim_;
  yBoxes_ = squareImage_.height()/squareDim_;

  //// figure out which orientation to use and how many pages it will
  //// require
  computeOrientationAndPageCounts();

  //// present the page-number to image-portion correspondence
  const int legendHeight = drawLegend();
  
  //// present the color list
  drawColorList(legendHeight);

  //// draw the pattern pages
  const bool cancel = drawPatternPages();
  if (cancel) {
    // abort probably does nothing; the printer writes to disk as it goes,
    // so we've already written a partial pdf
    painter_.end();
    printer_.abort();
    QFile fileToRemove(outputFile);
    fileToRemove.remove();
    return;
  }

  if (usePdfViewer) {
    QProcess::startDetached(pdfViewerPath,
                            QStringList(QDir::toNativeSeparators(outputFile)));
  }
}
//End of drawSoilClr routine
//End of Functions that draw soilPalette attributes on the graphics window
//This function controls drawing of bore holes and the Legend
void drawGraphics(struct hole holeData[MAX_HOLES], soil_palette soilPalette, int holeIndex, int soilIndex, char* choice, struct graphicWindow*dimenPtr, int legend)
{
	int i;
	//If the legend parameter=1, then drawLegend proceedure is called
	if (legend == 1)
	{
		drawLegend(dimenPtr, soilPalette);
	}
	
	for (int i = 0;i < strlen(choice);i++)
	{
		if (choice[i] == '1')
		{
			drawSoilType(holeData, soilPalette, holeIndex, soilIndex);
			labelHole(holeData, holeIndex, 15);
		}
		else if (choice[i] == '2')
		{
			drawSoilClr(holeData, soilPalette, holeIndex, soilIndex);
			labelHole(holeData, holeIndex, 10);
		}
		else if (choice[i] == '3')
		{
			drawSoilStr(holeData, soilPalette, holeIndex, soilIndex);
			labelHole(holeData, holeIndex, 5);
		}
		break;
	}
	//Dpending on the value of choice parameter, appropriate proccedure to draw bore hole circles is called,
	/*	  switch (choice)
		{
						case 1:
						{
		
				
										drawSoilType(holeData,soilPalette,holeIndex,soilIndex);
						
										labelHole(holeData,holeIndex,15);
				
										break;
							
						}
		
						case 2:
						{
		
										drawSoilClr(holeData,soilPalette,holeIndex,soilIndex);
						
										labelHole(holeData,holeIndex,10);
			
										break;
						}
						
						case 3:
						{
										drawSoilStr(holeData,soilPalette,holeIndex,soilIndex);
									
										labelHole(holeData,holeIndex,5);
										
										break;
						}
						case 12:
		
						{
				
										drawSoilType(holeData,soilPalette,holeIndex,soilIndex);
					
										drawSoilClr(holeData,soilPalette,holeIndex,soilIndex);
		
										labelHole(holeData,holeIndex,15);
				
							
										break;
						}
						case 13:
						{
										drawSoilType(holeData,soilPalette,holeIndex,soilIndex);
							
										drawSoilStr(holeData,soilPalette,holeIndex,soilIndex);
							
										labelHole(holeData,holeIndex,15);
										break;
						
						}
						
						case 23:
						{
										drawSoilClr(holeData,soilPalette,holeIndex,soilIndex);
					
										drawSoilStr(holeData,soilPalette,holeIndex,soilIndex);
												
										labelHole(holeData,holeIndex,10);
					
										break;
						}
						
						case 123:
						{
										drawSoilType(holeData,soilPalette,holeIndex,soilIndex);
					
										drawSoilClr(holeData,soilPalette,holeIndex,soilIndex);
					
										drawSoilStr(holeData,soilPalette,holeIndex,soilIndex);
							
										labelHole(holeData,holeIndex,15);
							
							
		
										break;
										
						}
						
						default:
						{
							printf("\nUnexpected parameter passed\n");
							break;
						
						}
		};
	*/
}
void crossTriggerIndependentControlTrigRun2011_SingleLep_LepTriJet_MuHadDifferentRunRanges(bool save=false)
{
  gStyle->SetOptStat(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetLegendBorderSize(0);
  gStyle->SetPadBottomMargin(0.11);
  gStyle->SetLabelSize(0.05,"XY");
  gStyle->SetTitleSize(0.05,"XY");
  gStyle->SetFillColor(0);
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  
//   const int fontstyle1=62;
  const int fontstyle1=42;
  gStyle->SetTitleFont(fontstyle1);
  gStyle->SetTitleFont(fontstyle1, "XYZ");
  gStyle->SetLabelFont(fontstyle1, "XYZ");
  gStyle->SetTextFont(fontstyle1);
  
  
  /// path where input files are stored
  TString inputPathScratch  ="/scratch/hh/current/cms/user/jlange/output_4_2_4/fullLeptonic";
  TString inputPath42       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_4/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  TString inputPath428       ="/afs/naf.desy.de/user/j/jlange/nafscratch/top/CMSSW_4_2_8_patch7/src/TopAnalysis/Configuration/analysis/fullLeptonic";
  
  TString outputFolder   = "/afs/desy.de/user/j/jlange/analysis/tagAndProbe/plots/2011/LepHad/PF2PAT/MuDifferentRunRanges";
//   TString outputFileName = "/MuDifferentRunRanges";
  TString outputFileName = "/MuDifferentRunRanges3Jets";

  TString fileFormatArr []= {"root", "png", "eps"};
  std::vector<TString> fileFormat(fileFormatArr, fileFormatArr + sizeof(fileFormatArr)/sizeof(TString));
  
  /// if set to 0: all plots (probe, test, eff) are drawn; to 1: only eff plots
  int onlyEffPlots =0;
  /// method ID of MC file to normalise scale factors to
  //TString mIDnorm = "m1WMu";
  TString mIDnorm = "m2allMu";
  //TString mIDnorm = "m1ttWcombMu";
  std::cout<< "Efficiency wrt. which SF is supposed to be normalized " <<  mIDnorm << std::endl;
  
  /// if two efficiencies should be averaged:
  /// destination method (leave empty if no averaging is supposed to take place):
  TString averageMIDdestination = "";
  TString averageMIDdestination_2 = "";
  //TString averageMIDdestination  = "m1ttWcombMu";
  /// first method to enter the averaging
  TString averageMID1  = "m1ttMuEPS";
  TString averageMID1_2= "m1ttEleEPS";
  /// second method to enter the averaging
  TString averageMID2  = "m1WMuEPS";
  TString averageMID2_2= "m1WEleEPS";

   /// map with structure that keeps features of methods, like file, filename, legend etc.
  std::map<TString, method*> method_;
  
//   TString mIDarr []= {"m1tt", "m1W", "m2", "m3", "m11", "m12"};
  //TString mIDarr []= {"m1ttEle", "m2allEle", "m2EPSEle", "m2ApostEPSEle", "m2B3e33Ele", "m2B5e33-WP70Ele"};
  TString mIDarr []= {"m2allMu", "m2AMu", "m2B3e33Mu", "m2B5e33Mu"};
  //TString mIDarr []= {"m1ttMu", "m1WMu", "m1ttWcombMu", "m2allMu"};
  //TString mIDarr []= {"m1ttMu", "m1WMu", "m2allMu"};
  //TString mIDarr []= {"m1ttEle", "m1WEle", "m2allEle"};
//   TString mIDarr []= {"m1ttEle", "m1ttMu", "m1WEle", "m1WMu"};
//   TString mIDarr []= {"m1ttEleEPS", "m1ttMuEPS", "m1WEleEPS", "m1WMuEPS", "m1ttWcombEleEPS", "m1ttWcombMuEPS", "m2EPSEle", "m2EPSMu"};
  //TString mIDarr []= {"m1ttEleEPS", "m1ttMuEPS", "m1WEleEPS", "m1WMuEPS","m2EPSEle", "m2EPSMu"};
  //TString mIDarr []= {"m1ttEle", "m1ttMu", "m2allEle", "m2allMu"};
 // TString mIDarr []= {"m1ttEle", "m2allEle", "m2EPSEle", "m2ApostEPSEle", "m2B3e33Ele", "m2B5e33-WP70Ele", "m1ttMu", "m2allMu", "m2EPSMu", "m2ApostEPSMu", "m2B3e33Mu", "m2B5e33Mu"};

  std::vector<TString> mID(mIDarr, mIDarr + sizeof(mIDarr)/sizeof(TString));
  int mIDNum = mID.size();
  std::cout<< "Number of considered methods (i.e. files): " <<  mIDNum << std::endl;
  
  // check if mIDnorm is in vector and give error if not
  bool inVector=false;
  for(int i=0; i< mIDNum; i++) if(mID[i]==mIDnorm) inVector=true;
  if(!inVector) {
    std::cout<<"ERROR!!!! Efficiency wrt. which SF is supposed to be normalized is not in mID vector!!! "<<std::endl; 
    return;
  }
  
  TString fileName ;
  
    /// Define histo and legend styles and options
//   int lineStyle   []= {1,1,1,1,1,1};
//   int lineColor   []= {2,1,4,kGreen+2,kGray+2,3};
//   int markerStyle []={1,21,22,20,22,23};
//   int markerColor []= {2,1,4,kGreen+2,kGray+2,3};
//   TString drawOpt []= {"","E X0 P same","E X0 P same","E X0 same","E X0 same","E same"};
//   TString legOpt  []= {"L","P","P","P","P","P"};
//   bool legOnPlot = false;
  
  /// Constructor for struct method(TString iniFileName, TString iniLegName, int iniLineStyle, int iniLineColor, int iniMarkerStyle, int iniMarkerColor, TString iniDrawOpt, TString iniLepOpt, TString source)

  /// Electrons:
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet.root";
  method_["m1ttEle"] = new method(fileName, "MC t#bar{t}", 2, 2, 1, 2, "E same", "LP","treeV2","","eventWeightPUeventWeightPU");
  //weight
  //Summer11 tt IsoEle27_Ele25TriJet
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet.root";
  method_["m1ttEleEPS"] = new method(fileName, "t#bar{t} (EleHad)", 2, 2, 1, 2, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCSFall11WJets_IsoEle32_IsoEle25TriJet_cfg/prel.root";
  method_["m1WEle"] = new method(fileName, "MC W IsoEle32_Ele25TriJet", 2, 8, 1, 8, "E same", "LP","treeV2","","eventWeightPUeventWeightPU");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCSFall11WJets_IsoEle32_IsoEle25TriJet_cfg/prel.root";
  method_["m1WEleEPS"] = new method(fileName, "W (EleHad)", 2, 8, 1, 8, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoEle32_IsoEle25TriJet.root";
  method_["m1ttWcombEleEPS"] = new method(fileName, "t#bar{t} and W (EleHad)", 2, 1, 1, 1, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
//   fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCSummer11ZJets_IsoEle27_Ele25TriJet_cfg_TreeV2/analyzeCrossTriggerRatiosMCSummer11ZJets_IsoEle27_Ele25TriJet_TreeV2.root";
//   method_["m1Z"] = new method(fileName, "Summer11 Z IsoEle27_Ele25TriJet", 1, 4, 1, 1, "E same", "LP","treeV2","","weight");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCFall11_HLT_IsoEle32_IsoEle25TriJet.root";
  method_["m1TaPEle"] = new method(fileName, "MC Z IsoEle32_Ele25TriJet", 2, 4, 1, 4, "E same", "LP","treeV2","","weight");
  
  /// Ele data
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2allEle"] = new method(fileName, "Data full 2011", 2, 1, 21, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2EPSEle"] = new method(fileName, "Data 1 fb^{-1} (EleHad)", 2, 4, 25, 4, "E same", "LP","treeV2","runNumber<=167913","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2AEle"] = new method(fileName, "Data 2011A (EleHad)", 2, 4, 25, 4, "E same", "LP","treeV2","runNumber<=175570","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2ApostEPSEle"] = new method(fileName, "Data A post EPS", 2, 4, 25, 4, "E same", "LP","treeV2","runNumber>167913 && runNumber<=175570","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2B3e33Ele"] = new method(fileName, "Data B 3e33", 2, 8, 23, 8, "E same", "LP","treeV2","runNumber>175570 && runNumber<=178380","");
  
  fileName=inputPath428+"/naf_analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeRun2011All_HLT_IsoEle27_32_IsoEle25TriJet.root";
  method_["m2B5e33-WP70Ele"] = new method(fileName, "Data B 5e33 WP70", 2, 6, 26, 6, "E same", "LP","treeV2","runNumber>178380","");
  
  //Run May10+PromptV4 IsoEle27(32)_IsoEle25TriJet
  
  /// Muons: 
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1ttMu"] = new method(fileName, "t#bar{t} (MuHad)", 1, 2, 1, 2, "E same", "LP","treeV2","","eventWeightPUeventWeightPU");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1ttMuEPS"] = new method(fileName, "t#bar{t} (MuHad)", 1, 2, 1, 2, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1ttMunoPUrew"] = new method(fileName, "t#bar{t} (MuHad)", 1, 2, 1, 2, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCSFall11WJets_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11WJets_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1WMu"] = new method(fileName, "W (MuHad)", 1, 8, 1, 8, "E same", "LP","treeV2","","eventWeightPUeventWeightPU");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCSFall11WJets_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11WJets_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1WMuEPS"] = new method(fileName, "W (MuHad)", 1, 8, 1, 8, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeMCFall11_HLT_IsoMu24_eta2p1_IsoMu17eta2p1TriJet.root";
  method_["m1MuTaP"] = new method(fileName, "Z (MuHad)", 1, 4, 1, 4, "E same", "LP","treeV2","","weight");
  
  fileName=inputPath428+"/naf_analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet_cfg/analyzeCrossTriggerRatiosMCFall11ttbar_IsoMu24_eta2p1_IsoMu17TriJet.root";
  method_["m1ttWcombMuEPS"] = new method(fileName, "t#bar{t} and W (MuHad)", 1, 1, 1, 1, "E same", "LP","treeV2","","eventWeightPUEPSeventWeightPUEPS");
  
  /// Mu data
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2allMu"] = new method(fileName, "Data 2011", 1, 1, 21, 1, "E same", "LP","treeV2","","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2EPSMu"] = new method(fileName, "Data 1 fb^{-1}", 1, 4, 21, 4, "E same", "LP","treeV2","runNumber<=167913","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2AMu"] = new method(fileName, "Data 2011A", 1, 4, 20, 4, "E same", "LP","treeV2","runNumber<=175570","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2ApostEPSMu"] = new method(fileName, "Data A post EPS (MuHad)", 1, 4, 25, 4, "E same", "LP","treeV2","runNumber>167913 && runNumber<=175570","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2B3e33Mu"] = new method(fileName, "Data 2011B 3e33", 1, 8, 22, 8, "E same", "LP","treeV2","runNumber>175570 && runNumber<=178380","");
  
  fileName=inputPath428+"/naf_analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet_cfg/analyzeZMuMuTagAndProbeRun2011All_HLT_IsoMu17_24_IsoMu17TriJet.root";
  method_["m2B5e33Mu"] = new method(fileName, "Data 2011B 5e33", 1, 6, 23, 6, "E same", "LP","treeV2","runNumber>178380","");
  
   
//   fileName=inputPathScratch+"/naf_analyzeZMuMuTagAndProbeRun2011A_2e33_170826_173198_HLT_IsoMu24_IsoMu17TriJet_muPt30_cfg/analyzeZMuMuTagAndProbeRun2011A_2e33_170826_173198_HLT_IsoMu24_IsoMu17TriJet_muPt30.root";
//   method_["m3"] = new method(fileName, "IsoMu24 2e33", 1, 4, 22, 4, "E0 same", "P","treeV2");
//    
//   fileName=inputPathScratch+"/naf_analyzeZMuMuTagAndProbeRun2011A_3e33_173212_175770_HLT_IsoMu24Eta_IsoMu17EtaTriJet_muPt30_cfg/analyzeZMuMuTagAndProbeRun2011A_3e33_173212_175770_HLT_IsoMu24Eta_IsoMu17EtaTriJet_muPt30.root";
//   method_["m4"] = new method(fileName, "IsoMu24 3e33", 1, 8, 23, 8, "E0 same", "P","treeV2");
  
  /// To compare different run ranges also beyond EPS:
//   fileName=inputPath42+"/naf_analyzeZEleEleTagAndProbeMCSummer11_HLT_IsoEle27_IsoEle25TriJet_cfg/analyzeZEleEleTagAndProbeMCSummer11_HLT_IsoEle27_IsoEle25TriJet.root";
//   method_["m1"] = new method(fileName, "Summer11 IsoEle27", 1, 2, 1, 2, "E same", "LP","treeV2","","PUweightEPSeventWeightPU");
//    //PUweightEPSeventWeightPU

  
  /// different tap studies (different efficiencies)

  
  const int folderNum=1;
  TString folderID[]={""};
  TString foldersTitle[]={"Jet Leg Trigger"};
  /// for reference trigger method:
  TString folderIDrefTriggerPass="******";
  TString folderIDrefTriggerAll="analyzeJetAllTrig1AfterCut";
  
//   TString folderIDrefTriggerPass="******";
//   TString folderIDrefTriggerAll="analyzeJetDiffMultTrig1AfterCut";


  /// effName = name of the effHisto; variables: corresponding variable to effName; cuts: corresponding cut to effName

//   TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR","lepLepMass"};
   //TString effIDarr[]      = {"Control", "Pt", "Eta", "RelIso", "PVMult", "Mult", "PtEta0to1p5", "PtEta1p5to2p1"};
  //TString effIDarr[]      = {"Pt", "Eta", "RelIso", "PVMult", "Mult", "MinDR"};
   //TString effIDarr[]      = {"pt3-3jets", "pt4-4jets", "pt4-geq4jets", "pt5-5jets", "eta3-3jets", "eta4-4jets", "eta4-geq4jets", "eta5-5jets"};
  //TString effIDarr[]      = {"pt3-3jets", "pt4-4jets", "pt4-geq4jets", "pt5-5jets", "eta3-3jets-ptl40", "eta4-4jets-ptl40", "eta4-geq4jets-ptl40", "absEta4-4jets-ptl40"};
  //TString effIDarr[]      = {"pt3-3jets", "pt4-4jets", "pt4-geq4jets", "pt5-5jets", "eta3-3jets-ptl40", "eta4-4jets-ptl40", "eta4-geq4jets-ptl40", "eta5-5jets-ptl40"};
  TString effIDarr[]      = {"pt3-3jets", "eta3-3jets", "eta3-3jets-ptl40", "pv-3jets"};
//   TString effIDarr[]      = {"pt4-4jets", "eta4-4jets-ptl40", "pv-4jets"};
  //TString effIDarr[]      = {"pt5-5jets", "eta5-5jets-ptl40", "pv-5jets"};
  //TString effIDarr[]      = {"pt3-3jets", "eta3-3jets", "eta3-3jets-ptl40", "pv-3jets", "pt5-5jets", "eta5-5jets-ptl40", "pv-5jets"};
  //TString effIDarr[]      = {"pt1-3jets", "pt2-3jets", "pt3-3jets", "pt1-4jets", "pt2-4jets", "pt3-4jets", "pt4-4jets"};
  // TString effIDarr[]      = {"pt3-3jets", "pt4-4jets", "pt4-geq4jets", "pt5-5jets", "pv-3jets", "pv-4jets", "pv-geq4jets", "pv-5jets"};
  std::vector<TString> effID(effIDarr, effIDarr + sizeof(effIDarr)/sizeof(TString));
  int effIDNum = effID.size();
  std::cout<< "Number of considered plots: " <<  effIDNum << std::endl;
    
  /// map with structure that keeps features of histograms
  std::map<TString, std::map<TString, eff*> > eff_;
  
  /// title for histo, x and y axis (separated by "/")
  TString title0 ="";
  TString title ="";
  
  /// axis range
  //double yLo = 0.5, yHi = 1.1;
  double yLo = 0.9, yHi = 1.;
  double yLo3 = 0.5, yHi3 = 1.;
  double yLoSF = 0.9, yHiSF = 1.1;
  
  /// Constructor for struct eff(TString iniVar, T  iniCuts, TString iniBins, TString iniTitles, double iniYLo=-9999., double iniYHi=-9999., double iniXLo=-9999., double iniXHi=-9999.)
  TCut cutPt  =""; /*"(probePt>30. || testPt>30. )";*/
  TCut cutEta =""; /*"(TMath::Abs(probeEta)<2.1 || TMath::Abs(testEta)<2.1)";*/
  TCut cutPtEta = cutPt && cutEta;
  for(int iFolder=0; iFolder < folderNum; iFolder++){
    title = foldersTitle[iFolder]+" Efficiency/ / ";
    eff_["Control"][folderID[iFolder]]        =new eff("Control", cutPtEta, mBinsControl, binsControl_, title, yLo, yHi, -9999.,-9999.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/3rd Jet p_{T} [GeV]/ ";
//     eff_["pt3-3jets"][folderID[iFolder]]             =new eff("pt3", "n==3", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/3rd Jet p_{T} [GeV]/ ";
//     eff_["pt3-4jets"][folderID[iFolder]]             =new eff("pt3", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet p_{T} [GeV]/ ";
//     eff_["pt4-4jets"][folderID[iFolder]]             =new eff("pt4", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/3rd Jet p_{T} [GeV]/ ";
//     eff_["pt3-5jets"][folderID[iFolder]]             =new eff("pt3", "n==5", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/4th Jet p_{T} [GeV]/ ";
//     eff_["pt4-5jets"][folderID[iFolder]]             =new eff("pt4", "n==5", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/5th Jet p_{T} [GeV]/ ";
//     eff_["pt5-5jets"][folderID[iFolder]]             =new eff("pt5", "n==5", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
    
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/3rd Jet p_{T} [GeV]/ ";
    eff_["pt3-3jets"][folderID[iFolder]]             =new eff("pt3", "n==3", mBinsJetPt, binsJetPt_, title, yLo3, yHi3, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet p_{T} [GeV]/ ";
    eff_["pt4-4jets"][folderID[iFolder]]             =new eff("pt4", "n==4", mBinsJetPt, binsJetPt4_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}>=4/4th Jet p_{T} [GeV]/ ";
    eff_["pt4-geq4jets"][folderID[iFolder]]             =new eff("pt4", "n>=4", mBinsJetPt, binsJetPt4_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/5th Jet p_{T} [GeV]/ ";
    eff_["pt5-5jets"][folderID[iFolder]]             =new eff("pt5", "n==5", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/3rd Jet #eta/ ";
    eff_["eta3-3jets"][folderID[iFolder]]             =new eff("eta3", "n==3", mBinsJetEta, binsJetEta_, title, yLo3, yHi3, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet #eta/ ";
    eff_["eta4-4jets"][folderID[iFolder]]             =new eff("eta4", "n==4", mBinsJetEta, binsJetEta_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}>=4/4th Jet #eta/ ";
    eff_["eta4-geq4jets"][folderID[iFolder]]             =new eff("eta4", "n>=4", mBinsJetEta, binsJetEta_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/5th Jet #eta/ ";
    eff_["eta5-5jets"][folderID[iFolder]]             =new eff("eta5", "n==5", mBinsJetEta, binsJetEta_, title, yLo, yHi, 30.,120.);
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/3rd Jet #eta (p_{T}<40 GeV)/ ";
    eff_["eta3-3jets-ptl40"][folderID[iFolder]]             =new eff("eta3", "n==3 && pt3 < 40", mBinsJetEta, binsJetEta_, title, yLo3, yHi3, -2.4,2.4);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet #eta (p_{T}<40 GeV)/ ";
    eff_["eta4-4jets-ptl40"][folderID[iFolder]]             =new eff("eta4", "n==4 && pt4 < 40", mBinsJetEta, binsJetEta_, title, yLo, yHi, -2.4,2.4);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}>=4/4th Jet #eta (p_{T}<40 GeV)/ ";
    eff_["eta4-geq4jets-ptl40"][folderID[iFolder]]             =new eff("eta4", "n>=4 && pt4 < 40", mBinsJetEta, binsJetEta_, title, yLo, yHi, -2.4,2.4);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/5th Jet #eta (p_{T}<40 GeV)/ ";
    eff_["eta5-5jets-ptl40"][folderID[iFolder]]             =new eff("eta5", "n==5 && pt5 < 40", mBinsJetEta, binsJetEta_, title, yLo, yHi, -2.4,2.4);
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet |#eta| (p_{T}<40 GeV)/ ";
    eff_["absEta4-4jets-ptl40"][folderID[iFolder]]             =new eff("TMath::Abs(eta4)", "n==4 && pt4 < 40", mBinsJetAbsEta, binsJetAbsEta_, title, yLo, yHi);
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/1st Jet p_{T} [GeV]/ ";
    eff_["pt1-3jets"][folderID[iFolder]]             =new eff("pt1", "n==3", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.,true);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/2nd Jet p_{T} [GeV]/ ";
    eff_["pt2-3jets"][folderID[iFolder]]             =new eff("pt2", "n==3", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3/3rd Jet p_{T} [GeV]/ ";
//     eff_["pt4-geq4jets"][folderID[iFolder]]             =new eff("pt3", "n==3", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/1st Jet p_{T} [GeV]/ ";
    eff_["pt1-4jets"][folderID[iFolder]]             =new eff("pt1", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/2nd Jet p_{T} [GeV]/ ";
    eff_["pt2-4jets"][folderID[iFolder]]             =new eff("pt2", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/3rd Jet p_{T} [GeV]/ ";
    eff_["pt3-4jets"][folderID[iFolder]]             =new eff("pt3", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
//     title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/4th Jet p_{T} [GeV]/ ";
//     eff_["pt5-5jets"][folderID[iFolder]]             =new eff("pt4", "n==4", mBinsJetPt, binsJetPt_, title, yLo, yHi, 30.,120.);
    
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=3 /pv / ";
    eff_["pv-3jets"][folderID[iFolder]]             =new eff("pv", "n==3", mBinsPVMult, binsPVMult_, title, yLo, yHi, 0.,20.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=4/ pv / ";
    eff_["pv-4jets"][folderID[iFolder]]             =new eff("pv", "n==4", mBinsPVMult, binsPVMult_, title, yLo, yHi, 0.,20.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}>=4/ pv / ";
    eff_["pv-geq4jets"][folderID[iFolder]]             =new eff("pv", "n>=4", mBinsPVMult, binsPVMult_, title, yLo, yHi, 0.,20.);
    title = foldersTitle[iFolder]+" Efficiency, N_{Jet}=5/ pv / ";
    eff_["pv-5jets"][folderID[iFolder]]             =new eff("pv", "n==5", mBinsPVMult, binsPVMult_, title, yLo, yHi, 0.,20.);
  }

  /// ---
  /// get efficiencies from tree or histo
  ///  ---
  for(int iMethod=0; iMethod<mIDNum; iMethod++){
    for(int iEff=0; iEff<effIDNum; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	getEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_[mID[iMethod]], mID[iMethod], folderIDrefTriggerPass, folderIDrefTriggerAll);
      }
    }
  }
  /// combine efficiencies (e.g. ttbar and W) with equal weights
  if(averageMIDdestination !="" && averageMID1 != "" && averageMID2 !=""){
    for(int iEff=0; iEff<effIDNum; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	averageEfficiencies(eff_[effID[iEff]][folderID[iFolder]], averageMIDdestination, averageMID1, averageMID2, 0.5, 0.5);
      }
    }
  }
  if(averageMIDdestination_2 !="" && averageMID1_2 != "" && averageMID2_2 !=""){
    for(int iEff=0; iEff<effIDNum; iEff++){
      for(int iFolder=0; iFolder<folderNum; iFolder++){
	averageEfficiencies(eff_[effID[iEff]][folderID[iFolder]], averageMIDdestination_2, averageMID1_2, averageMID2_2, 0.5, 0.5);
      }
    }
  }

 /// Draw one Canvas for each folder comparing different methods.
 /// Each canvas shows test (1st row) and probe collection (2nd) and efficiency (3rd) for different variables (columns)
 TCanvas* CanvComp [folderNum];
 TCanvas* CanvSFComp [folderNum];
 TCanvas* CanvEvtsComp [folderNum];
 TCanvas* CanvEvtsNormComp [folderNum];
 TCanvas* CanvLeg = new TCanvas("CanvLeg", "CanvLeg", 350,300);

 std::cout<< "Drawing eff. and SF"<<std::endl;
for(int iFolder=0; iFolder<folderNum; iFolder++) {

  CanvComp[iFolder] = new TCanvas("Comparison"+folderID[iFolder], "Comparison"+folderID[iFolder], 1700,1000);
  CanvSFComp[iFolder] = new TCanvas("ComparisonSF"+folderID[iFolder], "ComparisonSF"+folderID[iFolder], 1700,1000);
  CanvEvtsComp[iFolder] = new TCanvas("ComparisonEvts"+folderID[iFolder], "ComparisonEvts"+folderID[iFolder], 1700,1000);
  CanvEvtsNormComp[iFolder] = new TCanvas("ComparisonEvtsNorm"+folderID[iFolder], "ComparisonEvtsNorm"+folderID[iFolder], 1700,1000);
  
  CanvComp[iFolder]->Divide(4,2);
  CanvSFComp[iFolder]->Divide(4,2);
  CanvEvtsComp[iFolder]->Divide(4,2);
  CanvEvtsNormComp[iFolder]->Divide(4,2);
  
  for(int iEff=0; iEff<effIDNum; iEff++){
    CanvComp[iFolder]->cd(iEff+1);
    std::cout<< "Drawing eff."<<std::endl;
    drawEfficiencies(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
    CanvSFComp[iFolder]->cd(iEff+1);
    std::cout<< "Drawing SF"<<std::endl;
    drawSF          (eff_[effID[iEff]][folderID[iFolder]], method_, mID, mIDnorm, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend, yLoSF, yHiSF, eff_[effID[iEff]][folderID[iFolder]]->xLo, eff_[effID[iEff]][folderID[iFolder]]->xHi);
    // if desired plot also raw event number histos
    if(onlyEffPlots!=1) {
      std::cout<< "Drawing event numbers"<<std::endl;
      CanvEvtsComp[iFolder]->cd(iEff+1);
      drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend);
      CanvEvtsNormComp[iFolder]->cd(iEff+1);
      drawEventHistos(eff_[effID[iEff]][folderID[iFolder]], method_, mID, 0.15,0.15,0.9,0.45,eff_[effID[iEff]][folderID[iFolder]]->drawLegend,"normInt");
    }
  }
  // draw legend
  CanvLeg->cd();
  if(iFolder==0) drawLegend(eff_[effID[0]][folderID[0]], method_, mID, 0.,0.,1.,1.);
  
//   effControl[iMethod][iFolder]->GetXaxis()->SetNdivisions(0);
//   effRelIso[iMethod][iFolder]->GetXaxis()->SetNdivisions(505);
 
 if(save){
   for(unsigned int iFileFormat=0; iFileFormat < fileFormat.size(); iFileFormat++){
    CanvComp[iFolder]->Print(outputFolder+outputFileName+folderID[iFolder]+"_overview."+fileFormat[iFileFormat]);
    for(int iEff=0; iEff<effIDNum; iEff++){
      CanvComp  [iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_"+effID[iEff]+"."+fileFormat[iFileFormat]);
      CanvSFComp[iFolder]->cd(iEff+1)->Print(outputFolder+outputFileName+folderID[iFolder]+"_SF_"+effID[iEff]+"."+fileFormat[iFileFormat]);
    }
    if(iFolder==0) CanvLeg->Print(outputFolder+outputFileName+"_Legend."+fileFormat[iFileFormat]);
    std::cout<<"Canvas with plots is saved in "<<outputFolder<<std::endl;
   }
  }
  
  /// save graph in root file
//   TFile f("JetLegTriggerEfficiencyIsoLepTriJetJetMult4.root", "recreate");
//   eff_["absEta4-4jets-ptl40"][""]->graphSF["m2allMu"]->SetName("JetLegTriggerEfficiencyIsoLepTriJetJetMult4");
//       //eff_["Eta"]["tapAll"]->graphSF["m2"]->SetTitle("tapAllSFeta");
//   eff_["absEta4-4jets-ptl40"][""]->graphSF["m2allMu"]->Write();
//   std::cout<<"JetLegTriggerEfficiencyIsoLepTriJetJetMult4.root with TGraphErrors is saved."<<std::endl;
  
 }
}