#include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TGraph.h" #include "TRandom.h" #include "TFile.h" #include "TTree.h" #include "TPaveStats.h" #include "TPaveLabel.h" #include "TPaletteAxis.h" #include "TLegend.h" #include "TBranch.h" #include "TSystem.h" #include "TLorentzVector.h" #include "TVector3.h" #include "TEventList.h" #include "TGraph.h" #include "THashList.h" #include "TMultiGraph.h" #include "TLine.h" #include "TList.h" #include "TText.h" #include "TLatex.h" #include "TTreeReader.h" #include "TTreeReaderValue.h" #include "TStopwatch.h" #include #include #include #include #include using namespace std; vector fmsgeo(float); void detail_into(){ TCanvas *cc = new TCanvas("cc","cc",1000,1500); gStyle->SetOptDate(0); gStyle->SetLineWidth(1); gStyle->SetLabelSize(0.06,"XY"); gStyle->SetStatFontSize(0.08); gStyle->SetTitleFontSize(0.08); gStyle->SetStatBorderSize(0.0); gStyle->SetPadBorderSize(0); gStyle->SetPadBottomMargin(0.15); gStyle->SetPadTopMargin(0.07); gStyle->SetPadLeftMargin(0.12); gStyle->SetPadRightMargin(0.05); gStyle->SetStatStyle(0); gStyle->SetStatX(0.9); gStyle->SetStatY(0.92); gStyle->SetStatW(0.4); //gStyle->SetOptStat(11); gStyle->SetTitleOffset(0.8,"X"); gStyle->SetTitleOffset(0.8,"Y"); gStyle->SetTitleSize(0.08,"XY"); gStyle->SetTitleAlign(23); gStyle->SetTitleY(1.01); gStyle->SetCanvasPreferGL(kTRUE); gPad->SetFillStyle(0); gPad->SetFrameFillStyle(0); TGaxis::SetMaxDigits(3); cc->Print("detail_into.pdf["); TFile *f; vector eventtype,background; //eventtype.push_back("DY"); eventtype.push_back("QCD"); background.push_back("!(pointSourceMom1==\"Z0\"&&pointSourceMom0==\"Z0\")"); TPaveLabel *title=0; TPad *ct=0; TEventList *elist=0; TH2F *hist=0,*h2=0,*fmsxy=0; vector lines = fmsgeo(0.05); cc->Clear(); cc->cd(); gPad->SetFillStyle(0); title = new TPaveLabel(.10,.95,.90,.99,Form("")); title->Draw(); ct= new TPad("ct","ct",0.0,0.0,1.0,0.95); for(vector::iterator it=eventtype.begin();it!=eventtype.end();it++){ ct->Draw(); cc->cd(); gPad->SetFillStyle(0); title->DrawPaveLabel(.10,.95,.90,.99,Form("%s reconstructed e-/e+ pair tag2017 vertex_z(0,30)",*it)); ct->cd(); gPad->SetFillStyle(0); f = new TFile(Form("./test_pythia6_%sfilter.root",*it)); TTree* electronpair = (TTree*)f->Get("fmsPoint"); electronpair->Draw(">>elist",Form("%s",*background.begin())); elist = (TEventList*)gDirectory->Get("elist"); electronpair->SetEventList(elist); ct->cd(); ct->Clear(); gPad->SetFillStyle(0); ct->Divide(4,4,0,0); #if 1 for(unsigned i=0;i<32;i++){ ct->cd(i%16+1); gPad->SetFillStyle(0); gPad->SetTopMargin(0.01); gPad->SetBottomMargin(0.07); if(i%4==0)gPad->SetLeftMargin(0.18); else gPad->SetLeftMargin(0.08); gPad->SetRightMargin(0.02); electronpair->Draw("pointY:pointX>>pair(55,-110,110,55,-110,110)","pointE>20","",1,elist->GetEntry(i)); electronpair->Draw("pointY:pointX>>hist2d(55,-110,110,55,-110,110)","","cont",1,elist->GetEntry(i)); hist = (TH2F*)gDirectory->Get("hist2d"); h2 = (TH2F*)gDirectory->Get("pair"); hist->SetNameTitle(Form(""),Form("")); h2->SetNameTitle(Form(""),Form("")); hist->SetStats(0); hist->Draw("cont"); h2->SetMarkerStyle(24); h2->SetMarkerColor(kRed); h2->SetMarkerSize(1.2); h2->Draw("same"); for(vector::iterator ll=lines.begin();ll!=lines.end();ll++){ ll->Draw("same"); } if(i==15||i==31){ cc->Print("detail_into.pdf"); } } #endif } cc->Print("detail_into.pdf]"); } vector fmsgeo(float alpha=0.7){ TFile *f1 = new TFile(Form("./fmsgeo.root")); auto geofms = (TTree*)f1->Get("fmsgeo"); float fmsx, fmsy, fmsdx, fmsdy; geofms->SetBranchAddress("fmsx",&fmsx); geofms->SetBranchAddress("fmsy",&fmsy); geofms->SetBranchAddress("fmsdx",&fmsdx); geofms->SetBranchAddress("fmsdy",&fmsdy); TLine *l = new TLine(),*ll=0; vector lines; for(int i=0;iGetEntries();i++){ geofms->GetEntry(i); if(fmsdx>5.0)l->SetLineColorAlpha(kBlack,alpha); else l->SetLineColorAlpha(kGreen+4,alpha); ll = l->DrawLine(fmsx-fmsdx/2.0,fmsy-fmsdy/2.0,fmsx-fmsdx/2.0,fmsy+fmsdy/2.0); lines.push_back(*ll); ll = l->DrawLine(fmsx+fmsdx/2.0,fmsy-fmsdy/2.0,fmsx+fmsdx/2.0,fmsy+fmsdy/2.0); lines.push_back(*ll); ll = l->DrawLine(fmsx-fmsdx/2.0,fmsy-fmsdy/2.0,fmsx+fmsdx/2.0,fmsy-fmsdy/2.0); lines.push_back(*ll); ll = l->DrawLine(fmsx-fmsdx/2.0,fmsy+fmsdy/2.0,fmsx+fmsdx/2.0,fmsy+fmsdy/2.0); lines.push_back(*ll); } delete l,ll; f1->Close(); delete f1; return lines; }