Example #1
0
void surfaces() {
   //Draw 2-Dim functions
   // To see the output of this macro, click begin_html <a href="gif/surfaces.gif">here</a> end_html
   //Author: Rene Brun
   
   TCanvas *c1 = new TCanvas("c1","Surfaces Drawing Options",200,10,700,900);
   c1->SetFillColor(42);
   gStyle->SetFrameFillColor(42);
   TPaveText *title = new TPaveText(.2,0.96,.8,.995);
   title->SetFillColor(33);
   title->AddText("Examples of Surface options");
   title->Draw();

   TPad *pad1 = new TPad("pad1","Gouraud shading",0.03,0.50,0.98,0.95,21);
   TPad *pad2 = new TPad("pad2","Color mesh",0.03,0.02,0.98,0.48,21);
   pad1->Draw();
   pad2->Draw();
   //
   // We generate a 2-D function
   TF2 *f2 = new TF2("f2","x**2 + y**2 - x**3 -8*x*y**4",-1,1.2,-1.5,1.5);
   f2->SetContour(48);
   f2->SetFillColor(45);

   // Draw this function in pad1 with Gouraud shading option
   pad1->cd();
   pad1->SetPhi(-80);
   pad1->SetLogz();
   f2->Draw("surf4");

   // Draw this function in pad2 with color mesh option
   pad2->cd();
   pad2->SetTheta(25);
   pad2->SetPhi(-110);
   pad2->SetLogz();
   f2->SetLineWidth(1);
   f2->SetLineColor(5);
   f2->Draw("surf1");
   
   //add axis titles. The titles are set on the intermediate
   //histogram used for visualisation. We must force this histogram
   //to be created, then force the redrawing of the two pads
   pad2->Update();
   f2->GetHistogram()->GetXaxis()->SetTitle("x title");
   f2->GetHistogram()->GetYaxis()->SetTitle("y title");
   f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
   f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
   pad1->Modified();
   pad2->Modified();
}
Example #2
0
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
	
	
	TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
	OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]");
	OBPCanvas->SetFillColor(0);
	OBPCanvas->SetFrameBorderMode(0);
	
	TFrame* aFrame = OBPCanvas->GetFrame();
	aFrame->SetFillColor(0);
	
	int passcut = 0;
	for(int entry = 0;entry<data->GetEntries(); entry++)
    {
		data->GetEntry(entry);
			if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){
			if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){
				TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">");
				aArraw->Draw();
				passcut++;
			}
		}
	}
	DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );
	
	char sliceLeg[192]; 
	sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
	//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
	TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
	atext->AddText(sliceLeg);
	atext->SetLineColor(0);
	atext->SetFillColor(0);
	atext->SetTextFont(42);
	atext->SetTextSize(0.04);
	atext->Draw();
	
	
	
	char outfile[192];
	sprintf( outfile, "%s/%s.png", outputDir_, name );
	OBPCanvas->Print( outfile );
	
	return passcut;
}
Example #3
0
TPaveText* getHeader(double lumi, TString channelName)
{
  TPaveText* pt = new TPaveText(0.18,0.75,0.18,0.88,"brNDC");

  pt->SetBorderSize(1);
  pt->SetTextFont(42);
  pt->SetTextSize(0.04);
  pt->SetLineColor(0);
  pt->SetLineStyle(1);
  pt->SetLineWidth(1);
  pt->SetFillColor(0);
  pt->SetFillStyle(1001);
  pt->SetTextAlign(12);
  pt->AddText("CMS Preliminary");
  pt->AddText(Form("%.1f fb^{-1} at  #sqrt{s} = 7 TeV", lumi));
  if ( channelName != "" ) pt->AddText(channelName);

  return pt;
}
Example #4
0
void tpcdraw(Int_t sec, Int_t row, Int_t pad)
{
   gStyle->SetOptStat(0); 
  //calculate occupancy for selected sector and pad row 
  //for selected pad is obtained signal shape 
  Double_t par[3];
  gtpc.SetSecRowTime(sec,row);
  gtpc.SetHisto(pad);
  gtpc.Draw("box");  
  //plot histograms with specified options
  //move pads to another position be possible add text
  gtpc.GetPad1().SetPad(0.05,0.72,0.95,0.95);
  gtpc.GetPad2().SetPad(0.05,0.47,0.95,0.70); 
  gtpc.GetPad3().SetPad(0.05,0.22,0.95,0.45);  
  //fit histogram of occupancy on specified range <150,500> 
  gtpc.GetPad2().cd();
  g1 = new TF1("pol0_r","pol0",150,500); 
  gtpc.GetHis3()->Fit("pol0_r","R0Q");    
  g1->GetParameters(&par[0]);
  Float_t error = g1->GetParError(0);
  fitText = new TPaveText(0.15,0.7,0.3,0.9,"NDC");
  fitText->AddText("p0 fit on interval <150-500>");
  char s[100];
  sprintf(s,"%0.3f+- %0.3f",par[0],error);
  fitText->AddText(s);
  fitText->Draw();
  gtpc.GetPad2().Update();     
  //set logarithmic 
  gtpc.GetPad3().cd();
  gtpc.GetPad3().SetLogy();  
   gtpc.GetPad3().Draw();    
  //add comments to the histograms 
  gtpc.GetCanvas().cd();
  TPaveText * comment = new TPaveText(0.05,0.03,0.95,0.2,"NDC");
  comment->SetTextAlign(12);
  comment->SetFillColor(42);
  comment->ReadFile("comment.txt");
  comment->Draw();
  gtpc.GetCanvas().Update();
  

}
Example #5
0
TCanvas *hlabels2()
{
   const Int_t nx = 12;
   const Int_t ny = 20;
   const char *month[nx]  = {"January","February","March","April","May",
      "June","July","August","September","October","November",
      "December"};
   const char *people[ny] = {"Jean","Pierre","Marie","Odile","Sebastien",
      "Fons","Rene","Nicolas","Xavier","Greg","Bjarne","Anton",
      "Otto","Eddy","Peter","Pasha","Philippe","Suzanne","Jeff",
      "Valery"};
   TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,600,600);
   c1->SetGrid();
   c1->SetLeftMargin(0.15);
   c1->SetBottomMargin(0.15);
   TH2F *h = new TH2F("h","test",3,0,3,2,0,2);
   h->SetCanExtend(TH1::kAllAxes);
   h->SetStats(0);
   gRandom->SetSeed();
   for (Int_t i=0;i<15000;i++) {
      Int_t rx = gRandom->Rndm()*nx;
      Int_t ry = gRandom->Rndm()*ny;
      h->Fill(people[ry],month[rx],1);
   }
   h->LabelsDeflate("X");
   h->LabelsDeflate("Y");
   h->LabelsOption("v");
   h->Draw("text");

   TPaveText *pt = new TPaveText(0.6,0.85,0.98,0.98,"brNDC");
   pt->SetFillColor(18);
   pt->SetTextAlign(12);
   pt->AddText("Use the axis Context Menu LabelsOption");
   pt->AddText(" \"a\"   to sort by alphabetic order");
   pt->AddText(" \">\"   to sort by decreasing values");
   pt->AddText(" \"<\"   to sort by increasing values");
   pt->Draw();
   return c1;
}
Example #6
0
ExampleSingleRoll(){
   TGraph* mg2 = GetSinglePlotRateVsLumiSingleRoll(
    corr = false,
    Area_ = "EndCap", 
    Wheel_ = "+3", 
    Sector_ = "2", 
    Number_ = "22", 
    Letter_ = "F", 
    Year_ = "2011", 
    Corr_ = "UnCorrected", 
    PlotName_ = "RateVsLumi_", 
    RunNumber_ = 180252, 
    PartNo_ = "1",
	kBlue, 20
  );
  mg2->Draw("AP");
  gStyle->SetOptFit(0000);  
  string RollName=  GetRollName("RE+3_2_22", "1");
  TPaveText* text = new TPaveText(0.2, 0.7, 0.4, 0.8, "NDC");
  text->SetFillColor(0);
  text->AddText(RollName.c_str());
  text->Draw("same");
}
void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//=========  (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
   TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
   Can_result_0->SetFillColor(0);
   Can_result_0->SetBorderMode(0);
   Can_result_0->SetBorderSize(2);
   Can_result_0->SetFrameBorderMode(0);
   Can_result_0->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JES_akPu4PF");
   
   Double_t Graph_fx1001[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1001[4] = {
   1.025461,
   0.982262,
   0.9644553,
   0.970611};
   Double_t Graph_fex1001[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1001[4] = {
   0.001598024,
   0.0009318739,
   0.0008002418,
   0.0004502591};
   TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
   Graph_Graph1001->SetMinimum(0.9573146);
   Graph_Graph1001->SetMaximum(1.0334);
   Graph_Graph1001->SetDirectory(0);
   Graph_Graph1001->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1001->SetLineColor(ci);
   Graph_Graph1001->GetXaxis()->SetLabelFont(42);
   Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1001);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1002[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1002[4] = {
   1.025808,
   0.9823451,
   0.964104,
   0.9707841};
   Double_t Graph_fex1002[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1002[4] = {
   0.001641175,
   0.0009556419,
   0.0008206184,
   0.000461058};
   gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
   gre->SetName("Graph");
   gre->SetTitle("some title_1");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
   Graph_Graph1002->SetMinimum(0.9568668);
   Graph_Graph1002->SetMaximum(1.033866);
   Graph_Graph1002->SetDirectory(0);
   Graph_Graph1002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1002->SetLineColor(ci);
   Graph_Graph1002->GetXaxis()->SetLabelFont(42);
   Graph_Graph1002->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1002);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1003[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1003[4] = {
   0.9944711,
   0.9453074,
   0.9619222,
   0.9556338};
   Double_t Graph_fex1003[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1003[4] = {
   0.01053149,
   0.005298861,
   0.004412705,
   0.002663901};
   gre = new TGraphErrors(4,Graph_fx1003,Graph_fy1003,Graph_fex1003,Graph_fey1003);
   gre->SetName("Graph");
   gre->SetTitle("some title_2");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(3);
   gre->SetMarkerColor(3);
   
   TH1F *Graph_Graph1003 = new TH1F("Graph_Graph1003","some title_2",100,0,110);
   Graph_Graph1003->SetMinimum(0.9335092);
   Graph_Graph1003->SetMaximum(1.011502);
   Graph_Graph1003->SetDirectory(0);
   Graph_Graph1003->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1003->SetLineColor(ci);
   Graph_Graph1003->GetXaxis()->SetLabelFont(42);
   Graph_Graph1003->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1003);
   
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("Centrality");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#mu_{Reco./Gen.}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","lightJets","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","bJets","l");
   entry->SetLineColor(3);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.25,0.7,"#bf{#color[2]{|#eta_{jet}|<2.0 &75<refpt<120}}");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(24);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TPaveText *pt = new TPaveText(0.3750575,0.9365254,0.6249425,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("JES_akPu4PF");
   pt->Draw();
   Can_result_0->Modified();
   Can_result_0->cd();
   Can_result_0->SetSelected(Can_result_0);
}
void plot_Significance(bool unblind, char* scenario){


  gROOT->ProcessLine(".x tdrstyle.cc");
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadTopMargin(0.05);
 
  gStyle->SetNdivisions(605, "XYZ");
  gROOT->LoadMacro("CMS_lumi.C");


  //take tree with exp significance for all masses
  char fnam[50];
  sprintf(fnam, "higgsCombine%sExpSignif.ProfileLikelihood.TOTAL.root", scenario);
  TFile *fexp=new TFile(fnam,"READ");
  TTree *texp=(TTree*)fexp->Get("limit");

  //take tree with obs significance for all masses
  char fnam[50];
  sprintf(fnam, "higgsCombine%sObsSignif.ProfileLikelihood.TOTAL.root", scenario);
  TFile *fobs=new TFile(fnam,"READ");
  TTree *tobs=(TTree*)fobs->Get("limit");

  double expS,expM;
  texp->SetBranchAddress("limit",&expS);
  texp->SetBranchAddress("mh",&expM);

  double obsS,obsM;
  tobs->SetBranchAddress("limit",&obsS);
  tobs->SetBranchAddress("mh",&obsM);

  const int N=max(texp->GetEntries(),tobs->GetEntries());
  if(N!=tobs->GetEntries()){
    cout<<"ERROR from plot_Significance !!! Mismatch in number of masses present in exp and obs significance trees. ExpTree: "<<N<<" entries, ObsTree: "<<tobs->GetEntries()<<" entries"<<endl;
    //return;
  }

  double arrM[100],arrExp[100],arrObs[100];


  //1st loop on tree for preparing mH ordered list
  vector<double> v_mhTMP;
  for(int i=0;i<texp->GetEntries();i++){
    texp->GetEntry(i);
    v_mhTMP.push_back(expM);   
  }
  std::sort(v_mhTMP.begin(),v_mhTMP.end());
 
  int nMH=v_mhTMP.size();
  int iMH=0;

  // while(iMH<nMH){
  // cout<<"Check order: "<<iMH<<" -> "<<v_mhTMP.at(iMH)<<endl;
  //iMH++;
  // }
 iMH=0;
  while(iMH<nMH){
    double mhTMP=v_mhTMP.at(iMH);
    cout<<"Check "<<mhTMP<<endl;
    for(int i=0;i<N;i++){
      texp->GetEntry(i);
      if(expM!=mhTMP)continue;//follow exactly the order of v_mhTMP
      if(expS<1e-06)expS=1e-99;
      arrM[iMH]=expM/1000.;
      arrExp[iMH]=expS;
      //  cout<<"M="<<expM<<"   ExpSig="<<expS<<endl;
    }
    iMH++;
  }

  iMH=0;
  while(iMH<nMH){
    double mhTMP=v_mhTMP.at(iMH);
   
    for(int i=0;i<N;i++){
      tobs->GetEntry(i);
      if(obsM!=mhTMP)continue;//follow exactly the order of v_mhTMP
      arrObs[iMH]=obsS;
    }
    iMH++;
  }

  for(int i=0;i<N;i++){
    cout<<"M="<<arrM[i]<<"   ExpSig="<<arrExp[i]<<flush;
    if(unblind)cout<<"   ObsSig="<<arrObs[i] <<endl;
    else cout<<endl;
  }

  arrM[N]=arrM[N-1];
  arrExp[N]=arrExp[N-1];
  arrObs[N]=arrObs[N-1];

  TGraph *grExp=new TGraph(N+1,arrM,arrExp);
  TGraph *grObs=new TGraph(N+1,arrM,arrObs);
  grExp->SetMarkerStyle(7);
  grObs->SetMarkerStyle(20);
  grExp->SetLineStyle(kDashed);
  grObs->SetLineStyle(kSolid);
  grExp->SetTitle("");

  TLegend *l=new TLegend(0.50,0.15,0.89,0.38);
  l->SetTextSize(0.025);
  l->AddEntry(grExp,"Expected Significance","L");
  if(unblind)l->AddEntry(grObs,"Observed Significance","LP");
  l->SetFillColor(kWhite);

  TCanvas *cS=new TCanvas("canSig","Significance EXO-VV",800,700);
  cS->cd();

  double fr_left=0.750, fr_down=1e-06,fr_right=4.050,fr_up=0.6;
  grExp->GetXaxis()->SetTitle("M_{G_{Bulk}} (TeV)");
  grExp->GetYaxis()->SetTitle("p-value");// #rightarrow 2l2q
  grExp->GetYaxis()->SetTitleOffset(1.6);

  grExp->SetLineWidth(3.0);
  grExp->Draw("AL");
  grObs->SetLineWidth(3.0);
  if(unblind)  grObs->Draw("LP");
  grExp->GetXaxis()->SetRangeUser(fr_left,fr_right);
  grExp->GetYaxis()->SetRangeUser(fr_down,fr_up);
  cS->SetGrid();
  gPad->SetLogy();
  l->Draw();
  // gPad->RedrawAxis("");
  const double quant1sigma=1.58655253931457074e-01;
  const double quant2sigma=2.27501319481792155e-02;
  const double quant3sigma=1.34989803163009588e-03;
  const double quant4sigma=3.16712418331199785e-05;

   TLine *l1=new TLine();
  l1->SetLineStyle(2);
  l1->SetLineWidth(3.0);
  l1->SetLineColor(kRed);
  l1->DrawLine(0.8,quant1sigma,4.0,quant1sigma);
  TLine *l2=new TLine();
  l2->SetLineStyle(2);
  l2->SetLineWidth(3.0);
  l2->SetLineColor(kRed);
  l2->DrawLine(0.8,quant2sigma,4.0,quant2sigma);
  TLine *l3=new TLine();
  l3->SetLineStyle(2);
  l3->SetLineWidth(3.0);
  l3->SetLineColor(kRed);
  l3->DrawLine(0.8,quant3sigma,4.0,quant3sigma);
  TLine *l4=new TLine();
  l4->SetLineStyle(2);
  l4->SetLineWidth(3.0);
  l4->SetLineColor(kRed);
  l4->DrawLine(0.8,quant4sigma,4.0,quant4sigma);


  TPaveText* cmslabel = new TPaveText( 0.145, 0.953, 0.6, 0.975, "brNDC");
   cmslabel->SetFillColor(kWhite);
   cmslabel->SetTextSize(0.038);
   cmslabel->SetTextAlign(11);
   cmslabel->SetTextFont(62);
   cmslabel->SetBorderSize(0);
   //   std::string leftText = "CMS Preliminary 2011";
   std::string leftText = "CMS";
   std::string units = "fb ^{-1}";
   char lumiText[300];
   sprintf( lumiText, "%.1f %s", intLumi, units.c_str());
   cmslabel->AddText(Form("%s,  #sqrt{s} = 8 TeV, %s", leftText.c_str(), lumiText));
   //cmslabel->Draw();

   TPaveText* label_sqrt = new TPaveText(0.4,0.953,0.96,0.975, "brNDC");
   label_sqrt->SetFillColor(kWhite);
   label_sqrt->SetBorderSize(0);
   label_sqrt->SetTextSize(0.038);
   label_sqrt->SetTextFont(62);   
   label_sqrt->SetTextAlign(31); // align right
   // label_sqrt->AddText("#sqrt{s} = 7 TeV");
   label_sqrt->AddText(Form("%s", leftText.c_str(), lumiText));
   //label_sqrt->Draw();

   if(scenario=="JAM813TeV")
     CMS_lumi( cS, 5, 0 );
   else
     CMS_lumi( cS, 4, 0 );

   char fnam[50];
   sprintf(fnam, "EXOVVbulk_%s_Significance.root", scenario);
   cS->SaveAs(fnam);
   sprintf(fnam, "EXOVVbulk_%s_Significance.eps", scenario);
   cS->SaveAs(fnam);
   sprintf(fnam, "EXOVVbulk_%s_Significance.png", scenario);
   cS->SaveAs(fnam);
   sprintf(fnam, "EXOVVbulk_%s_Significance.pdf", scenario);
   cS->SaveAs(fnam);
}
Example #9
0
void drawLaser(TString infile="laser_3fibers1M_sig15_inc4.root"){
//void drawLaser(TString infile="../build/laser_monbars.root"){
  if(infile=="") return;
	const Int_t Nfibers = 3;

  TFile* output = new TFile("lasertime.root", "RECREATE");	

  const int nmcp = 70, npix = 64;
  TH1F * hPTime[nmcp][npix];
  TH1F * hTime = new TH1F("time",";time, [ns];entries, [#]",500,0,150);
  for(Int_t m=0; m<nmcp; m++){
    for(Int_t p=0; p<npix; p++){
      hPTime[m][p]  = new TH1F(Form("hPTime_%d",m*100+p),Form("mcp %d, pixel %d",m, p),400,0,25);//200); //800,1800
      axisTime800x500(hPTime[m][p]);
	 // gStyle->SetOptTitle(0);
      hPTime[m][p]->SetStats(1);
      hPTime[m][p]->SetLineColor(1);
		hPTime[m][p]->SetLineWidth(3);
    }
  }

  gSystem->Load("../build/libGlxDirc.so");
  TFile* f = new TFile(infile);
  TTree* t = (TTree*)f->Get("glxlut");
  TClonesArray *fLut[Nfibers];
  for(int ifib=0;ifib<Nfibers;ifib++){
  fLut[ifib] = new TClonesArray("GlxLutNode");
  //t->SetBranchAddress("LUT_0", &fLut);
  t->SetBranchAddress(Form("LUT_%d",ifib),&fLut[ifib]);
  }
  t->GetEntry(0);

  Double_t evtime;	
  GlxLutNode* node;
  Int_t mcpid, pixid;
  for(int i=0; i<20000; i++){
	  for(int jfib=0;jfib<Nfibers;jfib++){
		node = (GlxLutNode*) fLut[jfib]->At(i);
		Int_t size = node->Entries();
		if(size > 0){
		// cout<<"node "<<node->GetDetectorId()<<" has "<<size<<" entries, mcp = "<<i/100<<", pix = "<<i%100<<endl;
			mcpid = i/100;
			pixid = i%100-1;
  			for(int u=0; u<size; u++){
				evtime = node->GetTime(u);
				hPTime[mcpid][pixid]->Fill(evtime);
			}
		}
	 } 
  }
  output->Write();

	gStyle->SetOptStat("e");
  gStyle->SetOptFit(0001);
	SetRootPalette(1);

	//TCanvas* big = new TCanvas("big","big", 1400, 500);
	//big->Divide(14,5);
	TH2F * hPMToc[nmcp];
	for(int ipad=0;ipad<nmcp;ipad++){
	  hPMToc[ipad]  = new TH2F(Form("hPMToc_%d",ipad),Form("PMT %d",ipad),8,0,8,8,0,8); 
	  hPMToc[ipad]->SetStats(0);
	  //big->cd(ipad);
	  //gPad->SetBottomMargin(0.001);
	  //gPad->SetLeftMargin(0.001);
	  //gPad->SetRightMargin(0.001);
	  //gPad->SetTopMargin(0.001);
	  //gPad->SetFrameBorderSize(0.01);
	}	
	
  TCanvas* c = new TCanvas("c","c",800,600);
  TF1* fit = new TF1("fit","gaus(0)",0.,10.);
	
	TPaveText* tit; 
	gStyle->SetOptFit(0001);
	//gStyle->SetOptStat(1111111);
	Double_t y1,y2,prob;
  for(Int_t m=0; m<nmcp; m++){
    for(Int_t p=0; p<npix; p++){
	  hPMToc[m]->SetBinContent(p%8+1, 8-p/8, hPTime[m][p]->GetEntries());
	 // cout<<"bin "<<p+1<<" filled with "<< hPTime[m][p]->GetEntries()<<endl;
	  if(hPTime[m][p]->GetEntries() > 10){
	    c->Update();
		fit->SetParameter(1,2.5);
		fit->SetParameter(2,0.3);
		fit->SetParameter(0,200.); 
		//hPTime[m][p]->Fit("fit","R","",0.,7.);	  
	    //hPTime[m][p]->Fit("fit","M","",0.,7.);
		//hPTime[m][p]->Fit("fit","MW","",0.,7.);  
		//cout<<"maximum - "<<hPTime[m][p]->GetMaximum()<<endl;
		y1 = hPTime[m][p]->GetMaximum()/2.;
		y2 = hPTime[m][p]->GetMaximum()/3.*2.;
		prob = hPTime[m][p]->GetEntries()/1000000.;
		tit = new TPaveText(17.0,y1,25.,y2,"NB");
		tit->SetFillColor(0);
		tit->AddText(Form("prob = %f", prob));
		hPTime[m][p]->Draw();
		tit->Draw();
		c->Update();
        c->SaveAs(Form("pixels_3fibers_sig15_inc4/%d.png", m*100+p));
	  }
    }
  }
  cout<<"loop is over"<<endl;
  TCanvas* coc = new TCanvas("coc","coc", 500, 500);
	coc->SetRightMargin(0.1);
	coc->SetTopMargin(0.1);
	coc->SetLeftMargin(0.05);
	coc->SetBottomMargin(0.05);
  coc->cd();
  for(Int_t iii=0; iii<nmcp; iii++){
	  //cout<<"iii = "<<iii<<endl;
	  coc->Update();
	  hPMToc[iii]->SetMaximum(900.);
	  hPMToc[iii]->SetMinimum(0.);
	  hPMToc[iii]->Draw("colz");
	  coc->SaveAs(Form("pmt_3fibers_sig15_inc4/pmt%d.png", iii));
  }
  
}
Example #10
0
void CreateBkgTemplates(float XMIN, float XMAX, TString OUTPATH, bool MERGE)
{
  gROOT->ProcessLineSync(".x ../common/styleCMSTDR.C");
  gROOT->ForceStyle();
  RooMsgService::instance().setSilentMode(kTRUE);
  for(int i=0;i<2;i++) {
    RooMsgService::instance().setStreamStatus(i,kFALSE);
  }
  const int NSEL(2);
  if (!MERGE) {const int NCAT[NSEL] = {4,3};}
  else {const int NCAT[NSEL] = {4,2};}
  if (!MERGE) {const double MVA_BND[NSEL][NCAT[0]+1] = {{-0.6,0.0,0.7,0.84,1},{-0.1,0.4,0.8,1}};}
  else {const double MVA_BND[NSEL][NCAT[0]+1] = {{-0.6,0.0,0.7,0.84,1},{-0.1,0.4,1}};}
  float LUMI[2] = {19784,18281};
  TString SELECTION[2] = {"NOM","VBF"};
  TString SELNAME[2] = {"NOM","PRK"};
  TString MASS_VAR[2] = {"mbbReg[1]","mbbReg[2]"};
  TString TRIG_WT[2] = {"trigWtNOM[1]","trigWtVBF"};
  TString PATH("flat/");
  TFile *inf[9];
  TTree *tr;
  TH1F *hMbb[9],*hMbbYield[9],*hPass;
  TH1F *hZ,*hW,*hTT,*hST,*hTop;
  TH1F *hZYield,*hWYield,*hTTYield,*hSTYield,*hTopYield;
  char name[1000];
  float LUMI;
  float XSEC[9] = {56.4,11.1,3.79,30.7,11.1,1.76,245.8,650,1.2*1205};
  RooDataHist *roohist_Z[5],*roohist_T[5];
  RooRealVar *kJES[10],*kJER[10];
  RooWorkspace *w = new RooWorkspace("w","workspace");
  
  TString tMERGE = MERGE ? "_CATmerge56" : "";
  
  //RooRealVar x("mbbReg","mbbReg",XMIN,XMAX);
  int counter(0);
  for(int isel=0;isel<NSEL;isel++) {
    inf[0] = TFile::Open(PATH+"Fit_T_t-channel_sel"+SELECTION[isel]+".root");
    inf[1] = TFile::Open(PATH+"Fit_T_tW-channel_sel"+SELECTION[isel]+".root");
    inf[2] = TFile::Open(PATH+"Fit_T_s-channel_sel"+SELECTION[isel]+".root");
    inf[3] = TFile::Open(PATH+"Fit_Tbar_t-channel_sel"+SELECTION[isel]+".root");
    inf[4] = TFile::Open(PATH+"Fit_Tbar_tW-channel_sel"+SELECTION[isel]+".root");
    inf[5] = TFile::Open(PATH+"Fit_Tbar_s-channel_sel"+SELECTION[isel]+".root");
    inf[6] = TFile::Open(PATH+"Fit_TTJets_sel"+SELECTION[isel]+".root");
    inf[7] = TFile::Open(PATH+"Fit_ZJets_sel"+SELECTION[isel]+".root");
    inf[8] = TFile::Open(PATH+"Fit_WJets_sel"+SELECTION[isel]+".root");
     
    TCanvas *canZ = new TCanvas("canZ_"+SELECTION[isel],"canZ_"+SELECTION[isel],900,600); 
    TCanvas *canT = new TCanvas("canT_"+SELECTION[isel],"canT_"+SELECTION[isel],900,600);  
    canZ->Divide(2,2);
    canT->Divide(2,2);
    TCanvas *can = new TCanvas(); 
    
    sprintf(name,"CMS_vbfbb_scale_mbb_sel%s",SELECTION[isel].Data()); 
    kJES[isel] = new RooRealVar(name,name,1.0);
    sprintf(name,"CMS_vbfbb_res_mbb_sel%s",SELECTION[isel].Data()); 
    kJER[isel] = new RooRealVar(name,name,1.0);
    kJES[isel]->setConstant(kTRUE);
    kJER[isel]->setConstant(kTRUE);
  
    for(int icat=0;icat<NCAT[isel];icat++) {
		if (MERGE && SELECTION[isel]=="VBF" && icat==1) counter = 56;
      /*
      sprintf(name,"CMS_vbfbb_scale_mbb_CAT%d",counter); 
      kJES[counter] = new RooRealVar(name,name,1.0);
      sprintf(name,"CMS_vbbb_res_mbb_CAT%d",counter); 
      kJER[counter] = new RooRealVar(name,name,1.0);
      kJES[counter]->setConstant(kTRUE);
      kJER[counter]->setConstant(kTRUE);
      */ 
      for(int i=0;i<9;i++) {
        hPass = (TH1F*)inf[i]->Get("TriggerPass");
        sprintf(name,"Hbb/events",icat);
        tr = (TTree*)inf[i]->Get(name); 
        sprintf(name,"puWt[0]*%s*(mva%s>%1.2f && mva%s<=%1.2f)",TRIG_WT[isel].Data(),SELECTION[isel].Data(),MVA_BND[isel][icat],SELECTION[isel].Data(),MVA_BND[isel][icat+1]);
        TCut cut(name); 
        int NBINS(20);
        //if (icat > 1 && icat<=2) NBINS = 20; 
        if (icat > 2) NBINS = 12;
        sprintf(name,"hMbb%d_sel%s_CAT%d",i,SELECTION[isel].Data(),icat);
        hMbb[i] = new TH1F(name,name,NBINS,XMIN,XMAX);
        hMbb[i]->Sumw2();
        can->cd();        
        tr->Draw(MASS_VAR[isel]+">>"+hMbb[i]->GetName(),cut);
        sprintf(name,"hMbbYield%d_sel%s_CAT%d",i,SELECTION[isel].Data(),icat);
        hMbbYield[i] = new TH1F(name,name,NBINS,XMIN,XMAX);
        hMbbYield[i]->Sumw2();
        tr->Draw(MASS_VAR[isel]+">>"+hMbbYield[i]->GetName(),cut);
        hMbbYield[i]->Scale(LUMI[isel]*XSEC[i]/hPass->GetBinContent(1)); 
      }
      hZ  = (TH1F*)hMbb[7]->Clone("Z");
      hW  = (TH1F*)hMbb[8]->Clone("W");
      hTT = (TH1F*)hMbb[6]->Clone("TT");
      hST = (TH1F*)hMbb[0]->Clone("ST");
      hST->Add(hMbb[1]);
      hST->Add(hMbb[2]);
      hST->Add(hMbb[3]);
      hST->Add(hMbb[4]);
      hST->Add(hMbb[5]);
      hTop = (TH1F*)hTT->Clone("Top");
      hTop->Add(hST);
      //hZ->Add(hW);
      hZYield  = (TH1F*)hMbbYield[7]->Clone("ZYield");
      hWYield  = (TH1F*)hMbbYield[8]->Clone("WYield");
      hTTYield = (TH1F*)hMbbYield[6]->Clone("TTYield");
      hSTYield = (TH1F*)hMbbYield[0]->Clone("STYield");
      hSTYield->Add(hMbbYield[1]);
      hSTYield->Add(hMbbYield[2]);
      hSTYield->Add(hMbbYield[3]);
      hSTYield->Add(hMbbYield[4]);
      hSTYield->Add(hMbbYield[5]);
      hTopYield = (TH1F*)hTTYield->Clone("TopYield");
      hTopYield->Add(hSTYield);
      hZYield->Add(hWYield); 

      RooRealVar x("mbbReg_"+TString::Format("CAT%d",counter),"mbbReg_"+TString::Format("CAT%d",counter),XMIN,XMAX);

      sprintf(name,"yield_ZJets_CAT%d",counter);
      RooRealVar *YieldZ = new RooRealVar(name,name,hZYield->Integral());
      sprintf(name,"yield_WJets_CAT%d",counter);
      RooRealVar *YieldW = new RooRealVar(name,name,hWYield->Integral());
      sprintf(name,"yield_Top_CAT%d",counter);
      RooRealVar *YieldT = new RooRealVar(name,name,hTopYield->Integral());
      sprintf(name,"yield_TT_CAT%d",counter);
      RooRealVar *YieldTT = new RooRealVar(name,name,hTTYield->Integral());
      sprintf(name,"yield_ST_CAT%d",counter);
      RooRealVar *YieldST = new RooRealVar(name,name,hSTYield->Integral());

      sprintf(name,"roohist_Z_CAT%d",counter);
      roohist_Z[icat] = new RooDataHist(name,name,x,hZ);

      sprintf(name,"Z_mean_CAT%d",counter);
      RooRealVar mZ(name,name,95,80,110);
      sprintf(name,"Z_sigma_CAT%d",counter);
      RooRealVar sZ(name,name,12,9,20);

      sprintf(name,"Z_mean_shifted_CAT%d",counter);
      RooFormulaVar mZShift(name,"@0*@1",RooArgList(mZ,*(kJES[isel])));
      sprintf(name,"Z_sigma_shifted_CAT%d",counter);
      RooFormulaVar sZShift(name,"@0*@1",RooArgList(sZ,*(kJER[isel])));

      sprintf(name,"Z_a_CAT%d",counter);
      RooRealVar aZ(name,name,-1,-10,10);
      sprintf(name,"Z_n_CAT%d",counter);
      RooRealVar nZ(name,name,1,0,10);

      RooRealVar Zb0("Z_b0_CAT"+TString::Format("%d",counter),"Z_b0_CAT"+TString::Format("%d",counter),0.5,0,1.);
      RooRealVar Zb1("Z_b1_CAT"+TString::Format("%d",counter),"Z_b1_CAT"+TString::Format("%d",counter),0.5,0,1.);
      RooRealVar Zb2("Z_b2_CAT"+TString::Format("%d",counter),"Z_b2_CAT"+TString::Format("%d",counter),0.5,0,1.);
      RooBernstein Zbkg("Z_bkg_CAT"+TString::Format("%d",counter),"Z_bkg_CAT"+TString::Format("%d",counter),x,RooArgSet(Zb0,Zb1,Zb2));
      
      RooRealVar fZsig("fZsig_CAT"+TString::Format("%d",counter),"fZsig_CAT"+TString::Format("%d",counter),0.7,0.,1.);
      RooCBShape Zcore("Zcore_CAT"+TString::Format("%d",counter),"Zcore_CAT"+TString::Format("%d",counter),x,mZShift,sZShift,aZ,nZ);
    
      RooAddPdf modelZ("Z_model_CAT"+TString::Format("%d",counter),"Z_model_CAT"+TString::Format("%d",counter),RooArgList(Zcore,Zbkg),fZsig);
    
      RooFitResult *resZ = modelZ.fitTo(*roohist_Z[icat],RooFit::Save(),RooFit::SumW2Error(kFALSE),"q"); 
  
      canZ->cd(icat+1);
      RooPlot* frame = x.frame();
      roohist_Z[icat]->plotOn(frame);
      modelZ.plotOn(frame,RooFit::LineWidth(2));
      frame->GetXaxis()->SetTitle("M_{bb} (GeV)");
      frame->Draw();
      TPaveText *pave = new TPaveText(0.7,0.76,0.9,0.9,"NDC");
		pave->SetTextAlign(11);
      pave->SetFillColor(0);
      pave->SetBorderSize(0);
      pave->SetTextFont(62);
      pave->SetTextSize(0.045);
      pave->AddText(TString::Format("%s selection",SELNAME[isel].Data()));
		pave->AddText(TString::Format("CAT%d",counter));
		TText *lastline = pave->AddText("Z template");
		pave->SetY1NDC(pave->GetY2NDC()-0.055*3);
		TPaveText *paveorig = (TPaveText*)pave->Clone();
      paveorig->Draw();
    
      sprintf(name,"roohist_T_CAT%d",counter);
      if (icat < 3) { 
        roohist_T[icat] = new RooDataHist(name,name,x,hTopYield);
      }
      else {
        roohist_T[icat] = new RooDataHist(name,name,x,hSTYield);
      }

      sprintf(name,"Top_mean_CAT%d",counter);
      RooRealVar mT(name,name,130,0,200);
      sprintf(name,"Top_sigma_CAT%d",counter);
      RooRealVar sT(name,name,50,0,200);

      sprintf(name,"Top_mean_shifted_CAT%d",counter);
      RooFormulaVar mTShift(name,"@0*@1",RooArgList(mT,*(kJES[isel])));
      sprintf(name,"Top_sigma_shifted_CAT%d",counter);
      RooFormulaVar sTShift(name,"@0*@1",RooArgList(sT,*(kJER[isel])));

      sprintf(name,"Top_model_CAT%d",counter);

      RooGaussian *modelT = new RooGaussian(name,name,x,mTShift,sTShift); 
    
      RooFitResult *resT = modelT->fitTo(*roohist_T[icat],Save(),SumW2Error(kTRUE),"q");
      /*
      TF1 *tmp_func = new TF1("tmpFunc","gaus",XMIN,XMAX);
      tmp_func->SetParameters(1,a0.getVal(),a1.getVal());
      if (icat < 3) {
        float norm = tmp_func->Integral(XMIN,XMAX)/hTopYield->GetBinWidth(1);
        tmp_func->SetParameter(0,hTopYield->Integral()/norm);
      }
      else {
        float norm = tmp_func->Integral(XMIN,XMAX)/hSTYield->GetBinWidth(1);
        tmp_func->SetParameter(0,hSTYield->Integral()/norm);
      }  
      */
      canT->cd(icat+1);
      RooPlot* frame = x.frame();
      roohist_T[icat]->plotOn(frame);
      modelT->plotOn(frame,RooFit::LineWidth(2));
      //modelT->plotOn(frame,VisualizeError(*resT,1,kTRUE),FillColor(kGray),MoveToBack());
      frame->GetXaxis()->SetTitle("M_{bb} (GeV)");
      frame->Draw();
      //tmp_func->Draw("sameL");
		lastline->SetTitle("Top template");
		pave->Draw();

      mZ.setConstant(kTRUE);
      sZ.setConstant(kTRUE);
      aZ.setConstant(kTRUE);
      nZ.setConstant(kTRUE);
      Zb0.setConstant(kTRUE);
      Zb1.setConstant(kTRUE);
      Zb2.setConstant(kTRUE);
      fZsig.setConstant(kTRUE);
      
      mT.setConstant(kTRUE);
      sT.setConstant(kTRUE);

      w->import(modelZ);
      w->import(*modelT);
      w->import(*YieldZ);
      w->import(*YieldT);
      w->import(*YieldTT);
      w->import(*YieldST);
      YieldZ->Print();
      YieldW->Print();
      YieldT->Print();
      YieldTT->Print();
      YieldST->Print();
      counter++;
    }// category loop
	 system(TString::Format("[ ! -d %s/ ] && mkdir %s/",OUTPATH.Data(),OUTPATH.Data()).Data());
	 system(TString::Format("[ ! -d %s/plots ] && mkdir %s/plots",OUTPATH.Data(),OUTPATH.Data()).Data());
	 system(TString::Format("[ ! -d %s/plots/bkgTemplates ] && mkdir %s/plots/bkgTemplates",OUTPATH.Data(),OUTPATH.Data()).Data());
	 TString FULLPATH(OUTPATH+"/plots/bkgTemplates");
	 canT->SaveAs(TString::Format("%s/%s.png",FULLPATH.Data(),canT->GetName()));
	 canZ->SaveAs(TString::Format("%s/%s.png",FULLPATH.Data(),canZ->GetName()));
	 canT->SaveAs(TString::Format("%s/%s.pdf",FULLPATH.Data(),canT->GetName()));
	 canZ->SaveAs(TString::Format("%s/%s.pdf",FULLPATH.Data(),canZ->GetName()));
	 delete can;
  }// selection loop
  system(TString::Format("[ ! -d %s/ ] && mkdir %s/",OUTPATH.Data(),OUTPATH.Data()).Data());
  system(TString::Format("[ ! -d %s/output ] && mkdir %s/output",OUTPATH.Data(),OUTPATH.Data()).Data());
  w->Print();
  w->writeToFile(TString::Format("%s/output/bkg_shapes_workspace%s.root",OUTPATH.Data(),tMERGE.Data()).Data());
}
Example #11
0
int BtagEfficiencies()
{
  // Define sample
  TFile* TTJets    = new TFile("TTJetsFall11.root" , "READ");
  TFile* WJetsHT   = new TFile("WJetsHT.root"      , "READ");
  TFile* SingleTop = new TFile("SingleTop.root"    , "READ");

  // addSample(TFile* sample, TString name)
  addSample(TTJets,    "t#bar{t}+Jets", kRed,     21, 0.9, 7);
  addSample(SingleTop, "single top",    kBlue,    20, 1.0, 7);
  addSample(WJetsHT,   "W+Jets",        kGreen+2, 23, 1.1, 7);
  //addSample(SingleTop, "single top",    kBlue,  24, 1,   7);
  //addSample(WJetsHT,   "W+Jets",        kGreen, 25, 1,   7);


  // addAlgorithm(TString name)
  addAlgorithm("TCHEM");

  // addSelectionStep(TString name, int lc, TString sn);
  addSelectionStep("", 8, "RA4b");

  // Flavors
  Flavors.push_back("B");
  Flavors.push_back("C");
  Flavors.push_back("L");

  // global settings
//   gStyle->SetCanvasColor(10);
//   gStyle->SetOptStat(0);
//   gStyle->SetPalette(1);
//   gStyle->SetTitleFillColor(0);

  setTDRStyle();

  // loop over algorithms
  for(int a=0; a<Algos.size(); ++a)
    {
      std::cout << Algos[a] << std::endl;
      
      // loop over flavor	  
      for(int flv=0; flv<(int)Flavors.size(); ++flv)
	{
	  // loop over selection steps
	  for(int s=0; s < Steps.size(); ++s)
	    {
	      std::cout << "Selection step " << Steps[s] <<  std::endl;
	       
	      // Define canvas and legend/afs/desy.de/user/n/npietsch
	      TCanvas *canvas =new TCanvas(SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",1);

	      TLegend *leg = new TLegend(.64,.18,.91,.35);
	      leg->SetTextFont(42);
	      leg->SetFillColor(0);
	      leg->SetLineColor(1);
	      
	      TPaveText *label = new TPaveText(0.14,0.91,0.6,0.99,"NDC");
	      label->SetFillColor(0);
	      label->SetTextFont(42);
	      label->SetBorderSize(0);
	      TText *text=label->AddText("CMS Simulation, #sqrt{s}=7 TeV");
	      text->SetTextAlign(22);
	      
	      TPaveText *label2 = new TPaveText(0.33,0.23,0.53,0.33,"NDC");
	      label2->SetFillColor(0);
	      label2->SetTextFont(62);
	      label2->SetBorderSize(0);
	      TText *text2=label2->AddText("0 < |#eta| < 0.8");
	      text2->SetTextAlign(22);

	      // declare maximum and ybin
	      double Maximum=0;
	      double ybin=1;

	      // loop over files
	      for(int f=0; f<(int)Files.size(); ++f)
		{
		  TH2F* Pt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta");
		  TH2F* Pt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta");
		  Pt_->Add(Pt2_);

		  TH2F* TaggedPt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta");
		  TH2F* TaggedPt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta");
		  TaggedPt_->Add(TaggedPt2_);

		  TaggedPt_->Divide(Pt_);
		  
		  //--------------------------------------
		  // Draw x and y errors
		  //--------------------------------------
		  
		  // define shifts
		  double shift_=4*(f-1);
		  double shift2_=5*(f-1);
		  double shift3_=6*(f-1);
		  
		  // define array xbinsPt
		  Int_t nBins=TaggedPt_->GetNbinsX();
		  double xbinsPt[18];
		  double xbinsPtX[18];

		  // fill array xbinsPt
		  double xbin0=TaggedPt_->GetBinLowEdge(1);
		  xbinsPt[0]=xbin0;
		  xbinsPtX[0]=xbin0;
		  std::cout << xbin0 << std::endl;

		  //
		  double ibinX=0;
		  for(int xbin=1; xbin<TaggedPt_->GetNbinsX(); ++xbin)
		    {
		      ibinX=ibinX+TaggedPt_->GetXaxis()->GetBinWidth(xbin);
		      if(TaggedPt_->GetXaxis()->GetBinWidth(xbin)>20) shift_=shift3_;

		      xbinsPtX[xbin]=ibinX;
		      xbinsPt[xbin]=ibinX+shift_;
		    }
		  xbinsPt[TaggedPt_->GetNbinsX()]=TaggedPt_->GetBinLowEdge(TaggedPt_->GetNbinsX()+1)+shift_;
		  xbinsPtX[TaggedPt_->GetNbinsX()]=TaggedPt_->GetBinLowEdge(TaggedPt_->GetNbinsX()+1);

		  // define new histograms
		  char Tmp [70];
		  char Tmp2 [70];
		  sprintf(Tmp,"%i_%i_%i_%i_Pt", f, a, flv, s);
		  sprintf(Tmp2,"%i_%i_%i_%i_Pt2", f, a, flv, s);
		  TH1F* Tmp_=new TH1F(Tmp, Tmp, nBins, xbinsPt);
		  TH1F* Tmp2_=new TH1F(Tmp2, Tmp2, nBins, xbinsPtX);

		  // fill histogram Tmp_
		  for(int xbin=0; xbin<Tmp_->GetNbinsX()+1; ++xbin)
		    {
		      Tmp_->SetBinContent(xbin,TaggedPt_->GetBinContent(xbin, ybin));
		      Tmp_->SetBinError(xbin,TaggedPt_->GetBinError(xbin, ybin));
		      
		      Tmp2_->SetBinContent(xbin,TaggedPt_->GetBinContent(xbin, ybin));
		      Tmp2_->SetBinError(xbin,0.0000001);

		      if(TaggedPt_->GetBinContent(xbin, ybin)+TaggedPt_->GetBinError(xbin, ybin) > Maximum)
			{
			  Maximum=TaggedPt_->GetBinContent(xbin, ybin)+TaggedPt_->GetBinError(xbin, ybin);
			}
		    }

		  //--------------------------------------
		  // Draw histogram
		  //--------------------------------------

		  // draw histogram Tmp2_
		  if(Flavors[flv]=="B") Tmp2_->SetMaximum(1.05*0.947686);
		  if(Flavors[flv]=="C") Tmp2_->SetMaximum(1.05*0.388437);
		  if(Flavors[flv]=="L") Tmp2_->SetMaximum(1.05*0.0880499);
		  Tmp2_->SetMinimum(0);
		  Tmp2_->SetTitle("");
		  if(Flavors[flv]=="B") Tmp2_->GetXaxis()->SetTitle("b-jet p_{T} [GeV]");
		  if(Flavors[flv]=="C") Tmp2_->GetXaxis()->SetTitle("c-jet p_{T} [GeV]");
		  if(Flavors[flv]=="L") Tmp2_->GetXaxis()->SetTitle("light quark jet p_{T} [GeV]");
		  Tmp2_->GetXaxis()->SetTitleOffset(1.35);
		  //Tmp2_->GetXaxis()->CenterTitle();
		  Tmp2_->GetYaxis()->SetTitle("b-tag efficiency");
		  Tmp2_->GetYaxis()->SetTitleOffset(1.35);
		  //Tmp2_->GetYaxis()->CenterTitle();
		  Tmp2_->SetLineColor(SampleColors[f]);
		  Tmp2_->SetLineWidth(2);
		  if(f==0) Tmp2_->Draw("");
		  else Tmp2_->Draw("same");

// 		  TF1 *myfit1 = new TF1("myfit1","[0]+[1]*x", 40, 160);
// 		  myfit1->SetLineWidth(2);
// 		  myfit1->SetLineColor(SampleColors[f]);

// 		  Tmp2_->Fit("myfit1","0EMR"); // "0" = do NOT automatically draw "hist"
// 		  Tmp2_->GetFunction("myfit1")->ResetBit(1<<9); // make "fitname" visible

// 		  TF1 *myfit2 = new TF1("myfit2","[0]+[1]*x", 160, 670);
// 		  myfit2->SetLineWidth(2);
// 		  myfit2->SetLineColor(SampleColors[f]);

// 		  Tmp2_->Fit("myfit2","0EMR+"); // "0" = do NOT automatically draw "hist"
// 		  Tmp2_->GetFunction("myfit2")->ResetBit(1<<9); // make "fitname" visible
		  
		  // fit functions
// 		  Double_t par[6];

// 		  if(Flavors[flv] == "B")
// 		    {
// 		      TF1 *g1 = new TF1("g1","[1]+[2]*x+[3]*x**2",40,160);
// 		      g1->SetLineColor(SampleColors[f]);
// 		      Tmp2_->Fit(g1,"0EMR");
// 		      Tmp2_->GetFunction("g1")->ResetBit(1<<9);
		      
// 		      TF1 *g2 = new TF1("g2","[4]+[5]*x",160,670);
// 		      g2->SetLineColor(SampleColors[f]);
// 		      Tmp2_->Fit(g2,"0EMR+");
// 		      Tmp2_->GetFunction("g2")->ResetBit(1<<9);
// 		    }


// 		  if(Flavors[flv] == "C" || Flavors[flv] == "L")
// 		    {
// 		      TF1 *g1 = new TF1("g1","[1]+[2]*x+[3]*x**2",40,670);
// 		      g1->SetLineColor(SampleColors[f]);
// 		      g1->SetLineWidth(2);
// 		      Tmp2_->Fit(g1,"0EMR");
// 		      Tmp2_->GetFunction("g1")->ResetBit(1<<9);
// 		    }

// 		  TF1 *total = new TF1("total","[0]+[1]*x+[2]*x**2+[3]+[4]*x",40,670);
// 		  total->SetLineColor(SampleColors[f]);

// 		  g1->GetParameters(&par[0]);
// 		  g2->GetParameters(&par[3]);

// 		  total->SetParameters(par);
		  
// 		  Tmp2_->Fit("total","0EMR+"); // "0" = do NOT automatically draw "hist"
// 		  Tmp2_->GetFunction("total")->ResetBit(1<<9); // make "fitname" visible

		  // draw histogram Tmp_
		  Tmp_->SetLineColor(SampleColors[f]);
		  Tmp_->SetLineWidth(2);

		  Tmp_->SetMarkerStyle(MarkerStyles[f]);
		  Tmp_->SetMarkerColor(SampleColors[f]);
		  Tmp_->SetMarkerSize(MarkerSizes[f]);

		  Tmp_->Draw("same E x0");

		  leg->AddEntry(Tmp_,Names[f],"l P");
		  
		}
	      std::cout << "==============================" << std::endl;
	      std::cout << "Maximum: " << Maximum << std::endl;
	      std::cout << "==============================" << std::endl;

	      leg->SetShadowColor(0);
	      leg->Draw();
	      label->Draw();
	      label2->Draw();

	      canvas->SaveAs(Algos[a]+Steps[s]+"_"+Flavors[flv]+"jetsEff_MuPt_08.pdf");
	      
	    }
	}
    }
  std::cout << "" << std::endl;
  
  return 0;
}
Example #12
0
void proj_npe_1()
{
//=========Macro generated from canvas: c/
//=========  (Wed Jul 15 16:16:05 2015) by ROOT version6.04/00
   TCanvas *c = new TCanvas("c", "",0,45,600,500);
   c->SetHighLightColor(2);
   c->Range(-2655.754,-5.755,4350.289,51.795);
   c->SetFillColor(0);
   c->SetBorderMode(0);
   c->SetBorderSize(2);
   c->SetFrameBorderMode(0);
   c->SetFrameBorderMode(0);
   
   Double_t _fx2[39] = {
   -1488.08,
   -1403.181,
   -1178.164,
   -1033.78,
   -849.3154,
   -838.8983,
   -788.1957,
   -701.2156,
   -654.0264,
   -163.6875,
   1.142557,
   54.07047,
   256.5688,
   531.8203,
   632.5535,
   750.8472,
   835.9491,
   859.9519,
   970.3359,
   1013.975,
   1084.685,
   1488.872,
   1635.959,
   1867.579,
   1967.102,
   2022.346,
   2109.155,
   2234.388,
   2395.154,
   2415.658,
   2534.104,
   2547.086,
   2643.154,
   2683.775,
   2846.919,
   3002.304,
   3074.222,
   3131.044,
   3182.615};
   Double_t _fy2[39] = {
   2.55,
   2.3,
   2.55,
   2.7,
   2.4,
   2.65,
   2.75,
   2.5,
   2.4,
   2.45,
   42.05,
   2.55,
   2.6,
   2.6,
   2.85,
   2.7,
   2.55,
   2.6,
   2.6,
   2.6,
   2.55,
   2.25,
   2.65,
   2.6,
   2.55,
   2.25,
   2.55,
   2.45,
   2.65,
   2.65,
   2.65,
   2.6,
   2.6,
   2.35,
   2.55,
   2.15,
   2.45,
   2.75,
   2.3};
   TGraph *graph = new TGraph(39,_fx2,_fy2);
   graph->SetName("");
   graph->SetTitle("Event 1");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Event 1",100,-1955.149,3649.684);
   Graph_Graph2->SetMinimum(0);
   Graph_Graph2->SetMaximum(46.04);
   Graph_Graph2->SetDirectory(0);
   Graph_Graph2->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph2->SetLineColor(ci);
   Graph_Graph2->GetXaxis()->SetTitle("time wrt trigger [cm]");
   Graph_Graph2->GetXaxis()->SetLabelFont(42);
   Graph_Graph2->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleFont(42);
   Graph_Graph2->GetYaxis()->SetTitle("#PE");
   Graph_Graph2->GetYaxis()->SetLabelFont(42);
   Graph_Graph2->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleFont(42);
   Graph_Graph2->GetZaxis()->SetLabelFont(42);
   Graph_Graph2->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph2);
   
   graph->Draw("ap");
   
   TPaveText *pt = new TPaveText(0.4189298,0.94,0.5810702,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("Event 1");
   pt->Draw();
   c->Modified();
   c->cd();
   c->SetSelected(c);
}
void plot_golfcourse_Asymptotic(bool unblind){

  bool useNewStyle=true;
  if(useNewStyle)  setFPStyle();

  TFile *fFREQ=new TFile("higgsCombineEXOZZ.Asymptotic.TOTAL.root","READ");

  TTree *t=(TTree*)fFREQ->Get("limit");

  double mh,limit;
  float quant;
  t->SetBranchAddress("mh",&mh);
  t->SetBranchAddress("limit",&limit);
  t->SetBranchAddress("quantileExpected",&quant);

  //1st loop on tree for preparing mH ordered list
  vector<double> v_mhTMP;
  for(int i=0;i<t->GetEntries();i++){
    t->GetEntry(i);
    if(quant>-1.01&&quant<-0.99){
      v_mhTMP.push_back(mh);
    }
  }
  std::sort(v_mhTMP.begin(),v_mhTMP.end());

  int nMH=v_mhTMP.size();
  int iMH=0;
  vector<double> v_mh, v_median,v_68l,v_68h,v_95l,v_95h, v_obs;
  while(iMH<nMH){
    double mhTMP=v_mhTMP.at(iMH);
    for(int i=0;i<t->GetEntries();i++){
      // int i=j;
      // if(j==t->GetEntries())i=0;
      t->GetEntry(i);
      //cout<<"i "<<i<<flush<<"  m = "<<mh<<endl;
      // if(mh==600)cout<<"$$$$$$$$$ TREE 600 $$$$$$$$$$$$$$"<<endl;

      if(mh!=mhTMP)continue;//follow exactly the order of v_mhTMP

      if(quant>-1.01&&quant<-0.99){
	v_obs.push_back(limit);
	v_mh.push_back(mh);
      }
      else if(quant>0.02&&quant<0.03)v_95l.push_back(limit);
      else if(quant>0.15&&quant<0.17)v_68l.push_back(limit);
      else if(quant>0.49&&quant<0.51)v_median.push_back(limit);
      else if(quant>0.83&&quant<0.85)v_68h.push_back(limit);
      else if(quant>0.965&&quant<0.98){
	//   cout<<"95% -> at M="<<mh<<" I found "<<limit<<endl;
	v_95h.push_back(limit);
      }

      else {cout<<"Error! Quantile =  "<<quant<<endl;}
    }
    iMH++;
  }//end while loop
  cout<<"Out of the loop !"<<endl;
  ////////////////////////////////////////
  ///
 //read in theoretical values from text files
  // bool   applyExtraTherUnc=true;
  string xsect_file_th="../../../data/xsect_BulkG_ZZ_c0p5_xsect_in_pb.txt";
  if(!isZZChannel)xsect_file_th="../../../data/xsect_BulkG_WW_c0p5_xsect_in_pb.txt";
  //  make_interpolated_xsect(xsect_file_th, xsect_file_interpol);
  // string xsect_file_interpol="./RSGravXSectTimesBRToZZ_AgasheHapola_c10_EXPOINTERP.txt";
 
  ifstream xsect_file(xsect_file_th.c_str(),ios::in);
  if (! xsect_file.is_open()){ cout<<"Failed to open file with xsections"<<endl;}
  float mH, CS;
 

  vector<float> v_mhxs, v_xs,  v_brzz2l2q,v_toterrh,v_toterrl;
  while(xsect_file.good()){
    xsect_file >> mH>> CS;
    if(mH==1200)cout<<"~~~~~ 1200 theor ~~~~~~~~~~~~~"<<endl;
    if(mH<600.0)continue;
    v_mhxs.push_back(mH);
    v_xs.push_back(CS);//*BRZZ2l2q (multyply by BRZZ2l2q only if exp rates in cards are for process X->ZZ->2l2q !)
   
    //unavailable theor errors for graviton   

    float tot_err_p=0.0;
    float tot_err_m=0.0;
 
    v_toterrh.push_back(1.0+(tot_err_p));
    v_toterrl.push_back(1.0-(tot_err_m));
  }
  cout<<"Size of theor "<<v_mhxs.size()<<endl;
  xsect_file.close();

  string xsect_file_interpol2="../../../data/xsect_BulkG_ZZ_c0p2_xsect_in_pb.txt";
  if(!isZZChannel)xsect_file_interpol2="../../../data/xsect_BulkG_WW_c0p2_xsect_in_pb.txt";
  ifstream xsect_file2(xsect_file_interpol2.c_str(),ios::in);
  if (! xsect_file2.is_open()){ cout<<"Failed to open file with xsections (c=0.10)"<<endl;}
  float mH2,CS10;
 
  vector<float>  v_xs10;
  while(xsect_file2.good()){
    xsect_file2 >> mH2>> CS10;
    if(mH2==975)cout<<"~~~~~ 975 theor ~~~~~~~~~~~~~"<<endl;
    if(mH2<600.0)continue;
    v_xs10.push_back(CS10);//*BRZZ2l2q
   
    //unavailable theor errors for graviton   
    float tot_err_p=0.0;
    float tot_err_m=0.0;
 
    //    v_toterrh.push_back(1.0+(tot_err_p));
    //  v_toterrl.push_back(1.0-(tot_err_m));
  }
  cout<<"Size of theor "<<v_xs10.size()<<endl;
  xsect_file2.close();
  //
  //END THEOR INPUT PART
  ///////////////

  const int nMass= v_mh.size();
  double mass[nMass],mass1[nMass],obs_lim_cls[nMass]; 
  double medianD[nMass];
  double up68err[nMass],down68err[nMass],up95err[nMass],down95err[nMass];
  double xs[nMass], xs_uperr[nMass], xs_downerr[nMass];
  double xs10[nMass], xs10_uperr[nMass], xs10_downerr[nMass];
  int nMassEff=0,nMassEff1=0;
  int nM95=0;
  double mass95[nMass],median95[nMass];
  int nexcluded=0;
  bool excl; 
  for(int im=0;im<nMass;im++){
    if( mass[nMassEff-1]>1600.) cout<<"Array "<<im<<flush<<"  m = "<<v_mh.at(im)<<endl;;
    //protection against messed up jobs
    excl=false;
    if(v_68h.at(im)>=v_95h.at(im) || v_68l.at(im)<=v_95l.at(im) ){
      cout<<"Point at M = "<<v_mh.at(im) <<" excluded: "<<v_95l.at(im)<<"  "<<v_68l.at(im)<<"  "<<v_median.at(im)<<"  "<<v_68h.at(im)<<"  "<<v_95h.at(im)<< endl;
      nexcluded++;
      // continue;
      excl=true; 
    }
    //    if(im%2==1)excl=true;//sample only one half of the points

    //search for right index in theor vectors
    bool found=false;
    int indtmp=0,ind=-1;
    while(!found){
      if(v_mhxs.at(indtmp)==v_mh.at(im)){found=true;ind=indtmp;}
      indtmp++;
      if(indtmp==v_mhxs.size()){
	cout<<"!!! m="<<flush<<v_mh.at(im)<<" NOT found in theor matrix."<<endl;
	break;
      }
    }//end while    
   
  

    if(!found){
      cout<<"(2) m="<<v_mh.at(im)<<" NOT found in theor matrix."<<endl;
      continue;
    }

  
    double fl_xs=double(v_xs.at(ind));//*1000.0
    double fl_xs10=double(v_xs10.at(ind));//*1000.0
   
    if(fl_xs<fl_xs10)cout<<"WARNING ABOUT XSECT! XS="<<fl_xs<<"  XS10="<<fl_xs10<<endl;

    mass[nMassEff]=v_mh.at(im);
    //if( mass[nMassEff]==600.0)cout<<"=============> 600 !!!"<<endl;
    obs_lim_cls[nMassEff]=v_obs.at(im)*fl_xs;
    nMassEff++;
    if(!excl){
      mass1[nMassEff1]=v_mh.at(im);
      medianD[nMassEff1]=v_median.at(im)*fl_xs;
      up68err[nMassEff1]=(v_68h.at(im)-v_median.at(im))*fl_xs;
      down68err[nMassEff1]=(v_median.at(im)-v_68l.at(im))*fl_xs;
      cout<<"M="<<mass1[nMassEff1]<<"  Median="<<medianD[nMassEff1]<<endl;
      
      //scale factor 100 for making the xsect visible
      xs[nMassEff1]=fl_xs;//*100.0;
      xs_uperr[nMassEff1]=double( v_toterrh.at(ind))*xs[nMassEff1]- xs[nMassEff1];
      xs_downerr[nMassEff1]=  xs[nMassEff1]- double( v_toterrl.at(ind))* xs[nMassEff1];

      xs10[nMassEff1]=fl_xs10;//*100.0;
      xs10_uperr[nMassEff1]=double( v_toterrh.at(ind))*xs10[nMassEff1]- xs10[nMassEff1];
      xs10_downerr[nMassEff1]=  xs10[nMassEff1]- double( v_toterrl.at(ind))* xs10[nMassEff1];
    
      //cout<<"Theor err on 4g for M="<<mass[nMassEff]<<"  "<< ggxs4g_downerr[nMassEff] << "  "<<ggxs4g_uperr[nMassEff]<<endl;
      nMassEff1++;
      

      bool skip95= false;//
      //     skip95=v_mh.at(im)==204||v_mh.at(im)==208||v_mh.at(im)==212||v_mh.at(im)==214|| v_mh.at(im)==232 || v_mh.at(im)==240  || v_mh.at(im)==240 || v_mh.at(im)==244 || v_mh.at(im)==252 || v_mh.at(im)==264 || v_mh.at(im)==272 || v_mh.at(im)==288 ;
      //  skip95=false;
      
      if(skip95 )continue;
      mass95[nM95]=v_mh.at(im);
      median95[nM95]=v_median.at(im)*fl_xs;
      up95err[nM95]=(v_95h.at(im)-v_median.at(im))*fl_xs;
      down95err[nM95]=(v_median.at(im)-v_95l.at(im))*fl_xs;
   
      //  cout<<"M95: "<< mass95[nM95]<<" "<<median95[nM95]<<" +"<<up95err[nM95]<<"   -"<< down95err[nM95]<<
      //	" ("<<v_95h.at(im) <<" - "<<v_median.at(im) <<")"<<endl;
      nM95++; 
    }//end if not excluded mass point
  }//end loop over im (mass points)
  cout<<"Excluded "<<nexcluded<<" sick mass points."<<endl;

  


  //  cout<<"Working on TGraph"<<endl;
  TGraphAsymmErrors *grobslim_cls=new TGraphAsymmErrors(nMassEff,mass,obs_lim_cls);
  grobslim_cls->SetName("LimitObservedCLs");
  TGraphAsymmErrors *grmedian_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD);
  grmedian_cls->SetName("LimitExpectedCLs");
  TGraphAsymmErrors *gr68_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD,0,0,down68err,up68err);
  gr68_cls->SetName("Limit68CLs");
  TGraphAsymmErrors *gr95_cls=new TGraphAsymmErrors(nM95,mass95,median95,0,0,down95err,up95err);
  gr95_cls->SetName("Limit95CLs");

  // TGraphAsymmErrors *grthSM=new TGraphAsymmErrors(nMassEff1,mass1,xs,0,0,0,0);//xs_downerr,xs_uperr);
  TGraph *grthSM=new TGraph(nMassEff1,mass1,xs);//xs_downerr,xs_uperr);
  grthSM->SetName("SMXSection");

  // TGraphAsymmErrors *grthSM10=new TGraphAsymmErrors(nMassEff1,mass1,xs10,0,0,0,0);
  TGraph *grthSM10=new TGraph(nMassEff1,mass1,xs10);
  grthSM10->SetName("SMXSection_2nd");
 
  // cout<<"Plotting"<<endl;
  double fr_left=590.0, fr_down=0.0005,fr_right=2020.0,fr_up=1.0;
  if(!isZZChannel){fr_left=1000.0, fr_down=0.0000005,fr_right=2500.0,fr_up=10.0;}
  TCanvas *cMCMC=new TCanvas("c_lim_Asymp","canvas with limits for Asymptotic CLs",630,600);
  cMCMC->cd();
  cMCMC->SetGridx(1);
  cMCMC->SetGridy(1);
  // draw a frame to define the range

  TH1F *hr = cMCMC->DrawFrame(fr_left,fr_down,fr_right,fr_up,"");
  TString VV = "ZZ";
  if(!isZZChannel)VV="WW";
  hr->SetXTitle("M_{1} [GeV]");
  hr->SetYTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
  // cMCMC->GetFrame()->SetFillColor(21);
  //cMCMC->GetFrame()->SetBorderSize(12);
  
  gr95_cls->SetFillColor(kYellow);
  gr95_cls->SetFillStyle(1001);//solid
  gr95_cls->SetLineStyle(kDashed);
  gr95_cls->SetLineWidth(3);
  gr95_cls->GetXaxis()->SetTitle("M_{1} [GeV]");
  gr95_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
  gr95_cls->GetXaxis()->SetRangeUser(fr_left,fr_right);
  
  gr95_cls->Draw("3");
  
  gr68_cls->SetFillColor(kGreen);
  gr68_cls->SetFillStyle(1001);//solid
  gr68_cls->SetLineStyle(kDashed);
  gr68_cls->SetLineWidth(3);
  gr68_cls->Draw("3same");
  grmedian_cls->GetXaxis()->SetTitle("M_{1} [GeV]");
  grmedian_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q
  grmedian_cls->SetMarkerStyle(24);//25=hollow squre
  grmedian_cls->SetMarkerColor(kBlack);
  grmedian_cls->SetLineStyle(2);
  grmedian_cls->SetLineWidth(3);
  grmedian_cls->SetMinimum(0.0);
  grmedian_cls->SetMaximum(8.0);
 
  grobslim_cls->SetMarkerColor(kBlack);
  grobslim_cls->SetMarkerStyle(20);//24=hollow circle // 20 = solid circle
  grobslim_cls->SetMarkerSize(0.7);
  grobslim_cls->SetLineStyle(1);
  grobslim_cls->SetLineWidth(1);
  
  grthSM->SetLineColor(kRed);
  grthSM->SetLineWidth(2);
  grthSM->SetLineStyle(kSolid);
  grthSM->SetFillColor(kRed);
  grthSM->SetFillStyle(3344);

  grthSM10->SetLineColor(kRed);
  grthSM10->SetLineWidth(2);
  grthSM10->SetLineStyle(1);
  grthSM10->SetLineStyle(kDashed);
  grthSM10->SetFillColor(kRed);
  grthSM10->SetFillStyle(3344);

  grthSM->Draw("L3");
  grthSM10->Draw("L3");
  grmedian_cls->Draw("L");
  if(unblind)grobslim_cls->Draw("LP");

  /*
  TFile *fUnMPlus=new TFile("AsymptoticCLs_UnmatchedPlus_TGraph.root","READ");
  TGraph *grobs_ump=(TGraph*)fUnMPlus->Get("LimitObservedCLs");
  TGraph *grmedian_ump=(TGraph*)fUnMPlus->Get("LimitExpectedCLs");
  grobs_ump->SetName("LimitObs_UnmatchedPlus");
  grmedian_ump->SetName("LimitExp_UnmatchedPlus");
  grobs_ump->SetMarkerColor(kBlue);
  grobs_ump->SetLineColor(kBlue);
  grobs_ump->SetMarkerStyle(25);
  grmedian_ump->SetMarkerColor(kBlue);
  grmedian_ump->SetLineColor(kBlue);
  grmedian_ump->SetMarkerStyle(25);
  grobs_ump->Draw("P");
  grmedian_ump->Draw("L");
  */

 //draw grid on top of limits
  gStyle->SetOptStat(0);
  TH1D* postGrid = new TH1D("postGrid","",1,fr_left,fr_right);
  postGrid->GetYaxis()->SetRangeUser(fr_down,fr_up);
  postGrid->Draw("AXIGSAME");

  TLine *l1=new TLine();
  l1->SetLineStyle(1);
  l1->SetLineWidth(2.0);
  l1->SetLineColor(kRed);
  //  l1->DrawLine(200.0,1.0,600.0,1.0);
  //  cMCMC->Update();
  cMCMC->RedrawAxis("");
   gPad->RedrawAxis("");
  // hr->GetYaxis()->DrawClone();
   cMCMC->Update();
  


  //more graphics
  TLegend *leg = new TLegend(.46,.75,.94,.92);
  //   TLegend *leg = new TLegend(.35,.71,.90,.90);
   leg->SetFillColor(0);
   leg->SetShadowColor(0);
   leg->SetTextFont(42);
   leg->SetTextSize(0.025);
   //   leg->SetBorderMode(0);
   if(unblind)leg->AddEntry(grobslim_cls, "Asympt. CL_{S} Observed", "LP");
   leg->AddEntry(gr68_cls, "Asympt. CL_{S}  Expected #pm 1#sigma", "LF");
   leg->AddEntry(gr95_cls, "Asympt. CL_{S}  Expected #pm 2#sigma", "LF");
   leg->AddEntry(grthSM, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.50", "L" );// #rightarrow 2l2q
   leg->AddEntry(grthSM10, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.20", "L");// #rightarrow 2l2q
   leg->Draw();
   
 if(useNewStyle){
   TPaveText* cmslabel = new TPaveText( 0.145, 0.953, 0.6, 0.975, "brNDC");
   cmslabel->SetFillColor(kWhite);
   cmslabel->SetTextSize(0.038);
   cmslabel->SetTextAlign(11);
   cmslabel->SetTextFont(62);
   cmslabel->SetBorderSize(0);
   //   std::string leftText = "CMS Preliminary 2011";
   std::string leftText = "CMS";
   std::string units = "fb ^{-1}";
   char lumiText[300];
   sprintf( lumiText, "%.1f %s", intLumi, units.c_str());
   cmslabel->AddText(Form("%s,  #sqrt{s} = 8 TeV, %s", leftText.c_str(), lumiText));
   //cmslabel->Draw();

   TPaveText* label_sqrt = new TPaveText(0.4,0.953,0.96,0.975, "brNDC");
   label_sqrt->SetFillColor(kWhite);
   label_sqrt->SetBorderSize(0);
   label_sqrt->SetTextSize(0.038);
   label_sqrt->SetTextFont(62);   
   label_sqrt->SetTextAlign(31); // align right
   // label_sqrt->AddText("#sqrt{s} = 7 TeV");
   label_sqrt->AddText(Form("%s, L = %s at  #sqrt{s} = 8 TeV", leftText.c_str(), lumiText));
   label_sqrt->Draw();

   }
   else{

   TLatex * latex = new TLatex();
   latex->SetNDC();
   latex->SetTextSize(0.04);
   latex->SetTextAlign(31);
   latex->SetTextAlign(11); // align left 
   latex->DrawLatex(0.18, 0.96, "CMS preliminary 2012");
   latex->DrawLatex(0.60,0.96,Form("%.1f fb^{-1} at #sqrt{s} = 8 TeV",intLumi));
   
   }

   TLine *l1b=new TLine();
   l1b->SetLineStyle(1);
   l1b->SetLineWidth(2.0);
   l1b->SetLineColor(kRed);
   //l1b->DrawLine(200.0,1.0,600.0,1.0);
   cMCMC->Update();
   
   
   // cMCMC->RedrawAxis("");
   gPad->RedrawAxis("");
   // hr->GetYaxis()->DrawClone();
   cMCMC->Update();
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.root");
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.eps");
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.png");
   gPad->SetLogy();
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.eps");
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.png");
   cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.root");
  // cMCMC->SaveAs("ClsLimit_1fb.png");
   

   TFile *outfile=new TFile("AsymptoticCLs_TGraph.root","RECREATE");
   outfile->cd();
   if(unblind)grobslim_cls->Write();
   grmedian_cls->Write();
   outfile->Close();


}//end main
Example #14
0
void acceptance_mass()
{
//=========Macro generated from canvas: c2/c2
//=========  (Mon Oct 26 11:11:00 2015) by ROOT version6.02/05
   TCanvas *c2 = new TCanvas("c2", "c2",20,42,700,500);
   gStyle->SetOptStat(0);
   c2->Range(-1.3125,-0.025,9.8125,0.225);
   c2->SetFillColor(0);
   c2->SetBorderMode(0);
   c2->SetBorderSize(2);
   c2->SetFrameBorderMode(0);
   c2->SetFrameBorderMode(0);
   
   TH2F *dummy42 = new TH2F("dummy42","dummy4",178,-0.2,8.7,100,0,0.2);
   dummy42->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   dummy42->SetLineColor(ci);
   dummy42->GetXaxis()->SetTitle("Mass [GeV]");
   dummy42->GetXaxis()->SetLabelFont(42);
   dummy42->GetXaxis()->SetLabelSize(0.035);
   dummy42->GetXaxis()->SetTitleSize(0.035);
   dummy42->GetXaxis()->SetTitleFont(42);
   dummy42->GetYaxis()->SetTitle("#epsilon_{rec} = N_{rec}/N_{tot}");
   dummy42->GetYaxis()->SetLabelFont(42);
   dummy42->GetYaxis()->SetLabelSize(0.035);
   dummy42->GetYaxis()->SetTitleSize(0.035);
   dummy42->GetYaxis()->SetTitleFont(42);
   dummy42->GetZaxis()->SetLabelFont(42);
   dummy42->GetZaxis()->SetLabelSize(0.035);
   dummy42->GetZaxis()->SetTitleSize(0.035);
   dummy42->GetZaxis()->SetTitleFont(42);
   dummy42->Draw("");
   
   Double_t Graph0_fx1006[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph0_fy1006[5] = {
   0.0865404,
   0.08208333,
   0.0749858,
   0.05958333,
   0.1375897};
   Double_t Graph0_fex1006[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph0_fey1006[5] = {
   0.0009990599,
   0.0009753636,
   0.0009926071,
   0.0008541653,
   0.001244048};
   TGraphErrors *gre = new TGraphErrors(5,Graph0_fx1006,Graph0_fy1006,Graph0_fex1006,Graph0_fey1006);
   gre->SetName("Graph0");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","Graph",100,0,9.325);
   Graph_Graph1006->SetMinimum(0.05071871);
   Graph_Graph1006->SetMaximum(0.1468442);
   Graph_Graph1006->SetDirectory(0);
   Graph_Graph1006->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1006->SetLineColor(ci);
   Graph_Graph1006->GetXaxis()->SetLabelFont(42);
   Graph_Graph1006->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1006);
   
   gre->Draw(" pl");
   
   Double_t Graph1_fx1007[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph1_fy1007[4] = {
   0.08294682,
   0.07862374,
   0.06207908,
   0.137474};
   Double_t Graph1_fex1007[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph1_fey1007[4] = {
   0.0009899688,
   0.000956385,
   0.0008617826,
   0.001242555};
   gre = new TGraphErrors(4,Graph1_fx1007,Graph1_fy1007,Graph1_fex1007,Graph1_fey1007);
   gre->SetName("Graph1");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","Graph",100,0,9.325);
   Graph_Graph1007->SetMinimum(0.05346738);
   Graph_Graph1007->SetMaximum(0.1464664);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   gre->Draw(" pl");
   
   Double_t Graph2_fx1008[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph2_fy1008[5] = {
   0.06949495,
   0.06748737,
   0.0642268,
   0.06051768,
   0.1364046};
   Double_t Graph2_fex1008[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph2_fey1008[5] = {
   0.0009035941,
   0.000891407,
   0.0008800606,
   0.000847272,
   0.00123208};
   gre = new TGraphErrors(5,Graph2_fx1008,Graph2_fy1008,Graph2_fex1008,Graph2_fey1008);
   gre->SetName("Graph2");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(3);
   gre->SetMarkerColor(3);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,9.325);
   Graph_Graph1008->SetMinimum(0.05187377);
   Graph_Graph1008->SetMaximum(0.1454334);
   Graph_Graph1008->SetDirectory(0);
   Graph_Graph1008->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1008->SetLineColor(ci);
   Graph_Graph1008->GetXaxis()->SetLabelFont(42);
   Graph_Graph1008->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1008);
   
   gre->Draw(" pl");
   
   Double_t Graph3_fx1009[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph3_fy1009[5] = {
   0.04645202,
   0.04597222,
   0.04502717,
   0.05941919,
   0.1359975};
   Double_t Graph3_fex1009[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph3_fey1009[5] = {
   0.000747844,
   0.0007441589,
   0.0007643529,
   0.0008400378,
   0.001218037};
   gre = new TGraphErrors(5,Graph3_fx1009,Graph3_fy1009,Graph3_fex1009,Graph3_fey1009);
   gre->SetName("Graph3");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(4);
   gre->SetMarkerColor(4);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","Graph",100,0,9.325);
   Graph_Graph1009->SetMinimum(0.03496755);
   Graph_Graph1009->SetMaximum(0.1465108);
   Graph_Graph1009->SetDirectory(0);
   Graph_Graph1009->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1009->SetLineColor(ci);
   Graph_Graph1009->GetXaxis()->SetLabelFont(42);
   Graph_Graph1009->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetXaxis()->SetTitleFont(42);
   Graph_Graph1009->GetYaxis()->SetLabelFont(42);
   Graph_Graph1009->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetYaxis()->SetTitleFont(42);
   Graph_Graph1009->GetZaxis()->SetLabelFont(42);
   Graph_Graph1009->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1009);
   
   gre->Draw(" pl");
   
   Double_t Graph4_fx1010[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph4_fy1010[5] = {
   0.0157633,
   0.01659091,
   0.01693182,
   0.05516582,
   0.1364646};
   Double_t Graph4_fex1010[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph4_fey1010[5] = {
   0.0004493916,
   0.0004538785,
   0.0004584384,
   0.0008153701,
   0.001219797};
   gre = new TGraphErrors(5,Graph4_fx1010,Graph4_fy1010,Graph4_fex1010,Graph4_fey1010);
   gre->SetName("Graph4");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(6);
   gre->SetMarkerColor(6);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1010 = new TH1F("Graph_Graph1010","Graph",100,0,9.325);
   Graph_Graph1010->SetMinimum(0.003076858);
   Graph_Graph1010->SetMaximum(0.1499215);
   Graph_Graph1010->SetDirectory(0);
   Graph_Graph1010->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1010->SetLineColor(ci);
   Graph_Graph1010->GetXaxis()->SetLabelFont(42);
   Graph_Graph1010->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetXaxis()->SetTitleFont(42);
   Graph_Graph1010->GetYaxis()->SetLabelFont(42);
   Graph_Graph1010->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetYaxis()->SetTitleFont(42);
   Graph_Graph1010->GetZaxis()->SetLabelFont(42);
   Graph_Graph1010->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1010);
   
   gre->Draw(" pl");
   
   Double_t Graph5_fx1011[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph5_fy1011[4] = {
   0.005542929,
   0.005892857,
   0.04303571,
   0.132096};
   Double_t Graph5_fex1011[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph5_fey1011[4] = {
   0.0002638154,
   0.0002733515,
   0.0007247769,
   0.001203145};
   gre = new TGraphErrors(4,Graph5_fx1011,Graph5_fy1011,Graph5_fex1011,Graph5_fey1011);
   gre->SetName("Graph5");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(7);
   gre->SetMarkerColor(7);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1011 = new TH1F("Graph_Graph1011","Graph",100,0,9.325);
   Graph_Graph1011->SetMinimum(0);
   Graph_Graph1011->SetMaximum(0.1461011);
   Graph_Graph1011->SetDirectory(0);
   Graph_Graph1011->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1011->SetLineColor(ci);
   Graph_Graph1011->GetXaxis()->SetLabelFont(42);
   Graph_Graph1011->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetXaxis()->SetTitleFont(42);
   Graph_Graph1011->GetYaxis()->SetLabelFont(42);
   Graph_Graph1011->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetYaxis()->SetTitleFont(42);
   Graph_Graph1011->GetZaxis()->SetLabelFont(42);
   Graph_Graph1011->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1011);
   
   gre->Draw(" pl");
   
   Double_t Graph6_fx1012[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph6_fy1012[5] = {
   0.00155303,
   0.001868687,
   0.002222281,
   0.02356061,
   0.1211862};
   Double_t Graph6_fex1012[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph6_fey1012[5] = {
   0.0001399232,
   0.0001534615,
   0.0001707546,
   0.000538956,
   0.001165513};
   gre = new TGraphErrors(5,Graph6_fx1012,Graph6_fy1012,Graph6_fex1012,Graph6_fey1012);
   gre->SetName("Graph6");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(8);
   gre->SetMarkerColor(8);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1012 = new TH1F("Graph_Graph1012","Graph",100,0,9.325);
   Graph_Graph1012->SetMinimum(0);
   Graph_Graph1012->SetMaximum(0.1344456);
   Graph_Graph1012->SetDirectory(0);
   Graph_Graph1012->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1012->SetLineColor(ci);
   Graph_Graph1012->GetXaxis()->SetLabelFont(42);
   Graph_Graph1012->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetXaxis()->SetTitleFont(42);
   Graph_Graph1012->GetYaxis()->SetLabelFont(42);
   Graph_Graph1012->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetYaxis()->SetTitleFont(42);
   Graph_Graph1012->GetZaxis()->SetLabelFont(42);
   Graph_Graph1012->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1012);
   
   gre->Draw(" pl");
   
   Double_t Graph7_fx1013[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph7_fy1013[4] = {
   0.0009974747,
   0.0009974747,
   0.01513298,
   0.1061111};
   Double_t Graph7_fex1013[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph7_fey1013[4] = {
   0.0001121687,
   0.0001121687,
   0.0004451866,
   0.001147773};
   gre = new TGraphErrors(4,Graph7_fx1013,Graph7_fy1013,Graph7_fex1013,Graph7_fey1013);
   gre->SetName("Graph7");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(9);
   gre->SetMarkerColor(9);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1013 = new TH1F("Graph_Graph1013","Graph",100,0,9.325);
   Graph_Graph1013->SetMinimum(0);
   Graph_Graph1013->SetMaximum(0.1178962);
   Graph_Graph1013->SetDirectory(0);
   Graph_Graph1013->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1013->SetLineColor(ci);
   Graph_Graph1013->GetXaxis()->SetLabelFont(42);
   Graph_Graph1013->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetXaxis()->SetTitleFont(42);
   Graph_Graph1013->GetYaxis()->SetLabelFont(42);
   Graph_Graph1013->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetYaxis()->SetTitleFont(42);
   Graph_Graph1013->GetZaxis()->SetLabelFont(42);
   Graph_Graph1013->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1013);
   
   gre->Draw(" pl");
   
   Double_t Graph8_fx1014[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph8_fy1014[5] = {
   0.0002651515,
   0.0004419192,
   0.0003815789,
   0.006989796,
   0.07766414};
   Double_t Graph8_fex1014[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph8_fey1014[5] = {
   5.785313e-05,
   7.468147e-05,
   7.084391e-05,
   0.0002975439,
   0.0009510256};
   gre = new TGraphErrors(5,Graph8_fx1014,Graph8_fy1014,Graph8_fex1014,Graph8_fey1014);
   gre->SetName("Graph8");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(40);
   gre->SetMarkerColor(40);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1014 = new TH1F("Graph_Graph1014","Graph",100,0,9.325);
   Graph_Graph1014->SetMinimum(0);
   Graph_Graph1014->SetMaximum(0.08645595);
   Graph_Graph1014->SetDirectory(0);
   Graph_Graph1014->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1014->SetLineColor(ci);
   Graph_Graph1014->GetXaxis()->SetLabelFont(42);
   Graph_Graph1014->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetXaxis()->SetTitleFont(42);
   Graph_Graph1014->GetYaxis()->SetLabelFont(42);
   Graph_Graph1014->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetYaxis()->SetTitleFont(42);
   Graph_Graph1014->GetZaxis()->SetLabelFont(42);
   Graph_Graph1014->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1014);
   
   gre->Draw(" pl");
   
   Double_t Graph9_fx1015[2] = {
   0.25,
   2};
   Double_t Graph9_fy1015[2] = {
   6.47017e-05,
   0.002367956};
   Double_t Graph9_fex1015[2] = {
   0,
   0};
   Double_t Graph9_fey1015[2] = {
   1.3794e-05,
   6.810597e-05};
   gre = new TGraphErrors(2,Graph9_fx1015,Graph9_fy1015,Graph9_fex1015,Graph9_fey1015);
   gre->SetName("Graph9");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1015 = new TH1F("Graph_Graph1015","Graph",100,0.075,2.175);
   Graph_Graph1015->SetMinimum(0);
   Graph_Graph1015->SetMaximum(0.002674577);
   Graph_Graph1015->SetDirectory(0);
   Graph_Graph1015->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1015->SetLineColor(ci);
   Graph_Graph1015->GetXaxis()->SetLabelFont(42);
   Graph_Graph1015->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetXaxis()->SetTitleFont(42);
   Graph_Graph1015->GetYaxis()->SetLabelFont(42);
   Graph_Graph1015->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetYaxis()->SetTitleFont(42);
   Graph_Graph1015->GetZaxis()->SetLabelFont(42);
   Graph_Graph1015->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1015);
   
   gre->Draw(" pl");
   
   Double_t Graph10_fx1016[2] = {
   0.25,
   2};
   Double_t Graph10_fy1016[2] = {
   2.397917e-05,
   0.0007142042};
   Double_t Graph10_fex1016[2] = {
   0,
   0};
   Double_t Graph10_fey1016[2] = {
   9.063167e-06,
   4.035479e-05};
   gre = new TGraphErrors(2,Graph10_fx1016,Graph10_fy1016,Graph10_fex1016,Graph10_fey1016);
   gre->SetName("Graph10");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1016 = new TH1F("Graph_Graph1016","Graph",100,0.075,2.175);
   Graph_Graph1016->SetMinimum(0);
   Graph_Graph1016->SetMaximum(0.0008285233);
   Graph_Graph1016->SetDirectory(0);
   Graph_Graph1016->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1016->SetLineColor(ci);
   Graph_Graph1016->GetXaxis()->SetLabelFont(42);
   Graph_Graph1016->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetXaxis()->SetTitleFont(42);
   Graph_Graph1016->GetYaxis()->SetLabelFont(42);
   Graph_Graph1016->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetYaxis()->SetTitleFont(42);
   Graph_Graph1016->GetZaxis()->SetLabelFont(42);
   Graph_Graph1016->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1016);
   
   gre->Draw(" pl");
   
   TLegend *leg = new TLegend(0.158046,0.5369979,0.5071839,0.8372093,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph0","c#Tau=0.00 mm","PL");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph1","c#Tau=0.05 mm","PL");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(2);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph2","c#Tau=0.10 mm","PL");
   entry->SetLineColor(3);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(3);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph3","c#Tau=0.20 mm","PL");
   entry->SetLineColor(4);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(4);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph4","c#Tau=0.50 mm","PL");
   entry->SetLineColor(6);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(6);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph5","c#Tau=1.00 mm","PL");
   entry->SetLineColor(7);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(7);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph6","c#Tau=2.00 mm","PL");
   entry->SetLineColor(8);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(8);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph7","c#Tau=3.00 mm","PL");
   entry->SetLineColor(9);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(9);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph8","c#Tau=5.00 mm","PL");
   entry->SetLineColor(40);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(40);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.4195977,0.9339831,0.5804023,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("dummy4");
   pt->Draw();
   c2->Modified();
   c2->cd();
   c2->SetSelected(c2);
}
Example #15
0
File: csv2.C Project: rgoldouz/tqA
void csv2() 
{   
  TString sysname ="CSV.root";
  TFile *sysinput(0);
  sysinput = TFile::Open( sysname ); // if not: download from ROOT server
  std::vector<string> variables_;
  TString name;
  variables_.push_back("BDT__zjethist");
//  variables_.push_back("BDT__phjethist");
  variables_.push_back("BDT__tbartchhist");
  variables_.push_back("BDT__tt3hist");
  variables_.push_back("BDT__ttphhist");
  variables_.push_back("BDT__wwphhist");
  variables_.push_back("BDT__zzhist");
  variables_.push_back("BDT__zgammahist");
  variables_.push_back("BDT__singleantitopphotonhist");

std::vector<TH1F*> addhists;
std::vector<TH1F*> wjetandwphjet;

wjetandwphjet.push_back((TH1F*) sysinput->Get((std::string("BDT__wjet").c_str())));
wjetandwphjet.push_back((TH1F*) sysinput->Get((std::string("BDT__wphjethist").c_str())));

std::vector<TH1F*> jesuphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__JES__plus";
jesuphists.push_back((TH1F*) sysinput->Get(name));
}
//jesuphists.push_back((TH1F*) sysinput->Get((std::string("BDT__wjet").c_str())));
//jesuphists.push_back((TH1F*) sysinput->Get((std::string("BDT__wphjethist").c_str())));
for(unsigned int idx=1; idx<variables_.size(); ++idx){
jesuphists[idx]->Add(jesuphists[idx-1]);
}
addhists.push_back(jesuphists[variables_.size()-1]);

std::vector<TH1F*> jesdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__JES__minus";
jesdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
jesdownhists[idx]->Add(jesdownhists[idx-1]);}
addhists.push_back(jesdownhists[variables_.size()-1]);

std::vector<TH1F*> jeruphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__JER__plus";
jeruphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
jeruphists[idx]->Add(jeruphists[idx-1]);}
addhists.push_back(jeruphists[variables_.size()-1]);

std::vector<TH1F*> jerdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__JER__minus";
jerdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
jerdownhists[idx]->Add(jerdownhists[idx-1]);}
addhists.push_back(jerdownhists[variables_.size()-1]);

std::vector<TH1F*> phesuphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PhES__plus";
phesuphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
phesuphists[idx]->Add(phesuphists[idx-1]);}
addhists.push_back(phesuphists[variables_.size()-1]);

std::vector<TH1F*> phesdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PhES__minus";
phesdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
phesdownhists[idx]->Add(phesdownhists[idx-1]);}
addhists.push_back(phesdownhists[variables_.size()-1]);

std::vector<TH1F*> puuphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PU__plus";
puuphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
puuphists[idx]->Add(puuphists[idx-1]);}
addhists.push_back(puuphists[variables_.size()-1]);

std::vector<TH1F*> pudownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PU__minus";
pudownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
pudownhists[idx]->Add(pudownhists[idx-1]);}
addhists.push_back(pudownhists[variables_.size()-1]);

std::vector<TH1F*> triguphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__TRIG__plus";
triguphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
triguphists[idx]->Add(triguphists[idx-1]);}
addhists.push_back(triguphists[variables_.size()-1]);

std::vector<TH1F*> trigdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__TRIG__minus";
trigdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
trigdownhists[idx]->Add(trigdownhists[idx-1]);}
addhists.push_back(trigdownhists[variables_.size()-1]);

std::vector<TH1F*> btaguphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__BTAG__plus";
btaguphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
btaguphists[idx]->Add(btaguphists[idx-1]);}
addhists.push_back(btaguphists[variables_.size()-1]);

std::vector<TH1F*> btagdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__BTAG__minus";
btagdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
btagdownhists[idx]->Add(btagdownhists[idx-1]);}
addhists.push_back(btagdownhists[variables_.size()-1]);

std::vector<TH1F*> misstaguphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__MISSTAG__plus";
misstaguphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
misstaguphists[idx]->Add(misstaguphists[idx-1]);}
addhists.push_back(misstaguphists[variables_.size()-1]);

std::vector<TH1F*> misstagdownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__MISSTAG__minus";
misstagdownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
misstagdownhists[idx]->Add(misstagdownhists[idx-1]);}
addhists.push_back(misstagdownhists[variables_.size()-1]);

std::vector<TH1F*> muonuphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__MUON__plus";
muonuphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
muonuphists[idx]->Add(muonuphists[idx-1]);}
addhists.push_back(muonuphists[variables_.size()-1]);

std::vector<TH1F*> muondownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__MUON__minus";
muondownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
muondownhists[idx]->Add(muondownhists[idx-1]);}
addhists.push_back(muondownhists[variables_.size()-1]);

std::vector<TH1F*> photonuphists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PHOTON__plus";
photonuphists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
photonuphists[idx]->Add(photonuphists[idx-1]);}
addhists.push_back(photonuphists[variables_.size()-1]);

std::vector<TH1F*> photondownhists;
for(unsigned int i=0; i<variables_.size(); ++i){
name=variables_[i]+"__PHOTON__minus";
photondownhists.push_back((TH1F*) sysinput->Get(name));}
for(unsigned int idx=1; idx<variables_.size(); ++idx){
photondownhists[idx]->Add(photondownhists[idx-1]);}
addhists.push_back(photondownhists[variables_.size()-1]);

std::vector<std::vector<double_t> > vec(photondownhists[0]->GetNbinsX(), vector<double>(18));
  for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins
    for(int m = 0; m < 18; m++){ //loop over systematics
vec[p][m]=addhists[m]->GetBinContent(p+1)+wjetandwphjet[0]->GetBinContent(p+1)+wjetandwphjet[1]->GetBinContent(p+1);
cout<<vec[p][m]<<endl;
}}


   // Book output histograms
   UInt_t nbin = 20;
   double min=0;
   double max=1;

   // Prepare input tree (this must be replaced by your data source)
   // in this example, there is a toy tree with signal and one with background events
   // we'll later on use only the "signal" events for the test in this example.
   //   
   TFile *input(0);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::vector<string> samples_;
std::vector<string> datasamples_;
std::vector<TH1F*> hists;
std::vector<TH1F*> datahists;
std::vector<TH1F*> revDATAhists;

float scales[] = {0.628,0.0978,34.01,6.133,1.04,0.32,0.02,0.002,0.0961,0.0253,0.0224,0.0145,0.0125,0.0160,0.0158,0.0341,0.0341,0.0341,0.020,0.0017,0.0055,0.0032,0.00084,0.02,0.01139,0.01139,0.049094905/19.145};
samples_.push_back("WJET.root");
samples_.push_back("ZJET.root");
samples_.push_back("G_Pt_50to80.root");
samples_.push_back("G_Pt_80to120.root");
samples_.push_back("G_Pt_120to170.root");
samples_.push_back("G_Pt_170to300.root");
samples_.push_back("G_Pt_300to470.root");
samples_.push_back("G_Pt_470to800.root");
samples_.push_back("WPHJET.root");
samples_.push_back("T-W-CH.root");
samples_.push_back("TBAR-W-CH.root");
samples_.push_back("T-S-CH.root");
samples_.push_back("TBAR-S-CH.root");
samples_.push_back("T-T-CH.root");
samples_.push_back("TBAR-T-CH.root");
samples_.push_back("TTBAR1.root");
samples_.push_back("TTBAR2.root");
samples_.push_back("TTBAR3.root");
samples_.push_back("TTG.root");
samples_.push_back("WWG.root");
samples_.push_back("WW.root");
samples_.push_back("WZ.root");
samples_.push_back("ZZ.root");
samples_.push_back("ZGAMMA.root");
samples_.push_back("SINGLE-TOP-PH.root");
samples_.push_back("SINGLE-ANTITOP-PH.root");
samples_.push_back("SIGNALtGu.root");
datasamples_.push_back("REALDATA1.root");
datasamples_.push_back("REALDATA2.root");
datasamples_.push_back("REALDATA3.root");

std::vector<string> datasamplesreverse_;
datasamplesreverse_.push_back("etarev/REALDATA1.root");
datasamplesreverse_.push_back("etarev/REALDATA2.root");
datasamplesreverse_.push_back("etarev/REALDATA3.root");

TH1F   *wphjethist(0), *zjethist(0) , *phjethist(0), *wjethist(0), *twchhist(0), *tbarwhist(0),  *tschhist(0), *tbarschhist(0), *ttchhist(0), *tbartchhist(0), *tt1hist(0) ,*tt2hist(0), *tt3hist(0), *ttphhist(0), *wwphhist(0), *wwhist(0), *wzhist(0), *zzhist(0), *zgammahist(0),*singletopphotonhist(0), *singleantitopphotonhist(0), *signalhist(0), *G_Pt_50to80(0),*G_Pt_80to120(0), *G_Pt_120to170(0), *G_Pt_170to300(0) ,*G_Pt_300to470(0),*G_Pt_470to800(0)  ;

TH1F   *wphjethistSB(0), *zjethistSB(0) , *phjethistSB(0), *wjethistSB(0), *twchhistSB(0), *tbarwhistSB(0),  *tschhistSB(0), *tbarschhistSB(0), *ttchhistSB(0), *tbartchhistSB(0), *tt1histSB(0) ,*tt2histSB(0), *tt3histSB(0), *ttphhistSB(0), *wwphhistSB(0), *wwhistSB(0), *wzhistSB(0), *zzhistSB(0), *zgammahistSB(0),*singletopphotonhistSB(0), *singleantitopphotonhistSB(0), *signalhistSB(0), *G_Pt_50to80SB(0),*G_Pt_80to120SB(0), *G_Pt_120to170SB(0), *G_Pt_170to300SB(0) ,*G_Pt_300to470SB(0),*G_Pt_470to800SB(0)  ;

TH1F *data1hist(0), *data2hist(0) ,*data3hist(0) ,*datahistsideband(0);
TH1F *data1histrev(0), *data2histrev(0) ,*data3histrev(0), *datahistrevsideband(0);

wphjethist = new TH1F( "mu_BDT__wphjethist",           "mu_BDT__wphjethist",           nbin, min, max );
zjethist = new TH1F( "mu_BDT__zjethist",           "mu_BDT__zjethist",           nbin, min, max );
G_Pt_50to80= new TH1F( "mu_BDT__G_Pt_50to80",           "mu_BDT__G_Pt_50to80",           nbin, min, max );
G_Pt_80to120= new TH1F( "mu_BDT__G_Pt_80to120",           "mu_BDT__G_Pt_80to120",           nbin, min, max );
G_Pt_120to170= new TH1F( "mu_BDT__G_Pt_120to170",           "mu_BDT__G_Pt_120to170",           nbin, min, max );
G_Pt_170to300= new TH1F( "mu_BDT__G_Pt_170to300",           "mu_BDT__G_Pt_170to300",           nbin, min, max );
G_Pt_300to470= new TH1F( "mu_BDT__G_Pt_300to470",           "mu_BDT__G_Pt_300to470",           nbin, min, max );
G_Pt_470to800= new TH1F( "mu_BDT__G_Pt_470to800",           "mu_BDT__G_Pt_470to800",           nbin, min, max );
wjethist = new TH1F( "mu_BDT__wjethist",           "mu_BDT__wjethist",           nbin, min, max);
twchhist = new TH1F( "mu_BDT__twchhist",           "mu_BDT__twchhist",           nbin, min, max );
tbarwhist = new TH1F( "mu_BDT__tbarwhist",           "mu_BDT__tbarwhist",           nbin, min, max );
tschhist = new TH1F( "mu_BDT__tschhist",           "mu_BDT__tschhist",           nbin, min, max );
tbarschhist = new TH1F( "mu_BDT__tbarschhist",           "mu_BDT__tbarschhist",           nbin, min, max );
ttchhist = new TH1F( "mu_BDT__ttchhist",           "mu_BDT__ttchhist",           nbin, min, max );
tbartchhist = new TH1F( "mu_BDT__tbartchhist",           "mu_BDT__tbartchhist",           nbin, min, max);
tt1hist = new TH1F( "mu_BDT__tt1hist",           "mu_BDT__tt1hist",           nbin,min, max );
tt2hist = new TH1F( "mu_BDT__tt2hist",           "mu_BDT__tt2hist",           nbin, min, max);
tt3hist = new TH1F( "mu_BDT__tt3hist",           "mu_BDT__tt3hist",           nbin, min, max);
ttphhist = new TH1F( "mu_BDT__ttphhist",           "mu_BDT__ttphhist",           nbin, min, max);
wwphhist = new TH1F( "mu_BDT__wwphhist",           "BDT__wwphhist",           nbin,min, max );
wwhist = new TH1F( "mu_BDT__wwhist",           "mu_BDT__wwhist",           nbin,min, max );
wzhist = new TH1F( "mu_BDT__wzhist",           "mu_BDT__wzhist",           nbin, min, max );
zzhist = new TH1F( "mu_BDT__zzhist",           "mu_BDT__zzhist",           nbin, min, max );
zgammahist = new TH1F( "mu_BDT__zgammahist",           "mu_BDT__zgammahist",           nbin,min, max );
singletopphotonhist = new TH1F( "mu_BDT__singletopphotonhist",           "mu_BDT__singletopphotonhist",           nbin, min, max);
singleantitopphotonhist = new TH1F( "mu_BDT__singleantitopphotonhist",           "mu_BDT__singleantitopphotonhist",           nbin,min, max );
signalhist = new TH1F( "mu_BDT__signal100",           "mu_BDT__signal100",           nbin, min, max );


data1hist = new TH1F( "mu_BDT__data1hist",           "mu_BDT__data1hist",           nbin, min, max );
data2hist = new TH1F( "mu_BDT__data2hist",           "mu_BDT__data2hist",           nbin, min, max );
data3hist = new TH1F( "mu_BDT__DATA",           "mu_BDT__DATA",           nbin, min, max );
datahistsideband = new TH1F( "mu_BDT__DATA_sideband",           "mu_BDT__DATA_sideband",           nbin, min, max);


data1histrev = new TH1F( "mu_BDT__data1histrev",           "mu_BDT__data1histrev",           nbin, min, max );
data2histrev = new TH1F( "mu_BDT__data2histrev",           "mu_BDT__data2histrev",           nbin,min, max );
data3histrev = new TH1F( "mu_BDT__DATArev",           "mu_BDT__DATArev",           nbin, min, max );
datahistrevsideband = new TH1F( "mu_BDT__DATArevsideband",           "mu_BDT__DATArevsideband",           nbin, min, max );

wphjethistSB = new TH1F( "mu_BDT__wphjethist__JES__SB",           "mu_BDT__wphjethist__JES__SB",           nbin,min, max );
zjethistSB = new TH1F( "mu_BDT__zjethist__JES__SB",           "mu_BDT__zjethist__JES__SB",           nbin, min, max );
G_Pt_50to80SB= new TH1F( "mu_BDT__G_Pt_50to80SB",           "mu_BDT__G_Pt_50to80SB",           nbin, min, max );
G_Pt_80to120SB= new TH1F( "mu_BDT__G_Pt_80to120SB",           "mu_BDT__G_Pt_80to120SB",           nbin, min, max );
G_Pt_120to170SB= new TH1F( "mu_BDT__G_Pt_120to170SB",           "mu_BDT__G_Pt_120to170SB",           nbin, min, max );
G_Pt_170to300SB= new TH1F( "mu_BDT__G_Pt_170to300SB",           "mu_BDT__G_Pt_170to300SB",           nbin, min, max );
G_Pt_300to470SB= new TH1F( "mu_BDT__G_Pt_300to470SB",           "mu_BDT__G_Pt_300to470SB",           nbin, min, max );
G_Pt_470to800SB= new TH1F( "mu_BDT__G_Pt_470to800SB",           "mu_BDT__G_Pt_470to800SB",           nbin, min, max );
wjethistSB = new TH1F( "mu_BDT__wjethist__JES__SB",           "mu_BDT__wjethist__JES__SB",           nbin, min, max );
twchhistSB = new TH1F( "mu_BDT__twchhist__JES__SB",           "mu_BDT__twchhist__JES__SB",           nbin,min, max);
tbarwhistSB = new TH1F( "mu_BDT__tbarwhist__JES__SB",           "mu_BDT__tbarwhist__JES__SB",           nbin,min, max );
tschhistSB = new TH1F( "mu_BDT__tschhist__JES__SB",           "mu_BDT__tschhist__JES__SB",           nbin, min, max );
tbarschhistSB = new TH1F( "mu_BDT__tbarschhist__JES__SB",           "mu_BDT__tbarschhist__JES__SB",           nbin, min, max );
ttchhistSB = new TH1F( "mu_BDT__ttchhist__JES__SB",           "mu_BDT__ttchhist__JES__SB",           nbin, min, max );
tbartchhistSB = new TH1F( "mu_BDT__tbartchhist__JES__SB",           "mu_BDT__tbartchhist__JES__SB",           nbin, min, max);
tt1histSB = new TH1F( "mu_BDT__tt1hist__JES__SB",           "mu_BDT__tt1hist__JES__SB",           nbin, min, max );
tt2histSB = new TH1F( "mu_BDT__tt2hist__JES__SB",           "mu_BDT__tt2hist__JES__SB",           nbin, min, max );
tt3histSB = new TH1F( "mu_BDT__tt3hist__JES__SB",           "mu_BDT__tt3hist__JES__SB",           nbin, min, max );
ttphhistSB = new TH1F( "mu_BDT__ttphhist__JES__SB",           "mu_BDT__ttphhist__JES__SB",           nbin,min, max );
wwphhistSB = new TH1F( "mu_BDT__wwphhist__JES__SB",           "BDT__wwphhist__JES__SB",           nbin,min, max );
wwhistSB = new TH1F( "mu_BDT__wwhist__JES__SB",           "mu_BDT__wwhist__JES__SB",           nbin, min, max );
wzhistSB = new TH1F( "mu_BDT__wzhist__JES__SB",           "mu_BDT__wzhist__JES__SB",           nbin, min, max );
zzhistSB = new TH1F( "mu_BDT__zzhist__JES__SB",           "mu_BDT__zzhist__JES__SB",           nbin, min, max);
zgammahistSB = new TH1F( "mu_BDT__zgammahist__JES__SB",           "mu_BDT__zgammahist__JES__SB",           nbin, min, max );
singletopphotonhistSB = new TH1F( "mu_BDT__singletopphotonhistSB",           "mu_BDT__singletopphotonhistSB",           nbin,min, max );
singleantitopphotonhistSB = new TH1F( "mu_BDT__singleantitopphotonhistSB",           "mu_BDT__singleantitopphotonhistSB",           nbin, min, max);
signalhistSB = new TH1F( "mu_BDT__signal100__JES__SB",           "mu_BDT__signal100__JES__SB",           nbin,min, max );

std::vector<TH1F*> SBhists;
SBhists.push_back(wjethistSB);
SBhists.push_back(zjethistSB);
SBhists.push_back(G_Pt_50to80SB);
SBhists.push_back(G_Pt_80to120SB);
SBhists.push_back(G_Pt_120to170SB);
SBhists.push_back(G_Pt_170to300SB);
SBhists.push_back(G_Pt_300to470SB);
SBhists.push_back(G_Pt_470to800SB);
SBhists.push_back(wphjethistSB);
SBhists.push_back(twchhistSB);
SBhists.push_back(tbarwhistSB);
SBhists.push_back(tschhistSB);
SBhists.push_back(tbarschhistSB);
SBhists.push_back(ttchhistSB);
SBhists.push_back(tbartchhistSB);
SBhists.push_back(tt1histSB);
SBhists.push_back(tt2histSB);
SBhists.push_back(tt3histSB);
SBhists.push_back(ttphhistSB);
SBhists.push_back(wwphhistSB);
SBhists.push_back(wwhistSB);
SBhists.push_back(wzhistSB);
SBhists.push_back(zzhistSB);
SBhists.push_back(zgammahistSB);
SBhists.push_back(singletopphotonhistSB);
SBhists.push_back(singleantitopphotonhistSB);
SBhists.push_back(signalhistSB);

hists.push_back(wjethist);
hists.push_back(zjethist);
hists.push_back(G_Pt_50to80);
hists.push_back(G_Pt_80to120);
hists.push_back(G_Pt_120to170);
hists.push_back(G_Pt_170to300);
hists.push_back(G_Pt_300to470);
hists.push_back(G_Pt_470to800);
hists.push_back(wphjethist);
hists.push_back(twchhist);
hists.push_back(tbarwhist);
hists.push_back(tschhist);
hists.push_back(tbarschhist);
hists.push_back(ttchhist);
hists.push_back(tbartchhist);
hists.push_back(tt1hist);
hists.push_back(tt2hist);
hists.push_back(tt3hist);
hists.push_back(ttphhist);
hists.push_back(wwphhist);
hists.push_back(wwhist);
hists.push_back(wzhist);
hists.push_back(zzhist);
hists.push_back(zgammahist);
hists.push_back(singletopphotonhist);
hists.push_back(singleantitopphotonhist);
hists.push_back(signalhist);

for(unsigned int idx=0; idx<samples_.size(); ++idx){
hists[idx]->Sumw2();}

datahists.push_back(data1hist);
datahists.push_back(data2hist);
datahists.push_back(data3hist);
datahists.push_back(datahistsideband);
for(unsigned int idx=0; idx<datasamples_.size(); ++idx){
datahists[idx]->Sumw2();}

revDATAhists.push_back(data1histrev);
revDATAhists.push_back(data2histrev);
revDATAhists.push_back(data3histrev);
revDATAhists.push_back(datahistrevsideband);

double insidewphjet=0;
double outsidewphjet=0;
double insidewjet=0;
double outsidewjet=0;
double nsignalevent=0;
double mtopup=220;
double mtopdown=130;
//bool SR=false;
//bool SB=true;
bool SR=true;
bool SB=false;
for(unsigned int idx=0; idx<samples_.size(); ++idx){
   TString fname =samples_[idx];
   if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists
   else    
      input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server
   
   if (!input) {
      std::cout << "ERROR: could not open data file" << std::endl;
      exit(1);
   }
   std::cout << "--- TMVAClassificationApp    : Using input file: " << input->GetName() << std::endl;
   
   // --- Event loop

   // Prepare the event tree
   // - here the variable names have to corres[1]ponds to your tree
   // - you can use the same variables as above which is slightly faster,
   //   but of course you can use different ones and copy the values inside the event loop
   //
  //Double_t  myptphoton,myetaphoton,myptmuon,myetamuon,myptjet,myetajet,mymasstop,mymtw,mydeltaRphotonjet,mydeltaRphotonmuon,myht,mycostopphoton,mydeltaphiphotonmet,mycvsdiscriminant,myjetmultiplicity,mybjetmultiplicity,myleptoncharge;


std::vector<double> *myptphoton=0;
std::vector<double> *myetaphoton=0;
std::vector<double> *myptmuon=0;
std::vector<double> *myetamuon=0;
std::vector<double> *myptjet=0;
std::vector<double> *myetajet=0;
std::vector<double> *mymasstop=0;
//std::vector<double> *mymtw=0;
std::vector<double> *mydeltaRphotonjet=0;
std::vector<double> *mydeltaRphotonmuon=0;
//std::vector<double> *myht=0;
std::vector<double> *mycostopphoton=0;
std::vector<double> *mydeltaphiphotonmet=0;
std::vector<double> *mycvsdiscriminant=0;
std::vector<double> *myjetmultiplicity=0;
//std::vector<double> *mybjetmultiplicity=0;
//std::vector<double> *myleptoncharge=0;
std::vector<double> *myweight=0;
std::vector<double> *myjetmatchinginfo=0;
std::vector<double> *mycoswphoton=0;

   std::cout << "--- Select signal sample" << std::endl;
   TTree* theTree = (TTree*)input->Get("analyzestep2/atq");
//   Int_t myjetmultiplicity, mybjetmultiplicity , myleptoncharge;
//   Float_t userVar1, userVar2;

   theTree->SetBranchAddress("ptphoton", &myptphoton  );
   theTree->SetBranchAddress( "etaphoton", &myetaphoton );
   theTree->SetBranchAddress( "ptmuon", &myptmuon );
   theTree->SetBranchAddress( "etamuon", &myetamuon );
   theTree->SetBranchAddress( "ptjet", &myptjet );
   theTree->SetBranchAddress( "etajet", &myetajet );
   theTree->SetBranchAddress( "masstop", &mymasstop );
//   theTree->SetBranchAddress( "mtw", &mymtw );
   theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet );
   theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon );
//   theTree->SetBranchAddress( "ht", &myht );
   theTree->SetBranchAddress( "costopphoton", &mycostopphoton );
   theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity );
//   theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity );
   theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet );
   theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant );
//   theTree->SetBranchAddress( "leptoncharge", &myleptoncharge );
   theTree->SetBranchAddress( "weight", &myweight);
   theTree->SetBranchAddress( "coswphoton", &mycoswphoton );
	theTree->SetBranchAddress( "jetmatchinginfo", &myjetmatchinginfo );


//   std::cout << "--- Processing: " << theTree->GetEntries() << " events" << std::endl;
   TStopwatch sw;
   sw.Start();
   for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) {
//   std::cout << "--- ... Processing event: " << ievt << std::endl;
double finalweight;

      if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl;

      theTree->GetEntry(ievt);
//for (int l=0;l<sizeof(myptphoton);l++){
//std::cout << "--- ... reza: " << myptphoton[l] <<std::endl;
//}
//std::cout << "--- ......................."<< (*mycvsdiscriminant)[0]<<std::endl;
      // --- Return the MVA outputs and fill into histograms

finalweight=(*myweight)[0];
//cout<<(*myweight)[0]<<endl;
if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup){
hists[idx] ->Fill(Bmodification((*mycvsdiscriminant)[0],(*myjetmatchinginfo)[0]),finalweight );
if (samples_[idx]=="WPHJET.root")insidewphjet=insidewphjet+finalweight;
if (samples_[idx]=="SIGNALtGu.root")nsignalevent=nsignalevent+1;
//cout<<insidewphjet<<endl;
}
else {
SBhists[idx] ->Fill( Bmodification((*mycvsdiscriminant)[0],(*myjetmatchinginfo)[0]),finalweight );
if (samples_[idx]=="WPHJET.root")outsidewphjet=outsidewphjet+finalweight;}


      // Retrieve also per-event error
}
delete myptphoton;
delete myetaphoton;
delete myptmuon;
delete myetamuon;
delete myptjet;
delete myetajet;
delete mymasstop;
//delete mymtw;
delete mydeltaRphotonjet;
delete mydeltaRphotonmuon;
//delete myht;
delete mycostopphoton;
delete mydeltaphiphotonmet;
delete mycvsdiscriminant;
delete myjetmultiplicity;
//delete mybjetmultiplicity;
//delete myleptoncharge;
//delete myplot;
}
for(unsigned int idx=0; idx<datasamples_.size(); ++idx){
   TString fname =datasamples_[idx];
   if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists
   else    
      input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server
   
   if (!input) {
      std::cout << "ERROR: could not open data file" << std::endl;
      exit(1);
   }
   std::cout << "--- TMVAClassificationApp    : Using input file: " << input->GetName() << std::endl;
   
   // --- Event loop

   // Prepare the event tree
   // - here the variable names have to corres[1]ponds to your tree
   // - you can use the same variables as above which is slightly faster,
   //   but of course you can use different ones and copy the values inside the event loop
   //
  //Double_t  myptphoton,myetaphoton,myptmuon,myetamuon,myptjet,myetajet,mymasstop,mymtw,mydeltaRphotonjet,mydeltaRphotonmuon,myht,mycostopphoton,mydeltaphiphotonmet,mycvsdiscriminant,myjetmultiplicity,mybjetmultiplicity,myleptoncharge;


std::vector<double> *myptphoton=0;
std::vector<double> *myetaphoton=0;
std::vector<double> *myptmuon=0;
std::vector<double> *myetamuon=0;
std::vector<double> *myptjet=0;
std::vector<double> *myetajet=0;
std::vector<double> *mymasstop=0;
//std::vector<double> *mymtw=0;
std::vector<double> *mydeltaRphotonjet=0;
std::vector<double> *mydeltaRphotonmuon=0;
//std::vector<double> *myht=0;
std::vector<double> *mycostopphoton=0;
std::vector<double> *mydeltaphiphotonmet=0;
std::vector<double> *mycvsdiscriminant=0;
std::vector<double> *myjetmultiplicity=0;
//std::vector<double> *mybjetmultiplicity=0;
//std::vector<double> *myleptoncharge=0;
std::vector<double> *mycoswphoton=0;



   std::cout << "--- Select signal sample" << std::endl;
   TTree* theTree = (TTree*)input->Get("analyzestep2/atq");
//   Int_t myjetmultiplicity, mybjetmultiplicity , myleptoncharge;
//   Float_t userVar1, userVar2;

   theTree->SetBranchAddress("ptphoton", &myptphoton  );
   theTree->SetBranchAddress( "etaphoton", &myetaphoton );
   theTree->SetBranchAddress( "ptmuon", &myptmuon );
   theTree->SetBranchAddress( "etamuon", &myetamuon );
   theTree->SetBranchAddress( "ptjet", &myptjet );
   theTree->SetBranchAddress( "etajet", &myetajet );
   theTree->SetBranchAddress( "masstop", &mymasstop );
//   theTree->SetBranchAddress( "mtw", &mymtw );
   theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet );
   theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon );
//   theTree->SetBranchAddress( "ht", &myht );
   theTree->SetBranchAddress( "costopphoton", &mycostopphoton );
   theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity );
//   theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity );
   theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet );
   theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant );
   theTree->SetBranchAddress( "coswphoton", &mycoswphoton );
//   theTree->SetBranchAddress( "leptoncharge", &myleptoncharge );


   for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) {
//   std::cout << "--- ... Processing event: " << ievt << std::endl;
      theTree->GetEntry(ievt);
      // --- Return the MVA outputs and fill into histograms
//leptoncharge=(float)(*myleptoncharge )[0];

if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup) datahists[idx] ->Fill( (*mycvsdiscriminant)[0] );
else datahists[3]->Fill(  (*mycvsdiscriminant)[0] );
}
delete myptphoton;
delete myetaphoton;
delete myptmuon;
delete myetamuon;
delete myptjet;
delete myetajet;
delete mymasstop;
//delete mymtw;
delete mydeltaRphotonjet;
delete mydeltaRphotonmuon;
//delete myht;
delete mycostopphoton;
delete mydeltaphiphotonmet;
delete mycvsdiscriminant;
delete myjetmultiplicity;
//delete mybjetmultiplicity;
//delete myleptoncharge;
//delete myplot;

}

for(unsigned int idx=0; idx<datasamplesreverse_.size(); ++idx){
   TString fname =datasamplesreverse_[idx];
   if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists
   else
      input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server

   if (!input) {
      std::cout << "ERROR: could not open data file" << std::endl;
      exit(1);
   }
   std::cout << "--- TMVAClassificationApp    : Using input file: " << input->GetName() << std::endl;

std::vector<double> *myptphoton=0;
std::vector<double> *myetaphoton=0;
 std::vector<double> *myptmuon=0;
 std::vector<double> *myetamuon=0;
 std::vector<double> *myptjet=0;
 std::vector<double> *myetajet=0;
 std::vector<double> *mymasstop=0;
 //std::vector<double> *mymtw=0;
 std::vector<double> *mydeltaRphotonjet=0;
std::vector<double> *mydeltaRphotonmuon=0;
 //std::vector<double> *myht=0;
 std::vector<double> *mycostopphoton=0;
 std::vector<double> *mydeltaphiphotonmet=0;
 std::vector<double> *mycvsdiscriminant=0;
 std::vector<double> *myjetmultiplicity=0;
std::vector<double> *mycoswphoton=0;
 //std::vector<double> *mybjetmultiplicity=0;
 //std::vector<double> *myleptoncharge=0;
   TTree* theTree = (TTree*)input->Get("analyzestep2/atq");
   theTree->SetBranchAddress("ptphoton", &myptphoton  );
   theTree->SetBranchAddress( "etaphoton", &myetaphoton );
   theTree->SetBranchAddress( "ptmuon", &myptmuon );
   theTree->SetBranchAddress( "etamuon", &myetamuon );
   theTree->SetBranchAddress( "ptjet", &myptjet );
   theTree->SetBranchAddress( "etajet", &myetajet );
   theTree->SetBranchAddress( "masstop", &mymasstop );
//   theTree->SetBranchAddress( "mtw", &mymtw );
   theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet );
   theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon );
         //   theTree->SetBranchAddress( "ht", &myht );
   theTree->SetBranchAddress( "costopphoton", &mycostopphoton );
   theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity );
               //   theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity );
   theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet );
   theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant );
   theTree->SetBranchAddress( "coswphoton", &mycoswphoton );
                     //   theTree->SetBranchAddress( "leptoncharge", &myleptoncharge );
 // Efficiency calculator for cut method
 for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) {
                       //   std::cout << "--- ... Processing event: " << ievt << std::endl;
   if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl;
   theTree->GetEntry(ievt);

 

if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup) {
//revDATAhists[idx]->Fill( reader->EvaluateMVA( "BDT method"           ) );
insidewjet=insidewjet+1;
revDATAhists[idx]->Fill(  (*mycvsdiscriminant)[0]);
}
else {
//revDATAhists[3]->Fill( reader->EvaluateMVA( "BDT method"           ) );
outsidewjet=outsidewjet+1;
revDATAhists[3]->Fill( (*mycvsdiscriminant)[0]);
}


//cout<<insidewjet<<endl;
}
delete myptphoton;
delete myetaphoton;
delete myptmuon;
delete myetamuon;
delete myptjet;
delete myetajet;
delete mymasstop;
//delete mymtw;
delete mydeltaRphotonjet;
delete mydeltaRphotonmuon;
//delete myht;
delete mycostopphoton;
delete mydeltaphiphotonmet;
delete mycvsdiscriminant;
delete myjetmultiplicity;
////delete mybjetmultiplicity;
////delete myleptoncharge;
////delete myplot;
//
}

double wphjetscale;
wphjetscale=insidewphjet/(insidewphjet+outsidewphjet);
cout<<"wphjetscale=    "<<wphjetscale<<endl;
double wjetscale;
wjetscale=insidewjet/(insidewjet+outsidewjet);
cout<<"wjetscale=    "<<wjetscale<<endl;
cout<<"nsignalevent=    "<<nsignalevent<<endl;
//cout<<insidewphjet<<"insidewphjet"<<"       "<<wphjetscale<<"       "<<insidewjet/(insidewjet+outsidewjet)<<endl;
float lumi = 1;

if (SR==true){
double ff=0;
for(unsigned int idx=0; idx<samples_.size(); ++idx){
hists[idx]->Scale(lumi*scales[idx]);
if (idx !=0 && idx!=3){
ff=hists[idx]->Integral()+ff;
cout<<samples_[idx]<<"         =        "<<hists[idx]->Integral()<<"     " <<ff<<endl;}
}

for(unsigned int idx=0; idx<samples_.size(); ++idx){
SBhists[idx]->Scale(lumi*scales[idx]);}

THStack *hs1 = new THStack("hs1","BDT output");
for(unsigned int idx=1; idx<datasamplesreverse_.size(); ++idx){
revDATAhists[idx]->Add(revDATAhists[idx-1]);
}
//cout<<"*********************"<< datahists[3]->Integral()<<"       "<<wphjetscale<<endl;
//cout<<"*********************"<< revDATAhists[2]->Integral()<<"       "<<wjetscale<<endl;

revDATAhists[2]->Scale(219.373/revDATAhists[2]->Integral());
for(unsigned int idx=1; idx<revDATAhists[2]->GetNbinsX()+1; ++idx){
//revDATAhists[2]->SetBinError(idx,(revDATAhists[2]->GetBinContent(idx)/revDATAhists[2]->Integral())*74.84);
revDATAhists[2]->SetBinError(idx,0);
//if (revDATAhists[2]->GetBinError(idx)>revDATAhists[2]->GetBinContent(idx)) revDATAhists[2]->SetBinError(idx, revDATAhists[2]->GetBinContent(idx)/2); 
}
//revDATAhists[2]->Scale(wjetscale);
revDATAhists[3]->Scale(219.373/revDATAhists[3]->Integral());
revDATAhists[3]->Scale((1-wjetscale)/wjetscale);


for(unsigned int idx=1; idx<datasamples_.size(); ++idx){
datahists[idx]->Add(datahists[idx-1]);}
cout<<"     " <<datahists[2]->Integral()<<endl;

datahists[3]->Add(revDATAhists[3],-1);
datahists[3]->Add(SBhists[1],-1);
datahists[3]->Add(SBhists[2],-1);
for(unsigned int idx=9; idx<samples_.size()-1; ++idx){
datahists[3]->Add(SBhists[idx],-1);}
for(unsigned int idx=1; idx<nbin; ++idx){
if (datahists[3]->GetBinContent(idx)<0)datahists[3]->SetBinContent(idx,0);
} 
datahists[3]->Scale(1112.2/datahists[3]->Integral());
for(unsigned int idx=1; idx<datahists[3]->GetNbinsX()+1; ++idx){
//datahists[3]->SetBinError(idx,(datahists[3]->GetBinContent(idx)/datahists[3]->Integral())*139.11);}
datahists[3]->SetBinError(idx,0);}

TH1F *datatoMC(0);

//datahists[3]->Scale(wphjetscale);

//hists[1]->Add(revDATAhists[2]);
//hists[2]->Add(hists[1]);
//datahists[3]->Add(hists[2]);
//hists[4]->Add(datahists[3]);

//for(unsigned int idx=5; idx<samples_.size()-1; ++idx){
//   hists[idx]->Add(hists[idx-1]);}
//cout<<"**********real data***********"<< datahists[2]->Integral()<<"       "<<wphjetscale<<endl;
//cout<<"********** mc ***********"<< hists[18]->Integral()<<"       "<<wjetscale<<endl;
// setup the canvas and draw the histograms

TH1F *sum_h= new TH1F ( *hists[1] ) ;
sum_h->Sumw2();
for(unsigned int idx=2; idx<samples_.size()-1; ++idx){
if (idx!=8)sum_h->Add(hists[idx],1);
}
sum_h->Add(revDATAhists[2],1);
sum_h->Add(datahists[3],1);

std::vector<std::vector<double_t> > vecplus(photondownhists[0]->GetNbinsX(), vector<double>(18));
std::vector<std::vector<double_t> > vecminus(photondownhists[0]->GetNbinsX(), vector<double>(18));
 for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins
    for(int m = 0; m < 18; m++){ //loop over systematics
vecplus[p][m]=0;
vecminus[p][m]=0;
if (vec[p][m]>sum_h->GetBinContent(p+1)) vecplus[p][m] = vec[p][m]-sum_h->GetBinContent(p+1);
else if (vec[p][m]<sum_h->GetBinContent(p+1)) vecminus[p][m] = sum_h->GetBinContent(p+1)-vec[p][m];

cout<<vecplus[p][m]<<endl;
}}




TCanvas *c1 = new TCanvas("c1","signal region",50,50,865,780);
c1->cd();
TPad *pad1 = new TPad("pad1","pad1",0,0.25,1,1);
pad1->SetFillStyle(0);
pad1->SetFrameFillStyle(0);
pad1->SetBottomMargin(0);
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.25);
pad2->SetFillStyle(0);
pad2->SetFrameFillStyle(0);
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.12/0.46);
pad2->Draw();
pad1->Draw();

pad1->cd();

//W+jet
revDATAhists[2]->SetFillColor(kBlue-2);
revDATAhists[2]->SetLineColor(kBlack);
hs1->Add(revDATAhists[2]);
//Z+jet
hists[1]->SetFillColor(kOrange-4);
hists[1]->SetLineColor(kBlack);
hs1->Add(hists[1]);
//photon+jet
hists[3]->Add(hists[2]);
hists[4]->Add(hists[3]);
hists[5]->Add(hists[4]);
hists[6]->Add(hists[5]);
hists[7]->Add(hists[6]);
hists[7]->SetFillColor(19);
//hs1->Add(hists[7]);
//W+photon+jet
datahists[3]->SetFillColor(kGreen-3);
datahists[3]->SetLineColor(kBlack);
hs1->Add(datahists[3]);

//single top+singletop photon
hists[5+5]->Add(hists[4+5]);
hists[6+5]->Add(hists[5+5]);
hists[7+5]->Add(hists[6+5]);
hists[8+5]->Add(hists[7+5]);
hists[9+5]->Add(hists[8+5]);
hists[19+5]->Add(hists[9+5]);
hists[20+5]->Add(hists[19+5]);
hists[20+5]->SetFillColor(kRed+3);
hists[20+5]->SetLineColor(kBlack);
hs1->Add(hists[20+5]);
//hists[9+5]->SetFillColor(kAzure+10);
//hs1->Add(hists[9+5]);

hists[11+5]->Add(hists[10+5]);
hists[12+5]->Add(hists[11+5]);
hists[13+5]->Add(hists[12+5]);
hists[13+5]->SetFillColor(kPink+1);
hists[13+5]->SetLineColor(kBlack);
hs1->Add(hists[13+5]);
//hists[13+5]->SetFillColor(17);
//hs1->Add(hists[13+5]);
//hists[14+5]->SetFillColor(kSpring-9);
//hs1->Add(hists[14+5]);
hists[15+5]->Add(hists[14+5]);
hists[16+5]->Add(hists[15+5]);
hists[17+5]->Add(hists[16+5]);
hists[17+5]->SetFillColor(kViolet-7);
hists[17+5]->SetLineColor(kBlack);
hs1->Add(hists[17+5]);
hists[18+5]->SetFillColor(kAzure+10);
hists[18+5]->SetLineColor(kBlack);
hs1->Add(hists[18+5]);
//hists[20+5]->Add(hists[19+5]);
//hists[20+5]->SetFillColor(kYellow+3);
//hs1->Add(hists[20+5]);

hs1->Draw("hist");
hs1->SetMaximum(1.6*datahists[2]->GetMaximum());
//hs1->GetXaxis()->SetTitle("BDT output");
hs1->GetYaxis()->SetTitle("Events / 0.05");
hs1->GetYaxis()->SetTitleSize(0.045);
hs1->GetYaxis()->SetTitleFont(22);
hs1->GetYaxis()->SetTitleOffset(0.8);
hs1->GetYaxis()->SetLabelSize(0.044);

hists[21+5]->SetLineColor(kRed+3);
hists[21+5]->SetLineWidth(3);
hists[21+5]->Draw("histsame");

datahists[2]->SetLineWidth(3.);
datahists[2]->SetLineColor(kBlack);
datahists[2]->SetMarkerColor(kBlack);
datahists[2]->SetMarkerStyle(20.);
datahists[2]->SetMarkerSize(1.35);
datahists[2]->Draw("esame");
sum_h->SetLineColor(kBlack);
sum_h->SetFillColor(1);
sum_h->SetFillStyle(3001);
sum_h->Draw("e2same");


    TPaveText *pt = new TPaveText(0.1,0.95,0.4,0.95, "NDC"); // NDC sets coords
    pt->SetLineColor(10);                                              // relative to pad dimensions
    pt->SetFillColor(10); // text is black on white
    pt->SetTextSize(0.045);
    pt->SetTextAlign(12);
    pt->AddText("CMS Preliminary, 19.1 fb^{-1}, #sqrt{s} = 8 TeV");
    pt->SetShadowColor(10);
    pt->Draw("same");

std::vector<double_t> errorup(photondownhists[0]->GetNbinsX());
std::vector<double_t> errordown(photondownhists[0]->GetNbinsX());
 for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins
    for(int m = 0; m < 18; m++){ //loop over systematics
if (m==0) {errorup[p]=0;
errordown[p]=0;}
errorup[p]=pow(vecplus[p][m],2)+errorup[p];
errordown[p]=pow(vecminus[p][m],2)+errordown[p];
}
errorup[p]=pow(0.024*sum_h->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.024*sum_h->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.4*wjetandwphjet[0]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.4*wjetandwphjet[0]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*wjetandwphjet[1]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*wjetandwphjet[1]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*hists[1]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*hists[1]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*hists[20+5]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*hists[20+5]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*hists[13+5]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*hists[13+5]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*hists[17+5]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*hists[17+5]->GetBinContent(p+1),2)+errordown[p];
errorup[p]=pow(0.3*hists[18+5]->GetBinContent(p+1),2)+errorup[p];
errordown[p]=pow(0.3*hists[18+5]->GetBinContent(p+1),2)+errordown[p];

cout<<errorup[p]<<endl;
cout<<errordown[p]<<endl;
}

 double ax[photondownhists[0]->GetNbinsX()];
 double ay[photondownhists[0]->GetNbinsX()];
 double aexl[photondownhists[0]->GetNbinsX()];
 double aexh[photondownhists[0]->GetNbinsX()];
 double aeyl[photondownhists[0]->GetNbinsX()];
 double aeyh[photondownhists[0]->GetNbinsX()];
 for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins
ax[p]=min+(max-min)/(2*nbin)+p*((max-min)/nbin);
ay[p]=sum_h->GetBinContent(p+1);
aexl[p]=(max-min)/(2*nbin);
aexh[p]=(max-min)/(2*nbin);
aeyl[p]=sqrt(errordown[p]);
aeyh[p]=sqrt(errorup[p]);
}
TGraphAsymmErrors* gae = new TGraphAsymmErrors(photondownhists[0]->GetNbinsX(), ax, ay, aexl, aexh, aeyl, aeyh);
gae->SetFillColor(1);
gae->SetFillStyle(3003);

   gae->Draw("e2same");
TLegend* leg = new TLegend(0.60,0.40,0.89,0.87);
  leg->SetFillStyle ( 0);
  leg->SetFillColor ( 0);
  leg->SetBorderSize( 0);
  leg->AddEntry( datahists[2], "Data"               , "PL");
//  leg->AddEntry( hists[25], "Single top+#gamma"               , "F");
  leg->AddEntry( hists[23], "Z#gamma"               , "F");
  leg->AddEntry( hists[22], "WW,WZ,ZZ,WW#gamma "               , "F");
//  leg->AddEntry( hists[19], "WW#gamma"               , "F");
  leg->AddEntry( hists[18], "t#bar{t}, t#bar{t}#gamma"               , "F");
//  leg->AddEntry( hists[17], "t#bar{t}"               , "F");
  leg->AddEntry( hists[25], "Single top, Single top+#gamma"               , "F");
//  leg->AddEntry( hists[14], "Single top"               , "F");
  leg->AddEntry( datahists[3], "W#gamma"              , "F");
//  leg->AddEntry( hists[7], "#gamma+jets"                           , "F");
  leg->AddEntry( hists[1], "Z+jets"                           , "F");
  leg->AddEntry(revDATAhists[2], "W+jets"                           , "F");
  leg->AddEntry( hists[26], "Signal(tu#gamma) 1 pb"               , "L");
  leg->AddEntry(sum_h, "Stat uncertainty"               , "F");
  leg->AddEntry(gae, "Syst uncertainty"               , "F");

//  leg->AddEntry( datahists[2], "CMS Data 2012(19.145/fb)"               , "PL");

leg->Draw("same");
   sum_h->Draw("AXISSAMEY+");
   sum_h->Draw("AXISSAMEX+");
pad1->Draw();

TCanvas *c22 = new TCanvas("c22","signal region22",50,50,865,780);
c22->cd();
    gae->Draw("a2");
    gae->Draw("psame");

TH1F *h_ratio = (TH1F*)datahists[2]->Clone("h_copy");
h_ratio->Sumw2();	
pad2->cd();
pad2->SetGridy();
datatoMC = new TH1F( "datatoMC",           "datatoMC",           nbin, min, max );
datatoMC->Sumw2();
datatoMC->Divide(datahists[2],sum_h);
h_ratio->Divide(sum_h);
h_ratio->SetFillStyle(3004);
h_ratio->GetXaxis()->SetTitle("CSV discriminator");
h_ratio->GetYaxis()->SetTitle("DATA/MC");
  h_ratio->GetXaxis()->SetTitleSize(0.12);
  h_ratio->GetYaxis()->SetTitleSize(0.12);
  h_ratio->GetXaxis()->SetTitleFont(22);
  h_ratio->GetYaxis()->SetTitleFont(22);
  h_ratio->GetXaxis()->SetTickLength(0.05);
  h_ratio->GetYaxis()->SetTickLength(0.05);
  h_ratio->GetXaxis()->SetLabelSize(0.14);
  h_ratio->GetYaxis()->SetLabelSize(0.14);
  h_ratio->GetYaxis()->SetTitleOffset(0.25);
  h_ratio->GetYaxis()->SetNdivisions(504);
  h_ratio->SetLineWidth(2);
//h_ratio->SetStats(0);
//h_ratio->SetMarkerStyle(20);
h_ratio->SetMinimum(0);
h_ratio->SetMaximum(2);
h_ratio->Draw("E");


//datatoMC->Draw("");
TLine *l3 = new TLine(h_ratio->GetXaxis()->GetXmin(), 1.00, h_ratio->GetXaxis()->GetXmax(), 1.00);
l3->SetLineWidth(1);
//l3->SetLineStyle(7);
//l3->Draw();
  h_ratio->Draw("AXISSAMEY+");
   h_ratio->Draw("AXISSAMEX+");

 
c1->Update();

for(unsigned int idx=1; idx<nbin+1; ++idx){
cout<<"MC    "<<"nbin= "<<idx<<"  content= "<<sum_h->GetBinContent(idx)<<endl;
cout<<"signal    "<<"nbin= "<<idx<<"  content= "<<hists[21+5]->GetBinContent(idx)<<endl;
cout<<"Data    "<<"nbin= "<<idx<<"  content= "<<datahists[2]->GetBinContent(idx)<<endl;
}
cout<<"signal Integral   "<<hists[21+5]->Integral()<<endl;

}


if (SB==true){
for(unsigned int idx=0; idx<samples_.size(); ++idx){
SBhists[idx]->Scale(lumi*scales[idx]);}
revDATAhists[3]->Scale(620.32/revDATAhists[3]->Integral());
revDATAhists[3]->Scale(1-wjetscale);
SBhists[1]->Add(revDATAhists[3]);
SBhists[2]->Add(SBhists[1]);
SBhists[4]->Add(SBhists[2]);

for(unsigned int idx=5; idx<samples_.size()-1; ++idx){
   SBhists[idx]->Add(SBhists[idx-1]);}
SBhists[20]->SetMaximum(1.5*datahists[3]->GetMaximum());
SBhists[20]->SetFillColor(kMagenta+2);
SBhists[20]->Draw();
SBhists[18]->SetFillColor(kOrange+4);
SBhists[18]->Draw("same");
SBhists[17]->SetFillColor(kOrange-2);
SBhists[17]->Draw("same");

SBhists[16]->SetFillColor(kRed);
SBhists[16]->Draw("same");
SBhists[15]->SetFillColor(kViolet+1);
SBhists[15]->Draw("same");
SBhists[14]->SetFillColor(kSpring-9);
SBhists[14]->Draw("same");
SBhists[13]->SetFillColor(32);
SBhists[13]->Draw("same");
SBhists[12]->SetFillColor(6);
SBhists[12]->Draw("same");
SBhists[9]->SetFillColor(4);
SBhists[9]->Draw("same");
//hists[8]->SetFillColor(4);
//hists[8]->Draw("same");
//hists[7]->SetFillColor(3);
//hists[7]->Draw("same");
//hists[6]->SetFillColor(3);
//hists[6]->Draw("same");
//hists[5]->SetFillColor(2);
//hists[5]->Draw("same");
//hists[4]->SetFillColor(2);
//hists[4]->Draw("same");
//hists[3]->SetFillColor(5);
//hists[3]->Draw("same");
//datahists[3]->SetFillColor(5);
//datahists[3]->Draw("same");
SBhists[2]->SetFillColor(8);
SBhists[2]->Draw("same");
SBhists[1]->SetFillColor(kOrange+7);
SBhists[1]->Draw("same");
revDATAhists[3]->SetFillColor(7);
revDATAhists[3]->Draw("same");
//hists[0]->SetFillColor(7);
//hists[0]->Draw("same");
SBhists[21]->SetFillColor(1);
SBhists[21]->SetFillStyle(3004);
SBhists[21]->Draw("same");


 // plot data points
datahists[3]->SetLineWidth(3.);
datahists[3]->SetLineColor(kBlack);
datahists[3]->SetMarkerColor(kBlack);
datahists[3]->SetMarkerStyle(20.);
datahists[3]->Draw("esame");
//conv->RedrawAxis();


TLegend* leg = new TLegend(0.60,0.40,0.89,0.87);
  leg->SetFillStyle ( 0);
  leg->SetFillColor ( 0);
  leg->SetBorderSize( 0);
  leg->AddEntry( revDATAhists[2], "W JET"                           , "F");
  leg->AddEntry( SBhists[1], "Z JET"                           , "F");
  leg->AddEntry( SBhists[2], "PH JET"                           , "F");
//  leg->AddEntry( datahists[3], "W PH JET"              , "F");
//  leg->AddEntry( hists[5], "TOP-W-CH"               , "F");
//  leg->AddEntry( hists[5], "T-S-CH"               , "F");
//  leg->AddEntry( hists[7], "TOP-S-CH"               , "F");
//  leg->AddEntry( hists[7], "TTBAR-CH"               , "F");
//  leg->AddEntry( hists[8], "TBAR-W-CH"               , "F");
  leg->AddEntry( SBhists[9], "SINGLE TOP  "               , "F");
  leg->AddEntry( SBhists[12], "TTBAR"               , "F");
  leg->AddEntry( SBhists[13], "TTG"               , "F");
  leg->AddEntry( SBhists[14], "WWG"               , "F");
  leg->AddEntry( SBhists[15], "WW"               , "F");
  leg->AddEntry( SBhists[16], "WZ"               , "F");
  leg->AddEntry( SBhists[17], "ZZ"               , "F");
  leg->AddEntry( SBhists[18], "ZGAMMA"               , "F");
  leg->AddEntry( SBhists[20], "SINGLE TOP+PHOTON"               , "F");
  leg->AddEntry( SBhists[21], "SIGNAL"               , "F");
leg->AddEntry( datahists[3], "CMS Data 2012(19.145/fb)"               , "PL");

  leg->Draw("same");
}
} 
Example #16
0
void drawSinglePtBin(const std::string& fileName, int iPtBin, const std::string& x_axis) {

  int nBins_pt = 23;

  Double_t Lower[nBins_pt];
  Lower[0] = 20.;
  Lower[1] = 25.;
  Lower[2] = 30.;
  Lower[3] = 36.;
  Lower[4] = 42.;
  Lower[5] = 48.;
  Lower[6] = 55.;
  Lower[7] = 62.;
  Lower[8] = 70.;
  Lower[9] = 78.;
  Lower[10] = 87.;
  Lower[11] = 97.;
  Lower[12] = 108.;
  Lower[13] = 121.;
  Lower[14] = 135.;
  Lower[15] = 152.;
  Lower[16] = 172.;
  Lower[17] = 197.;
  Lower[18] = 231.;
  Lower[19] = 283.;
  Lower[20] = 397.;
  Lower[21] = 600.;
  Lower[22] = 1000.;

  Double_t ptMin = Lower[iPtBin];
  Double_t ptMax = Lower[iPtBin+1];

  TFile* file = TFile::Open(fileName.c_str());
 
  std::vector< TH1D* > h1_recoPhot;
  std::vector< TH1D* > h1_recoGen;
  std::vector< TH1D* > h1_genPhot;
  std::vector< TH1D* > h1_pt2ndJetMean;

  Int_t nPoints = 5;


  for( int i=0; i<nPoints; ++i ) {
    char name[100];
    sprintf( name, "ptBin_%d_%d/r_recoPhot_vs_%s_%d_%d", (int)ptMin, (int)ptMax, x_axis.c_str(), iPtBin, i);
    h1_recoPhot.push_back((TH1D*)file->Get(name));
    sprintf( name, "ptBin_%d_%d/r_recoGen_vs_%s_%d_%d", (int)ptMin, (int)ptMax, x_axis.c_str(), iPtBin, i);
    h1_recoGen.push_back((TH1D*)file->Get(name));
    sprintf( name, "ptBin_%d_%d/r_genPhot_vs_%s_%d_%d", (int)ptMin, (int)ptMax, x_axis.c_str(), iPtBin, i);
    h1_genPhot.push_back((TH1D*)file->Get(name));
    if( x_axis=="reco" )
      sprintf( name, "ptBin_%d_%d/pt2ndJetRecoMean_%d_%d", (int)ptMin, (int)ptMax, iPtBin, i);
    else if ( x_axis=="gen" )
      sprintf( name, "ptBin_%d_%d/pt2ndJetGenMean_%d_%d", (int)ptMin, (int)ptMax, iPtBin, i);
    else if ( x_axis=="recoRel" )
      sprintf( name, "ptBin_%d_%d/pt2ndJetRecoRelMean_%d_%d", (int)ptMin, (int)ptMax, iPtBin, i);
    else if ( x_axis=="genRel" )
      sprintf( name, "ptBin_%d_%d/pt2ndJetGenRelMean_%d_%d", (int)ptMin, (int)ptMax, iPtBin, i);
    h1_pt2ndJetMean.push_back((TH1D*)file->Get(name));
  }

  Float_t x[nPoints];
  Float_t x_err[nPoints];

  Float_t y_recoPhot[nPoints];
  Float_t y_recoPhot_err[nPoints];

  Float_t y_recoGen[nPoints];
  Float_t y_recoGen_err[nPoints];

  Float_t y_genPhot[nPoints];
  Float_t y_genPhot_err[nPoints];

  for( int i =0; i<nPoints; ++i ) {
    x[i] = h1_pt2ndJetMean[i]->GetMean();
    x_err[i] =  h1_pt2ndJetMean[i]->GetRMS()/sqrt((Float_t)h1_pt2ndJetMean[i]->GetEntries());
  }


  fillFromHistos( nPoints, y_recoPhot, y_recoPhot_err, h1_recoPhot);
  fillFromHistos( nPoints, y_recoGen, y_recoGen_err, h1_recoGen);
  fillFromHistos( nPoints, y_genPhot, y_genPhot_err, h1_genPhot);


  TGraphErrors* gr_recoPhot = new TGraphErrors(nPoints, x, y_recoPhot, x_err, y_recoPhot_err);
  gr_recoPhot->SetMarkerStyle(20);
  gr_recoPhot->SetMarkerColor(kRed);

  TGraphErrors* gr_recoGen = new TGraphErrors(nPoints, x, y_recoGen, x_err, y_recoGen_err);
  gr_recoGen->SetMarkerStyle(21);
  gr_recoGen->SetMarkerColor(kBlue);

  TGraphErrors* gr_genPhot = new TGraphErrors(nPoints, x, y_genPhot, x_err, y_genPhot_err);
  gr_genPhot->SetMarkerStyle(22);
  gr_genPhot->SetMarkerColor(kBlack);

  TF1* line1 = new TF1("line1", "[0] + x*[1]");
  line1->SetRange(0., 30.);
  Double_t x1, x2, y1, y2;
  Int_t ii;
  ii = gr_genPhot->GetPoint(1, x1, y1);
  ii = gr_genPhot->GetPoint(2, x2, y2);
  line1->SetParameter(0, 0.);
  line1->SetParameter(1, (y2-y1)/(x2-x1));
  line1->SetLineWidth(0.5);
  gr_genPhot->Fit(line1, "RQ");

  TF1* line2 = new TF1("line2", "[0] + x*[1]");
  line2->SetRange(0., 30.);
  ii = gr_recoGen->GetPoint(1, x1, y1);
  ii = gr_recoGen->GetPoint(2, x2, y2);
  line2->SetParameter(0, y1);
  line2->SetParameter(1, (y2-y1)/(x2-x1));
  line2->SetLineWidth(0.5);
  line2->SetLineColor(kBlue);
  gr_recoGen->Fit(line2, "RQ");

  TF1* sum = new TF1("sum", "sqrt( line1*line1 + line2*line2 )");
  sum->SetRange(0., 30.);
  //sum->SetLineWidth(1.);
  sum->SetLineColor(kGray+2);

  TF1* fit_recoPhot = new TF1("fit_recoPhot", "sqrt([0]+[1]*x*x)");
  fit_recoPhot->SetRange(0., 30.);
  fit_recoPhot->SetParameter(0, y1*y1);
  fit_recoPhot->SetLineColor(kRed);
  fit_recoPhot->SetLineWidth(0.5);
  gr_recoPhot->Fit(fit_recoPhot, "RQ");

  Float_t ymax=0.5;
  if( iPtBin>12 )
    ymax = 0.25;


  std::string xTitle;
  if( x_axis=="reco" )
    xTitle = "p_{T}^{2ndJet reco} [GeV/c]";
  else if( x_axis=="gen" )
    xTitle = "p_{T}^{2ndJet gen} [GeV/c]";
  else if( x_axis=="recoRel" )
    xTitle = "p_{T}^{2ndJet reco}/p_{T}^{#gamma} [%]";
  else if( x_axis=="genRel" )
    xTitle = "p_{T}^{2ndJet gen}/p_{T}^{#gamma} [%]";

  TH2D* h2_aux = new TH2D("aux", "", 10, 0., 35., 10, 0., ymax);
  h2_aux->SetXTitle(xTitle.c_str());
  h2_aux->GetXaxis()->SetTitleOffset(1.1);
  h2_aux->SetYTitle("resolution [%]");
  h2_aux->GetYaxis()->SetTitleOffset(1.2);

  TLegend* legend = new TLegend(0.2, 0.6, 0.45, 0.85);
  legend->SetTextSize(0.04);
  legend->SetFillStyle(0);
  legend->SetFillColor(kWhite);
  legend->AddEntry(gr_recoGen, "Intrinsic", "P");
  legend->AddEntry(gr_genPhot, "FSR", "P");
  legend->AddEntry(gr_recoPhot, "#gamma + jet", "P");
  legend->AddEntry(sum, "Intr. #oplus FSR", "L");

  char labeltext[50];
  sprintf(labeltext, "%d < p_{T}^{#gamma} < %d GeV/c", (int)ptMin, (int)ptMax);  


  TPaveText* label = new TPaveText(0.67, 0.83, 0.8, 0.86, "brNDC");
  label->SetFillColor(kWhite);
  label->SetTextSize(0.035);
  label->AddText(labeltext);

  TCanvas* c1 = new TCanvas("c1", "c1", 800, 600);
  c1->cd();
  h2_aux->Draw();
  sum->Draw("same");
  gr_recoPhot->Draw("Psame");
  gr_recoGen->Draw("Psame");
  gr_genPhot->Draw("Psame");
  legend->Draw("same");
  label->Draw("same");


  char canvasName[100];
  sprintf(canvasName, "secondJetPlots/ptBin_%d_%d_%s.png", (int)ptMin, (int)ptMax, x_axis.c_str());
  c1->SaveAs(canvasName);
  delete c1;

  file->Close();

}
Example #17
0
void simple_overlay()
{ //open function bracket




const int num_hists = 43;
TH1F *first_histogram[num_hists];
TH1F *second_histogram[num_hists]; 
string first_hname[num_hists]= {
"Energy_Positron","Energy_Neutrino", "Energy_First_a01", "Energy_Second_a01", "Energy_Tau_1", "Energy_Tau_2", "Energy_Tau_3", "Energy_Tau_4",
"PT_Positron","PT_Neutrino", "PT_First_a01", "PT_Second_a01", "PT_Tau_1", "PT_Tau_2", "PT_Tau_3", "PT_Tau_4",
"Eta_Tau_1","Eta_Tau_2", "Eta_Tau_3", "Eta_Tau_4",
"DeltaEta_Tau_12", "DeltaEta_Tau_13", "DeltaEta_Tau_14", "DeltaEta_Tau_23", "DeltaEta_Tau_24", "DeltaEta_Tau_34",
"DeltaPhi_Tau_12", "DeltaPhi_Tau_13", "DeltaPhi_Tau_14", "DeltaPhi_Tau_23", "DeltaPhi_Tau_24", "DeltaPhi_Tau_34",
"DeltaR_Tau_12", "DeltaR_Tau_13", "DeltaR_Tau_14", "DeltaR_Tau_23", "DeltaR_Tau_24", "DeltaR_Tau_34",
"Invariant_Mass_Pair12", "Invariant_Mass_Pair14", "Invariant_Mass_Pair32", "Invariant_Mass_Pair34", "Invariant_Mass_4_Taus"};          // enter info for histograms here 
string second_hname[num_hists]= {
"energy_ele_hist","energy_nu_hist","energy_a1_hist","energy_a2_hist","energy_tau1_hist","energy_tau2_hist","energy_tau3_hist", "energy_tau4_hist",
"pT_ele_hist","pT_nu_hist","pT_a1_hist","pT_a2_hist","pT_tau1_hist","pT_tau2_hist","pT_tau3_hist", "pT_tau4_hist",
"eta_tau1", "eta_tau2", "eta_tau3", "eta_tau4",
"deleta_tau12", "deleta_tau13", "deleta_tau14", "deleta_tau23", "deleta_tau24", "deleta_tau34",
"delphi_tau12", "delphi_tau13", "delphi_tau14", "delphi_tau23", "delphi_tau24", "delphi_tau34",
"delR_tau12", "delR_tau13", "delR_tau14", "delR_tau23", "delR_tau24", "delR_tau34",
"mass_12", "mass_14", "mass_32", "mass_34", "mass_1234"};

TFile *first_file = new TFile("Entries_3000_Histograms_h01_115_a01_9.root"); //put name of one file here
TFile *second_file = new TFile("KinematicsPlots_NewBinning.root"); //put name of other file here


for (int i=0; i < num_hists; i++)
	{
	TIter next(first_file->GetListOfKeys());
	TKey *key;
	string hName;

		while((key=(TKey*)next()))
			{	
			hName = key->GetName();
	
			if  (hName.find(first_hname[i]) != -1) 
				{
				first_histogram[i] = (TH1F*)(first_file->Get(hName.c_str()));
				cout << "first_hname[" << i << "]" << first_hname[i] << endl;
				break;
				}		
			}

	TIter next(second_file->GetListOfKeys());

		while((key=(TKey*)next()))
			{
			hName = key->GetName();
		
			if  (hName.find(second_hname[i]) != -1) 
				{
				second_histogram[i] = (TH1F*)(second_file->Get(hName.c_str()));
			cout << "second_hname[" << i << "]" << first_hname[i] << endl;
				break;				
				}					
			}

	TCanvas *c1 = new TCanvas();
	double statXstart[5] = {.8,.8,.8,.8,.8};  
	double statXend[5] = {1.,1.,1.,1.,1.};
	double statYstart[5] = {.80,.70,.60,.50,.40};
	double statYend[5] = {.70,.60,.50,.40,.30};
	Color_t color_array[15] = {kBlue+1,kRed+0,kViolet,kAzure+10,kGreen+2,kBlue+1,kRed+0,kViolet,kAzure+10,kGreen+2,kBlue+1,kRed+0,kViolet,kAzure+10,kGreen+2};
	size_t name_length;
	TPaveText *title = new TPaveText(0.306092,0.9390678,0.693908,0.995,"blNDC");
	gStyle->SetOptTitle(0);
	title->SetBorderSize(0);
	title->SetFillColor(kWhite);
	title->SetTextFont(42);
	TPaveStats *st;	
	
		string directory = "Francesca_Overlaid_Tau_Histograms";
		gSystem->MakeDirectory(directory.c_str());
		directory = directory + "/";

		c1->cd();
		gStyle->SetOptStat("nmre");
		gStyle->SetStatH(0.03);
		gStyle->SetStatW(0.20);

		//TH1F *first_histogram = new TH1F(first_histogram_title, first_histogram_title, 200, 0., 500);
		//TH1F *second_histogram = new TH1F(second_histogram_title, second_histogram_title, 200, 0., 500);	

		first_histogram[i]->SetLineColor(color_array[0]);
		first_histogram[i]->SetLineWidth(2);
	 	first_histogram[i]->SetTitle(first_hname[i].c_str());	// WHAT DOES THIS DO?	eg. does it just set the name for hist title, or also for legend title?
		first_histogram[i]->SetName(first_hname[i].c_str()); // WHAT DOES THIS DO? eg. does it just set name for legend title?
		first_histogram[i]->Draw();
	
		gPad->Update();	
	
		st = (TPaveStats*)first_histogram[i]->FindObject("stats");
		st->SetX1NDC(statXstart[0]); 
		st->SetX2NDC(statXend[0]);
		st->SetY1NDC(statYstart[0]); 
		st->SetY2NDC(statYend[0]);


		second_histogram[i]->SetLineColor(color_array[1]);
		second_histogram[i]->SetLineWidth(2);
		second_histogram[i]->SetTitle(second_hname[i].c_str()); 
		second_histogram[i]->SetName(second_hname[i].c_str());
		second_histogram[i]->Draw("sames");
	
		gPad->Update();		

		st = (TPaveStats*)second_histogram[i]->FindObject("stats");		
		st->SetX1NDC(statXstart[1]); 
		st->SetX2NDC(statXend[1]);
		st->SetY1NDC(statYstart[1]); 
		st->SetY2NDC(statYend[1]);				
		
		c1->BuildLegend(.85,.8,1.,1.);
		c1->SetTitle("Dwarves");
		title->Clear(); //this clears the title for the histogram
		title->AddText((first_hname[i]).c_str()); //this adds text to the TPaveText box that we created before the loop
		title->Draw(); //this draws the TPaveText box with the new text... e.g. it makes our new title
	
		c1->SaveAs((directory + first_hname[i] + ".png").c_str());
	} //close for loop

} //close function bracket
TPaveText* RDK2AnalysisPlotter::makeTitleBox(CoDet detType)
{
    TString line;
    TPaveText* titleBox = new TPaveText(.00,.0,1,1,"NDC");
    titleBox->SetFillColor(kWhite);
    titleBox->SetLineColor(kWhite);
    titleBox->SetTextAlign(11);
    titleBox->SetTextFont(102);

    //Make outline for title
//    TBox* theBox;
//    int numLines=getTitleBoxLines( detType);
//    int numLinesPerExpAnalysis;
//    int numLinesPerMCAnalysis;
//    int currentLine=0;
//    double y0, y1;
//    if(detType!=DET_EP)
//    {
//        numLinesPerExpAnalysis=4;
//        numLinesPerMCAnalysis=3;
//    }
//    else
//    {
//        numLinesPerExpAnalysis=2;
//        numLinesPerMCAnalysis=2;
//    }

//    y0=1.-1/(double)numLines;
//    y1=1;
//    theBox=titleBox->AddBox(0,y0,1.,y1);
//    theBox->SetFillStyle(0);

//    titleBox->AddText("");

    TString coTypeString;
    if(detType==DET_EP)
    {
        coTypeString="EP";
    }
    else if(detType==DET_EPG)
    {
        coTypeString="EPG (BGO)";
    }
    else if(detType==DET_EPBG)
    {
        coTypeString="EPBG (BAPD)";
    }
    double answer,error;
    titleBox->AddText("Title: "+titleString+"  Coincidence: "+coTypeString+"  Date made: "+getCurrentDateString());
    for (int i = 0;i< numExp;i++)
    {
//        y0=y0-numLinesPerExpAnalysis/(double) numLines;
//        y1=y0;
//        theBox=titleBox->AddBox(0,y0,1,y1);
//        theBox->SetFillStyle(0);

        int theColor=colorList[(i+4)%GRAPHICS_NUM_TYPES];
        line="#color["+int2str(theColor)+"]{";
        line+=TString("Exp: ") + exp[i]->GetName()+" \"" + exp[i]->GetTitle() + "\" " + exp[i]->GetPIDString()+" " + exp[i]->GetGroupString();
        line+=TString("  EP Counts: ") + int2str(exp[i]->GetEPCounts());
        line+="}";
    	titleBox->AddText(line);

    	if(detType==DET_EPG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=exp[i]->GetEPGCounts(error);
            line+=TString("     EPG Counts: ") + int2str((int) (answer+0.5))+" #pm " + int2str((int) (error+0.5));
            answer=exp[i]->GetEPGPerEP(error);
            line+=TString("  #frac{EPG}{EP}: ") + d2str(answer,2,2)+" #pm " + d2str(error,1,2) +" (#pm"+d2str(error*100./answer,1,1)+"%)";
            line +="}";
            titleBox->AddText(line);
        }
        else if(detType==DET_EPBG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=exp[i]->GetEPBGCounts(error);
            line+=TString("     EPBG Counts: ") + int2str((int) (answer+0.5))+" #pm " + int2str((int) (error+0.5));
            answer=exp[i]->GetEPBGPerEP(error);
            line+=TString("  #frac{EPBG}{EP}: ") + d2str(answer,2,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            line +="}";
            titleBox->AddText(line);
        }
        //Third Line
        if(detType != DET_EP)
        {
            line="#color["+int2str(theColor)+"]{";
            line+="     Prepeak BG Window: ["+d2str(exp[i]->GetWindowVal(detType,0))+","+d2str(exp[i]->GetWindowVal(detType,1))+"]";
            line+=" Peak Window: ["+d2str(exp[i]->GetWindowVal(detType,2))+","+d2str(exp[i]->GetWindowVal(detType,3))+"] ";
            line+=" Postpeak BG Window: ["+d2str(exp[i]->GetWindowVal(detType,4))+","+d2str(exp[i]->GetWindowVal(detType,5))+"] ";
            line +="}";
            titleBox->AddText(line);
        }

        //Fourth Line
        line="#color["+int2str(theColor)+"]{";
        line+="     "+exp[i]->GetCutSet().GetDisplayString( detType);
        line +="}";
        titleBox->AddText(line);


    }

    //Plot MC
    for (int i = 0;i< numMC;i++)
    {
//        y0=y0-numLinesPerMCAnalysis/(double) numLines;
//        y1=y0;
//        theBox=titleBox->AddBox(0,y0,1,y1);
//        theBox->SetFillStyle(0);
//        currentLine+=numLinesPerMCAnalysis;

        int theColor=colorList[(i)%GRAPHICS_NUM_TYPES];
        //First MC Line
        line="#color["+int2str(theColor)+"]{";
        line+=TString("MC: ") + mc[i]->GetName()+" \"" + mc[i]->GetTitle() + "\"";
        line+=" P_{3}"+mc[i]->GetP3ID()(3,3)+" E_{3}"+mc[i]->GetE3ID()(3,3);
        if(detType==DET_EPG || detType==DET_EPBG)
        {
            line+=" P_{4}"+mc[i]->GetP4ID()(3,3)+" E_{4}"+mc[i]->GetE4ID()(3,3)+" G_{4}"+mc[i]->GetG4ID()(3,3);
        }
        answer=mc[i]->GetEPPer3Decay(error);
    	line+=TString("  EP per 3 Decay: ") + d2str(answer,5,1)+" #pm " + d2str(error,5,1);
        line +="}";
    	titleBox->AddText(line);

    	//Second MC Line

    	if(detType==DET_EPG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=mc[i]->GetEPGPer4Decay(error);
            line+=TString("    EPG per 4 Decay: ") + d2str(answer,6,1)+" #pm " + d2str(error,6,1);
            answer=mc[i]->GetEPGPerEP(error);
            line+=TString("  #frac{EPG}{EP}: ") + d2str(answer,3,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            if(numExp>0)
            {
                double expAnswer,expError;
                double mcAnswer, mcError;
                expAnswer=exp[0]->GetEPGPerEP(expError); mcAnswer=mc[i]->GetEPGPerEP(mcError);
                answer=(expAnswer/mcAnswer)-1;
                error=getBasicErrorProgation(expAnswer,mcAnswer,expError,mcError,DIVISION);
                line+=TString("  #frac{Exp - MC}{MC}: ") +d2str(answer*100,1,1)+"% #pm " + d2str(error*100,1,1)+"%";
            }
            line +="}";
            titleBox->AddText(line);
        }
        else if(detType==DET_EPBG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=mc[i]->GetEPBGPer4Decay(error);
            line+=TString("    EPBG per 4 Decay: ") + d2str(answer,6,1)+" #pm " + d2str(error,6,1);
            answer=mc[i]->GetEPBGPerEP(error);
            line+=TString("  #frac{EPBG}{EP}: ") + d2str(answer,3,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            if(numExp>0)
            {
                double expAnswer,expError;
                double mcAnswer, mcError;
                expAnswer=exp[0]->GetEPGPerEP(expError); mcAnswer=mc[i]->GetEPGPerEP(mcError);
                answer=(expAnswer/mcAnswer)-1;
                error=getBasicErrorProgation(expAnswer,mcAnswer,expError,mcError,DIVISION);
                line+=TString("  #frac{Exp - MC}{MC}: ") +d2str(answer*100,1,1)+"% #pm " + d2str(error*100,1,1)+"%";
            }
            line +="}";
            titleBox->AddText(line);
        }
        //Third Line
        line="#color["+int2str(theColor)+"]{";
        line+="    "+mc[i]->GetCutSet().GetDisplayString( detType);
        line +="}";
        titleBox->AddText(line);

    }



    return titleBox;
}
void TracktoLCTXY_2015all_sameYrange_fullIntegral()
{
//=========Macro generated from canvas: TracktoLCTXY/TracktoLCTXY
//=========  (Fri Aug  5 09:06:01 2016) by ROOT version6.06/01
   TCanvas *TracktoLCTXY = new TCanvas("TracktoLCTXY", "TracktoLCTXY",0,0,500,500);
   gStyle->SetOptStat(0);
   TracktoLCTXY->SetHighLightColor(2);
   TracktoLCTXY->Range(-5,-2.123713,45,2.123713);
   TracktoLCTXY->SetFillColor(0);
   TracktoLCTXY->SetBorderMode(0);
   TracktoLCTXY->SetBorderSize(2);
   TracktoLCTXY->SetLogy();
   TracktoLCTXY->SetFrameBorderMode(0);
   TracktoLCTXY->SetFrameBorderMode(0);
   
   TH1D *TracktoLCTXY_1__31 = new TH1D("TracktoLCTXY_1__31","TracktoLCTXY",100,0,40);
   TracktoLCTXY_1__31->SetBinContent(0,409.6136);
   TracktoLCTXY_1__31->SetBinContent(1,11.40611);
   TracktoLCTXY_1__31->SetBinContent(2,17.55562);
   TracktoLCTXY_1__31->SetBinContent(3,16.61672);
   TracktoLCTXY_1__31->SetBinContent(4,12.72111);
   TracktoLCTXY_1__31->SetBinContent(5,5.882313);
   TracktoLCTXY_1__31->SetBinContent(6,2.469679);
   TracktoLCTXY_1__31->SetBinContent(7,1.726272);
   TracktoLCTXY_1__31->SetBinContent(8,1.478696);
   TracktoLCTXY_1__31->SetBinContent(9,1.298086);
   TracktoLCTXY_1__31->SetBinContent(10,1.192562);
   TracktoLCTXY_1__31->SetBinContent(11,1.101243);
   TracktoLCTXY_1__31->SetBinContent(12,0.9334858);
   TracktoLCTXY_1__31->SetBinContent(13,0.9253685);
   TracktoLCTXY_1__31->SetBinContent(14,0.892223);
   TracktoLCTXY_1__31->SetBinContent(15,0.7292012);
   TracktoLCTXY_1__31->SetBinContent(16,0.6365291);
   TracktoLCTXY_1__31->SetBinContent(17,0.6541165);
   TracktoLCTXY_1__31->SetBinContent(18,0.6744096);
   TracktoLCTXY_1__31->SetBinContent(19,0.6547929);
   TracktoLCTXY_1__31->SetBinContent(20,0.6236767);
   TracktoLCTXY_1__31->SetBinContent(21,0.6175888);
   TracktoLCTXY_1__31->SetBinContent(22,0.6121773);
   TracktoLCTXY_1__31->SetBinContent(23,0.6060893);
   TracktoLCTXY_1__31->SetBinContent(24,0.5864726);
   TracktoLCTXY_1__31->SetBinContent(25,0.548592);
   TracktoLCTXY_1__31->SetBinContent(26,0.5404747);
   TracktoLCTXY_1__31->SetBinContent(27,0.5052999);
   TracktoLCTXY_1__31->SetBinContent(28,0.5107114);
   TracktoLCTXY_1__31->SetBinContent(29,0.5262695);
   TracktoLCTXY_1__31->SetBinContent(30,0.476213);
   TracktoLCTXY_1__31->SetBinContent(31,0.4816245);
   TracktoLCTXY_1__31->SetBinContent(32,0.4958298);
   TracktoLCTXY_1__31->SetBinContent(33,0.4565963);
   TracktoLCTXY_1__31->SetBinContent(34,0.4938004);
   TracktoLCTXY_1__31->SetBinContent(35,0.4471261);
   TracktoLCTXY_1__31->SetBinContent(36,0.4281859);
   TracktoLCTXY_1__31->SetBinContent(37,0.3936875);
   TracktoLCTXY_1__31->SetBinContent(38,0.3463367);
   TracktoLCTXY_1__31->SetBinContent(39,0.4038341);
   TracktoLCTXY_1__31->SetBinContent(40,0.3848938);
   TracktoLCTXY_1__31->SetBinContent(41,0.3591891);
   TracktoLCTXY_1__31->SetBinContent(42,0.3463367);
   TracktoLCTXY_1__31->SetBinContent(43,0.298986);
   TracktoLCTXY_1__31->SetBinContent(44,0.3470132);
   TracktoLCTXY_1__31->SetBinContent(45,0.3071033);
   TracktoLCTXY_1__31->SetBinContent(46,0.2827515);
   TracktoLCTXY_1__31->SetBinContent(47,0.2807222);
   TracktoLCTXY_1__31->SetBinContent(48,0.2678698);
   TracktoLCTXY_1__31->SetBinContent(49,0.2482531);
   TracktoLCTXY_1__31->SetBinContent(50,0.2408123);
   TracktoLCTXY_1__31->SetBinContent(51,0.2360772);
   TracktoLCTXY_1__31->SetBinContent(52,0.2516353);
   TracktoLCTXY_1__31->SetBinContent(53,0.2516353);
   TracktoLCTXY_1__31->SetBinContent(54,0.2117254);
   TracktoLCTXY_1__31->SetBinContent(55,0.2137547);
   TracktoLCTXY_1__31->SetBinContent(56,0.2137547);
   TracktoLCTXY_1__31->SetBinContent(57,0.1866972);
   TracktoLCTXY_1__31->SetBinContent(58,0.1853443);
   TracktoLCTXY_1__31->SetBinContent(59,0.1954909);
   TracktoLCTXY_1__31->SetBinContent(60,0.18805);
   TracktoLCTXY_1__31->SetBinContent(61,0.1900793);
   TracktoLCTXY_1__31->SetBinContent(62,0.1657275);
   TracktoLCTXY_1__31->SetBinContent(63,0.1657275);
   TracktoLCTXY_1__31->SetBinContent(64,0.1298763);
   TracktoLCTXY_1__31->SetBinContent(65,0.1697862);
   TracktoLCTXY_1__31->SetBinContent(66,0.1569338);
   TracktoLCTXY_1__31->SetBinContent(67,0.1589632);
   TracktoLCTXY_1__31->SetBinContent(68,0.1569338);
   TracktoLCTXY_1__31->SetBinContent(69,0.1339349);
   TracktoLCTXY_1__31->SetBinContent(70,0.1542281);
   TracktoLCTXY_1__31->SetBinContent(71,0.1447579);
   TracktoLCTXY_1__31->SetBinContent(72,0.1379935);
   TracktoLCTXY_1__31->SetBinContent(73,0.1258176);
   TracktoLCTXY_1__31->SetBinContent(74,0.1244648);
   TracktoLCTXY_1__31->SetBinContent(75,0.1434051);
   TracktoLCTXY_1__31->SetBinContent(76,0.1258176);
   TracktoLCTXY_1__31->SetBinContent(77,0.1136417);
   TracktoLCTXY_1__31->SetBinContent(78,0.1298763);
   TracktoLCTXY_1__31->SetBinContent(79,0.1488166);
   TracktoLCTXY_1__31->SetBinContent(80,0.1055245);
   TracktoLCTXY_1__31->SetBinContent(81,0.1210826);
   TracktoLCTXY_1__31->SetBinContent(82,0.1102595);
   TracktoLCTXY_1__31->SetBinContent(83,0.1258176);
   TracktoLCTXY_1__31->SetBinContent(84,0.1258176);
   TracktoLCTXY_1__31->SetBinContent(85,0.1082302);
   TracktoLCTXY_1__31->SetBinContent(86,0.08793706);
   TracktoLCTXY_1__31->SetBinContent(87,0.104848);
   TracktoLCTXY_1__31->SetBinContent(88,0.1095831);
   TracktoLCTXY_1__31->SetBinContent(89,0.09470145);
   TracktoLCTXY_1__31->SetBinContent(90,0.0919957);
   TracktoLCTXY_1__31->SetBinContent(91,0.1149946);
   TracktoLCTXY_1__31->SetBinContent(92,0.09334858);
   TracktoLCTXY_1__31->SetBinContent(93,0.09673077);
   TracktoLCTXY_1__31->SetBinContent(94,0.09334858);
   TracktoLCTXY_1__31->SetBinContent(95,0.08117267);
   TracktoLCTXY_1__31->SetBinContent(96,0.08387843);
   TracktoLCTXY_1__31->SetBinContent(97,0.09470145);
   TracktoLCTXY_1__31->SetBinContent(98,0.0798198);
   TracktoLCTXY_1__31->SetBinContent(99,0.08049624);
   TracktoLCTXY_1__31->SetBinContent(100,0.07170253);
   TracktoLCTXY_1__31->SetBinContent(101,10.3529);
   TracktoLCTXY_1__31->SetMinimum(0.02);
   TracktoLCTXY_1__31->SetMaximum(50);
   TracktoLCTXY_1__31->SetEntries(768682);
   TracktoLCTXY_1__31->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   TracktoLCTXY_1__31->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   TracktoLCTXY_1__31->SetMarkerColor(ci);
   TracktoLCTXY_1__31->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_1__31->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_1__31->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTXY_2__32 = new TH1D("TracktoLCTXY_2__32","TracktoLCTXY",100,0,40);
   TracktoLCTXY_2__32->SetBinContent(0,276.7665);
   TracktoLCTXY_2__32->SetBinContent(1,11.52093);
   TracktoLCTXY_2__32->SetBinContent(2,20.6555);
   TracktoLCTXY_2__32->SetBinContent(3,19.30483);
   TracktoLCTXY_2__32->SetBinContent(4,14.79244);
   TracktoLCTXY_2__32->SetBinContent(5,7.642031);
   TracktoLCTXY_2__32->SetBinContent(6,3.450872);
   TracktoLCTXY_2__32->SetBinContent(7,2.14178);
   TracktoLCTXY_2__32->SetBinContent(8,1.598793);
   TracktoLCTXY_2__32->SetBinContent(9,1.359368);
   TracktoLCTXY_2__32->SetBinContent(10,1.15174);
   TracktoLCTXY_2__32->SetBinContent(11,0.9867786);
   TracktoLCTXY_2__32->SetBinContent(12,0.8112185);
   TracktoLCTXY_2__32->SetBinContent(13,0.6647371);
   TracktoLCTXY_2__32->SetBinContent(14,0.5582053);
   TracktoLCTXY_2__32->SetBinContent(15,0.5402688);
   TracktoLCTXY_2__32->SetBinContent(16,0.4187898);
   TracktoLCTXY_2__32->SetBinContent(17,0.4068322);
   TracktoLCTXY_2__32->SetBinContent(18,0.3807427);
   TracktoLCTXY_2__32->SetBinContent(19,0.3532945);
   TracktoLCTXY_2__32->SetBinContent(20,0.3187803);
   TracktoLCTXY_2__32->SetBinContent(21,0.2924191);
   TracktoLCTXY_2__32->SetBinContent(22,0.3163344);
   TracktoLCTXY_2__32->SetBinContent(23,0.2704062);
   TracktoLCTXY_2__32->SetBinContent(24,0.253285);
   TracktoLCTXY_2__32->SetBinContent(25,0.2655144);
   TracktoLCTXY_2__32->SetBinContent(26,0.2396967);
   TracktoLCTXY_2__32->SetBinContent(27,0.2562744);
   TracktoLCTXY_2__32->SetBinContent(28,0.2369791);
   TracktoLCTXY_2__32->SetBinContent(29,0.2421426);
   TracktoLCTXY_2__32->SetBinContent(30,0.2261085);
   TracktoLCTXY_2__32->SetBinContent(31,0.2315438);
   TracktoLCTXY_2__32->SetBinContent(32,0.2125202);
   TracktoLCTXY_2__32->SetBinContent(33,0.2323591);
   TracktoLCTXY_2__32->SetBinContent(34,0.2163249);
   TracktoLCTXY_2__32->SetBinContent(35,0.2212167);
   TracktoLCTXY_2__32->SetBinContent(36,0.2117049);
   TracktoLCTXY_2__32->SetBinContent(37,0.2016496);
   TracktoLCTXY_2__32->SetBinContent(38,0.2242061);
   TracktoLCTXY_2__32->SetBinContent(39,0.1986602);
   TracktoLCTXY_2__32->SetBinContent(40,0.1926814);
   TracktoLCTXY_2__32->SetBinContent(41,0.2019214);
   TracktoLCTXY_2__32->SetBinContent(42,0.1644178);
   TracktoLCTXY_2__32->SetBinContent(43,0.2049108);
   TracktoLCTXY_2__32->SetBinContent(44,0.1877896);
   TracktoLCTXY_2__32->SetBinContent(45,0.1693096);
   TracktoLCTXY_2__32->SetBinContent(46,0.1684943);
   TracktoLCTXY_2__32->SetBinContent(47,0.1695813);
   TracktoLCTXY_2__32->SetBinContent(48,0.1663202);
   TracktoLCTXY_2__32->SetBinContent(49,0.1820825);
   TracktoLCTXY_2__32->SetBinContent(50,0.1565366);
   TracktoLCTXY_2__32->SetBinContent(51,0.1535472);
   TracktoLCTXY_2__32->SetBinContent(52,0.1434919);
   TracktoLCTXY_2__32->SetBinContent(53,0.1342519);
   TracktoLCTXY_2__32->SetBinContent(54,0.1424048);
   TracktoLCTXY_2__32->SetBinContent(55,0.1483837);
   TracktoLCTXY_2__32->SetBinContent(56,0.1429484);
   TracktoLCTXY_2__32->SetBinContent(57,0.1217507);
   TracktoLCTXY_2__32->SetBinContent(58,0.1168589);
   TracktoLCTXY_2__32->SetBinContent(59,0.1236531);
   TracktoLCTXY_2__32->SetBinContent(60,0.1266425);
   TracktoLCTXY_2__32->SetBinContent(61,0.1155001);
   TracktoLCTXY_2__32->SetBinContent(62,0.1260989);
   TracktoLCTXY_2__32->SetBinContent(63,0.1032707);
   TracktoLCTXY_2__32->SetBinContent(64,0.1108801);
   TracktoLCTXY_2__32->SetBinContent(65,0.1008248);
   TracktoLCTXY_2__32->SetBinContent(66,0.1084342);
   TracktoLCTXY_2__32->SetBinContent(67,0.09104127);
   TracktoLCTXY_2__32->SetBinContent(68,0.09729186);
   TracktoLCTXY_2__32->SetBinContent(69,0.1013683);
   TracktoLCTXY_2__32->SetBinContent(70,0.1027272);
   TracktoLCTXY_2__32->SetBinContent(71,0.09022597);
   TracktoLCTXY_2__32->SetBinContent(72,0.08451891);
   TracktoLCTXY_2__32->SetBinContent(73,0.07392007);
   TracktoLCTXY_2__32->SetBinContent(74,0.08261655);
   TracktoLCTXY_2__32->SetBinContent(75,0.07908361);
   TracktoLCTXY_2__32->SetBinContent(76,0.06576712);
   TracktoLCTXY_2__32->SetBinContent(77,0.08696479);
   TracktoLCTXY_2__32->SetBinContent(78,0.06033183);
   TracktoLCTXY_2__32->SetBinContent(79,0.07337654);
   TracktoLCTXY_2__32->SetBinContent(80,0.07337654);
   TracktoLCTXY_2__32->SetBinContent(81,0.07826831);
   TracktoLCTXY_2__32->SetBinContent(82,0.07663772);
   TracktoLCTXY_2__32->SetBinContent(83,0.07364831);
   TracktoLCTXY_2__32->SetBinContent(84,0.05951653);
   TracktoLCTXY_2__32->SetBinContent(85,0.05761418);
   TracktoLCTXY_2__32->SetBinContent(86,0.06603889);
   TracktoLCTXY_2__32->SetBinContent(87,0.07174595);
   TracktoLCTXY_2__32->SetBinContent(88,0.063593);
   TracktoLCTXY_2__32->SetBinContent(89,0.05815771);
   TracktoLCTXY_2__32->SetBinContent(90,0.06848477);
   TracktoLCTXY_2__32->SetBinContent(91,0.0690283);
   TracktoLCTXY_2__32->SetBinContent(92,0.05380947);
   TracktoLCTXY_2__32->SetBinContent(93,0.06033183);
   TracktoLCTXY_2__32->SetBinContent(94,0.04946123);
   TracktoLCTXY_2__32->SetBinContent(95,0.05707065);
   TracktoLCTXY_2__32->SetBinContent(96,0.05217888);
   TracktoLCTXY_2__32->SetBinContent(97,0.05870124);
   TracktoLCTXY_2__32->SetBinContent(98,0.05054829);
   TracktoLCTXY_2__32->SetBinContent(99,0.06196241);
   TracktoLCTXY_2__32->SetBinContent(100,0.06033183);
   TracktoLCTXY_2__32->SetBinContent(101,4.113435);
   TracktoLCTXY_2__32->SetEntries(1401505);
   TracktoLCTXY_2__32->SetStats(0);

   ci = TColor::GetColor("#ff9999");
   TracktoLCTXY_2__32->SetLineColor(ci);

   ci = TColor::GetColor("#ff9999");
   TracktoLCTXY_2__32->SetMarkerColor(ci);
   TracktoLCTXY_2__32->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_2__32->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_2__32->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTXY_3__33 = new TH1D("TracktoLCTXY_3__33","TracktoLCTXY",100,0,40);
   TracktoLCTXY_3__33->SetBinContent(0,88.51608);
   TracktoLCTXY_3__33->SetBinContent(1,5.09867);
   TracktoLCTXY_3__33->SetBinContent(2,12.92636);
   TracktoLCTXY_3__33->SetBinContent(3,15.66491);
   TracktoLCTXY_3__33->SetBinContent(4,14.76753);
   TracktoLCTXY_3__33->SetBinContent(5,12.20265);
   TracktoLCTXY_3__33->SetBinContent(6,8.960495);
   TracktoLCTXY_3__33->SetBinContent(7,6.632291);
   TracktoLCTXY_3__33->SetBinContent(8,4.920438);
   TracktoLCTXY_3__33->SetBinContent(9,3.70266);
   TracktoLCTXY_3__33->SetBinContent(10,2.78);
   TracktoLCTXY_3__33->SetBinContent(11,2.157847);
   TracktoLCTXY_3__33->SetBinContent(12,1.640975);
   TracktoLCTXY_3__33->SetBinContent(13,1.288242);
   TracktoLCTXY_3__33->SetBinContent(14,1.066903);
   TracktoLCTXY_3__33->SetBinContent(15,0.7867064);
   TracktoLCTXY_3__33->SetBinContent(16,0.6151066);
   TracktoLCTXY_3__33->SetBinContent(17,0.5073386);
   TracktoLCTXY_3__33->SetBinContent(18,0.4505531);
   TracktoLCTXY_3__33->SetBinContent(19,0.3394692);
   TracktoLCTXY_3__33->SetBinContent(20,0.2731504);
   TracktoLCTXY_3__33->SetBinContent(21,0.2362606);
   TracktoLCTXY_3__33->SetBinContent(22,0.1749158);
   TracktoLCTXY_3__33->SetBinContent(23,0.1649679);
   TracktoLCTXY_3__33->SetBinContent(24,0.1463158);
   TracktoLCTXY_3__33->SetBinContent(25,0.1206173);
   TracktoLCTXY_3__33->SetBinContent(26,0.1011361);
   TracktoLCTXY_3__33->SetBinContent(27,0.1081825);
   TracktoLCTXY_3__33->SetBinContent(28,0.07792455);
   TracktoLCTXY_3__33->SetBinContent(29,0.06963471);
   TracktoLCTXY_3__33->SetBinContent(30,0.07419412);
   TracktoLCTXY_3__33->SetBinContent(31,0.05968689);
   TracktoLCTXY_3__33->SetBinContent(32,0.053884);
   TracktoLCTXY_3__33->SetBinContent(33,0.04725212);
   TracktoLCTXY_3__33->SetBinContent(34,0.05802892);
   TracktoLCTXY_3__33->SetBinContent(35,0.053884);
   TracktoLCTXY_3__33->SetBinContent(36,0.04227822);
   TracktoLCTXY_3__33->SetBinContent(37,0.04062025);
   TracktoLCTXY_3__33->SetBinContent(38,0.0431072);
   TracktoLCTXY_3__33->SetBinContent(39,0.03730431);
   TracktoLCTXY_3__33->SetBinContent(40,0.03730431);
   TracktoLCTXY_3__33->SetBinContent(41,0.03481735);
   TracktoLCTXY_3__33->SetBinContent(42,0.03979126);
   TracktoLCTXY_3__33->SetBinContent(43,0.02652751);
   TracktoLCTXY_3__33->SetBinContent(44,0.02901446);
   TracktoLCTXY_3__33->SetBinContent(45,0.03730431);
   TracktoLCTXY_3__33->SetBinContent(46,0.0323304);
   TracktoLCTXY_3__33->SetBinContent(47,0.03357388);
   TracktoLCTXY_3__33->SetBinContent(48,0.03896228);
   TracktoLCTXY_3__33->SetBinContent(49,0.02569852);
   TracktoLCTXY_3__33->SetBinContent(50,0.02404055);
   TracktoLCTXY_3__33->SetBinContent(51,0.03315938);
   TracktoLCTXY_3__33->SetBinContent(52,0.01906665);
   TracktoLCTXY_3__33->SetBinContent(53,0.02445505);
   TracktoLCTXY_3__33->SetBinContent(54,0.02569852);
   TracktoLCTXY_3__33->SetBinContent(55,0.03067243);
   TracktoLCTXY_3__33->SetBinContent(56,0.02818548);
   TracktoLCTXY_3__33->SetBinContent(57,0.0323304);
   TracktoLCTXY_3__33->SetBinContent(58,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(59,0.03025794);
   TracktoLCTXY_3__33->SetBinContent(60,0.02735649);
   TracktoLCTXY_3__33->SetBinContent(61,0.03150142);
   TracktoLCTXY_3__33->SetBinContent(62,0.01823766);
   TracktoLCTXY_3__33->SetBinContent(63,0.02777098);
   TracktoLCTXY_3__33->SetBinContent(64,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(65,0.02901446);
   TracktoLCTXY_3__33->SetBinContent(66,0.02569852);
   TracktoLCTXY_3__33->SetBinContent(67,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(68,0.03647532);
   TracktoLCTXY_3__33->SetBinContent(69,0.02072462);
   TracktoLCTXY_3__33->SetBinContent(70,0.01989563);
   TracktoLCTXY_3__33->SetBinContent(71,0.03067243);
   TracktoLCTXY_3__33->SetBinContent(72,0.02486954);
   TracktoLCTXY_3__33->SetBinContent(73,0.01906665);
   TracktoLCTXY_3__33->SetBinContent(74,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(75,0.02735649);
   TracktoLCTXY_3__33->SetBinContent(76,0.02486954);
   TracktoLCTXY_3__33->SetBinContent(77,0.02404055);
   TracktoLCTXY_3__33->SetBinContent(78,0.02072462);
   TracktoLCTXY_3__33->SetBinContent(79,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(80,0.02569852);
   TracktoLCTXY_3__33->SetBinContent(81,0.01575071);
   TracktoLCTXY_3__33->SetBinContent(82,0.02072462);
   TracktoLCTXY_3__33->SetBinContent(83,0.01989563);
   TracktoLCTXY_3__33->SetBinContent(84,0.02321157);
   TracktoLCTXY_3__33->SetBinContent(85,0.02238258);
   TracktoLCTXY_3__33->SetBinContent(86,0.0215536);
   TracktoLCTXY_3__33->SetBinContent(87,0.02321157);
   TracktoLCTXY_3__33->SetBinContent(88,0.01823766);
   TracktoLCTXY_3__33->SetBinContent(89,0.02569852);
   TracktoLCTXY_3__33->SetBinContent(90,0.02652751);
   TracktoLCTXY_3__33->SetBinContent(91,0.01906665);
   TracktoLCTXY_3__33->SetBinContent(92,0.01740868);
   TracktoLCTXY_3__33->SetBinContent(93,0.01823766);
   TracktoLCTXY_3__33->SetBinContent(94,0.01989563);
   TracktoLCTXY_3__33->SetBinContent(95,0.01409274);
   TracktoLCTXY_3__33->SetBinContent(96,0.01699418);
   TracktoLCTXY_3__33->SetBinContent(97,0.01823766);
   TracktoLCTXY_3__33->SetBinContent(98,0.01492172);
   TracktoLCTXY_3__33->SetBinContent(99,0.0107768);
   TracktoLCTXY_3__33->SetBinContent(100,0.01160578);
   TracktoLCTXY_3__33->SetBinContent(101,1.28161);
   TracktoLCTXY_3__33->SetEntries(457904);
   TracktoLCTXY_3__33->SetStats(0);
   TracktoLCTXY_3__33->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_3__33->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_3__33->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTXY_4__34 = new TH1D("TracktoLCTXY_4__34","TracktoLCTXY",100,0,40);
   TracktoLCTXY_4__34->SetBinContent(0,203.5372);
   TracktoLCTXY_4__34->SetBinContent(1,8.025974);
   TracktoLCTXY_4__34->SetBinContent(2,17.74727);
   TracktoLCTXY_4__34->SetBinContent(3,17.46572);
   TracktoLCTXY_4__34->SetBinContent(4,13.20721);
   TracktoLCTXY_4__34->SetBinContent(5,9.513171);
   TracktoLCTXY_4__34->SetBinContent(6,7.11212);
   TracktoLCTXY_4__34->SetBinContent(7,5.388818);
   TracktoLCTXY_4__34->SetBinContent(8,4.156971);
   TracktoLCTXY_4__34->SetBinContent(9,3.201082);
   TracktoLCTXY_4__34->SetBinContent(10,2.504091);
   TracktoLCTXY_4__34->SetBinContent(11,1.918193);
   TracktoLCTXY_4__34->SetBinContent(12,1.501936);
   TracktoLCTXY_4__34->SetBinContent(13,1.159923);
   TracktoLCTXY_4__34->SetBinContent(14,0.9238168);
   TracktoLCTXY_4__34->SetBinContent(15,0.746396);
   TracktoLCTXY_4__34->SetBinContent(16,0.6267051);
   TracktoLCTXY_4__34->SetBinContent(17,0.4977338);
   TracktoLCTXY_4__34->SetBinContent(18,0.4103881);
   TracktoLCTXY_4__34->SetBinContent(19,0.356616);
   TracktoLCTXY_4__34->SetBinContent(20,0.2935633);
   TracktoLCTXY_4__34->SetBinContent(21,0.2363792);
   TracktoLCTXY_4__34->SetBinContent(22,0.1962548);
   TracktoLCTXY_4__34->SetBinContent(23,0.1824705);
   TracktoLCTXY_4__34->SetBinContent(24,0.1604977);
   TracktoLCTXY_4__34->SetBinContent(25,0.1303361);
   TracktoLCTXY_4__34->SetBinContent(26,0.112594);
   TracktoLCTXY_4__34->SetBinContent(27,0.0999016);
   TracktoLCTXY_4__34->SetBinContent(28,0.1044054);
   TracktoLCTXY_4__34->SetBinContent(29,0.08106769);
   TracktoLCTXY_4__34->SetBinContent(30,0.0682388);
   TracktoLCTXY_4__34->SetBinContent(31,0.07219665);
   TracktoLCTXY_4__34->SetBinContent(32,0.05813946);
   TracktoLCTXY_4__34->SetBinContent(33,0.05704763);
   TracktoLCTXY_4__34->SetBinContent(34,0.05418161);
   TracktoLCTXY_4__34->SetBinContent(35,0.04940489);
   TracktoLCTXY_4__34->SetBinContent(36,0.04708477);
   TracktoLCTXY_4__34->SetBinContent(37,0.04544704);
   TracktoLCTXY_4__34->SetBinContent(38,0.03794077);
   TracktoLCTXY_4__34->SetBinContent(39,0.03712191);
   TracktoLCTXY_4__34->SetBinContent(40,0.03452883);
   TracktoLCTXY_4__34->SetBinContent(41,0.03643952);
   TracktoLCTXY_4__34->SetBinContent(42,0.03630304);
   TracktoLCTXY_4__34->SetBinContent(43,0.03753134);
   TracktoLCTXY_4__34->SetBinContent(44,0.03384644);
   TracktoLCTXY_4__34->SetBinContent(45,0.03152632);
   TracktoLCTXY_4__34->SetBinContent(46,0.02879677);
   TracktoLCTXY_4__34->SetBinContent(47,0.02320119);
   TracktoLCTXY_4__34->SetBinContent(48,0.02947916);
   TracktoLCTXY_4__34->SetBinContent(49,0.02292824);
   TracktoLCTXY_4__34->SetBinContent(50,0.02674961);
   TracktoLCTXY_4__34->SetBinContent(51,0.02565779);
   TracktoLCTXY_4__34->SetBinContent(52,0.02729552);
   TracktoLCTXY_4__34->SetBinContent(53,0.02292824);
   TracktoLCTXY_4__34->SetBinContent(54,0.02388358);
   TracktoLCTXY_4__34->SetBinContent(55,0.02797791);
   TracktoLCTXY_4__34->SetBinContent(56,0.02347415);
   TracktoLCTXY_4__34->SetBinContent(57,0.02088107);
   TracktoLCTXY_4__34->SetBinContent(58,0.02156346);
   TracktoLCTXY_4__34->SetBinContent(59,0.02320119);
   TracktoLCTXY_4__34->SetBinContent(60,0.01774209);
   TracktoLCTXY_4__34->SetBinContent(61,0.01965277);
   TracktoLCTXY_4__34->SetBinContent(62,0.02306471);
   TracktoLCTXY_4__34->SetBinContent(63,0.02674961);
   TracktoLCTXY_4__34->SetBinContent(64,0.01856095);
   TracktoLCTXY_4__34->SetBinContent(65,0.02402006);
   TracktoLCTXY_4__34->SetBinContent(66,0.02674961);
   TracktoLCTXY_4__34->SetBinContent(67,0.02019868);
   TracktoLCTXY_4__34->SetBinContent(68,0.02674961);
   TracktoLCTXY_4__34->SetBinContent(69,0.02538483);
   TracktoLCTXY_4__34->SetBinContent(70,0.01910686);
   TracktoLCTXY_4__34->SetBinContent(71,0.02156346);
   TracktoLCTXY_4__34->SetBinContent(72,0.02047164);
   TracktoLCTXY_4__34->SetBinContent(73,0.02456597);
   TracktoLCTXY_4__34->SetBinContent(74,0.02047164);
   TracktoLCTXY_4__34->SetBinContent(75,0.0225188);
   TracktoLCTXY_4__34->SetBinContent(76,0.02033516);
   TracktoLCTXY_4__34->SetBinContent(77,0.01856095);
   TracktoLCTXY_4__34->SetBinContent(78,0.02115403);
   TracktoLCTXY_4__34->SetBinContent(79,0.02224585);
   TracktoLCTXY_4__34->SetBinContent(80,0.02320119);
   TracktoLCTXY_4__34->SetBinContent(81,0.01555845);
   TracktoLCTXY_4__34->SetBinContent(82,0.01992573);
   TracktoLCTXY_4__34->SetBinContent(83,0.01992573);
   TracktoLCTXY_4__34->SetBinContent(84,0.02210937);
   TracktoLCTXY_4__34->SetBinContent(85,0.01473958);
   TracktoLCTXY_4__34->SetBinContent(86,0.01992573);
   TracktoLCTXY_4__34->SetBinContent(87,0.02402006);
   TracktoLCTXY_4__34->SetBinContent(88,0.02142698);
   TracktoLCTXY_4__34->SetBinContent(89,0.02142698);
   TracktoLCTXY_4__34->SetBinContent(90,0.01473958);
   TracktoLCTXY_4__34->SetBinContent(91,0.01856095);
   TracktoLCTXY_4__34->SetBinContent(92,0.01965277);
   TracktoLCTXY_4__34->SetBinContent(93,0.01992573);
   TracktoLCTXY_4__34->SetBinContent(94,0.02074459);
   TracktoLCTXY_4__34->SetBinContent(95,0.01883391);
   TracktoLCTXY_4__34->SetBinContent(96,0.01692322);
   TracktoLCTXY_4__34->SetBinContent(97,0.02033516);
   TracktoLCTXY_4__34->SetBinContent(98,0.02047164);
   TracktoLCTXY_4__34->SetBinContent(99,0.0170597);
   TracktoLCTXY_4__34->SetBinContent(100,0.02402006);
   TracktoLCTXY_4__34->SetBinContent(101,2.459599);
   TracktoLCTXY_4__34->SetEntries(2242103);
   TracktoLCTXY_4__34->SetStats(0);

   ci = TColor::GetColor("#ff0000");
   TracktoLCTXY_4__34->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   TracktoLCTXY_4__34->SetMarkerColor(ci);
   TracktoLCTXY_4__34->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_4__34->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_4__34->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTXY_5__35 = new TH1D("TracktoLCTXY_5__35","TracktoLCTXY",100,0,40);
   TracktoLCTXY_5__35->SetBinContent(0,159.1284);
   TracktoLCTXY_5__35->SetBinContent(1,6.015494);
   TracktoLCTXY_5__35->SetBinContent(2,14.56136);
   TracktoLCTXY_5__35->SetBinContent(3,16.27146);
   TracktoLCTXY_5__35->SetBinContent(4,13.98079);
   TracktoLCTXY_5__35->SetBinContent(5,10.67292);
   TracktoLCTXY_5__35->SetBinContent(6,8.289123);
   TracktoLCTXY_5__35->SetBinContent(7,6.407344);
   TracktoLCTXY_5__35->SetBinContent(8,4.981097);
   TracktoLCTXY_5__35->SetBinContent(9,3.819647);
   TracktoLCTXY_5__35->SetBinContent(10,2.972575);
   TracktoLCTXY_5__35->SetBinContent(11,2.225132);
   TracktoLCTXY_5__35->SetBinContent(12,1.795631);
   TracktoLCTXY_5__35->SetBinContent(13,1.365355);
   TracktoLCTXY_5__35->SetBinContent(14,1.062442);
   TracktoLCTXY_5__35->SetBinContent(15,0.8275488);
   TracktoLCTXY_5__35->SetBinContent(16,0.6769445);
   TracktoLCTXY_5__35->SetBinContent(17,0.5399752);
   TracktoLCTXY_5__35->SetBinContent(18,0.429811);
   TracktoLCTXY_5__35->SetBinContent(19,0.3672141);
   TracktoLCTXY_5__35->SetBinContent(20,0.2846297);
   TracktoLCTXY_5__35->SetBinContent(21,0.2519368);
   TracktoLCTXY_5__35->SetBinContent(22,0.194608);
   TracktoLCTXY_5__35->SetBinContent(23,0.1871707);
   TracktoLCTXY_5__35->SetBinContent(24,0.1492098);
   TracktoLCTXY_5__35->SetBinContent(25,0.1414627);
   TracktoLCTXY_5__35->SetBinContent(26,0.1208553);
   TracktoLCTXY_5__35->SetBinContent(27,0.09978308);
   TracktoLCTXY_5__35->SetBinContent(28,0.0929656);
   TracktoLCTXY_5__35->SetBinContent(29,0.07592191);
   TracktoLCTXY_5__35->SetBinContent(30,0.06941432);
   TracktoLCTXY_5__35->SetBinContent(31,0.05934304);
   TracktoLCTXY_5__35->SetBinContent(32,0.05376511);
   TracktoLCTXY_5__35->SetBinContent(33,0.05113108);
   TracktoLCTXY_5__35->SetBinContent(34,0.04307406);
   TracktoLCTXY_5__35->SetBinContent(35,0.03749613);
   TracktoLCTXY_5__35->SetBinContent(36,0.03129842);
   TracktoLCTXY_5__35->SetBinContent(37,0.03222808);
   TracktoLCTXY_5__35->SetBinContent(38,0.02479083);
   TracktoLCTXY_5__35->SetBinContent(39,0.02200186);
   TracktoLCTXY_5__35->SetBinContent(40,0.02355129);
   TracktoLCTXY_5__35->SetBinContent(41,0.0210722);
   TracktoLCTXY_5__35->SetBinContent(42,0.01983266);
   TracktoLCTXY_5__35->SetBinContent(43,0.01673381);
   TracktoLCTXY_5__35->SetBinContent(44,0.02076232);
   TracktoLCTXY_5__35->SetBinContent(45,0.02076232);
   TracktoLCTXY_5__35->SetBinContent(46,0.02076232);
   TracktoLCTXY_5__35->SetBinContent(47,0.02076232);
   TracktoLCTXY_5__35->SetBinContent(48,0.01611404);
   TracktoLCTXY_5__35->SetBinContent(49,0.01518438);
   TracktoLCTXY_5__35->SetBinContent(50,0.01239541);
   TracktoLCTXY_5__35->SetBinContent(51,0.01332507);
   TracktoLCTXY_5__35->SetBinContent(52,0.009606446);
   TracktoLCTXY_5__35->SetBinContent(53,0.01208553);
   TracktoLCTXY_5__35->SetBinContent(54,0.01673381);
   TracktoLCTXY_5__35->SetBinContent(55,0.0127053);
   TracktoLCTXY_5__35->SetBinContent(56,0.01409978);
   TracktoLCTXY_5__35->SetBinContent(57,0.009606446);
   TracktoLCTXY_5__35->SetBinContent(58,0.01022622);
   TracktoLCTXY_5__35->SetBinContent(59,0.01440967);
   TracktoLCTXY_5__35->SetBinContent(60,0.01022622);
   TracktoLCTXY_5__35->SetBinContent(61,0.01084599);
   TracktoLCTXY_5__35->SetBinContent(62,0.01115587);
   TracktoLCTXY_5__35->SetBinContent(63,0.01146576);
   TracktoLCTXY_5__35->SetBinContent(64,0.009606446);
   TracktoLCTXY_5__35->SetBinContent(65,0.01239541);
   TracktoLCTXY_5__35->SetBinContent(66,0.01363496);
   TracktoLCTXY_5__35->SetBinContent(67,0.009141618);
   TracktoLCTXY_5__35->SetBinContent(68,0.008986675);
   TracktoLCTXY_5__35->SetBinContent(69,0.0148745);
   TracktoLCTXY_5__35->SetBinContent(70,0.007437248);
   TracktoLCTXY_5__35->SetBinContent(71,0.008211962);
   TracktoLCTXY_5__35->SetBinContent(72,0.0105361);
   TracktoLCTXY_5__35->SetBinContent(73,0.009606446);
   TracktoLCTXY_5__35->SetBinContent(74,0.01286024);
   TracktoLCTXY_5__35->SetBinContent(75,0.01022622);
   TracktoLCTXY_5__35->SetBinContent(76,0.01146576);
   TracktoLCTXY_5__35->SetBinContent(77,0.01146576);
   TracktoLCTXY_5__35->SetBinContent(78,0.006507592);
   TracktoLCTXY_5__35->SetBinContent(79,0.006197707);
   TracktoLCTXY_5__35->SetBinContent(80,0.01146576);
   TracktoLCTXY_5__35->SetBinContent(81,0.009916331);
   TracktoLCTXY_5__35->SetBinContent(82,0.009916331);
   TracktoLCTXY_5__35->SetBinContent(83,0.006507592);
   TracktoLCTXY_5__35->SetBinContent(84,0.009916331);
   TracktoLCTXY_5__35->SetBinContent(85,0.01146576);
   TracktoLCTXY_5__35->SetBinContent(86,0.008366904);
   TracktoLCTXY_5__35->SetBinContent(87,0.006507592);
   TracktoLCTXY_5__35->SetBinContent(88,0.00929656);
   TracktoLCTXY_5__35->SetBinContent(89,0.006817478);
   TracktoLCTXY_5__35->SetBinContent(90,0.008366904);
   TracktoLCTXY_5__35->SetBinContent(91,0.008986675);
   TracktoLCTXY_5__35->SetBinContent(92,0.01022622);
   TracktoLCTXY_5__35->SetBinContent(93,0.007127363);
   TracktoLCTXY_5__35->SetBinContent(94,0.0127053);
   TracktoLCTXY_5__35->SetBinContent(95,0.007747134);
   TracktoLCTXY_5__35->SetBinContent(96,0.00867679);
   TracktoLCTXY_5__35->SetBinContent(97,0.008366904);
   TracktoLCTXY_5__35->SetBinContent(98,0.00867679);
   TracktoLCTXY_5__35->SetBinContent(99,0.008366904);
   TracktoLCTXY_5__35->SetBinContent(100,0.008057019);
   TracktoLCTXY_5__35->SetBinContent(101,0.8879764);
   TracktoLCTXY_5__35->SetEntries(1678146);
   TracktoLCTXY_5__35->SetStats(0);

   ci = TColor::GetColor("#00ff00");
   TracktoLCTXY_5__35->SetLineColor(ci);

   ci = TColor::GetColor("#00ff00");
   TracktoLCTXY_5__35->SetMarkerColor(ci);
   TracktoLCTXY_5__35->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_5__35->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_5__35->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTXY_6__36 = new TH1D("TracktoLCTXY_6__36","TracktoLCTXY",100,0,40);
   TracktoLCTXY_6__36->SetBinContent(0,132.4689);
   TracktoLCTXY_6__36->SetBinContent(1,5.09816);
   TracktoLCTXY_6__36->SetBinContent(2,12.67502);
   TracktoLCTXY_6__36->SetBinContent(3,15.20123);
   TracktoLCTXY_6__36->SetBinContent(4,13.83961);
   TracktoLCTXY_6__36->SetBinContent(5,11.47257);
   TracktoLCTXY_6__36->SetBinContent(6,9.031551);
   TracktoLCTXY_6__36->SetBinContent(7,7.111131);
   TracktoLCTXY_6__36->SetBinContent(8,5.534443);
   TracktoLCTXY_6__36->SetBinContent(9,4.370377);
   TracktoLCTXY_6__36->SetBinContent(10,3.271341);
   TracktoLCTXY_6__36->SetBinContent(11,2.471691);
   TracktoLCTXY_6__36->SetBinContent(12,1.930412);
   TracktoLCTXY_6__36->SetBinContent(13,1.454689);
   TracktoLCTXY_6__36->SetBinContent(14,1.177213);
   TracktoLCTXY_6__36->SetBinContent(15,0.8992112);
   TracktoLCTXY_6__36->SetBinContent(16,0.7062226);
   TracktoLCTXY_6__36->SetBinContent(17,0.5475898);
   TracktoLCTXY_6__36->SetBinContent(18,0.4699387);
   TracktoLCTXY_6__36->SetBinContent(19,0.3761613);
   TracktoLCTXY_6__36->SetBinContent(20,0.2964067);
   TracktoLCTXY_6__36->SetBinContent(21,0.2587204);
   TracktoLCTXY_6__36->SetBinContent(22,0.2134969);
   TracktoLCTXY_6__36->SetBinContent(23,0.1787905);
   TracktoLCTXY_6__36->SetBinContent(24,0.1412796);
   TracktoLCTXY_6__36->SetBinContent(25,0.1202454);
   TracktoLCTXY_6__36->SetBinContent(26,0.107099);
   TracktoLCTXY_6__36->SetBinContent(27,0.08185802);
   TracktoLCTXY_6__36->SetBinContent(28,0.07467134);
   TracktoLCTXY_6__36->SetBinContent(29,0.06625767);
   TracktoLCTXY_6__36->SetBinContent(30,0.05135846);
   TracktoLCTXY_6__36->SetBinContent(31,0.04802805);
   TracktoLCTXY_6__36->SetBinContent(32,0.0462752);
   TracktoLCTXY_6__36->SetBinContent(33,0.04417178);
   TracktoLCTXY_6__36->SetBinContent(34,0.03418054);
   TracktoLCTXY_6__36->SetBinContent(35,0.0334794);
   TracktoLCTXY_6__36->SetBinContent(36,0.03207713);
   TracktoLCTXY_6__36->SetBinContent(37,0.02489045);
   TracktoLCTXY_6__36->SetBinContent(38,0.02804557);
   TracktoLCTXY_6__36->SetBinContent(39,0.02453988);
   TracktoLCTXY_6__36->SetBinContent(40,0.02068361);
   TracktoLCTXY_6__36->SetBinContent(41,0.0173532);
   TracktoLCTXY_6__36->SetBinContent(42,0.01682734);
   TracktoLCTXY_6__36->SetBinContent(43,0.01542507);
   TracktoLCTXY_6__36->SetBinContent(44,0.0115688);
   TracktoLCTXY_6__36->SetBinContent(45,0.01226994);
   TracktoLCTXY_6__36->SetBinContent(46,0.01262051);
   TracktoLCTXY_6__36->SetBinContent(47,0.01332165);
   TracktoLCTXY_6__36->SetBinContent(48,0.01226994);
   TracktoLCTXY_6__36->SetBinContent(49,0.01191937);
   TracktoLCTXY_6__36->SetBinContent(50,0.01191937);
   TracktoLCTXY_6__36->SetBinContent(51,0.008764242);
   TracktoLCTXY_6__36->SetBinContent(52,0.008764242);
   TracktoLCTXY_6__36->SetBinContent(53,0.01051709);
   TracktoLCTXY_6__36->SetBinContent(54,0.009465381);
   TracktoLCTXY_6__36->SetBinContent(55,0.007011394);
   TracktoLCTXY_6__36->SetBinContent(56,0.01367222);
   TracktoLCTXY_6__36->SetBinContent(57,0.007011394);
   TracktoLCTXY_6__36->SetBinContent(58,0.006310254);
   TracktoLCTXY_6__36->SetBinContent(59,0.008413672);
   TracktoLCTXY_6__36->SetBinContent(60,0.009114812);
   TracktoLCTXY_6__36->SetBinContent(61,0.008764242);
   TracktoLCTXY_6__36->SetBinContent(62,0.007186678);
   TracktoLCTXY_6__36->SetBinContent(63,0.005258545);
   TracktoLCTXY_6__36->SetBinContent(64,0.003856266);
   TracktoLCTXY_6__36->SetBinContent(65,0.005959684);
   TracktoLCTXY_6__36->SetBinContent(66,0.007361963);
   TracktoLCTXY_6__36->SetBinContent(67,0.007361963);
   TracktoLCTXY_6__36->SetBinContent(68,0.002103418);
   TracktoLCTXY_6__36->SetBinContent(69,0.004557406);
   TracktoLCTXY_6__36->SetBinContent(70,0.005609115);
   TracktoLCTXY_6__36->SetBinContent(71,0.003505697);
   TracktoLCTXY_6__36->SetBinContent(72,0.0057844);
   TracktoLCTXY_6__36->SetBinContent(73,0.005959684);
   TracktoLCTXY_6__36->SetBinContent(74,0.006310254);
   TracktoLCTXY_6__36->SetBinContent(75,0.005258545);
   TracktoLCTXY_6__36->SetBinContent(76,0.004907975);
   TracktoLCTXY_6__36->SetBinContent(77,0.007361963);
   TracktoLCTXY_6__36->SetBinContent(78,0.006660824);
   TracktoLCTXY_6__36->SetBinContent(79,0.005609115);
   TracktoLCTXY_6__36->SetBinContent(80,0.005609115);
   TracktoLCTXY_6__36->SetBinContent(81,0.005609115);
   TracktoLCTXY_6__36->SetBinContent(82,0.00543383);
   TracktoLCTXY_6__36->SetBinContent(83,0.002453988);
   TracktoLCTXY_6__36->SetBinContent(84,0.004732691);
   TracktoLCTXY_6__36->SetBinContent(85,0.004907975);
   TracktoLCTXY_6__36->SetBinContent(86,0.005258545);
   TracktoLCTXY_6__36->SetBinContent(87,0.003505697);
   TracktoLCTXY_6__36->SetBinContent(88,0.004557406);
   TracktoLCTXY_6__36->SetBinContent(89,0.005609115);
   TracktoLCTXY_6__36->SetBinContent(90,0.005959684);
   TracktoLCTXY_6__36->SetBinContent(91,0.005959684);
   TracktoLCTXY_6__36->SetBinContent(92,0.006310254);
   TracktoLCTXY_6__36->SetBinContent(93,0.002804557);
   TracktoLCTXY_6__36->SetBinContent(94,0.006660824);
   TracktoLCTXY_6__36->SetBinContent(95,0.003505697);
   TracktoLCTXY_6__36->SetBinContent(96,0.006660824);
   TracktoLCTXY_6__36->SetBinContent(97,0.003155127);
   TracktoLCTXY_6__36->SetBinContent(98,0.006310254);
   TracktoLCTXY_6__36->SetBinContent(99,0.003505697);
   TracktoLCTXY_6__36->SetBinContent(100,0.002453988);
   TracktoLCTXY_6__36->SetBinContent(101,0.3968449);
   TracktoLCTXY_6__36->SetEntries(1328499);
   TracktoLCTXY_6__36->SetStats(0);

   ci = TColor::GetColor("#0000ff");
   TracktoLCTXY_6__36->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   TracktoLCTXY_6__36->SetMarkerColor(ci);
   TracktoLCTXY_6__36->GetXaxis()->SetTitle("cm");
   TracktoLCTXY_6__36->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTXY_6__36->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTXY_1","ME11A: mean:4.9cm;RMS:7.8cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_2","ME11B: mean:3.4cm;RMS:6.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_3","ME12+13: mean:2.5cm;RMS:3.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_4","ME2: mean:2.3cm;RMS:3.6cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_5","ME3: mean:2.3cm;RMS:2.8cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTXY_6","ME4: mean:2.3cm;RMS:2.4cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.01,0.945,0.3364516,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("TracktoLCTXY");
   pt->Draw();
   TracktoLCTXY->Modified();
   TracktoLCTXY->cd();
   TracktoLCTXY->SetSelected(TracktoLCTXY);
}
void TracktoLCTYfull_2016B_June22all_sameYrange_fullIntegral_10k9k_lin()
{
//=========Macro generated from canvas: TracktoLCTYfull/TracktoLCTYfull
//=========  (Sat Aug  6 07:01:22 2016) by ROOT version6.06/01
   TCanvas *TracktoLCTYfull = new TCanvas("TracktoLCTYfull", "TracktoLCTYfull",0,0,500,500);
   gStyle->SetOptStat(0);
   TracktoLCTYfull->SetHighLightColor(2);
   TracktoLCTYfull->Range(-10000.5,-14.99438,-9995.5,134.9994);
   TracktoLCTYfull->SetFillColor(0);
   TracktoLCTYfull->SetBorderMode(0);
   TracktoLCTYfull->SetBorderSize(2);
   TracktoLCTYfull->SetFrameBorderMode(0);
   TracktoLCTYfull->SetFrameBorderMode(0);
   
   TH1D *TracktoLCTYfull_1__73 = new TH1D("TracktoLCTYfull_1__73","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_1__73->SetBinContent(26,100);
   TracktoLCTYfull_1__73->SetBinContent(101,26.00723);
   TracktoLCTYfull_1__73->SetMinimum(0.005);
   TracktoLCTYfull_1__73->SetMaximum(120);
   TracktoLCTYfull_1__73->SetEntries(675802);
   TracktoLCTYfull_1__73->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   TracktoLCTYfull_1__73->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   TracktoLCTYfull_1__73->SetMarkerColor(ci);
   TracktoLCTYfull_1__73->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_1__73->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_1__73->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTYfull_2__74 = new TH1D("TracktoLCTYfull_2__74","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_2__74->SetBinContent(26,100);
   TracktoLCTYfull_2__74->SetBinContent(101,35.88015);
   TracktoLCTYfull_2__74->SetEntries(1185341);
   TracktoLCTYfull_2__74->SetStats(0);

   ci = TColor::GetColor("#ff9999");
   TracktoLCTYfull_2__74->SetLineColor(ci);

   ci = TColor::GetColor("#ff9999");
   TracktoLCTYfull_2__74->SetMarkerColor(ci);
   TracktoLCTYfull_2__74->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_2__74->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_2__74->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTYfull_3__75 = new TH1D("TracktoLCTYfull_3__75","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_3__75->SetBinContent(26,100);
   TracktoLCTYfull_3__75->SetBinContent(101,122.3848);
   TracktoLCTYfull_3__75->SetEntries(389596);
   TracktoLCTYfull_3__75->SetStats(0);
   TracktoLCTYfull_3__75->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_3__75->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_3__75->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTYfull_4__76 = new TH1D("TracktoLCTYfull_4__76","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_4__76->SetBinContent(26,100);
   TracktoLCTYfull_4__76->SetBinContent(101,49.76866);
   TracktoLCTYfull_4__76->SetEntries(1890705);
   TracktoLCTYfull_4__76->SetStats(0);

   ci = TColor::GetColor("#ff0000");
   TracktoLCTYfull_4__76->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   TracktoLCTYfull_4__76->SetMarkerColor(ci);
   TracktoLCTYfull_4__76->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_4__76->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_4__76->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTYfull_5__77 = new TH1D("TracktoLCTYfull_5__77","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_5__77->SetBinContent(26,100);
   TracktoLCTYfull_5__77->SetBinContent(101,63.70034);
   TracktoLCTYfull_5__77->SetEntries(1394704);
   TracktoLCTYfull_5__77->SetStats(0);

   ci = TColor::GetColor("#00ff00");
   TracktoLCTYfull_5__77->SetLineColor(ci);

   ci = TColor::GetColor("#00ff00");
   TracktoLCTYfull_5__77->SetMarkerColor(ci);
   TracktoLCTYfull_5__77->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_5__77->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_5__77->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *TracktoLCTYfull_6__78 = new TH1D("TracktoLCTYfull_6__78","TracktoLCTYfull",100,-10000,-9996);
   TracktoLCTYfull_6__78->SetBinContent(26,100);
   TracktoLCTYfull_6__78->SetBinContent(101,78.02474);
   TracktoLCTYfull_6__78->SetEntries(1102290);
   TracktoLCTYfull_6__78->SetStats(0);

   ci = TColor::GetColor("#0000ff");
   TracktoLCTYfull_6__78->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   TracktoLCTYfull_6__78->SetMarkerColor(ci);
   TracktoLCTYfull_6__78->GetXaxis()->SetTitle("cm");
   TracktoLCTYfull_6__78->GetYaxis()->SetTitle("scaled number of entries");
   TracktoLCTYfull_6__78->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("TracktoLCTYfull_1","ME11A: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_2","ME11B: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_3","ME12+13: mean:-9999.0cm;RMS:0.0cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_4","ME2: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_5","ME3: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("TracktoLCTYfull_6","ME4: mean:-9999.0cm;RMS:0.0cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.01,0.945,0.3707258,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("TracktoLCTYfull");
   pt->Draw();
   TracktoLCTYfull->Modified();
   TracktoLCTYfull->cd();
   TracktoLCTYfull->SetSelected(TracktoLCTYfull);
}
Example #21
0
void plottingmacro_IVF()
{


  double fa = 0.46502;
  double fb = 0.53498;
  bool debug_ = true;

  //  std::string path("Nov10thFall11Plots/");
  //  std::string path("Nov10Fall1160MTopSlimPlots/");
  std::string path("Nov10Fall1160MTopIVFPlots_b/");

  if(debug_)
    std::cout << "Init the style form setTDRStyle" << std::endl;
  setTDRStyle();
  gStyle->SetErrorX(0.5);
  gROOT->ForceStyle();
  initOptions();
  

  if(debug_)
    std::cout << "Init the sample" << std::endl;
  //  std::vector<Sample> s = Nov10thDiJetPtUpdatedSlimHistos();
  //std::vector<Sample> s = Nov10Fall1160MTopSlimHistos();
  std::vector<Sample> s = Nov10Fall1160MTopIVFHistos();

  Sample data(1,"fake data","S1.root",0,true,1000);

  if(debug_)
    std::cout << "Init the data sample" << std::endl;
  for(size_t i=0;i< s.size();i++) if(s[i].data) {data=s[i];break;}

  if(debug_)
    std::cout << "Ls data sample" << std::endl;
  data.file()->ls(); 

  if(debug_)
    std::cout << "Init the mc sample" << std::endl;
  for(size_t i=0;i< s.size();i++) s[i].dump(1,fa,fb);

  std::vector<std::string> names;

  if(debug_)
    std::cout << "Get List of Keys" << std::endl;
  TList * subs = data.file()->GetListOfKeys();
  for(size_t i=0;i< subs->GetSize();i++)
    {
      TString nn = subs->At(i)->GetName();
      if( nn.Contains(TRegexp("Count*")) )
	continue;
      if(debug_)
	std::cout << "Get List of Keys in subdirs" << std::endl;
      TList * objs = ((TDirectoryFile *)data.file()->Get(subs->At(i)->GetName()))->GetListOfKeys();
      for(size_t j=0;j< objs->GetSize();j++)
	{
	  if(debug_)
	    std::cout << "Name = " << subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName() << std::endl;
	  names.push_back(subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName());
	  //      std::cout << subs->At(i)->GetName() << "/"  << objs->At(j)->GetName() << std::endl;
	  //TODO: select plots via regexp
	}
    }


  if(debug_)
    std::cout << "Starting plotting" << std::endl;

  std::string process;

  for(size_t i = 0 ; i < names.size() ; i++) 
    {
      
      std::map<std::string,TH1F *> grouped;
      TString n=names[i];
      //      if(!n.Contains(TRegexp("VlightRegionHZee/HiggsPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee/ZPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZmmSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZeeSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVPureRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVTTbarPureRegionZcombSV"))) continue;
      if(!n.Contains(TRegexp("TTbarRegionZeeSVJets"))) continue;

      if(n.Contains(TRegexp("RegionHZcomb")))
	process = "Z(l^{+}l^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZmm")))
	process = "Z(#mu^{+}#mu^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZee")))
	process = "Z(e^{+}e^{-})H(b#bar{b})";

      if(debug_)
	std::cout << "Creating the Canvas" << std::endl;

      TCanvas *c = new TCanvas();
      c->SetLogy(false);
      c->SetTitle(names[i].c_str());

      if(debug_)
	std::cout << "Creating histograms" << std::endl;
  
      TH1F *hd = ((TH1F*)data.file()->Get(names[i].c_str()));
      hd->Sumw2();
      Options o=options[names[i]];
      //      hd->Rebin(o.rebin);
      hd->SetMarkerStyle(20);
      hd->GetXaxis()->SetLabelOffset(99);
      hd->SetYTitle(o.yaxis.c_str());
      double nbin = hd->GetNbinsX();
      double min_bin = hd->GetXaxis()->GetXmin();
      double max_bin = hd->GetXaxis()->GetXmax();
      TH1F *hmc = new TH1F("hmc","hmc", nbin, min_bin, max_bin);
      hmc->SetFillColor(kWhite);
      hmc->Sumw2();
      //      hmc->Rebin(o.rebin);

      if(debug_)
	std::cout << "Creating the THStack and Legend" << std::endl;
      THStack * sta = new THStack("sta",hd->GetTitle());
      TLegend * l = new TLegend(o.legendx1,o.legendy1,o.legendx2,o.legendy2); //0.7,0.1,0.9,0.6);
      l->SetFillColor(kWhite);
      l->SetBorderSize(0);
      l->SetTextFont(62);
      l->SetTextSize(0.03);
      if(debug_)
	std::cout << "Adding data to the legend" << std::endl;  
      l->AddEntry(hd, "Data","P");
      if(debug_)
	std::cout << "Adding MC to the THStack" << std::endl;  

      //with the proper trigger eff
      //      double SF[] = {1.01,1.03,1.00};
      //      double SF[] = {1.03,1.054,1.032};
      double SF[] = {1.0,1.0,1.0};

      if(debug_){
	for(int i = 0; i< 3; ++i)
	  std::cout << "SF [" << i << "] = " << SF[i] << std::endl;
      }

      double mcIntegral=0;
      for(size_t j=0;j< s.size() ;j++) 
	{ 
	  if(!s[j].data) 
	    {
	      if(debug_)
		std::cout << "Creating TH1F from file " << s[j].name << std::endl;  
	      TH1F * h = ((TH1F*)s[j].file()->Get(names[i].c_str()));
	      h->Sumw2();
	      if(debug_){
		std::cout << "TH1F created from file " << s[j].name << std::endl;  
		std::cout << "Scaling : " << s[j].scale(data.lumi(),fa,fb) << std::endl;  
		std::cout << "Scaling with SF : " << s[j].scale(data.lumi(),fa,fb,SF) << std::endl;  
		std::cout << "Histo integral before scaling = " << h->Integral() << std::endl;
	      }
	      h->Scale(s[j].scale(data.lumi(),fa,fb,SF));
	      if(debug_){
		std::cout << "Histo integral after scaling = " << h->Integral() << std::endl;
		std::cout << "Managing style... " << std::endl;  
	      }
	      h->SetLineWidth(1.);
	      h->SetFillColor(s[j].color);
	      h->SetLineColor(s[j].color);
	      //	      h->Rebin(options[names[i]].rebin);
	      if(debug_)
		std::cout << "Cloning and update legend " << std::endl;  
	      if(grouped.find(s[j].name) == grouped.end()){
		l->AddEntry(h,s[j].name.c_str(),"F");
	      }
	      std::cout << "Sample : " << s[j].name << " - Integral for plot " << names[i] << " = " << h->Integral(-10000,10000) << std::endl;
	      mcIntegral += h->Integral();
	      sta->Add(h);
	      hmc->Add(h);	      
	      //TO FIX grouped map
	      // sovrascrive histo con lo stesso nome tipo VV o ST etc...
	      grouped[s[j].name]=(TH1F *)h->Clone(("_"+names[i]).c_str());
	    }
	}

      if(debug_){
	std::cout << "Data total = " << hd->Integral() << std::endl;
	std::cout << "MC = " << mcIntegral << std::endl;
	std::cout << "Data/MC = " << hd->Integral()/mcIntegral << std::endl;
      }

      TPad * TopPad = new TPad("TopPad","Top Pad",0.,0.3,1.,1. ) ;
      TPad * BtmPad = new TPad("BtmPad","Bottom Pad",0.,0.,1.,0.313 ) ;
      TopPad->SetBottomMargin(0.02);
      BtmPad->SetTopMargin(0.0);
      BtmPad->SetFillStyle(4000);
      TopPad->SetFillStyle(4000);
      BtmPad->SetFillColor(0);
      BtmPad->SetBottomMargin(0.35);
      TopPad->Draw() ;
      BtmPad->Draw() ;
      std::cout << "hd maximum = " << hd->GetMaximum() << "  sta maximum = " << sta->GetMaximum() << std::endl;
      double maxY;
      if(hd->GetMaximum() > sta->GetMaximum()) maxY = (hd->GetMaximum())*1.5;
      else maxY = (sta->GetMaximum())*1.5;
      TopPad->cd();
      hd->Draw("E1X0");
      sta->Draw("sameHIST");
      hmc->Draw("sameE2");
      hmc->SetFillColor(2);
      hmc->SetMarkerSize(0);
      hmc->SetFillStyle(3013);
      hd->Draw("E1X0same");
      l->Draw("same");
      std::cout << "Set Maximum to = " << maxY << std::endl;
      hd->GetYaxis()->SetRangeUser(0.,maxY);
      hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);

      BtmPad->cd();
      std::cout << "Division" << std::endl;

      TH1D * divisionErrorBand = (TH1D*)(hmc)->Clone("divisionErrorBand");
      divisionErrorBand->Sumw2();
      divisionErrorBand->Divide(hmc);
      divisionErrorBand->Draw("E2");      
      divisionErrorBand->SetMaximum(2.49);
      divisionErrorBand->SetMinimum(0);
      divisionErrorBand->SetMarkerStyle(20);
      divisionErrorBand->SetMarkerSize(0.55);
      divisionErrorBand->GetXaxis()->SetTitleOffset(1.12);
      divisionErrorBand->GetXaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetXaxis()->SetTitleSize(0.5);
      divisionErrorBand->GetYaxis()->SetTitle("Data/MC");
      divisionErrorBand->GetYaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleOffset(0.40);
      divisionErrorBand->GetYaxis()->SetNdivisions(505);
      //divisionErrorBand->UseCurrentStyle();
      divisionErrorBand->SetFillColor(2);
      divisionErrorBand->SetFillStyle(3001);
      divisionErrorBand->SetMarkerSize(0.);

      TH1D * division = (TH1D*)(hd)->Clone("division");
      division->Sumw2();
      division->Divide(hmc);
//       division->SetMaximum(2.5);
//       division->SetMinimum(0);
//       division->SetMarkerStyle(20);
//       division->SetMarkerSize(0.55);
//       division->GetXaxis()->SetLabelSize(0.12);
//       division->GetXaxis()->SetTitleSize(0.14);
//       division->GetYaxis()->SetLabelSize(0.10);
//       division->GetYaxis()->SetTitleSize(0.10);
//      division->GetYaxis()->SetTitle("Data/MC");
      Double_t min = division->GetXaxis()->GetXmin();
      Double_t max = division->GetXaxis()->GetXmax();
      division->Draw("E1X0same");

      TLine *line = new TLine(min, 1.0, max, 1.0);
      line->SetLineColor(kRed);
      line->Draw("same");
      
      TLegend * leg3 =new TLegend(0.50,0.86,0.69,0.96);
      leg3->AddEntry(divisionErrorBand,"MC uncert. (stat.)","f");
      leg3->SetFillColor(0);
      leg3->SetLineColor(0);
      leg3->SetShadowColor(0);
      leg3->SetTextFont(62);
      leg3->SetTextSize(0.06);
      leg3->Draw();

      TPaveText *pave = new TPaveText(0.15,0.85,0.32,0.96,"brNDC");
      pave->SetTextAlign(12);
      pave->SetLineColor(0);
      pave->SetFillColor(0);
      pave->SetShadowColor(0);
      //TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",histDt->Chi2Test(histCopyMC5,"UWCHI2/NDF"),histDt->KolmogorovTest(histCopyMC5))); // stat + sys
      TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",hd->Chi2Test(hmc,"UWCHI2/NDF"),hd->KolmogorovTest(hmc))); // stat only
      text->SetTextFont(62);
      text->SetTextSize(0.08);
      pave->Draw();

      TopPad->cd();
      TLatex latex;
      latex.SetNDC();
      latex.SetTextAlign(12);
      latex.SetTextSize(0.052);
      latex.DrawLatex(0.17,0.89,"CMS Preliminary");
      latex.SetTextSize(0.04);
      latex.DrawLatex(0.17,0.84,"#sqrt{s} = 7 TeV, L = 4.7 fb^{-1}");
      //      latex.DrawLatex(0.17,0.79,"Z(e^{+}e^{-})H(b#bar{b})");
      latex.DrawLatex(0.17,0.79,process.c_str());
      c->Update();
      std::string cName= hd->GetName();
      cName += "_bare.pdf";
      cName = path+cName;
      c->Print(cName.c_str(),"pdf");

//       std::cout << names[i] << " d: " <<  hd->Integral() << " ";
//       THStack * sta2 = new THStack("sta2",hd->GetTitle());
//       float tot=0;
//       float toterr2=0;

//       if(debug_)
// 	std::cout << "Putting the iterator in the for loop" << std::endl;
//       for(std::map<std::string,TH1F *>::reverse_iterator it=grouped.rbegin(); it!=grouped.rend();++it)
//  	{
// 	  if(debug_)
// 	    std::cout << "Using the iterator" << std::endl;
// 	  std::cout << (*it).first << " " << (*it).second->Integral() << " | " << std::endl ;
// 	  if((*it).second->GetEntries() > 0) {
// 	    float er=1.*sqrt((*it).second->GetEntries())/(*it).second->GetEntries()*(*it).second->Integral();
// 	    toterr2+=er*er;
// 	  }
// 	  tot+=(*it).second->Integral();
// 	  sta2->Add(it->second);
//  	}
//       std::cout << " Tot: " << tot << "+-" << sqrt(toterr2) <<  " SF: " << hd->Integral()/tot << std::endl;
//       TCanvas *c2 = new TCanvas();
//       c2->SetTitle(names[i].c_str());
//       std::cout << "hd maximum = " << hd->GetMaximum() << "  sta2 maximum = " << sta2->GetMaximum() << std::endl;
//       if(hd->GetMaximum() > sta2->GetMaximum()) maxY =  hd->GetBinContent(hd->GetMaximumBin()) * 1.5;
//       else maxY = ( sta2->GetMaximum())*1.5;
//       //      hd->Draw("E1"); 
//       sta2->Draw("PADSHIST");
//       //    hd->Draw("E1same");
//       //      l->Draw("same");
//       std::cout << "Set Maximum to = " << maxY << std::endl;
//       hd->GetYaxis()->SetRangeUser(0.,maxY);
//       hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);
//       c2->Update();

//       std::string c2Name = hd->GetName();
//       c2Name = path+c2Name;
//       c2Name += "_norm.pdf";
//       c2->Print(c2Name.c_str(),"pdf");  

    }

}
Example #22
0
void RooToyMCFit(){
    stringstream out;
   out.str("");
   out << "toyMC_" << _sigma_over_tau << "_" << _purity << "_" << mistag_rate << ".root";
   TFile* file = TFile::Open(out.str().c_str());
   TTree* tree = (TTree*)file->Get("ToyTree");
   tree->Print();

//    TFile* file = TFile::Open("ToyData/toyMC_453_0.912888_0.3_0.8_0.root");
//    TFile* file = TFile::Open("ToyData/toyMC_10000_0.9_0.3_0.8_0.root");
//    TTree* tree = (TTree*)file->Get("ToyTree1");

    RooRealVar tau("tau","tau",_tau,"ps"); tau.setConstant(kTRUE);
    RooRealVar dm("dm","dm",_dm,"ps^{-1}"); dm.setConstant(kTRUE);

    RooAbsReal* sin2beta;
    RooAbsReal* cos2beta;
    if(softlimit){
      RooRealVar x("x","x",_cos2beta,-3.,30000.); if(constBeta) x.setConstant(kTRUE);
      RooRealVar y("y","y",_sin2beta,-3.,30000.); if(constBeta) y.setConstant(kTRUE);
      cos2beta = new RooFormulaVar("cos2beta","cos2beta","@0/sqrt(@0*@0+@1*@1)",RooArgSet(x,y));
      sin2beta = new RooFormulaVar("sin2beta","sin2beta","@0/sqrt(@0*@0+@1*@1)",RooArgSet(y,x));
//      sin2beta = new RooFormulaVar("sin2beta","sin2beta","2/TMath::Pi()*TMath::ATan(@0)",RooArgSet(y));
//      cos2beta = new RooFormulaVar("cos2beta","cos2beta","2/TMath::Pi()*TMath::ATan(@0)",RooArgSet(x));
    }
    else{ 
      sin2beta = new RooRealVar("sin2beta","sin2beta",_sin2beta,-3.,3.); if(constBeta) ((RooRealVar*)sin2beta)->setConstant(kTRUE);
      cos2beta = new RooRealVar("cos2beta","cos2beta",_cos2beta,-3.,3.); if(constBeta) ((RooRealVar*)cos2beta)->setConstant(kTRUE);
    }
    RooRealVar dt("dt","#Deltat",-5.,5.,"ps");
    RooRealVar avgMisgat("avgMisgat","avgMisgat",mistag_rate,0.0,0.5); if(constMistag) avgMisgat.setConstant(kTRUE);
    RooRealVar delMisgat("delMisgat","delMisgat",0); delMisgat.setConstant(kTRUE);
    RooRealVar mu("mu","mu",0); mu.setConstant(kTRUE);

    tau.Print();
    dm.Print();
    sin2beta->Print();
    cos2beta->Print();
    avgMisgat.Print();

    RooRealVar moment("moment","moment",0.); moment.setConstant(kTRUE);
    RooRealVar parity("parity","parity",-1.); parity.setConstant(kTRUE);

    RooRealVar* K[8];
    RooAbsReal* Kb[8];
    RooArgList Kset;
    RooRealVar* C[8];
    RooRealVar* S[8];
    RooFormulaVar* a1[2][8];
    RooFormulaVar* b1[2][8];
    RooFormulaVar* a2[2][8];
    RooFormulaVar* b2[2][8];

    for(int i=0; i<8; i++){
        out.str("");
        out << "K" << i+1;
        K[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_K[i],0.,1.); Kset.add(*K[i]); if(constK) K[i]->setConstant(kTRUE);
        K[i]->Print();
        if(i!=7){
          out.str("");
          out << "Kb" << i+1;
          Kb[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_Kb[i],0.,1.); Kset.add(*Kb[i]); if(constK) ((RooRealVar*)Kb[i])->setConstant(kTRUE);
          Kb[i]->Print();
        }
        out.str("");
        out << "C" << i+1;
        C[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_C[i]); C[i]->setConstant(kTRUE);
        C[i]->Print();
        out.str("");
        out << "S" << i+1;
        S[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_S[i]); S[i]->setConstant(kTRUE);
        S[i]->Print();
    }
    Kb[7] = new RooFormulaVar("K8b","K8b","1-@0-@1-@2-@3-@4-@5-@6-@7-@8-@9-@10-@11-@12-@13-@14",Kset);

    for(int i=0; i<8; i++){
        out.str("");
        out << "a10_" << i+1;
        a1[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i]));
        a1[0][i]->Print();
        out.str("");
        out << "a11_" << i+1;
        a1[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i]));
        a1[1][i]->Print();
        out.str("");
        out << "a20_" << i+1;
        a2[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i]));
        a2[0][i]->Print();
        out.str("");
        out << "a21_" << i+1;
        a2[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i]));
        a2[1][i]->Print();

        out.str("");
        out << "b10_" << i+1;
        b1[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta));
        b1[0][i]->Print();
        out.str("");
        out << "b11_" << i+1;
        b1[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta));
        b1[1][i]->Print();
        out.str("");
        out << "b20_" << i+1;
        b2[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta));
        b2[0][i]->Print();
        out.str("");
        out << "b21_" << i+1;
        b2[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta));
        b2[1][i]->Print();

        cout << "bin = " << i+1 << endl;
        cout << "  a11 = " << a1[0][i]->getVal() << " b11 = " << b1[0][i]->getVal() << endl;
        cout << "  a12 = " << a1[1][i]->getVal() << " b12 = " << b1[1][i]->getVal() << endl;
        cout << "  a21 = " << a2[0][i]->getVal() << " b21 = " << b2[0][i]->getVal() << endl;
        cout << "  a22 = " << a2[1][i]->getVal() << " b22 = " << b2[1][i]->getVal() << endl;
    }

    RooRealVar* dgamma = new RooRealVar("dgamma","dgamma",0.); dgamma->setConstant(kTRUE);
    RooRealVar* f0 = new RooRealVar("f0","f0",1.);             f0->setConstant(kTRUE);
    RooRealVar* f1 = new RooRealVar("f1","f1",0.);             f1->setConstant(kTRUE);

    RooCategory tag("tag","tag");
    tag.defineType("B0",1);
    tag.defineType("anti-B0",-1);

    RooCategory bin("bin","bin");
    bin.defineType("1",1);
    bin.defineType("2",2);
    bin.defineType("3",3);
    bin.defineType("4",4);
    bin.defineType("5",5);
    bin.defineType("6",6);
    bin.defineType("7",7);
    bin.defineType("8",8);
    bin.defineType("-1",-1);
    bin.defineType("-2",-2);
    bin.defineType("-3",-3);
    bin.defineType("-4",-4);
    bin.defineType("-5",-5);
    bin.defineType("-6",-6);
    bin.defineType("-7",-7);
    bin.defineType("-8",-8);

    
    RooSuperCategory bintag("bintag","bintag",RooArgSet(bin,tag));

    tree->Print();

    RooDataSet d("data","data",tree,RooArgSet(dt,bin,tag));
    cout << "DataSet is ready." << endl;
    d.Print();

    RooRealVar mean("mean","mean",0.,"ps"); mean.setConstant(kTRUE);
    RooRealVar sigma("sigma","sigma",_sigma_over_tau*_tau,0.,1.5*_tau,"ps"); if(constSigma) sigma.setConstant(kTRUE);
    RooGaussModel rf("rf","rf",dt,mean,sigma);
//    RooTruthModel rf("rf","rf",dt);
    RooGaussian rfpdf("rfpdf","rfpdf",dt,mean,sigma);

    cout << "Preparing PDFs..." << endl;
//    RooRealVar* fsigs1[8];
//    RooRealVar* fsigs1b[8];
//    RooRealVar* fsigs2[8];
//    RooRealVar* fsigs2b[8];
    RooBDecay* sigpdfs1[8];
    RooBDecay* sigpdfs1b[8];
    RooBDecay* sigpdfs2[8];
    RooBDecay* sigpdfs2b[8];
    RooAddPdf* PDFs1[8];
    RooAddPdf* PDFs1b[8];
    RooAddPdf* PDFs2[8];
    RooAddPdf* PDFs2b[8];
    RooAddPdf* pdfs1[8];
    RooAddPdf* pdfs1b[8];
    RooAddPdf* pdfs2[8];
    RooAddPdf* pdfs2b[8];
    RooSimultaneous pdf("pdf","pdf",bintag);
    RooRealVar fsig("fsig","fsig",_purity,0.,1.); if(constFSig) fsig.setConstant(kTRUE);
    fsig.Print();
    for(int j=0; j<8; j++){
//        out.str("");
//        out << "fsig1" << j+1;
//        fsigs1[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.);  if(constFSig) fsigs1[j]->setConstant(kTRUE);
//        out.str("");
//        out << "fsig1b" << j+1;
//        fsigs1b[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs1b[j]->setConstant(kTRUE);
//        out.str("");
//        out << "fsig2" << j+1;
//        fsigs2[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.);  if(constFSig) fsigs2[j]->setConstant(kTRUE);
//        out.str("");
//        out << "fsig2b" << j+1;
//        fsigs2b[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs2b[j]->setConstant(kTRUE);

        out.str("");
        out << "sigpdf1" << j+1;
        sigpdfs1[j]  = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a1[0][j],*b1[0][j],dm,rf,RooBDecay::DoubleSided);
        out.str("");
        out << "sigpdf1b" << j+1;
        sigpdfs1b[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a1[1][j],*b1[1][j],dm,rf,RooBDecay::DoubleSided);
        out.str("");
        out << "sigpdf2" << j+1;
        sigpdfs2[j]  = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a2[0][j],*b2[0][j],dm,rf,RooBDecay::DoubleSided);
        out.str("");
        out << "sigpdf2b" << j+1;
        sigpdfs2b[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a2[1][j],*b2[1][j],dm,rf,RooBDecay::DoubleSided);

        out.str("");
        out << "PDF1" << j+1;
        PDFs1[j]  = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs1[j],rfpdf),RooArgList(fsig));
        out.str("");
        out << "PDF1b" << j+1;
        PDFs1b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs1b[j],rfpdf),RooArgList(fsig));
        out.str("");
        out << "PDF2" << j+1;
        PDFs2[j]  = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs2[j],rfpdf),RooArgList(fsig));
        out.str("");
        out << "PDF2b" << j+1;
        PDFs2b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs2b[j],rfpdf),RooArgList(fsig));

        //Adding mistaging
        out.str("");
        out << "pdf1" << j+1;
        pdfs1[j]  = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs2[j],*PDFs1[j]),RooArgList(avgMisgat));
        out.str("");
        out << "pdf1b" << j+1;
        pdfs1b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs2b[j],*PDFs1b[j]),RooArgList(avgMisgat));
        out.str("");
        out << "pdf2" << j+1;
        pdfs2[j]  = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs1[j],*PDFs2[j]),RooArgList(avgMisgat));
        out.str("");
        out << "pdf2b" << j+1;
        pdfs2b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs1b[j],*PDFs2b[j]),RooArgList(avgMisgat));

        out.str("");
        out << "{" << j+1 << ";B0}";
        pdf.addPdf(*pdfs1[j],out.str().c_str());
        out.str("");
        out << "{" << -(j+1) << ";B0}";
        pdf.addPdf(*pdfs1b[j],out.str().c_str());
        out.str("");
        out << "{" << j+1 << ";anti-B0}";
        pdf.addPdf(*pdfs2[j],out.str().c_str());
        out.str("");
        out << "{" << -(j+1) << ";anti-B0}";
        pdf.addPdf(*pdfs2b[j],out.str().c_str());
    }

    cout << "Fitting..." << endl;
    pdf.fitTo(d,Verbose(),Timer());
    dt.setBins(50);

    cout << "Drawing plots." << endl;
    for(int i=0; i<8; i++){
        RooPlot* dtFrame = dt.frame();
        out.str("");
        out << "tag == 1 && bin == " << i+1;
        RooDataSet* ds = d.reduce(out.str().c_str());
        ds->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kBlue));

        out.str("");
        out << "{" << j+1 << ";B0}";
        bintag = out.str().c_str();
        pdf.plotOn(dtFrame,ProjWData(*ds),Slice(bintag),LineColor(kBlue));
        double chi2 = dtFrame->chiSquare();

        out.str("");
        out << "tag == -1 && bin == " << i+1;
        RooDataSet* dsb = d.reduce(out.str().c_str());
        dsb->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kRed));

        out.str("");
        out << "{" << j+1 << ";anti-B0}";
        bintag = out.str().c_str();
        pdf.plotOn(dtFrame,ProjWData(*dsb),Slice(bintag),LineColor(kRed));
        double chi2b = dtFrame->chiSquare();

        out.str("");
        out << "#Delta t, toy MC, bin == " << i+1;
        TCanvas* cm = new TCanvas(out.str().c_str(),out.str().c_str(),600,400);
        cm->cd();
        dtFrame->GetXaxis()->SetTitleSize(0.05);
        dtFrame->GetXaxis()->SetTitleOffset(0.85);
        dtFrame->GetXaxis()->SetLabelSize(0.05);
        dtFrame->GetYaxis()->SetTitleOffset(1.6);

        TPaveText *ptB = new TPaveText(0.7,0.65,0.98,0.99,"brNDC");
        ptB->SetFillColor(0);
        ptB->SetTextAlign(12);
        out.str("");
        out << "bin = " << (i+1);
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#chi^{2}(B^{0}) = " << chi2;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#chi^{2}(#barB^{0}) = " << chi2b;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#sigma/#tau = " << _sigma_over_tau;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "purity = " << _purity;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "mistag = " << mistag_rate;
        ptB->AddText(out.str().c_str());

        dtFrame->Draw();
        ptB->Draw();

        out.str("");
        out << "../Reports/cpfitfigs/dt_bin" << (i+1) << ".root";
        cm->Print(out.str().c_str());
        out.str("");
        out << "../Reports/cpfitfigs/dt_bin" << (i+1) << ".png";
        cm->Print(out.str().c_str());
    }

    for(int i=0; i<8; i++){
        RooPlot* dtFrame = dt.frame();
        out.str("");
        out << "tag == 1 && bin == " << -(i+1);
        RooDataSet* ds2 = (RooDataSet*)d.reduce(out.str().c_str());
        ds2->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kBlue));

        out.str("");
        out << "{" << -(j+1) << ";B0}";
        bintag = out.str().c_str();
        pdf.plotOn(dtFrame,ProjWData(*ds2),Slice(bintag),LineColor(kBlue));
        double chi2 = dtFrame->chiSquare();

        out.str("");
        out << "tag == -1 && bin == " << -(i+1);
        RooDataSet* ds2b = (RooDataSet*)d.reduce(out.str().c_str());
        ds2b->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kRed));

        out.str("");
        out << "{" << -(j+1) << ";anti-B0}";
        bin = out.str().c_str();
        pdf.plotOn(dtFrame,ProjWData(*ds2b),Slice(bintag),LineColor(kRed));
        double chi2b = dtFrame->chiSquare();

        out.str("");
        out << "#Delta t, toy MC, bin == " << -(i+1);
        TCanvas* cm = new TCanvas(out.str().c_str(),out.str().c_str(),600,400);
        cm->cd();
        dtFrame->GetXaxis()->SetTitleSize(0.05);
        dtFrame->GetXaxis()->SetTitleOffset(0.85);
        dtFrame->GetXaxis()->SetLabelSize(0.05);
        dtFrame->GetYaxis()->SetTitleOffset(1.6);

        TPaveText *ptB = new TPaveText(0.7,0.65,0.98,0.99,"brNDC");
        ptB->SetFillColor(0);
        ptB->SetTextAlign(12);
        out.str("");
        out << "bin = " << -(i+1);
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#chi^{2}(B^{0}) = " << chi2;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#chi^{2}(#barB^{0}) = " << chi2b;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "#sigma/#tau = " << _sigma_over_tau;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "purity = " << _purity;
        ptB->AddText(out.str().c_str());
        out.str("");
        out << "mistag = " << mistag_rate;
        ptB->AddText(out.str().c_str());

        dtFrame->Draw();
        ptB->Draw();

        out.str("");
        out << "../Reports/cpfitfigs/dt_bin" << -(i+1) << ".root";
        cm->Print(out.str().c_str());
        out.str("");
        out << "../Reports/cpfitfigs/dt_bin" << -(i+1) << ".png";
        cm->Print(out.str().c_str());
    }

    return;
}
void paraPull_alpha_MUON_ISO_SYS_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_MUON_ISO_SYS
//=========  (Sun Nov 22 20:21:56 2015) by ROOT version6.02/12
   TCanvas *c1 = new TCanvas("c1", "alpha_MUON_ISO_SYS",0,22,1000,600);
   gStyle->SetOptStat(0);
   c1->Range(-4.125,-0.9777052,37.125,1.049159);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetGridx();
   c1->SetGridy();
   c1->SetFrameBorderMode(0);
   c1->SetFrameBorderMode(0);
   
   TH1F *NuisanceParameterFreed33 = new TH1F("NuisanceParameterFreed33","alpha_MUON_ISO_SYS",33,0,33);
   NuisanceParameterFreed33->SetMinimum(-0.7750188);
   NuisanceParameterFreed33->SetMaximum(0.8464727);
   NuisanceParameterFreed33->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   NuisanceParameterFreed33->SetLineColor(ci);
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(1,"XS_ttbar");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(4,"Luminosity");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(5,"XS_st");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(7,"XS_Zc");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(8,"MUONS_ID");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(12,"XS_Zl");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(18,"MUONS_SCALE");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(20,"FT_EFF_extrapolation");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(21,"MUON_EFF_STAT");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(22,"MUON_EFF_SYS");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(23,"MUON_EFF_TrigStatUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(25,"FT_EFF_Eigen_Light_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(26,"EG_RESOLUTION_ALL");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(27,"XS_diboson");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_4");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(29,"FT_EFF_Eigen_Light_3");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(30,"MUONS_MS");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(31,"XS_Zb");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
   NuisanceParameterFreed33->GetXaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetXaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetXaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetXaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
   NuisanceParameterFreed33->GetYaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetYaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetYaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetYaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->GetZaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetZaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetZaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetZaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->Draw("hist");
   
   Double_t _fx1033[35] = {
   1.22802e-312,
   0.5,
   1.5,
   2.5,
   3.5,
   4.5,
   5.5,
   6.5,
   7.5,
   8.5,
   9.5,
   10.5,
   11.5,
   12.5,
   13.5,
   14.5,
   15.5,
   16.5,
   17.5,
   18.5,
   19.5,
   20.5,
   21.5,
   22.5,
   23.5,
   24.5,
   25.5,
   26.5,
   27.5,
   28.5,
   29.5,
   30.5,
   31.5,
   32.5,
   0};
   Double_t _fy1033[35] = {
   1.22802e-312,
   -0.7750188,
   -0.3925669,
   -0.2928498,
   -0.2070924,
   -0.1830524,
   -0.1280032,
   -0.1262679,
   -0.1096289,
   -0.06558224,
   -0.05681625,
   -0.05340132,
   -0.04752113,
   -0.03756,
   -0.03159065,
   -0.03113199,
   -0.02395544,
   -0.01709673,
   -0.001375576,
   0.0001640258,
   0.01017132,
   0.01056379,
   0.01803238,
   0.01953954,
   0.02015159,
   0.02033505,
   0.0231812,
   0.04061694,
   0.04275862,
   0.04588616,
   0.04795404,
   0.05347781,
   0.05730227,
   0.8464727,
   0};
   Double_t _fex1033[35] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fey1033[35] = {
   0,
   0,
   0.6105177,
   1.072963,
   1.274131,
   0.9350411,
   0.9915346,
   0.9862834,
   0.9243374,
   0.769056,
   0.9864216,
   0.9937953,
   0.9917567,
   0.9969205,
   0.9819024,
   0.9371645,
   0.9926625,
   0.9931845,
   0.9925671,
   1.004991,
   0.9933467,
   0.9551202,
   0.9932281,
   0.9929675,
   0.9926546,
   0.9909755,
   0.9913131,
   1.098392,
   0.9868992,
   0.9931708,
   0.9930622,
   0.7376817,
   0.7516033,
   0.9909095,
   0.7841002};
   TGraphErrors *gre = new TGraphErrors(35,_fx1033,_fy1033,_fex1033,_fey1033);
   gre->SetName("");
   gre->SetTitle("");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(20);
   gre->SetMarkerSize(1.2);
   
   TH1F *Graph_Graph1033 = new TH1F("Graph_Graph1033","",100,0,35.75);
   Graph_Graph1033->SetMinimum(-1.813084);
   Graph_Graph1033->SetMaximum(2.169243);
   Graph_Graph1033->SetDirectory(0);
   Graph_Graph1033->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1033->SetLineColor(ci);
   Graph_Graph1033->GetXaxis()->SetLabelFont(42);
   Graph_Graph1033->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetXaxis()->SetTitleFont(42);
   Graph_Graph1033->GetYaxis()->SetLabelFont(42);
   Graph_Graph1033->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetYaxis()->SetTitleFont(42);
   Graph_Graph1033->GetZaxis()->SetLabelFont(42);
   Graph_Graph1033->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1033);
   
   gre->Draw("p");
   
   TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(72);
   leg->SetTextSize(0.015);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.3293574,0.9341608,0.6706426,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("alpha_MUON_ISO_SYS");
   pt->Draw();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
void SegX_2016B_June22all_sameYrange_fullIntegral_10k9k()
{
//=========Macro generated from canvas: SegX/SegX
//=========  (Fri Aug  5 09:22:37 2016) by ROOT version6.06/01
   TCanvas *SegX = new TCanvas("SegX", "SegX",0,0,500,500);
   gStyle->SetOptStat(0);
   SegX->SetHighLightColor(2);
   SegX->Range(-125,-2.848556,125,2.626708);
   SegX->SetFillColor(0);
   SegX->SetBorderMode(0);
   SegX->SetBorderSize(2);
   SegX->SetLogy();
   SegX->SetFrameBorderMode(0);
   SegX->SetFrameBorderMode(0);
   
   TH1D *SegX_1__19 = new TH1D("SegX_1__19","SegX",100,-100,100);
   SegX_1__19->SetBinContent(0,399.7427);
   SegX_1__19->SetBinContent(39,0.0007394809);
   SegX_1__19->SetBinContent(40,0.01109221);
   SegX_1__19->SetBinContent(41,0.02366339);
   SegX_1__19->SetBinContent(42,0.04880574);
   SegX_1__19->SetBinContent(43,0.09613251);
   SegX_1__19->SetBinContent(44,0.5671818);
   SegX_1__19->SetBinContent(45,1.913037);
   SegX_1__19->SetBinContent(46,3.895585);
   SegX_1__19->SetBinContent(47,8.348);
   SegX_1__19->SetBinContent(48,11.60985);
   SegX_1__19->SetBinContent(49,11.7363);
   SegX_1__19->SetBinContent(50,12.04171);
   SegX_1__19->SetBinContent(51,12.05058);
   SegX_1__19->SetBinContent(52,11.89159);
   SegX_1__19->SetBinContent(53,11.26081);
   SegX_1__19->SetBinContent(54,8.149079);
   SegX_1__19->SetBinContent(55,3.796495);
   SegX_1__19->SetBinContent(56,1.839089);
   SegX_1__19->SetBinContent(57,0.5302078);
   SegX_1__19->SetBinContent(58,0.09835096);
   SegX_1__19->SetBinContent(59,0.05472159);
   SegX_1__19->SetBinContent(60,0.02292391);
   SegX_1__19->SetBinContent(61,0.008873771);
   SegX_1__19->SetBinContent(62,0.005176366);
   SegX_1__19->SetMinimum(0.005);
   SegX_1__19->SetMaximum(120);
   SegX_1__19->SetEntries(675802);
   SegX_1__19->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff00ff");
   SegX_1__19->SetLineColor(ci);

   ci = TColor::GetColor("#ff00ff");
   SegX_1__19->SetMarkerColor(ci);
   SegX_1__19->GetXaxis()->SetTitle("cm");
   SegX_1__19->GetYaxis()->SetTitle("scaled number of entries");
   SegX_1__19->Draw("H");
   
   TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *SegX_2__20 = new TH1D("SegX_2__20","SegX",100,-100,100);
   SegX_2__20->SetBinContent(0,270.1449);
   SegX_2__20->SetBinContent(39,0.0249815);
   SegX_2__20->SetBinContent(40,0.1142904);
   SegX_2__20->SetBinContent(41,0.3269454);
   SegX_2__20->SetBinContent(42,1.204733);
   SegX_2__20->SetBinContent(43,2.505957);
   SegX_2__20->SetBinContent(44,3.989545);
   SegX_2__20->SetBinContent(45,5.530904);
   SegX_2__20->SetBinContent(46,6.957972);
   SegX_2__20->SetBinContent(47,7.25369);
   SegX_2__20->SetBinContent(48,7.353304);
   SegX_2__20->SetBinContent(49,7.47384);
   SegX_2__20->SetBinContent(50,7.455104);
   SegX_2__20->SetBinContent(51,7.516308);
   SegX_2__20->SetBinContent(52,7.505691);
   SegX_2__20->SetBinContent(53,7.34581);
   SegX_2__20->SetBinContent(54,7.34862);
   SegX_2__20->SetBinContent(55,6.910819);
   SegX_2__20->SetBinContent(56,5.432227);
   SegX_2__20->SetBinContent(57,3.844028);
   SegX_2__20->SetBinContent(58,2.401034);
   SegX_2__20->SetBinContent(59,1.067022);
   SegX_2__20->SetBinContent(60,0.2994657);
   SegX_2__20->SetBinContent(61,0.1164762);
   SegX_2__20->SetBinContent(62,0.02123427);
   SegX_2__20->SetEntries(1185341);
   SegX_2__20->SetStats(0);

   ci = TColor::GetColor("#ff9999");
   SegX_2__20->SetLineColor(ci);

   ci = TColor::GetColor("#ff9999");
   SegX_2__20->SetMarkerColor(ci);
   SegX_2__20->GetXaxis()->SetTitle("cm");
   SegX_2__20->GetYaxis()->SetTitle("scaled number of entries");
   SegX_2__20->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *SegX_3__21 = new TH1D("SegX_3__21","SegX",100,-100,100);
   SegX_3__21->SetBinContent(0,80.5951);
   SegX_3__21->SetBinContent(28,0.0004635445);
   SegX_3__21->SetBinContent(29,0.001390634);
   SegX_3__21->SetBinContent(30,0.01344279);
   SegX_3__21->SetBinContent(31,0.03754711);
   SegX_3__21->SetBinContent(32,0.1219122);
   SegX_3__21->SetBinContent(33,0.3712992);
   SegX_3__21->SetBinContent(34,0.817229);
   SegX_3__21->SetBinContent(35,1.240445);
   SegX_3__21->SetBinContent(36,1.838418);
   SegX_3__21->SetBinContent(37,2.596777);
   SegX_3__21->SetBinContent(38,3.1229);
   SegX_3__21->SetBinContent(39,3.203556);
   SegX_3__21->SetBinContent(40,3.271697);
   SegX_3__21->SetBinContent(41,3.325005);
   SegX_3__21->SetBinContent(42,3.348646);
   SegX_3__21->SetBinContent(43,3.330568);
   SegX_3__21->SetBinContent(44,3.375068);
   SegX_3__21->SetBinContent(45,3.360234);
   SegX_3__21->SetBinContent(46,3.349109);
   SegX_3__21->SetBinContent(47,3.318515);
   SegX_3__21->SetBinContent(48,3.375531);
   SegX_3__21->SetBinContent(49,3.312489);
   SegX_3__21->SetBinContent(50,3.43162);
   SegX_3__21->SetBinContent(51,3.357453);
   SegX_3__21->SetBinContent(52,3.422813);
   SegX_3__21->SetBinContent(53,3.361625);
   SegX_3__21->SetBinContent(54,3.392682);
   SegX_3__21->SetBinContent(55,3.39361);
   SegX_3__21->SetBinContent(56,3.321297);
   SegX_3__21->SetBinContent(57,3.326859);
   SegX_3__21->SetBinContent(58,3.282822);
   SegX_3__21->SetBinContent(59,3.388047);
   SegX_3__21->SetBinContent(60,3.411224);
   SegX_3__21->SetBinContent(61,3.326859);
   SegX_3__21->SetBinContent(62,3.22627);
   SegX_3__21->SetBinContent(63,3.022774);
   SegX_3__21->SetBinContent(64,2.55274);
   SegX_3__21->SetBinContent(65,1.746172);
   SegX_3__21->SetBinContent(66,1.123632);
   SegX_3__21->SetBinContent(67,0.7268378);
   SegX_3__21->SetBinContent(68,0.3203093);
   SegX_3__21->SetBinContent(69,0.09409954);
   SegX_3__21->SetBinContent(70,0.03337521);
   SegX_3__21->SetBinContent(71,0.003708356);
   SegX_3__21->SetBinContent(72,0.0009270891);
   SegX_3__21->SetEntries(389596);
   SegX_3__21->SetStats(0);
   SegX_3__21->GetXaxis()->SetTitle("cm");
   SegX_3__21->GetYaxis()->SetTitle("scaled number of entries");
   SegX_3__21->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *SegX_4__22 = new TH1D("SegX_4__22","SegX",100,-100,100);
   SegX_4__22->SetBinContent(0,205.6549);
   SegX_4__22->SetBinContent(20,0.002748252);
   SegX_4__22->SetBinContent(21,0.008244756);
   SegX_4__22->SetBinContent(22,0.01972275);
   SegX_4__22->SetBinContent(23,0.06773633);
   SegX_4__22->SetBinContent(24,0.1547104);
   SegX_4__22->SetBinContent(25,0.2565574);
   SegX_4__22->SetBinContent(26,0.3739239);
   SegX_4__22->SetBinContent(27,0.4752859);
   SegX_4__22->SetBinContent(28,0.5855393);
   SegX_4__22->SetBinContent(29,0.687063);
   SegX_4__22->SetBinContent(30,0.84339);
   SegX_4__22->SetBinContent(31,1.017177);
   SegX_4__22->SetBinContent(32,1.278746);
   SegX_4__22->SetBinContent(33,1.383664);
   SegX_4__22->SetBinContent(34,1.584286);
   SegX_4__22->SetBinContent(35,1.911167);
   SegX_4__22->SetBinContent(36,2.183405);
   SegX_4__22->SetBinContent(37,2.35606);
   SegX_4__22->SetBinContent(38,2.533727);
   SegX_4__22->SetBinContent(39,2.709938);
   SegX_4__22->SetBinContent(40,2.69458);
   SegX_4__22->SetBinContent(41,2.674696);
   SegX_4__22->SetBinContent(42,2.683264);
   SegX_4__22->SetBinContent(43,2.654165);
   SegX_4__22->SetBinContent(44,2.712525);
   SegX_4__22->SetBinContent(45,2.747282);
   SegX_4__22->SetBinContent(46,2.711231);
   SegX_4__22->SetBinContent(47,2.720446);
   SegX_4__22->SetBinContent(48,2.75585);
   SegX_4__22->SetBinContent(49,2.717375);
   SegX_4__22->SetBinContent(50,2.758275);
   SegX_4__22->SetBinContent(51,2.76943);
   SegX_4__22->SetBinContent(52,2.74906);
   SegX_4__22->SetBinContent(53,2.771046);
   SegX_4__22->SetBinContent(54,2.740816);
   SegX_4__22->SetBinContent(55,2.685851);
   SegX_4__22->SetBinContent(56,2.669523);
   SegX_4__22->SetBinContent(57,2.647213);
   SegX_4__22->SetBinContent(58,2.597745);
   SegX_4__22->SetBinContent(59,2.6401);
   SegX_4__22->SetBinContent(60,2.63913);
   SegX_4__22->SetBinContent(61,2.655943);
   SegX_4__22->SetBinContent(62,2.623126);
   SegX_4__22->SetBinContent(63,2.52629);
   SegX_4__22->SetBinContent(64,2.347007);
   SegX_4__22->SetBinContent(65,2.170634);
   SegX_4__22->SetBinContent(66,1.884493);
   SegX_4__22->SetBinContent(67,1.603524);
   SegX_4__22->SetBinContent(68,1.388999);
   SegX_4__22->SetBinContent(69,1.219901);
   SegX_4__22->SetBinContent(70,1.018147);
   SegX_4__22->SetBinContent(71,0.8441984);
   SegX_4__22->SetBinContent(72,0.6936911);
   SegX_4__22->SetBinContent(73,0.5441539);
   SegX_4__22->SetBinContent(74,0.4651012);
   SegX_4__22->SetBinContent(75,0.3503213);
   SegX_4__22->SetBinContent(76,0.2463727);
   SegX_4__22->SetBinContent(77,0.1514772);
   SegX_4__22->SetBinContent(78,0.06708968);
   SegX_4__22->SetBinContent(79,0.01762115);
   SegX_4__22->SetBinContent(80,0.006951461);
   SegX_4__22->SetBinContent(81,0.001939943);
   SegX_4__22->SetBinContent(82,0.0003233238);
   SegX_4__22->SetEntries(1890705);
   SegX_4__22->SetStats(0);

   ci = TColor::GetColor("#ff0000");
   SegX_4__22->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   SegX_4__22->SetMarkerColor(ci);
   SegX_4__22->GetXaxis()->SetTitle("cm");
   SegX_4__22->GetYaxis()->SetTitle("scaled number of entries");
   SegX_4__22->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *SegX_5__23 = new TH1D("SegX_5__23","SegX",100,-100,100);
   SegX_5__23->SetBinContent(0,157.814);
   SegX_5__23->SetBinContent(20,0.002033373);
   SegX_5__23->SetBinContent(21,0.006839528);
   SegX_5__23->SetBinContent(22,0.01959432);
   SegX_5__23->SetBinContent(23,0.07671363);
   SegX_5__23->SetBinContent(24,0.1695094);
   SegX_5__23->SetBinContent(25,0.2972422);
   SegX_5__23->SetBinContent(26,0.4053807);
   SegX_5__23->SetBinContent(27,0.513704);
   SegX_5__23->SetBinContent(28,0.6421762);
   SegX_5__23->SetBinContent(29,0.7730515);
   SegX_5__23->SetBinContent(30,0.9682553);
   SegX_5__23->SetBinContent(31,1.173626);
   SegX_5__23->SetBinContent(32,1.3936);
   SegX_5__23->SetBinContent(33,1.584737);
   SegX_5__23->SetBinContent(34,1.798056);
   SegX_5__23->SetBinContent(35,2.092526);
   SegX_5__23->SetBinContent(36,2.351134);
   SegX_5__23->SetBinContent(37,2.561681);
   SegX_5__23->SetBinContent(38,2.586636);
   SegX_5__23->SetBinContent(39,2.621203);
   SegX_5__23->SetBinContent(40,2.579241);
   SegX_5__23->SetBinContent(41,2.579057);
   SegX_5__23->SetBinContent(42,2.579796);
   SegX_5__23->SetBinContent(43,2.63784);
   SegX_5__23->SetBinContent(44,2.620279);
   SegX_5__23->SetBinContent(45,2.582569);
   SegX_5__23->SetBinContent(46,2.566302);
   SegX_5__23->SetBinContent(47,2.530441);
   SegX_5__23->SetBinContent(48,2.528777);
   SegX_5__23->SetBinContent(49,2.546338);
   SegX_5__23->SetBinContent(50,2.577208);
   SegX_5__23->SetBinContent(51,2.52545);
   SegX_5__23->SetBinContent(52,2.498461);
   SegX_5__23->SetBinContent(53,2.490882);
   SegX_5__23->SetBinContent(54,2.534138);
   SegX_5__23->SetBinContent(55,2.527113);
   SegX_5__23->SetBinContent(56,2.571478);
   SegX_5__23->SetBinContent(57,2.530071);
   SegX_5__23->SetBinContent(58,2.587005);
   SegX_5__23->SetBinContent(59,2.566117);
   SegX_5__23->SetBinContent(60,2.54301);
   SegX_5__23->SetBinContent(61,2.554102);
   SegX_5__23->SetBinContent(62,2.535247);
   SegX_5__23->SetBinContent(63,2.604012);
   SegX_5__23->SetBinContent(64,2.53155);
   SegX_5__23->SetBinContent(65,2.317861);
   SegX_5__23->SetBinContent(66,2.053707);
   SegX_5__23->SetBinContent(67,1.759977);
   SegX_5__23->SetBinContent(68,1.516342);
   SegX_5__23->SetBinContent(69,1.373451);
   SegX_5__23->SetBinContent(70,1.156989);
   SegX_5__23->SetBinContent(71,0.9863709);
   SegX_5__23->SetBinContent(72,0.7802608);
   SegX_5__23->SetBinContent(73,0.6194394);
   SegX_5__23->SetBinContent(74,0.5092676);
   SegX_5__23->SetBinContent(75,0.4011291);
   SegX_5__23->SetBinContent(76,0.2872602);
   SegX_5__23->SetBinContent(77,0.163779);
   SegX_5__23->SetBinContent(78,0.08170463);
   SegX_5__23->SetBinContent(79,0.02051858);
   SegX_5__23->SetBinContent(80,0.006654676);
   SegX_5__23->SetBinContent(81,0.001109113);
   SegX_5__23->SetEntries(1394704);
   SegX_5__23->SetStats(0);

   ci = TColor::GetColor("#00ff00");
   SegX_5__23->SetLineColor(ci);

   ci = TColor::GetColor("#00ff00");
   SegX_5__23->SetMarkerColor(ci);
   SegX_5__23->GetXaxis()->SetTitle("cm");
   SegX_5__23->GetYaxis()->SetTitle("scaled number of entries");
   SegX_5__23->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TH1D *SegX_6__24 = new TH1D("SegX_6__24","SegX",100,-100,100);
   SegX_6__24->SetBinContent(0,127.6015);
   SegX_6__24->SetBinContent(20,0.001032403);
   SegX_6__24->SetBinContent(21,0.004336093);
   SegX_6__24->SetBinContent(22,0.01817029);
   SegX_6__24->SetBinContent(23,0.08341816);
   SegX_6__24->SetBinContent(24,0.1755085);
   SegX_6__24->SetBinContent(25,0.3111663);
   SegX_6__24->SetBinContent(26,0.4148195);
   SegX_6__24->SetBinContent(27,0.5382949);
   SegX_6__24->SetBinContent(28,0.6943943);
   SegX_6__24->SetBinContent(29,0.8948869);
   SegX_6__24->SetBinContent(30,1.059452);
   SegX_6__24->SetBinContent(31,1.265726);
   SegX_6__24->SetBinContent(32,1.461057);
   SegX_6__24->SetBinContent(33,1.634294);
   SegX_6__24->SetBinContent(34,1.885787);
   SegX_6__24->SetBinContent(35,2.235772);
   SegX_6__24->SetBinContent(36,2.351608);
   SegX_6__24->SetBinContent(37,2.469508);
   SegX_6__24->SetBinContent(38,2.50048);
   SegX_6__24->SetBinContent(39,2.516792);
   SegX_6__24->SetBinContent(40,2.462488);
   SegX_6__24->SetBinContent(41,2.513488);
   SegX_6__24->SetBinContent(42,2.529387);
   SegX_6__24->SetBinContent(43,2.509152);
   SegX_6__24->SetBinContent(44,2.564283);
   SegX_6__24->SetBinContent(45,2.531865);
   SegX_6__24->SetBinContent(46,2.500687);
   SegX_6__24->SetBinContent(47,2.495937);
   SegX_6__24->SetBinContent(48,2.522367);
   SegX_6__24->SetBinContent(49,2.535169);
   SegX_6__24->SetBinContent(50,2.563663);
   SegX_6__24->SetBinContent(51,2.495112);
   SegX_6__24->SetBinContent(52,2.525051);
   SegX_6__24->SetBinContent(53,2.496144);
   SegX_6__24->SetBinContent(54,2.51163);
   SegX_6__24->SetBinContent(55,2.514727);
   SegX_6__24->SetBinContent(56,2.579562);
   SegX_6__24->SetBinContent(57,2.585137);
   SegX_6__24->SetBinContent(58,2.518857);
   SegX_6__24->SetBinContent(59,2.536201);
   SegX_6__24->SetBinContent(60,2.563457);
   SegX_6__24->SetBinContent(61,2.528768);
   SegX_6__24->SetBinContent(62,2.531865);
   SegX_6__24->SetBinContent(63,2.472192);
   SegX_6__24->SetBinContent(64,2.477767);
   SegX_6__24->SetBinContent(65,2.363377);
   SegX_6__24->SetBinContent(66,2.154832);
   SegX_6__24->SetBinContent(67,1.816616);
   SegX_6__24->SetBinContent(68,1.592172);
   SegX_6__24->SetBinContent(69,1.388582);
   SegX_6__24->SetBinContent(70,1.132133);
   SegX_6__24->SetBinContent(71,1.010723);
   SegX_6__24->SetBinContent(72,0.82489);
   SegX_6__24->SetBinContent(73,0.6696166);
   SegX_6__24->SetBinContent(74,0.5168209);
   SegX_6__24->SetBinContent(75,0.3947909);
   SegX_6__24->SetBinContent(76,0.2859756);
   SegX_6__24->SetBinContent(77,0.1655974);
   SegX_6__24->SetBinContent(78,0.0755719);
   SegX_6__24->SetBinContent(79,0.02064806);
   SegX_6__24->SetBinContent(80,0.005368496);
   SegX_6__24->SetBinContent(81,0.0008259224);
   SegX_6__24->SetEntries(1102290);
   SegX_6__24->SetStats(0);

   ci = TColor::GetColor("#0000ff");
   SegX_6__24->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   SegX_6__24->SetMarkerColor(ci);
   SegX_6__24->GetXaxis()->SetTitle("cm");
   SegX_6__24->GetYaxis()->SetTitle("scaled number of entries");
   SegX_6__24->Draw("H,same");
   
   leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextFont(62);
   leg->SetTextSize(0.02);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l");

   ci = TColor::GetColor("#ff00ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l");

   ci = TColor::GetColor("#ff9999");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l");

   ci = TColor::GetColor("#00ff00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(62);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.01,0.9390678,0.1408871,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(1);
   pt->SetFillColor(0);
   TText *AText = pt->AddText("SegX");
   pt->Draw();
   SegX->Modified();
   SegX->cd();
   SegX->SetSelected(SegX);
}
void InclusiveJets_2010_mcdataRatio(){

//general root settings
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0); //get rid of statistics box

// to set the errors of the histograms to sqrt(sum of squares of weights)
TH1::SetDefaultSumw2() ;

//Ranges for plots
Float_t xmin=17.5 , ymin = 0.00001, xmax = 1684.0, ymax = 10000000000000000.;

//for the linecolor and linestyle
Int_t icol[8]={8,kViolet,7,4,12,46,6,7};
Int_t isty[8]={1,1,1,1,1,1,1,1};
Int_t imark[5] = {21,22,25,26,3};

//get the root files
TFile *f[3];
f[0] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADONbornkt5ktsupp250_errorcut.root");
f[1] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADOFFbornkt5ktsupp250_errorcut.root");
f[2] = new TFile("out_aida_40times900kevents_errorcut50/NOTUNEbornkt5ktsupp250_errorcut.root");

//get the Tgraph and convert into histo
TH1F _histotmp[6][3];
Int_t n = 3; //number of files
Int_t nh = 6; // number of histograms = number of y bins

for(const int ifile = 0; ifile < n; ifile++){

  _histotmp[0][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d01_x01_y01;1")); // |y| <0.5
  _histotmp[1][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d02_x01_y01;2")); // 0.5 < |y| < 1.0
  _histotmp[2][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d03_x01_y01;2")); // 1.0 < |y| < 1.5
  _histotmp[3][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d04_x01_y01;2")); // 1.5 < |y| < 2.0
  _histotmp[4][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
  _histotmp[5][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0

  for(const int ihisto = 0; ihisto < nh; ihisto++){
    _histotmp[ihisto][ifile].SetName("");
  }
}

//change the histo so that I can plot it and do the ratio
 TH1F *_histo[6][3];

for(const int ifile = 0; ifile < n; ifile++){
  for(const int ihisto = 0; ihisto < nh; ihisto++){

    TH1F *_histo[ihisto][ifile]= (TH1F*)_histotmp[ihisto][ifile].Clone("");
/*
  _histo[ihisto][ifile]->Divide((TH1*)_histo[ihisto][1]);  //histo 0 / hsito 1
  TH1F *_ratio1[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone("");
  _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]);  //histo 0 / hsito 2
  TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone("");
*/
    _histo[ihisto][ifile]->SetLineWidth(2);
    _histo[ihisto][ifile]->SetLineColor(icol[ihisto]);
    _histo[ihisto][ifile]->SetMarkerStyle(2);
    _histo[ihisto][ifile]->SetMarkerColor(icol[ihisto]);

  }

//scale the histos that it fits in one histogram
_histo[0][ifile]->Scale(10000);
_histo[1][ifile]->Scale(1000);
_histo[2][ifile]->Scale(100);
_histo[3][ifile]->Scale(10);
_histo[4][ifile]->Scale(1);
}

//get the data 2010
//data =  new TFile("out_aida/CMS_2011_S9086218.root");

//TH1F _histodata1 = Gr2Hi((TGraph*)data->Get("d01_x01_y01;1")); // |y| <0.5
//TH1F _histodata2 = Gr2Hi((TGraph*)data->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0
//TH1F _histodata3 = Gr2Hi((TGraph*)data->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5
//TH1F _histodata4 = Gr2Hi((TGraph*)data->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0
//TH1F _histodata5 = Gr2Hi((TGraph*)data->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5
//TH1F _histodata6 = Gr2Hi((TGraph*)data->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0


   Double_t xAxis1[35] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 737, 846, 1684}; 

   TH1F *d01_x01_y01_histo = new TH1F("d01_x01_y01_histo","d01_x01_y01_histo",34, xAxis1);
   d01_x01_y01_histo->SetBinContent(1,1.97e+11);
   d01_x01_y01_histo->SetBinContent(2,1.02e+11);
   d01_x01_y01_histo->SetBinContent(3,5.14e+10);
   d01_x01_y01_histo->SetBinContent(4,2.66e+10);
   d01_x01_y01_histo->SetBinContent(5,1.38e+10);
   d01_x01_y01_histo->SetBinContent(6,6.53e+09);
   d01_x01_y01_histo->SetBinContent(7,3.35e+09);
   d01_x01_y01_histo->SetBinContent(8,1.8e+09);
   d01_x01_y01_histo->SetBinContent(9,9.2e+08);
   d01_x01_y01_histo->SetBinContent(10,4.66e+08);
   d01_x01_y01_histo->SetBinContent(11,2.37e+08);
   d01_x01_y01_histo->SetBinContent(12,1.18e+08);
   d01_x01_y01_histo->SetBinContent(13,5.43e+07);
   d01_x01_y01_histo->SetBinContent(14,2.39e+07);
   d01_x01_y01_histo->SetBinContent(15,1.08e+07);
   d01_x01_y01_histo->SetBinContent(16,5240000);
   d01_x01_y01_histo->SetBinContent(17,2610000);
   d01_x01_y01_histo->SetBinContent(18,1360000);
   d01_x01_y01_histo->SetBinContent(19,716000);
   d01_x01_y01_histo->SetBinContent(20,381000);
   d01_x01_y01_histo->SetBinContent(21,207000);
   d01_x01_y01_histo->SetBinContent(22,117000);
   d01_x01_y01_histo->SetBinContent(23,66800);
   d01_x01_y01_histo->SetBinContent(24,37900);
   d01_x01_y01_histo->SetBinContent(25,22000);
   d01_x01_y01_histo->SetBinContent(26,12900);
   d01_x01_y01_histo->SetBinContent(27,7540);
   d01_x01_y01_histo->SetBinContent(28,4410);
   d01_x01_y01_histo->SetBinContent(29,2770);
   d01_x01_y01_histo->SetBinContent(30,1450);
   d01_x01_y01_histo->SetBinContent(31,846);

   d01_x01_y01_histo->SetBinContent(32,499);
   d01_x01_y01_histo->SetBinContent(33,205);

   d01_x01_y01_histo->SetBinContent(34,20.2);

   d01_x01_y01_histo->SetBinError(1,2.547782e+10);
   d01_x01_y01_histo->SetBinError(2,1.24325e+10);
   d01_x01_y01_histo->SetBinError(3,6.016764e+09);
   d01_x01_y01_histo->SetBinError(4,3.005329e+09);
   d01_x01_y01_histo->SetBinError(5,1.530463e+09);
   d01_x01_y01_histo->SetBinError(6,7.056178e+08);
   d01_x01_y01_histo->SetBinError(7,3.617535e+08);
   d01_x01_y01_histo->SetBinError(8,1.96072e+08);
   d01_x01_y01_histo->SetBinError(9,9.919588e+07);
   d01_x01_y01_histo->SetBinError(10,5.102008e+07);
   d01_x01_y01_histo->SetBinError(11,2.639067e+07);
   d01_x01_y01_histo->SetBinError(12,1.335539e+07);
   d01_x01_y01_histo->SetBinError(13,6258885);
   d01_x01_y01_histo->SetBinError(14,2836105);
   d01_x01_y01_histo->SetBinError(15,1319900);
   d01_x01_y01_histo->SetBinError(16,663920.6);
   d01_x01_y01_histo->SetBinError(17,342646.4);
   d01_x01_y01_histo->SetBinError(18,184642.2);
   d01_x01_y01_histo->SetBinError(19,100845.5);
   d01_x01_y01_histo->SetBinError(20,55764.14);
   d01_x01_y01_histo->SetBinError(21,31565.29);
   d01_x01_y01_histo->SetBinError(22,18614.95);
   d01_x01_y01_histo->SetBinError(23,11075.51);
   d01_x01_y01_histo->SetBinError(24,6579.499);
   d01_x01_y01_histo->SetBinError(25,4015.708);
   d01_x01_y01_histo->SetBinError(26,2479.083);
   d01_x01_y01_histo->SetBinError(27,1527.99);
   d01_x01_y01_histo->SetBinError(28,943.6936);
   d01_x01_y01_histo->SetBinError(29,627.92);
   d01_x01_y01_histo->SetBinError(30,350.3168);
   d01_x01_y01_histo->SetBinError(31,219.1467);
   d01_x01_y01_histo->SetBinError(32,139.7467);
   d01_x01_y01_histo->SetBinError(33,62.02427);
   d01_x01_y01_histo->SetBinError(34,7.233998);
   d01_x01_y01_histo->SetEntries(34);
   d01_x01_y01_histo->SetStats(0);

   //d01_x01_y01_histo->Scale(10000);
   d01_x01_y01_histo->SetLineWidth(2);
   d01_x01_y01_histo->SetMarkerStyle(21);
   d01_x01_y01_histo->SetMarkerSize(0.7);
   d01_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis2[34] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 790, 1684}; 

   TH1F *d02_x01_y01_histo = new TH1F("d02_x01_y01_histo","d02_x01_y01_histo",33, xAxis2);
   d02_x01_y01_histo->SetBinContent(1,1.89e+10);
   d02_x01_y01_histo->SetBinContent(2,9.74e+09);
   d02_x01_y01_histo->SetBinContent(3,4.99e+09);
   d02_x01_y01_histo->SetBinContent(4,2.49e+09);
   d02_x01_y01_histo->SetBinContent(5,1.31e+09);
   d02_x01_y01_histo->SetBinContent(6,6.28e+08);
   d02_x01_y01_histo->SetBinContent(7,3.23e+08);
   d02_x01_y01_histo->SetBinContent(8,1.71e+08);
   d02_x01_y01_histo->SetBinContent(9,8.84e+07);
   d02_x01_y01_histo->SetBinContent(10,4.42e+07);
   d02_x01_y01_histo->SetBinContent(11,2.22e+07);
   d02_x01_y01_histo->SetBinContent(12,1.13e+07);
   d02_x01_y01_histo->SetBinContent(13,5130000);
   d02_x01_y01_histo->SetBinContent(14,2230000);
   d02_x01_y01_histo->SetBinContent(15,1010000);
   d02_x01_y01_histo->SetBinContent(16,482000);
   d02_x01_y01_histo->SetBinContent(17,238000);
   d02_x01_y01_histo->SetBinContent(18,122000);
   d02_x01_y01_histo->SetBinContent(19,64200);
   d02_x01_y01_histo->SetBinContent(20,34100);
   d02_x01_y01_histo->SetBinContent(21,18700);
   d02_x01_y01_histo->SetBinContent(22,10100);
   d02_x01_y01_histo->SetBinContent(23,5720);
   d02_x01_y01_histo->SetBinContent(24,3420);
   d02_x01_y01_histo->SetBinContent(25,1890);
   d02_x01_y01_histo->SetBinContent(26,1130);
   d02_x01_y01_histo->SetBinContent(27,590);
   d02_x01_y01_histo->SetBinContent(28,376);
   d02_x01_y01_histo->SetBinContent(29,196);
   d02_x01_y01_histo->SetBinContent(30,130);

   d02_x01_y01_histo->SetBinContent(31,62.4);
   d02_x01_y01_histo->SetBinContent(32,30.1);
   d02_x01_y01_histo->SetBinContent(33,2.14);

   d02_x01_y01_histo->SetBinError(1,2.47211e+09);
   d02_x01_y01_histo->SetBinError(2,1.196891e+09);
   d02_x01_y01_histo->SetBinError(3,5.890842e+08);
   d02_x01_y01_histo->SetBinError(4,2.837945e+08);
   d02_x01_y01_histo->SetBinError(5,1.465766e+08);
   d02_x01_y01_histo->SetBinError(6,6.848512e+07);
   d02_x01_y01_histo->SetBinError(7,3.536592e+07);
   d02_x01_y01_histo->SetBinError(8,1.879562e+07);
   d02_x01_y01_histo->SetBinError(9,9619569);
   d02_x01_y01_histo->SetBinError(10,4860292);
   d02_x01_y01_histo->SetBinError(11,2483524);
   d02_x01_y01_histo->SetBinError(12,1278948);
   d02_x01_y01_histo->SetBinError(13,596427.3);
   d02_x01_y01_histo->SetBinError(14,266851);
   d02_x01_y01_histo->SetBinError(15,124973);
   d02_x01_y01_histo->SetBinError(16,61551.8);
   d02_x01_y01_histo->SetBinError(17,31482.64);
   d02_x01_y01_histo->SetBinError(18,16749.58);
   d02_x01_y01_histo->SetBinError(19,9172.852);
   d02_x01_y01_histo->SetBinError(20,5077.065);
   d02_x01_y01_histo->SetBinError(21,2898.771);
   d02_x01_y01_histo->SetBinError(22,1633.017);
   d02_x01_y01_histo->SetBinError(23,965.8504);
   d02_x01_y01_histo->SetBinError(24,606.0352);
   d02_x01_y01_histo->SetBinError(25,351.8168);
   d02_x01_y01_histo->SetBinError(26,221.2594);
   d02_x01_y01_histo->SetBinError(27,122.0002);
   d02_x01_y01_histo->SetBinError(28,82.34314);
   d02_x01_y01_histo->SetBinError(29,45.69701);
   d02_x01_y01_histo->SetBinError(30,32.27314);
   d02_x01_y01_histo->SetBinError(31,16.82748);
   d02_x01_y01_histo->SetBinError(32,8.687436);
   d02_x01_y01_histo->SetBinError(33,0.745178);
   d02_x01_y01_histo->SetEntries(33);
   d02_x01_y01_histo->SetStats(0);

   d02_x01_y01_histo->SetLineStyle(0);
   d02_x01_y01_histo->SetLineWidth(2);
   d02_x01_y01_histo->SetMarkerStyle(22);
   d02_x01_y01_histo->SetMarkerSize(0.7);
   d02_x01_y01_histo->SetFillColor(kGray);


   Double_t xAxis3[33] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 1410}; 

   TH1F *d03_x01_y01_histo = new TH1F("d03_x01_y01_histo","d03_x01_y01_histo",32, xAxis3);
   d03_x01_y01_histo->SetBinContent(1,1.84e+09);
   d03_x01_y01_histo->SetBinContent(2,9.24e+08);
   d03_x01_y01_histo->SetBinContent(3,4.64e+08);
   d03_x01_y01_histo->SetBinContent(4,2.34e+08);
   d03_x01_y01_histo->SetBinContent(5,1.19e+08);
   d03_x01_y01_histo->SetBinContent(6,5.88e+07);
   d03_x01_y01_histo->SetBinContent(7,2.92e+07);
   d03_x01_y01_histo->SetBinContent(8,1.57e+07);
   d03_x01_y01_histo->SetBinContent(9,8090000);
   d03_x01_y01_histo->SetBinContent(10,4090000);
   d03_x01_y01_histo->SetBinContent(11,2050000);
   d03_x01_y01_histo->SetBinContent(12,994000);
   d03_x01_y01_histo->SetBinContent(13,452000);
   d03_x01_y01_histo->SetBinContent(14,192000);
   d03_x01_y01_histo->SetBinContent(15,86200);
   d03_x01_y01_histo->SetBinContent(16,40500);
   d03_x01_y01_histo->SetBinContent(17,20100);
   d03_x01_y01_histo->SetBinContent(18,10000);
   d03_x01_y01_histo->SetBinContent(19,5210);
   d03_x01_y01_histo->SetBinContent(20,2720);
   d03_x01_y01_histo->SetBinContent(21,1470);
   d03_x01_y01_histo->SetBinContent(22,803);
   d03_x01_y01_histo->SetBinContent(23,435);
   d03_x01_y01_histo->SetBinContent(24,252);
   d03_x01_y01_histo->SetBinContent(25,138);
   d03_x01_y01_histo->SetBinContent(26,75.7);
   d03_x01_y01_histo->SetBinContent(27,43.1);
   d03_x01_y01_histo->SetBinContent(28,23.5);
   d03_x01_y01_histo->SetBinContent(29,13.1);

   d03_x01_y01_histo->SetBinContent(30,6.96);
   d03_x01_y01_histo->SetBinContent(31,3.31);
   d03_x01_y01_histo->SetBinContent(32,0.263);

   d03_x01_y01_histo->SetBinError(1,3.267438e+08);
   d03_x01_y01_histo->SetBinError(2,1.460402e+08);
   d03_x01_y01_histo->SetBinError(3,6.756898e+07);
   d03_x01_y01_histo->SetBinError(4,3.169167e+07);
   d03_x01_y01_histo->SetBinError(5,1.534246e+07);
   d03_x01_y01_histo->SetBinError(6,7206299);
   d03_x01_y01_histo->SetBinError(7,3487964);
   d03_x01_y01_histo->SetBinError(8,1852766);
   d03_x01_y01_histo->SetBinError(9,937690);
   d03_x01_y01_histo->SetBinError(10,474695.6);
   d03_x01_y01_histo->SetBinError(11,239744.8);
   d03_x01_y01_histo->SetBinError(12,117028.5);
   d03_x01_y01_histo->SetBinError(13,54375.43);
   d03_x01_y01_histo->SetBinError(14,23751.81);
   d03_x01_y01_histo->SetBinError(15,11010.17);
   d03_x01_y01_histo->SetBinError(16,5355.962);
   d03_x01_y01_histo->SetBinError(17,2760.221);
   d03_x01_y01_histo->SetBinError(18,1428.408);
   d03_x01_y01_histo->SetBinError(19,775.8965);
   d03_x01_y01_histo->SetBinError(20,422.7916);
   d03_x01_y01_histo->SetBinError(21,238.9779);
   d03_x01_y01_histo->SetBinError(22,137.1344);
   d03_x01_y01_histo->SetBinError(23,78.10703);
   d03_x01_y01_histo->SetBinError(24,47.62767);
   d03_x01_y01_histo->SetBinError(25,27.54976);
   d03_x01_y01_histo->SetBinError(26,16.01829);
   d03_x01_y01_histo->SetBinError(27,9.722084);
   d03_x01_y01_histo->SetBinError(28,5.653863);
   d03_x01_y01_histo->SetBinError(29,3.37332);
   d03_x01_y01_histo->SetBinError(30,1.948179);
   d03_x01_y01_histo->SetBinError(31,1.026618);
   d03_x01_y01_histo->SetBinError(32,0.09205037);
   d03_x01_y01_histo->SetEntries(32);
   d03_x01_y01_histo->SetStats(0);

   d03_x01_y01_histo->SetLineStyle(0);
   d03_x01_y01_histo->SetLineWidth(2);
   d03_x01_y01_histo->SetMarkerStyle(25);
   d03_x01_y01_histo->SetMarkerSize(0.7);
   d03_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis4[30] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 1032}; 

   TH1F *d04_x01_y01_histo = new TH1F("d04_x01_y01_histo","d04_x01_y01_histo",29, xAxis4);
   d04_x01_y01_histo->SetBinContent(1,1.44e+08);
   d04_x01_y01_histo->SetBinContent(2,7.35e+07);
   d04_x01_y01_histo->SetBinContent(3,3.8e+07);
   d04_x01_y01_histo->SetBinContent(4,1.89e+07);
   d04_x01_y01_histo->SetBinContent(5,9700000);
   d04_x01_y01_histo->SetBinContent(6,4670000);
   d04_x01_y01_histo->SetBinContent(7,2280000);
   d04_x01_y01_histo->SetBinContent(8,1220000);
   d04_x01_y01_histo->SetBinContent(9,629000);
   d04_x01_y01_histo->SetBinContent(10,305000);
   d04_x01_y01_histo->SetBinContent(11,151000);
   d04_x01_y01_histo->SetBinContent(12,73400);
   d04_x01_y01_histo->SetBinContent(13,32900);
   d04_x01_y01_histo->SetBinContent(14,13900);
   d04_x01_y01_histo->SetBinContent(15,6160);
   d04_x01_y01_histo->SetBinContent(16,2860);
   d04_x01_y01_histo->SetBinContent(17,1400);
   d04_x01_y01_histo->SetBinContent(18,711);
   d04_x01_y01_histo->SetBinContent(19,356);
   d04_x01_y01_histo->SetBinContent(20,186);
   d04_x01_y01_histo->SetBinContent(21,94.5);
   d04_x01_y01_histo->SetBinContent(22,50.9);
   d04_x01_y01_histo->SetBinContent(23,25.6);
   d04_x01_y01_histo->SetBinContent(24,13.3);
   d04_x01_y01_histo->SetBinContent(25,7);
   d04_x01_y01_histo->SetBinContent(26,3.45);
   d04_x01_y01_histo->SetBinContent(27,1.73);

   d04_x01_y01_histo->SetBinContent(28,0.796);
   d04_x01_y01_histo->SetBinContent(29,0.066);

   d04_x01_y01_histo->SetBinError(1,3.637846e+07);
   d04_x01_y01_histo->SetBinError(2,1.67099e+07);
   d04_x01_y01_histo->SetBinError(3,7851714);
   d04_x01_y01_histo->SetBinError(4,3568673);
   d04_x01_y01_histo->SetBinError(5,1703586);
   d04_x01_y01_histo->SetBinError(6,750723.4);
   d04_x01_y01_histo->SetBinError(7,343490.2);
   d04_x01_y01_histo->SetBinError(8,173448.2);
   d04_x01_y01_histo->SetBinError(9,84294.21);
   d04_x01_y01_histo->SetBinError(10,39082.27);
   d04_x01_y01_histo->SetBinError(11,18979.5);
   d04_x01_y01_histo->SetBinError(12,9119.636);
   d04_x01_y01_histo->SetBinError(13,4140.893);
   d04_x01_y01_histo->SetBinError(14,1810.098);
   d04_x01_y01_histo->SetBinError(15,830.3785);
   d04_x01_y01_histo->SetBinError(16,399.9657);
   d04_x01_y01_histo->SetBinError(17,204.9602);
   d04_x01_y01_histo->SetBinError(18,109.8075);
   d04_x01_y01_histo->SetBinError(19,59.1287);
   d04_x01_y01_histo->SetBinError(20,33.42105);
   d04_x01_y01_histo->SetBinError(21,18.47046);
   d04_x01_y01_histo->SetBinError(22,10.88183);
   d04_x01_y01_histo->SetBinError(23,6.000047);
   d04_x01_y01_histo->SetBinError(24,3.41489);
   d04_x01_y01_histo->SetBinError(25,1.994767);
   d04_x01_y01_histo->SetBinError(26,1.086542);
   d04_x01_y01_histo->SetBinError(27,0.610451);
   d04_x01_y01_histo->SetBinError(28,0.3130872);
   d04_x01_y01_histo->SetBinError(29,0.03211142);
   d04_x01_y01_histo->SetEntries(29);
   d04_x01_y01_histo->SetStats(0);

   d04_x01_y01_histo->SetLineStyle(0);
   d04_x01_y01_histo->SetLineWidth(2);
   d04_x01_y01_histo->SetMarkerStyle(26);
   d04_x01_y01_histo->SetMarkerSize(0.7);
   d04_x01_y01_histo->SetFillColor(kGray);

   Double_t xAxis5[27] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 737};

   TH1F *d05_x01_y01_histo = new TH1F("d05_x01_y01_histo","d05_x01_y01_histo",26, xAxis5);
   d05_x01_y01_histo->SetBinContent(1,1.05e+07);
   d05_x01_y01_histo->SetBinContent(2,5520000);
   d05_x01_y01_histo->SetBinContent(3,2720000);
   d05_x01_y01_histo->SetBinContent(4,1440000);
   d05_x01_y01_histo->SetBinContent(5,738000);
   d05_x01_y01_histo->SetBinContent(6,348000);
   d05_x01_y01_histo->SetBinContent(7,168000);
   d05_x01_y01_histo->SetBinContent(8,89800);
   d05_x01_y01_histo->SetBinContent(9,43800);
   d05_x01_y01_histo->SetBinContent(10,21800);
   d05_x01_y01_histo->SetBinContent(11,10300);
   d05_x01_y01_histo->SetBinContent(12,5030);
   d05_x01_y01_histo->SetBinContent(13,2180);
   d05_x01_y01_histo->SetBinContent(14,896);
   d05_x01_y01_histo->SetBinContent(15,384);
   d05_x01_y01_histo->SetBinContent(16,170);
   d05_x01_y01_histo->SetBinContent(17,78.5);
   d05_x01_y01_histo->SetBinContent(18,35.8);
   d05_x01_y01_histo->SetBinContent(19,16.5);
   d05_x01_y01_histo->SetBinContent(20,7.25);
   d05_x01_y01_histo->SetBinContent(21,3.27);
   d05_x01_y01_histo->SetBinContent(22,1.38);
   d05_x01_y01_histo->SetBinContent(23,0.579);
   d05_x01_y01_histo->SetBinContent(24,0.22);

   d05_x01_y01_histo->SetBinContent(25,0.0808);
   d05_x01_y01_histo->SetBinContent(26,0.00548);

   d05_x01_y01_histo->SetBinError(1,1978672);
   d05_x01_y01_histo->SetBinError(2,935188);
   d05_x01_y01_histo->SetBinError(3,421635.1);
   d05_x01_y01_histo->SetBinError(4,206618.7);
   d05_x01_y01_histo->SetBinError(5,100557.7);
   d05_x01_y01_histo->SetBinError(6,44514.08);
   d05_x01_y01_histo->SetBinError(7,20942.13);
   d05_x01_y01_histo->SetBinError(8,11048.87);
   d05_x01_y01_histo->SetBinError(9,5260.105);
   d05_x01_y01_histo->SetBinError(10,2634.555);
   d05_x01_y01_histo->SetBinError(11,1278.591);
   d05_x01_y01_histo->SetBinError(12,627.8137);
   d05_x01_y01_histo->SetBinError(13,282.1732);
   d05_x01_y01_histo->SetBinError(14,121.6466);
   d05_x01_y01_histo->SetBinError(15,55.24865);
   d05_x01_y01_histo->SetBinError(16,25.82574);
   d05_x01_y01_histo->SetBinError(17,12.76174);
   d05_x01_y01_histo->SetBinError(18,6.253124);
   d05_x01_y01_histo->SetBinError(19,3.142438);
   d05_x01_y01_histo->SetBinError(20,1.508923);
   d05_x01_y01_histo->SetBinError(21,0.7510828);
   d05_x01_y01_histo->SetBinError(22,0.3514478);
   d05_x01_y01_histo->SetBinError(23,0.1646418);
   d05_x01_y01_histo->SetBinError(24,0.071108);
   d05_x01_y01_histo->SetBinError(25,0.02988224);
   d05_x01_y01_histo->SetBinError(26,0.002567773);
   d05_x01_y01_histo->SetEntries(26);
   d05_x01_y01_histo->SetStats(0);

   d05_x01_y01_histo->SetLineStyle(0);
   d05_x01_y01_histo->SetLineWidth(2);
   d05_x01_y01_histo->SetMarkerStyle(3);
   d05_x01_y01_histo->SetMarkerSize(0.7);
   d05_x01_y01_histo->SetFillColor(kGray);

// MC / Data
TH1F *_ratio[6][3];

for(const int ifile = 0; ifile < n; ifile++){
  for(const int ihisto = 0; ihisto < nh; ihisto++){

    TH1F *_ratio[ihisto][ifile]= (TH1F*)_histo[ihisto][ifile]->Clone("");

    _ratio[ihisto][ifile]->SetLineWidth(1);
    _ratio[ihisto][ifile]->SetLineColor(icol[ihisto]);
    _ratio[ihisto][ifile]->SetMarkerStyle(imark[ihisto]);
    _ratio[ihisto][ifile]->SetMarkerSize(0.5);
    _ratio[ihisto][ifile]->SetMarkerColor(icol[ihisto]);
 }

  _ratio[0][ifile]->Divide((TH1*)d01_x01_y01_histo);  
  _ratio[1][ifile]->Divide((TH1*)d02_x01_y01_histo);  
  _ratio[2][ifile]->Divide((TH1*)d03_x01_y01_histo);  
  _ratio[3][ifile]->Divide((TH1*)d04_x01_y01_histo);  
  _ratio[4][ifile]->Divide((TH1*)d05_x01_y01_histo);  

//  TH1F *_ratio[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone("");
 // _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]);  //histo 0 / hsito 2
//  TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone("");

}



//create a canvas to draw TGraph and TH1F

TCanvas *c1 = new TCanvas("c1", "c1",369,0,680,750);

    //pads (inclusive jet cross section, MC / data )
   Pad_inclJet = new TPad("Pad_inclJet","xs",0.01,0.51,1.0,1.0);
   Pad_inclJet->Draw();
   Pad_MCdata1 = new TPad("Pad_MCdata1","ratio",0.01,0.40,1.0,0.50);
   Pad_MCdata1->Draw();
   Pad_MCdata2 = new TPad("Pad_MCdata2","ratio",0.01,0.30,1.0,0.40);
   Pad_MCdata2->Draw();
   Pad_MCdata3 = new TPad("Pad_MCdata3","ratio",0.01,0.20,1.0,0.30);
   Pad_MCdata3->Draw();
   Pad_MCdata4 = new TPad("Pad_MCdata4","ratio",0.01,0.10,1.0,0.20);
   Pad_MCdata4->Draw();
   Pad_MCdata5 = new TPad("Pad_MCdata5","ratio",0.01,0.0,1.0,0.10);
   Pad_MCdata5->Draw();

// first pad style
   Pad_inclJet->cd();
   gStyle->SetOptStat(0);
   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLogy();
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.03);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

//empty histo for border and style

   TH1F *shape = new TH1F("","",1, xmin, xmax);
   shape->SetMinimum(ymin);
   shape->SetMaximum(ymax); 
   shape->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)");
   shape->GetXaxis()->SetLabelSize(0.03);
   shape->GetXaxis()->SetTitleSize(0.03);
   shape->GetXaxis()->SetNdivisions(508);
   shape->GetXaxis()->SetTitleOffset(1.3);
   shape->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d|y|} (pb/GeV)");
   shape->GetYaxis()->SetLabelSize(0.03);
   shape->GetYaxis()->SetTitleSize(0.03);
   shape->GetYaxis()->SetTitleOffset(1.6);
   shape->Draw("e");

  //data
  d01_x01_y01_histo->Draw("E2same");
  d02_x01_y01_histo->Draw("E2same");
  d03_x01_y01_histo->Draw("E2same");
  d04_x01_y01_histo->Draw("E2same");
  d05_x01_y01_histo->Draw("E2same");

	_histo[0][0]->Draw("E1same");
	_histo[1][0]->Draw("E1same");
	_histo[2][0]->Draw("E1same");
	_histo[3][0]->Draw("E1same");
	_histo[4][0]->Draw("E1same");


  gPad->SetLogy();
  gPad->SetLogx();

   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.17,0.79,0.37,0.95,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.03);
   text = pt->AddText("CMS 2010");
   text = pt->AddText("#sqrt{s} = 7 TeV");
   text = pt->AddText("anti-k_{T} R = 0.5");
   pt->Draw();

TLegend *leg = new TLegend(0.68,0.77,0.83,0.928);
   leg->SetBorderSize(1);
   leg->SetTextSize(0.025);
   leg->SetLineColor(0);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);

   leg->AddEntry((TH1F*)_histo[0][0],"POWHEG & Pythia6 Z2","pfl");
   leg->AddEntry((TH1F*)  d01_x01_y01_histo, "|y| <0.5 (x 10^{4})","pfl");
   leg->AddEntry((TH1F*)  d02_x01_y01_histo, "0.5 < |y| < 1.0 (x 10^{3})","pfl");
   leg->AddEntry((TH1F*)  d03_x01_y01_histo, "1.0 < |y| < 1.5 (x 10^{2})","pfl");
   leg->AddEntry((TH1F*)  d04_x01_y01_histo, "1.5 < |y| < 2.0 (x 10^{1})","pfl");
   leg->AddEntry((TH1F*)  d05_x01_y01_histo, "2.0 < |y| < 2.5 (x 10^{0})","pfl");

   leg->Draw();

//second pad MC / Data

   Pad_MCdata1->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   //AK Empty histo for style and borders
   TH1F *shape_MCdata = new TH1F("","",1, xmin, xmax);
   shape_MCdata->SetMinimum(0.5);
   shape_MCdata->SetMaximum(2.0);
   shape_MCdata->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)");
   shape_MCdata->GetXaxis()->SetLabelSize(0.0);
   shape_MCdata->GetXaxis()->SetTitleSize(0.0);
   shape_MCdata->GetXaxis()->SetTitleOffset(0.6);
   shape_MCdata->GetYaxis()->SetTitle("MC/Data");
   shape_MCdata->GetYaxis()->SetLabelSize(0.15);
   shape_MCdata->GetYaxis()->SetTitleSize(0.15);
   shape_MCdata->GetYaxis()->SetTitleOffset(0.2);
   shape_MCdata->GetYaxis()->SetNdivisions(108, kTRUE);   
   shape_MCdata->Draw("e");   

// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.89,0.7,0.94,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.2);
   text = pt->AddText("|y| <0.5");
   pt->Draw();

	_ratio[0][0]->Draw("EhistSame");

   Pad_MCdata2->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   



// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.2);
   text = pt->AddText("0.5 < |y| < 1.0");
   pt->Draw();

	_ratio[1][0]->Draw("EhistSame");

   Pad_MCdata3->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.2);
   text = pt->AddText("1.0 < |y| < 1.5");
   pt->Draw();
	_ratio[2][0]->Draw("EhistSame");

   Pad_MCdata4->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.2);
   text = pt->AddText("1.5 < |y| < 2.0");
   pt->Draw();
	_ratio[3][0]->Draw("EhistSame");

   Pad_MCdata5->cd();

   gPad->SetFillColor(0);
   gPad->SetBorderMode(0);
   gPad->SetBorderSize(2);
   gPad->SetLeftMargin(0.14);
   gPad->SetRightMargin(0.03);
   gPad->SetTopMargin(0.0);
   gPad->SetFrameBorderMode(0);
   gPad->SetFrameBorderMode(0);

  gPad->SetLogx();

   shape_MCdata->Draw("e");   
// horizontal line at y = 1
   TLine *line = new TLine(xmin,1,xmax,1);
   line->SetLineStyle(2);
   line->Draw();

   TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(12);
   pt->SetTextSize(0.2);
   text = pt->AddText("2.0 < |y| < 2.5");
   pt->Draw();
	_ratio[4][0]->Draw("EhistSame");

//write in png file
mysubpad1 =(TPad*)c1->GetPad(0);
mysubpad1->Print("pics/InclusiveJets_10_mcdataRatio.png");

} 
Example #26
0
void Purity_1d_fit(int type = 0){
  TChain* tree = new TChain("TEvent");
  if(!type) tree->Add("/home/vitaly/B0toDh0/TMVA/FIL_b2dh_gen_0-1_full.root");
  else      tree->Add("/home/vitaly/B0toDh0/TMVA/FIL_b2dh_data.root");

  RooCategory b0f("b0f","b0f");
  b0f.defineType("signal",1);
  b0f.defineType("fsr",10);
  b0f.defineType("bad_pi0",5);
  b0f.defineType("rho",3);
  b0f.defineType("comb",-1);

  RooArgSet argset;

  const double deMin = -0.15;
  const double deMax = 0.3;

  RooRealVar mbc("mbc","M_{bc}",mbc_min,mbc_max,"GeV"); argset.add(mbc);
  RooRealVar de("de","#DeltaE",deMin,deMax,"GeV"); argset.add(de);
  de.setRange("Signal",de_min,de_max);
  RooRealVar md("md","md",DMass-md_cut,DMass+md_cut,"GeV"); argset.add(md);
  RooRealVar mk("mk","mk",KMass-mk_cut,KMass+mk_cut,"GeV"); argset.add(mk);
  RooRealVar mpi0("mpi0","mpi0",Pi0Mass-mpi0_cut,Pi0Mass+mpi0_cut,"GeV"); argset.add(mpi0);
  RooRealVar bdtgs("bdtgs","bdtgs",bdtgs_cut,1.); argset.add(bdtgs);
  RooRealVar atckpi_max("atckpi_max","atckpi_max",0.,atckpi_cut); argset.add(atckpi_max);

  if(!type) argset.add(b0f);

  RooDataSet ds("ds","ds",tree,argset,"mbc>0||mbc<=0");
//  RooDataSet* ds0 = ds.reduce(RooArgSet(de));
  
  stringstream out;
  if(!type){
    out.str("");
    out << "de<" << de_max << " && de>" << de_min;
    Roo1DTable* sigtable = ds.table(b0f,out.str().c_str());
    sigtable->Print();
    sigtable->Print("v");

    Roo1DTable* fulltable = ds.table(b0f);
    fulltable->Print();
    fulltable->Print("v");
  }

//  RooDataHist* dh = ds0->binnedClone();

//  ds0->Print();

  ////////////////
  // Signal PDF //
  ////////////////
  ////////////
  // de pdf //
  ////////////
  RooRealVar de0("de0","de0",m_de0,-0.1,0.1); if(cSig) de0.setConstant(kTRUE);
  RooRealVar s1("s1","s1",m_s1,0.,0.5); if(cSig) s1.setConstant(kTRUE);
  RooGaussian g1("g1","g1",de,de0,s1);

  RooRealVar deCBl("deCBl","deCBl",m_deCBl,-0.1,0.1); if(cSig) deCBl.setConstant(kTRUE);
  RooRealVar sCBl("sCBl","sCBl",m_sCBl,0.,0.5); if(cSig) sCBl.setConstant(kTRUE);
  RooRealVar nl("nl","nl",m_nl,0.,100.); if(cSig) nl.setConstant(kTRUE);
  RooRealVar alphal("alphal","alphal",m_alphal,-10.,10.); if(cSig) alphal.setConstant(kTRUE);

  RooRealVar deCBr("deCBr","deCBr",m_deCBr,-0.1,0.1); if(cSig) deCBr.setConstant(kTRUE);
  RooRealVar sCBr("sCBr","sCBr",m_sCBr,0.,0.5); if(cSig) sCBr.setConstant(kTRUE);
  RooRealVar nr("nr","nr",m_nr,0.,100.); if(cSig) nr.setConstant(kTRUE);
  RooRealVar alphar("alphar","alphar",m_alphar,-10.,10.); if(cSig) alphar.setConstant(kTRUE);

  RooCBShape CBl("CBl","CBl",de,deCBl,sCBl,alphal,nl);
  RooCBShape CBr("CBr","CBr",de,deCBr,sCBr,alphar,nr);

  RooRealVar fCBl("fCBl","fCBl",m_fCBl,0.,1.); if(cSig) fCBl.setConstant(kTRUE);
  RooRealVar fCBr("fCBr","fCBr",m_fCBr,0.,1.); if(cSig) fCBr.setConstant(kTRUE);

  RooAddPdf pdf_sig("pdf_sig","pdf_sig",RooArgList(CBl,CBr,g1),RooArgSet(fCBl,fCBr));

  //////////////
  // Comb PDF //
  //////////////
  ////////////
  // de pdf //
  ////////////
  RooRealVar c1("c1","c1",mc_c1_1d,-10.,10.); if(cComb) c1.setConstant(kTRUE);
  RooRealVar c2("c2","c2",mc_c2_1d,-10.,10.); if(cComb) c2.setConstant(kTRUE);
  RooChebychev pdf_comb("pdf_comb","pdf_comb",de,RooArgSet(c1,c2));

  /////////////
  // Rho PDF //
  /////////////
  ////////////
  // de pdf //
  ////////////
if(de_rho_param == 0){
  RooRealVar exppar("exppar","exppar",mr_exppar,-40.,-25.);// if(cRho) exppar.setConstant(kTRUE);
  RooExponential pdf_rho("pdf_rho","pdf_rho",de,exppar);
  }
  
  RooRealVar de0r("de0r","de0r",mr_de0r,-0.2,0.12); if(cRho) de0r.setConstant(kTRUE);
  
  if(de_rho_param == 1){
   RooRealVar slopel("slopel","slopel",mr_slopel,-1000,-500.); if(cRho) slopel.setConstant(kTRUE);
   RooRealVar sloper("sloper","sloper",mr_sloper,-10000,0.); if(cRho) sloper.setConstant(kTRUE);
   RooRealVar steep("steep","steep",mr_steep,7.,9.); if(cRho) steep.setConstant(kTRUE);
   RooRealVar p5("p5","p5",mr_p5,0.01,1000.); if(cRho) p5.setConstant(kTRUE);
   RooRhoDeltaEPdf pdf_rho("pdf_rho","pdf_rho",de,de0r,slopel,sloper,steep,p5);
  }
  
  if(de_rho_param == -1){
   RooRealVar x0("x0","x0",mr_x0_1d,-0.2,0.12); if(cRho) x0.setConstant(kTRUE);
   RooRealVar p1("p1","p1",mr_p1_1d,-1000.,100.); if(cRho) p1.setConstant(kTRUE);
   RooRealVar p2("p2","p2",mr_p2_1d,0.,100.); if(cRho) p2.setConstant(kTRUE);
   RooGenericPdf pdf_rho("pdf_rho","1+@0*@1-@2*TMath::Log(1+TMath::Exp(@2*(@0-@1)/@3))",RooArgSet(de,x0,p1,p2));
  }
  //////////////////
  // Complete PDF //
  //////////////////
  RooRealVar Nsig("Nsig","Nsig",700,100.,1500.);// fsig.setConstant(kTRUE);
  RooRealVar Nrho("Nrho","Nrho",400,100,1500.);// frho.setConstant(kTRUE);
  RooRealVar Ncmb("Ncmb","Ncmb",1000,100,100000);// frho.setConstant(kTRUE);
  RooAddPdf pdf("pdf","pdf",RooArgList(pdf_sig,pdf_rho,pdf_comb),RooArgList(Nsig,Nrho,Ncmb));

  pdf.fitTo(ds,Verbose(),Timer(true));

   RooAbsReal* intSig  = pdf_sig.createIntegral(RooArgSet(de),NormSet(RooArgSet(de)),Range("Signal"));
   RooAbsReal* intRho  = pdf_rho.createIntegral(RooArgSet(de),NormSet(RooArgSet(de)),Range("Signal"));
   RooAbsReal* intCmb  = pdf_comb.createIntegral(RooArgSet(de),NormSet(RooArgSet(de)),Range("Signal"));
   const double nsig = intSig->getVal()*Nsig.getVal();
   const double nsig_err = intSig->getVal()*Nsig.getError();
   const double nsig_err_npq = TMath::Sqrt(nsig*(Nsig.getVal()-nsig)/Nsig.getVal());
   const double nsig_err_total = TMath::Sqrt(nsig_err*nsig_err+nsig_err_npq*nsig_err_npq);
   const double nrho = intRho->getVal()*Nrho.getVal();
   const double nrho_err = intRho->getVal()*Nrho.getError();
   const double nrho_err_npq = TMath::Sqrt(nrho*(Nrho.getVal()-nrho)/Nrho.getVal());
   const double nrho_err_total = TMath::Sqrt(nrho_err*nrho_err+nrho_err_npq*nrho_err_npq);
   const double ncmb = intCmb->getVal()*Ncmb.getVal();
   const double ncmb_err = intCmb->getVal()*Ncmb.getError();
   const double ncmb_err_npq = TMath::Sqrt(ncmb*(Ncmb.getVal()-ncmb)/Ncmb.getVal());
   const double ncmb_err_total = TMath::Sqrt(ncmb_err*ncmb_err+ncmb_err_npq*ncmb_err_npq);
   const double purity = nsig/(nsig+nrho+ncmb);
   const double purity_err = nsig_err_total/(nsig+nrho+ncmb);
   cout << "Nsig = " << nsig <<" +- " << nsig_err << endl;
   cout << "Nrho = " << nrho <<" +- " << nrho_err << endl;
   cout << "Ncmb = " << ncmb <<" +- " << ncmb_err << endl;
   
  /////////////
  //  Plots  //
  /////////////
  // de //
  RooPlot* deFrame = de.frame();
  ds.plotOn(deFrame,DataError(RooAbsData::SumW2),MarkerSize(1));
  pdf.plotOn(deFrame,Components(pdf_sig),LineStyle(kDashed));
  pdf.plotOn(deFrame,Components(pdf_rho),LineStyle(kDashed));
  pdf.plotOn(deFrame,Components(pdf_comb),LineStyle(kDashed));
  pdf.plotOn(deFrame,LineWidth(2));

  RooHist* hdepull = deFrame->pullHist();
  RooPlot* dePull = de.frame(Title("#Delta E pull distribution"));
  dePull->addPlotable(hdepull,"P");
  dePull->GetYaxis()->SetRangeUser(-5,5);

  TCanvas* cm = new TCanvas("Delta E","Delta E",600,700);
  cm->cd();

  TPad *pad3 = new TPad("pad3","pad3",0.01,0.20,0.99,0.99);
  TPad *pad4 = new TPad("pad4","pad4",0.01,0.01,0.99,0.20);
  pad3->Draw();
  pad4->Draw();

  pad3->cd();
  pad3->SetLeftMargin(0.15);
  pad3->SetFillColor(0);

  deFrame->GetXaxis()->SetTitleSize(0.05);
  deFrame->GetXaxis()->SetTitleOffset(0.85);
  deFrame->GetXaxis()->SetLabelSize(0.04);
  deFrame->GetYaxis()->SetTitleOffset(1.6);
  deFrame->Draw();

  stringstream out1;
  TPaveText *pt = new TPaveText(0.6,0.75,0.98,0.9,"brNDC");
  pt->SetFillColor(0);
  pt->SetTextAlign(12);
  out1.str("");
  out1 << "#chi^{2}/n.d.f = " << deFrame->chiSquare();
  pt->AddText(out1.str().c_str());
  out1.str("");
  out1 << "S: " << (int)(nsig+0.5) << " #pm " << (int)(nsig_err_total+0.5);
  pt->AddText(out1.str().c_str());
  out1.str("");
  out1 << "Purity: " << std::fixed << std::setprecision(2) << purity*100. << " #pm " << purity_err*100;
  pt->AddText(out1.str().c_str());
  pt->Draw();

  TLine *de_line_RIGHT = new TLine(de_max,0,de_max,50);
  de_line_RIGHT->SetLineColor(kRed);
  de_line_RIGHT->SetLineStyle(1);
  de_line_RIGHT->SetLineWidth((Width_t)2.);
  de_line_RIGHT->Draw();
  TLine *de_line_LEFT = new TLine(de_min,0,de_min,50);
  de_line_LEFT->SetLineColor(kRed);
  de_line_LEFT->SetLineStyle(1);
  de_line_LEFT->SetLineWidth((Width_t)2.);
  de_line_LEFT->Draw();

  pad4->cd(); pad4->SetLeftMargin(0.15); pad4->SetFillColor(0);
  dePull->SetMarkerSize(0.05); dePull->Draw();
  TLine *de_lineUP = new TLine(deMin,3,deMax,3);
  de_lineUP->SetLineColor(kBlue);
  de_lineUP->SetLineStyle(2);
  de_lineUP->Draw();
  TLine *de_line = new TLine(deMin,0,deMax,0);
  de_line->SetLineColor(kBlue);
  de_line->SetLineStyle(1);
  de_line->SetLineWidth((Width_t)2.);
  de_line->Draw();
  TLine *de_lineDOWN = new TLine(deMin,-3,deMax,-3);
  de_lineDOWN->SetLineColor(kBlue);
  de_lineDOWN->SetLineStyle(2);
  de_lineDOWN->Draw();

  cm->Update();
  
  if(!type){
    out.str("");
    out << "de<" << de_max << " && de>" << de_min;
    Roo1DTable* sigtable = ds.table(b0f,out.str().c_str());
    sigtable->Print();
    sigtable->Print("v");
    
    Roo1DTable* fulltable = ds.table(b0f);
    fulltable->Print();
    fulltable->Print("v");
  }
  
  cout << "Nsig = " << nsig <<" +- " << nsig_err << " +- " << nsig_err_npq << " (" << nsig_err_total << ")" << endl;
  cout << "Nrho = " << nrho <<" +- " << nrho_err << " +- " << nrho_err_npq << " (" << nrho_err_total << ")" << endl;
  cout << "Ncmb = " << ncmb <<" +- " << ncmb_err << " +- " << ncmb_err_npq << " (" << ncmb_err_total << ")" << endl;
  cout << "Pury = " << purity << " +- " << purity_err << endl;
}
Example #27
0
void tree() {
   //
   // This macro displays the Tree data structures
   //Author: Rene Brun
   TCanvas* c1 = new TCanvas("c1","Tree Data Structure",200,10,750,940);
   c1->Range(0,-0.1,1,1.15);

   gBenchmark->Start("tree");

   Int_t branchcolor = 26;
   Int_t leafcolor   = 30;
   Int_t basketcolor = 42;
   Int_t offsetcolor = 43;
   TPaveLabel* title = new TPaveLabel(.3,1.05,.8,1.13,c1->GetTitle());
   title->SetFillColor(16);
   title->Draw();
   TPaveText* treePave = new TPaveText(.01,.75,.15,1.00);
   treePave->SetFillColor(18);
   treePave->SetTextAlign(12);
   TText *tnt = treePave->AddText("Tree");
   tnt->SetTextAlign(22);
   tnt->SetTextSize(0.030);
   treePave->AddText("fScanField");
   treePave->AddText("fMaxEventLoop");
   treePave->AddText("fMaxVirtualSize");
   treePave->AddText("fEntries");
   treePave->AddText("fDimension");
   treePave->AddText("fSelectedRows");
   treePave->Draw();
   TPavesText* farm = new TPavesText(.01,1.02,.15,1.1,9,"tr");
   TText *tfarm = farm->AddText("CHAIN");
   tfarm->SetTextSize(0.024);
   farm->AddText("Collection");
   farm->AddText("of Trees");
   farm->Draw();
   TLine* llink = new TLine(.15,.92,.80,.92);
   llink->SetLineWidth(2);
   llink->SetLineColor(1);
   llink->Draw();
   llink->DrawLine(.21,.87,.21,.275);
   llink->DrawLine(.23,.87,.23,.375);
   llink->DrawLine(.25,.87,.25,.775);
   llink->DrawLine(.41,.25,.41,-.025);
   llink->DrawLine(.43,.25,.43,.075);
   llink->DrawLine(.45,.25,.45,.175);
   TPaveLabel* branch0 = new TPaveLabel(.20,.87,.35,.97,"Branch 0");
   branch0->SetTextSize(0.35);
   branch0->SetFillColor(branchcolor);
   branch0->Draw();
   TPaveLabel* branch1 = new TPaveLabel(.40,.87,.55,.97,"Branch 1");
   branch1->SetTextSize(0.35);
   branch1->SetFillColor(branchcolor);
   branch1->Draw();
   TPaveLabel* branch2 = new TPaveLabel(.60,.87,.75,.97,"Branch 2");
   branch2->SetTextSize(0.35);
   branch2->SetFillColor(branchcolor);
   branch2->Draw();
   TPaveLabel* branch3 = new TPaveLabel(.80,.87,.95,.97,"Branch 3");
   branch3->SetTextSize(0.35);
   branch3->SetFillColor(branchcolor);
   branch3->Draw();
   TPaveLabel* leaf0 = new TPaveLabel(.4,.75,.5,.8,"Leaf 0");
   leaf0->SetFillColor(leafcolor);
   leaf0->Draw();
   TPaveLabel* leaf1 = new TPaveLabel(.6,.75,.7,.8,"Leaf 1");
   leaf1->SetFillColor(leafcolor);
   leaf1->Draw();
   TPaveLabel* leaf2 = new TPaveLabel(.8,.75,.9,.8,"Leaf 2");
   leaf2->SetFillColor(leafcolor);
   leaf2->Draw();
   TPaveText* firstevent = new TPaveText(.4,.35,.9,.4);
   firstevent->AddText("First event of each basket");
   firstevent->AddText("Array of fMaxBaskets Integers");
   firstevent->SetFillColor(basketcolor);
   firstevent->Draw();
   TPaveLabel* basket0 = new TPaveLabel(.4,.25,.5,.3,"Basket 0");
   basket0->SetFillColor(basketcolor);
   basket0->Draw();
   TPaveLabel* basket1 = new TPaveLabel(.6,.25,.7,.3,"Basket 1");
   basket1->SetFillColor(basketcolor);
   basket1->Draw();
   TPaveLabel* basket2 = new TPaveLabel(.8,.25,.9,.3,"Basket 2");
   basket2->SetFillColor(basketcolor);
   basket2->Draw();

   TPaveText* offset = new TPaveText(.55,.15,.9,.2);
   offset->AddText("Offset of events in fBuffer");
   offset->AddText("Array of fEventOffsetLen Integers");
   offset->AddText("(if variable length structure)");
   offset->SetFillColor(offsetcolor);
   offset->Draw();
   TPaveText* buffer = new TPaveText(.55,.05,.9,.1);
   buffer->AddText("Basket buffer");
   buffer->AddText("Array of fBasketSize chars");
   buffer->SetFillColor(offsetcolor);
   buffer->Draw();
   TPaveText* zipbuffer = new TPaveText(.55,-.05,.75,.0);
   zipbuffer->AddText("Basket compressed buffer");
   zipbuffer->AddText("(if compression)");
   zipbuffer->SetFillColor(offsetcolor);
   zipbuffer->Draw();
   TArrow* ar1 = new TArrow();
   ar1->SetLineWidth(2);
   ar1->SetLineColor(1);
   ar1->SetFillStyle(1001);
   ar1->SetFillColor(1);
   ar1->DrawArrow(.21,.275,.39,.275,0.015,"|>");
   ar1->DrawArrow(.23,.375,.39,.375,0.015,"|>");
   ar1->DrawArrow(.25,.775,.39,.775,0.015,"|>");
   ar1->DrawArrow(.50,.775,.59,.775,0.015,"|>");
   ar1->DrawArrow(.70,.775,.79,.775,0.015,"|>");
   ar1->DrawArrow(.50,.275,.59,.275,0.015,"|>");
   ar1->DrawArrow(.70,.275,.79,.275,0.015,"|>");
   ar1->DrawArrow(.45,.175,.54,.175,0.015,"|>");
   ar1->DrawArrow(.43,.075,.54,.075,0.015,"|>");
   ar1->DrawArrow(.41,-.025,.54,-.025,0.015,"|>");
   TLine* ldot = new TLine(.95,.92,.99,.92);
   ldot->SetLineStyle(3);
   ldot->Draw();
   ldot->DrawLine(.9,.775,.99,.775);
   ldot->DrawLine(.9,.275,.99,.275);
   ldot->DrawLine(.55,.05,.55,0);
   ldot->DrawLine(.9,.05,.75,0);
   TText* pname = new TText(.46,.21,"fEventOffset");
   pname->SetTextFont(72);
   pname->SetTextSize(0.018);
   pname->Draw();
   pname->DrawText(.44,.11,"fBuffer");
   pname->DrawText(.42,.01,"fZipBuffer");
   pname->DrawText(.26,.81,"fLeaves = TObjArray of TLeaf");
   pname->DrawText(.24,.40,"fBasketEvent");
   pname->DrawText(.22,.31,"fBaskets = TObjArray of TBasket");
   pname->DrawText(.20,1.0,"fBranches = TObjArray of TBranch");
   TPaveText* ntleaf = new TPaveText(0.30,.42,.62,.7);
   ntleaf->SetTextSize(0.014);
   ntleaf->SetFillColor(leafcolor);
   ntleaf->SetTextAlign(12);
   ntleaf->AddText("fLen: number of fixed elements");
   ntleaf->AddText("fLenType: number of bytes of data type");
   ntleaf->AddText("fOffset: relative to Leaf0-fAddress");
   ntleaf->AddText("fNbytesIO: number of bytes used for I/O");
   ntleaf->AddText("fIsPointer: True if pointer");
   ntleaf->AddText("fIsRange: True if leaf has a range");
   ntleaf->AddText("fIsUnsigned: True if unsigned");
   ntleaf->AddText("*fLeafCount: points to Leaf counter");
   ntleaf->AddText(" ");
   ntleaf->AddLine(0,0,0,0);
   ntleaf->AddText("fName = Leaf name");
   ntleaf->AddText("fTitle = Leaf type (see Type codes)");
   ntleaf->Draw();
   TPaveText* type = new TPaveText(.65,.42,.95,.7);
   type->SetTextAlign(12);
   type->SetFillColor(leafcolor);
   type->AddText(" ");
   type->AddText("C : a character string");
   type->AddText("B : an 8 bit signed integer");
   type->AddText("b : an 8 bit unsigned integer");
   type->AddText("S : a 16 bit signed short integer");
   type->AddText("s : a 16 bit unsigned short integer");
   type->AddText("I : a 32 bit signed integer");
   type->AddText("i : a 32 bit unsigned integer");
   type->AddText("F : a 32 bit floating point");
   type->AddText("D : a 64 bit floating point");
   type->AddText("TXXXX : a class name TXXXX");
   type->Draw();
   TPaveLabel* typecode = new TPaveLabel(.7,.68,.9,.72,"fType codes");
   typecode->SetFillColor(leafcolor);
   typecode->Draw();
   ldot->DrawLine(.4,.75,.30,.7);
   ldot->DrawLine(.5,.75,.62,.7);
   TPaveText* ntbasket = new TPaveText(0.02,-0.07,0.35,.25);
   ntbasket->SetFillColor(basketcolor);
   ntbasket->SetTextSize(0.014);
   ntbasket->SetTextAlign(12);
   ntbasket->AddText("fNbytes: Size of compressed Basket");
   ntbasket->AddText("fObjLen: Size of uncompressed Basket");
   ntbasket->AddText("fDatime: Date/Time when written to store");
   ntbasket->AddText("fKeylen: Number of bytes for the key");
   ntbasket->AddText("fCycle : Cycle number");
   ntbasket->AddText("fSeekKey: Pointer to Basket on file");
   ntbasket->AddText("fSeekPdir: Pointer to directory on file");
   ntbasket->AddText("fClassName: 'TBasket'");
   ntbasket->AddText("fName: Branch name");
   ntbasket->AddText("fTitle: TreePave name");
   ntbasket->AddText(" ");
   ntbasket->AddLine(0,0,0,0);
   ntbasket->AddText("fNevBuf: Number of events in Basket");
   ntbasket->AddText("fLast: pointer to last used byte in Basket");
   ntbasket->Draw();
   ldot->DrawLine(.4,.3,0.02,0.25);
   ldot->DrawLine(.5,.25,0.35,-.07);
   ldot->DrawLine(.5,.3,0.35,0.25);
   TPaveText* ntbranch = new TPaveText(0.02,0.40,0.18,0.68);
   ntbranch->SetFillColor(branchcolor);
   ntbranch->SetTextSize(0.015);
   ntbranch->SetTextAlign(12);
   ntbranch->AddText("fBasketSize");
   ntbranch->AddText("fEventOffsetLen");
   ntbranch->AddText("fMaxBaskets");
   ntbranch->AddText("fEntries");
   ntbranch->AddText("fAddress of Leaf0");
   ntbranch->AddText(" ");
   ntbranch->AddLine(0,0,0,0);
   ntbranch->AddText("fName: Branchname");
   ntbranch->AddText("fTitle: leaflist");
   ntbranch->Draw();
   ldot->DrawLine(.2,.97,.02,.68);
   ldot->DrawLine(.35,.97,.18,.68);
   ldot->DrawLine(.35,.87,.18,.40);
   TPavesText* basketstore = new TPavesText(.8,-0.088,0.952,-0.0035,7,"tr");
   basketstore->SetFillColor(28);
   basketstore->AddText("Baskets");
   basketstore->AddText("Stores");
   basketstore->Draw();
   c1->Update();

   gBenchmark->Show("treePave");
}
Example #28
0
void archi() {
   TCanvas *c1 = new TCanvas("c1","Dictionary Architecture",20,10,750,930);
   c1->SetBorderSize(0);
   c1->Range(0,0,20.5,26);


   TPaveLabel *title = new TPaveLabel(4,24,16,25.5,c1->GetTitle());
   title->SetFillColor(46);
   title->Draw();

   TPavesText *dll = new TPavesText(0.5,19,4.5,23,5,"tr");
   dll->SetFillColor(39);
   dll->SetTextSize(0.023);
   dll->AddText(" ");
   dll->AddText("Dynamically");
   dll->AddText("Linked");
   dll->AddText("Libraries");
   dll->Draw();
   TPaveLabel *dlltitle = new TPaveLabel(1.5,22.6,3.5,23.3,"DLLs");
   dlltitle->SetFillColor(28);
   dlltitle->Draw();

   TPavesText *cpp = new TPavesText(5.5,19,9.5,23,5,"tr");
   cpp->SetTextSize(0.023);
   cpp->AddText(" ");
   cpp->AddText("Commented");
   cpp->AddText("Header");
   cpp->AddText("Files");
   cpp->Draw();
   TPaveLabel *cpptitle = new TPaveLabel(6.5,22.6,8.5,23.3,"C++");
   cpptitle->SetFillColor(28);
   cpptitle->Draw();

   TPavesText *odl = new TPavesText(10.5,19,14.5,23,5,"tr");
   odl->SetTextSize(0.023);
   odl->AddText(" ");
   odl->AddText("Objects");
   odl->AddText("Description");
   odl->AddText("Files");
   odl->Draw();
   TPaveLabel *odltitle = new TPaveLabel(11.5,22.6,13.5,23.3,"ODL");
   odltitle->SetFillColor(28);
   odltitle->Draw();

   TPavesText *idl = new TPavesText(15.5,19,19.5,23,5,"tr");
   idl->SetTextSize(0.023);
   idl->AddText(" ");
   idl->AddText("Interface");
   idl->AddText("Definition");
   idl->AddText("Language");
   idl->Draw();
   TPaveLabel *idltitle = new TPaveLabel(16.5,22.6,18.5,23.3,"IDL");
   idltitle->SetFillColor(28);
   idltitle->Draw();

   TWbox *p1 = new TWbox(7.8,10,13.2,17,11,12,1);
   p1->Draw();
   TText *pro1 = new TText(10.5,15.8,"Process 1");
   pro1->SetTextAlign(21);
   pro1->SetTextSize(0.03);
   pro1->Draw();
   TPaveText *p1dict = new TPaveText(8.8,13.8,12.2,15.6);
   p1dict->SetTextSize(0.023);
   p1dict->AddText("Dictionary");
   p1dict->AddText("in memory");
   p1dict->Draw();
   TPavesText *p1object = new TPavesText(8.6,10.6,12.1,13.0,5,"tr");
   p1object->SetTextSize(0.023);
   p1object->AddText("Objects");
   p1object->AddText("in memory");
   p1object->Draw();
   TWbox *p2 = new TWbox(15.5,10,20,17,11,12,1);
   p2->Draw();
   TText *pro2 = new TText(17.75,15.8,"Process 2");
   pro2->SetTextAlign(21);
   pro2->SetTextSize(0.03);
   pro2->Draw();
   TPaveText *p2dict = new TPaveText(16,13.8,19.5,15.6);
   p2dict->SetTextSize(0.023);
   p2dict->AddText("Dictionary");
   p2dict->AddText("in memory");
   p2dict->Draw();
   TPavesText *p2object = new TPavesText(16.25,10.6,19.25,13.0,5,"tr");
   p2object->SetTextSize(0.023);
   p2object->AddText("Objects");
   p2object->AddText("in memory");
   p2object->Draw();
   TWbox *stub1 = new TWbox(12.9,11.5,13.6,15.5,49,3,1);
   stub1->Draw();
   TText *tstub1 = new TText(13.25,13.5,"Stub1");
   tstub1->SetTextSize(0.025);
   tstub1->SetTextAlign(22);
   tstub1->SetTextAngle(90);
   tstub1->Draw();
   TWbox *stub2 = new TWbox(15.1,11.5,15.8,15.5,49,3,1);
   stub2->Draw();
   TText *tstub2 = new TText(15.45,13.5,"Stub2");
   tstub2->SetTextSize(0.025);
   tstub2->SetTextAlign(22);
   tstub2->SetTextAngle(-90);
   tstub2->Draw();
   TArrow *ar1 = new TArrow();
   ar1->SetLineWidth(6);
   ar1->SetLineColor(1);
   ar1->SetFillStyle(1001);
   ar1->SetFillColor(1);
   ar1->DrawArrow(13.5,14,15,14,0.012,"|>");
   ar1->DrawArrow(15.1,13,13.51,13,0.012,"|>");

   TPaveText *cint = new TPaveText(1.0,15.0,8.0,17.5);
   cint->SetFillColor(39);
   cint->SetBorderSize(1);
   cint->SetTextSize(0.023);
   cint->AddText("C++ Interpreter");
   cint->AddText("and program builder");
   cint->Draw();
   TPaveText *command = new TPaveText(2.5,13.4,8.0,14.5);
   command->SetTextSize(0.023);
   command->SetFillColor(39);
   command->SetBorderSize(1);
   command->AddText("Command Thread");
   command->Draw();
   TPavesText *view = new TPavesText(1.0,9.5,7.7,12.6,3,"tr");
   view->SetFillColor(39);
   view->SetBorderSize(2);
   view->SetTextSize(0.023);
   view->AddText("Viewer Thread(s)");
   view->AddText("Picking");
   view->AddText("Context Menus");
   view->AddText("Inspector/Browser");
   view->Draw();

   TPavesText *web = new TPavesText(0.5,5,6,8.5,5,"tr");
   web->SetTextSize(0.023);
   web->AddText(" ");
   web->AddText("generated");
   web->AddText("automatically");
   web->AddText("from dictionary");
   web->AddText("and source files");
   web->Draw();
   TPaveLabel *webtitle = new TPaveLabel(1.5,8.1,5.0,8.8,"HTML Files");
   webtitle->SetFillColor(28);
   webtitle->Draw();

   TPavesText *printed = new TPavesText(0.5,1.0,6,4,5,"tr");
   printed->SetTextSize(0.023);
   printed->AddText(" ");
   printed->AddText("generated");
   printed->AddText("automatically");
   printed->AddText("from HTML files");
   printed->Draw();
   TPaveLabel *printedtitle = new TPaveLabel(1.5,3.6,5.0,4.3,"Printed Docs");
   printedtitle->SetFillColor(28);
   printedtitle->Draw();

   TBox *box1 = new TBox(0.2,9.2,14.25,17.8);
   box1->SetFillStyle(0);
   box1->SetLineStyle(2);
   box1->Draw();

   TBox *box2 = new TBox(10.2,18.7,20.2,23.6);
   box2->SetFillStyle(0);
   box2->SetLineStyle(3);
   box2->Draw();

   ar1->DrawArrow(2.5,17.5,2.5,18.9,0.012,"|>");
   ar1->DrawArrow(5.5,9.2,5.5,8.7,0.012,"|>");
   ar1->DrawArrow(5.5,5,5.5,4.2,0.012,"|>");
   ar1->DrawArrow(8.5,9.2,8.5,8.2,0.012,"|>");
   ar1->DrawArrow(9.5,8.1,9.5,9.0,0.012,"|>");
   ar1->DrawArrow(6.5,19,6.5,17.6,0.012,"|>");
   ar1->DrawArrow(8.5,19,8.5,17.1,0.012,"|>");
   ar1->DrawArrow(11.5,19,11.5,17.1,0.012,"|>");


   TPaveLabel *ootitle = new TPaveLabel(10.5,7.8,17,8.8,"Objects Data Base");
   ootitle->SetFillColor(28);
   ootitle->Draw();

   TPad *pio = new TPad("pio","pio",0.37,0.02,0.95,0.31,49);
   pio->Range(0,0,12,8);
   pio->Draw();
   pio->cd();
   TPavesText *raw = new TPavesText(0.5,1,2.5,6,7,"tr");
   raw->Draw();
   TPavesText *dst1 = new TPavesText(4,1,5,3,7,"tr");
   dst1->Draw();
   TPavesText *dst2 = new TPavesText(6,1,7,3,7,"tr");
   dst2->Draw();
   TPavesText *dst3 = new TPavesText(4,4,5,6,7,"tr");
   dst3->Draw();
   TPavesText *dst4 = new TPavesText(6,4,7,6,7,"tr");
   dst4->Draw();
   Float_t xlow = 8.5;
   Float_t ylow = 1;
   Float_t dx   = 0.5;
   Float_t dy   = 0.5;
   for (Int_t j=1;j<9;j++) {
      Float_t y0 = ylow + (j-1)*0.7;
      Float_t y1 = y0 + dy;
      for (Int_t i=1;i<5;i++) {
         Float_t x0 = xlow +(i-1)*0.6;
         Float_t x1 = x0 + dx;
         TPavesText *anal = new TPavesText(x0,y0,x1,y1,7,"tr");
         anal->Draw();
      }
   }
   TText *daq = new TText();
   daq->SetTextSize(0.07);
   daq->SetTextAlign(22);
   daq->DrawText(1.5,7.3,"DAQ");
   daq->DrawText(6,7.3,"DST");
   daq->DrawText(10.,7.3,"Physics Analysis");
   daq->DrawText(1.5,0.7,"Events");
   daq->DrawText(1.5,0.3,"Containers");
   daq->DrawText(6,0.7,"Tracks/Hits");
   daq->DrawText(6,0.3,"Containers");
   daq->DrawText(10.,0.7,"Attributes");
   daq->DrawText(10.,0.3,"Containers");

   c1->cd();
}
void phimetphijet2()
{
//=========Macro generated from canvas: phimetphijet2/phimetphijet2
//=========  (Mon Nov 23 11:05:11 2015) by ROOT version6.02/05
   TCanvas *phimetphijet2 = new TCanvas("phimetphijet2", "phimetphijet2",300,322,700,700);
   phimetphijet2->Range(-3.926991,-6.296078,3.926991,4.627329);
   phimetphijet2->SetFillColor(0);
   phimetphijet2->SetBorderMode(0);
   phimetphijet2->SetBorderSize(2);
   phimetphijet2->SetLogy();
   phimetphijet2->SetFrameBorderMode(0);
   phimetphijet2->SetFrameBorderMode(0);
   
   THStack *phimetphijet2 = new THStack();
   phimetphijet2->SetName("phimetphijet2");
   phimetphijet2->SetTitle("phimetphijet2");
   
   TH1F *phimetphijet2_stack_20 = new TH1F("phimetphijet2_stack_20","phimetphijet2",20,-3.141593,3.141593);
   phimetphijet2_stack_20->SetMinimum(6.255515e-06);
   phimetphijet2_stack_20->SetMaximum(3427.587);
   phimetphijet2_stack_20->SetDirectory(0);
   phimetphijet2_stack_20->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   phimetphijet2_stack_20->SetLineColor(ci);
   phimetphijet2_stack_20->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet2_stack_20->GetXaxis()->SetLabelFont(42);
   phimetphijet2_stack_20->GetXaxis()->SetLabelSize(0.035);
   phimetphijet2_stack_20->GetXaxis()->SetTitleSize(0.035);
   phimetphijet2_stack_20->GetXaxis()->SetTitleFont(42);
   phimetphijet2_stack_20->GetYaxis()->SetTitle("Events/pb");
   phimetphijet2_stack_20->GetYaxis()->SetLabelFont(42);
   phimetphijet2_stack_20->GetYaxis()->SetLabelSize(0.035);
   phimetphijet2_stack_20->GetYaxis()->SetTitleSize(0.035);
   phimetphijet2_stack_20->GetYaxis()->SetTitleFont(42);
   phimetphijet2_stack_20->GetZaxis()->SetLabelFont(42);
   phimetphijet2_stack_20->GetZaxis()->SetLabelSize(0.035);
   phimetphijet2_stack_20->GetZaxis()->SetTitleSize(0.035);
   phimetphijet2_stack_20->GetZaxis()->SetTitleFont(42);
   phimetphijet2->SetHistogram(phimetphijet2_stack_20);
   
   
   TH1D *phimetphijet296 = new TH1D("phimetphijet296"," #Delta_{#phi}[MET,jet_{2}]",20,-3.141593,3.141593);
   phimetphijet296->SetBinContent(1,599.5565);
   phimetphijet296->SetBinContent(2,601.8699);
   phimetphijet296->SetBinContent(3,574.6103);
   phimetphijet296->SetBinContent(4,505.7655);
   phimetphijet296->SetBinContent(5,574.5997);
   phimetphijet296->SetBinContent(6,596.3209);
   phimetphijet296->SetBinContent(7,665.2723);
   phimetphijet296->SetBinContent(8,850.025);
   phimetphijet296->SetBinContent(9,1039.648);
   phimetphijet296->SetBinContent(10,1354.568);
   phimetphijet296->SetBinContent(11,1313.67);
   phimetphijet296->SetBinContent(12,1079.464);
   phimetphijet296->SetBinContent(13,839.0052);
   phimetphijet296->SetBinContent(14,679.6341);
   phimetphijet296->SetBinContent(15,578.1462);
   phimetphijet296->SetBinContent(16,532.6048);
   phimetphijet296->SetBinContent(17,559.8399);
   phimetphijet296->SetBinContent(18,538.712);
   phimetphijet296->SetBinContent(19,558.2774);
   phimetphijet296->SetBinContent(20,576.3311);
   phimetphijet296->SetBinError(1,14.01782);
   phimetphijet296->SetBinError(2,14.06125);
   phimetphijet296->SetBinError(3,13.75496);
   phimetphijet296->SetBinError(4,12.88979);
   phimetphijet296->SetBinError(5,13.75495);
   phimetphijet296->SetBinError(6,14.00518);
   phimetphijet296->SetBinError(7,14.76104);
   phimetphijet296->SetBinError(8,16.69368);
   phimetphijet296->SetBinError(9,18.3991);
   phimetphijet296->SetBinError(10,20.96339);
   phimetphijet296->SetBinError(11,20.62724);
   phimetphijet296->SetBinError(12,18.76332);
   phimetphijet296->SetBinError(13,16.57613);
   phimetphijet296->SetBinError(14,14.92679);
   phimetphijet296->SetBinError(15,13.77979);
   phimetphijet296->SetBinError(16,13.24077);
   phimetphijet296->SetBinError(17,13.5788);
   phimetphijet296->SetBinError(18,13.30024);
   phimetphijet296->SetBinError(19,13.5421);
   phimetphijet296->SetBinError(20,13.74356);
   phimetphijet296->SetEntries(88534);

   ci = TColor::GetColor("#00cc00");
   phimetphijet296->SetFillColor(ci);

   ci = TColor::GetColor("#00cc00");
   phimetphijet296->SetLineColor(ci);

   ci = TColor::GetColor("#00cc00");
   phimetphijet296->SetMarkerColor(ci);
   phimetphijet296->SetMarkerStyle(22);
   phimetphijet296->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet296->GetXaxis()->SetLabelFont(42);
   phimetphijet296->GetXaxis()->SetLabelSize(0.035);
   phimetphijet296->GetXaxis()->SetTitleSize(0.035);
   phimetphijet296->GetXaxis()->SetTitleFont(42);
   phimetphijet296->GetYaxis()->SetTitle("Events/pb");
   phimetphijet296->GetYaxis()->SetLabelFont(42);
   phimetphijet296->GetYaxis()->SetLabelSize(0.035);
   phimetphijet296->GetYaxis()->SetTitleSize(0.035);
   phimetphijet296->GetYaxis()->SetTitleFont(42);
   phimetphijet296->GetZaxis()->SetLabelFont(42);
   phimetphijet296->GetZaxis()->SetLabelSize(0.035);
   phimetphijet296->GetZaxis()->SetTitleSize(0.035);
   phimetphijet296->GetZaxis()->SetTitleFont(42);
   phimetphijet2->Add(phimetphijet2,"");
   
   TH1D *phimetphijet297 = new TH1D("phimetphijet297"," #Delta_{#phi}[MET,jet_{2}]",20,-3.141593,3.141593);
   phimetphijet297->SetBinContent(1,3.833102);
   phimetphijet297->SetBinContent(2,4.030573);
   phimetphijet297->SetBinContent(3,4.099132);
   phimetphijet297->SetBinContent(4,4.272269);
   phimetphijet297->SetBinContent(5,4.209427);
   phimetphijet297->SetBinContent(6,4.370433);
   phimetphijet297->SetBinContent(7,4.06457);
   phimetphijet297->SetBinContent(8,3.764594);
   phimetphijet297->SetBinContent(9,3.518276);
   phimetphijet297->SetBinContent(10,3.486163);
   phimetphijet297->SetBinContent(11,3.551275);
   phimetphijet297->SetBinContent(12,3.544476);
   phimetphijet297->SetBinContent(13,3.844214);
   phimetphijet297->SetBinContent(14,3.933075);
   phimetphijet297->SetBinContent(15,4.224541);
   phimetphijet297->SetBinContent(16,4.33643);
   phimetphijet297->SetBinContent(17,4.349964);
   phimetphijet297->SetBinContent(18,4.199265);
   phimetphijet297->SetBinContent(19,4.023059);
   phimetphijet297->SetBinContent(20,3.888278);
   phimetphijet297->SetBinError(1,0.05590373);
   phimetphijet297->SetBinError(2,0.05732162);
   phimetphijet297->SetBinError(3,0.0572273);
   phimetphijet297->SetBinError(4,0.05746171);
   phimetphijet297->SetBinError(5,0.05623738);
   phimetphijet297->SetBinError(6,0.0572591);
   phimetphijet297->SetBinError(7,0.05438423);
   phimetphijet297->SetBinError(8,0.05158963);
   phimetphijet297->SetBinError(9,0.04876562);
   phimetphijet297->SetBinError(10,0.04882319);
   phimetphijet297->SetBinError(11,0.04943321);
   phimetphijet297->SetBinError(12,0.04933328);
   phimetphijet297->SetBinError(13,0.0524752);
   phimetphijet297->SetBinError(14,0.05317107);
   phimetphijet297->SetBinError(15,0.05552655);
   phimetphijet297->SetBinError(16,0.0574827);
   phimetphijet297->SetBinError(17,0.05824327);
   phimetphijet297->SetBinError(18,0.05807843);
   phimetphijet297->SetBinError(19,0.05712001);
   phimetphijet297->SetBinError(20,0.05627091);
   phimetphijet297->SetEntries(324582);

   ci = TColor::GetColor("#00ffff");
   phimetphijet297->SetFillColor(ci);

   ci = TColor::GetColor("#00ffff");
   phimetphijet297->SetLineColor(ci);

   ci = TColor::GetColor("#00ffff");
   phimetphijet297->SetMarkerColor(ci);
   phimetphijet297->SetMarkerStyle(20);
   phimetphijet297->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet297->GetXaxis()->SetLabelFont(42);
   phimetphijet297->GetXaxis()->SetLabelSize(0.035);
   phimetphijet297->GetXaxis()->SetTitleSize(0.035);
   phimetphijet297->GetXaxis()->SetTitleFont(42);
   phimetphijet297->GetYaxis()->SetTitle("Events/pb");
   phimetphijet297->GetYaxis()->SetLabelFont(42);
   phimetphijet297->GetYaxis()->SetLabelSize(0.035);
   phimetphijet297->GetYaxis()->SetTitleSize(0.035);
   phimetphijet297->GetYaxis()->SetTitleFont(42);
   phimetphijet297->GetZaxis()->SetLabelFont(42);
   phimetphijet297->GetZaxis()->SetLabelSize(0.035);
   phimetphijet297->GetZaxis()->SetTitleSize(0.035);
   phimetphijet297->GetZaxis()->SetTitleFont(42);
   phimetphijet2->Add(phimetphijet2,"");
   
   TH1D *phimetphijet298 = new TH1D("phimetphijet298"," #Delta_{#phi}[MET,jet_{2}]",20,-3.141593,3.141593);
   phimetphijet298->SetBinContent(1,0.562526);
   phimetphijet298->SetBinContent(2,0.5785768);
   phimetphijet298->SetBinContent(3,0.5795457);
   phimetphijet298->SetBinContent(4,0.5955618);
   phimetphijet298->SetBinContent(5,0.5771722);
   phimetphijet298->SetBinContent(6,0.5592627);
   phimetphijet298->SetBinContent(7,0.508213);
   phimetphijet298->SetBinContent(8,0.4729086);
   phimetphijet298->SetBinContent(9,0.4529622);
   phimetphijet298->SetBinContent(10,0.452754);
   phimetphijet298->SetBinContent(11,0.4560625);
   phimetphijet298->SetBinContent(12,0.4478396);
   phimetphijet298->SetBinContent(13,0.481398);
   phimetphijet298->SetBinContent(14,0.5057427);
   phimetphijet298->SetBinContent(15,0.5478765);
   phimetphijet298->SetBinContent(16,0.5759238);
   phimetphijet298->SetBinContent(17,0.588108);
   phimetphijet298->SetBinContent(18,0.6099644);
   phimetphijet298->SetBinContent(19,0.6091882);
   phimetphijet298->SetBinContent(20,0.5592744);
   phimetphijet298->SetBinError(1,0.006701172);
   phimetphijet298->SetBinError(2,0.006782582);
   phimetphijet298->SetBinError(3,0.006778253);
   phimetphijet298->SetBinError(4,0.006758593);
   phimetphijet298->SetBinError(5,0.006577098);
   phimetphijet298->SetBinError(6,0.006435378);
   phimetphijet298->SetBinError(7,0.005984446);
   phimetphijet298->SetBinError(8,0.005703029);
   phimetphijet298->SetBinError(9,0.00552641);
   phimetphijet298->SetBinError(10,0.005538473);
   phimetphijet298->SetBinError(11,0.00554042);
   phimetphijet298->SetBinError(12,0.00553433);
   phimetphijet298->SetBinError(13,0.00578102);
   phimetphijet298->SetBinError(14,0.005996152);
   phimetphijet298->SetBinError(15,0.006336019);
   phimetphijet298->SetBinError(16,0.006562733);
   phimetphijet298->SetBinError(17,0.00671901);
   phimetphijet298->SetBinError(18,0.006958606);
   phimetphijet298->SetBinError(19,0.006977009);
   phimetphijet298->SetBinError(20,0.006670566);
   phimetphijet298->SetEntries(300679);

   ci = TColor::GetColor("#ffcc00");
   phimetphijet298->SetFillColor(ci);

   ci = TColor::GetColor("#ffcc00");
   phimetphijet298->SetLineColor(ci);

   ci = TColor::GetColor("#ffcc00");
   phimetphijet298->SetMarkerColor(ci);
   phimetphijet298->SetMarkerStyle(21);
   phimetphijet298->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet298->GetXaxis()->SetLabelFont(42);
   phimetphijet298->GetXaxis()->SetLabelSize(0.035);
   phimetphijet298->GetXaxis()->SetTitleSize(0.035);
   phimetphijet298->GetXaxis()->SetTitleFont(42);
   phimetphijet298->GetYaxis()->SetTitle("Events/pb");
   phimetphijet298->GetYaxis()->SetLabelFont(42);
   phimetphijet298->GetYaxis()->SetLabelSize(0.035);
   phimetphijet298->GetYaxis()->SetTitleSize(0.035);
   phimetphijet298->GetYaxis()->SetTitleFont(42);
   phimetphijet298->GetZaxis()->SetLabelFont(42);
   phimetphijet298->GetZaxis()->SetLabelSize(0.035);
   phimetphijet298->GetZaxis()->SetTitleSize(0.035);
   phimetphijet298->GetZaxis()->SetTitleFont(42);
   phimetphijet2->Add(phimetphijet2,"");
   
   TH1D *phimetphijet299 = new TH1D("phimetphijet299"," #Delta_{#phi}[MET,jet_{2}]",20,-3.141593,3.141593);
   phimetphijet299->SetBinContent(1,0.01442198);
   phimetphijet299->SetBinContent(2,0.01314174);
   phimetphijet299->SetBinContent(3,0.01025734);
   phimetphijet299->SetBinContent(4,0.008221299);
   phimetphijet299->SetBinContent(5,0.006293227);
   phimetphijet299->SetBinContent(6,0.006031009);
   phimetphijet299->SetBinContent(7,0.004565674);
   phimetphijet299->SetBinContent(8,0.003886993);
   phimetphijet299->SetBinContent(9,0.004241758);
   phimetphijet299->SetBinContent(10,0.004334306);
   phimetphijet299->SetBinContent(11,0.003686474);
   phimetphijet299->SetBinContent(12,0.00418006);
   phimetphijet299->SetBinContent(13,0.00434973);
   phimetphijet299->SetBinContent(14,0.004951289);
   phimetphijet299->SetBinContent(15,0.005429451);
   phimetphijet299->SetBinContent(16,0.006277802);
   phimetphijet299->SetBinContent(17,0.009578662);
   phimetphijet299->SetBinContent(18,0.01055041);
   phimetphijet299->SetBinContent(19,0.01200032);
   phimetphijet299->SetBinContent(20,0.01436028);
   phimetphijet299->SetBinError(1,0.0004716491);
   phimetphijet299->SetBinError(2,0.0004502285);
   phimetphijet299->SetBinError(3,0.0003977627);
   phimetphijet299->SetBinError(4,0.000356104);
   phimetphijet299->SetBinError(5,0.0003115612);
   phimetphijet299->SetBinError(6,0.0003050012);
   phimetphijet299->SetBinError(7,0.0002653744);
   phimetphijet299->SetBinError(8,0.0002448576);
   phimetphijet299->SetBinError(9,0.0002557877);
   phimetphijet299->SetBinError(10,0.000258563);
   phimetphijet299->SetBinError(11,0.0002384582);
   phimetphijet299->SetBinError(12,0.0002539206);
   phimetphijet299->SetBinError(13,0.0002590227);
   phimetphijet299->SetBinError(14,0.000276354);
   phimetphijet299->SetBinError(15,0.0002893907);
   phimetphijet299->SetBinError(16,0.0003111791);
   phimetphijet299->SetBinError(17,0.0003843785);
   phimetphijet299->SetBinError(18,0.000403405);
   phimetphijet299->SetBinError(19,0.0004302323);
   phimetphijet299->SetBinError(20,0.0004706392);
   phimetphijet299->SetEntries(9774);

   ci = TColor::GetColor("#ff0000");
   phimetphijet299->SetFillColor(ci);

   ci = TColor::GetColor("#ff0000");
   phimetphijet299->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   phimetphijet299->SetMarkerColor(ci);
   phimetphijet299->SetMarkerStyle(20);
   phimetphijet299->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet299->GetXaxis()->SetLabelFont(42);
   phimetphijet299->GetXaxis()->SetLabelSize(0.035);
   phimetphijet299->GetXaxis()->SetTitleSize(0.035);
   phimetphijet299->GetXaxis()->SetTitleFont(42);
   phimetphijet299->GetYaxis()->SetTitle("Events/pb");
   phimetphijet299->GetYaxis()->SetLabelFont(42);
   phimetphijet299->GetYaxis()->SetLabelSize(0.035);
   phimetphijet299->GetYaxis()->SetTitleSize(0.035);
   phimetphijet299->GetYaxis()->SetTitleFont(42);
   phimetphijet299->GetZaxis()->SetLabelFont(42);
   phimetphijet299->GetZaxis()->SetLabelSize(0.035);
   phimetphijet299->GetZaxis()->SetTitleSize(0.035);
   phimetphijet299->GetZaxis()->SetTitleFont(42);
   phimetphijet2->Add(phimetphijet2,"");
   
   TH1D *phimetphijet2100 = new TH1D("phimetphijet2100"," #Delta_{#phi}[MET,jet_{2}]",20,-3.141593,3.141593);
   phimetphijet2100->SetBinContent(1,0.0001677165);
   phimetphijet2100->SetBinContent(2,0.0002012598);
   phimetphijet2100->SetBinContent(3,0.0002180314);
   phimetphijet2100->SetBinContent(4,0.0002348031);
   phimetphijet2100->SetBinContent(5,0.0001509448);
   phimetphijet2100->SetBinContent(6,0.0001174015);
   phimetphijet2100->SetBinContent(7,0.0001341732);
   phimetphijet2100->SetBinContent(8,8.385824e-05);
   phimetphijet2100->SetBinContent(9,0.0001006299);
   phimetphijet2100->SetBinContent(10,0.0001509448);
   phimetphijet2100->SetBinContent(11,6.708659e-05);
   phimetphijet2100->SetBinContent(12,3.35433e-05);
   phimetphijet2100->SetBinContent(13,0.0002180314);
   phimetphijet2100->SetBinContent(14,0.0002180314);
   phimetphijet2100->SetBinContent(15,0.0002012598);
   phimetphijet2100->SetBinContent(16,0.0001174015);
   phimetphijet2100->SetBinContent(17,0.0003186613);
   phimetphijet2100->SetBinContent(18,0.0003689762);
   phimetphijet2100->SetBinContent(19,8.385824e-05);
   phimetphijet2100->SetBinContent(20,8.385824e-05);
   phimetphijet2100->SetBinError(1,5.303661e-05);
   phimetphijet2100->SetBinError(2,5.809869e-05);
   phimetphijet2100->SetBinError(3,6.047104e-05);
   phimetphijet2100->SetBinError(4,6.275376e-05);
   phimetphijet2100->SetBinError(5,5.031494e-05);
   phimetphijet2100->SetBinError(6,4.437361e-05);
   phimetphijet2100->SetBinError(7,4.743738e-05);
   phimetphijet2100->SetBinError(8,3.750254e-05);
   phimetphijet2100->SetBinError(9,4.108198e-05);
   phimetphijet2100->SetBinError(10,5.031494e-05);
   phimetphijet2100->SetBinError(11,3.35433e-05);
   phimetphijet2100->SetBinError(12,2.371869e-05);
   phimetphijet2100->SetBinError(13,6.047104e-05);
   phimetphijet2100->SetBinError(14,6.047104e-05);
   phimetphijet2100->SetBinError(15,5.809869e-05);
   phimetphijet2100->SetBinError(16,4.437361e-05);
   phimetphijet2100->SetBinError(17,7.310592e-05);
   phimetphijet2100->SetBinError(18,7.8666e-05);
   phimetphijet2100->SetBinError(19,3.750254e-05);
   phimetphijet2100->SetBinError(20,3.750254e-05);
   phimetphijet2100->SetEntries(195);

   ci = TColor::GetColor("#0000ff");
   phimetphijet2100->SetFillColor(ci);

   ci = TColor::GetColor("#0000ff");
   phimetphijet2100->SetLineColor(ci);

   ci = TColor::GetColor("#0000ff");
   phimetphijet2100->SetMarkerColor(ci);
   phimetphijet2100->SetMarkerStyle(21);
   phimetphijet2100->GetXaxis()->SetTitle("phimetphijet2");
   phimetphijet2100->GetXaxis()->SetLabelFont(42);
   phimetphijet2100->GetXaxis()->SetLabelSize(0.035);
   phimetphijet2100->GetXaxis()->SetTitleSize(0.035);
   phimetphijet2100->GetXaxis()->SetTitleFont(42);
   phimetphijet2100->GetYaxis()->SetTitle("Events/pb");
   phimetphijet2100->GetYaxis()->SetLabelFont(42);
   phimetphijet2100->GetYaxis()->SetLabelSize(0.035);
   phimetphijet2100->GetYaxis()->SetTitleSize(0.035);
   phimetphijet2100->GetYaxis()->SetTitleFont(42);
   phimetphijet2100->GetZaxis()->SetLabelFont(42);
   phimetphijet2100->GetZaxis()->SetLabelSize(0.035);
   phimetphijet2100->GetZaxis()->SetTitleSize(0.035);
   phimetphijet2100->GetZaxis()->SetTitleFont(42);
   phimetphijet2->Add(phimetphijet2,"");
   phimetphijet2->Draw("nostack");
   
   TPaveText *pt = new TPaveText(0.3269253,0.9342857,0.6730747,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("phimetphijet2");
   pt->Draw();
   
   TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC");
   leg->SetBorderSize(1);
   leg->SetTextSize(0.034965);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("phimetphijet2","phimetphijet2_QCD","lp");

   ci = TColor::GetColor("#00cc00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#00cc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(22);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phimetphijet2","phimetphijet2_WJetsToLNu","lp");

   ci = TColor::GetColor("#00ffff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#00ffff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phimetphijet2","phimetphijet2_ZJetsToNuNu","lp");

   ci = TColor::GetColor("#ffcc00");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#ffcc00");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phimetphijet2","phimetphijet2_signal","lp");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#ff0000");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("phimetphijet2","phimetphijet2_ttbar","lp");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);

   ci = TColor::GetColor("#0000ff");
   entry->SetMarkerColor(ci);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   phimetphijet2->Modified();
   phimetphijet2->cd();
   phimetphijet2->SetSelected(phimetphijet2);
}
void paraPull_alpha_EL_EFF_Iso_TotalCorrUncertainty_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_EL_EFF_Iso_TotalCorrUncertainty
//=========  (Sun Nov 22 20:14:54 2015) by ROOT version6.02/12
    TCanvas *c1 = new TCanvas("c1", "alpha_EL_EFF_Iso_TotalCorrUncertainty",0,22,1000,600);
    gStyle->SetOptStat(0);
    c1->Range(-4.125,-0.9750892,37.125,1.047955);
    c1->SetFillColor(0);
    c1->SetBorderMode(0);
    c1->SetBorderSize(2);
    c1->SetGridx();
    c1->SetGridy();
    c1->SetFrameBorderMode(0);
    c1->SetFrameBorderMode(0);

    TH1F *NuisanceParameterFreed9 = new TH1F("NuisanceParameterFreed9","alpha_EL_EFF_Iso_TotalCorrUncertainty",33,0,33);
    NuisanceParameterFreed9->SetMinimum(-0.7727848);
    NuisanceParameterFreed9->SetMaximum(0.8456503);
    NuisanceParameterFreed9->SetStats(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#000099");
    NuisanceParameterFreed9->SetLineColor(ci);
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(1,"XS_ttbar");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(4,"Luminosity");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(5,"XS_st");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(7,"XS_Zc");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(8,"MUONS_ID");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(12,"XS_Zl");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(16,"EL_EFF_Reco_TotalCorrUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(17,"MUONS_SCALE");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(18,"MUON_ISO_STAT");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(19,"FT_EFF_extrapolation");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(20,"MUON_EFF_STAT");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(21,"MUON_EFF_SYS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(22,"MUON_EFF_TrigStatUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(23,"FT_EFF_Eigen_Light_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(25,"EG_RESOLUTION_ALL");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(26,"XS_diboson");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(29,"MUON_ISO_SYS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(30,"XS_Zb");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(31,"MUONS_MS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
    NuisanceParameterFreed9->GetXaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetXaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetXaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetXaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
    NuisanceParameterFreed9->GetYaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetYaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetYaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetYaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->GetZaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetZaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetZaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetZaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->Draw("hist");

    Double_t _fx1009[35] = {
        1.22802e-312,
        0.5,
        1.5,
        2.5,
        3.5,
        4.5,
        5.5,
        6.5,
        7.5,
        8.5,
        9.5,
        10.5,
        11.5,
        12.5,
        13.5,
        14.5,
        15.5,
        16.5,
        17.5,
        18.5,
        19.5,
        20.5,
        21.5,
        22.5,
        23.5,
        24.5,
        25.5,
        26.5,
        27.5,
        28.5,
        29.5,
        30.5,
        31.5,
        32.5,
        0
    };
    Double_t _fy1009[35] = {
        1.22802e-312,
        -0.7727848,
        -0.3922476,
        -0.2907829,
        -0.2050988,
        -0.1826652,
        -0.1278621,
        -0.1246447,
        -0.1083822,
        -0.06587814,
        -0.05693349,
        -0.05334209,
        -0.04676047,
        -0.03729371,
        -0.03207689,
        -0.03107143,
        -0.01702517,
        -0.001380258,
        0.0001641211,
        0.01041877,
        0.01060027,
        0.01810894,
        0.01987367,
        0.02024918,
        0.02038876,
        0.02749887,
        0.0401174,
        0.04268003,
        0.04584905,
        0.05094516,
        0.05434531,
        0.05598196,
        0.05756905,
        0.8456503,
        0
    };
    Double_t _fex1009[35] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
    };
    Double_t _fey1009[35] = {
        0,
        0,
        0.6107702,
        1.073131,
        1.266362,
        0.9365976,
        0.9916527,
        0.9863054,
        0.9267238,
        0.7691165,
        0.9864524,
        0.9937947,
        0.9917419,
        0.9970684,
        0.9817834,
        0.9376065,
        0.9926703,
        0.9925594,
        1.005011,
        0.9933467,
        0.9551198,
        0.9932276,
        0.9929662,
        0.9927806,
        0.9913159,
        0.9909915,
        1.097968,
        0.9870135,
        0.9931711,
        0.9930639,
        0.9855126,
        0.7540343,
        0.738039,
        0.9909039,
        0.7858475
    };
    TGraphErrors *gre = new TGraphErrors(35,_fx1009,_fy1009,_fex1009,_fey1009);
    gre->SetName("");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetMarkerStyle(20);
    gre->SetMarkerSize(1.2);

    TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","",100,0,35.75);
    Graph_Graph1009->SetMinimum(-1.802262);
    Graph_Graph1009->SetMaximum(2.167356);
    Graph_Graph1009->SetDirectory(0);
    Graph_Graph1009->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1009->SetLineColor(ci);
    Graph_Graph1009->GetXaxis()->SetLabelFont(42);
    Graph_Graph1009->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetXaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetXaxis()->SetTitleFont(42);
    Graph_Graph1009->GetYaxis()->SetLabelFont(42);
    Graph_Graph1009->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetYaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetYaxis()->SetTitleFont(42);
    Graph_Graph1009->GetZaxis()->SetLabelFont(42);
    Graph_Graph1009->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph1009);

    gre->Draw("p");

    TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextFont(72);
    leg->SetTextSize(0.015);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    leg->Draw();

    TPaveText *pt = new TPaveText(0.2068675,0.9341608,0.7931325,0.995,"blNDC");
    pt->SetName("title");
    pt->SetBorderSize(0);
    pt->SetFillColor(0);
    pt->SetFillStyle(0);
    pt->SetTextFont(42);
    TText *AText = pt->AddText("alpha_EL_EFF_Iso_TotalCorrUncertainty");
    pt->Draw();
    c1->Modified();
    c1->cd();
    c1->SetSelected(c1);
}