#include "TFile.h" #include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TRandom.h" #include "TLegend.h" #include "TPaveStats.h" #include "TGraph.h" #include "TSystem.h" #include "TTree.h" #include "TTreePlayer.h" #include "TF1.h" #include "TCut.h" #include "TPaletteAxis.h" #include "TLine.h" #include "TLatex.h" #include "TText.h" void DrawVerticalLine(Double_t x) { TLine l; Double_t lm = gPad->GetLeftMargin(); Double_t rm = 1.-gPad->GetRightMargin(); Double_t tm = 1.-gPad->GetTopMargin(); Double_t bm = gPad->GetBottomMargin(); Double_t xndc = (rm-lm)*((x-gPad->GetUxmin())/(gPad->GetUxmax()-gPad->GetUxmin()))+lm; l.DrawLineNDC(xndc,bm,xndc,tm); } void simlemmasec() { double Enemin=43690; double Enemax=46000; int n=3; int c_YTitleSize=25; int c_YTitleFont=43; double c_YTitleOffset=1.; int c_YLabelFont=43; int c_YLabelSize=25; int c_XTitleSize=25; int c_XTitleFont=43; double c_XTitleOffset=1.1; int c_XLabelFont=43; int c_XLabelSize=25; double c_XTitleOffsetTH3=2.; double c_YTitleOffsetTH3=2.; double c_ZTitleOffsetTH3=2.; float fillcolor=0.35; char dirin[50];//Directory where there is the input root file char dirout[50];//Main Directory where to save the output files char Secondary[50]; char dirsp[50]; char PDGname[50]; char KinEnname[50]; char Momentumname[50]; char Directionname[50]; char RelEnname[50]; char RelEnHitname[50]; char MomHitname[50]; char RelEnmomname[50]; char PDGxname[50]; char kinenxname[50]; char angname[50]; char angxname[50]; char momxname[50]; char totmomXname[50]; char dirxname[50]; char relenxname[50]; char vertxname[50]; char RelEnXHitname[50]; char RelEnXMomname[50]; char countyname[50]; char Hitpoints[50]; char XHitpoints[50]; char YHitpoints[50]; char ZHitpoints[50]; char Vertname[50]; char momvalxname[50]; char Momentumvalname[50]; char totmomname[50]; char Invmassname[50]; char invmassxname[50]; char Posiemitx[50]; char Posiemity[50]; char Angemitx[50]; char Angemity[50]; char Eneangname[50]; char htempname[50]; char Emittancename[50]; char outformat[50]; sprintf(dirin, "C:/"); sprintf(dirout, "C:/"); sprintf(dirsp, "Secondaries/"); sprintf(Secondary, "B1Secondaryparticles"); sprintf(PDGname, "Particle PDG"); sprintf(KinEnname, "Particle Kinetic Energy"); sprintf(Eneangname, "Kinetic Energy- Angle"); sprintf(Momentumname, "Particle Momentum Direction"); sprintf(Momentumvalname, "Particle Momentum "); sprintf(momvalxname, "Particle Momentum (MeV/c)"); sprintf(Directionname, "Particle Position"); sprintf(RelEnname, "Deposited Energy"); sprintf(RelEnHitname, "Particle Released Energy- Hit point"); sprintf(MomHitname, "Particle Momentum Direction- Hit point"); sprintf(RelEnmomname, "Particle Released Energy- Momentum Direction"); sprintf(PDGxname, "PDG"); sprintf(kinenxname, "Kinetic Energy (MeV)"); sprintf(momxname, "Momentum Direction (mm)"); sprintf(dirxname, "Position (mm)"); sprintf(relenxname, "Energy (MeV)"); sprintf(RelEnXHitname, "Hit point (mm)"); sprintf(RelEnXMomname, "Momentum Direction "); sprintf(Hitpoints, "Space Hit points"); sprintf(XHitpoints, "z Hit points (mm)"); sprintf(YHitpoints, "x Hit points (mm)"); sprintf(ZHitpoints, "y Hit points (mm)"); sprintf(angname, "Angular distribution"); sprintf(angxname, "Angular distribution (rad)"); sprintf(vertxname, "Vertex (mm)"); sprintf(Invmassname, "Invariant Mass"); sprintf(totmomname, "Particle Momentum"); sprintf(totmomXname, "Particle Momentum (MeV/c)"); sprintf(invmassxname, "Invariant Mass (MeV/c^{2})"); sprintf(Posiemitx, "x (mm)"); sprintf(Posiemity, "y (mm)"); sprintf(Angemitx, "x' (rad)"); sprintf(Angemity, "y' (rad)"); sprintf(Emittancename, "Emittance"); sprintf(Vertname, "Vertex"); sprintf(countyname, "#Counts"); sprintf(htempname, "Lemma"); sprintf(outformat, "pdf"); //sprintf(outformat, "png"); TString myfilein = TString::Format("%sB1.root",dirin); gSystem->mkdir(TString::Format("%ssimulazione/", dirout), kTRUE); gSystem->mkdir(TString::Format("%ssimulazione/%s", dirout, dirsp), kTRUE); TString outfolder=TString::Format("%ssimulazione/",dirout); TString outfoldersp=TString::Format("%ssimulazione/%s",dirout, dirsp); TString cdXnamehenehit = TString::Format("%s",RelEnXHitname); TString cdYnamehenehit = TString::Format("%s",relenxname); TString cdXnamehspacehit = TString::Format("%s",XHitpoints); TString cdYnamehspacehit = TString::Format("%s",YHitpoints); TString cdZnamehspacehit = TString::Format("%s",ZHitpoints); TString cdXnamehenemom = TString::Format("%s",RelEnXMomname); TString cdnamePDGsp = TString::Format("%s - %s",PDGname, Secondary); TString cdnameKinEnsp = TString::Format("%s - %s",KinEnname, Secondary); TString cdnameinvmasssp = TString::Format("%s - %s",Invmassname, Secondary); TString cdnamePxsp = TString::Format("%s x-axis - %s", Momentumname,Secondary); TString cdnamePysp = TString::Format("%s y-axis - %s", Momentumname, Secondary); TString cdnamePzsp = TString::Format("%s z-axis - %s", Momentumname, Secondary); TString cdnameangxsp = TString::Format("%s x-axis - %s", angname, Secondary); TString cdnameangysp = TString::Format("%s y-axis - %s", angname, Secondary); TString cdnamemomvalxsp = TString::Format("%s x-axis - %s", Momentumvalname, Secondary); TString cdnamemomvalysp = TString::Format("%s y-axis - %s", Momentumvalname, Secondary); TString cdnamemomvalzsp = TString::Format("%s z-axis - %s", Momentumvalname, Secondary); TString cdnameDxsp= TString::Format("%s x-axis - %s", Directionname, Secondary); TString cdnameDysp= TString::Format("%s y-axis - %s", Directionname, Secondary); TString cdnameDzsp= TString::Format("%s z-axis - %s", Directionname, Secondary); TString cdnametotmomsp= TString::Format("%s - %s", totmomname, Secondary); TString cdnamevertxsp= TString::Format("%s x-axis - %s", Vertname, Secondary); TString cdnamevertysp= TString::Format("%s y-axis - %s", Vertname, Secondary); TString cdnamevertzsp= TString::Format("%s z-axis - %s", Vertname, Secondary); TString cdnameRelEnsp = TString::Format("%s - %s",RelEnname,Secondary); TString cdXnamehemitxxp = TString::Format("%s", Posiemitx); TString cdYnamehemitxxp = TString::Format("%s", Angemitx); TString cdXnamehemityyp = TString::Format("%s", Posiemity); TString cdYnamehemityyp = TString::Format("%s", Angemity); TString cdXnameheneangxp = TString::Format("%s", Angemitx); TString cdXnameheneangyp = TString::Format("%s", Angemity); TString cdYnameheneang = TString::Format("%s", KinEnname); TString cdnameheneangx = TString::Format("%s x-axis' - %s", Eneangname, Secondary); TString cdnameheneangy = TString::Format("%s y-axis' - %s", Eneangname, Secondary); TString myplotpdgsp = TString::Format("%s%s-%s.%s",outfoldersp.Data(), Secondary, PDGname, outformat); TString myplotkinensp = TString::Format("%s%s-%s.%s",outfoldersp.Data(), Secondary, KinEnname, outformat); TString myplotmomxsp = TString::Format("%s%s-%sx.%s",outfoldersp.Data(), Secondary, Momentumname, outformat); TString myplotmomysp = TString::Format("%s%s-%sy.%s",outfoldersp.Data(), Secondary, Momentumname, outformat); TString myplotmomzsp = TString::Format("%s%s-%sz.%s",outfoldersp.Data(), Secondary, Momentumname, outformat); TString myplotvertxsp = TString::Format("%s%s-%sx.%s",outfoldersp.Data(), Secondary, Vertname, outformat); TString myplotvertysp = TString::Format("%s%s-%sy.%s",outfoldersp.Data(), Secondary, Vertname, outformat); TString myplotvertzsp = TString::Format("%s%s-%sz.%s",outfoldersp.Data(), Secondary, Vertname, outformat); TString myplottotmomsp = TString::Format("%s%s-%s.%s",outfoldersp.Data(), Secondary, totmomname, outformat); TString myplotdirxsp = TString::Format("%s%s-%sx.%s",outfoldersp.Data(), Secondary, Directionname, outformat); TString myplotdirysp = TString::Format("%s%s-%sy.%s",outfoldersp.Data(), Secondary, Directionname, outformat); TString myplotdirzsp = TString::Format("%s%s-%sz.%s",outfoldersp.Data(), Secondary, Directionname, outformat); TString myplotinvmasssp = TString::Format("%s%s-%s.%s",outfoldersp.Data(), Secondary, Invmassname, outformat); TString myplotmomvalxsp = TString::Format("%s%s-%sx.%s",outfoldersp.Data(), Secondary, Momentumvalname, outformat); TString myplotmomvalysp = TString::Format("%s%s-%sy.%s",outfoldersp.Data(), Secondary, Momentumvalname, outformat); TString myplotmomvalzsp = TString::Format("%s%s-%sz.%s",outfoldersp.Data(), Secondary, Momentumvalname, outformat); TString myplothemitxxpsp = TString::Format("%s%s-%sxxp.%s",outfoldersp.Data(), Secondary, Emittancename, outformat); TString myplothemityypsp = TString::Format("%s%s-%syyp.%s",outfoldersp.Data(), Secondary, Emittancename, outformat); TString myplotangxsp = TString::Format("%s%s-%sx.%s",outfoldersp.Data(), Secondary, angname, outformat); TString myplotangysp = TString::Format("%s%s-%sy.%s",outfoldersp.Data(), Secondary, angname, outformat); TString myplotheneangx = TString::Format("%s%s-%s_xp.%s",outfoldersp.Data(), Secondary, Eneangname, outformat); TString myplotheneangy = TString::Format("%s%s-%s_yp.%s",outfoldersp.Data(), Secondary, Eneangname, outformat); TString canvtitle = TString::Format("Simulation LEMMA"); gStyle->SetOptFit(); gStyle->SetOptStat(111110); TFile *fin = TFile::Open(myfilein); fin->ls (); TGaxis::SetMaxDigits(n); if (fin == 0) { printf("Error: cannot open the file!\n"); } else { TTree *ts=0; fin->GetObject(Secondary,ts); gStyle->SetOptFit(); gStyle->SetOptStat(111110); ts->SetLineColor(kBlue); //---------------------------------------------------------------------SECONDARY -------------------------------------------------------------// TCanvas *c20 = new TCanvas("c20",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleID >> htemp(100, -25., 25.)")); ts->GetHistogram()->SetTitle(cdnamePDGsp); ts->SetScanField(0); TH1F *htemppdgsp= (TH1F*)gPad->GetPrimitive("htemp"); htemppdgsp->GetXaxis()->SetTitle(PDGxname); htemppdgsp->GetYaxis()->SetTitle(countyname); htemppdgsp->GetYaxis()->SetTitleSize(c_YTitleSize); htemppdgsp->GetYaxis()->SetTitleFont(c_YTitleFont); htemppdgsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htemppdgsp->GetYaxis()->SetLabelFont(c_YLabelFont); htemppdgsp->GetYaxis()->SetLabelSize(c_YLabelSize); htemppdgsp->GetXaxis()->SetTitleSize(c_XTitleSize); htemppdgsp->GetXaxis()->SetTitleFont(c_XTitleFont); htemppdgsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htemppdgsp->GetXaxis()->SetLabelFont(c_XLabelFont); htemppdgsp->GetXaxis()->SetLabelSize(c_XLabelSize); htemppdgsp->SetFillStyle(1001); htemppdgsp->SetFillColorAlpha(kBlue, fillcolor); htemppdgsp->Draw(); htemppdgsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c20->Update(); TLegend* legpdgsp = new TLegend(0.25, 0.7, .35, .75); legpdgsp->SetHeader("Legend"); legpdgsp->SetNColumns(1); legpdgsp->AddEntry(htemppdgsp, "MC", "l"); legpdgsp->Draw(); c20->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statspdgsp = (TPaveStats*)htemppdgsp->GetListOfFunctions()->FindObject("stats"); statspdgsp->SetTextColor(kBlue); statspdgsp->SetX1NDC(0.80); statspdgsp->SetX2NDC(0.98); statspdgsp->SetY1NDC(0.77); statspdgsp->SetY2NDC(0.92); statspdgsp->DrawClone(); gPad->Update(); c20->Print(myplotpdgsp); delete c20; TCanvas *c21 = new TCanvas("c21",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleKinEn >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle("Primary e^{+} Kinetic Energy"); // TPaveText *t=new TPaveText(0.75,0.6,0.8,0.55,"brNDC"); ts->SetScanField(0); TH1F *htempkinensp= (TH1F*)gPad->GetPrimitive("htemp"); htempkinensp->GetXaxis()->SetTitle(kinenxname); htempkinensp->GetYaxis()->SetTitle(countyname); htempkinensp->GetYaxis()->SetTitleSize(c_YTitleSize); htempkinensp->GetYaxis()->SetTitleFont(c_YTitleFont); htempkinensp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempkinensp->GetYaxis()->SetLabelFont(c_YLabelFont); htempkinensp->GetYaxis()->SetLabelSize(c_YLabelSize); htempkinensp->GetXaxis()->SetTitleSize(c_XTitleSize); htempkinensp->GetXaxis()->SetTitleFont(c_XTitleFont); htempkinensp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempkinensp->GetXaxis()->SetLabelFont(c_XLabelFont); htempkinensp->GetXaxis()->SetLabelSize(c_XLabelSize); Double_t integral= htempkinensp->Integral(0,45); htempkinensp->SetFillStyle(1001); htempkinensp->SetFillColorAlpha(kBlue, fillcolor); htempkinensp->Draw(); htempkinensp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c21->Update(); float threshold = 43690; auto lnThreshold = new TLine(threshold, 0, threshold, gPad->GetUymax()); lnThreshold->SetLineColor(kRed); lnThreshold->SetLineStyle(10); lnThreshold->SetLineWidth(2); // maybe lnThreshold->Draw(); DrawVerticalLine(2.); c21->SetLogy(); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c21->Update(); TLegend* legkinensp = new TLegend(0.25, 0.7, .35, .75); legkinensp->SetHeader("Legend"); legkinensp->SetNColumns(1); legkinensp->AddEntry(htempkinensp, "MC", "l"); legkinensp->Draw(); c21->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statskinensp = (TPaveStats*)htempkinensp->GetListOfFunctions()->FindObject("stats"); statskinensp->SetTextColor(kBlue); statskinensp->SetX1NDC(0.80); statskinensp->SetX2NDC(0.98); statskinensp->SetY1NDC(0.83); statskinensp->SetY2NDC(0.98); //statskinensp->AddText(TString::Format("Integral = %g", integral)); statskinensp->DrawClone(); gPad->Update(); //t->AddText("Threshold"); //((TText*)t->GetListOfLines()->Last())->SetTextColor(kRed); //t->Draw(); TText *t = new TText(.75,.8,"Threshold"); t->SetTextAlign(22); t->SetTextColor(kRed+2); t->SetTextFont(43); t->SetTextSize(40); t->SetTextAngle(45); t->Draw(); gPad->Update(); c21->Print(myplotkinensp); delete c21; TCanvas *c22 = new TCanvas("c22",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMomDir.x >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamePxsp); ts->SetScanField(0); TH1F *htempmomxsp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomxsp->GetXaxis()->SetTitle(momxname); htempmomxsp->GetYaxis()->SetTitle(countyname); htempmomxsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomxsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomxsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomxsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomxsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomxsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomxsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomxsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomxsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomxsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomxsp->SetFillStyle(1001); htempmomxsp->SetFillColorAlpha(kBlue, fillcolor); htempmomxsp->Draw(); htempmomxsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c22->Update(); TLegend* legmomxsp = new TLegend(0.25, 0.7, .35, .75); legmomxsp->SetHeader("Legend"); legmomxsp->SetNColumns(1); legmomxsp->AddEntry(htempmomxsp, "MC", "l"); legmomxsp->Draw(); c22->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomxsp = (TPaveStats*)htempmomxsp->GetListOfFunctions()->FindObject("stats"); statsmomxsp->SetTextColor(kBlue); statsmomxsp->SetX1NDC(0.80); statsmomxsp->SetX2NDC(0.98); statsmomxsp->SetY1NDC(0.83); statsmomxsp->SetY2NDC(0.98); statsmomxsp->DrawClone(); gPad->Update(); c22->Print(myplotmomxsp); delete c22; TCanvas *c23 = new TCanvas("c23",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMomDir.y >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamePysp); ts->SetScanField(0); TH1F *htempmomysp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomysp->GetXaxis()->SetTitle(momxname); htempmomysp->GetYaxis()->SetTitle(countyname); htempmomysp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomysp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomysp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomysp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomysp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomysp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomysp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomysp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomysp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomysp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomysp->SetFillStyle(1001); htempmomysp->SetFillColorAlpha(kBlue, fillcolor); htempmomysp->Draw(); htempmomysp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c23->Update(); TLegend* legmomysp = new TLegend(0.65, 0.7, .75, .75); legmomysp->SetHeader("Legend"); legmomysp->SetNColumns(1); legmomysp->AddEntry(htempmomysp, "MC", "l"); legmomysp->Draw(); c23->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomysp = (TPaveStats*)htempmomysp->GetListOfFunctions()->FindObject("stats"); statsmomysp->SetTextColor(kBlue); statsmomysp->SetX1NDC(0.80); statsmomysp->SetX2NDC(0.98); statsmomysp->SetY1NDC(0.77); statsmomysp->SetY2NDC(0.92); statsmomysp->DrawClone(); gPad->Update(); c23->Print(myplotmomysp); delete c23; TCanvas *c24 = new TCanvas("c24",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMomDir.z >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamePzsp); ts->SetScanField(0); TH1F *htempmomzsp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomzsp->GetXaxis()->SetTitle(momxname); htempmomzsp->GetYaxis()->SetTitle(countyname); htempmomzsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomzsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomzsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomzsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomzsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomzsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomzsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomzsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomzsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomzsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomzsp->SetFillStyle(1001); htempmomzsp->SetFillColorAlpha(kBlue, fillcolor); htempmomzsp->Draw(); htempmomzsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c24->Update(); TLegend* legmomzsp = new TLegend(0.25, 0.7, .35, .75); legmomzsp->SetHeader("Legend"); legmomzsp->SetNColumns(1); legmomzsp->AddEntry(htempmomzsp, "MC", "l"); legmomzsp->Draw(); c24->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomzsp = (TPaveStats*)htempmomzsp->GetListOfFunctions()->FindObject("stats"); statsmomzsp->SetTextColor(kBlue); statsmomzsp->SetX1NDC(0.80); statsmomzsp->SetX2NDC(0.98); statsmomzsp->SetY1NDC(0.77); statsmomzsp->SetY2NDC(0.92); statsmomzsp->DrawClone(); gPad->Update(); c24->Print(myplotmomzsp); delete c24; TCanvas *c33 = new TCanvas("c33",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleVert.x >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamevertxsp); ts->SetScanField(0); TH1F *htempvertxsp= (TH1F*)gPad->GetPrimitive("htemp"); htempvertxsp->GetXaxis()->SetTitle(vertxname); htempvertxsp->GetYaxis()->SetTitle(countyname); htempvertxsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempvertxsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempvertxsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempvertxsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempvertxsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempvertxsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempvertxsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempvertxsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempvertxsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempvertxsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempvertxsp->SetFillStyle(1001); htempvertxsp->SetFillColorAlpha(kBlue, fillcolor); htempvertxsp->Draw(); htempvertxsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c33->Update(); TLegend* legvertxsp = new TLegend(0.25, 0.7, .35, .75); legvertxsp->SetHeader("Legend"); legvertxsp->SetNColumns(1); legvertxsp->AddEntry(htempvertxsp, "MC", "l"); legvertxsp->Draw(); c33->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsvertxsp = (TPaveStats*)htempvertxsp->GetListOfFunctions()->FindObject("stats"); statsvertxsp->SetTextColor(kBlue); statsvertxsp->SetX1NDC(0.80); statsvertxsp->SetX2NDC(0.98); statsvertxsp->SetY1NDC(0.77); statsvertxsp->SetY2NDC(0.92); statsvertxsp->DrawClone(); gPad->Update(); c33->Print(myplotvertxsp); delete c33; TCanvas *c34 = new TCanvas("c34",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleVert.y >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamevertysp); ts->SetScanField(0); TH1F *htempvertysp= (TH1F*)gPad->GetPrimitive("htemp"); htempvertysp->GetXaxis()->SetTitle(vertxname); htempvertysp->GetYaxis()->SetTitle(countyname); htempvertysp->GetYaxis()->SetTitleSize(c_YTitleSize); htempvertysp->GetYaxis()->SetTitleFont(c_YTitleFont); htempvertysp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempvertysp->GetYaxis()->SetLabelFont(c_YLabelFont); htempvertysp->GetYaxis()->SetLabelSize(c_YLabelSize); htempvertysp->GetXaxis()->SetTitleSize(c_XTitleSize); htempvertysp->GetXaxis()->SetTitleFont(c_XTitleFont); htempvertysp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempvertysp->GetXaxis()->SetLabelFont(c_XLabelFont); htempvertysp->GetXaxis()->SetLabelSize(c_XLabelSize); htempvertysp->SetFillStyle(1001); htempvertysp->SetFillColorAlpha(kBlue, fillcolor); htempvertysp->Draw(); htempvertysp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c34->Update(); TLegend* legvertysp = new TLegend(0.25, 0.7, .35, .75); legvertysp->SetHeader("Legend"); legvertysp->SetNColumns(1); legvertysp->AddEntry(htempvertysp, "MC", "l"); legvertysp->Draw(); c34->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsvertysp = (TPaveStats*)htempvertysp->GetListOfFunctions()->FindObject("stats"); statsvertysp->SetTextColor(kBlue); statsvertysp->SetX1NDC(0.80); statsvertysp->SetX2NDC(0.98); statsvertysp->SetY1NDC(0.77); statsvertysp->SetY2NDC(0.92); statsvertysp->DrawClone(); gPad->Update(); c34->Print(myplotvertysp); delete c34; TCanvas *c35 = new TCanvas("c35",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleVert.z >> htemp(50, -10, 40)")); ts->GetHistogram()->SetTitle(cdnamevertzsp); ts->SetScanField(0); TH1F *htempvertzsp= (TH1F*)gPad->GetPrimitive("htemp"); htempvertzsp->GetXaxis()->SetTitle(vertxname); htempvertzsp->GetYaxis()->SetTitle(countyname); htempvertzsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempvertzsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempvertzsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempvertzsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempvertzsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempvertzsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempvertzsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempvertzsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempvertzsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempvertzsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempvertzsp->SetFillStyle(1001); htempvertzsp->SetFillColorAlpha(kBlue, fillcolor); htempvertzsp->Draw(); htempvertzsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c35->Update(); TLegend* legvertzsp = new TLegend(0.25, 0.7, .35, .75); legvertzsp->SetHeader("Legend"); legvertzsp->SetNColumns(1); legvertzsp->AddEntry(htempvertzsp, "MC", "l"); legvertzsp->Draw(); c35->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsvertzsp = (TPaveStats*)htempvertzsp->GetListOfFunctions()->FindObject("stats"); statsvertzsp->SetTextColor(kBlue); statsvertzsp->SetX1NDC(0.80); statsvertzsp->SetX2NDC(0.98); statsvertzsp->SetY1NDC(0.77); statsvertzsp->SetY2NDC(0.92); statsvertzsp->DrawClone(); gPad->Update(); c35->Print(myplotvertzsp); delete c35; TCanvas *c36 = new TCanvas("c36",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleTotMom >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnametotmomsp); ts->SetScanField(0); TH1F *htemptotmomsp= (TH1F*)gPad->GetPrimitive("htemp"); htemptotmomsp->GetXaxis()->SetTitle(totmomXname); htemptotmomsp->GetYaxis()->SetTitle(countyname); htemptotmomsp->GetYaxis()->SetTitleSize(c_YTitleSize); htemptotmomsp->GetYaxis()->SetTitleFont(c_YTitleFont); htemptotmomsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htemptotmomsp->GetYaxis()->SetLabelFont(c_YLabelFont); htemptotmomsp->GetYaxis()->SetLabelSize(c_YLabelSize); htemptotmomsp->GetXaxis()->SetTitleSize(c_XTitleSize); htemptotmomsp->GetXaxis()->SetTitleFont(c_XTitleFont); htemptotmomsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htemptotmomsp->GetXaxis()->SetLabelFont(c_XLabelFont); htemptotmomsp->GetXaxis()->SetLabelSize(c_XLabelSize); htemptotmomsp->SetFillStyle(1001); htemptotmomsp->SetFillColorAlpha(kBlue, fillcolor); htemptotmomsp->Draw(); htemptotmomsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c36->Update(); TLegend* legtotmomsp = new TLegend(0.25, 0.7, .35, .75); legtotmomsp->SetHeader("Legend"); legtotmomsp->SetNColumns(1); legtotmomsp->AddEntry(htemptotmomsp, "MC", "l"); legtotmomsp->Draw(); c36->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statstotmomsp = (TPaveStats*)htemptotmomsp->GetListOfFunctions()->FindObject("stats"); statstotmomsp->SetTextColor(kBlue); statstotmomsp->SetX1NDC(0.80); statstotmomsp->SetX2NDC(0.98); statstotmomsp->SetY1NDC(0.77); statstotmomsp->SetY2NDC(0.92); statstotmomsp->DrawClone(); gPad->Update(); c36->Print(myplottotmomsp); delete c36; TCanvas *c37 = new TCanvas("c37",canvtitle,1280,1024); ts->Draw(Form("PositionDirection.x >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnameDxsp); ts->SetScanField(0); TH1F *htempdirxsp= (TH1F*)gPad->GetPrimitive("htemp"); htempdirxsp->GetXaxis()->SetTitle(dirxname); htempdirxsp->GetYaxis()->SetTitle(countyname); htempdirxsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempdirxsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempdirxsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempdirxsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempdirxsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempdirxsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempdirxsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempdirxsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempdirxsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempdirxsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempdirxsp->SetFillStyle(1001); htempdirxsp->SetFillColorAlpha(kBlue, fillcolor); htempdirxsp->Draw(); htempdirxsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c37->Update(); TLegend* legdirxsp = new TLegend(0.25, 0.7, .35, .75); legdirxsp->SetHeader("Legend"); legdirxsp->SetNColumns(1); legdirxsp->AddEntry(htempdirxsp, "MC", "l"); legdirxsp->Draw(); c37->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsdirxsp = (TPaveStats*)htempdirxsp->GetListOfFunctions()->FindObject("stats"); statsdirxsp->SetTextColor(kBlue); statsdirxsp->SetX1NDC(0.80); statsdirxsp->SetX2NDC(0.98); statsdirxsp->SetY1NDC(0.77); statsdirxsp->SetY2NDC(0.92); statsdirxsp->DrawClone(); gPad->Update(); c37->Print(myplotdirxsp); delete c37; TCanvas *c38 = new TCanvas("c38",canvtitle,1280,1024); ts->Draw(Form("PositionDirection.y >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnameDysp); ts->SetScanField(0); TH1F *htempdirysp= (TH1F*)gPad->GetPrimitive("htemp"); htempdirysp->GetXaxis()->SetTitle(dirxname); htempdirysp->GetYaxis()->SetTitle(countyname); htempdirysp->GetYaxis()->SetTitleSize(c_YTitleSize); htempdirysp->GetYaxis()->SetTitleFont(c_YTitleFont); htempdirysp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempdirysp->GetYaxis()->SetLabelFont(c_YLabelFont); htempdirysp->GetYaxis()->SetLabelSize(c_YLabelSize); htempdirysp->GetXaxis()->SetTitleSize(c_XTitleSize); htempdirysp->GetXaxis()->SetTitleFont(c_XTitleFont); htempdirysp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempdirysp->GetXaxis()->SetLabelFont(c_XLabelFont); htempdirysp->GetXaxis()->SetLabelSize(c_XLabelSize); htempdirysp->SetFillStyle(1001); htempdirysp->SetFillColorAlpha(kBlue, fillcolor); htempdirysp->Draw(); htempdirysp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c38->Update(); TLegend* legdirysp = new TLegend(0.25, 0.7, .35, .75); legdirysp->SetHeader("Legend"); legdirysp->SetNColumns(1); legdirysp->AddEntry(htempdirysp, "MC", "l"); legdirysp->Draw(); c38->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsdirysp = (TPaveStats*)htempdirysp->GetListOfFunctions()->FindObject("stats"); statsdirysp->SetTextColor(kBlue); statsdirysp->SetX1NDC(0.80); statsdirysp->SetX2NDC(0.98); statsdirysp->SetY1NDC(0.77); statsdirysp->SetY2NDC(0.92); statsdirysp->DrawClone(); gPad->Update(); c38->Print(myplotdirysp); delete c38; TCanvas *c39 = new TCanvas("c39",canvtitle,1280,1024); ts->Draw(Form("PositionDirection.z >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnameDzsp); ts->SetScanField(0); TH1F *htempdirzsp= (TH1F*)gPad->GetPrimitive("htemp"); htempdirzsp->GetXaxis()->SetTitle(dirxname); htempdirzsp->GetYaxis()->SetTitle(countyname); htempdirzsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempdirzsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempdirzsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempdirzsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempdirzsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempdirzsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempdirzsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempdirzsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempdirzsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempdirzsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempdirzsp->SetFillStyle(1001); htempdirzsp->SetFillColorAlpha(kBlue, fillcolor); htempdirzsp->Draw(); htempdirzsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c39->Update(); TLegend* legdirzsp = new TLegend(0.25, 0.7, .35, .75); legdirzsp->SetHeader("Legend"); legdirzsp->SetNColumns(1); legdirzsp->AddEntry(htempdirzsp, "MC", "l"); legdirzsp->Draw(); c39->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsdirzsp = (TPaveStats*)htempdirzsp->GetListOfFunctions()->FindObject("stats"); statsdirzsp->SetTextColor(kBlue); statsdirzsp->SetX1NDC(0.80); statsdirzsp->SetX2NDC(0.98); statsdirzsp->SetY1NDC(0.77); statsdirzsp->SetY2NDC(0.92); statsdirzsp->DrawClone(); gPad->Update(); c39->Print(myplotdirzsp); delete c39; TCanvas *c40 = new TCanvas("c40",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMom.x >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamemomvalxsp); ts->SetScanField(0); TH1F *htempmomvalxsp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomvalxsp->GetXaxis()->SetTitle(momvalxname); htempmomvalxsp->GetYaxis()->SetTitle(countyname); htempmomvalxsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomvalxsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomvalxsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomvalxsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomvalxsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomvalxsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomvalxsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomvalxsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomvalxsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomvalxsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomvalxsp->SetFillStyle(1001); htempmomvalxsp->SetFillColorAlpha(kBlue, fillcolor); htempmomvalxsp->Draw(); htempmomvalxsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c40->Update(); TLegend* legmomvalxsp = new TLegend(0.25, 0.7, .35, .75); legmomvalxsp->SetHeader("Legend"); legmomvalxsp->SetNColumns(1); legmomvalxsp->AddEntry(htempmomvalxsp, "MC", "l"); legmomvalxsp->Draw(); c40->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomvalxsp = (TPaveStats*)htempmomvalxsp->GetListOfFunctions()->FindObject("stats"); statsmomvalxsp->SetTextColor(kBlue); statsmomvalxsp->SetX1NDC(0.80); statsmomvalxsp->SetX2NDC(0.98); statsmomvalxsp->SetY1NDC(0.77); statsmomvalxsp->SetY2NDC(0.92); statsmomvalxsp->DrawClone(); gPad->Update(); c40->Print(myplotmomvalxsp); delete c40; TCanvas *c41 = new TCanvas("c41",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMom.y >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamemomvalysp); ts->SetScanField(0); TH1F *htempmomvalysp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomvalysp->GetXaxis()->SetTitle(momvalxname); htempmomvalysp->GetYaxis()->SetTitle(countyname); htempmomvalysp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomvalysp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomvalysp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomvalysp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomvalysp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomvalysp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomvalysp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomvalysp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomvalysp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomvalysp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomvalysp->SetFillStyle(1001); htempmomvalysp->SetFillColorAlpha(kBlue, fillcolor); htempmomvalysp->Draw(); htempmomvalysp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c41->Update(); TLegend* legmomvalysp = new TLegend(0.25, 0.7, .35, .75); legmomvalysp->SetHeader("Legend"); legmomvalysp->SetNColumns(1); legmomvalysp->AddEntry(htempmomvalysp, "MC", "l"); legmomvalysp->Draw(); c41->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomvalysp = (TPaveStats*)htempmomvalysp->GetListOfFunctions()->FindObject("stats"); statsmomvalysp->SetTextColor(kBlue); statsmomvalysp->SetX1NDC(0.80); statsmomvalysp->SetX2NDC(0.98); statsmomvalysp->SetY1NDC(0.77); statsmomvalysp->SetY2NDC(0.92); statsmomvalysp->DrawClone(); gPad->Update(); c41->Print(myplotmomvalysp); delete c41; TCanvas *c42 = new TCanvas("c42",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleMom.z >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnamemomvalzsp); ts->SetScanField(0); TH1F *htempmomvalzsp= (TH1F*)gPad->GetPrimitive("htemp"); htempmomvalzsp->GetXaxis()->SetTitle(momvalxname); htempmomvalzsp->GetYaxis()->SetTitle(countyname); htempmomvalzsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempmomvalzsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempmomvalzsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempmomvalzsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempmomvalzsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempmomvalzsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempmomvalzsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempmomvalzsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempmomvalzsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempmomvalzsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempmomvalzsp->SetFillStyle(1001); htempmomvalzsp->SetFillColorAlpha(kBlue, fillcolor); htempmomvalzsp->Draw(); htempmomvalzsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c42->Update(); TLegend* legmomvalzsp = new TLegend(0.25, 0.7, .35, .75); legmomvalzsp->SetHeader("Legend"); legmomvalzsp->SetNColumns(1); legmomvalzsp->AddEntry(htempmomvalzsp, "MC", "l"); legmomvalzsp->Draw(); c42->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsmomvalzsp = (TPaveStats*)htempmomvalzsp->GetListOfFunctions()->FindObject("stats"); statsmomvalzsp->SetTextColor(kBlue); statsmomvalzsp->SetX1NDC(0.80); statsmomvalzsp->SetX2NDC(0.98); statsmomvalzsp->SetY1NDC(0.77); statsmomvalzsp->SetY2NDC(0.92); statsmomvalzsp->DrawClone(); gPad->Update(); c42->Print(myplotmomvalzsp); delete c42; TCanvas *c43 = new TCanvas("c43",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleAng.x >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnameangxsp); ts->SetScanField(0); TH1F *htempangxsp= (TH1F*)gPad->GetPrimitive("htemp"); htempangxsp->GetXaxis()->SetTitle(angxname); htempangxsp->GetYaxis()->SetTitle(countyname); htempangxsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempangxsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempangxsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempangxsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempangxsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempangxsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempangxsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempangxsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempangxsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempangxsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempangxsp->SetFillStyle(1001); htempangxsp->SetFillColorAlpha(kBlue, fillcolor); htempangxsp->Draw(); htempangxsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c43->Update(); TLegend* legangxsp = new TLegend(0.25, 0.7, .35, .75); legangxsp->SetHeader("Legend"); legangxsp->SetNColumns(1); legangxsp->AddEntry(htempangxsp, "MC", "l"); legangxsp->Draw(); c43->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsangxsp = (TPaveStats*)htempangxsp->GetListOfFunctions()->FindObject("stats"); statsangxsp->SetTextColor(kBlue); statsangxsp->SetX1NDC(0.80); statsangxsp->SetX2NDC(0.98); statsangxsp->SetY1NDC(0.77); statsangxsp->SetY2NDC(0.92); statsangxsp->DrawClone(); gPad->Update(); c43->Print(myplotangxsp); delete c43; TCanvas *c44 = new TCanvas("c44",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleAng.y >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle(cdnameangysp); ts->SetScanField(0); TH1F *htempangysp= (TH1F*)gPad->GetPrimitive("htemp"); htempangysp->GetXaxis()->SetTitle(angxname); htempangysp->GetYaxis()->SetTitle(countyname); htempangysp->GetYaxis()->SetTitleSize(c_YTitleSize); htempangysp->GetYaxis()->SetTitleFont(c_YTitleFont); htempangysp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempangysp->GetYaxis()->SetLabelFont(c_YLabelFont); htempangysp->GetYaxis()->SetLabelSize(c_YLabelSize); htempangysp->GetXaxis()->SetTitleSize(c_XTitleSize); htempangysp->GetXaxis()->SetTitleFont(c_XTitleFont); htempangysp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempangysp->GetXaxis()->SetLabelFont(c_XLabelFont); htempangysp->GetXaxis()->SetLabelSize(c_XLabelSize); htempangysp->SetFillStyle(1001); htempangysp->SetFillColorAlpha(kBlue, fillcolor); htempangysp->Draw(); htempangysp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c44->Update(); TLegend* legangysp = new TLegend(0.25, 0.7, .35, .75); legangysp->SetHeader("Legend"); legangysp->SetNColumns(1); legangysp->AddEntry(htempangysp, "MC", "l"); legangysp->Draw(); c44->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsangysp = (TPaveStats*)htempangysp->GetListOfFunctions()->FindObject("stats"); statsangysp->SetTextColor(kBlue); statsangysp->SetX1NDC(0.80); statsangysp->SetX2NDC(0.98); statsangysp->SetY1NDC(0.77); statsangysp->SetY2NDC(0.92); statsangysp->DrawClone(); gPad->Update(); c44->Print(myplotangysp); delete c44; TCanvas *c55 = new TCanvas("c55",canvtitle,1280,1024); TH2F *heneangx = new TH2F("heneangx", "", 500, 0., 0.,500, 0.,0.); TString varheneangx = TString::Format("SecondaryParticleKinEn : SecondaryParticleAng.x >> heneangx"); ts->Draw(varheneangx); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn heneangx->SetTitle(cdnameheneangx); heneangx->GetXaxis()->SetTitle(cdXnameheneangxp); heneangx->GetYaxis()->SetTitle(cdYnameheneang); heneangx->GetYaxis()->SetTitleSize(c_YTitleSize); heneangx->GetYaxis()->SetTitleFont(c_YTitleFont); heneangx->GetYaxis()->SetTitleOffset(c_YTitleOffset); heneangx->GetYaxis()->SetLabelFont(c_YLabelFont); heneangx->GetYaxis()->SetLabelSize(c_YLabelSize); heneangx->GetXaxis()->SetTitleSize(c_XTitleSize); heneangx->GetXaxis()->SetTitleFont(c_XTitleFont); heneangx->GetXaxis()->SetTitleOffset(c_XTitleOffset); heneangx->GetXaxis()->SetLabelFont(c_XLabelFont); heneangx->GetXaxis()->SetLabelSize(c_XLabelSize); heneangx->SetMarkerSize(50); //heneangx->Draw("COLZ"); heneangx->Draw("COLZ"); heneangx->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn //TH1 *heneangxcopy = heneangx->DrawCopy("colz"); // creates all axes gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn /* TPaletteAxis * paletteemityypsp = (TPaletteAxis *) heneangxcopy->GetListOfFunctions()->FindObject("palette"); paletteemityypsp->SetX1NDC(0.86); paletteemityypsp->SetX2NDC(0.90); paletteemityypsp->SetY1NDC(0.2); paletteemityypsp->SetY2NDC(0.8);*/ c55->Modified(); c55->Update(); TLegend* legheneangx = new TLegend(0.65, 0.7, .75, .75); legheneangx->SetHeader("Legend"); legheneangx->SetNColumns(1); legheneangx->AddEntry(legheneangx, "MC", "l"); legheneangx->Draw(); gPad->Update(); TPaveStats *statsheneangx = (TPaveStats*)heneangx->GetListOfFunctions()->FindObject("stats"); statsheneangx->SetTextColor(kBlue); statsheneangx->SetX1NDC(0.80); statsheneangx->SetX2NDC(0.98); statsheneangx->SetY1NDC(0.77); statsheneangx->SetY2NDC(0.92); gPad->Update(); c55->Print(myplotheneangx); delete c55; TCanvas *c56 = new TCanvas("c56",canvtitle,1280,1024); TH2F *heneangy = new TH2F("heneangy", "", 500, 0., 0.,500, 0.,0.); TString varheneangy = TString::Format("SecondaryParticleKinEn : SecondaryParticleAng.y >> heneangy"); ts->Draw(varheneangy); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn heneangy->SetTitle(cdnameheneangy); heneangy->GetXaxis()->SetTitle(cdXnameheneangyp); heneangy->GetYaxis()->SetTitle(cdYnameheneang); heneangy->GetYaxis()->SetTitleSize(c_YTitleSize); heneangy->GetYaxis()->SetTitleFont(c_YTitleFont); heneangy->GetYaxis()->SetTitleOffset(c_YTitleOffset); heneangy->GetYaxis()->SetLabelFont(c_YLabelFont); heneangy->GetYaxis()->SetLabelSize(c_YLabelSize); heneangy->GetXaxis()->SetTitleSize(c_XTitleSize); heneangy->GetXaxis()->SetTitleFont(c_XTitleFont); heneangy->GetXaxis()->SetTitleOffset(c_XTitleOffset); heneangy->GetXaxis()->SetLabelFont(c_XLabelFont); heneangy->GetXaxis()->SetLabelSize(c_XLabelSize); heneangy->SetMarkerSize(50); //heneangy->Draw("COLZ"); heneangy->Draw("COLZ"); heneangy->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn //TH1 *heneangycopy = heneangy->DrawCopy("colz"); // creates all axes gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn /* TPaletteAxis * paletteemityypsp = (TPaletteAxis *) heneangycopy->GetListOfFunctions()->FindObject("palette"); paletteemityypsp->SetX1NDC(0.86); paletteemityypsp->SetX2NDC(0.90); paletteemityypsp->SetY1NDC(0.2); paletteemityypsp->SetY2NDC(0.8);*/ c56->Modified(); c56->Update(); TLegend* legheneangy = new TLegend(0.65, 0.7, .75, .75); legheneangy->SetHeader("Legend"); legheneangy->SetNColumns(1); legheneangy->AddEntry(legheneangy, "MC", "l"); legheneangy->Draw(); gPad->Update(); TPaveStats *statsheneangy = (TPaveStats*)heneangy->GetListOfFunctions()->FindObject("stats"); statsheneangy->SetTextColor(kBlue); statsheneangy->SetX1NDC(0.80); statsheneangy->SetX2NDC(0.98); statsheneangy->SetY1NDC(0.77); statsheneangy->SetY2NDC(0.92); gPad->Update(); c56->Print(myplotheneangy); delete c56; /*TCanvas *c57 = new TCanvas("c57",canvtitle,1280,1024); ts->Draw(Form("SecondaryParticleAng.z >> htemp(100, 0., 0.)")); ts->GetHistogram()->SetTitle("z'"); ts->SetScanField(0); TH1F *htempangzsp= (TH1F*)gPad->GetPrimitive("htemp"); htempangzsp->GetXaxis()->SetTitle("z'"); htempangzsp->GetYaxis()->SetTitle(countyname); htempangzsp->GetYaxis()->SetTitleSize(c_YTitleSize); htempangzsp->GetYaxis()->SetTitleFont(c_YTitleFont); htempangzsp->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempangzsp->GetYaxis()->SetLabelFont(c_YLabelFont); htempangzsp->GetYaxis()->SetLabelSize(c_YLabelSize); htempangzsp->GetXaxis()->SetTitleSize(c_XTitleSize); htempangzsp->GetXaxis()->SetTitleFont(c_XTitleFont); htempangzsp->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempangzsp->GetXaxis()->SetLabelFont(c_XLabelFont); htempangzsp->GetXaxis()->SetLabelSize(c_XLabelSize); htempangzsp->SetFillStyle(1001); htempangzsp->SetFillColorAlpha(kBlue, fillcolor); htempangzsp->Draw(); htempangzsp->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c57->Update(); TLegend* legangzsp = new TLegend(0.25, 0.7, .35, .75); legangzsp->SetHeader("Legend"); legangzsp->SetNColumns(1); legangzsp->AddEntry(htempangzsp, "MC", "l"); legangzsp->Draw(); c57->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsangzsp = (TPaveStats*)htempangzsp->GetListOfFunctions()->FindObject("stats"); statsangzsp->SetTextColor(kBlue); statsangzsp->SetX1NDC(0.80); statsangzsp->SetX2NDC(0.98); statsangzsp->SetY1NDC(0.77); statsangzsp->SetY2NDC(0.92); statsangzsp->DrawClone(); gPad->Update(); c57->Print("C:/simulazione/Secondaries/zprime"); delete c57; */ /* TCanvas *c58 = new TCanvas("c58",canvtitle,1280,1024); ts->Draw(Form("TMath::Sqrt(InvariantMass)>> htemp(1000, 105.658, 105.659)")); ts->GetHistogram()->SetTitle("Inariant mass #mu^{#pm}"); ts->SetScanField(0); TH1F *htempinmass= (TH1F*)gPad->GetPrimitive("htemp"); htempinmass->GetXaxis()->SetTitle("Ivnariant mass (MeV)"); htempinmass->GetYaxis()->SetTitle(countyname); htempinmass->GetYaxis()->SetTitleSize(c_YTitleSize); htempinmass->GetYaxis()->SetTitleFont(c_YTitleFont); htempinmass->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempinmass->GetYaxis()->SetLabelFont(c_YLabelFont); htempinmass->GetYaxis()->SetLabelSize(c_YLabelSize); htempinmass->GetXaxis()->SetTitleSize(c_XTitleSize); htempinmass->GetXaxis()->SetTitleFont(c_XTitleFont); htempinmass->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempinmass->GetXaxis()->SetLabelFont(c_XLabelFont); htempinmass->GetXaxis()->SetLabelSize(c_XLabelSize); htempinmass->SetFillStyle(1001); htempinmass->SetFillColorAlpha(kBlue, fillcolor); htempinmass->Draw(); htempinmass->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c58->Update(); TLegend* legangzsp = new TLegend(0.25, 0.7, .35, .75); legangzsp->SetHeader("Legend"); legangzsp->SetNColumns(1); legangzsp->AddEntry(htempinmass, "MC", "l"); legangzsp->Draw(); c58->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statsinvmass = (TPaveStats*)htempinmass->GetListOfFunctions()->FindObject("stats"); statsinvmass->SetTextColor(kBlue); statsinvmass->SetX1NDC(0.80); statsinvmass->SetX2NDC(0.98); statsinvmass->SetY1NDC(0.77); statsinvmass->SetY2NDC(0.92); statsinvmass->DrawClone(); gPad->Update(); c58->Print("C:/simulazione/Secondaries/invmass.pdf"); delete c58; */ TCanvas *c30 = new TCanvas("c30",canvtitle,1280,1024); c30->SetLogy(); TCut cutmin = TString::Format("SecondaryParticleKinEn >= %g", Enemin).Data(); TString henecut = TString::Format("SecondaryParticleKinEn>> htemp(100, 0., 0.)"); ts->Draw(henecut, cutmin ); ts->Draw(henecut, cutmin ); ts->GetHistogram()->SetTitle("Primary e^{+} Kinetic Energy" ); ts->SetScanField(0); TH1F *htempkinenspcut= (TH1F*)gPad->GetPrimitive("htemp"); htempkinenspcut->GetXaxis()->SetTitle(kinenxname); htempkinenspcut->GetYaxis()->SetTitle(countyname); htempkinenspcut->GetYaxis()->SetTitleSize(c_YTitleSize); htempkinenspcut->GetYaxis()->SetTitleFont(c_YTitleFont); htempkinenspcut->GetYaxis()->SetTitleOffset(c_YTitleOffset); htempkinenspcut->GetYaxis()->SetLabelFont(c_YLabelFont); htempkinenspcut->GetYaxis()->SetLabelSize(c_YLabelSize); htempkinenspcut->GetXaxis()->SetTitleSize(c_XTitleSize); htempkinenspcut->GetXaxis()->SetTitleFont(c_XTitleFont); htempkinenspcut->GetXaxis()->SetTitleOffset(c_XTitleOffset); htempkinenspcut->GetXaxis()->SetLabelFont(c_XLabelFont); htempkinenspcut->GetXaxis()->SetLabelSize(c_XLabelSize); htempkinenspcut->SetFillStyle(1001); htempkinenspcut->SetFillColorAlpha(kBlue, fillcolor); htempkinenspcut->Draw(); htempkinenspcut->SetName(htempname); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c30->Update(); TLegend* legkinenspcut = new TLegend(0.25, 0.7, .35, .75); legkinenspcut->SetHeader("Legend"); legkinenspcut->SetNColumns(1); legkinenspcut->AddEntry(htempkinenspcut, "MC", "l"); legkinenspcut->Draw(); c30->Update(); gPad->Modified(); gPad->Update(); TPaveStats *statskinenspcut = (TPaveStats*)htempkinenspcut->GetListOfFunctions()->FindObject("stats"); statskinenspcut->SetTextColor(kBlue); statskinenspcut->SetX1NDC(0.80); statskinenspcut->SetX2NDC(0.98); statskinenspcut->SetY1NDC(0.83); statskinenspcut->SetY2NDC(0.98); //statskinenspcut->AddText(TString::Format("Integral = %g", integral)); statskinenspcut->DrawClone(); gPad->Update(); c30->Print("C:/simulazione/Secondaries/Kinenecut.pdf"); delete c30; } }