TH2F* InterpolateThisHistogram(TH2F *hold/*, TH2F* hnew*/){ float binsize = hold->GetXaxis()->GetBinWidth(1)/2.; TString name = hold->GetName(); name.ReplaceAll("Org",""); TGraph2D *g = new TGraph2D(hold); //cout << g->GetXmax() << " " << g->GetXmin() << " " << g->GetYmax() << " " << g->GetYmin() << " " << binsize << endl; g->SetNpx(int(g->GetXmax()-g->GetXmin())/binsize); g->SetNpy(int(g->GetYmax()-g->GetYmin())/binsize); TH2F *hnew = (TH2F*)g->GetHistogram(); //TH2F *htemp = (TH2F*)hnew->Clone(name); //name.ReplaceAll("YXZ",""); TH2F *h = new TH2F(name.Data(),hold->GetTitle(),hnew->GetNbinsX(),g->GetXmin()-binsize,g->GetXmax()-binsize,hnew->GetNbinsY(),g->GetYmin()-binsize,g->GetYmax()-binsize); for(unsigned int x = 1; x<=hnew->GetNbinsX(); ++x){ for(unsigned int y = 1; y<=hnew->GetNbinsY(); ++y){ h->SetBinContent(x,y,hnew->GetBinContent(x,y)); } } delete g; return h; }
TH2D grMu(TTree *tree, double quantileExpected){ TGraph2D *gr = new TGraph2D(); float X, Y, qE; double limit; std::string x = "trackedParam_proc_scaling_muV"; std::string y = "trackedParam_proc_scaling_muF"; tree->SetBranchAddress(Form("%s",x.c_str()),&X); tree->SetBranchAddress(Form("%s",y.c_str()),&Y); tree->SetBranchAddress("quantileExpected",&qE); tree->SetBranchAddress("limit",&limit); int pt = 0; for (int i=0;i<tree->GetEntries();i++){ tree->GetEntry(i); if (TMath::Abs(qE-quantileExpected)>0.001) continue; gr->SetPoint(pt,X,Y,limit); pt++; //std::cout << " Lim " << X << ", " << Y << ", " << limit << std::endl; } gr->Draw("colz"); TH2D * expected = (TH2D*) gr->GetHistogram(); expected->SetTitle(""); expected->GetZaxis()->SetTitleOffset(1.2); expected->GetYaxis()->SetTitle("#it{#mu}_{ggH}"); expected->GetXaxis()->SetTitle("#it{#mu}_{qqH,VH}"); expected->GetZaxis()->SetTitle("B(H #rightarrow inv.) - 95% CL upper limit"); expected->GetXaxis()->SetRangeUser(MUVMIN,MUVMAX); expected->GetYaxis()->SetRangeUser(MUFMIN,MUFMAX); //expected->GetXaxis()->SetLimits(MUVMIN,MUVMAX); //expected->GetYaxis()->SetLimits(MUFMIN,MUFMAX); expected->SetMaximum(0.6); expected->SetMinimum(0.05); return *expected; }
void CommandMSUGRA(TString plotName_,Int_t tanBeta_, Bool_t plotLO_){ gROOT->SetStyle("CMS");//jmt specific gROOT->ForceStyle(); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetPalette(1); gStyle->SetTextFont(42); gStyle->SetFrameBorderMode(0); //convert tanb value to string std::stringstream tmp; tmp << tanBeta_; TString tanb( tmp.str() ); // Output file std::cout << " create " << plotName_ << std::endl; TFile* output = new TFile( plotName_, "RECREATE" ); if ( !output || output->IsZombie() ) { std::cout << " zombie alarm output is a zombie " << std::endl; } //set old exclusion Limits TGraph* LEP_ch = set_lep_ch(tanBeta_); TGraph* LEP_sl = set_lep_sl(tanBeta_);//slepton curve TGraph* TEV_sg_cdf = set_tev_sg_cdf(tanBeta_);//squark gluino cdf TGraph* TEV_sg_d0 = set_tev_sg_d0(tanBeta_);//squark gluino d0 // TGraph* TEV_tlp_cdf = set_tev_tlp_cdf(tanBeta_);//trilepton cdf // TGraph* TEV_tlp_d0 = set_tev_tlp_d0(tanBeta_);//trilepton d0 TGraph* stau = set_tev_stau(tanBeta_);//stau TGraph* NoEWSB = set_NoEWSB(tanBeta_); TGraph* TEV_sn_d0_1 = set_sneutrino_d0_1(tanBeta_); TGraph* TEV_sn_d0_2 = set_sneutrino_d0_2(tanBeta_); int nPoints = nSusyGridPoints(); double m0[nPoints],m12[nPoints],squarkMass[nPoints],gluinoMass[nPoints]; susyGrid(m0,m12,squarkMass,gluinoMass); TGraph2D* squarkMasses = new TGraph2D("squarkMasses","",nPoints,m0,m12,squarkMass); TGraph2D* gluinoMasses = new TGraph2D("gluinoMasses","",nPoints,m0,m12,gluinoMass); TH2D* gluinoMassPlot = gluinoMasses->GetHistogram(); TH2D* squarkMassPlot = squarkMasses->GetHistogram(); //constant ssqquark and gluino lines TF1* lnsq[15]; TF1* lngl[15]; TGraph* lnsq_40[15]; TGraph* lngl_40[15]; TLatex* sq_text[15]; TLatex* gl_text[15]; TLatex* sq_40_text[15]; TLatex* gl_40_text[15]; for(int i = 1; i < 15; i++){ //lnsq[i] = constant_squark(tanBeta_,i); //sq_text[i] = constant_squark_text(i,*lnsq[i],tanBeta_); //lngl[i] = constant_gluino(tanBeta_,i); //gl_text[i] = constant_gluino_text(i,*lngl[i]); lnsq_40[i] = constant_mass(i*250,squarkMasses); lngl_40[i] = constant_mass(i*250,gluinoMasses); sq_40_text[i] = constant_squark_text_tanBeta40(i*250,lnsq_40[i]); gl_40_text[i] = constant_gluino_text_tanBeta40(i*250,lngl_40[i]);; } //Legends TLegend* legst = makeStauLegend(0.05,tanBeta_); TLegend* legNoEWSB = makeNoEWSBLegend(0.05,tanBeta_); TLegend* legexp = makeExpLegend( *TEV_sg_cdf,*TEV_sg_d0,*LEP_ch,*LEP_sl,*TEV_sn_d0_1,0.035,tanBeta_); //make Canvas TCanvas* cvsSys = new TCanvas("cvsnm","cvsnm",0,0,800,600); gStyle->SetOptTitle(0); cvsSys->SetFillColor(0); cvsSys->GetPad(0)->SetRightMargin(0.07); cvsSys->Range(-120.5298,26.16437,736.0927,750); // cvsSys->Range(-50.5298,26.16437,736.0927,500); cvsSys->SetFillColor(0); cvsSys->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderSize(2); cvsSys->GetPad(0)->SetLeftMargin(0.1407035); cvsSys->GetPad(0)->SetTopMargin(0.08); cvsSys->GetPad(0)->SetBottomMargin(0.13); cvsSys->SetTitle("tan#beta="+tanb); output->cd(); //and now the exclusion limits TGraph* SSdilep; TGraphErrors* OSdilep; TGraphErrors* RA1; TGraphErrors* RA1_old; TGraphErrors* RA5_old; TGraphErrors* RA6_old; TGraph* RA2b_1b_loose; TGraph* RA2b_1b_tight; TGraph* RA2b_2b_loose; TGraph* RA2b_2b_tight; TGraph* RA2b_1b_loose_exp; TGraph* RA2b_1b_tight_exp; TGraph* RA2b_2b_loose_exp; TGraph* RA2b_2b_tight_exp; TGraph* RA2b_1b_loose_exp_p; TGraph* RA2b_1b_tight_exp_p; TGraph* RA2b_2b_loose_exp_p; TGraph* RA2b_2b_tight_exp_p; TGraph* RA2b_1b_loose_exp_m; TGraph* RA2b_1b_tight_exp_m; TGraph* RA2b_2b_loose_exp_m; TGraph* RA2b_2b_tight_exp_m; TGraph* RA2b_1b_loose_shade; TGraph* RA2b_1b_tight_shade; TGraph* RA2b_2b_loose_shade; TGraph* RA2b_2b_tight_shade; TSpline3* RA1_tb40 =getCLs1080ObsNLOtb40(); if (tanBeta_ == 10) { SSdilep = SSdilep_NLO(); OSdilep = OSdilep_NLO(); RA1 = RA1_NLO(); RA1_old = getRA1Observed_NLO_tanBeta10(); RA5_old = getRA5Observed_NLO_tanBeta10(); RA6_old = getRA6Observed_NLO_tanBeta10(); } if(tanBeta_ == 40) { // RA2b_1b_loose = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge1b-loose.root", "hsusyscanExcluded"); // RA2b_2b_loose = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge2b-loose.root", "hsusyscanExcluded"); // RA2b_1b_tight = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge1b-tight.root", "hsusyscanExcluded"); // RA2b_2b_tight = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge2b-tight.root", "hsusyscanExcluded"); // RA2b_1b_loose = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge1bloose.root", "hcls"); // RA2b_2b_loose = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge2bloose.root", "hcls"); // RA2b_1b_tight = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge1btight.root", "hcls"); // RA2b_2b_tight = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge2btight.root", "hcls"); /* TString ra2bfile= "RA2b_tb40_exclusion.25Sep.root"; RA2b_1b_loose = RA2b_limit(ra2bfile,"curve4_ge1bloose"); RA2b_1b_tight = RA2b_limit(ra2bfile,"curve4_ge1btight"); RA2b_2b_loose = RA2b_limit(ra2bfile,"curve4_ge2bloose"); RA2b_2b_tight = RA2b_limit(ra2bfile,"curve4_ge2btight"); RA2b_1b_loose_exp = RA2b_limit(ra2bfile,"curve4_1bloose_exp"); RA2b_1b_tight_exp = RA2b_limit(ra2bfile,"curve4_1btight_exp"); RA2b_2b_loose_exp = RA2b_limit(ra2bfile,"curve4_2bloose_exp"); RA2b_2b_tight_exp = RA2b_limit(ra2bfile,"curve4_2btight_exp"); RA2b_1b_loose_exp_p = RA2b_limit(ra2bfile,"curve4_1bloose_exp_plus"); RA2b_1b_tight_exp_p = RA2b_limit(ra2bfile,"curve4_1btight_exp_plus"); RA2b_2b_loose_exp_p = RA2b_limit(ra2bfile,"curve4_2bloose_exp_plus"); RA2b_2b_tight_exp_p = RA2b_limit(ra2bfile,"curve4_2btight_exp_plus"); RA2b_1b_loose_exp_m = RA2b_limit(ra2bfile,"curve4_1bloose_exp_minus"); RA2b_1b_tight_exp_m = RA2b_limit(ra2bfile,"curve4_1btight_exp_minus"); RA2b_2b_loose_exp_m = RA2b_limit(ra2bfile,"curve4_2bloose_exp_minus"); RA2b_2b_tight_exp_m = RA2b_limit(ra2bfile,"curve4_2btight_exp_minus"); */ RA2b_1b_loose = get_RA2b_1bloose(); RA2b_1b_tight = get_RA2b_1btight(); RA2b_2b_loose = get_RA2b_2bloose(); RA2b_2b_tight = get_RA2b_2btight(); RA2b_1b_loose_exp = get_RA2b_1bloose_exp(); RA2b_1b_tight_exp = get_RA2b_1btight_exp(); RA2b_2b_loose_exp = get_RA2b_2bloose_exp(); RA2b_2b_tight_exp = get_RA2b_2btight_exp(); RA2b_1b_loose_exp_p = get_RA2b_1bloose_exp_p(); RA2b_1b_tight_exp_p = get_RA2b_1btight_exp_p(); RA2b_2b_loose_exp_p = get_RA2b_2bloose_exp_p(); RA2b_2b_tight_exp_p = get_RA2b_2btight_exp_p(); RA2b_1b_loose_exp_m = get_RA2b_1bloose_exp_m(); RA2b_1b_tight_exp_m = get_RA2b_1btight_exp_m(); RA2b_2b_loose_exp_m = get_RA2b_2bloose_exp_m(); RA2b_2b_tight_exp_m = get_RA2b_2btight_exp_m(); cout<<"Getting the shaded regions"<<endl; RA2b_1b_loose_shade = getShadedRegion(RA2b_1b_loose_exp_p,RA2b_1b_loose_exp_m); RA2b_1b_tight_shade = getShadedRegion(RA2b_1b_tight_exp_p,RA2b_1b_tight_exp_m); RA2b_2b_loose_shade = getShadedRegion(RA2b_2b_loose_exp_p,RA2b_2b_loose_exp_m); RA2b_2b_tight_shade = getShadedRegion(RA2b_2b_tight_exp_p,RA2b_2b_tight_exp_m); cout<<"DONE Getting the shaded regions"<<endl; } double m0min = 0; if (tanBeta_ == 40) m0min=400; TH2D* hist = new TH2D("h","h",100,m0min,2000,100,120,700); hist->Draw(); hist->GetXaxis()->SetTitle("m_{0} [GeV]"); hist->GetYaxis()->SetTitle("m_{1/2} [GeV]"); hist->GetXaxis()->SetTitleOffset(.9); hist->GetXaxis()->SetTitleSize(0.06); hist->GetYaxis()->SetTitleOffset(1.0); hist->GetYaxis()->SetTitleSize(0.06); hist->GetXaxis()->SetNdivisions(506); // if (tanBeta_ == 50) hist->GetXaxis()->SetNdivisions(504); hist->GetYaxis()->SetNdivisions(506); int col[]={2,3,4}; //SSdilep->SetLineColor(kGreen+2); //SSdilep->SetLineStyle(1); //SSdilep->SetLineWidth(3); // //OSdilep->SetLineColor(kCyan+2); //OSdilep->SetLineStyle(1); //OSdilep->SetLineWidth(3); // //RA1->SetLineColor(kRed+2); //RA1->SetLineStyle(1); //RA1->SetLineWidth(3); RA1_tb40->SetLineColor(kBlack); RA1_tb40->SetLineStyle(7); RA1_tb40->SetLineWidth(3); RA1_tb40->SetName("RA1_tb40"); // //TSpline3 *sRA1 = new TSpline3("sRA1",RA1_old); //sRA1->SetLineColor(kRed+2); ////sRA1->SetLineStyle(5); //sRA1->SetLineStyle(2); //sRA1->SetLineWidth(3); // //RA5_old->SetLineColor(kGreen+2); ////RA5_old->SetLineStyle(5); //RA5_old->SetLineStyle(2); //RA5_old->SetLineWidth(3); // //RA6_old->SetLineColor(kCyan+2); ////RA6_old->SetLineStyle(1); //RA6_old->SetLineStyle(2); //RA6_old->SetLineWidth(3); if (RA2bmode.Contains("all")) { RA2b_1b_loose->SetLineColor(kRed+2); RA2b_1b_loose->SetLineStyle(2); RA2b_1b_loose->SetLineWidth(3); RA2b_1b_tight->SetLineColor(kRed+2); RA2b_1b_tight->SetLineStyle(1); RA2b_1b_tight->SetLineWidth(3); RA2b_2b_loose->SetLineColor(kGreen+2); RA2b_2b_loose->SetLineStyle(2); RA2b_2b_loose->SetLineWidth(3); RA2b_2b_tight->SetLineColor(kGreen+2); RA2b_2b_tight->SetLineStyle(1); RA2b_2b_tight->SetLineWidth(3); } else { RA2b_1b_loose->SetLineColor(kRed); RA2b_1b_loose->SetLineStyle(1); RA2b_1b_loose->SetLineWidth(3); RA2b_1b_tight->SetLineColor(kRed); RA2b_1b_tight->SetLineStyle(1); RA2b_1b_tight->SetLineWidth(3); RA2b_2b_loose->SetLineColor(kRed); RA2b_2b_loose->SetLineStyle(1); RA2b_2b_loose->SetLineWidth(3); RA2b_2b_tight->SetLineColor(kRed); RA2b_2b_tight->SetLineStyle(1); RA2b_2b_tight->SetLineWidth(3); RA2b_1b_loose_exp->SetLineColor(kBlue); RA2b_2b_loose_exp->SetLineColor(kBlue); RA2b_1b_tight_exp->SetLineColor(kBlue); RA2b_2b_tight_exp->SetLineColor(kBlue); RA2b_1b_loose_exp->SetLineStyle(5); RA2b_2b_loose_exp->SetLineStyle(5); RA2b_1b_tight_exp->SetLineStyle(5); RA2b_2b_tight_exp->SetLineStyle(5); RA2b_1b_loose_exp->SetLineWidth(3); RA2b_2b_loose_exp->SetLineWidth(3); RA2b_1b_tight_exp->SetLineWidth(3); RA2b_2b_tight_exp->SetLineWidth(3); int acolor=kCyan+2; RA2b_1b_loose_exp_p->SetLineColor(acolor); RA2b_2b_loose_exp_p->SetLineColor(acolor); RA2b_1b_tight_exp_p->SetLineColor(acolor); RA2b_2b_tight_exp_p->SetLineColor(acolor); RA2b_1b_loose_exp_p->SetLineStyle(1); RA2b_2b_loose_exp_p->SetLineStyle(1); RA2b_1b_tight_exp_p->SetLineStyle(1); RA2b_2b_tight_exp_p->SetLineStyle(1); RA2b_1b_loose_exp_p->SetLineWidth(3); RA2b_2b_loose_exp_p->SetLineWidth(3); RA2b_1b_tight_exp_p->SetLineWidth(3); RA2b_2b_tight_exp_p->SetLineWidth(3); RA2b_1b_loose_exp_m->SetLineColor(acolor); RA2b_2b_loose_exp_m->SetLineColor(acolor); RA2b_1b_tight_exp_m->SetLineColor(acolor); RA2b_2b_tight_exp_m->SetLineColor(acolor); RA2b_1b_loose_exp_m->SetLineStyle(1); RA2b_2b_loose_exp_m->SetLineStyle(1); RA2b_1b_tight_exp_m->SetLineStyle(1); RA2b_2b_tight_exp_m->SetLineStyle(1); RA2b_1b_loose_exp_m->SetLineWidth(3); RA2b_2b_loose_exp_m->SetLineWidth(3); RA2b_1b_tight_exp_m->SetLineWidth(3); RA2b_2b_tight_exp_m->SetLineWidth(3); RA2b_1b_tight_shade->SetFillStyle(fillstyle); RA2b_1b_tight_shade->SetFillColor(acolor); RA2b_1b_loose_shade->SetFillStyle(fillstyle); RA2b_1b_loose_shade->SetFillColor(acolor); RA2b_2b_tight_shade->SetFillStyle(fillstyle); RA2b_2b_tight_shade->SetFillColor(acolor); RA2b_2b_loose_shade->SetFillStyle(fillstyle); RA2b_2b_loose_shade->SetFillColor(acolor); } TLegend* myleg; float leg_x1=0.39+0.23; float leg_y1=0.65+0.05; float leg_x2= 0.55+0.25; float leg_y2= 0.84+0.05; if (RA2bmode.Contains("all")) { leg_y1 -= 0.1; } if( plotLO_ ) myleg = new TLegend(0.3,0.65,0.65,0.8,NULL,"brNDC"); else myleg = new TLegend(leg_x1,leg_y1,leg_x2,leg_y2,NULL,"brNDC"); myleg->SetFillColor(0); myleg->SetShadowColor(0); myleg->SetTextSize(0.04); myleg->SetBorderSize(0); TLegendEntry *entry=0; // entry= myleg->AddEntry("ge1bLoose","LEP2 #tilde{#chi}_{1}^{#pm}","f"); // entry->SetFillColor(3); // entry->SetLineColor(3); // entry->SetFillStyle(1001); if (RA2bmode.Contains("all")) { entry= myleg->AddEntry("ge1bLoose","#geq 1b Loose","l"); entry->SetLineColor(1); entry->SetLineStyle(2); entry->SetLineWidth(3); entry->SetLineColor(kRed+2); entry->SetTextColor(kRed+2); entry=myleg->AddEntry("ge2bLoose","#geq 2b Loose","l"); entry->SetLineColor(1); entry->SetLineStyle(2); entry->SetLineWidth(3); entry->SetLineColor(kGreen+2); entry->SetTextColor(kGreen+2); entry=myleg->AddEntry("ge1bTight","#geq 1b Tight","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kRed+2); entry->SetTextColor(kRed+2); entry=myleg->AddEntry("ge2bTight","#geq 2b Tight","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kGreen+2); entry->SetTextColor(kGreen+2); } else if (RA2bmode.Contains("ge")) { entry=myleg->AddEntry("ge1bTight","Observed Limit","l"); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kRed); entry->SetTextColor(kBlack); entry=myleg->AddEntry("ge1bTight_exp","Expected Limit #pm 1#sigma","lf"); entry->SetFillStyle (fillstyle); entry->SetFillColor (kCyan+2); entry->SetLineStyle(5); entry->SetLineWidth(3); entry->SetLineColor(kBlue); entry->SetTextColor(kBlack); } if (RA2bmode=="allPlusRA1") { entry=myleg->AddEntry("RA1_tb40","CMS #alpha_{T}","l"); entry->SetLineColor(kBlack); entry->SetLineStyle(7); entry->SetLineWidth(3); entry->SetTextColor(kBlack); } //constant squark and gluino mass contours for (int it=2;it<9;it++) { if(it<7){ if(lngl_40[it]!=0)lngl_40[it]->Draw("samec"); if(gl_40_text[it]!=0)gl_40_text[it]->Draw(); } if(lnsq_40[it]!=0)lnsq_40[it]->Draw("samec"); if(it<6){ if(sq_40_text[it]!=0)sq_40_text[it]->Draw(); } } //SSdilep->Draw("samec"); //OSdilep->Draw("samec"); //RA1->Draw("samec"); // //sRA1->Draw("same"); //RA5_old->Draw("c same"); //RA6_old->Draw("c same"); TString drawopt="samel"; //default choice if (RA2bmode.Contains("all")) RA2b_1b_loose->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_2b_loose->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_1b_tight->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_2b_tight->Draw(drawopt); if (RA2bmode=="allPlusRA1") RA1_tb40->Draw(drawopt); if (RA2bmode=="ge1btight") { RA2b_1b_tight_shade->Draw("f"); RA2b_1b_tight_exp_p->Draw(drawopt); RA2b_1b_tight_exp_m->Draw(drawopt); RA2b_1b_tight_exp->Draw(drawopt); RA2b_1b_tight->Draw(drawopt); } else if (RA2bmode=="ge1bloose") { RA2b_1b_loose_shade->Draw("f"); RA2b_1b_loose_exp_p->Draw(drawopt); RA2b_1b_loose_exp_m->Draw(drawopt); RA2b_1b_loose_exp->Draw(drawopt); RA2b_1b_loose->Draw(drawopt); } else if (RA2bmode=="ge2bloose") { RA2b_2b_loose_shade->Draw("f"); RA2b_2b_loose_exp_p->Draw(drawopt); RA2b_2b_loose_exp_m->Draw(drawopt); RA2b_2b_loose_exp->Draw(drawopt); RA2b_2b_loose->Draw(drawopt); } else if (RA2bmode=="ge2btight") { RA2b_2b_tight_shade->Draw("f"); RA2b_2b_tight_exp_p->Draw(drawopt); RA2b_2b_tight_exp_m->Draw(drawopt); RA2b_2b_tight_exp->Draw(drawopt); RA2b_2b_tight->Draw(drawopt); } // // //TLatex* RA1label = new TLatex(670,430.,"#alpha_{T}"); ////TLatex* RA1label = new TLatex(80,288.,"#alpha_{T}"); //RA1label->SetTextFont(42); //RA1label->SetTextSize(0.05); //RA1label->SetTextColor(kRed+2); //RA1label->Draw("same"); TLatex* RA2blabel_2b=0; TLatex* RA2blabel_1b=0; if (false) { RA2blabel_2b = new TLatex(1150,330.,"#geq 2 b-tags"); RA2blabel_2b->SetTextFont(42); RA2blabel_2b->SetTextSize(0.05); RA2blabel_2b->SetTextColor(kGreen+2); RA2blabel_2b->Draw("same"); RA2blabel_1b = new TLatex(1150,430.,"#geq 1 b-tags"); RA2blabel_1b->SetTextFont(42); RA2blabel_1b->SetTextSize(0.05); RA2blabel_1b->SetTextColor(kRed+2); RA2blabel_1b->Draw("same"); } // //TLatex* RA5label = new TLatex(400,370.,"SS Dilepton"); //RA5label->SetTextFont(42); ////RA5label->SetTextAngle(20); //RA5label->SetTextSize(0.04); //RA5label->SetTextColor(kGreen+2); //RA5label->Draw("same"); // //TLatex* RA6label = new TLatex(650,215.,"OS Dilepton"); //RA6label->SetTextFont(42); ////RA6label->SetTextAngle(8); //RA6label->SetTextSize(0.04); //RA6label->SetTextColor(kCyan+2); //RA6label->Draw("same"); //exclusion limits previous experiments if(tanBeta_ == 3){ TEV_sn_d0_1->Draw("fsame"); TEV_sn_d0_2->Draw("fsame"); } // LEP_ch->Draw("fsame"); if (tanBeta_ != 40) LEP_sl->Draw("fsame"); //remove CDF/D0 excluded regions // TEV_sg_cdf->Draw("fsame"); // TEV_sg_d0->Draw("same"); // TEV_sg_d0->Draw("fsame"); //other labels Double_t xpos = 0; Double_t xposi = 0; Double_t ypos = 0; if(tanBeta_ == 40) xposi = 180+160; if(tanBeta_ == 40) xpos = 400;//240; if(tanBeta_ == 40) ypos = -10; //TLatex* lumilabel = new TLatex(750 +xposi + 100,767.-154,"#sqrt{s} = 7 TeV, #scale[0.65]{#int}Ldt = 0.98 fb^{-1}"); TLatex* lumilabel = new TLatex(925+xpos-50,767.-154+105,"#sqrt{s} = 7 TeV, L_{int} = 1.1 fb^{-1}"); TLatex* integral_symbol = new TLatex(1287 +xposi + 100-85,767.-145+95,"#int"); lumilabel->SetTextSize(0.05); integral_symbol->SetTextSize(0.03); lumilabel->Draw("same"); // integral_symbol->Draw("same"); TLatex* cmslabel = new TLatex(10.+xpos,767.-154+105,"CMS Preliminary"); cmslabel->SetTextSize(0.05); cmslabel->Draw("same"); TString text_tanBeta; text_tanBeta = "tan#beta = "+tanb+", A_{0} = -500 GeV, #mu > 0"; TLatex* cmssmpars = new TLatex(/*530.+xpos,690.+ypos-130*/150+xpos,660,text_tanBeta); cmssmpars->SetTextSize(0.04); cmssmpars->Draw("same"); TLatex* lep_chargino = new TLatex(250,135,"LEP2 #tilde{#chi}_{1}^{#pm}"); lep_chargino->SetTextSize(0.03); lep_chargino->SetTextFont(42); // lep_chargino->Draw("same"); TLatex* lep_slepton = new TLatex(26,190,"LEP2 #tilde{#font[12]{l}}^{#pm}"); lep_slepton->SetTextSize(0.03); lep_slepton->SetTextAngle(-83); lep_slepton->SetTextFont(42); // lep_slepton->Draw("same"); //LM points TMarker* LM0 = new TMarker(200.,160.,20); TMarker* LM1 = new TMarker(60.,250.,20); TMarker* LM3 = new TMarker(330.,240.,20); TMarker* LM6 = new TMarker(80.,400.,20); LM0->SetMarkerSize(1.2); LM1->SetMarkerSize(1.2); TLatex* tLM0 = new TLatex(205.,160.," LM0"); tLM0->SetTextSize(0.035); TLatex* tLM1 = new TLatex(80.,245.,"LM1"); tLM1->SetTextSize(0.035); //TLatex* tLM3 = new TLatex(350.,235.,"LM3 (tan#beta=20)"); TLatex* tLM3 = new TLatex(350.,235.,"LM3"); tLM3->SetTextSize(0.035); TLatex* tLM6 = new TLatex(100.,395.,"LM6"); tLM6->SetTextSize(0.035); // if (tanBeta_ != 50){ // LM0->Draw("same"); // tLM0->Draw("same"); // LM1->Draw("same"); // tLM1->Draw("same"); // } /* if (tanBeta_ == 10){ LM1->Draw("same"); tLM1->Draw("same"); LM3->Draw("same"); tLM3->Draw("same"); LM6->Draw("same"); tLM6->Draw("same"); } */ //stau=LSP contour stau->Draw("fsame"); // NoEWSB->Draw("fsame"); //legends // legexp->Draw(); // legst->Draw(); //legNoEWSB->Draw(); myleg->Draw(); hist->Draw("sameaxis"); cvsSys->RedrawAxis(); cvsSys->Update(); cvsSys->Write(); if( plotLO_ ){ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.png"); }else{ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".eps"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".png"); } output->Write(); //output->Close(); //delete output; }
int main(int argc , char* argv[]){ //Program Options po::options_description desc("Allowed Options"); desc.add_options() ("help,h", "Produce this help message") ("startwl,s",po::value<double>(),"Set the start Wavelength for the Analysis") ("stopwl,p",po::value<double>(),"Set the stop Wavelength for the Analysis") ("non-interactive,n","Runs the program in Noninteractive mode. It quits when it's finished") ("version,v","Prints Version") ; po::variables_map vm; po::store(po::parse_command_line(argc,argv,desc),vm); po::notify(vm); if (vm.count("help")) { std::cout << desc<< std::endl; return 3; } if (vm.count("version")) { std::cout << "VCSEL Laser Analysis Version " << _VERSION << std::endl; std::cout << "Using ROOT version " << _ROOT_VERSION << " and Boost version " << _BOOST_VERSION << std::endl; return 0; } if (argc < 4) { std::cout << desc; return 2; } double startwl, stopwl; startwl = 842.; stopwl = 860.; bool run = true; if (vm.count("startwl")) { startwl = vm["startwl"].as<double>(); NUM_ARGS +=2; } if (vm.count("stopwl")) { double tmp = vm["stopwl"].as<double>(); stopwl =tmp; NUM_ARGS +=2; } if (vm.count("non-interactive")) { run = false; NUM_ARGS++; } //checking filetypes must be txt, csv or CSV if (!check_extensions(argc, argv)) { return 1; } std::cout <<"startwl: "<< startwl << '\t' << "stopwl: " << stopwl << std::endl; Double_t max = -210; Double_t maxwl = 0; int _argc = argc; TApplication *t = new TApplication("big",&_argc,argv); std::cout << "Running with boost and ROOT" <<std::endl; std::vector<double> _x,_y; Double_t x[LINES], y[LINES], _inta[LINES], _intb[LINES]; Double_t *cmp_int = new Double_t[argc]; Double_t *argc_ary = new Double_t[argc]; Double_t *cmp_int_root = new Double_t[argc]; Double_t *asymmety_ary = new Double_t[argc]; Double_t *width_ary = new Double_t [argc]; TGraph2D *gr = new TGraph2D(LINES*(argc-1)); //Setting up canvas for plot of all sectrums (is it called spectrums? ;) ) TCanvas *c1 = new TCanvas("All Plots","All Plots",10,10,3000,1500); TH1F *integral_hist = new TH1F("Asymmerty", "Asymmetry", 100,0, 100); if(!(argc % ROWS)){ c1->Divide(argc/ROWS,ROWS); }else{ c1->Divide(argc/ROWS+(argc %ROWS -1),ROWS); } for (Int_t i = NUM_ARGS +1; i < argc ; i++){ try{ max = -211; maxwl = 0; argc_ary[i] = i-NUM_ARGS; std::ifstream in; in.seekg(0, std::ios::beg); // voodoo keep this; char **arg1 = t->Argv() ; std::string tmp = arg1[i]; in.open(tmp.c_str()); std::cout<< "file: " << tmp << std::endl; std::string line; int cline = 0; std::vector<double> a,b, inta, intb; //reading file while(getline(in,line)){ read_file(line, a, b, inta, intb); cline++; } if (cline < LINES){ for(int i = cline ; i < LINES ; i++){ a.push_back(100); b.push_back(-70); } } std::cout<< "\n\ncline: " << cline<< std::endl; cline =(cline > LINES) ? LINES :cline; for(Int_t j = 0; j <LINES ;j++){ x[j] = a[j]; y[j] = b[j]; _inta[j] = inta[j]; _intb[j]= (intb[j] < 0)? 0:intb[j]; } double s_integral = 0; std::cout <<"size of int " << intb.size()<< std::endl; for (size_t it = 0; it < intb.size() - 1; it++){ double y_val = (intb[it]+intb[it+1])/2; assert (y_val >= 0); double area = 0.002*y_val; if(area > 0 ) s_integral += area; } std::cout << "Simpson integral: " <<s_integral <<std::endl; integral_hist->Fill(s_integral); cmp_int[i] = s_integral; Int_t lines = (Int_t)intb.size(); TGraph *r_integral = new TGraph(lines, _inta, _intb); std::cout << "ROOT integral: " << r_integral->Integral() << std::endl; cmp_int_root[i] = r_integral->Integral(); //expanding //expand(y, THRS_EXPAND, RATIO_EXPAND, LINES); //Filling TGraph2D for(Int_t j = 0; j <LINES ; j++){ if (y[j] > max){ max = y[j]; maxwl = x[j]; } gr->SetPoint(j+i*LINES, x[j],i,y[j]); } in.seekg(0, std::ios::beg); in.close(); //Plotting each spectrum TGraph *_gr = new TGraph(LINES,x,y); _gr->GetHistogram()->GetXaxis()->SetTitle("#lambda in nm"); _gr->GetHistogram()->GetYaxis()->SetTitle("Intensity in dB"); c1->cd(i-NUM_ARGS); _gr->Draw("AP"); _gr->GetYaxis()->SetRangeUser(-80.,-10.); _gr->GetXaxis()->SetRangeUser(startwl,stopwl); _gr->SetTitle(tmp.c_str()); c1->Update(); //Calculating asymmetry std::cout << "maximum: " << max << std::endl; double leftlimit, rightlimit = 1; leftlimit = findlower(x,y, max); rightlimit = findupper(x,y, max); if (leftlimit != 1 && rightlimit != 1){ width_ary[i] = (leftlimit +rightlimit)/2; }else{ width_ary[i] = maxwl; } double calced_asy = (maxwl-leftlimit)/(rightlimit-maxwl); asymmety_ary[i-NUM_ARGS] = calced_asy; std::cout << "Asymmetry: " << calced_asy << std::endl; }catch(std::exception e){ std::cout << e.what()<< std::endl; } } //Setting style for 3D Plot TCanvas *d = new TCanvas("big","big",10,10,1500,800); d->Divide(2,2); d->cd(1); TGraph *the_ints = new TGraph(argc-1,argc_ary,cmp_int); the_ints->Draw("A*"); the_ints->SetTitle("My Ints"); d->Update(); d->cd(2); std::cout << "Fitting\n\n"; integral_hist->SetFillColor(kBlue); //settig everything to print fitresuts gStyle->SetOptStat(1211); gStyle->SetOptFit(1111); integral_hist->Draw(); integral_hist->Fit("gaus","W","" ,10,100); //integral_hist->Draw("SAME"); d->Update(); d->cd(3); TGraph *roots_int = new TGraph(argc-1, argc_ary, cmp_int_root); roots_int->SetTitle("ROOTS Int"); roots_int->Draw("A*"); d->Update(); d->cd(4); d->Update(); //gROOT->SetStyle("modern"); gr->SetTitle("big"); gr->GetHistogram("empty")->GetXaxis()->SetTitle("#lambda in nm"); gr->GetHistogram("empty")->GetXaxis()->SetLimits(startwl,stopwl); gr->GetHistogram("empty")->GetYaxis()->SetTitle("Messurement"); gr->GetHistogram("empty")->GetZaxis()->SetTitle("Intensity in dB"); gr->GetHistogram("empty")->GetXaxis()->SetTitleOffset(1.5); gr->GetHistogram("empty")->GetYaxis()->SetTitleOffset(1.5); gr->GetHistogram("empty")->GetZaxis()->SetTitleOffset(1.5); gr->GetHistogram("empty")->GetZaxis()->SetRangeUser(-70.,max); gr->GetHistogram("empty")->GetXaxis()->CenterTitle(); gr->GetHistogram("empty")->GetYaxis()->CenterTitle(); gr->GetHistogram("empty")->GetZaxis()->CenterTitle(); gr->Draw("PCOL"); d->SetFillColor(16); #ifdef RENDER //Render 3D animation const Int_t kUPDATE = 1; TSlider *slider = 0; for (Int_t i = 1; i <= 125; i++){ TView3D *v = new TView3D(); v->RotateView(5+i,45+i,d); //d->Update(); if(i && (i%kUPDATE)== 0){ if (i == kUPDATE){ gr->Draw("PCOL"); d->Update(); slider = new TSlider("slider","test",850,-70,856,max); } if (slider) slider->SetRange(0,Float_t(i)/10000.); d->Modified(); d->Update(); d->Print("3d.gif+"); } } d->Update(); d->Print("3d.gif++"); #endif //Saving image TImage *img = TImage::Create(); boost::filesystem::path p(t->Argv(3)); std::string file = p.parent_path().string(); file += "_big.png"; img->FromPad(d); img->WriteImage(file.c_str()); //cleaning TCanvas *e = new TCanvas("Asymmetry","Asymmetry",10,10,1500,800); e->Divide(2,1); TGraph *asy_plot = new TGraph(argc-1, argc_ary, asymmety_ary); e->cd(1); asy_plot->SetTitle("Asymmetry"); asy_plot->GetHistogram()->GetXaxis()->SetTitle("# Meassurement"); asy_plot->GetHistogram()->GetYaxis()->SetTitle("Asymmetry"); asy_plot->GetHistogram()->GetXaxis()->SetRange(1, argc); asy_plot->Draw("A*"); e->Update(); e->cd(2); TGraph *center_plot = new TGraph(argc-1 , argc_ary, width_ary); center_plot->GetHistogram()->GetXaxis()->SetTitle("# Meassurement"); center_plot->GetHistogram()->GetYaxis()->SetTitle("Center in nm"); center_plot->GetHistogram()->GetYaxis()->SetRangeUser(startwl, stopwl); center_plot->SetTitle("Center"); center_plot->Draw("A*"); e->Update(); //Saving Images TImage *secimg = TImage::Create(); boost::filesystem::path p2(t->Argv(3)); file = p2.parent_path().string(); file += "_asy_cent.png"; secimg->FromPad(e); secimg->WriteImage(file.c_str()); TImage *thrdimg = TImage::Create(); boost::filesystem::path p3(t->Argv(3)); file = p3.parent_path().string(); file += "_allplots.png"; thrdimg->FromPad(c1); thrdimg->WriteImage(file.c_str()); //detecting Gradients gradient(asymmety_ary, width_ary,cmp_int, argc-1,c1); std::cout << "\n\n\nDone !!\nYou can quit now using CTRL+C \n" ; if (run == true){ t->Run(); } std::cout << "With \n" ; delete[] cmp_int; delete[] argc_ary; delete[] cmp_int_root; delete[] asymmety_ary; delete[] width_ary; return 0; }
PadBoundaries PlotBundle::calculatePadBoundaries() const { PadBoundaries union_pad_boundaries; bool nothing_drawn(true); std::vector<DrawableDataObjectDrawOptionPair<TH1*> >::const_iterator hist_it; for (hist_it = histograms.begin(); hist_it != histograms.end(); hist_it++) { TH1* hist = hist_it->data_object; std::string draw_option(hist_it->draw_option); if (hist) { hist->Draw(draw_option.c_str()); if (plot_axis.x_axis_range.active) hist->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low, plot_axis.x_axis_range.high); PadBoundaries current_pad_boundaries(*hist); if (nothing_drawn) { union_pad_boundaries = current_pad_boundaries; nothing_drawn = false; } else { union_pad_boundaries = union_pad_boundaries.getUnionBoundaries( current_pad_boundaries); } } } std::vector<DrawableDataObjectDrawOptionPair<TGraph*> >::const_iterator graph_it; for (graph_it = graphs.begin(); graph_it != graphs.end(); graph_it++) { TGraph* graph = graph_it->data_object; std::string draw_option("A"); draw_option.append(graph_it->draw_option); if (graph) { graph->Draw(draw_option.c_str()); if (plot_axis.x_axis_range.active) graph->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low, plot_axis.x_axis_range.high); PadBoundaries current_pad_boundaries(*graph->GetHistogram()); if (nothing_drawn) { union_pad_boundaries = current_pad_boundaries; nothing_drawn = false; } else { union_pad_boundaries = union_pad_boundaries.getUnionBoundaries( current_pad_boundaries); } } } std::vector<DrawableDataObjectDrawOptionPair<TGraph2D*> >::const_iterator graph2d_it; for (graph2d_it = graphs2d.begin(); graph2d_it != graphs2d.end(); graph2d_it++) { TGraph2D* graph = graph2d_it->data_object; std::string draw_option("A"); draw_option.append(graph2d_it->draw_option); if (graph) { graph->Draw(draw_option.c_str()); PadBoundaries current_pad_boundaries(*(TH1*) graph->GetHistogram()); current_pad_boundaries.is_2d = true; current_pad_boundaries.z_min = graph->GetZmin(); current_pad_boundaries.z_max = graph->GetZmax(); if (nothing_drawn) { union_pad_boundaries = current_pad_boundaries; nothing_drawn = false; } else { union_pad_boundaries = union_pad_boundaries.getUnionBoundaries( current_pad_boundaries); } } } return union_pad_boundaries; }