//-------------------------- // DrawPoly //-------------------------- void DrawPoly(int N, double *z, double *r, int color) { TPolyLine *pl = new TPolyLine(N, z, r); pl->SetLineColor(color); if (fill_detectors) { pl->SetFillColor(color); pl->SetFillStyle(1001); } pl->SetLineWidth(2); pl->Draw(); if (full) { for(int i=0; i<N; i++)r[i] = -r[i]; pl = new TPolyLine(N, z, r); pl->SetLineColor(color); if (fill_detectors) { pl->SetFillColor(color); pl->SetFillStyle(1001); } pl->SetLineWidth(2); pl->Draw(); } }
void createPolyline(const Data& data){ double x[data.points.size()],y[data.points.size()]; for(size_t i=0;i<data.points.size()/2;i++){ x[i]=data.points[2*i]; y[i]=data.points[2*i+1]; } TPolyLine* pline = new TPolyLine(data.points.size()/2,y,x); vp.push_back(pline); pline->SetFillColor(colorList.getIndex(data)); pline->SetLineWidth(0); pline->Draw("f"); }
//-------------------------- // DrawStartCounterBoundaries //-------------------------- void DrawStartCounterBoundaries(int color=start_counter_color) { // Values from Richard's old spreadsheet "start_geom.xls" const int Npoints = 15; double r_hi[] = {8.675, 8.675, 8.675, 7.759, 7.354, 4.353, 3.134, 2.290, 1.915, 5.593, 5.893, 6.907, 6.951, 6.951, 8.675}; double r_lo[Npoints]; for (Int_t i=0; i<Npoints; i++) r_lo[i] = -r_hi[i]; double z[] = { 0.0, 51.383, 51.726, 53.938, 54.914, 57.915, 59.134, 58.442, 58.290, 54.360, 54.238, 51.531, 51.488, 0.0, 0.0}; // shift z to proper location in lab system for(int i=0; i<Npoints; i++)z[i] += 38.75; TPolyLine *pol = new TPolyLine(Npoints, z, r_hi); pol->SetLineWidth(2.0); if (fill_detectors) { pol->SetFillColor(color); pol->SetFillStyle(1001); } else pol->SetFillStyle(0); pol->SetLineColor(color); pol->Draw(); TLatex *lab = new TLatex(z[6]+(z[6]-z[0])*0.1, 0, "start counter"); if (full) lab->SetTextAlign(12); else lab->SetTextAlign(11); lab->SetTextSize(0.02); lab->SetTextColor(color); lab->Draw(); if (full) { pol = new TPolyLine(Npoints, z, r_lo); pol->SetLineWidth(2.0); if (fill_detectors) { pol->SetFillColor(color); pol->SetFillStyle(1001); } else pol->SetFillStyle(0); pol->SetLineColor(color); pol->Draw(); } }
void triangles(Int_t ntriangles=50) { TCanvas *c1 = new TCanvas("c1","triangles",10,10,700,700); TRandom r; Double_t dx = 0.2; Double_t dy = 0.2; Int_t ncolors = gStyle->GetNumberOfColors(); Double_t x[4],y[4]; TColor *c; Int_t ci; for (Int_t i=0;i<ntriangles;i++) { x[0] = r.Uniform(.05,.95); y[0] = r.Uniform(.05,.95); x[1] = x[0] + dx*r.Rndm(); y[1] = y[0] + dy*r.Rndm(); x[2] = x[1] - dx*r.Rndm(); y[2] = y[1] - dy*r.Rndm(); x[3] = x[0]; y[3] = y[0]; TPolyLine *pl = new TPolyLine(4,x,y); pl->SetUniqueID(i); ci = ncolors*r.Rndm(); c = gROOT->GetColor(TColor::GetColorPalette(ci)); c->SetAlpha(r.Rndm()); pl->SetFillColor(ci); pl->Draw("f"); } c1->AddExec("ex","TriangleClicked()"); }
void makePlots() { // ********************************************** // * Input parameters * // ********************************************** // switch to include/exclude sytematics uncertainties bool systematics = true; // array of signal efficiencies Double_t S_eff[5] = {0.36, 0.43, 0.54, 0.59, 0.66}; // Double_t S_eff[10] = {0.36, 0.43, 0.54, 0.59, 0.66, 0.67, 0.68, 0.7, 0.7, 0.7}; // array of relative uncertainties on the signal efficiencies Double_t Sigma_S_eff[5] = {0.18, 0.15, 0.12, 0.12, 0.10}; // array of N_background for 100 pb^-1 Double_t N_bkg_100[5] = {10.35, 6.37, 2.83, 1.27, 1.27}; // array of relative uncertainties on N_background (0.1 = 10%) Double_t Sigma_N_bkg[5] = {0.19, 0.23, 0.33, 0.33, 0.33}; // arrays of leptoquark masses Double_t m[10] = {250, 300, 400, 500, 600, 650, 700, 800, 900, 1000}; // relative uncertainty on the integrated luminosity (0.1 = 10% uncertainty) Double_t Sigma_L = 0.1; // array of theoretical cross-sections for different leptoquark masses Double_t xsTh[10] = {10.1, 3.8, 0.75, 0.197, 0.0617, 0.0362, 0.0218, 0.0085, 0.00351, 0.00153}; // filename for the final plot (NB: changing the name extension changes the file format) string fileName = "xs95CL_vs_m.eps"; // axes labels for the final plot string title = ";m (GeV/c^{2});#beta^{2}#times#sigma (pb)"; TH2F *bg = new TH2F("bg",title.c_str(), 100, 200., 650., 100, 0.01, 50.); bg->SetStats(kFALSE); bg->SetTitleOffset(1.,"X"); bg->SetTitleOffset(1.5,"Y"); // region excluded by Tevatron limits Double_t x_shaded[5] = {200,256,256,200,200}; Double_t y_shaded[5] = {0.01,0.01,50,50,0.01}; // PDF uncertainty band Double_t x_pdf[12] = {250,300,400,500,600,650,650,600,500,400,300,250}; Double_t y_pdf[12] = {9.64045,3.6081,0.691125,0.176217,0.0538333,0.0312225,0.0424445,0.071356,0.221527,0.819375,4.0147,10.5293}; // ********************************************** // * Don't change anything below this point! * // ********************************************** // turn on/off batch mode gROOT->SetBatch(kTRUE); // set ROOT style style(); TCanvas *c = new TCanvas("c","",800,800); c->cd(); bg->Draw(); TGraph *grshade = new TGraph(12,x_pdf,y_pdf); grshade->SetFillColor(kYellow); grshade->Draw("f"); TPolyLine *pl = new TPolyLine(5,x_shaded,y_shaded,"F"); // pl->SetFillStyle(3001); pl->SetFillColor(kGray+1); pl->Draw(); gPad->RedrawAxis(); Int_t size = sizeof(S_eff)/sizeof(*S_eff); // array of 95% CL upper limits on the cross section // Double_t xsUp[size]; Double_t xsUp[5] = {0.23722, 0.166074, 0.10131, 0.0748393, 0.0669023}; // Double_t xsUp_sys[size]; // with systematics included Double_t xsUp_sys[5] = {0.302162, 0.198514, 0.114258, 0.0816143, 0.0718672}; // with systematics included // for(Int_t i = 0; i < size; i++){ // // xsUp[i] = CLA(100, 0, S_eff[i], 0, N_bkg_100[i], 0); // if(systematics) xsUp_sys[i] = CLA(100, 100*Sigma_L, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg_100[i], N_bkg_100[i]*Sigma_N_bkg[i]); // } TGraph *xsUp_vs_m = new TGraph(size, m, xsUp); xsUp_vs_m->SetLineWidth(2); xsUp_vs_m->SetLineStyle(7); xsUp_vs_m->SetLineColor(kBlue); xsUp_vs_m->SetMarkerSize(.9); xsUp_vs_m->SetMarkerStyle(22); xsUp_vs_m->SetMarkerColor(kBlue); xsUp_vs_m->Draw("CP"); TGraph *xsUp_vs_m_sys = new TGraph(size, m, xsUp_sys); xsUp_vs_m_sys->SetLineWidth(2); xsUp_vs_m_sys->SetLineColor(kRed); xsUp_vs_m_sys->SetMarkerSize(.9); xsUp_vs_m_sys->SetMarkerStyle(21); xsUp_vs_m_sys->SetMarkerColor(kRed); if(systematics) xsUp_vs_m_sys->Draw("CP"); TGraph *xsTh_vs_m = new TGraph(size+1, m, xsTh); xsTh_vs_m->SetLineWidth(2); xsTh_vs_m->SetLineColor(kGreen+2); xsTh_vs_m->SetFillColor(kYellow); xsTh_vs_m->SetMarkerSize(1.); xsTh_vs_m->SetMarkerStyle(22); xsTh_vs_m->SetMarkerColor(kGreen+2); xsTh_vs_m->Draw("C"); TLegend *legend = new TLegend(.3,.69,.92,.86); legend->SetBorderSize(1); legend->SetFillColor(0); //legend->SetFillStyle(0); legend->SetMargin(0.15); legend->SetHeader("LQ #rightarrow eq"); legend->AddEntry(xsTh_vs_m,"#beta^{2}#times#sigma_{theory} with PDF unc. band, #beta=1","lf"); if(systematics) legend->AddEntry(xsUp_vs_m_sys,"95% C.L. upper limit (with sys. unc.)","lp"); legend->AddEntry(xsUp_vs_m,"95% C.L. upper limit (no sys. unc.)","lp"); legend->Draw(); TLatex l1; l1.SetTextAlign(12); l1.SetTextSize(0.04); l1.SetTextFont(62); l1.SetNDC(); l1.DrawLatex(0.25,0.24,"CMS Preliminary"); TLatex l2; l2.SetTextAlign(12); l2.SetTextSize(0.04); l2.SetTextFont(62); l2.SetNDC(); l2.DrawLatex(0.25,0.15,"#intLdt=100 pb^{-1}"); c->SetGridx(); c->SetGridy(); // c->SaveAs(fileName.c_str()); string name, extension; size_t pos = fileName.find("."); name = fileName.substr(0,pos); extension = fileName.substr(pos); c->SetLogy(); c->SaveAs((name + "_log" + extension).c_str()); delete pl; delete xsTh_vs_m; delete xsUp_vs_m; delete xsUp_vs_m_sys; delete bg; delete c; }
void makePlots() { // ********************************************** // * Input parameters * // ********************************************** // switch to include/exclude sytematics uncertainties bool systematics = true; // does nothing at the moment // total integrated luminosity (in pb-1) Double_t L_int = 33.2; // relative uncertainty on the integrated luminosity (0.1 = 10% uncertainty) Double_t Sigma_L_int = 0.11; // array of signal efficiencies Double_t S_eff[10] = {0.297, 0.380, 0.403, 0.430, 0.451, 0.469, 0.496, 0.522, 0.539, 0.565}; // array of relative uncertainties on the signal efficiencies (0.1 = 10%) Double_t Sigma_S_eff[10] = {0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105}; // array of N_background for L_int Double_t N_bkg[10] = {4.9, 2.7, 1.7, 1.4, 1.2, 0.96, 0.80, 0.67, 0.42, 0.33}; // to PRL in Dec 2010 Double_t N_bkg[10] = {4.5, 2.5, 1.5, 1.3, 1.1, 0.89, 0.75, 0.62, 0.41, 0.32}; // array of relative uncertainties on N_background (0.1 = 10%) Double_t Sigma_N_bkg[10] = {0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28}; // to PRL in Dec 2010 Double_t Sigma_N_bkg[10] = {0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25}; // array of N_observed for L_int Int_t N_obs[10] = {2, 1, 1, 1, 1, 1, 1, 1, 0, 0}; // array of LQ masses for calculation of upXS Double_t mData[10] = {200, 250, 280, 300, 320, 340, 370, 400, 450, 500}; // arrays of LQ masses for theoretical cross section Double_t mTh[10] = {100, 150, 200, 250, 300, 350, 400, 450, 500, 550}; // array of theoretical cross-sections for different leptoquark masses Double_t xsTh[10] = {386, 53.3, 11.9, 3.47, 1.21, 0.477, 0.205, 0.0949, 0.0463, 0.0236}; // filename for the final plot (NB: changing the name extension changes the file format) string fileName = "xs95CL_vs_m.eps"; // axes labels for the final plot string title = ";M_{LQ} [GeV];#beta^{2}#times#sigma [pb]"; // integrated luminosity string lint = "#intLdt=33.2 pb^{-1}"; // region excluded by Tevatron limits Double_t x_shaded[5] = {200,299,299,200,200}; Double_t y_shaded[5] = {0.01,0.01,100,100,0.01}; // PDF uncertainty band Double_t x_pdf[20] = {100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100}; Double_t y_pdf[20] = {445.5, 61.4, 13.7, 4.1, 1.43, 0.572, 0.249, 0.1167, 0.0581, 0.0300, 0.0169, 0.0340, 0.0719, 0.160, 0.379, 0.98, 2.9, 10.0, 45.2, 330.3}; // turn on/off batch mode gROOT->SetBatch(kTRUE); Int_t size = sizeof(S_eff)/sizeof(*S_eff); // Upper limits can be entered manually when the calls to CL95(...) and CLA(...) are commented below. // However, CL95(...) and CLA(...) have to be called at least once to get the upper limits // Double_t xsUp_observed[size]; // for(Int_t i = 0; i < size; i++){ // xsUp_observed[i] = CL95(L_int, L_int*Sigma_L_int, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg[i], N_bkg[i]*Sigma_N_bkg[i], N_obs[i], kFALSE, 1); // } // cout<<endl<<Form("Double_t xsUp_observed[%i] = {", size); // for(Int_t i = 0; i < size; i++) { // cout<<xsUp_observed[i]; // if(i<(size-1)) cout<<", "; // } // cout<<"};"<<endl<<endl; // Array of the observed 95% CL upper limits on the cross section Double_t xsUp_observed[10] = {0.440918, 0.308594, 0.30542, 0.291992, 0.282715, 0.277588, 0.266846, 0.257324, 0.174243, 0.166113}; //to PRL in Dec. 2010 Double_t xsUp_observed[10] = {0.444824, 0.310547, 0.309082, 0.293945, 0.284668, 0.279297, 0.268066, 0.258789, 0.174243, 0.166113}; // Double_t xsUp_expected[size]; // for(Int_t i = 0; i < size; i++){ // // xsUp_expected[i] = CLA(L_int, L_int*Sigma_L_int, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg[i], N_bkg[i]*Sigma_N_bkg[i], kFALSE, 1); // } // cout<<endl<<Form("Double_t xsUp_expected[%i] = {", size); // for(Int_t i = 0; i < size; i++) { // cout<<xsUp_expected[i]; // if(i<(size-1)) cout<<", "; // } // cout<<"};"<<endl<<endl; // Array of the expected 95% CL upper limits on the cross section Double_t xsUp_expected[10] = {0.719781, 0.454356, 0.373334, 0.332432, 0.30521, 0.278996, 0.254081, 0.233398, 0.209577, 0.193584}; //to PRL in Dec. 2010 Double_t xsUp_expected[10] = {0.692479, 0.442443, 0.360792, 0.326146, 0.298866, 0.274453, 0.250794, 0.230144, 0.208843, 0.192884}; // set ROOT style // myStyle(); setTDRStyle(); gStyle->SetPadLeftMargin(0.14); gROOT->ForceStyle(); TCanvas *c = new TCanvas("c","",800,800); c->cd(); TH2F *bg = new TH2F("bg",title.c_str(), 100, 200., 500., 100, 0.01, 100.); bg->SetStats(kFALSE); bg->SetTitleOffset(1.,"X"); bg->SetTitleOffset(1.13,"Y"); // bg->GetXaxis()->SetNdivisions(505); bg->Draw(); TPolyLine *pl = new TPolyLine(5,x_shaded,y_shaded,"F"); // pl->SetFillStyle(3001); pl->SetLineColor(0); pl->SetFillColor(kGray); pl->Draw(); TGraph *grshade = new TGraph(20,x_pdf,y_pdf); grshade->SetFillColor(kGreen); grshade->Draw("f"); gPad->RedrawAxis(); // set ROOT style // myStyle(); setTDRStyle(); gStyle->SetPadLeftMargin(0.14); gROOT->ForceStyle(); TGraph *xsTh_vs_m = new TGraph(10, mTh, xsTh); xsTh_vs_m->SetLineWidth(2); xsTh_vs_m->SetLineColor(kRed); xsTh_vs_m->SetFillColor(kGreen); xsTh_vs_m->SetMarkerSize(1.); xsTh_vs_m->SetMarkerStyle(22); xsTh_vs_m->SetMarkerColor(kRed); xsTh_vs_m->Draw("C"); TGraph *xsData_vs_m_expected = new TGraph(size, mData, xsUp_expected); xsData_vs_m_expected->SetMarkerStyle(23); xsData_vs_m_expected->SetMarkerColor(kBlue); xsData_vs_m_expected->SetLineColor(kBlue); xsData_vs_m_expected->SetLineWidth(2); xsData_vs_m_expected->SetLineStyle(2); xsData_vs_m_expected->SetMarkerSize(1.5); xsData_vs_m_expected->Draw("CP"); TGraph *xsData_vs_m_observed = new TGraph(size, mData, xsUp_observed); xsData_vs_m_observed->SetMarkerStyle(22); xsData_vs_m_observed->SetMarkerColor(kBlack); xsData_vs_m_observed->SetLineColor(kBlack); xsData_vs_m_observed->SetLineWidth(2); xsData_vs_m_observed->SetLineStyle(1); xsData_vs_m_observed->SetMarkerSize(1.5); xsData_vs_m_observed->Draw("CP"); TLegend *legend = new TLegend(.36,.65,.91,.92); legend->SetBorderSize(1); legend->SetFillColor(0); //legend->SetFillStyle(0); legend->SetTextFont(42); legend->SetMargin(0.15); legend->SetHeader("LQ #rightarrow eq"); legend->AddEntry(pl,"D#oslash exclusion (1 fb^{-1}, #beta=1)","f"); legend->AddEntry(xsTh_vs_m,"#beta^{2}#times#sigma_{theory} with theory uncertainty, #beta=1","lf"); legend->AddEntry(xsData_vs_m_expected, "Expected 95% C.L. upper limit","lp"); legend->AddEntry(xsData_vs_m_observed, "Observed 95% C.L. upper limit","lp"); legend->Draw(); TLatex l1; l1.SetTextAlign(12); l1.SetTextFont(42); l1.SetNDC(); l1.SetTextSize(0.06); l1.DrawLatex(0.42,0.31,"CMS"); l1.SetTextSize(0.05); l1.DrawLatex(0.42,0.20,lint.c_str()); c->SetGridx(); c->SetGridy(); string name, extension; size_t pos = fileName.find("."); name = fileName.substr(0,pos); extension = fileName.substr(pos); c->SetLogy(); c->SaveAs((name + "_log" + extension).c_str()); delete pl; delete xsTh_vs_m; delete bg; delete c; }
void TestH8500adapter() { Th8500* pm = new Th8500(); //pm->Print(); TConnectH8500 conn85; //conn85.Print(1,0,0); //TRANSLATION? NO //ROTATION? NO //pm->Rotate(180.0); Float_t Xcoordinates[64]; Float_t Ycoordinates[64]; int i; for (i=0; i<64; i++) { Xcoordinates[i]=0; Ycoordinates[i]=0; } for (i=0; i<64; i++) { Xcoordinates[i]=pm->GetX(i+1); Ycoordinates[i]=pm->GetY(i+1); //printf("anode %d : (%3.2lf,%3.2lf)\n",i+1,Xcoordinates[i],Ycoordinates[i]); } // Graphics Float_t A= 26.0*1.5; // mm Int_t D = 368; // size of the window in pixel Float_t B= .80; /* CANVAS 1 OUTLINE OF THE PM*/ TCanvas* mycanv = new TCanvas("mycanv","Outline of H8500",SCREEN_PIXX-D,0,D,D); mycanv->Range(-A,-A,A,A); TGaxis *axis1 = new TGaxis(-B*A,-B*A,-B*A,B*A,-A,A,510,""); axis1->SetName("axis1"); axis1->Draw(); axis1->SetTitle("[mm]"); TGaxis *axis2 = new TGaxis(-B*A,-B*A,B*A,-B*A,-A,A,510,""); axis2->SetName("axis2"); axis2->Draw(); axis2->SetTitle("[mm]"); Double_t x[5] = {pm->GetXVertex(0),pm->GetXVertex(1),pm->GetXVertex(2),pm->GetXVertex(3),pm->GetXVertex(0)}; Double_t y[5] = {pm->GetYVertex(0),pm->GetYVertex(1),pm->GetYVertex(2),pm->GetYVertex(3),pm->GetYVertex(0)}; Int_t linewidth = 2; Int_t mycolor = 2; TPolyLine *pline = new TPolyLine(5,x,y); pline->SetFillColor(38); pline->SetLineColor(mycolor); pline->SetLineWidth(linewidth); pline->Draw(""); Int_t anode1mark= 8; Int_t anodemark = 6; for (int k=1; k<65; k++) {// loop on anodes if (k==1) { mark1 = new TMarker((double)pm->GetX(k),(double)pm->GetY(k),anode1mark); } else { mark1 = new TMarker((double)pm->GetX(k),(double)pm->GetY(k),anodemark); } mark1->Draw("SAME"); } /* CANVAS 2 - ANODES*/ TCanvas* mycanv2 = new TCanvas("mycanv2","ANODES",SCREEN_PIXX-D,D+20,D,D); mycanv2->Range(-A,-A,A,A); TH2F *h2 = new TH2F("h2","Hamamatsu View",100,-32,32,100,-32,32); for (i=0; i<64; i++) {//LOOP ON ANODES // Hamamatsu View h2->Fill(Xcoordinates[i],Ycoordinates[i],i+1); //printf("%d: %d,%d \n",i,Xcoordinates[i],Ycoordinates[i]); } h2->Draw("text"); h2->SetMarkerSize(2.2); h2->SetStats(0); TPolyLine *pline = new TPolyLine(5,x,y); pline->SetFillColor(38); pline->SetLineColor(mycolor); pline->SetLineWidth(linewidth); pline->Draw("same"); //CANVAS 3 - MAROC TCanvas* mycanv3 = new TCanvas("mycanv3","MAROC CHANNEL",SCREEN_PIXX-2*D,D+20,D,D); mycanv3->Range(-A,-A,A,A); TH2F *h3 = new TH2F("h3","Maroc View",100,-32,32,100,-32,32); for (i=0; i<64; i++) {//LOOP ON ANODES // Maroc View h3->Fill(Xcoordinates[i],Ycoordinates[i],conn85.GetMaroc(i+1)); //printf("%d: %d,%d \n",i,Xcoordinates[i],Ycoordinates[i]); } h3->Draw("text"); // DO NOT PRINT ZERO!!! WHY? h3->SetMarkerSize(2.2); h3->SetStats(0); TPolyLine *pline = new TPolyLine(5,x,y); pline->SetFillColor(38); pline->SetLineColor(mycolor); pline->SetLineWidth(linewidth); pline->Draw("same"); //CANVAS 4 - PIN of the Adapter Board TCanvas* mycanv4 = new TCanvas("mycanv4","Adapter PIN",SCREEN_PIXX-2*D,0,D,D); mycanv4->Range(-A,-A,A,A); TH2F *h4 = new TH2F("h3","Samtec View",100,-32,32,100,-32,32); for (i=0; i<64; i++) {//LOOP ON ANODES // Samtec View h4->Fill(Xcoordinates[i],Ycoordinates[i],conn85.GetPinfromAnode(i+1)); } h4->Draw("text"); // DO NOT PRINT ZERO!!! WHY? h4->SetMarkerSize(2.2); h4->SetStats(0); TPolyLine *pline = new TPolyLine(5,x,y); pline->SetFillColor(38); pline->SetLineColor(mycolor); pline->SetLineWidth(linewidth); pline->Draw("same"); //h2->Print(); delete pm; }