Example #1
0
void postprocess(TCanvas* c2, const char* name, Int_t rWrite, Int_t rPerformance) {

        if (rPerformance){

                TLatex *alice = new TLatex(0.65,0.47,"Performance");
                alice->SetNDC();
                alice->SetTextColor(myDarkRed);
                alice->SetTextFont(42);
                alice->SetTextSize(0.05);
                alice->SetLineWidth(2);
                alice->Draw();

                TLatex *alice2 = new TLatex(0.62,0.41,"LHC10h - Pass2");
                alice2->SetNDC();
                alice2->SetTextColor(myDarkRed);
                alice->SetTextFont(42);
                alice2->SetTextSize(0.05);
                alice2->SetLineWidth(2);
                alice2->Draw();

                TText *date = new TText(0.68,0.35,cStamp2);
                date->SetNDC();
                date->SetTextFont(42);
                date->SetTextSize(0.04);
                date->Draw();

                //Acquire canvas proportions
                Double_t AliLogo_LowX = 0.67;
                Double_t AliLogo_LowY = 0.53;
                Double_t AliLogo_Height = 0.22;
                //ALICE logo is a png file that is 821x798 pixels->should be wider than a square
                Double_t AliLogo_Width  = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw();

                TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height);
                //    myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment !
                myPadSetUp(myPadLogo,0,0,0,0);
                //myPadLogo->SetFixedAspectRatio(1);
                myPadLogo->Draw();
                myPadLogo->cd();
                TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
                myAliceLogo->Draw();
        }

        if (rWrite == 1)
                c2->SaveAs(Form("%s.png",name));

        if (rWrite == 2)
                c2->SaveAs(Form("%s.eps",name));

}
Example #2
0
drawMultiplicity(const char* infilename, const char* system, Int_t rWrite, Int_t rPerformance) {

        prepareAll();

        TFile *f = new TFile(infilename, "read");

        int minMultBin = 0; // 0, 2, 3
        int maxMultBin = 6; // 2, 6, 8

        double EvMultall = 0;

        for (int i = minMultBin; i < maxMultBin; i++) {

                if (i == minMultBin)
                        TH1D* hEvMult =(TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i));
                else
                        hEvMult->Add((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)));

                EvMultall += ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries();
                cout << "MultBin " << i << " " << ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries() << endl;
                //delete hEvMult;
        }

        cout << "Number of events (all bins): " << EvMultall << endl;

        TCanvas *c2 = new TCanvas("mult", "Event Multiplicity");
        c2->SetGridx();
        c2->SetGridy();
        c2->SetFillColor(10);
        c2->SetLogy();

        hEvMult->GetXaxis()->SetTitle("multiplicity");
        hEvMult->GetYaxis()->SetTitle("number of events");
        hEvMult->GetXaxis()->SetRangeUser(0,4000);
        hEvMult->Draw("");

        if (rPerformance){
                TLatex *alice = new TLatex(0.35,0.27,"Performance");
                alice->SetNDC();
                alice->SetTextColor(myDarkRed);
                alice->SetTextFont(42);
                alice->SetTextSize(0.05);
                alice->SetLineWidth(2);
                alice->Draw();

                TLatex *alice2 = new TLatex(0.32,0.21,"LHC10h - Pass2");
                alice2->SetNDC();
                alice2->SetTextColor(myDarkRed);
                alice->SetTextFont(42);
                alice2->SetTextSize(0.05);
                alice2->SetLineWidth(2);
                alice2->Draw();

                TText *date = new TText(0.38,0.15,cStamp2);
                date->SetNDC();
                date->SetTextFont(42);
                date->SetTextSize(0.04);
                date->Draw();

                //Acquire canvas proportions
                Double_t AliLogo_LowX = 0.37;
                Double_t AliLogo_LowY = 0.33;
                Double_t AliLogo_Height = 0.22;
                //ALICE logo is a png file that is 821x798 pixels->should be wider than a square
                Double_t AliLogo_Width  = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw();

                TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height);
                //    myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment !
                myPadSetUp(myPadLogo,0,0,0,0);
                //myPadLogo->SetFixedAspectRatio(1);
                myPadLogo->Draw();
                myPadLogo->cd();
                TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
                myAliceLogo->Draw();
        }

        if (rWrite == 1)
                c2->SaveAs(Form("multiplicity%s.png",system));

        if (rWrite == 2)
                c2->SaveAs(Form("multiplicity%s.eps",system));

}
Example #3
0
void FastVsSlowSimRes() {

  Int_t plusTPC =0;

  gROOT->LoadMacro("~/fig_template.C"); // figure style
  myOptions(0);
  gROOT->ForceStyle();

  TCanvas *myCan = new TCanvas("myCan");
  myCan->Draw();
  myCan->cd();
  
  TPad *myPad = new TPad("myPad", "The pad",0,0,1,1);
  myPadSetUp(myPad,0.15,0.04,0.04,0.15);
  myPad->Draw();   myPad->cd();
  myPad->SetGridx();   myPad->SetGridy();  myPad->SetLogx(); 

  //  TLegend *leg = new TLegend(0.7,160,20,290,"","brCDN"); 
  TLegend *leg = new TLegend(0.44,160,1.7,290,"","brCDN"); 
 
  leg->SetFillColor(0);

  
  // Current ITS +++++++++++++++++++++++++++++++++++++++++

  DetectorK its("ALICE","ITS");
  its.MakeAliceCurrent(0,plusTPC);
  its.SetMaxRadiusOfSlowDetectors(0.1);
  its.SolveViaBilloir(0);
  Int_t color=1; Int_t linewidth=2;

  TGraph *c[6];
  TGraph *d[6];

  Int_t pi =0;
  d[pi] = its.GetGraphPointingResolution(1,color,linewidth);
  d[pi]->SetLineStyle(2);
  //  d[pi]->GetYaxis()->SetTitle("Pointing resolution #sigma [#mum]");
  //  d[pi]->SetTitle("Pointing resolution .vs. Pt");
  //  d[pi]->Draw("AC");
  
  c[pi] = its.GetGraphPointingResolution(0,color,linewidth);
  c[pi]->SetMinimum(-1);
  c[pi]->Draw("AC");

  leg->AddEntry(c[pi],"FastTool:  Current ITS","l");
  //  leg->AddEntry(d[pi],"in z  - Current ITS","l");

 

 
  // Current ITS +++++++++++++++++++++++++++++++++++++++++

  Int_t color=3; Int_t linewidth=2;
  Int_t pi =2;

  DetectorK its("ALICE","ITS");
  its.MakeAliceCurrent(0,plusTPC);
  
  its.SetRadius("bpipe",2.0);
  its.AddLayer("spd0", 2.2,1,1,1);  

  its.SetRadius("spd0",2.2); its.SetRadiationLength("spd0",X0); its.SetResolution("spd0",resRPhi,resZ);
  its.SetRadius("spd1",4.8);   its.SetRadiationLength("spd1",X0); its.SetResolution("spd1",resRPhi,resZ);
  its.SetRadius("spd2",9.1);   its.SetRadiationLength("spd2",X0); its.SetResolution("spd2",resRPhi,resZ);

  its.SetMaxRadiusOfSlowDetectors(0.1);
  its.SolveViaBilloir(0);

  d[pi] = its.GetGraphPointingResolution(1,color,linewidth);
  d[pi]->SetLineStyle(2);
  //  d[pi]->Draw("C");

  c[pi] = its.GetGraphPointingResolution(0,color,linewidth);
  c[pi]->Draw("C");

  leg->AddEntry(c[pi],"FastTool: \"New SPDs\"","l");
  //  leg->AddEntry(d[pi],"in z  - \"New SPDs\"","l");



  // ALL NEW +++++++++++++++++++++++++++++++++++++++++++

  color=2; Int_t linewidth=2;
  Int_t pi =1; 


  // for a 0.8,0.2 weight configuration
  
  DetectorK *itsU = new DetectorK((char*)"ALICE",(char*)"ITS");
  
  itsU->AddLayer((char*)"bpipe", 2.0,0.0022); // beam pipe
  itsU->AddLayer((char*)"vertex",  0,     0); // dummy vertex for matrix calculation
  
  itsU->AddLayer("ddd1",  2.2 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd2",  3.8 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd3",  6.8 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd4", 12.4 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd5", 23.5 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd6", 39.6 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd7", 43.0 ,  X0, resRPhi, resZ); 
 
  if(plusTPC) itsU->AddTPC(0.1,0.1);
  itsU->SetMaxRadiusOfSlowDetectors(0.1);
  itsU->SolveViaBilloir(0);
  itsU->PrintLayout();

  
  d[pi] = itsU->GetGraphPointingResolution(1,color,linewidth);
  d[pi]->SetLineStyle(2);
  //  d[pi]->Draw("C");

  c[pi] = itsU->GetGraphPointingResolution(0,color,linewidth);
  c[pi]->SetMaximum(150);
  c[pi]->Draw("C");

  leg->AddEntry(c[pi],"FastTool: \"All New\" ","l");
  //  leg->AddEntry(d[pi],"in z  - \"All New\" ","l");


  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 
  TFile f1("root/FastVsSlow_CurrentITS-PbPb-fran.root");
  TFile f2("root/FastVsSlow_NewSPDs-PbPb-fran.root");
  TFile f3("root/FastVsSlow_AllNew-PbPb-fran.root");
  TGraphErrors *dca1 = (TGraphErrors*)f1.Get("dca");
  TGraphErrors *dca2 = (TGraphErrors*)f2.Get("dca");
  TGraphErrors *dca3 = (TGraphErrors*)f3.Get("dca");
  
  dca1->SetMarkerStyle(21); dca1->SetMarkerColor(1);
  dca2->SetMarkerStyle(21); dca2->SetMarkerColor(3);
  dca3->SetMarkerStyle(21); dca3->SetMarkerColor(2);

  leg->AddEntry(dca1,"FullMC: Current ITS","PE");
  leg->AddEntry(dca2,"FullMC: \"New SPDs\"","PE");
  leg->AddEntry(dca3,"FullMC: \"All New\" ","PE");

  dca1->Draw("APE"); dca1->SetMinimum(-1); dca1->SetMaximum(300);
  dca2->Draw("PE");
  dca3->Draw("PE");
  c[0]->Draw("C");
  c[1]->Draw("C");
  c[2]->Draw("C");

  leg->Draw();

  myCan->SaveAs(Form("FastVsSlowSim-Res-%d.pdf",plusTPC));
  myCan->SaveAs(Form("FastVsSlowSim-Res-%d.eps",plusTPC));


}
Example #4
0
void FastVsSlowSimEff(Int_t id=0,Int_t PbPb=0) {

  Int_t mult = 2400; // 2800  // deducted from "Frackable"
  if (PbPb) mult=2800;


  Int_t plusTPC =0;

  gROOT->LoadMacro("~/fig_template.C"); // figure style
  myOptions(0);
  gROOT->ForceStyle();

  TCanvas *myCan = new TCanvas("myCan");
  myCan->Draw();
  myCan->cd();
  
  TPad *myPad = new TPad("myPad", "The pad",0,0,1,1);
  myPadSetUp(myPad,0.15,0.04,0.04,0.15);
  myPad->Draw();   myPad->cd();
  myPad->SetGridx();   myPad->SetGridy();//  myPad->SetLogx();


  TLegend *leg = new TLegend(0.9,30,1.7,70,"","brCDN"); 
  leg->SetFillColor(0);

  TGraph *c[6];
  if (id!=2) {
  
  
    // Current ITS +++++++++++++++++++++++++++++++++++++++++
    Int_t color=1; Int_t linewidth=2;

    Int_t pi =0;
 
    DetectorK its("ALICE","ITS");
    its.MakeAliceCurrent(0,plusTPC);
    its.SetMaxRadiusOfSlowDetectors(0.01);
    its.SetAtLeastCorr(atLeastcorr);
    if (PbPb) its.SetdNdEtaCent(mult);
    its.SolveViaBilloir(0);
    Int_t color=1; Int_t linewidth=2;

    if (id==0)
      c[pi] = its.GetGraphRecoEfficiency(0,color,linewidth);
    else if (id==1)
      c[pi] = its.GetGraphRecoPurity(0,color,linewidth);
    else 
      c[pi] = its.GetGraphRecoFakes(0,color,linewidth);

    c[pi]->Draw("AC");

    leg->AddEntry(c[pi],"FastTool: Current ITS","l");


    // NEW SPD  +++++++++++++++++++++++++++++++++++++++++

    Int_t color=3; Int_t linewidth=2;
    Int_t pi =2;

    DetectorK its("ALICE","ITS");
    its.MakeAliceCurrent(0,plusTPC);
    its.SetAtLeastCorr(atLeastcorr);
    if (PbPb) its.SetdNdEtaCent(mult);
    its.SetRadius("bpipe",2.0);
    its.AddLayer("spd0", 2.2,1,1,1);  

    its.SetRadius("spd0",2.2); its.SetRadiationLength("spd0",X0); its.SetResolution("spd0",resRPhi,resZ);
    its.SetRadius("spd1",4.8);   its.SetRadiationLength("spd1",X0); its.SetResolution("spd1",resRPhi,resZ);
    its.SetRadius("spd2",9.1);   its.SetRadiationLength("spd2",X0); its.SetResolution("spd2",resRPhi,resZ);

    its.SetMaxRadiusOfSlowDetectors(0.1);
    its.SolveViaBilloir(0);

    if (id==0)
      c[pi] = its.GetGraphRecoEfficiency(0,color,linewidth);
    else if (id==1)
      c[pi] = its.GetGraphRecoPurity(0,color,linewidth);
    else 
      c[pi] = its.GetGraphRecoFakes(0,color,linewidth);
   
    c[pi]->Draw("C");

    leg->AddEntry(c[pi],"FastTool: \"New SPDs\"","l");


    // ALL NEW +++++++++++++++++++++++++++++++++++++++++++

    color=4; Int_t linewidth=2;
    Int_t pi =1; 


    // for a 0.8,0.2 weight configuration
  
    DetectorK *itsU = new DetectorK((char*)"ALICE",(char*)"ITS");
    itsU->SetAtLeastCorr(atLeastcorr);
    itsU->AddLayer((char*)"bpipe", 2.0,0.0022); // beam pipe
    itsU->AddLayer((char*)"vertex",  0,     0); // dummy vertex for matrix calculation
  
    itsU->AddLayer("ddd1",  2.2 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd2",  3.8 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd3",  6.8 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd4", 12.4 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd5", 23.5 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd6", 39.6 ,  X0, resRPhi, resZ); 
    //    itsU->AddLayer("ddd6", 42.6 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd7", 43.0 ,  X0, resRPhi, resZ); 
    //    itsU->AddLayer("ddd8", 43.4 ,  X0, resRPhi, resZ); 


    if (PbPb) itsU->SetdNdEtaCent(mult);
    if(plusTPC) itsU->AddTPC(0.1,0.1);
    itsU->SetMaxRadiusOfSlowDetectors(0.1);
    itsU->SolveViaBilloir(0);
    itsU->PrintLayout();

    if (id==0)
      c[pi] = itsU->GetGraphRecoEfficiency(0,color,linewidth);
    else if (id==1)
      c[pi] = itsU->GetGraphRecoPurity(0,color,linewidth);
    else 
      c[pi] = itsU->GetGraphRecoFakes(0,color,linewidth);
    c[pi]->Draw("C");

    leg->AddEntry(c[pi],"FastTool: \"All New\" ","l");

    // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 // ALL NEW - double outer layer +++++++++++++++++++++++++++++++++++++

    color=2; Int_t linewidth=2;
    Int_t pi =3; 


    // for a 0.8,0.2 weight configuration
  
    DetectorK *itsU = new DetectorK((char*)"ALICE",(char*)"ITS");
    itsU->SetAtLeastCorr(atLeastcorr);
    itsU->AddLayer((char*)"bpipe", 2.0,0.0022); // beam pipe
    itsU->AddLayer((char*)"vertex",  0,     0); // dummy vertex for matrix calculation
  
    itsU->AddLayer("ddd1",  2.2 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd2",  3.8 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd3",  6.8 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd4", 12.4 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd5", 23.5 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd6", 39.6 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd8", 40.0 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd7", 43.0 ,  X0, resRPhi, resZ); 
    itsU->AddLayer("ddd9", 43.4 ,  X0, resRPhi, resZ); 


    if (PbPb) itsU->SetdNdEtaCent(mult);
    if(plusTPC) itsU->AddTPC(0.1,0.1);
    itsU->SetMaxRadiusOfSlowDetectors(0.1);
    itsU->SolveViaBilloir(0);
    itsU->PrintLayout();

    if (id==0)
      c[pi] = itsU->GetGraphRecoEfficiency(0,color,linewidth);
    else if (id==1)
      c[pi] = itsU->GetGraphRecoPurity(0,color,linewidth);
    else 
      c[pi] = itsU->GetGraphRecoFakes(0,color,linewidth);
    c[pi]->Draw("C");

    leg->AddEntry(c[pi],"FastTool: \"All New\" (2x double layer)","l");

    // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


  }

  char h[100];
  if (PbPb==0) 
    sprintf(h,"-fran");
  else 
    sprintf(h,"-Anna");

  TFile f1(Form("root/FastVsSlow_CurrentITS-PbPb%s.root",h));
  TFile f2(Form("root/FastVsSlow_NewSPDs-PbPb%s.root",h));
  TFile f3(Form("root/FastVsSlow_AllNew-PbPb%s.root",h));
  TFile f4(Form("root/FastVsSlow_AllNew-9-PbPb%s.root",h));

  //  TFile f1(Form("root/FastVsSlow_CurrentITS%s-fran.root",h));
  //  TFile f2(Form("root/FastVsSlow_NewSPDs%s-fran.root",h));
  //  TFile f3(Form("root/FastVsSlow_AllNew%s-fran.root",h));

  TH1F *eff1 = 0;
  TH1F *eff2 = 0;
  TH1F *eff3 = 0;
  TH1F *eff4 = 0;
  if (id==0) {
    eff1 = (TH1F*)f1.Get("efficiency");
    eff2 = (TH1F*)f2.Get("efficiency");
    eff3 = (TH1F*)f3.Get("efficiency");
    eff4 = (TH1F*)f4.Get("efficiency");
    eff1->GetYaxis()->SetTitle("efficiency (%)");
  } else if (id==1) {
    eff1 = (TH1F*)f1.Get("purity");
    eff2 = (TH1F*)f2.Get("purity");
    eff3 = (TH1F*)f3.Get("purity");
    eff4 = (TH1F*)f4.Get("purity");
      eff1->GetYaxis()->SetTitle("purity (%)");
  } else if (id==2) {
    eff1 = (TH1F*)f1.Get("annaEff");
    eff2 = (TH1F*)f2.Get("annaEff");
    eff3 = (TH1F*)f3.Get("annaEff");
    eff4 = (TH1F*)f4.Get("annaEff");
    eff1->GetYaxis()->SetTitle("Overall efficiency (%)");
  } else if (id==3) {
    eff1 = (TH1F*)f1.Get("fake");
    eff2 = (TH1F*)f2.Get("fake");
    eff3 = (TH1F*)f3.Get("fake");
    eff4 = (TH1F*)f4.Get("fake");
    eff1->GetYaxis()->SetTitle("Fake ratio (%)");
  }

  eff1->SetMarkerStyle(21); eff1->SetMarkerColor(1);
  eff2->SetMarkerStyle(21); eff2->SetMarkerColor(3);
  eff3->SetMarkerStyle(21); eff3->SetMarkerColor(4);
  eff4->SetMarkerStyle(21); eff4->SetMarkerColor(2);

  leg->AddEntry(eff1,"FullMC: Current ITS","PE");
  leg->AddEntry(eff2,"FullMC: \"New SPDs\"","PE");
  leg->AddEntry(eff3,"FullMC: \"All New\" ","PE");
  leg->AddEntry(eff4,"FullMC: \"All New\" (2x double layer)","PE");

  eff1->SetMinimum(0.4); eff1->SetMaximum(100);
  eff1->DrawCopy("E");
  eff2->DrawCopy("sameE");
  eff4->DrawCopy("sameE");
  eff3->DrawCopy("sameE");
  if (id!=2) {
    c[0]->Draw("C");
    c[1]->Draw("C");
    c[2]->Draw("C");
    c[3]->Draw("C");
  }
  eff2->DrawCopy("sameE");
  eff4->DrawCopy("sameE");
  eff3->DrawCopy("sameE");

  
  leg->Draw();
 



  TPaveText *pt = 0;
  if (id!=3) 
   pt = new TPaveText(0.4,0.1,1.76,30);
  else
   pt = new TPaveText(0.4,70,1.76,100);
    
  pt->SetBorderSize(1); // no shadow
  pt->SetTextFont(12);
  TText *t1 = pt->AddText("FastTool settings: "); t1->SetTextFont(32); // bold

  pt->AddText(Form("   Tracked particles: Pions;   Average rapidity: 0.45; dN_{ch}/d#eta = %d ",mult));

  //  pt->AddText("\"New SPDs\": layer radii: r = {2.2,4.8,9.1} cm");
  //  pt->AddText("\"All New\: layer radii: r = {2.2,3.8,6.8,...} cm");
  //  pt->AddText(Form("    New layer prop.: X/X_{0}=%1.1lf%%;  #sigma_{r#phi,z}=%1.0lf#mum",X0*100,resZ*1e4));
  
  TText *t2 = pt->AddText("FullMC settings: "); t2->SetTextFont(32); // bold
  if (PbPb==0) {
    pt->AddText("   Generator: AliGenHIJINGpara (parametrized PbPb event)");
    pt->AddText("   dN_{ch.pr.}/d#eta = 2070");
    pt->AddText("   Track selection: Pions, |#eta|<0.9");
  } else {
    pt->AddText("   Generator: AliGenHijing (modified);  #sqrt{s_{NN}} = 5.5 TeV");
    pt->AddText("   dN_{ch.pr.}/d#eta = 2410; Impactparameter range: b#in(0,5)  #rightarrow central PbPb ");
    pt->AddText("   Track selection: Pions, |#eta|<0.9");
  }
  //  pt->SetLabel("Settings");
  pt->SetTextAlign(12);
  pt->SetFillColor(0);
  pt->Draw();





  if (PbPb==0) {    
    myCan->SaveAs(Form("FastVsSlowSim-Eff-%d.pdf",id));
    myCan->SaveAs(Form("FastVsSlowSim-Eff-%d.eps",id));
  }else{
    myCan->SaveAs(Form("FastVsSlowSim-Eff-PbPb-%d.pdf",id));
    myCan->SaveAs(Form("FastVsSlowSim-Eff-PbPb-%d.eps",id));
  }




}
Example #5
0
void plotcf(const char* sys="PP", const char* kT="kT1", const char* proj="Out", int mult=2, TString dir = "../train_results_central_dcaptdep", int period=11, int numofpsibins = 6) {

  int seppsi = 0; // indicates if draw in separate psi bins
  int psibins = 0; // indicates if one uses psi binning
  int fname = 1; // indicates if the file name is specified
  int plotinpsibins = 0;
  int rb = 1; // flag to rebinning

  if (mult<2)
    const char* centrality = "central";
  else
    const char* centrality = "semicentral";

  if (period == 11) {

    const int Nruns = 64;
    // const int Nruns = 66;

    int runs[Nruns] = {
      167915, 168115, 168460, 169035, 169238, 169859, 170228  , 167920 // , 168310
      , 168464, 169091, 169411, 169923, 170230, 167985, 168311, 169094, 169415, 170027, 170268, 167987, 168322, 168511, 169138, 169417, 170081, 170269, 167988, 168325, 168512, 169144, 169835, 170155, 170270, 168069,  168341, 168514, 169145, 169837, 170159, 170306// , 168076
      , 168342, 168777,  169148,      169838, 170163, 170308, 168105, 168361, 168826, 169156, 169846, 170193, 170309, 168107 // ,168362
      , 168988,       169160,      169855, 170203, 168108 , 168458,  168992,      169167, 169858, 170204
    };


    // const int Nruns = 62;
    // int runs[Nruns] = {
    //   167915, 168115, 168460, 169035, 169238, 169859, 170228  ,  // 167920 ,
    //   168310, 168464, 169091, 169411, 169923, 170230, 167985, 168311, 169094, 169415, 170027, 170268, 167987, 168322, 168511, 169138, 169417, 170081, 170269, 167988, 168325, 168512, 169144, 169835, 170155, 170270, 168069, // 168341,
    //   168514, 169145, 169837, 170159, 170306, 168076, 168342, 168777, // 169148,
    //   169838, 170163, 170308, 168105, 168361, 168826, 169156, 169846, 170193, 170309, 168107, 168362, // 168988,
    //   // 169160,
    //   169855, 170203, 168108 , 168458,  168992,
    //   169167, 169858, 170204
    // };

  }
  else if (period == 10) {
    const int Nruns = 89;
    int runs[Nruns] = {
      139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137544, 137541, 137539, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137230, 137162, 137161};
  }


  TFile* ifile_[Nruns+1];

  if (plotinpsibins) {
    for (int jf = 0 ; jf < Nruns; ++jf ) {
      ifile_[jf] = new TFile(Form("%s/%d.mergedbinsdir.root",dir.Data(),runs[jf]), "read");
    }
  }
  if (fname)
    ifile_[Nruns] = new TFile(Form("%s",dir.Data()), "read");
  else
    ifile_[Nruns] = new TFile(Form("%s/allrunsmergedbins.root",dir.Data()), "read");


  TH1D* numpp[13][3][Nruns+1];
  TH1D* denpp[13][3][Nruns+1];

  TH1D* numpapoutp[13][3];
  TH1D* numpapoutn[13][3];
  TH1D* numpaplongp[13][3];
  TH1D* numpaplongn[13][3];
  TH1D* numpapsidep[13][3];
  TH1D* numpapsiden[13][3];

  TH1D* denpapoutp[13][3];
  TH1D* denpapoutn[13][3];
  TH1D* denpaplongp[13][3];
  TH1D* denpaplongn[13][3];
  TH1D* denpapsidep[13][3];
  TH1D* denpapsiden[13][3];

  TH1D* numsum;
  TH1D* densum;

	TCanvas *myCan = new TCanvas("asd","asd");
	myCan->Draw();
	myCan->cd();

	TPad *myPad = new TPad("myPad", "The pad",0,0,1,1);
	myPadSetUp(myPad,0.15,0.04,0.04,0.15);
	myPad->Draw();
	myPad->cd();

  TGraph* grnument[13];
  TH2D* hnument = new TH2D("hipsiif","hipsiif",numofpsibins,-0.5,numofpsibins,Nruns,-0.5,Nruns);

  TFile* grofile = new TFile("grofile.root","recreate");

  if (plotinpsibins) {

// _________________________________________________
// // Psi binning.....
// _________________________________________________

// each numerator and denominator from different run
    for (int iPsi = 0; iPsi < numofpsibins; ++iPsi) {

      grnument[iPsi] = new TGraph();

      for (int iif = 0; iif < Nruns; ++iif ) {


        // cout << Form("NumcqinvPPtpcM3Psi%d%s",iPsi,kT) << endl;
        // cout << Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT) << endl;
        // cout << "iPsi = " << iPsi << endl;
        // // cout << "ikT = " << ikT << endl;
        // cout << "iif = " << iif << endl << endl;

        bool exi = false;

        if (iPsi == 0) {

          if (strcmp(sys,"PAP") != 0) {


            if ( ifile_[iif]->GetListOfKeys()->Contains(Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT)) ) {
              exi = true;

              numsum = (TH1D*)ifile_[iif]->Get(Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT));
              densum = (TH1D*)ifile_[iif]->Get(Form("Dencqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT));

              grnument[iPsi]->SetPoint(grnument[iPsi]->GetN(), iif, numsum->GetEntries());
              hnument->SetBinContent(iPsi+1, iif, numsum->GetEntries());

              if (densum->GetEntries()==0) {
                cout << "iPsi = " << iPsi << endl;
                cout << "iif = " << iif << endl << endl;
              }
            }
          }
          else {
            exi = true;
            numsum = (TH1D*)ifile_[iif]->Get(Form("Num%sPckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            densum = (TH1D*)ifile_[iif]->Get(Form("Den%sPckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            numsumN = (TH1D*)ifile_[iif]->Get(Form("Num%sNckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            densumN = (TH1D*)ifile_[iif]->Get(Form("Den%sNckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));

            grnument[iPsi]->SetPoint(grnument[iPsi]->GetN(), iif, numsum->GetEntries());
            hnument->SetBinContent(iPsi+1, iif, numsum->GetEntries());

            // numsum->SetBit(TH1::kIsAverage);
            // densum->SetBit(TH1::kIsAverage);
            // numsumN->SetBit(TH1::kIsAverage);
            // densumN->SetBit(TH1::kIsAverage);

          }
          if (exi)
            if (!seppsi) {
              densum->Scale(numsum->GetEntries()/densum->GetEntries());
            }
          if (strcmp(sys,"PAP") == 0) {
            densumN->Scale(numsumN->GetEntries()/densumN->GetEntries());
          }
        }
        else {
          if (strcmp(sys,"PAP") != 0) {
            if ( ifile_[iif]->GetListOfKeys()->Contains(Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT)) ) {
              exi = true;
              numpp[iPsi][2][iif] = (TH1D*)ifile_[iif]->Get(Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT));
              denpp[iPsi][2][iif] = (TH1D*)ifile_[iif]->Get(Form("Dencqinv%stpcM%dPsi%d%s",sys,mult,iPsi,kT));

              grnument[iPsi]->SetPoint(grnument[iPsi]->GetN(), iif, numpp[iPsi][2][iif]->GetEntries());
              hnument->SetBinContent(iPsi+1, iif, numpp[iPsi][2][iif]->GetEntries());

              // cout << iPsi << endl;
              // cout << numpp[iPsi][2][iif]->GetEntries() << endl;
              // // cout << denpp[iPsi][2][iif]->GetEntries() << endl;
              // cout << endl;

              if (denpp[iPsi][2][iif]->GetEntries()==0) {
                cout << denpp[iPsi][2][iif]->GetEntries() << endl;
                cout << "iPsi = " << iPsi << endl;
                cout << "iif = " << iif << endl;
              }
            }
          }
          else {
            exi = true;
            numpp[iPsi][2][iif] = (TH1D*)ifile_[iif]->Get(Form("Num%sPckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            denpp[iPsi][2][iif] = (TH1D*)ifile_[iif]->Get(Form("Den%sPckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            numpp[iPsi][0][iif] = (TH1D*)ifile_[iif]->Get(Form("Num%sNckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            denpp[iPsi][0][iif] = (TH1D*)ifile_[iif]->Get(Form("Den%sNckstarPAPtpcM%dPsi%d%s",proj,mult,iPsi,kT));
            // numpp[iPsi][2][iif]->SetBit(TH1::kIsAverage);
            // denpp[iPsi][2][iif]->SetBit(TH1::kIsAverage);
            // numpp[iPsi][0][iif]->SetBit(TH1::kIsAverage);
            // denpp[iPsi][0][iif]->SetBit(TH1::kIsAverage);
            grnument[iPsi]->SetPoint(grnument[iPsi]->GetN(), iif, numpp[iPsi][2][iif]->GetEntries());
            hnument->SetBinContent(iPsi+1, iif, numpp[iPsi][2][iif]->GetEntries());

          }

          if (exi) {
            numsum->Add(numpp[iPsi][2][iif]);
            if (!seppsi)
              denpp[iPsi][2][iif]->Scale(numpp[iPsi][2][iif]->GetEntries()/denpp[iPsi][2][iif]->GetEntries());
            densum->Add(denpp[iPsi][2][iif]);
            if (strcmp(sys,"PAP") == 0) {
              numsumN->Add(numpp[iPsi][0][iif]);
              denpp[iPsi][0][iif]->Scale(numpp[iPsi][0][iif]->GetEntries()/denpp[iPsi][0][iif]->GetEntries());
              densumN->Add(denpp[iPsi][0][iif]);
            }
          }

        }


        // int rb = 2;
        // if (exi) {
        //     cout << "exi" << endl;
        //     numsum->Rebin(rb);
        // }
        // densum->Rebin(rb);
        // numsum->Divide(densum);
        // numsum->SetMarkerColor(1+iPsi);
        // numsum->SetMarkerStyle(20);
        // numsum->SetMarkerSize(1.0);

        // if (iPsi == 0)
        //     numsum->Draw("p");
        // else
        // numsum->Draw("psame");

      }

      if (seppsi) {
        double norm = numsum->GetEntries()/densum->GetEntries();
        cout << iPsi << " " << norm << endl;
        TH1F *hnew = (TH1F*)densum->Clone("hnew");
        hnew->Scale(norm);

        numsum->SetMarkerColor(iPsi+1);
        numsum->SetMarkerStyle(20);
        numsum->SetMarkerSize(1.0);

        int rb = 1;

        numsum->Rebin(rb);
        // densum->Rebin(rb);
        // numsum->Divide(densum);

        hnew->Rebin(rb);
        numsum->Divide(hnew);
        if (iPsi == 0) {
          numsum->DrawCopy("p");
        }
        else {
          numsum->DrawCopy("psame");
        }

        // hnument[iPsi][iif]->Write();

      }
      // cout <<"write ipsi = " << iPsi << endl;
      // grnument[iPsi]->SetName(Form("gr%d",iPsi));
      // grnument[iPsi]->Write();
    }
    // hnument->Write();

    // numpp[6][2]->Draw("p");


    if (!seppsi) {


      if (strcmp(sys,"PAP")==0) {
        numsum->SetBit(TH1::kIsAverage);
        densum->SetBit(TH1::kIsAverage);
        numsumN->SetBit(TH1::kIsAverage);
        densumN->SetBit(TH1::kIsAverage);

        numsum->Add(numsumN);
        densum->Add(densumN);

        numsum->ResetBit(TH1::kIsAverage);
        densum->ResetBit(TH1::kIsAverage);
      }

      numsum->SetMarkerColor(kBlue);
      numsum->SetMarkerStyle(20);
      numsum->SetMarkerSize(1.0);

      int rb = 1;

      numsum->Rebin(rb);
      densum->Rebin(rb);
      numsum->Divide(densum);



      if (psibins)
        numsum->Draw("p");

      // densum->Draw("psame");
    }
  }

// _________________________________________________
// // bez Psi binningu.....
// _________________________________________________


  if (strcmp(sys,"PAP") != 0) {
    numpp[0][2][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Numcqinv%stpcM%dPsi%d%s",sys,mult,numofpsibins,kT));
    denpp[0][2][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Dencqinv%stpcM%dPsi%d%s",sys,mult,numofpsibins,kT));

    numpp[0][2][Nruns]->SetXTitle("#it{q}_{inv} (GeV/#it{c})");
    numpp[0][2][Nruns]->SetYTitle("C(#it{q}_{inv})");

    // numsum->SetXTitle("#it{q}_{inv} (GeV/#it{c})");
    // numsum->SetYTitle("C(#it{q}_{inv})");

  }
  else {
    numpp[0][2][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Num%sPckstarPAPtpcM%dPsi%d%s",proj,mult,numofpsibins,kT));
    denpp[0][2][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Den%sPckstarPAPtpcM%dPsi%d%s",proj,mult,numofpsibins,kT));

    numpp[0][0][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Num%sNckstarPAPtpcM%dPsi%d%s",proj,mult,numofpsibins,kT));
    denpp[0][0][Nruns] = (TH1D*)ifile_[Nruns]->Get(Form("Den%sNckstarPAPtpcM%dPsi%d%s",proj,mult,numofpsibins,kT));

    numpp[0][2][Nruns]->SetBit(TH1::kIsAverage);
    denpp[0][2][Nruns]->SetBit(TH1::kIsAverage);

    numpp[0][0][Nruns]->SetBit(TH1::kIsAverage);
    denpp[0][0][Nruns]->SetBit(TH1::kIsAverage);

    numpp[0][2][Nruns]->Add(numpp[0][0][Nruns]);
    denpp[0][2][Nruns]->Add(denpp[0][0][Nruns]);

    numpp[0][2][Nruns]->ResetBit(TH1::kIsAverage);
    denpp[0][2][Nruns]->ResetBit(TH1::kIsAverage);

    numpp[0][2][Nruns]->SetXTitle("#it{k*} (GeV/#it{c})");
    numpp[0][2][Nruns]->SetYTitle("C(#it{k*})");

    // numsum->SetXTitle("#it{k*} (GeV/#it{c})");
    // numsum->SetYTitle("C(#it{k*})");

  }

  gStyle->SetOptStat(0);
  numpp[0][2][Nruns]->GetXaxis()->SetTitleSize(0.06);
  numpp[0][2][Nruns]->GetYaxis()->SetTitleSize(0.06);
  numpp[0][2][Nruns]->SetTitle("");

  numpp[0][2][Nruns]->Rebin(rb);
  denpp[0][2][Nruns]->Rebin(rb);

  numpp[0][2][Nruns]->SetMarkerColor(kRed);
  numpp[0][2][Nruns]->SetMarkerStyle(20);
  numpp[0][2][Nruns]->SetMarkerSize(1.0);

  // numsum->GetXaxis()->SetTitleSize(0.06);
  // numsum->GetYaxis()->SetTitleSize(0.06);
  // numsum->SetTitle("");

  // numsum->Rebin(rb);
  // densum->Rebin(rb);


  double norm = denpp[0][2][Nruns]->GetEntries()/numpp[0][2][Nruns]->GetEntries();
  //double norm = calculateNormalizationFactor(numpp[0][2][Nruns],denpp[0][2][Nruns],0.4,0.45 );
  //double norm = calculateNormalizationFactor(numpp[0][2][Nruns],denpp[0][2][Nruns],0.3,0.4 );

  numpp[0][2][Nruns]->Divide(denpp[0][2][Nruns]);
  numpp[0][2][Nruns]->Scale(norm);

  if (strcmp(sys,"PAP") == 0) {
    numpp[0][2][Nruns]->SetMaximum(1.5);
    numpp[0][2][Nruns]->SetMinimum(0.9);
    // numpp[0][2][Nruns]->GetXaxis()->SetRangeUser(0,0.46);
    // numpp[0][2][Nruns]->GetXaxis()->SetRangeUser(0,0.5);

    // numsum->GetXaxis()->SetRangeUser(0,0.6);

    // numsum->SetMaximum(1.058);
    // numsum->SetMinimum(0.912);
    // numsum->SetTitle("");
  }
  else {
    numpp[0][2][Nruns]->SetMaximum(1.5);
    numpp[0][2][Nruns]->SetMinimum(0.9);
    // numsum->SetMaximum(2.2);
    // numsum->SetMinimum(0.5);
    // numpp[0][2][Nruns]->GetXaxis()->SetRangeUser(0,0.26);
    numpp[0][2][Nruns]->GetXaxis()->SetRangeUser(0,0.5);
    // numsum->GetXaxis()->SetRangeUser(0,0.26);
    // numsum->GetXaxis()->SetRangeUser(0,0.3);
  }


// uncomment this to compare
  // if (!psibins)
  numpp[0][2][Nruns]->Draw("p");
  // else
  //   numpp[0][2][Nruns]->Draw("same");






  //numpp[0][2][Nruns]->Write();

  // if (strcmp(sys,"PAP") ==0 ) {
  //   numpp[0][0][Nruns]->Rebin(rb);
  //   denpp[0][0][Nruns]->Rebin(rb);

  //   numpp[0][0][Nruns]->SetMarkerColor(kBlack);
  //   numpp[0][0][Nruns]->SetMarkerStyle(20);
  //   numpp[0][0][Nruns]->SetMarkerSize(1.0);

  //   double norm = denpp[0][0][Nruns]->GetEntries()/numpp[0][0][Nruns]->GetEntries();
  //   numpp[0][0][Nruns]->Divide(denpp[0][0][Nruns]);
  //   numpp[0][0][Nruns]->Scale(norm);
  //   // numpp[0][0][Nruns]->Draw("same");

  //   numsumN->SetMarkerColor(kGreen+2);
  //   numsumN->SetMarkerStyle(20);
  //   numsumN->SetMarkerSize(1.0);

  //   numsumN->Rebin(rb);
  //   densumN->Rebin(rb);
  //   numsumN->Divide(densumN);

  //   // numsumN->Draw("same");
  // }


  // if (psibins) {
  //   TLegend *leg = new TLegend (0.5,0.2,0.7,0.3);
  //   leg->SetFillColor(kWhite);
  //   leg->SetBorderSize(0);
  //   leg->SetTextSize(0.07);
  //   leg->AddEntry(numsum,"w/ #Psi bins","p");
  //   leg->AddEntry(numpp[0][2][Nruns],"w/o EP cut","p");
  //   leg->Draw("same");
  // }


  // TString namef( dir(16,dir.Length()) );
  // cout << namef << endl;

  dir.ReplaceAll("/","_");
  dir.ReplaceAll("..","");
  dir.ReplaceAll(".root","");
  dir.ReplaceAll("_train_results_","");
  dir.ReplaceAll("_central_","");
  dir.ReplaceAll("_semicentral_","");
  dir.ReplaceAll("jun19_","");
  myCan->SaveAs(Form("figs/cf%s%s%s.png",sys,dir.Data(),kT));

  TFile* ofile = new TFile(Form("figs/cf%s%s%s.root",sys,dir.Data(),kT),"recreate");
  numpp[0][2][Nruns]->Write();

  //numsum->Write();


}
Example #6
0
// infilename - root file with relevant histograms
// system - PP,APAP,PP
// status - Pass,Fail
// rWrite - 0-no,1-png,2-eps
// rPerformance - 0-no,1-yes (ALICE logo etc.)
// bin: 0 - all, 1- 0:5, 2- 5:10, etc
void drawDCA(const char* infilename, const char* system, const char* status, Int_t rWrite, Int_t rPerformance, int isMC, Int_t bin, Int_t ptrange)
{

    myOptions(0);

    gROOT->ForceStyle();
    gStyle->SetPalette(1.0);

    TDatime now;
    int iDate = now.GetDate();
    int iYear=iDate/10000;
    int iMonth=(iDate%10000)/100;
    int iDay=iDate%100;
    char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                      "Jul","Aug","Sep","Oct","Nov","Dec"};
    char cStamp1[25],cStamp2[25];
    sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
    sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);

    TFile *f = new TFile(infilename, "read");

    // DCA xy
    TH2D* DCAxy =(TH2D*)f->Get(Form("DCARPtcut%s1%stpcM%d","Pass", system,0));


    if (!bin) {
        int minMultBin = 0;
        int maxMultBin = 6; // 8
    }
    else {
        int minMultBin = bin-1;
        int maxMultBin = bin; // 8
    }

    // int minMultBin = 0;
    // int maxMultBin = 0; // 8

    double EvMultall = 0;

    for(int i = minMultBin; i<maxMultBin; i++) {

        TH2D* DCAxyN = (TH2D*)f->Get(Form("DCARPtcut%s1%stpcM%d",status, system,i));
        DCAxy->Add(DCAxyN);

        cout<<i<<" "<<DCAxyN->GetEntries()<<endl;

        //delete hEvMult;
    }


    if (!isMC) {
        TCanvas *c2 = new TCanvas("DCA xy prim", "DCA xy prim");
        c2->SetGridx();
        c2->SetGridy();
        c2->SetFillColor(10);
        c2->SetRightMargin(1.9);
        c2->SetLogz();

        DCAxy->GetXaxis()->SetTitle("DCA_{XY} (cm)");
        DCAxy->GetXaxis()->SetRangeUser(-5.0,5.0);
        DCAxy->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
        // DCAxy->GetZaxis()->SetLabelSize(0.05);
        DCAxy->Draw("colz");
        postprocess(c2,Form("DCAxy%s",status),rWrite,rPerformance,system);

        // TCanvas *c4 = new TCanvas("DCA xy Projection X", "DCA xy Projection X");
        // c4->SetGridx();
        // c4->SetGridy();
        // c4->SetFillColor(10);
        // c4->SetRightMargin(1.9);
        // c4->SetLogy();

        gStyle->SetOptTitle(1);
        TCanvas *myCan = new TCanvas("myCan",cStamp1,600,400);
        myCan->Draw();
        myCan->cd();

        TPad *myPad = new TPad("myPad", "The pad",0,0,1,1);
        myPadSetUp(myPad,0.15,0.04,0.04,0.15);
        myPad->Draw();
        myPad->SetLogy();

        myPad->cd();

        if (ptrange == 0) {
            TH1D* pripp = (TH1D*)DCAxy->ProjectionX("zxc1",1,100);
            pripp->SetTitle("0.5 < #it{p}_{T} < 3 GeV/#it{c}");
        }
        else if (ptrange == 1) {
            TH1D* pripp = (TH1D*)DCAxy->ProjectionX("zxc1",15,33);
            pripp->SetTitle("0.5 < #it{p}_{T} < 1 GeV/#it{c}");
        }
        else if (ptrange == 2) {
            TH1D* pripp = (TH1D*)DCAxy->ProjectionX("zxc1",33,100);
            pripp->SetTitle("1 < #it{p}_{T} < 3 GeV/#it{c}");
        }

        pripp->SetYTitle("Number of Entries (normalized)");
        pripp->GetXaxis()->SetTitleSize(0.068);
        pripp->GetYaxis()->SetTitleSize(0.068);
        pripp->GetXaxis()->SetLabelSize(0.058);
        pripp->GetYaxis()->SetLabelSize(0.058);

        // pripp->SetLabelSize(0.05);
        // DCAxy->ProjectionX("asd",50,100)->SetYTitle("Number of Entries");
        // DCAxy->ProjectionX("asd",50,100)->SetTitle("1.0 < p_{T} < 2.0 GeV");
        // DCAxy->ProjectionX("asd",0,200)->SetTitle("");
        // DCAxy->ProjectionX("asd",50,100)->GetXaxis()->SetNdivisions(8);
        // DCAxy->ProjectionX("asd",50,100)->GetYaxis()->SetNdivisions(8);
        // DCAxy->ProjectionX("asd",50,100)->GetXaxis()->SetTitleSize(0.05);
        // DCAxy->ProjectionX("asd",50,100)->GetYaxis()->SetTitleSize(0.05);
        // DCAxy->ProjectionX("asd",50,100)->GetXaxis()->SetLabelSize(0.05);
        // DCAxy->ProjectionX("asd",50,100)->GetYaxis()->SetLabelSize(0.05);

        pripp->Draw("");

        //if (!isMC) {
        pripp->Scale(1./pripp->Integral());
        TFile* fout = new TFile("dca.root","update");
        pripp->SetName(Form("dcaxyMC%d",isMC));
        pripp->Write();
        //}

        postprocess(myCan,Form("DCAxy%sProX",status),rWrite,rPerformance,system);

    }
    else if (isMC) {

        TH2D* primp =(TH2D*)f->Get(Form("DCARPtcut%s1%stpcM%dprim","Pass", system,0));
        TH2D* weakp =(TH2D*)f->Get(Form("DCARPtcut%s1%stpcM%dweak","Pass", system,0));
        TH2D* matp =(TH2D*)f->Get(Form("DCARPtcut%s1%stpcM%dmat","Pass", system,0));

        // prim 2D
        TCanvas *c3prim = new TCanvas("DCA xy primary", "DCA xy primary");
        c3prim->SetGridx();
        c3prim->SetGridy();
        c3prim->SetFillColor(10);
        c3prim->SetRightMargin(1.9);
        c3prim->SetLogz();

        primp->GetXaxis()->SetTitle("DCA_{XY} (cm)");
        primp->GetXaxis()->SetRangeUser(-5.0,5.0);
        primp->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
        primp->GetZaxis()->SetLabelSize(0.03);
        primp->Draw("colz");
        postprocess(c3prim,Form("DCAxy%s",status),rWrite,rPerformance,system);

        // weak 2D
        TCanvas *c3 = new TCanvas("DCA xy weak", "DCA xy weak");
        c3->SetGridx();
        c3->SetGridy();
        c3->SetFillColor(10);
        c3->SetRightMargin(1.9);
        c3->SetLogz();

        weakp->GetXaxis()->SetTitle("DCA_{XY} (cm)");
        weakp->GetXaxis()->SetRangeUser(-5.0,5.0);
        weakp->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
        weakp->GetZaxis()->SetLabelSize(0.03);
        weakp->Draw("colz");
        postprocess(c3,Form("DCAxy%s",status),rWrite,rPerformance,system);

        // mat 2D
        TCanvas *c4 = new TCanvas("DCA xy mat", "DCA xy mat");
        c4->SetGridx();
        c4->SetGridy();
        c4->SetFillColor(10);
        c4->SetRightMargin(1.9);
        c4->SetLogz();

        matp->GetXaxis()->SetTitle("DCA_{XY} (cm)");
        matp->GetXaxis()->SetRangeUser(-5.0,5.0);
        matp->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
        matp->GetZaxis()->SetLabelSize(0.03);
        matp->Draw("colz");
        postprocess(c4,Form("DCAxy%s",status),rWrite,rPerformance,system);


        // prim proj
        gStyle->SetOptTitle(1);

        TCanvas *myCan3prim = new TCanvas("myCan3prim",cStamp1);
        myCan3prim->Draw();
        myCan3prim->cd();

        TPad *myPad3prim = new TPad("myPad3prim", "The pad3prim",0,0,1,1);
        myPadSetUp(myPad3prim,0.15,0.04,0.04,0.15);
        myPad3prim->Draw();
        myPad3prim->SetLogy();

        myPad3prim->cd();

        TH1D* primpp = (TH1D*)primp->ProjectionX("zxc22",0,100);
        primpp->Draw("");

        cout << primpp->FindBin(-0.1) << endl;
        cout << primpp->FindBin(0.1) << endl;

        cout << "primary in cut- " << primpp->Integral(191,211) << endl;
        cout << "primary all- " << primpp->Integral(1,400) << endl;

        postprocess(myCan3prim,Form("DCAxy%sProX",status),rWrite,rPerformance,system);


        // weak proj
        TCanvas *myCan3 = new TCanvas("myCan3",cStamp1);
        myCan3->Draw();
        myCan3->cd();

        TPad *myPad3 = new TPad("myPad3", "The pad3",0,0,1,1);
        myPadSetUp(myPad3,0.15,0.04,0.04,0.15);
        myPad3->Draw();
        myPad3->SetLogy();

        myPad3->cd();

        TH1D* weakpp = (TH1D*)weakp->ProjectionX("zxc2",0,100);
        weakpp->Draw("");

        cout << "weak in cut- " << weakpp->Integral(191,211) << endl;
        cout << "weak all- " << weakpp->Integral(1,400) << endl;

        postprocess(myCan3,Form("DCAxy%sProX",status),rWrite,rPerformance,system);

        // mat proj
        gStyle->SetOptTitle(1);
        TCanvas *myCan4 = new TCanvas("myCan4",cStamp1);
        myCan4->Draw();
        myCan4->cd();

        TPad *myPad4 = new TPad("myPad4", "The pad4",0,0,1,1);
        myPadSetUp(myPad4,0.15,0.04,0.04,0.15);
        myPad4->Draw();
        myPad4->SetLogy();

        myPad4->cd();

        TH1D* matpp = (TH1D*)matp->ProjectionX("zxc3",0,100);
        matpp->Draw("");

        cout << "material in cut- " << matpp->Integral(191,211) << endl;
        cout << "material all- " << matpp->Integral(1,400) << endl;

        postprocess(myCan4,Form("DCAxy%sProX",status),rWrite,rPerformance,system);

        cout  << "in cut: " << endl;
        cout << "prim - " << primpp->Integral(191,211) / (primpp->Integral(191,211)+weakpp->Integral(191,211)+matpp->Integral(191,211)) << endl;
        cout << "weak - " << weakpp->Integral(191,211) / (primpp->Integral(191,211)+weakpp->Integral(191,211)+matpp->Integral(191,211)) << endl;
        cout << "mat - " << matpp->Integral(191,211) / (primpp->Integral(191,211)+weakpp->Integral(191,211)+matpp->Integral(191,211)) << endl;

        cout << endl << "in cut / all " << endl;
        cout << "prim - " << primpp->Integral(191,211) / primpp->Integral(1,400) << endl;
        cout << "weak - " << weakpp->Integral(191,211) / weakpp->Integral(1,400) << endl;
        cout << "mat - " << matpp->Integral(191,211) / matpp->Integral(1,400) << endl;


        // _____sum____

        TH2D* psum = new TH2D("psum","",400, -2.0, 2.0, 100,0.0,2.0);
        psum->GetXaxis()->SetTitle("DCA_{xy} (cm)");
        psum->GetYaxis()->SetTitle("Number of Entries (normalized)");
        psum->GetXaxis()->SetLimits(-2,2);


        for (int i = 0; i < primp->GetNbinsX(); i++) {
            for (int j = 0; j < primp->GetNbinsY(); j++) {
                psum->SetBinContent(i,j,primp->GetBinContent(i,j)+weakp->GetBinContent(i,j)+matp->GetBinContent(i,j));
            }
        }

        gStyle->SetOptStat(0);

        TCanvas *cansum = new TCanvas("cansum",cStamp1,600,400);
        cansum->Draw();
        cansum->cd();

        TPad *padsum = new TPad("padsum", "The pad4",0,0,1,1);
        myPadSetUp(padsum,0.15,0.04,0.04,0.15);
        padsum->Draw();
        padsum->SetLogy();

        padsum->cd();

        // TCanvas* cansum = new TCanvas("cansum","cansum");
        // cansum->SetLogy();
        //psum->Draw("colz");
        TH1D* asd0 = (TH1D*)psum->ProjectionX("zxc",0,100);

        // asd0->Scale(1./asd0->Integral());
        // TFile* fout = new TFile("dca.root","update");
        // asd0->SetName(Form("dcaxyMC%d",isMC));
        // asd0->Write();

        asd0->GetXaxis()->SetTitle("DCA_{xy} (cm)");
        asd0->GetYaxis()->SetTitle("Number of Entries (normalized)");
        //asd0->SetMaximum(5000);
        //asd0->SetMinimum(0.00008);
        asd0->GetXaxis()->SetNdivisions(8);
        asd0->GetYaxis()->SetNdivisions(8);
        //asd0->GetYaxis()->SetTitleOffset(1.4);
        asd0->GetXaxis()->SetTitleSize(0.068);
        asd0->GetYaxis()->SetTitleSize(0.068);
        asd0->GetXaxis()->SetLabelSize(0.058);
        asd0->GetYaxis()->SetLabelSize(0.058);
        asd0->SetFillColor(kBlack);

        Double_t norm = asd0->Integral();
        //asd0->Scale(1./norm);
        //asd0->SetMinimum(0.00007);

        asd0->SetMarkerSize(1.3);
        asd0->SetMarkerColor(kBlack);
        asd0->SetMarkerStyle(20);
        asd0->Draw("pc");

        primpp->SetFillColor(kGreen+2);
        //primpp->Scale(1./norm);
        primpp->SetMarkerSize(1.3);
        primpp->SetMarkerColor(kGreen+2);
        primpp->SetMarkerStyle(20);
        primpp->Draw("psame");

        matpp->SetFillColor(kRed);
        //matpp->Scale(1./norm);
        matpp->SetMarkerSize(1.3);
        matpp->SetMarkerColor(kRed);
        matpp->SetMarkerStyle(20);
        matpp->Draw("psame");

        weakpp->SetFillColor(kBlue);
        //weakpp->Scale(1./norm);
        weakpp->SetMarkerSize(1.3);
        weakpp->SetMarkerColor(kBlue);
        weakpp->SetMarkerStyle(20);
        weakpp->Draw("psame");



        // _____endofsum____


        TLegend *myLegend = new TLegend(0.6,0.6,0.89,0.89);
        myLegend->SetFillColor(10);
        myLegend->SetBorderSize(0);

        myLegend->AddEntry(asd0,"all","f");
        myLegend->AddEntry(primpp,"primary","f");
        myLegend->AddEntry(weakpp,"weak decay","f");
        myLegend->AddEntry(matpp,"material","f");
        //myLegend->Draw("same");


        // logo

        TLatex *sys = new TLatex(0.16,0.91,"AMPT Pb-Pb #sqrt{s_{NN}} = 2.76 TeV");
        sys->SetNDC();
        sys->SetTextFont(42);
        sys->SetTextSize(0.05);
        sys->SetTextColor(kRed+2);
        sys->Draw();

        TDatime now;
        int iDate = now.GetDate();
        int iYear=iDate/10000;
        int iMonth=(iDate%10000)/100;
        int iDay=iDate%100;
        char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun",
                          "Jul","Aug","Sep","Oct","Nov","Dec"};
        char cStamp1[25],cStamp2[25];
        sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear);
        sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear);


        TText *date = new TText(0.27,0.5,cStamp2);
        date->SetNDC();
        date->SetTextFont(42);
        date->SetTextSize(0.04);
        date->Draw();

        //           //Acquire canvas proportions
//                 Double_t AliLogo_LowX = 0.27;
//                 Double_t AliLogo_LowY = 0.6;
//                 Double_t AliLogo_Height = 0.22;
//                 //ALICE logo is a png file that is 821x798 pixels->should be wider than a square
//                 Double_t AliLogo_Width  = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw();

//                 TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height);
//                 //    myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment !
//                 myPadSetUp(myPadLogo,0,0,0,0);
//                 myPadLogo->SetFixedAspectRatio(1);
//                 myPadLogo->Draw();
//                 myPadLogo->cd();

// //                TASImage *myAliceLogo = new TASImage("alice_preliminary.eps");
//                 TASImage *myAliceLogo = new TASImage("alice_performance.eps");
// //		TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png");
//                 myAliceLogo->Draw();

        DrawALICELogo(0,0.27,0.55,0.7,0.8);

//logo

        // postprocess(cansum,Form("DCAxyMC%s",status),rWrite,rPerformance,system);
        cansum->SaveAs("DCAxyMC.png");
        cansum->SaveAs("DCAxyMC.eps");
    }

//__________________________________________________


}