//---------------- // StandardLabels2D //---------------- void StandardLabels2D(TH2D *axes=NULL) { // This will draw a label or two on the // current plot using the NDC coordinates. // It is put here to make sure all plots have // a consistent labeling. // Date, Author TLatex *lab = new TLatex(0.7, 0.7, "July 27, 2009 DL"); ConvertFromNDC2D(lab, axes); lab->SetTextSize(0.03); lab->SetTextAlign(33); lab->SetTextColor(kBlue); lab->Draw(); // SVN Revision lab = new TLatex(0.7, 0.645, "svn revision: 5396"); ConvertFromNDC2D(lab, axes); lab->SetTextSize(0.02); lab->SetTextAlign(31); lab->SetTextColor(kBlue); lab->Draw(); // Event type lab = new TLatex(0.45, 0.675, "Single proton MULS ON"); ConvertFromNDC2D(lab, axes); lab->SetTextSize(0.03); lab->SetTextAlign(32); lab->Draw(); // Conditions lab = new TLatex(0.7, 0.61, "Full Reconstruction + LR_FORCE_TRUTH"); ConvertFromNDC2D(lab, axes); lab->SetTextSize(0.03); lab->SetTextAlign(31); lab->Draw(); } //---------------- // ConvertFromNDC //---------------- void ConvertFromNDC2D(TLatex *obj, TH2D *h=NULL) { // Bugs in ROOT make it hard to plot labels consistently. // For 1D plots, the histogram axes define the coordinate // system. For 2D plots, we seem to be forced to use the // NDC. There does not seem to be an obvious way to tell // which we're using so we pass the information in in the // form of the "axes" histogram. If it is not NULL, then // we use it to define the limits. Otherwise, we do nothing. if(h==NULL)return; TAxis *xaxis = h->GetXaxis(); int Nbinsx = xaxis->GetNbins(); double xmin = xaxis->GetBinLowEdge(1); double xmax = xmin + xaxis->GetBinLowEdge(Nbinsx); TAxis *yaxis = h->GetYaxis(); int Nbinsy = yaxis->GetNbins(); double ymin = yaxis->GetBinLowEdge(1); double ymax = ymin + yaxis->GetBinLowEdge(Nbinsy); double x = obj->GetX(); double y = obj->GetY(); cout<<" in: x="<