void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy)
{
    if (peer != 0)
        peer->handleMouseWheel (e.source.getIndex(),
                                Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds(),
                                ix * 256.0f, iy * 256.0f);
    else
        Component::mouseWheelMove (e, ix, iy);
}
Exemple #2
0
void zeeAnaDiff(TH1D* hsee, TCut addCut,TH1D* hseeMc) {
  
  TFile *f1=new TFile(fname1.Data());
  TTree *zp = (TTree*)f1->Get("tz");
  zp->AddFriend("yEvt=yongsunHiEvt"       ,fname1.Data());
  zp->AddFriend("ySkim=yongsunSkimTree"   ,fname1.Data());
  zp->AddFriend("yHlt=yongsunHltTree"     ,fname1.Data());
  zp->AddFriend("tgj",                     fname1.Data());
  
  TH1D* hmass = new TH1D("hmass",";inv. mass (GeV);event fraction",34,30,200);
  hmass->Sumw2();

  zp->Draw("invm>>hmass",addCut && "isEle1==1 && isEle2==1");
  TH1D* htemp = (TH1D*)hsee->Clone("htemp");   htemp->Reset();
  zp->Draw("see1>>htemp",addCut && "isEle1==1 && isEle2==1" && "invm>80 && invm<100" );
  hsee->Reset();
  hsee->Add(htemp);
  handsomeTH1(hmass,2);
  scaleInt(hmass);
  
  TH1D* htempMC;
  TFile *f1mc;
  TTree *zpmc ;
  f1mc=new TFile(fname1MC.Data());
  zpmc = (TTree*)f1mc->Get("tz");
  zpmc->AddFriend("yEvt=yongsunHiEvt"       ,fname1MC.Data());
  zpmc->AddFriend("ySkim=yongsunSkimTree"   ,fname1MC.Data());
  zpmc->AddFriend("yHlt=yongsunHltTree"     ,fname1MC.Data());
  zpmc->AddFriend("yPho=yongsunPhotonTree"     ,fname1MC.Data());
  zpmc->AddFriend("tgj",                     fname1MC.Data());
  hseeMc->Sumw2();
  htempMC = (TH1D*)hseeMc->Clone("htempMc");   htempMC->Reset();
  TH1D* hmassMC = new TH1D("hmassMC11",";inv. mass (GeV);event fraction",34,30,200);
  hmassMC->Sumw2();
  zpmc->Draw("invm>>hmassMC11",Form("(%s) *yPho.ncoll",addCut.GetTitle()));
  zpmc->Draw("see1>>htempMc",Form("(%s) *yPho.ncoll", (addCut && "invm>80 && invm<100").GetTitle()) );
  hseeMc->Reset();
  hseeMc->Add(htempMC);
  handsomeTH1(hmassMC,1);
  scaleInt(hmassMC);
  
  
  hmassMC->SetAxisRange(0,0.6,"Y");
  hmassMC->DrawCopy();
  hmass->DrawCopy("same");                                                                                             
  TLegend* leg1 =  new TLegend(0.5580645,0.5381356,0.8923387,0.7648305,NULL,"brNDC");
  easyLeg(leg1,"Z->ee mass");
  leg1->AddEntry(hmass,"DATA","pl");
  leg1->AddEntry(hmassMC,"MC","pl");
  leg1->Draw();
  
}
void drawPtDependenceOfDpt(bool drawPbPb=1, int xNorm = 1) {
  gStyle -> SetOptStat(0);  
  const int nPtBin = 5;
  double ptBin[nPtBin+1] = {40, 50,60,80,120,9999}; 
  double AvePtBin[nPtBin+1] = { 45, 54.1479, 67.4204, 99.6956, 150, 9999};
  
  TH1D* hxjg[7][1000]; // [species][centrality] 
  TH1D* hxjgNorm[7][1000];
  TH1D* hdpt[7][1000];
  TH1D* hdptNorm[7][1000];
  TH1D* hdphi[7][1000];
  
  valPair meanX[7][1000];
  valPair meanDpt[7][1000];
  valPair rjg[7][1000];
  TGraphAsymmErrors* gr[7];
  TGraphAsymmErrors* gx[7];
  TGraphAsymmErrors* gdpt[7];
  for (int i=0;i<7;i++) {  
    gr[i] = new TGraphAsymmErrors();
    gr[i]->SetName(Form("gr_%d",i));
    gx[i] = new TGraphAsymmErrors();
    gx[i]->SetName(Form("gx_%d",i));
    gdpt[i] = new TGraphAsymmErrors();
    gdpt[i]->SetName(Form("gdpt_%d",i));
  }
  TFile* fff[7][1000];
  
  for ( int ipt = 0 ; ipt<nPtBin  ; ipt++) { 
    for ( int iSpecies=0 ; iSpecies<=5 ; iSpecies++){ 
      if (  (iSpecies!=kPPDATA)&&(iSpecies!=kHIDATA) ) 
	continue;
      
      int iglb = ipt + iSpecies*50.;
      int icent = -1;
      
      if ( iSpecies == kPPDATA) { 
        icent = 7;
	fff[iSpecies][iglb] = new TFile(Form("photonTrackCorr_ppDATA_output_photonPtThr%d_to_%d_jetPtThr30_20130816.root",(int)ptBin[ipt],(int)ptBin[ipt+1]));
      }
      if ( iSpecies == kHIDATA) { 
	icent = 10030;
	//	icent = 13099;
	fff[iSpecies][iglb] = new TFile(Form("photonTrackCorr_pbpbDATA_output_photonPtThr%d_to_%d_jetPtThr30_20130816.root",(int)ptBin[ipt],(int)ptBin[ipt+1]));
      }
  cout << "hdphi" << endl;     
      hdphi[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("jetDphi_icent%d_final",icent));
      
      hxjg[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("xjg_icent%d_final",icent));
      hxjgNorm[iSpecies][iglb] = (TH1D*)hxjg[iSpecies][iglb]->Clone(Form("norm_%s",hxjg[iSpecies][iglb]->GetName()) );
      meanX[iSpecies][iglb].val = hxjg[iSpecies][iglb]->GetMean();
      meanX[iSpecies][iglb].err = hxjg[iSpecies][iglb]->GetMeanError();
      gx[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], meanX[iSpecies][iglb].val);
      gx[iSpecies]->SetPointError(ipt+1, 0.001,0.001, meanX[iSpecies][iglb].err, meanX[iSpecies][iglb].err);

      hdpt[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("dpt_icent%d_final",icent));
      hdptNorm[iSpecies][iglb] = (TH1D*)hdpt[iSpecies][iglb]->Clone(Form("norm_%s",hdpt[iSpecies][iglb]->GetName()) );
      meanDpt[iSpecies][iglb].val = hdpt[iSpecies][iglb]->GetMean();
      meanDpt[iSpecies][iglb].err = hdpt[iSpecies][iglb]->GetMeanError();
      gdpt[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], meanDpt[iSpecies][iglb].val);
      gdpt[iSpecies]->SetPointError(ipt+1, 0.001,0.001, meanDpt[iSpecies][iglb].err, meanDpt[iSpecies][iglb].err);

cout << "rError" << endl;      
      double rError;
      rjg[iSpecies][iglb].val = hxjg[iSpecies][iglb]->IntegralAndError(1, hxjg[iSpecies][iglb]->GetNbinsX(), rError, "width");
      rjg[iSpecies][iglb].err = rError;
      gr[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], rjg[iSpecies][iglb].val);
      gr[iSpecies]->SetPointError(ipt+1, 0.001,0.001, rjg[iSpecies][iglb].err, rjg[iSpecies][iglb].err);

      
    }
  }
  
  cout << "finish!"<< endl; 
  //
  //for PbPb 30-100 % !!
  //
  for ( int ipt = 0 ; ipt<nPtBin  ; ipt++) { 
      cout << "in the for loop  " << endl;
      int iSpecies=6;
      int iglb = ipt + iSpecies*50.;
      int icent = 13099;
      fff[iSpecies][iglb] = new TFile(Form("photonTrackCorr_pbpbDATA_output_photonPtThr%d_to_%d_jetPtThr30_20130816.root",(int)ptBin[ipt],(int)ptBin[ipt+1]));
      hdphi[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("jetDphi_icent%d_final",icent));

      hxjg[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("xjg_icent%d_final",icent));
      hxjgNorm[iSpecies][iglb] = (TH1D*)hxjg[iSpecies][iglb]->Clone(Form("norm_%s",hxjg[iSpecies][iglb]->GetName()) );
      meanX[iSpecies][iglb].val = hxjg[iSpecies][iglb]->GetMean();
      meanX[iSpecies][iglb].err = hxjg[iSpecies][iglb]->GetMeanError();
      gx[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], meanX[iSpecies][iglb].val);
      gx[iSpecies]->SetPointError(ipt+1, 0.001,0.001, meanX[iSpecies][iglb].err, meanX[iSpecies][iglb].err);

      hdpt[iSpecies][iglb] = (TH1D*)fff[iSpecies][iglb]->Get(Form("dpt_icent%d_final",icent));
      hdptNorm[iSpecies][iglb] = (TH1D*)hdpt[iSpecies][iglb]->Clone(Form("norm_%s",hdpt[iSpecies][iglb]->GetName()) );
      meanDpt[iSpecies][iglb].val = hdpt[iSpecies][iglb]->GetMean();
      meanDpt[iSpecies][iglb].err = hdpt[iSpecies][iglb]->GetMeanError();
      gdpt[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], meanDpt[iSpecies][iglb].val);
      gdpt[iSpecies]->SetPointError(ipt+1, 0.001,0.001, meanDpt[iSpecies][iglb].err, meanDpt[iSpecies][iglb].err);

      double rError;
      rjg[iSpecies][iglb].val = hxjg[iSpecies][iglb]->IntegralAndError(1, hxjg[iSpecies][iglb]->GetNbinsX(), rError, "width");
      rjg[iSpecies][iglb].err = rError;
      gr[iSpecies]->SetPoint     (ipt+1, AvePtBin[ipt], rjg[iSpecies][iglb].val);
      gr[iSpecies]->SetPointError(ipt+1, 0.001,0.001, rjg[iSpecies][iglb].err, rjg[iSpecies][iglb].err);
  }

            
 

  TCanvas* c1 = new TCanvas("c1","",900,350);
  makeMultiPanelCanvas(c1,nPtBin,1,0.0,0.0,0.2,0.15,0.02);
  for ( int ipt = 0 ; ipt<nPtBin  ; ipt++) {
    
    
    c1->cd(ipt+1);
    
    int iSpecies = kPPDATA;
    int iglb = ipt + iSpecies*50.;
    handsomeTH1(hdptNorm[iSpecies][iglb],1);
    if (xNorm==1) scaleInt(hdptNorm[iSpecies][iglb]);
    hdptNorm[iSpecies][iglb]->SetXTitle("x_{J,#gamma}");
    hdptNorm[iSpecies][iglb]->SetYTitle("#frac{dN}{dx} #frac{1}{N}");
    hdptNorm[iSpecies][iglb]->SetAxisRange(-100,100,"X");
    if (xNorm==1)     hdptNorm[iSpecies][iglb]->SetAxisRange(-.03,.6,"Y");
    else              hdptNorm[iSpecies][iglb]->SetAxisRange(-.03,.6,"Y");
    hdptNorm[iSpecies][iglb]->SetMarkerStyle(24);
    hdptNorm[iSpecies][iglb]->Draw();

    iSpecies = kHIDATA;
    iglb = ipt + iSpecies*50.;
    if (xNorm==1)  scaleInt(hdptNorm[iSpecies][iglb]);
    handsomeTH1(hdptNorm[iSpecies][iglb],2);
    if (drawPbPb) hdptNorm[iSpecies][iglb]->Draw("same");
    
    //for PbPb 30-100 % !! 
    iSpecies = 6;
    iglb = ipt + iSpecies*50.;
    if (xNorm==1)  scaleInt(hdptNorm[iSpecies][iglb]);
    handsomeTH1(hdptNorm[iSpecies][iglb],2);
    hdptNorm[iSpecies][iglb] -> SetMarkerStyle(24);

    if (drawPbPb) hdptNorm[iSpecies][iglb]->Draw("same");
    //    onSun(0,0,2,0);

    //    onSun(meanX[iSpecies][iglb].val - meanX[iSpecies][iglb].err, 0, meanX[iSpecies][iglb].val+meanX[iSpecies][iglb].err,0,ycolor[ipt+1],2);

    float dx1;    
    (ipt==0)? dx1=0.15 : dx1=0 ;
    
    if ( ipt == nPtBin-1 ) 
      drawText(Form("p_{T}^{#gamma} > %dGeV,   p_{T}^{jet}>30GeV", (int)ptBin[ipt]), 0.12+dx1+0.25,0.889118,1,15);
    else 
      drawText(Form("%dGeV < p_{T}^{#gamma} < %dGeV,   p_{T}^{jet}>30GeV", (int)ptBin[ipt], (int)ptBin[ipt+1]), 0.12+dx1,0.889118,1,15);

      
    TLegend *l1 = new TLegend(0.6365615,0.6445304,0.9577623,0.846736,NULL,"brNDC");
    easyLeg(l1,"2.76TeV");
    l1->AddEntry(hdptNorm[kPPDATA][ipt + kPPDATA*50],"pp ","p");
    if (drawPbPb)    l1->AddEntry(hdptNorm[kHIDATA][iglb],"PbPb 0-30%","p");
    if (drawPbPb)    l1->AddEntry(hdptNorm[6][iglb],"PbPb 30-100%","p");
    if ( ipt==0 )   l1->Draw();

  }
  //  c1->SaveAs(Form("gifs/dpt_ptDependence_drawPbPb%d_norm%d.pdf",drawPbPb,xNorm));

  TCanvas* cDphi = new TCanvas("cDphi","",900,350);
  makeMultiPanelCanvas(cDphi,nPtBin,1,0.0,0.0,0.2,0.15,0.02);
  for ( int ipt = 0 ; ipt<nPtBin  ; ipt++) {
    cDphi->cd(ipt+1);
    
    int iSpecies = kPPDATA;
    int iglb = ipt + iSpecies*50.;
    handsomeTH1(hdphi[iSpecies][iglb],1);
    hdphi[iSpecies][iglb]->SetYTitle("x_{J,#gamma}");
    hdphi[iSpecies][iglb]->SetXTitle("#Delta#phi_{J,#gamma}");
    hdphi[iSpecies][iglb]->Scale(1./hdphi[iSpecies][iglb]->Integral("width"));
    hdphi[iSpecies][iglb]->SetAxisRange(0.01,30,"Y");
    hdphi[iSpecies][iglb]->SetMarkerStyle(24);
    hdphi[iSpecies][iglb]->Draw();

    iSpecies = kHIDATA;
    iglb = ipt + iSpecies*50.;
    hdphi[iSpecies][iglb]->Scale(1./hdphi[iSpecies][iglb]->Integral("width"));
    handsomeTH1(hdphi[iSpecies][iglb],2);
    if (drawPbPb)     hdphi[iSpecies][iglb]->Draw("same");
    
    // for PbPb 30-100% !!!
    iSpecies = 6;
    iglb = ipt + iSpecies*50.;
    hdphi[iSpecies][iglb]->Scale(1./hdphi[iSpecies][iglb]->Integral("width"));
    handsomeTH1(hdphi[iSpecies][iglb],2);
    hdphi[iSpecies][iglb] -> SetMarkerStyle(24);
    if (drawPbPb)     hdphi[iSpecies][iglb]->Draw("same");
    
    gPad->SetLogy();
    float dx1;    
    (ipt==0)? dx1=0.15 : dx1=0 ;
    
    if ( ipt == nPtBin-1 ) 
      drawText(Form("%dGeV<p_{T}^{#gamma},   p_{T}^{jet}>30GeV", (int)ptBin[ipt]), 0.15+dx1+0.25,0.889118,1,15);
    else 
      drawText(Form("%dGeV<p_{T}^{#gamma}<%dGeV,   p_{T}^{jet}>30GeV", (int)ptBin[ipt], (int)ptBin[ipt+1]), 0.15+dx1,0.889118,1,15);
    
      
    TLegend *l1 = new TLegend(0.6365615,0.6445304,0.9577623,0.846736,NULL,"brNDC");
    easyLeg(l1,"2.76TeV");
    l1->AddEntry(hdphi[kPPDATA][ipt + kPPDATA*50],"pp ","p");
    if (drawPbPb)    l1->AddEntry(hdphi[kHIDATA][iglb],"PbPb 0-30%","p");
    if (drawPbPb)    l1->AddEntry(hdphi[6][iglb],"PbPb 30-100%","p");
    if ( ipt==0 )   l1->Draw();

  }

  
  //  cDphi->SaveAs(Form("gifs/dphi_ptDependence_drawPbPb%d_norm%d.pdf",drawPbPb,xNorm));
  
  TCanvas* c2 = new TCanvas("c2","",800,400);
  c2->Divide(2,1);
  c2->cd(2);
  TH1D* hr = new TH1D("hr",";p_{T}^{#gamma};r_{J,#gamma}",200,20,180);
  handsomeTH1(hr,0);
  hr->SetAxisRange(0.0,1.3,"Y");
  //  hr->SetNdivisions(5);
  hr->Draw();
  handsomeTGraph(gr[kPPDATA],1);
  handsomeTGraph(gr[kHIDATA],2);
  handsomeTGraph(gr[6],2);
  gr[kPPDATA]->SetMarkerStyle(24);
  gr[kPPDATA]->Draw("same p");
  gr[6]->SetMarkerStyle(24);
  if (drawPbPb)   gr[kHIDATA]->Draw("same p");
  if (drawPbPb)   gr[6]->Draw("same p");
  jumSun(20,1,180,1);


  
  c2->cd(1);
  TH1D* hx = (TH1D*)hr->Clone("hx");
  handsomeTH1(hx,0);
  hx->SetYTitle("<#Deltap_{T}^{J,#gamma}>");
  hx->SetAxisRange(-60,10,"Y");
  //  hx->SetNdivisions(5);
  hx->Draw();
  handsomeTGraph(gdpt[kPPDATA],1);
  handsomeTGraph(gdpt[kHIDATA],2);
  handsomeTGraph(gdpt[6],2);
  gdpt[kPPDATA]->SetMarkerStyle(24);
  gdpt[6]->SetMarkerStyle(24);
  gdpt[kPPDATA]->Draw("same p");
  if (drawPbPb)   gdpt[kHIDATA]->Draw("same p");
  if (drawPbPb)   gdpt[6]->Draw("same p");
  jumSun(20,1,180,1);
 
  gStyle -> SetEndErrorSize(0);
  
  TLegend *l1=   new TLegend(0.5226071,0.6300415,0.9597724,0.8332584,NULL,"brNDC");
  easyLeg(l1,"2.76TeV");
  l1->AddEntry(gr[kPPDATA],"pp ","p");
  if (drawPbPb)     l1->AddEntry(gr[kHIDATA],"PbPb 0-30%","p");
  if (drawPbPb)     l1->AddEntry(gr[6],"PbPb 30-100%","p");
  l1->Draw();

  //  c2->SaveAs(Form("gifs/summaryPlot_ptDependence_drawPbPb%d_norm%d.pdf",drawPbPb,xNorm));

}
void drawDphi() { 
  
  TH1D* hdphi[5][5]; // [species][centrality] 
  TH1D* hxjg[5][5]; // [species][centrality] 
  TH1D* hxjgNorm[5][5];
  TFile* fff[5];
  
  fff[kHIDATA] = new TFile("ffFiles/photonTrackCorr_pbpbDATA_output_photonPtThr60_jetPtThr30_20130210_genLevel0.root");
  for ( int iSpecies =0 ; iSpecies<=5 ; iSpecies++) {
    if (iSpecies != kHIDATA)       continue;
    for ( int icent = 1 ; icent<=4 ; icent++) {
      hdphi[iSpecies][icent] = (TH1D*)fff[iSpecies]->Get(Form("jetDphi_icent%d_final",icent));
      hxjg[iSpecies][icent] = (TH1D*)fff[iSpecies]->Get(Form("jetXjg_icent%d_final",icent));
      hxjgNorm[iSpecies][icent] = (TH1D*)hxjg[iSpecies][icent]->Clone(Form("norm_%s",hxjg[iSpecies][icent]->GetName()));
      scaleInt(hxjgNorm[iSpecies][icent]);    
    }}
  
  fff[kHIMC]   = new TFile("ffFiles/photonTrackCorr_pbpbMC_output_photonPtThr60_jetPtThr30_20130210_genLevel0.root"); 
  for ( int iSpecies =0 ; iSpecies<=5 ; iSpecies++) {
    if (iSpecies != kHIMC)         continue;
    for ( int icent = 1 ; icent<=4 ; icent++) {
      hdphi[iSpecies][icent] = (TH1D*)fff[iSpecies]->Get(Form("jetDphi_icent%d_final",icent));
      hxjg[iSpecies][icent] = (TH1D*)fff[iSpecies]->Get(Form("jetXjg_icent%d_final",icent));
      hxjgNorm[iSpecies][icent] = (TH1D*)hxjg[iSpecies][icent]->Clone(Form("norm_%s",hxjg[iSpecies][icent]->GetName()));
      scaleInt(hxjgNorm[iSpecies][icent]);
    }}
  
  
  
  TCanvas* c1 = new TCanvas("c1","",1400,450);
  makeMultiPanelCanvas(c1,4,1,0.0,0.0,0.2,0.15,0.02);
  for ( int icent = 1 ; icent<=4 ; icent++) {
    c1->cd(5-icent);
    handsomeTH1(hdphi[kHIMC][icent],1);
    handsomeTH1(hdphi[kHIDATA][icent],2);
    hdphi[kHIMC][icent]->Scale(1./hdphi[kHIMC][icent]->Integral("width"));
    hdphi[kHIDATA][icent]->Scale(1./hdphi[kHIDATA][icent]->Integral("width"));
    hdphi[kHIMC][icent]->SetAxisRange(3.141592/3.,3.141592,"X");
    hdphi[kHIMC][icent]->SetAxisRange(0.01,5,"Y");
    hdphi[kHIMC][icent]->DrawCopy("hist");
    //  hdphi[kHIDATA][icent]->Draw("same");
    //    gPad->SetLogy();
    
    TF1 *fdphi = new TF1("fdphi","exp(-(TMath::Pi()-x)/[0]) / ([0]*(1-exp(-TMath::Pi()/[0]))) ",2.0*TMath::Pi()/3.0,TMath::Pi());
    fdphi->SetParName(0,"width");
    fdphi->SetParameter("width",0.22);
        
    float fitxmin=3.1415926*2./3;
    //    float fitxmin=2.5;
    hdphi[kHIMC][icent]->Fit("fdphi","0llm","",fitxmin,3.1415926);
    fdphi->SetLineWidth(1);
    fdphi->SetLineStyle(2);
    fdphi->SetLineColor(kBlue);
    float dphiWidth = fdphi->GetParameter("width");
    float dphiWidthErr = fdphi->GetParError(0);
    cout << " dphiWidth,dphiWidthErr = " << dphiWidth <<"   "<< dphiWidthErr << endl;
    fdphi->DrawCopy("same");
  }
  c1->SaveAs("pdfFiles/dPhi_MC_only.pdf");


  TCanvas* c2 = new TCanvas("c2","",1400,450);
  makeMultiPanelCanvas(c2,4,1,0.0,0.0,0.2,0.15,0.02);
  for ( int icent = 1 ; icent<=4 ; icent++) {
    c2->cd(5-icent);
    handsomeTH1(hxjgNorm[kHIMC][icent],1);
    handsomeTH1(hxjgNorm[kHIDATA][icent],2);
    hxjgNorm[kHIMC][icent]->SetAxisRange(-0.01,0.35,"Y");
    hxjgNorm[kHIMC][icent]->DrawCopy("");
    //    hxjgNorm[kHIDATA][5-icent]->Draw("same");
    int lowCent = centBin1[icent-1];    int highCent = centBin1[icent]-1;
    drawText(Form("%.0f%% - %.0f%%", float((float)lowCent*2.5), float((float)(highCent+1)*2.5)), 0.67,0.7,1);
  }
  TLegend *l12 = new TLegend(0.304355,0.755085,.8,0.9552542,NULL,"brNDC");
  easyLeg(l12,"p_{T}^{Jet}/p_{T}^{#gamma}");
  l12->AddEntry(hxjgNorm[kHIMC][1],"PYTHIA+HYDJET","pl");
  c2->cd(1);   l12->Draw();

  c2->SaveAs("pdfFiles/xgj_MC_only.pdf");

  TCanvas* c2MCover = new TCanvas("c2MCover","",500,500);
  bool drawn=false;
  for ( int icent = 1 ; icent<=4 ; icent++) {
    c2MCover->cd(icent);
    handsomeTH1(hxjgNorm[kHIMC][icent],ycolor[icent]);
    hxjgNorm[kHIMC][5-icent]->SetAxisRange(-0.01,0.38,"Y");
    if (drawn)  
      hxjgNorm[kHIMC][5-icent]->Draw("same");
    else       hxjgNorm[kHIMC][5-icent]->Draw("");
    
    
    drawn = true;
  }
  TLegend *l11 = new TLegend(0.1794355,0.7055085,1,0.9152542,NULL,"brNDC");
  easyLeg(l11,"p_{T}^{Jet}/p_{T}^{#gamma} of PYTHIA embedded in"); 
  l11->AddEntry(hxjgNorm[kHIMC][4],"HYDJET 50-100%","p");
  l11->AddEntry(hxjgNorm[kHIMC][3],"HYDJET 30-50%","p");
  l11->AddEntry(hxjgNorm[kHIMC][2],"HYDJET 10-30%","p");
  l11->AddEntry(hxjgNorm[kHIMC][1],"HYDJET 0 -10%","p");
  l11->Draw();
  c2MCover->SaveAs("pdfFiles/xgj_MC_OnePannel.pdf");


  
  TCanvas* c3 = new TCanvas("c3","",500,500);
  TH1D* npartTempHist = new TH1D("meanR",";N_{part}; R",100,0,400);
  
  double npart4[8] = { 43.6661-10, 43.6661+10, 116.36-10, 116.36+10, 235.769-10, 235.769+10, 359.22-10,359.22+10};
  double npart4_2[4] = { 43.6661, 116.36, 235.769, 359.22};
  TGraphAsymmErrors* gR[5];

  for ( int iSpec = 0 ; iSpec<5 ; iSpec++) {
    
    if ( (iSpec != kHIDATA) && (iSpec != kHIMC) )       continue;
    gR[iSpec] = new TGraphAsymmErrors();
    gR[iSpec]->SetName(Form("gR_%d",iSpec));
    for ( int icent =4 ; icent>=1 ; icent--) {
      double theRerror;
      double theR = hxjg[iSpec][icent]->IntegralAndError(1, hxjg[iSpec][5-icent]->GetNbinsX(), theRerror, "width");
      gR[iSpec]->SetPoint(icent, npart4_2[4 - icent], theR );
      gR[iSpec]->SetPointError(icent, 0.001,0.001, theRerror, theRerror);    
    }
  }
  handsomeTH1(npartTempHist,1);
  npartTempHist->SetAxisRange(0.3,1.0,"Y");
  npartTempHist->DrawCopy();
  gR[kHIDATA]->SetMarkerColor(2);
  gR[kHIDATA]->SetLineColor(2);
  gR[kHIMC]->Draw("same p");
  //  gR[kHIDATA]->Draw("same p");

  c3->SaveAs("pdfFiles/r_MC_only.pdf");

  TCanvas* c3a = new TCanvas("c3a","",500,500);
  npartTempHist->DrawCopy();
  gR[kHIMC]->Draw("same p");
  gR[kHIDATA]->Draw("same p");
  TLegend *l13 = new TLegend(0.1794355,0.7055085,1,0.9152542,NULL,"brNDC");
  easyLeg(l13,"R_{J,#gamma}");
  l13->AddEntry(gR[kHIDATA],"PbPb data","pl");
  l13->AddEntry(gR[kHIMC],"PYTHIA+HYDJET","pl");
  l13->Draw();
  c3a->SaveAs("pdfFiles/r_MC_Data.pdf");


  TCanvas* c4 = new TCanvas("c4","",500,500);
  
  TGraphAsymmErrors* gX[5];

  for ( int iSpec = 0 ; iSpec<5 ; iSpec++) {
    
    if ( (iSpec != kHIDATA) && (iSpec != kHIMC) )       continue;
    gX[iSpec] = new TGraphAsymmErrors();
    gX[iSpec]->SetName(Form("gX_%d",iSpec));
    for ( int icent =4 ; icent>=1 ; icent--) {
      double theX      = hxjg[iSpec][icent]->GetMean();
      double theXerror = hxjg[iSpec][icent]->GetMeanError();
      gX[iSpec]->SetPoint(icent, npart4_2[4 - icent], theX );
      gX[iSpec]->SetPointError(icent, 0.001,0.001, theXerror, theXerror);    
    }
  }
  handsomeTH1(npartTempHist,1);
  npartTempHist->SetYTitle("<X_{J,#gamma}>");
  npartTempHist->SetAxisRange(0.6,1.1,"Y");
  npartTempHist->DrawCopy();
  gX[kHIDATA]->SetMarkerColor(2);
  gX[kHIDATA]->SetLineColor(2);
  gX[kHIMC]->Draw("same p");
  //  gX[kHIDATA]->Draw("same p");

  c4->SaveAs("pdfFiles/meanX_MC_only.pdf");


 TCanvas* c4a = new TCanvas("c4a","",500,500);
  
 npartTempHist->DrawCopy();
 gX[kHIMC]->Draw("same p");
 gX[kHIDATA]->Draw("same p");
 TLegend *l14 = new TLegend(0.1794355,0.7055085,1,0.9152542,NULL,"brNDC");
 easyLeg(l14,"<X_{J,#gamma}>");
 l14->AddEntry(gX[kHIDATA],"PbPb data","pl");
 l14->AddEntry(gX[kHIMC],"PYTHIA+HYDJET","pl");
 l14->Draw();
 c4a->SaveAs("pdfFiles/meanX_MC_Data.pdf");




    
}
void showerShapeBkg(  sampleType collision = kPPMC)
{
  TH1::SetDefaultSumw2();
  
  TCut bkgPhoCut = "( (abs(genMomId)>22) || (genIso>5) ) && (hovere<0.1)";

  multiTreeUtil* tgj = new multiTreeUtil();
  if ( collision == kPPMC ) {
    tgj->addFile(fnamePPMC_emDijet30to50,   "tgj", bkgPhoCut, wPPMC_emDijet30to50);
    tgj->addFile(fnamePPMC_emDijet50to80,   "tgj", bkgPhoCut, wPPMC_emDijet50to80);
    tgj->addFile(fnamePPMC_emDijet80to120,  "tgj", bkgPhoCut, wPPMC_emDijet80to120);
    tgj->addFile(fnamePPMC_emDijet120to9999,"tgj", bkgPhoCut, wPPMC_emDijet120to9999);
  }
  else { 
    cout << " pA and PbPb MC samples are not ready yet" << endl;
  }


  TH1D* hPtHat = new TH1D("hpthat",";pt hat (GeV);",200,0,200);
  handsomeTH1(hPtHat,1);
  TCanvas* c1 = new TCanvas("c1","",500,500);
  tgj->Draw3(hPtHat,"photonEt",bkgPhoCut,"");
  gPad->SetLogy();

  TCanvas* c2 = new TCanvas("c1","",1100,600);
  makeMultiPanelCanvas(c2,nPtBinPa,2,0.0,0.0,0.2,0.15,0.02);
  c2->cd(1);
  TCut ppIsoCut  = "(ecalIso < 4.2)  &&  (hcalIso < 2.2)  &&  (trackIso < 2)";
  TCut hiIsoCut  = "sumIso < 1";
  TCut ppSbCut   = "(ecalIso < 4.2)  &&  (hcalIso < 2.2)  &&  ( (trackIso>2) && (trackIso<4) )";
  TCut hiSbCut   = "(sumIso > 10) && (sumIso<20)";

  TH1D* sii[5][nPtBinPa+1]; 
  for ( int ipt = 1 ; ipt<=nPtBinPa ; ipt++) {
    for ( int iiso = 1 ; iiso<=4 ; iiso++) {
      sii[iiso][ipt] = new TH1D(Form("sigmaIetaIeta_iso%d_ipt%d",iiso,ipt), ";#sigma_{#eta#eta};Entries", 25,0,0.025);
      handsomeTH1(sii[iiso][ipt],1);
    }
    TCut phoPtCut = Form ( "photonEt>=%f && photonEt<%f", (float)ptBinPa[ipt-1], (float)ptBinPa[ipt]);
    tgj->Draw2(sii[1][ipt], "sigmaIetaIeta",ppIsoCut && phoPtCut, "");
    tgj->Draw2(sii[2][ipt], "sigmaIetaIeta",hiIsoCut && phoPtCut, "");
    tgj->Draw2(sii[3][ipt], "sigmaIetaIeta",ppSbCut && phoPtCut, "");
    tgj->Draw2(sii[4][ipt], "sigmaIetaIeta",hiSbCut && phoPtCut, "");
    scaleInt(sii[1][ipt]);
    scaleInt(sii[2][ipt]);
    scaleInt(sii[3][ipt]);
    scaleInt(sii[4][ipt]);
  }  

  for ( int ipt = 1 ; ipt<=nPtBinPa ; ipt++) {
    c2->cd(ipt);
    TH1D* sii_A = sii[1][ipt];
    TH1D* sii_B = sii[4][ipt];
    handsomeTH1(sii_B,2);
    sii_A->Draw();
    sii_B->Draw("same");
    c2->cd(ipt+nPtBinPa);
    TH1D* hRatio = (TH1D*)sii_A->Clone(Form("hRatio_%s",sii_A->GetName()));
    hRatio->Divide(sii_B);
    hRatio->SetAxisRange(0,4,"Y");
    hRatio->Draw();
    hRatio->Fit("pol1");
    jumSun(0,1,0.025,1);
  }
}
Exemple #6
0
void drawSingleVariable(TH1D* theHist, int lowCent, int highCent, TString variable1, TCut addCut1, TString variable2, TCut addCut2, int normChoice,bool overDraw, TH1D* theMCSig) { 
   theHist->Reset();   
   if (addCut2 =="")  
      addCut2 = addCut1;
   if (variable2 =="")
      variable2 = variable1;

   cout << "addCut2 = " << addCut2.GetTitle() << endl;
   cout << "variable2 = "<< variable2 << endl;

   TString fname1 = "rootFiles/barrelHiForestPhoton35_Skim2011-Dec04-withTracks.root";//barrelHiForestPhoton35_Skim2011-v2.root";
   TFile *f1  =new TFile(fname1.Data());
   TTree *photon1 = (TTree*)f1->Get("yongsunPhotonTree");
   photon1->AddFriend("yEvt=yongsunHiEvt"    ,fname1.Data());
   photon1->AddFriend("yskim=yongsunSkimTree"   ,fname1.Data());
   photon1->AddFriend("yhlt=yongsunHltTree"     ,fname1.Data());

   TString fname2 = "rootFiles/barrelHiForestPhoton35_Skim2010.root";
   TFile *f2  =new TFile(fname2.Data());
   TTree *photon2 = (TTree*)f2->Get("yongsunPhotonTree");
   //  photon2->AddFriend("yEvt=yongsunHiEvt"    ,fname2.Data());
   photon2->AddFriend("yskim=yongsunSkimTree"   ,fname2.Data());
   photon2->AddFriend("yhlt=yongsunHltTree"     ,fname2.Data());
   
   TString fnameMC ;
   TFile *fMC;
   TTree *photonSig;
   if ( theMCSig){ 
      fnameMC = "rootFiles/barrelHiForestPhoton35_MCPhoton50_25k.root";
      fMC  =new TFile(fnameMC.Data());
      photonSig = (TTree*)fMC->Get("yongsunPhotonTree");
      photonSig->AddFriend("yEvt=yongsunHiEvt"    ,fnameMC.Data());
      cout << " MC is running " << endl;
   }
   //   photonSig->AddFriend("yskim=yongsunSkimTree"   ,fnameMC.Data());
   //  photonSig->AddFriend("yhlt=yongsunHltTree"     ,fnameMC.Data());
   
   //genMatchCut1 
   TCut collisionCut = "yskim.pcollisionEventSelection==1";
   
   TCut runCut1       = ""; //"yhlt.Run>= 181985 && yhlt.Run <=182099"; 
   
   TCut centCut1     = Form("(yEvt.hiBin >= %d) && (yEvt.hiBin<= %d)",lowCent,highCent);
   TCut centCut2     = Form("(cBin >= %d) && (cBin <= %d)",lowCent,highCent);
   
   TCut spikeCut1     = "abs(seedTime)<4 && swissCrx<0.90 && sigmaIetaIeta>0.002";
   TCut spikeCut2   = "abs(seedTime)<4 && (1 - (eRight+eLeft+eTop+eBottom)/eMax)<0.90 && sigmaIetaIeta>0.002";
   TCut spikeCutSig = "swissCrx<0.90 && sigmaIetaIeta>0.002";

   TCut nonElectron = "!isEle";
   
   TCut hltCut1       = "yhlt.HLT_HISinglePhoton30_v2==1"; // 181695 => H/E cut is removed from L1
   TCut hltCut2       = "yhlt.HLT_HIPhoton30==1";
      
   TCut basicCut1       = collisionCut && nonElectron && etaCut && spikeCut1 && centCut1 && runCut1 && hltCut1;
   TCut basicCut2       = collisionCut && nonElectron && etaCut && spikeCut2 && centCut2; //&& hltCut2;
   TCut basicCutSig     =                 nonElectron && etaCut && spikeCutSig && centCut1;
   
   
   TCut finalCut1     = basicCut1   && addCut1;
   TCut finalCut2     = basicCut2   && addCut2;
   TCut finalCutSig   = basicCutSig && addCut1 && genMatchCut1;
   
   TH1D* tempHist1 = (TH1D*)theHist->Clone("tempHist1");
   TH1D* tempHist2 = (TH1D*)theHist->Clone("tempHist2");
   TH1D* tempHistSig = (TH1D*)theHist->Clone("tempHistSig");
   
   
   photon1->Draw(Form("%s>>%s",variable1.Data(),tempHist1->GetName()),finalCut1);
   photon2->Draw(Form("%s>>%s",variable2.Data(),tempHist2->GetName()),finalCut2);
   if ( theMCSig) {
      photonSig->Draw(Form("%s>>%s",variable1.Data(),tempHistSig->GetName()),  Form("(%s)*ncoll",finalCutSig.GetTitle()));
      cout << " mc cut = " << finalCutSig.GetTitle() << endl;
   }

   tempHist1->Sumw2();
   tempHist2->Sumw2();
   if ( theMCSig)
      tempHistSig->Sumw2();
   
   handsomeTH1(tempHist1,2);
   handsomeTH1(tempHist2,1);
   tempHist2->SetMarkerStyle(24);
   if ( normChoice == 0) {
      scaleInt(tempHist1);
      scaleInt(tempHist2);
   }
   if ( normChoice == 1) {
      double nEvents1 = photon1->GetEntries("leading==1" && basicCut1 && "pt>40 && hadronicOverEm<0.2");
      double nEvents2 = photon2->GetEntries("leading==1" && basicCut2 && "pt>40 && hadronicOverEm<0.2");
      tempHist1->Scale(1./nEvents1);
      tempHist2->Scale(1./nEvents2);
      cout <<" this file is<<" << nEvents1/nEvents2 * 6.7 << "micro barn" << endl;
   }
   if ( normChoice == 2) {
      double nLumi1 = 17.4   ; //microb^-1
      double nLumi2 = 7.0  ;
      tempHist1->Scale(1./nLumi1);
      tempHist2->Scale(1./nLumi2);
   }
   
   cleverRange(tempHist2,1.5);
   if ( overDraw) 
      tempHist2->DrawCopy("same");//hist");
   else 
      tempHist2->DrawCopy("");//hist");                                                                                                  

   tempHist1->DrawCopy("same");
   
   TLegend* leg1 =  new TLegend(0.4012097,0.7584746,1,0.9300847,NULL,"brNDC");
   easyLeg(leg1,"");
   leg1->AddEntry(tempHist2,"2010 PbPb, 6.8 #mub^{-1}","pl");
   leg1->AddEntry(tempHist1,"2011 PbPb, 84  #mub^{-1}","pl");
   leg1->Draw();
   theHist->Reset();
   theHist->Add(tempHist1);
   if ( theMCSig)
      theMCSig->Add(tempHistSig);
   
}
void MagnifierComponent::passOnMouseEventToPeer (const MouseEvent& e)
{
    if (peer != 0)
        mouseSource.handleEvent (peer, Point<int> (scaleInt (e.x), scaleInt (e.y)),
                                 e.eventTime.toMilliseconds(), ModifierKeys::getCurrentModifiers());
}
void yeonju_drawPAFigures_0815(int xNorm = 1) { 
  gStyle -> SetOptStat(0); 
    //yeonju
  const int nCentBinPa = 3;
  double centBinPa[nCentBinPa+1] = {0,20,30,100};
  double AvePtBin[nCentBinPa+1] = {10, 25.0, 65.0, 9999};
  const int nPt = 5;
  const int nFile = 10;
  
  double PtBinPa[nPt+1] = {40,50,60,80,120,9999};

/*  const int nCentBinPa = 5;
  double centBinPa[nCentBinPa+1] = {0,20,25,30,40,100};
  double AvePtBin[nCentBinPa+1] = { 10, 22.5, 27.5, 35, 70, 9999};
  */
  TH1D* hxjg[7][1000][20]; // [species][centrality][pt_dependence]
  TH1D* hxjgNorm[7][1000][20];
  TH1D* hdphi[7][1000][20];
  
  valPair meanX[7][1000][20];
  valPair rjg[7][1000][20];
  TGraphAsymmErrors* gr[7][20];
  TGraphAsymmErrors* gx[7][20];
  for (int j=1;j<=nFile;j++){
      for (int i=1;i<=7;i++) {  
          gr[i][j] = new TGraphAsymmErrors();
          gr[i][j]->SetName(Form("gr_%d_%d",i,j));
          gx[i][j] = new TGraphAsymmErrors();
          gx[i][j]->SetName(Form("gx_%d_%d",i,j));
      }
  }
  TFile* fff[7][1000][20];
  double rError[20];
// cout << "ok!"<< endl;
  for ( int icent = 1 ; icent<=nCentBinPa  ; icent++) { 
    int iSpecies =kPADATA ; 
    
    int iglb = icent + iSpecies*50.;
    
    fff[iSpecies][iglb][1] = new TFile("ffFiles/photonTrackCorr_ppbDATA_output_photonPtThr40_to_50_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][2] = new TFile("ffFiles/photonTrackCorr_ppbDATA_output_photonPtThr50_to_60_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][3] = new TFile("ffFiles/photonTrackCorr_ppbDATA_output_photonPtThr60_to_80_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][4] = new TFile("ffFiles/photonTrackCorr_ppbDATA_output_photonPtThr80_to_120_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][5] = new TFile("ffFiles/photonTrackCorr_ppbDATA_output_photonPtThr120_to_9999_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][6] = new TFile("ffFiles/photonTrackCorr_ppbMC_output_photonPtThr40_to_50_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][7] = new TFile("ffFiles/photonTrackCorr_ppbMC_output_photonPtThr50_to_60_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][8] = new TFile("ffFiles/photonTrackCorr_ppbMC_output_photonPtThr60_to_80_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][9] = new TFile("ffFiles/photonTrackCorr_ppbMC_output_photonPtThr80_to_120_jetPtThr30_20130815.root");
    fff[iSpecies][iglb][10] = new TFile("ffFiles/photonTrackCorr_ppbMC_output_photonPtThr120_to_9999_jetPtThr30_20130815.root");
  //          cout << "fffff" << endl;
    for(int j = 1; j <= nFile ; j++){
        hdphi[iSpecies][iglb][j] = (TH1D*)fff[iSpecies][iglb][j]->Get(Form("jetDphi_icent%d_final",icent));
//cout << "hdphi" <<endl;
        hxjg[iSpecies][iglb][j] = (TH1D*)fff[iSpecies][iglb][j]->Get(Form("xjg_icent%d_final",icent));
        hxjgNorm[iSpecies][iglb][j] = (TH1D*)hxjg[iSpecies][iglb][j]->Clone(Form("norm_%s",hxjg[iSpecies][iglb][j]->GetName()) );

//cout << "meanX" <<endl;
        meanX[iSpecies][iglb][j].val = hxjg[iSpecies][iglb][j]->GetMean();
        meanX[iSpecies][iglb][j].err = hxjg[iSpecies][iglb][j]->GetMeanError();
        gx[iSpecies][j]->SetPoint     (icent, AvePtBin[icent-1], meanX[iSpecies][iglb][j].val);
        gx[iSpecies][j]->SetPointError(icent, AvePtBin[icent-1] - centBinPa[icent-1], centBinPa[icent] - AvePtBin[icent-1], meanX[iSpecies][iglb][j].err, meanX[iSpecies][iglb][j].err);

//cout << "rjg" <<endl;
        rjg[iSpecies][iglb][j].val = hxjg[iSpecies][iglb][j]->IntegralAndError(1, hxjg[iSpecies][iglb][j]->GetNbinsX(), rError[j], "width");
        rjg[iSpecies][iglb][j].err = rError[j];
        gr[iSpecies][j]->SetPoint     (icent, AvePtBin[icent-1], rjg[iSpecies][iglb][j].val);
        gr[iSpecies][j]->SetPointError(icent,  AvePtBin[icent-1] - centBinPa[icent-1], centBinPa[icent] - AvePtBin[icent-1], rjg[iSpecies][iglb][j].err, rjg[iSpecies][iglb][j].err);
    }

  }

  cout << "Tcanvas c1 " << endl;
  TCanvas* c1 = new TCanvas("c1","xjg_distribution",900,1750);
  makeMultiPanelCanvas(c1,3,5,0.0,0.0,0.2,0.15,0.02);
  for ( int j = 1 ; j <= nPt ; j++){//pt
      for ( int icent = 1 ; icent<=nCentBinPa  ; icent++) {
          c1->cd(icent+3*(j-1));

          int iSpecies = kPADATA;
          int iglb = icent + iSpecies*50.;
          handsomeTH1(hxjgNorm[iSpecies][iglb][j],icent);
          hxjgNorm[iSpecies][iglb][j]->Scale(0.1);
          if (xNorm==1) scaleInt(hxjgNorm[iSpecies][iglb][j]);
          hxjgNorm[iSpecies][iglb][j]->SetXTitle("x_{J,#gamma}");
          hxjgNorm[iSpecies][iglb][j]->SetYTitle("#frac{dN}{dx} #frac{1}{N}");
          if (xNorm==1)     hxjgNorm[iSpecies][iglb][j]->SetAxisRange(-0.015,0.35,"Y");
          else              hxjgNorm[iSpecies][iglb][j]->SetAxisRange(-0.06,1.5,"Y");
          hxjgNorm[iSpecies][iglb][j]->SetMarkerStyle(19+j);
          hxjgNorm[iSpecies][iglb][j]->Draw();


          float dx1;    
          ((icent==1)||(icent==4))? dx1=0.15 : dx1=0 ;

          if ( icent == nCentBinPa )
              drawText(Form("E_{T}^{HF|#eta|>4} > %dGeV, ", (int)centBinPa[icent-1]), 0.12+dx1+0.25,0.889118,1,15);//yeonju 130805
          else
              drawText(Form("%dGeV < E_{T}^{HF|#eta|>4} < %dGeV, ", (int)centBinPa[icent-1], (int)centBinPa[icent]), 0.12+dx1,0.889118,1,15);
          
          if ( j == nPt ) 
              drawText(Form("p_{T}^{#gamma} < %dGeV, ", (int)PtBinPa[j-1]), 0.12+dx1+0.25,0.79,1,15);//yeonju 130823
          else
              drawText(Form("%dGeV < p_{T}^{#gamma} < %dGeV, ", (int)PtBinPa[j-1], (int)PtBinPa[j]), 0.12+dx1,0.79,1,15);//yeonju 130823
          
              TLegend *l1 = new TLegend(0.6365615,0.6445304,0.9577623,0.846736,NULL,"brNDC");
              easyLeg(l1,"p+Pb 5.02TeV");
          //    l1->AddEntry(hxjgNorm[kPADATA][icent + kPADATA*50][j],"pPb ","p");
              if ( icent==1 && j==1)   l1->Draw();
              onSun(0,0,2,0);
              jumSun(1,0,1,1);
      }
  }

  c1 -> SaveAs("pPbData_xjgDistribution_pt_cent_dep.gif");
//cout<< "c11" << endl;
/*  TCanvas* c11 = new TCanvas("c11","xjgDist_onePanel_pt_cent_dep",500,500);
  for ( int j = 1 ; j <=nPt ; j++){
      for ( int icent = 1 ; icent<=nCentBinPa  ; icent++) {
          int iSpecies = kPADATA;
          int iglb = icent + iSpecies*50.;
          handsomeTH1(hxjgNorm[iSpecies][iglb][j],icent+3*(j-1));

          if ( icent == 1 && j == 1) hxjgNorm[iSpecies][iglb][j]->Draw();
          else     hxjgNorm[iSpecies][iglb][j]->Draw("same");
          onSun(0,0,2,0);
      }
  }

  c11 -> SaveAs("xjgDist_onePanel_by_pt_cent_dep.gif");
*/
  TCanvas* cDphi = new TCanvas("cDphi","",1200,350);
  makeMultiPanelCanvas(cDphi,5,1,0.0,0.0,0.2,0.15,0.02);

  TH1D* meanDphi[7][10];      // [iSpecies][pt]
  for (int j=1 ; j<=nPt  ; j++) {

          int iSpecies = kPADATA;
          meanDphi[iSpecies][j] = new TH1D(Form("meanDphi_iSpecies%d_pt%d",iSpecies,j), ";p_{T}^{#gamma} (GeV); <Dphi_{J#phi}>",nPt,AvePtBin);
  }

  for (int ipt=1 ; ipt<=nPt ; ipt++) {
      for (int icent=1 ; icent<= nCentBinPa ; icent++ ) { 
          int iSpecies = kPADATA;
          int iglb = icent + iSpecies*50.;

          if ( hdphi[iSpecies][iglb][ipt] == NULL ) 
              continue;   // emtpy histogram 

          meanDphi[iSpecies][ipt]->SetBinContent( ipt, hdphi[iSpecies][iglb][ipt]->GetMean() );
          meanDphi[iSpecies][ipt]->SetBinError  ( ipt, hdphi[iSpecies][iglb][ipt]->GetMeanError() );
      }
  }

  for ( int j = 1 ; j<=nPt ; j++){
      int icent=1;
      // for ( int icent = 1 ; icent<=nCentBinPa  ; icent++) {
      cDphi->cd(j-1);
      int iSpecies = kPADATA;
      int iglb = icent + iSpecies*50.;
      handsomeTH1(meanDphi[iSpecies][j]);
      meanDphi[iSpecies][j]->SetXTitle("#Delta#phi_{J,#gamma}");
      meanDphi[iSpecies][j]->Scale(1./meanDphi[iSpecies][j]->Integral("width"));
      meanDphi[iSpecies][j]->SetAxisRange(0.01,30,"Y");
      //    meanDphi[iSpecies][j]->SetMarkerStyle(24);
      //    handsomeTH1(meanDphi[iSpecies][j],icent+3*(j-1));
      meanDphi[iSpecies][j]->Draw();

      gPad->SetLogy();
      float dx1=0;    
 //     ((icent==1)||(icent==4))? dx1=0.15 : dx1=0 ;

      /*   if ( icent == nCentBinPa )
           drawText(Form("E_{T}^{HF|#eta|>4} > %dGeV", (int)centBinPa[icent-1]), 0.12+dx1+0.25,0.889118,1,15);//yeonju 130805
           else
           drawText(Form("%dGeV < E_{T}^{HF|#eta|>4} < %dGeV", (int)centBinPa[icent-1], (int)centBinPa[icent]), 0.12+dx1,0.889118,1,15);
           */   if ( j == nPt ) 
      drawText(Form("p_{T}^{#gamma} < %dGeV, ", (int)PtBinPa[j-1]), 0.12+dx1+0.25,0.79,1,15);//yeonju 130823
      else
          drawText(Form("%dGeV < p_{T}^{#gamma} < %dGeV, ", (int)PtBinPa[j-1], (int)PtBinPa[j]), 0.12+dx1,0.79,1,15);//yeonju 130823

      TLegend *l1 = new TLegend(0.6365615,0.6445304,0.9577623,0.846736,NULL,"brNDC");
      easyLeg(l1,"p+Pb 5.02TeV");
          if ( icent==1 && j==1)   l1->Draw();
     // }
  }
  cDphi -> SaveAs("pPbData_Dphi_distribution_by_pt_dep.pdf");
  
  TCanvas* c2 = new TCanvas("c2","xjg_rjg_vs_pt",800,400);
  c2->Divide(2,1);
  
  TH1D* hr[15];
  TH1D* hx[15];

  for(int j=1; j<=nFile ; j++){
      c2->cd(2);
      hr[j] = new TH1D(Form("hr%d",j),";E_{T}^{HF|#eta|>4} (GeV);r_{J,#gamma}",200,0,100);
      handsomeTH1(hr[j],j+1);
      hr[j]->SetAxisRange(0.01,1.1,"Y");
      //  hr->SetNdivisions(5);
      if (j ==1 ) {hr[j]->Draw();}
      else  { hr[j]->Draw("same");}
      
      if (j < 4) { 
      handsomeTGraph(gr[kPADATA][j],j+1);
          gr[kPADATA][j]->SetMarkerStyle(20);
          gr[kPADATA][j]->SetMarkerSize(1);
          gr[kPADATA][j]->Draw("same p");
      } else {  
      handsomeTGraph(gr[kPADATA][j],j-2);
          gr[kPADATA][j]->SetMarkerStyle(24);
          gr[kPADATA][j]->SetMarkerSize(1.5);
          gr[kPADATA][j]->Draw("same p");
      }

      jumSun(0,1,100,1);

      c2->cd(1);
      hx[j] = (TH1D*)hr[j]->Clone(Form("hx%d",j));
      handsomeTH1(hx[j],j+1);
      hx[j]->SetYTitle("<x_{J,#gamma}>");
      hx[j]->SetAxisRange(0.6,1.05,"Y");
      //  hx->SetNdivisions(5);
      if (j==1) {hx[j]->Draw();}
      else {hx[j]->Draw("same");}
      if (j < 4) { 
      handsomeTGraph(gx[kPADATA][j],j+1);
          gx[kPADATA][j]->SetMarkerStyle(20);
          gx[kPADATA][j]->SetMarkerSize(1);
          gx[kPADATA][j]->Draw("same p");
      } else {  
      handsomeTGraph(gx[kPADATA][j],j-2);
          gx[kPADATA][j]->SetMarkerStyle(24);
          gx[kPADATA][j]->SetMarkerSize(0.2);
          gx[kPADATA][j]->Draw("same p");
      }
      jumSun(0,1,100,1);
  
      TLegend *l1 = new TLegend(0.5226071,0.6300415,0.9597724,0.8332584,NULL,"brNDC");
      easyLeg(l1,"5.02TeV");
      l1->AddEntry(gr[kPADATA][j],"pPb ","p");
      l1->Draw();  }
  

      c2 -> SaveAs("pPbMC_and_Data_comparison_xjg_rjg.gif");
  /* 
  for(int j=1; j<=nPt ; j++){
      c2->cd(2*j);
      hr[j] = new TH1D(Form("hr%d",j),";E_{T}^{HF|#eta|>4} (GeV);r_{J,#gamma}",200,0,100);
      handsomeTH1(hr[j],1);
      hr[j]->SetAxisRange(0.01,1.1,"Y");
      //  hr->SetNdivisions(5);
      hr[j]->Draw();
      handsomeTGraph(gr[kPADATA][j],1);
      gr[kPADATA][j]->SetMarkerStyle(20+j);
      gr[kPADATA][j]->Draw("same p");
      jumSun(0,1,100,1);

      c2->cd(2*j-1);
      hx[j] = (TH1D*)hr[j]->Clone(Form("hx%d",j));
      handsomeTH1(hx[j],1);
      hx[j]->SetYTitle("<x_{J,#gamma}>");
      hx[j]->SetAxisRange(0.6,1.05,"Y");
      //  hx->SetNdivisions(5);
      hx[j]->Draw();
      handsomeTGraph(gx[kPADATA][j],1);
      gx[kPADATA][j]->SetMarkerStyle(20+j);
      gx[kPADATA][j]->Draw("same p");
      jumSun(0,1,100,1);

      TLegend *l1 = new TLegend(0.5226071,0.6300415,0.9597724,0.8332584,NULL,"brNDC");
      easyLeg(l1,"5.02TeV");
      l1->AddEntry(gr[kPADATA][j],"pPb ","p");
      l1->Draw();

      c2 -> SaveAs("x_Jgamma.gif");
  }*/
}
Exemple #9
0
void zeeAna() {
  
  const int tempNbin = 2;
  int tempBin[tempNbin+1] = {0,12,40};
  
  TH1D* hsee[5];
  TH1D* hseeMC[5];
  TH1D* hseePho[5];
  
  TCanvas* c1 = new TCanvas("c1","",1000,500);
  c1->Divide(2,1);
  c1->Draw();
  for ( int icent = 1 ; icent<= tempNbin ; icent++) {
    c1->cd(icent);
    int lowCent = tempBin[icent-1];
    int highCent = tempBin[icent]-1;
    TCut centCut      = Form("yEvt.hiBin >= %d && yEvt.hiBin<= %d",lowCent,highCent);
    TCut firstCut = "pt1>30 && hoe1<0.1 && (cc4+cr4)<5";
    TCut secondCut = "pt2>30 && hoe2<0.2 && see2<0.011 && (cc4+cr4)<5";
    TCut generalCut  = centCut && firstCut && secondCut;
    hsee[icent]   = new TH1D(Form("hsee_icent%d",icent),";#sigma_{#eta#eta};event fraction",25,0,0.025);
    hseeMC[icent] = new TH1D(Form("hseeMC_icent%d",icent),";#sigma_{#eta#eta};event fraction",25,0,0.025);
    hsee[icent]->Sumw2();
    zeeAnaDiff(hsee[icent], generalCut, hseeMC[icent]);
    drawText(Form("%.0f%% - %.0f%%", float((float)lowCent*2.5), float((float)(highCent+1)*2.5)),0.6880963,0.8369118);
  }
  
  c1->SaveAs("invMassOfZ.pdf");

  TCanvas* c1a = new TCanvas("c1a","",1000,500);
  for ( int icent = 1 ; icent<= tempNbin ; icent++) {
    int lowCent = tempBin[icent-1];
    int highCent = tempBin[icent]-1;
    TCut centCut      = Form("yEvt.hiBin >= %d && yEvt.hiBin<= %d",lowCent,highCent);
    TCut generalCut  = "hadronicOverEm<0.1 && corrPt>40 && abs(eta)<1.44 && isGenMatched";
    hseePho[icent] =  new TH1D(Form("hseePho_icent%d",icent),";#sigma_{#eta#eta};event fraction",25,0,0.025);
    hseePho[icent]->Sumw2();
    getseePhoMC(hseePho[icent],generalCut && centCut);
  }
 
  
  TCanvas* c2 = new TCanvas("c2","",1000,500);
  c2->Divide(2,1);
  c2->Draw();
  for ( int icent = 1 ;icent<=tempNbin ; icent++) {
    int lowCent = tempBin[icent-1];
    int highCent = tempBin[icent]-1;
    c2->cd(icent);
    handsomeTH1(hsee[icent],2);
    handsomeTH1(hseeMC[icent],1);
    handsomeTH1(hseePho[icent],4);
    scaleInt(hsee[icent]);
    scaleInt(hseeMC[icent]);
    scaleInt(hseePho[icent]);
    hsee[icent]->SetAxisRange(0,0.8,"Y");
    hsee[icent]->Draw();
    hseeMC[icent]->Draw("same");
    hseePho[icent]->Draw("same hist");
    TLegend* leg1 =  new TLegend(0.5580645,0.5381356,0.8923387,0.7648305,NULL,"brNDC");
    easyLeg(leg1,"#sigma_{#eta#eta}");
    leg1->AddEntry(hsee[icent],"DATA electron","pl");
    leg1->AddEntry(hseeMC[icent],"MC electron","pl");
    leg1->AddEntry(hseePho[icent],"MC photon","l");
    leg1->Draw();
    drawText(Form("%.0f%% - %.0f%%", float((float)lowCent*2.5), float((float)(highCent+1)*2.5)),0.5880963,0.8369118);
    cout << "shift = " << getMean(hsee[icent],5,12) - getMean(hseeMC[icent],5,12) << endl;

  }

  c2->SaveAs("showerShapeComparison.pdf");
  
}