本文整理汇总了C++中TMarker::SetMarkerSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TMarker::SetMarkerSize方法的具体用法?C++ TMarker::SetMarkerSize怎么用?C++ TMarker::SetMarkerSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMarker
的用法示例。
在下文中一共展示了TMarker::SetMarkerSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gtime2
void gtime2(Int_t nsteps = 200, Int_t np=5000) {
if (np > 5000) np = 5000;
Int_t color[5000];
Double_t cosphi[5000], sinphi[5000], speed[5000];
TRandom3 r;
Double_t xmin = 0, xmax = 10, ymin = -10, ymax = 10;
TGraphTime *g = new TGraphTime(nsteps,xmin,ymin,xmax,ymax);
g->SetTitle("TGraphTime demo 2;X;Y");
Int_t i,s;
Double_t phi,fact = xmax/Double_t(nsteps);
for (i=0;i<np;i++) { //calculate some object parameters
speed[i] = r.Uniform(0.5,1);
phi = r.Gaus(0,TMath::Pi()/6.);
cosphi[i] = fact*speed[i]*TMath::Cos(phi);
sinphi[i] = fact*speed[i]*TMath::Sin(phi);
Double_t rc = r.Rndm();
color[i] = kRed;
if (rc > 0.3) color[i] = kBlue;
if (rc > 0.7) color[i] = kYellow;
}
for (s=0;s<nsteps;s++) { //fill the TGraphTime step by step
for (i=0;i<np;i++) {
Double_t xx = s*cosphi[i];
if (xx < xmin) continue;
Double_t yy = s*sinphi[i];
TMarker *m = new TMarker(xx,yy,25);
m->SetMarkerColor(color[i]);
m->SetMarkerSize(1.5 -s/(speed[i]*nsteps));
g->Add(m,s);
}
g->Add(new TPaveLabel(.70,.92,.98,.99,Form("shower at %5.3f nsec",3.*s/nsteps),"brNDC"),s);
}
g->Draw();
}
示例2: DrawLabel
void DrawLabel(TString txt, double x, double y, int mstyle, int col, double msize) {
TMarker *m = new TMarker(x,y,mstyle);
m->SetNDC();
m->SetMarkerSize(msize); m->SetMarkerColor(col);
TLine *l = new TLine();
l->SetLineWidth(2); l->SetLineColor(col);
m->Draw();
tex->SetTextSize(0.04);
tex->SetTextAlign(12); tex->SetTextColor(col);
tex->DrawLatex(x+0.025,y,txt);
tex->SetTextColor(kBlack);
}
示例3: myMarkerText
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);
}
示例4: myMarkerText
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);
}
示例5: overlayWorkingPoints
// 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();
}
}
示例6: showHistogram1d
void showHistogram1d(TH1* histogram,
const std::string& xAxisTitle,
Float_t* genX,
const std::string& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 600);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->SetTopMargin(0.10);
canvas->SetLeftMargin(0.16);
canvas->SetRightMargin(0.14);
canvas->SetBottomMargin(0.12);
TAxis* xAxis = histogram->GetXaxis();
xAxis->SetTitle(xAxisTitle.data());
xAxis->SetTitleOffset(1.15);
TAxis* yAxis = histogram->GetYaxis();
yAxis->SetTitle("Sampling Points");
yAxis->SetTitleOffset(1.60);
histogram->SetLineColor(1);
histogram->SetLineWidth(2);
histogram->SetMarkerColor(1);
histogram->SetMarkerStyle(20);
histogram->Draw("e1p");
TMarker* genMarker = 0;
if ( genX ) {
genMarker = new TMarker(*genX, 0.10, 34);
genMarker->SetMarkerColor(1);
genMarker->SetMarkerSize(2);
genMarker->Draw();
}
canvas->Update();
size_t idx = outputFileName.find_last_of('.');
std::string outputFileName_plot = std::string(outputFileName, 0, idx);
if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
canvas->Print(std::string(outputFileName_plot).append(".png").data());
canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
canvas->Print(std::string(outputFileName_plot).append(".root").data());
delete genMarker;
delete canvas;
}
示例7: drawTransition
void drawTransition(){
TBox *bTrans = new TBox(0., 0., 0.97, 0.97);
if(iColor)bTrans->SetFillColor(kYellow-9);
if (! iColor)bTrans->SetFillStyle(4017);
bTrans->Draw();
TEllipse *eTrans1 = new TEllipse(0., 0., 0.9, 0.7, 70., 90., 0.);
eTrans1->SetNoEdges();
eTrans1->SetFillColor(17);
eTrans1->SetLineWidth(2);
eTrans1->SetLineStyle(7);
eTrans1->Draw();
TEllipse *eTrans2 = new TEllipse(0., 0., 0.9, 0.7, 0., 70., 0.);
eTrans2->SetNoEdges();
eTrans2->SetFillColor(17);
eTrans2->SetLineWidth(2);
eTrans2->Draw();
TMarker *mCrit = new TMarker(0.29, 0.6625, 20);
mCrit->SetMarkerSize(1.4);
mCrit->Draw();
}
示例8: TMarker
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;
}
示例9: Show_SR
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") ;
//.........这里部分代码省略.........
示例10: drawMeasurement
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]);
//.........这里部分代码省略.........
示例11: Drawing
//.........这里部分代码省略.........
for(unsigned int i=0; i<fr->J1_PseudoPoints.size(); i++)
{
for(unsigned int j=0; j<fr->J3_PseudoPoints.size(); j++)
{
for(unsigned int k=0; k<fr->J4_PseudoPoints.size(); k++)
{
double Rad = FindR(fr->J1_PseudoPoints[i],fr->J3_PseudoPoints[j],fr->J4_PseudoPoints[k]);
double Xcen = FindX(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
double Ycen = FindY(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
Hough->Fill(Xcen,Ycen,Rad);
Houghxy->Fill(Xcen,Ycen);
Houghyr->Fill(Ycen,Rad);
Houghxr->Fill(Xcen,Rad);
}
}
}
}
//J2,J3,J4;
if(fr->J2_PseudoPoints.size() >= 1 && fr->J3_PseudoPoints.size() >= 1 && fr->J4_PseudoPoints.size() >= 1)
{
for(unsigned int i=0; i<fr->J2_PseudoPoints.size(); i++)
{
for(unsigned int j=0; j<fr->J3_PseudoPoints.size(); j++)
{
for(unsigned int k=0; k<fr->J4_PseudoPoints.size(); k++)
{
double Rad = FindR(fr->J2_PseudoPoints[i],fr->J3_PseudoPoints[j],fr->J4_PseudoPoints[k]);
double Xcen = FindX(fr->J2_PseudoPoints[i].X(),fr->J2_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
double Ycen = FindY(fr->J2_PseudoPoints[i].X(),fr->J2_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
Hough->Fill(Xcen,Ycen,Rad);
Houghxy->Fill(Xcen,Ycen);
Houghyr->Fill(Ycen,Rad);
Houghxr->Fill(Xcen,Rad);
}
}
}
}
/*
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DO NOT ERASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//Forming PseudoPoints:
for(unsigned int ps=0; ps<fr->AllX.size(); ps++)
{
for(unsigned int s=0; s<fr->AllY.size(); s++)
{
fr->PseudoPoints.push_back(TVector3(fr->AllX[ps].Cor(),fr->AllY[s].Cor(),0));
}
}
//Full Combinatorial:
for(unsigned int i=0; i<fr->PseudoPoints.size()-2; i++)
{
for(unsigned int j=i+1; j<fr->PseudoPoints.size()-1; j++)
{
for(unsigned int k=j+1; k<fr->PseudoPoints.size(); k++)
{
double Rad = FindR(fr->PseudoPoints[i],fr->PseudoPoints[j],fr->PseudoPoints[k]);
double Xcen = FindX(fr->PseudoPoints[i].X(),fr->PseudoPoints[i].Y(),fr->PseudoPoints[j].X(),fr->PseudoPoints[j].Y(),fr->PseudoPoints[k].X(),fr->PseudoPoints[k].Y());
double Ycen = FindY(fr->PseudoPoints[i].X(),fr->PseudoPoints[i].Y(),fr->PseudoPoints[j].X(),fr->PseudoPoints[j].Y(),fr->PseudoPoints[k].X(),fr->PseudoPoints[k].Y());
Hough->Fill(Xcen,Ycen,Rad);
Houghxy->Fill(Xcen,Ycen);
Houghyr->Fill(Ycen,Rad);
Houghxr->Fill(Xcen,Rad);
}
}
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
int xbin, ybin, zbin;
xbin=0; ybin=0; zbin=0;
Hough->GetMaximumBin(xbin, ybin, zbin);
//cout << "xbin= " << xbin << " ybin= " << ybin << " zbin= " << zbin << endl;
TAxis *xaxis = Hough->GetXaxis();
double Xrec=xaxis->GetBinCenter(xbin);
cout<<"Xrec= "<< Xrec <<endl;
TAxis *yaxis = Hough->GetYaxis();
double Yrec=yaxis->GetBinCenter(ybin);
cout<<"Yrec= "<< Yrec <<endl;
TAxis *zaxis = Hough->GetZaxis();
double Rrec=zaxis->GetBinCenter(zbin);
cout<<"Rrec= "<< Rrec <<endl;
//Drawing the founded ring and its center:
TEllipse ring (Xrec,Yrec,Rrec,Rrec,1,360,0);
ring.SetLineColor(2);
ring.SetFillStyle(0);
ring.DrawEllipse(Xrec,Yrec,Rrec,Rrec,0,360,0);
HBD->Update();
TMarker circumcenter (Xrec,Yrec,8);
circumcenter.SetMarkerColor(2);
circumcenter.SetMarkerSize(1);
circumcenter.DrawMarker(Xrec,Yrec);
HBD->Update();
}
示例12: TCanvas
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);
//.........这里部分代码省略.........
示例13: showHistogram2d
void showHistogram2d(TH2* histogram,
const std::string& xAxisTitle, const std::string& yAxisTitle,
int zAxisNormOption, double zMin, double zMax,
Float_t* genX, Float_t* genY,
const std::string& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", 900, 800);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->SetTopMargin(0.10);
canvas->SetLeftMargin(0.12);
canvas->SetRightMargin(0.14);
canvas->SetBottomMargin(0.12);
histogram->SetTitle("");
histogram->SetStats(false);
int numBinsX = histogram->GetNbinsX();
int numBinsY = histogram->GetNbinsY();
if ( zAxisNormOption == kNormByQuantiles ) {
std::vector<double> binContents;
for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
binContents.push_back(histogram->GetBinContent(iBinX, iBinY));
}
}
std::sort(binContents.begin(), binContents.end());
histogram->SetMinimum(binContents[TMath::Nint(0.05*binContents.size())]);
histogram->SetMaximum(binContents[TMath::Nint(0.95*binContents.size())]);
} else if ( zAxisNormOption == kNormByNegLogMax ) {
double maxBinContent = 0.;
for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
double binContent = histogram->GetBinContent(iBinX, iBinY);
if ( binContent > maxBinContent ) {
std::cout << "binX = " << iBinX << " (x = " << histogram->GetXaxis()->GetBinCenter(iBinX) << "),"
<< " binY = " << iBinY << " (y = " << histogram->GetYaxis()->GetBinCenter(iBinY) << "): maxBinContent = " << maxBinContent << std::endl;
maxBinContent = binContent;
}
}
}
double logMaxBinContent = TMath::Log(maxBinContent);
for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
double binContent = histogram->GetBinContent(iBinX, iBinY);
if ( binContent > 0. ) {
histogram->SetBinContent(iBinX, iBinY, -TMath::Log(binContent) + logMaxBinContent);
} else {
histogram->SetBinContent(iBinX, iBinY, -1.);
}
}
}
histogram->SetMinimum(0.);
histogram->SetMaximum(zMax);
} else if ( zAxisNormOption == kNormByValue ) {
histogram->SetMinimum(zMin);
histogram->SetMaximum(zMax);
} else assert(0);
TAxis* xAxis = histogram->GetXaxis();
xAxis->SetTitle(xAxisTitle.data());
xAxis->SetTitleOffset(1.15);
TAxis* yAxis = histogram->GetYaxis();
yAxis->SetTitle(yAxisTitle.data());
yAxis->SetTitleOffset(1.30);
gStyle->SetPalette(1,0);
histogram->Draw("COLZ");
TMarker* genMarker = 0;
if ( genX && genY ) {
genMarker = new TMarker(*genX, *genY, 34);
genMarker->SetMarkerColor(1);
genMarker->SetMarkerSize(2);
genMarker->Draw();
}
canvas->Update();
size_t idx = outputFileName.find_last_of('.');
std::string outputFileName_plot = std::string(outputFileName, 0, idx);
if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
canvas->Print(std::string(outputFileName_plot).append(".png").data());
canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
canvas->Print(std::string(outputFileName_plot).append(".root").data());
delete genMarker;
delete canvas;
}
示例14: plotFit
//.........这里部分代码省略.........
// TGraph *tphplots[s2bSteps];
TGraph *tphplots[s2bSteps-30];
// for(s2bStep=0; s2bStep<s2bSteps; s2bStep++) {
for(s2bStep=0; s2bStep<s2bSteps-30; s2bStep++) {
Float_t tphArray[tphSteps], fitxArray[tphSteps];
tphStep = 0;
for(point=0; point<Npoints; point++) {
tree->GetEntry(point);
if(fits2b == s2bValues[s2bStep]) {
// tphArray[tphStep] = fittph;
tphArray[tphStep] = sqrt(1.0/(1.0+fittph));
if (fittph < tphMin) tphMin = fittph;
if (fittph > tphMax) tphMax = fittph;
fitxArray[tphStep] = fitx;
if (fitx < fitxMin) fitxMin = fitx;
if (fitx > fitxMax) fitxMax = fitx;
tphStep++;
TMarker *m = new TMarker(fitxArray[tphStep],tphArray[tphStep],20);
m->SetMarkerSize(2);
m->SetMarkerColor(31+tphStep);
m->Draw();
}
}
if (s2bStep == 0) {
TH1F* frame = MyC->DrawFrame(0.0,0.0,1.1*fitxMax,1.1);
// TH1F* frame = MyC->DrawFrame(0.7*fitxMin,0.7*tphMin,1.1*fitxMax,1.1*tphMax);
TAxis *xaxis = frame->GetXaxis();
TAxis *yaxis = frame->GetYaxis();
xaxis->SetTitle("x = u^{2}/v^{2}");
xaxis->CenterTitle();
xaxis->SetTitleOffset(1.);
xaxis->SetDecimals();
xaxis->SetLabelSize(0.03);
xaxis->SetLabelOffset(0.01);
yaxis->SetTitle("tan^{2}(#phi)");
yaxis->CenterTitle();
yaxis->SetTitleOffset(1.);
yaxis->SetDecimals();
yaxis->SetLabelSize(0.03);
yaxis->SetLabelOffset(0.01);
frame->SetTitle(plottitle.c_str());
示例15: EventDisplayForBaby
//.........这里部分代码省略.........
{
for(int i=0; i<(int)els_pt_->size(); i++)
{
if(els_miniso_->at(i)>0.1) continue;
if(els_sigid_->at(i)!=1) continue;
if(els_pt_->at(i)<20) continue;
lepPt =els_pt_->at(i);
lepEta =els_eta_->at(i);
lepPhi =els_phi_->at(i);
}
}
if(nmus_==1)
{
for(int i=0; i<(int)mus_pt_->size(); i++)
{
if(mus_miniso_->at(i)>0.2) continue;
if(mus_sigid_->at(i)!=1) continue;
if(mus_pt_->at(i)<20) continue;
lepPt =mus_pt_->at(i);
lepEta =mus_eta_->at(i);
lepPhi =mus_phi_->at(i);
}
}
myText(xalign+0.01,0.96,Form("H_{T} = %.0f GeV",ht_),1,0.04);
myText(xalign+0.01,0.91,Form("M_{J} = %.0f GeV",mj_),1,0.04);
myText(xalign+0.01,0.86,Form("#slash{E}_{T} = %.0f GeV",met_),1,0.04);
myText(xalign+0.01,0.81,Form("m_{T} = %.0f GeV",mt_),1,0.04);
myText(xalign+0.01,0.76,Form("reco %s p_{T} = %.0f GeV", nmus_==1?"#mu":"e", lepPt), kBlack, 0.04);
nextline=0.76;
TMarker recolep = TMarker(lepEta, lepPhi, 27);
recolep.SetMarkerSize(4);
recolep.SetMarkerColor(kRed);
genpart.push_back(recolep);
TMarker mumark = TMarker(xalign,nextline,27);
mumark.SetNDC();
mumark.SetX(xalign);
mumark.SetY(nextline+0.01);
mumark.SetMarkerSize(2);
mumark.SetMarkerColor(kRed);
genpart.push_back(mumark);
myText(xalign+0.01,0.71,Form("-- large-R jets --"),1,0.04);
myText(xalign+0.01,0.67,Form("(pT, eta, phi, mass)"),1,0.03);
nextline=0.635;
for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
{
myText(xalign+0.01,nextline,Form("%3.0f, %2.1f, %2.1f, %3.0f",
fjets_pt_->at(ifj),fjets_eta_->at(ifj),fjets_phi_->at(ifj),fjets_m_->at(ifj)),1,0.03);
nextline=nextline-0.035;
}
nextline=nextline-0.015;
myText(xalign+0.01,nextline,Form("-- AK4 jets --"),1,0.04);
nextline=nextline-0.04;
myText(xalign+0.01,nextline,Form("(pT, eta, phi)"),1,0.03);
nextline=nextline-0.035;
for(int ij = 0; ij< (int)jets_pt_->size(); ij++)
{
if(jets_islep_->at(ij)==1) continue;
myText(xalign+0.01,nextline,Form("%3.0f, %2.1f, %2.1f",
jets_pt_->at(ij),jets_eta_->at(ij),jets_phi_->at(ij)),1,0.03);
nextline=nextline-0.035;
}
if(truth) myText(xalign,0.68,"Gen p_{T} [GeV]",1,0.04);