void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle, const char *text,Float_t msize) { Double_t tsize=0.06; TMarker *marker = new TMarker(x-(0.4*tsize),y,8); marker->SetMarkerColor(color); marker->SetNDC(); marker->SetMarkerStyle(mstyle); marker->SetMarkerSize(msize); marker->Draw(); TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); l.SetNDC(); l.DrawLatex(x,y,text); }
vector<TObject *> * mark_overflows(TH1F * histogram) { Double_t maximum_value = histogram->GetMaximum(); Double_t minimum_value = histogram->GetMinimum(); vector<TObject *> * overflow_markers = new vector<TObject *>(); Float_t * bins = histogram->GetArray(); Int_t number_of_bins = histogram->GetNbinsX(); // note that the bins array has the following structure: // bins[0] is the underflow bin // bins[1] through bins[number_of_bins] are the actual bins // bins[number_of_bins + 1] is the overflow bin for(int j = 1; j <= number_of_bins; j++) { if (bins[j] > maximum_value || bins[j] < minimum_value) { Double_t x1 = histogram->GetXaxis()->GetBinLowEdge(j); Double_t x2 = histogram->GetXaxis()->GetBinUpEdge(j); TMarker * m = new TMarker(); m->SetX((x2 + x1) / 2.0); m->SetMarkerColor(kRed); m->SetMarkerSize(MARKER_SIZE * 2); if(bins[j] > maximum_value) { m->SetY(maximum_value - MARKER_Y_SHIFT); m->SetMarkerStyle(22); // up arrow } else { m->SetY(minimum_value + MARKER_Y_SHIFT); m->SetMarkerStyle(23); // down arrow } overflow_markers->push_back(m); } } return overflow_markers; }
void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text) { // printf("**myMarker: text= %s\ m ",text); Double_t tsize=0.06; TMarker *marker = new TMarker(x-(0.4*tsize),y,8); marker->SetMarkerColor(color); marker->SetNDC(); marker->SetMarkerStyle(mstyle); marker->SetMarkerSize(2.0); marker->Draw(); TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); l.SetNDC(); l.DrawLatex(x,y,text); }
// Draw on a given canvas the full set of working points void overlayWorkingPoints(TCanvas *c1, TTree *signalTree, TTree *backgroundTree, const TString *cutFileNames, int markerColor, int markerStyle, TLegend *leg, const TString legendText){ // Now loop over working points for(int iwp = 0; iwp<nWP; iwp++){ // Load the working point from a ROOT file TFile *cutFile = new TFile(cutFileNames[iwp]); if( !cutFile ) assert(0); VarCut *cutObject = (VarCut*)cutFile->Get("cuts"); if( !cutObject ) assert(0); // Compute the efficiencies float effSignal, effBackground; findEfficiencies(signalTree, backgroundTree, effSignal, effBackground, cutObject); printf("Computed eff for cut from %s, effS= %.3f effB= %.3f\n", cutFileNames[iwp].Data(), effSignal, effBackground); // Make a marker and draw it. TMarker *marker = new TMarker(effSignal, 1.0-effBackground, 20); marker->SetMarkerSize(2); marker->SetMarkerColor(markerColor); marker->SetMarkerStyle(markerStyle); marker->Draw("same"); // Add marker to the legend only once. Do not draw the legend here, // it is drawn in the main function later if( iwp == 0 ){ if( !leg ) assert(0); leg->AddEntry(marker, legendText, "p"); } c1->Update(); cutFile->Close(); } }
void Show_SR(TString oredList, TCanvas *can, float xlow, float xhigh, float ylow, float yhigh, bool useShape, TLegend *leg) { Int_t c_myRed = TColor::GetColor("#aa000"); can->cd(); TLatex lat; //lat.SetTextAlign( 11 ); lat.SetTextSize( 0.0265 ); lat.SetTextColor( 12 ); lat.SetTextFont( 42 ); cout << "Draw signal region labels." << endl; gROOT->ProcessLine(".L summary_harvest_tree_description.h+"); gSystem->Load("libSusyFitter.so"); TString txtfile=oredList; txtfile.ReplaceAll(".root",""); TTree* tree = harvesttree( txtfile!=0 ? txtfile : 0 ); if (tree==0) { cout << "Cannot open list file. Exit." << endl; return; } Float_t fID; Float_t m0; Float_t m12; TBranch *b_m0; TBranch *b_m12; TBranch *b_fID; tree->SetBranchAddress("m0", &m0, &b_m0); tree->SetBranchAddress("m12", &m12, &b_m12); tree->SetBranchAddress("fID", &fID, &b_fID); bool drawMarker; for( Int_t i = 0; i < tree->GetEntries(); i++ ){ drawMarker = false; tree->GetEntry( i ); cout << m0 << " " << m12 << " " << fID << endl; TMarker marker; //marker.SetMarkerColor(4); marker.SetMarkerSize(2.5); marker.SetMarkerStyle(29); int _m0 = (int) m0; int _m12 = (int) m12; if(oredList.Contains("GG")){ if( (_m0 == 700 && _m12 == 550) || (_m0 == 1162 && _m12 == 337) || (_m0 == 1250 && _m12 == 50) ) drawMarker = true; } else if(oredList.Contains("SS")){ if( (_m0 == 850 && _m12 == 100) || (_m0 == 450 && _m12 == 400)) drawMarker = true; } else if(oredList.Contains("SG")){ if( (_m0 == 1425 && _m12 == 525) || (_m0 == 1612 && _m12 == 37)) drawMarker = true; } if (drawMarker) marker.DrawMarker(m0, m12); TString mySR = GetSRName(fID, useShape); lat.DrawLatex(m0,m12,mySR.Data()); } leg->Draw("same"); // add up/down lines TLine *line1; TLine *line2; if (oredList.Contains("GG")) { line1 = new TLine( 972, 1412, 1062, 1412); line2 = new TLine( 972, 1355, 1062, 1355); cout << "GG line1" << endl; } else if (oredList.Contains("SS")) { line1 = new TLine( 793, 1128, 860, 1128); line2 = new TLine( 793, 1081, 860, 1081); cout << "SS line1" << endl; } else if (oredList.Contains("SG")) { line1 = new TLine( 1150, 1645, 1260, 1645); line2 = new TLine( 1150, 1565, 1260, 1565); cout << "SG line1" << endl; } /* line1->SetLineWidth(2); line1->SetLineColor(c_myRed); line1->SetLineStyle(3); line1->Draw("SAME") ; line2->SetLineWidth(2); line2->SetLineColor(c_myRed); line2->SetLineStyle(3); line2->Draw("SAME") ; */ }
void drawMeasurement(int i, double m[5], char label[2][100], int aux[5], double vstep, TH2F* histo, TCanvas* canvas) { double lowY = (i+1)*vstep; double uppY = (i+2)*vstep; //double lowX = histo->GetBinLowEdge(1); //double uppX = histo->GetBinLowEdge(histo->GetNbinsX()) + // histo->GetBinWidth(histo->GetNbinsX()); double lowX = 0.25; double uppX = 2.80; double widthX = uppX - lowX; // y-range of the histogram is [0...1] double startX = lowX + 0.04*widthX; TPaveText* text = new TPaveText(startX, lowY, startX, uppY, "BR"); text->SetTextAlign(12); text->SetFillColor(aux[1]); text->SetTextColor(aux[0]); text->SetLineColor(1); text->SetBorderSize(0); TText* t0 = text->AddText(" "); t0->SetTextSize(0.08); t0->SetTextFont(aux[2]); TText* t1 = text->AddText(label[0]); t1->SetTextSize(0.08); t1->SetTextFont(aux[2]); TText* t2 = text->AddText(label[1]); t2->SetTextSize(0.08); t2->SetTextFont(aux[2]); text->Draw(); double ypos = 0.5*(lowY+uppY); double mean = m[0]; double nErr1 = m[1]; double pErr1 = m[2]; double nErr2 = sqrt(m[1]*m[1]+m[3]*m[3]); double pErr2 = sqrt(m[2]*m[2]+m[4]*m[4]); // draw TGraphAsymmErrors 1 (stat only) |---*---| TMarker* measurement = new TMarker(mean, ypos, aux[4]); measurement->SetMarkerColor(aux[0]); measurement->SetMarkerStyle(aux[4]); measurement->SetMarkerSize(1.5); //measurement->SetMarkerSize(1.75); measurement->Draw(); double vsizeErr1 = 0.09*vstep; TLine* l1 = new TLine(mean, ypos, mean-nErr1, ypos); l1->SetLineWidth(aux[3]); l1->SetLineColor(aux[0]); l1->Draw(); TLine* l2 = new TLine(mean, ypos, mean+pErr1, ypos); l2->SetLineWidth(aux[3]); l2->SetLineColor(aux[0]); l2->Draw(); TLine* l3 = new TLine(mean-nErr1, ypos-vsizeErr1, mean-nErr1, ypos+vsizeErr1); l3->SetLineWidth(aux[3]); l3->SetLineColor(aux[0]); l3->Draw(); TLine* l4 = new TLine(mean+pErr1, ypos-vsizeErr1, mean+pErr1, ypos+vsizeErr1); l4->SetLineWidth(aux[3]); l4->SetLineColor(aux[0]); l4->Draw(); // overlay TGraphAsymmErrors 2 (stat+syst) |----*-----| double vsizeErr2 = 0.12*vstep; TLine* l5 = new TLine(mean, ypos, mean-nErr2, ypos); l5->SetLineWidth(aux[3]); l5->SetLineColor(aux[0]); l5->Draw(); TLine* l6 = new TLine(mean, ypos, mean+pErr2, ypos); l6->SetLineWidth(aux[3]); l6->SetLineColor(aux[0]); l6->Draw(); TLine* l7 = new TLine(mean-nErr2, ypos-vsizeErr2, mean-nErr2, ypos+vsizeErr2); l7->SetLineWidth(aux[3]); l7->SetLineColor(aux[0]); l7->Draw(); TLine* l8 = new TLine(mean+pErr2, ypos-vsizeErr2, mean+pErr2, ypos+vsizeErr2); l8->SetLineWidth(aux[3]); l8->SetLineColor(aux[0]); l8->Draw(); // draw measurement label "XXX+/-YY+/-ZZ" TPaveText* num = new TPaveText(uppX-0.32*widthX, lowY, uppX-0.02*widthX, uppY, "BR"); num->SetTextAlign(12); num->SetFillColor(aux[1]); num->SetTextColor(aux[0]); num->SetLineColor(aux[0]); num->SetBorderSize(0); TString str; char s[100]; sprintf(s, "%4.2f#color[%d]{X}", m[0], aux[1]); str +=s; if (m[1]==m[2]) { // sym. stat. errors sprintf(s, "#pm %4.2f", m[1]); str +=s; } else { sprintf(s, "^{+%4.2f}", m[2]); str +=s; sprintf(s, "_{-#color[%d]{|}%4.2f}", aux[1], m[1]); str +=s; } str += " (stat)"; if (m[3]!=0.0 || m[4]!=0.0) { if (m[3]==m[4]) { // sym. syst. errors sprintf(s, "#color[%d]{X}#pm% 4.2f", aux[1], m[3]); str +=s; } else { sprintf(s, "#color[%d]{X}", aux[1]); str +=s; sprintf(s, "^{+%4.2f}", m[4]); str +=s; sprintf(s, "_{-#color[%d]{|}%4.2f}", aux[1], m[3]); str +=s; } } str += " (syst)"; TText* n0 = num->AddText(str); n0->SetTextFont(aux[2]); num->Draw(); return; }
void /home/users/m/k/mkomm/Diff13/analysis/unfolding/result/nominal/multi_top_y_nol() { //=========Macro generated from canvas: cvMulti0.984295447508/ //========= (Mon May 15 15:02:17 2017) by ROOT version6.02/05 TCanvas *cvMulti0.984295447508 = new TCanvas("cvMulti0.984295447508", "",0,0,800,650); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); cvMulti0.984295447508->SetHighLightColor(2); cvMulti0.984295447508->Range(-0.5419355,-0.2962025,3.329032,1.982278); cvMulti0.984295447508->SetFillColor(0); cvMulti0.984295447508->SetBorderMode(0); cvMulti0.984295447508->SetBorderSize(2); cvMulti0.984295447508->SetTickx(1); cvMulti0.984295447508->SetTicky(1); cvMulti0.984295447508->SetLeftMargin(0.14); cvMulti0.984295447508->SetRightMargin(0.24); cvMulti0.984295447508->SetTopMargin(0.08); cvMulti0.984295447508->SetBottomMargin(0.13); cvMulti0.984295447508->SetFrameFillStyle(0); cvMulti0.984295447508->SetFrameLineWidth(0); cvMulti0.984295447508->SetFrameBorderMode(0); cvMulti0.984295447508->SetFrameBorderSize(0); cvMulti0.984295447508->SetFrameFillStyle(0); cvMulti0.984295447508->SetFrameLineWidth(0); cvMulti0.984295447508->SetFrameBorderMode(0); cvMulti0.984295447508->SetFrameBorderSize(0); TH2F *axis0.09336527505115 = new TH2F("axis0.09336527505115","",50,0,2.4,50,0,1.8); axis0.09336527505115->SetLineStyle(0); axis0.09336527505115->SetMarkerStyle(20); axis0.09336527505115->SetMarkerSize(0.16); axis0.09336527505115->GetXaxis()->SetTitle("top quark |y|"); axis0.09336527505115->GetXaxis()->SetNdivisions(1005); axis0.09336527505115->GetXaxis()->SetLabelFont(43); axis0.09336527505115->GetXaxis()->SetLabelOffset(0.0077); axis0.09336527505115->GetXaxis()->SetLabelSize(32); axis0.09336527505115->GetXaxis()->SetTitleSize(35); axis0.09336527505115->GetXaxis()->SetTickLength(0.04032258); axis0.09336527505115->GetXaxis()->SetTitleOffset(1.15); axis0.09336527505115->GetXaxis()->SetTitleFont(43); axis0.09336527505115->GetYaxis()->SetTitle(" Scale factor"); axis0.09336527505115->GetYaxis()->SetNdivisions(512); axis0.09336527505115->GetYaxis()->SetLabelFont(43); axis0.09336527505115->GetYaxis()->SetLabelOffset(0.0077); axis0.09336527505115->GetYaxis()->SetLabelSize(32); axis0.09336527505115->GetYaxis()->SetTitleSize(35); axis0.09336527505115->GetYaxis()->SetTickLength(0.03164557); axis0.09336527505115->GetYaxis()->SetTitleOffset(1.3); axis0.09336527505115->GetYaxis()->SetTitleFont(43); axis0.09336527505115->GetZaxis()->SetLabelFont(43); axis0.09336527505115->GetZaxis()->SetLabelOffset(0.0077); axis0.09336527505115->GetZaxis()->SetLabelSize(32); axis0.09336527505115->GetZaxis()->SetTitleSize(34); axis0.09336527505115->GetZaxis()->SetTitleOffset(1.3); axis0.09336527505115->GetZaxis()->SetTitleFont(43); axis0.09336527505115->Draw("AXIS"); TF1 *tf13 = new TF1("tf1","1",0,2.4); tf13->SetFillColor(19); tf13->SetFillStyle(0); tf13->SetMarkerStyle(20); tf13->SetMarkerSize(0.16); tf13->SetLineWidth(1); tf13->GetXaxis()->SetNdivisions(505); tf13->GetXaxis()->SetLabelFont(43); tf13->GetXaxis()->SetLabelOffset(0.0077); tf13->GetXaxis()->SetLabelSize(32); tf13->GetXaxis()->SetTitleSize(34); tf13->GetXaxis()->SetTickLength(0.05); tf13->GetXaxis()->SetTitleOffset(1.15); tf13->GetXaxis()->SetTitleFont(43); tf13->GetYaxis()->SetNdivisions(512); tf13->GetYaxis()->SetLabelFont(43); tf13->GetYaxis()->SetLabelOffset(0.0077); tf13->GetYaxis()->SetLabelSize(32); tf13->GetYaxis()->SetTitleSize(34); tf13->GetYaxis()->SetTitleOffset(1.3); tf13->GetYaxis()->SetTitleFont(43); tf13->Draw("LSame"); TMarker *marker = new TMarker(0.0892,0.9606917,20); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); TLine *line = new TLine(0.0892,0.9359605,0.0892,0.9854228); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.2,0,0.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.0892,0.9606917,0.3142,0.9554859); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.3142,0.9554859,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.3142,0.9323344,0.3142,0.9786374); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.45,0,0.45,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.3142,0.9554859,0.5642,0.9562376); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.5642,0.9562376,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.5642,0.9291835,0.5642,0.9832918); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.7,0,0.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.5642,0.9562376,0.8142,0.940729); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.8142,0.940729,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.8142,0.9117791,0.8142,0.9696789); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.95,0,0.95,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.8142,0.940729,1.0642,1.028565); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.0642,1.028565,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.0642,0.9987074,1.0642,1.058422); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.2,0,1.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.0642,1.028565,1.3392,1.024151); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.3392,1.024151,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.3392,0.9916412,1.3392,1.05666); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.5,0,1.5,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.3392,1.024151,1.5892,0.9990193); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.5892,0.9990193,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.5892,0.9494996,1.5892,1.048539); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.7,0,1.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.5892,0.9990193,2.0392,0.9212695); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(2.0392,0.9212695,20); ci = TColor::GetColor("#f9910c"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(2.0392,0.8767255,2.0392,0.9658136); ci = TColor::GetColor("#f9910c"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(2.4,0,2.4,1.8); line->SetLineStyle(2); line->Draw(); marker = new TMarker(0.1036,1.197582,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.1036,1.070044,0.1036,1.325121); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.2,0,0.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.1036,1.197582,0.3286,1.07941); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.3286,1.07941,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.3286,0.9690778,0.3286,1.189742); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.45,0,0.45,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.3286,1.07941,0.5786,1.238685); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.5786,1.238685,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.5786,1.103282,0.5786,1.374089); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.7,0,0.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.5786,1.238685,0.8286,1.070291); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.8286,1.070291,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.8286,0.9410973,0.8286,1.199485); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.95,0,0.95,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.8286,1.070291,1.0786,0.7963992); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.0786,0.7963992,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.0786,0.6813629,1.0786,0.9114354); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.2,0,1.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.0786,0.7963992,1.3536,0.9233731); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.3536,0.9233731,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.3536,0.7879375,1.3536,1.058809); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.5,0,1.5,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.3536,0.9233731,1.6036,1.066334); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.6036,1.066334,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.6036,0.8539173,1.6036,1.278751); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.7,0,1.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.6036,1.066334,2.0536,1.283384); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(2.0536,1.283384,20); ci = TColor::GetColor("#0a9128"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(2.0536,1.067281,2.0536,1.499488); ci = TColor::GetColor("#0a9128"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(2.4,0,2.4,1.8); line->SetLineStyle(2); line->Draw(); marker = new TMarker(0.118,0.1968883,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.118,0.1722209,0.118,0.2215558); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.2,0,0.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.118,0.1968883,0.343,0.2348717); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.343,0.2348717,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.343,0.2130683,0.343,0.2566752); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.45,0,0.45,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.343,0.2348717,0.593,0.2059685); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.593,0.2059685,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.593,0.1802414,0.593,0.2316957); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.7,0,0.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.593,0.2059685,0.843,0.2345659); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.843,0.2345659,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.843,0.208081,0.843,0.2610507); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.95,0,0.95,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.843,0.2345659,1.093,0.3094085); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.093,0.3094085,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.093,0.2799161,1.093,0.3389009); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.2,0,1.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.093,0.3094085,1.368,0.347837); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.368,0.347837,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.368,0.2999248,1.368,0.3957492); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.5,0,1.5,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.368,0.347837,1.618,0.5309299); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.618,0.5309299,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.618,0.4081874,1.618,0.6536723); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.7,0,1.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.618,0.5309299,2.068,0.2949066); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(2.068,0.2949066,20); ci = TColor::GetColor("#999999"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(2.068,0,2.068,0.7323252); ci = TColor::GetColor("#999999"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(2.4,0,2.4,1.8); line->SetLineStyle(2); line->Draw(); marker = new TMarker(0.1252,0.9784018,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.1252,0.8521009,0.1252,1.104703); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.2,0,0.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.1252,0.9784018,0.3502,0.9447267); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.3502,0.9447267,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.3502,0.8411522,0.3502,1.048301); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.45,0,0.45,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.3502,0.9447267,0.6002,0.7547158); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.6002,0.7547158,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.6002,0.6180429,0.6002,0.8913887); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.7,0,0.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.6002,0.7547158,0.8502,1.12315); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(0.8502,1.12315,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(0.8502,0.9840732,0.8502,1.262226); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(0.95,0,0.95,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(0.8502,1.12315,1.1002,1.107947); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.1002,1.107947,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.1002,0.9620515,1.1002,1.253843); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.2,0,1.2,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.1002,1.107947,1.3752,0.6245485); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.3752,0.6245485,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.3752,0.462954,1.3752,0.786143); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.5,0,1.5,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.3752,0.6245485,1.6252,0.8379717); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(1.6252,0.8379717,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(1.6252,0.5506004,1.6252,1.125343); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(1.7,0,1.7,1.8); line->SetLineStyle(2); line->Draw(); line = new TLine(1.6252,0.8379717,2.0752,0.3802364); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(3); line->Draw(); marker = new TMarker(2.0752,0.3802364,20); ci = TColor::GetColor("#ff0505"); marker->SetMarkerColor(ci); marker->SetMarkerStyle(20); marker->SetMarkerSize(1.2); marker->Draw(); line = new TLine(2.0752,0.06910222,2.0752,0.6913706); ci = TColor::GetColor("#ff0505"); line->SetLineColor(ci); line->SetLineWidth(2); line->Draw(); line = new TLine(2.4,0,2.4,1.8); line->SetLineStyle(2); line->Draw(); TH2F *axis0.0933652750511_copy6 = new TH2F("axis0.0933652750511_copy6","",50,0,2.4,50,0,1.8); axis0.0933652750511_copy6->SetDirectory(0); axis0.0933652750511_copy6->SetLineStyle(0); axis0.0933652750511_copy6->SetMarkerStyle(20); axis0.0933652750511_copy6->SetMarkerSize(0.16); axis0.0933652750511_copy6->GetXaxis()->SetTitle("top quark |y|"); axis0.0933652750511_copy6->GetXaxis()->SetNdivisions(1005); axis0.0933652750511_copy6->GetXaxis()->SetLabelFont(43); axis0.0933652750511_copy6->GetXaxis()->SetLabelOffset(0.0077); axis0.0933652750511_copy6->GetXaxis()->SetLabelSize(32); axis0.0933652750511_copy6->GetXaxis()->SetTitleSize(35); axis0.0933652750511_copy6->GetXaxis()->SetTickLength(0.04032258); axis0.0933652750511_copy6->GetXaxis()->SetTitleOffset(1.15); axis0.0933652750511_copy6->GetXaxis()->SetTitleFont(43); axis0.0933652750511_copy6->GetYaxis()->SetTitle(" Scale factor"); axis0.0933652750511_copy6->GetYaxis()->SetNdivisions(512); axis0.0933652750511_copy6->GetYaxis()->SetLabelFont(43); axis0.0933652750511_copy6->GetYaxis()->SetLabelOffset(0.0077); axis0.0933652750511_copy6->GetYaxis()->SetLabelSize(32); axis0.0933652750511_copy6->GetYaxis()->SetTitleSize(35); axis0.0933652750511_copy6->GetYaxis()->SetTickLength(0.03164557); axis0.0933652750511_copy6->GetYaxis()->SetTitleOffset(1.3); axis0.0933652750511_copy6->GetYaxis()->SetTitleFont(43); axis0.0933652750511_copy6->GetZaxis()->SetLabelFont(43); axis0.0933652750511_copy6->GetZaxis()->SetLabelOffset(0.0077); axis0.0933652750511_copy6->GetZaxis()->SetLabelSize(32); axis0.0933652750511_copy6->GetZaxis()->SetTitleSize(34); axis0.0933652750511_copy6->GetZaxis()->SetTitleOffset(1.3); axis0.0933652750511_copy6->GetZaxis()->SetTitleFont(43); axis0.0933652750511_copy6->Draw("sameaxis"); TPaveText *pt = new TPaveText(0.14,0.94,0.14,0.94,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(11); pt->SetTextFont(63); pt->SetTextSize(34); TText *AText = pt->AddText("CMS"); pt->Draw(); pt = new TPaveText(0.24,0.94,0.24,0.94,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(11); pt->SetTextFont(53); pt->SetTextSize(34); AText = pt->AddText("Preliminary"); pt->Draw(); cvMulti0.984295447508->Modified(); cvMulti0.984295447508->cd(); cvMulti0.984295447508->SetSelected(cvMulti0.984295447508); }
void PrintVertexRosenbrock() { // open file std::ifstream data ("Vertex.txt", std::ios::in); double buf; std::vector<double> x1; std::vector<double> x2; std::vector<double> x3; std::vector<double> y1; std::vector<double> y2; std::vector<double> y3; // loop on file while (1) { data >> buf; if (data.eof()) {break;} x1.push_back(buf); data >> buf; y1.push_back(buf); data >> buf; x2.push_back(buf); data >> buf; y2.push_back(buf); data >> buf; x3.push_back(buf); data >> buf; y3.push_back(buf); } // functions //TF2* f = new TF2 ("himmelblau", "(x*x + y - 11)*(x*x + y - 11) + (x + y*y - 7)*(x + y*y - 7)", 0, 10, 0, 10); // himmelblau gStyle->SetOptTitle(0); TF2* f = new TF2 ("rosenbrock", "100*(y-x*x)*(y-x*x) + (1-x)*(1-x)", -1.5, 2.2, -0.5, 2.2); // rosenbrock f->SetNpx(1000); f->SetNpy(1000); f->GetXaxis()->SetTitle("x"); f->GetYaxis()->SetTitle("y"); TCanvas* c1 = new TCanvas; c1->SetLogz(); rosenbrock->Draw("COLZ"); // loop on vertex std::vector<TLine*> vl1; std::vector<TLine*> vl2; std::vector<TLine*> vl3; TLine* l1; TLine* l2; TLine* l3; for (int i = 0; i < x1.size(); i++) { l1 = new TLine(0,0,0,0); l2 = new TLine(0,0,0,0); l3 = new TLine(0,0,0,0); l1->SetLineWidth(1.5); l2->SetLineWidth(1.5); l3->SetLineWidth(1.5); l1->SetLineColor(kBlue -10 + i); l2->SetLineColor(kBlue -10 + i); l3->SetLineColor(kBlue -10 + i); l1->SetX1(x1.at(i)); l1->SetY1(y1.at(i)); l1->SetX2(x2.at(i)); l1->SetY2(y2.at(i)); l2->SetX1(x2.at(i)); l2->SetY1(y2.at(i)); l2->SetX2(x3.at(i)); l2->SetY2(y3.at(i)); l3->SetX1(x3.at(i)); l3->SetY1(y3.at(i)); l3->SetX2(x1.at(i)); l3->SetY2(y1.at(i)); l1->Draw("same"); l2->Draw("same"); l3->Draw("same"); } TMarker* min = new TMarker (1,1,0); min ->SetMarkerColor (kBlue); min->SetMarkerStyle(20); min->SetMarkerSize (1.0); min->Draw(); }
void Neutrals (/*TH1 *h1*/)//const char *part="e")//,int nevent = 1000) { cout << "TEST VII" << endl; char infile[100]; int pz[9] = {1,2,4,8,12,16,32,40,50}; double x[9]; double means[9] = {0}; double y[9]; double mval = 0; int lastbincont = 0; bool lastbin = false; int var = 11; double intnum[1000] = {0}; double varnum[1000] = {0}; char *part[] = {"gamma","neutron","anti_neutron"}; int i = 0; int w =4; //TCanvas *c3 = new TCanvas("TresGraphitos","stupid graph",1); // TH1F *h4 = new TH1F("histo","histo",1000,0,.5); //TH2F *h3 = new TH2F("HistoGraph","HistoGraph",1000,0,.55,1000,0,1.2); // TMarker *grmark = new TMarker(); // TCanvas *c19 = new TCanvas(); // h3->Draw(); for (int q=0; q<3; q++) { for (int w=0; w<9;w++) { cout << "TEST VI" << endl; char ffile[100]; sprintf(ffile,"/phenix/u/jpinkenburg/sPHENIX/analysis/AntiSigma/macros/HistoBaseFiles/%s_ThinBins.root", part[q]); TFile *f = TFile::Open(ffile); char hname[100]; sprintf(hname,"%s%dd",part[q],pz[w]); TH1F *h1 = (TH1F *)f->Get(hname); var = 11; i = 0; while (var <= 8001) { if (i<1000) { varnum[i] = .005*(i); intnum[i] = (h1->Integral(var-10,var))/10000.;//(h1->Integral()); i++; } var+=10; } // varnum[0] = 0; // intnum[0] = 0; char fname [100]; sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root"); TFile *fout = TFile::Open(fname,"UPDATE"); // h1->Write(); //fout->Write(); f->Close(); //char hname[100]; //sprintf(hname,"%s%dGeV",part[q],pz[w]); // cout << h1->Integral() << " " << hname << " " << pz[i] << endl; //TH2 *h2 = new TH2F("hname","hname",1,0,5,1,0,1.2); gStyle->SetOptStat(0); TMarker *mean = new TMarker(); mean->SetMarkerStyle(20); mean->SetMarkerColor(3); char canvname[100]; sprintf(canvname,"%s%d",part[q],pz[w]); //TCanvas *c3 = new TCanvas(canvname,"stupid graph",1); //double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9}; cout << "TEST V" << endl; TGraph *gr = new TGraph((i-2),varnum,intnum); char gtitle[100]; sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]); char gname[100]; sprintf(gname,"%s%dGeV",part[q],pz[w]); cout << intnum[50] << " " << varnum[50] << endl; gr->SetTitle(gtitle); gr->SetName(gname); gr->SetMarkerStyle(20); if (part[q] == "anti_neutron") { gr->SetMarkerColor(4); } else if (part[q] == "neutron") { gr->SetMarkerColor(2); } else if (part[q] == "gamma") { gr->SetMarkerColor(3); } else { cout << "idiot" << endl; } // gr->SetMaximum(1.2); //h2->Draw(); //gr->Draw("A*"); gr->Draw("ALP"); //c3->DrawFrame(0,0,0.5,1.2); // gr->PaintGrapHist((i-1),varnum,intnum,"chopt"); // gr->SetHistogram(h4); //h4->Write(); gr->Write(); cout << "TEST 1" << endl; // TH2F *h3 = (TH2F *) "HistoGraph"; cout << "TEST II" << endl; cout << "TEST III" << endl; //h3->Write(); cout << "TEST IV" << endl; //double x; //double y; //gr()->GetPoint( fout->Write(); fout->Close(); // gr->Close(); for (int a=0;a<1000;a++) { intnum[a] = 0; varnum[a] = 0; } } } }