本文整理汇总了C++中TMarker类的典型用法代码示例。如果您正苦于以下问题:C++ TMarker类的具体用法?C++ TMarker怎么用?C++ TMarker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TMarker类的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: drawEventRPhi
void drawEventRPhi(double vxlb, double vylb, double vxl0, double vyl0, double pmu1, double phimu1, double pmu2, double phimu2, double ppr, double phipr, double ppi, double phipi, int colors = 0)
{
Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1);
switch(colors)
{
case 0:
colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break;
case 1:
colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break;
}
// draw the vertices
TMarker *m;
const double xlb = vxlb;
const double ylb = vylb;
m = new TMarker(xlb,ylb,7);
m->SetMarkerColor(colLb);
m->Draw();
const double xl0 = vxl0;
const double yl0 = vyl0;
m = new TMarker(xl0,yl0,7);
m->SetMarkerColor(colL0);
m->Draw();
// draw the l0 flight line
TLine *l;
l = new TLine(vxlb,vylb,vxl0,vyl0);
l->SetLineColor(colL0);
l->SetLineStyle(2);
l->Draw();
// draw the muons
TArrow *a;
const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(phimu1);
const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(phimu1);
a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
a->SetLineColor(colMu1);
a->Draw();
const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(phimu2);
const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(phimu2);
a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">");
a->SetLineColor(colMu2);
a->Draw();
// draw the p and pi
const double xpr = xl0 + scalepr * ppr * TMath::Cos(phipr);
const double ypr = yl0 + scalepr * ppr * TMath::Sin(phipr);
a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
a->SetLineColor(colPr);
a->Draw();
const double xpi = xl0 + scalepi * ppi * TMath::Cos(phipi);
const double ypi = yl0 + scalepi * ppi * TMath::Sin(phipi);
a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
a->SetLineColor(colPi);
a->Draw();
}
示例4: 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();
}
}
示例5: 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;
}
示例6: 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();
}
示例7: 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);
}
示例8: 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);
}
示例9: mark_overflows
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;
}
示例10: genPlots02
//.........这里部分代码省略.........
if(fVerbose>0)
cout << "Succesfully opened file " << fullPath << endl;
// Get TTree
TTree* t = (TTree*) f->Get("events");
if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
// Do a cut, if needed
//t->Draw(">>lst","chi2lb>.1&&mlb>5.61&&mlb<5.63");
//t->Draw(">>lst","chi2lb>.1&&isSig==1");
t->Draw(">>lst","(rid1m&4)==4&&(rid2m&4)==4&&mjp>2.895&&mjp<3.295&&prob1m>0.1&&prob2m>0.1&&ptjp>2&&probjp>0.005&&ml0>1.101&&ml0<1.129&&probpr>0.02&&probpi>0.02&&rptpr>rptpi&&ptl0>3&&rptpr>1&&rptpi>0.5&&probl0>0.02&&alphal0<0.3&&d3l0>1&&d3l0/d3El0>10&&problb>0.001&&alphalb<0.3");
TEventList *lst;
lst = (TEventList*)gDirectory->Get("lst");
t->SetEventList(lst);
if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
// Do plots
c->cd(1);
//doPlot2d(t,"hrzL0vtx", "vrl0:TMath::Abs(vzl0)",30,0,300,30,0,120,"Tit","|z|","r","cm","cm");
if (custBinning)
{
double newbinsX[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
const int newbinsX_size = sizeof(newbinsX)/sizeof(double);
std::vector<double> binvecX(newbinsX,newbinsX+newbinsX_size);
//double newbinsY[]={0,1,2,3,4,5,6,7,8,9,10};
double newbinsY[]={0,0.5,1,2,4,8,16,32};
const int newbinsY_size = sizeof(newbinsY)/sizeof(double);
std::vector<double> binvecY(newbinsY,newbinsY+newbinsY_size);
doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",binvecX, binvecY,"#Lambda vertices","|z|","r","cm","cm");
}
else
{
doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",30,0,50,30,0,30,"#Lambda vertices","|z|","r","cm","cm");
}
// add tracker
TPad* pad;
pad = (TPad*)c->cd(1);
pad->Modified();
pad->Update();
repositionPalette("hrzL0vtxreco");
pad->Update();
pad->SetLogz();
drawTracker(pad);
if (nOverlay<=0) return;
int maxN = nOverlay;
if (maxN > t->GetEntries()) maxN = t->GetEntries();
double vrl0,vzl0,ppr,ppi,etapr,etapi;
t->SetBranchAddress("vrl0",&vrl0);
t->SetBranchAddress("vzl0",&vzl0);
t->SetBranchAddress("ppr",&ppr);
t->SetBranchAddress("etapr",&etapr);
t->SetBranchAddress("ppi",&ppi);
t->SetBranchAddress("etapi",&etapi);
double scalepr = 4;
double scalepi = 8;
{ // reference indicator
const double x1pr = 0; const double y1pr = -3;
const double x2pr = scalepr; const double y2pr = y1pr;
const double versatz = 14;
const double x1pi = x1pr+versatz; const double y1pi = -3;
const double x2pi = x2pr+versatz+scalepi; const double y2pi = y1pi;
TArrow *a;
a = new TArrow(x1pr,y1pr,x2pr,y2pr,.01,">");
a->SetLineColor(24);
a->Draw();
TLatex tl;
tl.SetTextSize(20);
tl.SetTextFont(4);
tl.DrawLatex(x1pr,y2pr-1.2,"p(p) / 1 GeV");
a = new TArrow(x1pi,y1pi,x2pi,y2pi,.01,">");
a->SetLineColor(20);
a->Draw();
tl.SetTextSize(20);
tl.SetTextFont(4);
tl.DrawLatex(x1pi,y2pi-1.2,"p(#pi) / 1 GeV");
}
for (int i = 0; i!=maxN; i++)
{
t->GetEntry(i);
const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)));
const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)));
const double x1=TMath::Abs(vzl0);
const double y1=vrl0;
const double x2pr=x1+scalepr*ppr*TMath::Cos(thetapr);
const double y2pr=y1+scalepr*ppr*TMath::Sin(thetapr);
const double x2pi=x1+scalepi*ppi*TMath::Cos(thetapi);
const double y2pi=y1+scalepi*ppi*TMath::Sin(thetapi);
TArrow *a;
a = new TArrow(x1,y1,x2pr,y2pr,.01,">");
a->SetLineColor(24);
a->Draw();
a = new TArrow(x1,y1,x2pi,y2pi,.01,">");
a->SetLineColor(20);
a->Draw();
TMarker *m = new TMarker(x1,y1,7);
m->SetMarkerColor(28);
m->Draw();
}
}
示例11: geugd_riordan
//.........这里部分代码省略.........
#endif
// gen0->Draw("same");
#ifdef NEW_ROBERTS
roberts_curve->Draw("same");
#endif
// ourfit->Draw("same");
// bbba05->Draw("same");
//lomon->Draw("same");
// bandi->Draw("same");
#ifdef PQCD
legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
#endif
#ifdef GALSTER
legThry->AddEntry(galster,"Galster fit (1971)","l");
#endif
// legThry->AddEntry(gen0,"G_{E}^{n} = 0","l");
#ifdef NEW_ROBERTS
legThry->AddEntry(roberts_curve,"q(qq) Faddeev - I. Cloet, ANL","l");
#endif
// legThry->AddEntry(bbba05,"BBBA05","l");
// legThry->AddEntry(lomon, "Lomon", "l");
// legThry->AddEntry(ourfit, "Our Fit", "l");
legThry->Draw();
legDta->Draw();
mgrDta->Draw("p");
legDta->Draw();
TEllipse *cir1 = new TEllipse(1.31, 0.0, 0.17, 0.0065);
TEllipse *cir2 = new TEllipse(2.4, 0.0, 0.17, 0.0065);
cir1->SetFillStyle(0);
cir2->SetFillStyle(0);
#ifdef PLOTKIN1
cir1->Draw("same");
// cir2->Draw("same");
// TPaveLabel *exacc = new TPaveLabel( 0.3779, 0.2691, 0.5963, 0.3114, "Expected Accuracy", "NDC");
TPaveLabel *exacc = new TPaveLabel( 0.2716, 0.2733, 0.4899, 0.3136, "Expected Accuracy", "NDC");
exacc->SetFillStyle(0);
exacc->SetBorderSize(0);
exacc->Draw("same");
#endif
// draw a line at 1
cn->Modified();
cn->Update();
cn->SaveAs(Form("%s.pdf",psfile));
cn->SaveAs(Form("%s.eps",psfile));
// cn->SaveAs(Form("%s.root",psfile));
// gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
// cn->SaveAs("bogdan_gen.eps");
return; // LEAVING HERE
// now an overlay, hopefully matching dimensions
// remove everything but the graph
cn->Update();
TList *clist = cn->GetListOfPrimitives();
TFrame* frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
cn->Update();
datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };
gr = OneGraph(&miller);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gen_Miller_Overlay.pdf");
cn->SaveAs("gen_Miller_Overlay.root");
}
示例12: 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") ;
//.........这里部分代码省略.........
示例13: q4gmn_jan2009
//.........这里部分代码省略.........
wgr->Add(gr,"p");
wlg->AddEntry(gr,f->label,"p");
}
else {
wgr->Add(gr,"l");
wlg->AddEntry(gr,f->label,"l");
}
}
f++;
}
mgrThry->Draw("c");
legThry->Draw();
// draw a line at 1
cn->Modified();
cn->Update();
TFrame* frame = gPad->GetFrame();
TLine *line1 = new TLine(frame->GetX1(),1.,frame->GetX2(),1.);
line1->SetLineStyle(1);
line1->Draw();
cn->Update();
cn->SaveAs(Form("%s.eps",psfile));
cn->SaveAs(Form("%s.root",psfile));
gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
return;
// remove everything but the graph
cn->Update();
TList *clist = cn->GetListOfPrimitives();
frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
cn->Update();
{
datafile_t miller = { "figure_input/Miller/lattice.GMn.rtf","Miller",
"[0]","[1]/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
"([3]-[1])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
"([1]-[2])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
0,0,1,3,"F" };
gr = OneGraph(&miller);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gmngd_Miller_Overlay.eps");
cn->SaveAs("gmngd_Miller_Overlay.root");
clist->Remove(gr);
}
{
datafile_t miller_spl = { "figure_input/Miller/lattice.GMn.spl3","Miller",
"[0]","[1]/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
"([3]-[1])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
"([1]-[2])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
0,0,1,3,"F" };
gr = OneGraph(&miller_spl);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller_spl.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gmngd_Miller_Overlay_spl.eps");
cn->SaveAs("gmngd_Miller_Overlay_spl.root");
clist->Remove(gr);
}
}
示例14: 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]);
//.........这里部分代码省略.........
示例15: 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();
}