void drawDist(const char* infilename, const char* system, Int_t rWrite, Int_t rPerformance) { 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"); // TList *list = (TList*)f->Get("femtolist"); // pseudorapidity vs pt TH2D* ypt =(TH2D*)f->Get(Form("EtaPtcutPass1%stpcM%i",system,0)); int minMultBin = 0; int maxMultBin = 6; double EvMultall = 0; for(int i = minMultBin; i < maxMultBin; i++) { TH1D* yptN =(TH1D*)f->Get(Form("EtaPtcutPass1%stpcM%i",system,i)); ypt->Add(yptN); //delete hEvMult; } TCanvas *c2 = new TCanvas("pseudorapidity vs pt", "pseudorapidity vs pt"); c2->SetGridx(); c2->SetGridy(); c2->SetFillColor(10); ypt->GetXaxis()->SetTitle("#eta"); ypt->GetYaxis()->SetTitle("p_{T}"); ypt->GetXaxis()->SetTitleOffset(1.3); ypt->GetYaxis()->SetTitleOffset(1.3); ypt->GetXaxis()->SetRangeUser(-0.8,0.8); ypt->GetYaxis()->SetRangeUser(0.1,8.); ypt->Draw("colz"); // https://wiki.bnl.gov/eic/index.php/ROOT#Moving_and_resizing_the_palette_axis_of_a_2D_histogram gPad->SetRightMargin( 0.12 ); // The default right margin is 0.1 i.e. 10% of the image width // TPaletteAxis* palette // = dynamic_cast<TPaletteAxis*>( myHistogram.GetListOfFunctions()->FindObject( "palette" ) ); // if( palette ) { // palette->SetX1NDC( 0.86 ); // Start the palette 86 % of the way across the image // palette->SetX1NDC( 0.91 ); // End the palette 91% of the way across the image // gPad->Modified(); // Update with the new position // } // if postprocess(c2,Form("ypt%s",system),rWrite,rPerformance); }
void prepareAll() { 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); }
int main(int argc, char* argv[]) { int level; po::options_description myOptions("command line options by bujian"); myOptions.add_options() ("help,h","Produce help message") ("level",po::value<int>(& level)->default_value(5)); po::variables_map vmap; po::store(po::parse_command_line(argc,argv,myOptions), vmap); po::notify(vmap); if(vmap.count("help")) { std::cout<<myOptions<<std::endl; return 1; } if(vmap.count("level")) { level = vmap["level"].as<int>(); std::cout<<"Int: "<<level<<std::endl; } }
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)); }
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)); } }
void plotDeplambda() { myOptions(); ifstream infilepp0f1("fitresults_pp_0.txt"); ifstream infilepp1f1("fitresults_pp_2.txt"); ifstream infilepp2f1("fitresults_pp_4.txt"); ifstream infileapap0f1("fitresults_apap_0.txt"); ifstream infileapap1f1("fitresults_apap_2.txt"); ifstream infileapap2f1("fitresults_apap_4.txt"); ifstream infilepap0f1("fitresults_pap_0.txt"); ifstream infilepap1f1("fitresults_pap_2.txt"); ifstream infilepap2f1("fitresults_pap_4.txt"); c1 = new TCanvas("c1","",200,10,700,500); c1->SetFillColor(10); // c1->SetGrid(); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); char *centralities[3] = {"30-70%","10-30%","0-10%"}; Int_t n = 3; Double_t xapf1[3] = {5,20,50}; Double_t yapf1[3] = {3.43727e+00,4.64683e+00,5.52090e+00}; Double_t exapf1[3] = {0,0,0}; Double_t eyapf1[3] = {9.02434e-02,1.51701e-01,2.18175e-01}; Double_t lamppapap[3] = {3.43727e+00,4.64683e+00,5.52090e+00}; Double_t elamppapap[3] = {0,0,0}; Double_t lamplaapap[3] = {9.02434e-02,1.51701e-01,2.18175e-01}; Double_t elamplaapap[3] = {0,0,0}; infileapap0f1 >> yapf1[0] >> eyapf1[0] >> lamppapap[0] >> elamppapap[0] >> lamplaapap[0]; infileapap1f1 >> yapf1[1] >> eyapf1[1] >> lamppapap[1] >> elamppapap[1] >> lamplaapap[1]; infileapap2f1 >> yapf1[2] >> eyapf1[2] >> lamppapap[2] >> elamppapap[2] >> lamplaapap[2]; lamplaapap[2] = 0.129/1.711; lamplaapap[1] = 0.162/1.887; lamplaapap[0] = 0.329/1.922; // lamppapap[0] /= lamplaapap[0]; // lamppapap[1] /= lamplaapap[1]; // lamppapap[2] /= lamplaapap[2]; gr1 = new TGraphErrors(n,xapf1,lamplaapap,exapf1,exapf1); gr1->SetTitle(""); gr1->GetXaxis()->SetTitle("centrality percentile"); // gr1->GetXaxis()->SetTitleOffset(1.7); gr1->GetYaxis()->SetTitle("#lambda_{p#Lambda} / #lambda_{pp}"); gr1->GetYaxis()->SetLabelSize(0.045); gr1->GetYaxis()->SetTitleOffset(0.8); gr1->SetMinimum(0.0); gr1->SetMaximum(0.27); gr1->SetMarkerSize(1.5); gr1->SetMarkerColor(2); gr1->SetMarkerStyle(20); gr1->Draw("AP"); // Double_t xpf1[3] = {5,20,50}; // Double_t ypf1[3] = {2.98691e+00,3.54014e+00,4.38414e+00}; // Double_t expf1[3] = {0,0,0}; // Double_t eypf1[3] = {6.23538e-02,4.70256e-02,8.24919e-02}; // Double_t lampppp[3] = {3.43727e+00,4.64683e+00,5.52090e+00}; // Double_t elampppp[3] = {0,0,0}; // Double_t lamplapp[3] = {9.02434e-02,1.51701e-01,2.18175e-01}; // Double_t elamplapp[3] = {0,0,0}; // infilepp0f1 >> ypf1[0] >> eypf1[0] >> lampppp[0] >> elampppp[0] >> lamplapp[0]; // infilepp1f1 >> ypf1[1] >> eypf1[1] >> lampppp[1] >> elampppp[1] >> lamplapp[1]; // infilepp2f1 >> ypf1[2] >> eypf1[2] >> lampppp[2] >> elampppp[2] >> lamplapp[2]; // lamplapp[0] /= lampppp[0]; // lamplapp[1] /= lampppp[1]; // lamplapp[2] /= lampppp[2]; // // lampppp[0] /= lamplapp[0]; // // lampppp[1] /= lamplapp[1]; // // lampppp[2] /= lamplapp[2]; // gr3 = new TGraphErrors(n,xpf1,lamplapp,expf1,expf1); // gr3->SetTitle(""); // gr3->SetMarkerSize(1.5); // gr3->SetMarkerColor(4); // gr3->SetMarkerStyle(21); // gr3->Draw("Psame"); // Double_t xpaf1[3] = {5,20,50}; // Double_t ypaf1[3] = {2.98691e+00,3.54014e+00,4.38414e+00}; // Double_t expaf1[3] = {0,0,0}; // Double_t eypaf1[3] = {6.23538e-02,4.70256e-02,8.24919e-02}; // Double_t lampppap[3] = {3.43727e+00,4.64683e+00,5.52090e+00}; // Double_t elampppap[3] = {0,0,0}; // Double_t lamplapap[3] = {9.02434e-02,1.51701e-01,2.18175e-01}; // Double_t elamplapap[3] = {0,0,0}; // infilepap0f1 >> ypaf1[0] >> eypaf1[0] >> lampppap[0] >> elampppap[0] >> lamplapap[0]; // infilepap1f1 >> ypaf1[1] >> eypaf1[1] >> lampppap[1] >> elampppap[1] >> lamplapap[1]; // infilepap2f1 >> ypaf1[2] >> eypaf1[2] >> lampppap[2] >> elampppap[2] >> lamplapap[2]; // lamplapap[0] /= lampppap[0]; // lamplapap[1] /= lampppap[1]; // lamplapap[2] /= lampppap[2]; // // lampppap[0] /= lamplapap[0]; // // lampppap[1] /= lamplapap[1]; // // lampppap[2] /= lamplapap[2]; // // cout<<lampppap[2]<<endl; // // cout<<lampppap[1]<<endl; // // cout<<lampppap[0]<<endl; // gr5 = new TGraphErrors(n,xpaf1,lamplapap,expaf1,expaf1); // gr5->SetTitle(""); // gr5->SetMarkerSize(1.5); // gr5->SetMarkerColor(9); // gr5->SetMarkerStyle(22); // gr5->Draw("Psame"); // TLegend *myLegend = new TLegend(0.2,0.7,0.49,0.89); // myLegend->SetFillColor(10); // // myLegend->AddEntry(gr,"#bar{p}-#bar{p} field3","p"); // myLegend->AddEntry(gr1,"#bar{p}-#bar{p}","p"); // //myLegend->AddEntry(gr2,"p-p field3","p"); // myLegend->AddEntry(gr3,"p-p","p"); // //myLegend->AddEntry(gr4,"p-#bar{p} field3","p"); // myLegend->AddEntry(gr5,"p-#bar{p}","p"); // myLegend->Draw("same"); // cout << "<lam[0]> = " << (lamplapap[0]+lamplaapap[0]+lamplapp[0])/3. << endl; // cout << "<lam[1]> = " << (lamplapap[1]+lamplaapap[1]+lamplapp[1])/3. << endl; // cout << "<lam[2]> = " << (lamplapap[2]+lamplaapap[2]+lamplapp[2])/3. << endl; c1->SaveAs("proton_compare_lambda.eps"); // return c1; }
// 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"); } //__________________________________________________ }