Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:47

0001 //This file plots the TGraphs of MPV values found from the LanGau fit
0002 void LanGauPlots()
0003 {
0004 
0005     std::string file0 = "/Users/ar2545/Downloads/LanGauFitData/47.root";
0006     std::string file1 = "/Users/ar2545/Downloads/LanGauFitData/48.root";
0007     std::string file2 = "/Users/ar2545/Downloads/LanGauFitData/50.root";
0008     std::string file3 = "/Users/ar2545/Downloads/LanGauFitData/51.root";
0009     std::string file4 = "/Users/ar2545/Downloads/LanGauFitData/52.root";
0010     std::string file5 = "/Users/ar2545/Downloads/LanGauFitData/53.root";
0011     std::string file6 = "/Users/ar2545/Downloads/LanGauFitData/54.root";
0012 //    std::string file2 = "/Users/ar2545/Downloads/LanGauData/122.root";
0013     
0014     TFile* fsyspp0;
0015     TFile* fsyspp1;
0016     TFile* fsyspp2;
0017     TFile* fsyspp3;
0018     TFile* fsyspp4;
0019     TFile* fsyspp5;
0020     TFile* fsyspp6;
0021    
0022 
0023     fsyspp0 = new TFile(file0.c_str());
0024     fsyspp1 = new TFile(file1.c_str());
0025     fsyspp2 = new TFile(file2.c_str());
0026     fsyspp3 = new TFile(file3.c_str());
0027     fsyspp4 = new TFile(file4.c_str());
0028     fsyspp5 = new TFile(file5.c_str());
0029     fsyspp6 = new TFile(file6.c_str());
0030     
0031     int Voltage = 57;
0032     string VoV;
0033     map<int,string> VtoVov = {{58,"5.5 VoV"},{57.5,"5.5 VoV"},{57,"4.5 VoV"},{56.5,"4 VoV"},{56,"3.5 VoV"}};
0034     auto noiseIt = VtoVov.find(Voltage);
0035     VoV = noiseIt->second;
0036     
0037     TH1D* mpv0 = (TH1D*)fsyspp0->Get("mpv_hist");
0038     TH1D* mpv1 = (TH1D*)fsyspp1->Get("mpv_hist");
0039 //    TH1D* mpv2 = (TH1D*)fsyspp2->Get("mpv_hist");
0040     
0041     TGraphAsymmErrors* g_mpv0 = (TGraphAsymmErrors*)fsyspp0->Get("MPV");
0042     g_mpv0->SetFillStyle(1001);
0043     g_mpv0->SetFillColorAlpha(kGray+3, 0.3);
0044     g_mpv0->SetLineColor(kBlack);
0045     g_mpv0->SetLineWidth(2);
0046     
0047     TGraphAsymmErrors*  g_mpv1 = (TGraphAsymmErrors*)fsyspp1->Get("MPV");
0048     g_mpv1->SetFillStyle(1001);
0049     g_mpv1->SetFillColorAlpha(kGray+3, 0.3);
0050     g_mpv1->SetLineColor(kBlack);
0051     g_mpv1->SetLineWidth(2);
0052     
0053     TGraphAsymmErrors* g_mpv2 = (TGraphAsymmErrors*)fsyspp2->Get("MPV");
0054     g_mpv2->SetFillStyle(1001);
0055     g_mpv2->SetFillColorAlpha(kGray+3, 0.3);
0056     g_mpv2->SetLineColor(kBlack);
0057     g_mpv2->SetLineWidth(2);
0058     
0059     TGraphAsymmErrors*  g_mpv3 = (TGraphAsymmErrors*)fsyspp3->Get("MPV");
0060     g_mpv3->SetFillStyle(1001);
0061     g_mpv3->SetFillColorAlpha(kGray+3, 0.3);
0062     g_mpv3->SetLineColor(kBlack);
0063     g_mpv3->SetLineWidth(2);
0064     
0065     TGraphAsymmErrors*  g_mpv4 = (TGraphAsymmErrors*)fsyspp4->Get("MPV");
0066     g_mpv4->SetFillStyle(1001);
0067     g_mpv4->SetFillColorAlpha(kGray+3, 0.3);
0068     g_mpv4->SetLineColor(kBlack);
0069     g_mpv4->SetLineWidth(2);
0070     
0071     TGraphAsymmErrors*  g_mpv5 = (TGraphAsymmErrors*)fsyspp5->Get("MPV");
0072     g_mpv5->SetFillStyle(1001);
0073     g_mpv5->SetFillColorAlpha(kGray+3, 0.3);
0074     g_mpv5->SetLineColor(kBlack);
0075     g_mpv5->SetLineWidth(2);
0076     
0077     TGraphAsymmErrors*  g_mpv6 = (TGraphAsymmErrors*)fsyspp6->Get("MPV");
0078     g_mpv6->SetFillStyle(1001);
0079     g_mpv6->SetFillColorAlpha(kGray+3, 0.3);
0080     g_mpv6->SetLineColor(kBlack);
0081     g_mpv6->SetLineWidth(2);
0082 
0083 //g->SetMarkerStyle()
0084 g_mpv0->SetLineWidth(4);g_mpv0->SetFillStyle(1001);g_mpv0->SetFillColorAlpha(kGreen+4, 0.3);g_mpv0->SetLineColor(kGreen+2);
0085 g_mpv1->SetLineWidth(4);g_mpv1->SetFillStyle(1001);g_mpv1->SetFillColorAlpha(kRed+2, 0.3);g_mpv1->SetLineColor(kRed);
0086 g_mpv2->SetLineWidth(4);g_mpv2->SetFillStyle(1001);g_mpv2->SetFillColorAlpha(kMagenta+2, 0.3);g_mpv2->SetLineColor(kMagenta);
0087 g_mpv3->SetLineWidth(4);g_mpv3->SetFillStyle(1001);g_mpv3->SetFillColorAlpha(kGray+2, 0.3);g_mpv3->SetLineColor(kGray);
0088 g_mpv4->SetLineWidth(4);g_mpv4->SetFillStyle(1001);g_mpv4->SetFillColorAlpha(kAzure+2, 0.3);g_mpv4->SetLineColor(kAzure);
0089 g_mpv5->SetLineWidth(4);g_mpv5->SetFillStyle(1001);g_mpv5->SetFillColorAlpha(kOrange+8, 0.3);g_mpv5->SetLineColor(kOrange+6);
0090 g_mpv6->SetLineWidth(4);g_mpv6->SetFillStyle(1001);g_mpv6->SetFillColorAlpha(kCyan-7, 0.3);g_mpv6->SetLineColor(kCyan);
0091 
0092     TCanvas* c = new TCanvas("c", "c", 850, 600);
0093 //    TCanvas* c1 = new TCanvas("c", "c", 850, 600);
0094     gStyle->SetOptStat(0);
0095     g_mpv0->GetYaxis()->SetRangeUser(-2000,2000);
0096     g_mpv0->Draw();
0097     g_mpv1->Draw("SAME");
0098     g_mpv2->Draw("SAME");
0099     g_mpv3->Draw("SAME");
0100     g_mpv4->Draw("SAME");
0101     g_mpv5->Draw("SAME");
0102 //    g_mpv6->Draw("SAME");
0103 
0104 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
0105     //  TLegend* leg = new TLegend(0.58, 0.65, 0.68, 0.85);
0106     TLegend* leg = new TLegend(0.20, 0.20, 0.42, 0.40);
0107     //  TLegend* leg = new TLegend(0.15, 0.50, 0.30, 0.62);
0108     leg->SetFillColor(0);
0109     leg->SetBorderSize(0);
0110     leg->SetTextFont(42);
0111     leg->SetTextSize(0.035);
0112     // leg->SetNDC(true);
0113     
0114     TLegend* leg1 = new TLegend(0.50, 0.82, 0.72, 0.90);
0115     //  TLegend* leg = new TLegend(0.15, 0.50, 0.30, 0.62);
0116     leg1->SetFillColor(0);
0117     leg1->SetBorderSize(0);
0118     leg1->SetTextFont(42);
0119     leg1->SetTextSize(0.12);
0120     
0121     TLegend* leg2 = new TLegend(0.20, 0.82, 0.42, 0.90);
0122     //  TLegend* leg = new TLegend(0.15, 0.50, 0.30, 0.62);
0123     leg2->SetFillColor(0);
0124     leg2->SetBorderSize(0);
0125     leg2->SetTextFont(42);
0126     leg2->SetTextSize(0.12);
0127     
0128     TLatex* lat = new TLatex();
0129     lat->SetTextFont(42);
0130     lat->SetNDC(true);
0131     lat->SetTextSize(0.035);
0132     //  lat->SetTextAlign(33);
0133     
0134     TLatex* lat1 = new TLatex();
0135     lat1->SetTextFont(42);
0136     lat1->SetNDC(true);
0137     lat1->SetTextSize(0.035);
0138     lat1->SetTextAlign(1);
0139     
0140     //Writing particle track cut range on plots
0141     TLatex latex1;
0142     latex1.SetNDC ();
0143     latex1.SetTextFont(42);
0144     const char *str1 = "#it{#pi}";
0145     latex1.SetTextSize(0.035);
0146     
0147     TLatex latex2;
0148     latex2.SetNDC ();
0149     latex2.SetTextFont(42);
0150     latex2.SetTextSize(0.035);
0151     //Writing collision energy
0152     TLatex latex3;
0153     latex3.SetNDC();
0154     latex3.SetTextFont(42);
0155     const char *str3 = "#sqrt{#it{s}} = 13 TeV";
0156     latex3.SetTextSize(0.035);
0157 
0158 //$$$$$$$$$$$$$$$$$$$$$$$$$$ plotting finishes$$$$$$$$$$$$$$$$$$$$$$$$$$$$
0159 
0160     latex1.DrawLatex(0.15,0.80 ,Form("Landau-Gauss Fit"));
0161     latex2.DrawLatex(0.15,0.85 ,Form("%s, Species: %s",VoV.c_str(),str1));
0162     //
0163     std::stringstream ss;
0164     ss.str("");
0165     
0166 
0167 //      leg->AddEntry(g_mpv0,"54 V");
0168 //      leg->AddEntry(g_mpv1,"55 V");
0169       
0170       leg->AddEntry(g_mpv0,"300 GeV");
0171       leg->AddEntry(g_mpv1,"250 GeVV");
0172       leg->AddEntry(g_mpv2,"200 GeV");
0173       leg->AddEntry(g_mpv3,"150 GeV");
0174       leg->AddEntry(g_mpv4,"100 GeV");
0175       leg->AddEntry(g_mpv5,"80 GeV");
0176 //      leg->AddEntry(g_mpv6,"60 GeV");
0177       leg->Draw("same");
0178     
0179 //    ss << "Pion_VoltageScan300GeV.pdf";
0180 //    c->SaveAs(ss.str().c_str());
0181 }
0182 
0183 
0184