本文整理汇总了C++中TArrow类的典型用法代码示例。如果您正苦于以下问题:C++ TArrow类的具体用法?C++ TArrow怎么用?C++ TArrow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TArrow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawArrow
void drawArrow(Double_t u, Double_t v, Double_t du, Double_t due, Double_t dv, Double_t dve){
if ( du+dv ){
Double_t arrowLengthSqr = du*du+dv*dv;
Double_t relErrorOnArrowLength = sqrt(du*du*due*due+dv*dv*dve*dve)/arrowLengthSqr;
Int_t color = 0; //-10, -9, -7, -4, 0
Int_t lwid = 2;
if ( relErrorOnArrowLength>0.5 ) color=kBlue-9;
if ( relErrorOnArrowLength<0.4 ) color=kBlue-7;
if ( relErrorOnArrowLength<0.3 ) color=kBlue-4;
if ( relErrorOnArrowLength<0.2 ) color=kBlue;
// if ( relErrorOnArrowLength<0.1 ) color=kBlue;
if ( relErrorOnArrowLength<0.1 ) {
color=kBlue;
lwid = 3;
}
if ( relErrorOnArrowLength<0.05 ) {
color=kBlue;
lwid = 4;
}
Double_t arrowSize = 0.006;
TArrow * ar = new TArrow(u-0.5*du,v-0.5*dv,u+0.5*du,v+0.5*dv,arrowSize,"|>");
ar->SetLineWidth(lwid);
ar->SetFillColor(color);
ar->SetLineColor(color);
ar->Draw();
}
}
示例2: normArrow
void normArrow(float x, float y, float norm)
{
// draw 100 mu m arrow if norm = 1
TArrow* normArrow = new TArrow(x,y,x+norm,y,arrowSize,">");
// normArrow->SetLineWidth(2);
normArrow->Draw();
}
示例3: Plot
void Plot(RooRealVar *mass, RooDataSet *data, RooAbsPdf *pdf, pair<double,double> sigRange, vector<double> fwhmRange, string title, string savename){
double semin=sigRange.first;
double semax=sigRange.second;
double fwmin=fwhmRange[0];
double fwmax=fwhmRange[1];
double halfmax=fwhmRange[2];
double binwidth=fwhmRange[3];
RooPlot *plot = mass->frame(Bins(binning_),Range("higgsRange"));
if (data) data->plotOn(plot,Invisible());
pdf->plotOn(plot,NormRange("higgsRange"),Range(semin,semax),FillColor(19),DrawOption("F"),LineWidth(2),FillStyle(1001),VLines(),LineColor(15));
TObject *seffLeg = plot->getObject(int(plot->numItems()-1));
pdf->plotOn(plot,NormRange("higgsRange"),Range(semin,semax),LineColor(15),LineWidth(2),FillStyle(1001),VLines());
pdf->plotOn(plot,NormRange("higgsRange"),Range("higgsRange"),LineColor(kBlue),LineWidth(2),FillStyle(0));
TObject *pdfLeg = plot->getObject(int(plot->numItems()-1));
if (data) data->plotOn(plot,MarkerStyle(kOpenSquare));
TObject *dataLeg = plot->getObject(int(plot->numItems()-1));
TLegend *leg = new TLegend(0.15,0.89,0.5,0.55);
leg->SetFillStyle(0);
leg->SetLineColor(0);
leg->SetTextSize(0.03);
if (data) leg->AddEntry(dataLeg,"Simulation","lep");
leg->AddEntry(pdfLeg,"Parametric model","l");
leg->AddEntry(seffLeg,Form("#sigma_{eff} = %1.2f GeV",0.5*(semax-semin)),"fl");
plot->GetXaxis()->SetNdivisions(509);
halfmax*=(plot->getFitRangeBinW()/binwidth);
TArrow *fwhmArrow = new TArrow(fwmin,halfmax,fwmax,halfmax,0.02,"<>");
fwhmArrow->SetLineWidth(2.);
TPaveText *fwhmText = new TPaveText(0.15,0.45,0.45,0.58,"brNDC");
fwhmText->SetFillColor(0);
fwhmText->SetLineColor(kWhite);
fwhmText->SetTextSize(0.03);
fwhmText->AddText(Form("FWHM = %1.2f GeV",(fwmax-fwmin)));
TLatex lat1(0.65,0.85,"#splitline{CMS Preliminary}{Simulation}");
lat1.SetNDC(1);
lat1.SetTextSize(0.03);
TLatex lat2(0.65,0.75,title.c_str());
lat2.SetNDC(1);
lat2.SetTextSize(0.025);
TCanvas *canv = new TCanvas("c","c",600,600);
plot->SetTitle("");
plot->GetXaxis()->SetTitle("m_{#gamma#gamma} (GeV)");
plot->Draw();
leg->Draw("same");
fwhmArrow->Draw("same <>");
fwhmText->Draw("same");
lat1.Draw("same");
lat2.Draw("same");
canv->Print(Form("%s.pdf",savename.c_str()));
canv->Print(Form("%s.png",savename.c_str()));
string path = savename.substr(0,savename.find('/'));
canv->Print(Form("%s/animation.gif+100",path.c_str()));
delete canv;
}
示例4: TArrow
void Interface::dessinVent(double vent)
{
if(vent != 0){
TArrow *vecteurVent = new TArrow(245,290,245 + 5*vent,290);
vecteurVent->SetLineColor(kBlack);
vecteurVent->Draw();
}
}
示例5: drawLabels
void drawLabels(){
// "Hadron Gas"
TLatex *xHad1 = new TLatex(0.11, 0.13, "Hadron");
TLatex *xHad2 = new TLatex(0.15, 0.085, "Gas");
xHad1->SetTextSize(0.04);
xHad2->SetTextSize(0.04);
if(iColor)xHad1->SetTextColor(4);
if(iColor)xHad2->SetTextColor(4);
xHad1->Draw();
xHad2->Draw();
//"Quark Gloun Plasma"
TLatex *xQGP1 = new TLatex(0.55, 0.8, "Quark Gluon");
TLatex *xQGP2 = new TLatex(0.62, 0.755, "Plasma");
xQGP1->SetTextSize(0.04);
xQGP2->SetTextSize(0.04);
if(iColor)xQGP1->SetTextColor(4);
if(iColor)xQGP2->SetTextColor(4);
xQGP1->Draw();
xQGP2->Draw();
//"Early Universe"
TArrow *aUniv = new TArrow(.025, 0.95,.025, 0.45,0.03,"|>");
aUniv->SetLineWidth(2);
if(iColor)aUniv->SetLineColor(2);
if(iColor)aUniv->SetFillColor(2);
aUniv->Draw();
TLatex *xUniv = new TLatex(0.075, 0.58, "Early Universe");
xUniv->SetTextSize(0.04);
xUniv->SetTextAngle(90);
if(iColor)xUniv->SetTextColor(2);
xUniv->Draw();
//"Neutron Stars"
TArrow *aNeut = new TArrow(.65, .05 ,.99, 0.075,0.03,"|>");
aNeut->SetLineWidth(2);
if(iColor)aNeut->SetLineColor(8);
if(iColor)aNeut->SetFillColor(8);
aNeut->Draw();
TLatex *xNeut = new TLatex(0.735, 0.08, "Neutron Stars");
xNeut->SetTextSize(0.04);
xNeut->SetTextAngle(5);
if(iColor)xNeut->SetTextColor(8);
xNeut->Draw();
//"Critical Point"
TLatex *xCrit1 = new TLatex(0.2, 0.585, "Critical");
TLatex *xCrit2 = new TLatex(0.225, 0.54, "Point");
xCrit1->SetTextSize(0.04);
xCrit2->SetTextSize(0.04);
xCrit1->Draw();
xCrit2->Draw();
}
示例6: drawArrowLength
// draw a horizontal arrow of a certain length in pad coordinates at xy in NDC
// returns the new x in NDC
double drawArrowLength(TPad* pad, double x, double y, double length, Color_t color = 1)
{
const double x1 = NDCtoUserX(pad,x);
const double y1 = NDCtoUserY(pad,y);
const double x2 = x1 + length;
const double y2 = y1;
TArrow *a = new TArrow(x1,y1,x2,y2,.01,">");
a->SetLineColor(color);
a->Draw();
//pad->Update();
cout << "Arrow: " << length << " " << pad->GetX2()-pad->GetX1() << endl;
return x + (length/(pad->GetX2()-pad->GetX1()));
}
示例7: transparency
void transparency()
{
TCanvas *c1 = new TCanvas("c1", "c1",224,330,700,527);
c1->Range(-0.125,-0.125,1.125,1.125);
TLatex *tex = new TLatex(0.06303724,0.0194223,"This text is opaque and this line is transparent");
tex->SetLineWidth(2);
tex->Draw();
TArrow *arrow = new TArrow(0.5555158,0.07171314,0.8939828,0.6195219,0.05,"|>");
arrow->SetLineWidth(4);
arrow->SetAngle(30);
arrow->Draw();
// Draw a transparent graph.
Double_t x[10] = {
0.5232808, 0.8724928, 0.9280086, 0.7059456, 0.7399714,
0.4659742, 0.8241404, 0.4838825, 0.7936963, 0.743553};
Double_t y[10] = {
0.7290837, 0.9631474, 0.4775896, 0.6494024, 0.3555777,
0.622012, 0.7938247, 0.9482072, 0.3904382, 0.2410359};
TGraph *graph = new TGraph(10,x,y);
graph->SetLineColorAlpha(46, 0.1);
graph->SetLineWidth(7);
graph->Draw("l");
// Draw an ellipse with opaque colors.
TEllipse *ellipse = new TEllipse(0.1740688,0.8352632,0.1518625,0.1010526,0,360,0);
ellipse->SetFillColor(30);
ellipse->SetLineColor(51);
ellipse->SetLineWidth(3);
ellipse->Draw();
// Draw an ellipse with transparent colors, above the previous one.
ellipse = new TEllipse(0.2985315,0.7092105,0.1566977,0.1868421,0,360,0);
ellipse->SetFillColorAlpha(9, 0.571);
ellipse->SetLineColorAlpha(8, 0.464);
ellipse->SetLineWidth(3);
ellipse->Draw();
// Draw a transparent blue text.
tex = new TLatex(0.04871059,0.1837649,"This text is transparent");
tex->SetTextColorAlpha(9, 0.476);
tex->SetTextSize(0.125);
tex->SetTextAngle(26.0);
tex->Draw();
}
示例8: 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();
}
示例9: drawExperiments
void drawExperiments(){
TEllipse *eRHIC = new TEllipse(0.4, 0.55, 0.035, 0.13, 0., 165., 335.);
// eRHIC->SetFillColor(0);
eRHIC->SetNoEdges();
eRHIC->SetFillStyle(0);
eRHIC->SetLineWidth(2);
eRHIC->Draw();
TLine *lGarbage = new TLine(0.383507,0.595395,0.401148,0.546523);
lGarbage->SetLineColor(17);
lGarbage->SetLineWidth(3);
lGarbage->Draw();
TArrow *aRHIC = new TArrow(0.385543,0.600282,0.382829,0.595395, 0.025, "|>");
aRHIC->Draw();
TLatex *xRHIC = new TLatex(0.417432, 0.679342, "RHIC");
xRHIC->SetTextSize(0.04);
xRHIC->Draw();
}
示例10: makeZPhiArrowPlot
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]");
OBPCanvas->SetFillColor(0);
OBPCanvas->SetFrameBorderMode(0);
TFrame* aFrame = OBPCanvas->GetFrame();
aFrame->SetFillColor(0);
int passcut = 0;
for(int entry = 0;entry<data->GetEntries(); entry++)
{
data->GetEntry(entry);
if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){
if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){
TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">");
aArraw->Draw();
passcut++;
}
}
}
DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );
char sliceLeg[192];
sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
atext->AddText(sliceLeg);
atext->SetLineColor(0);
atext->SetFillColor(0);
atext->SetTextFont(42);
atext->SetTextSize(0.04);
atext->Draw();
char outfile[192];
sprintf( outfile, "%s/%s.png", outputDir_, name );
OBPCanvas->Print( outfile );
return passcut;
}
示例11: drawAxis
void drawAxis()
{
TArrow *arr = new TArrow(0,0,1,0,0.03,"|>");
arr->SetFillColor(1);
arr->SetLineWidth(2);
arr->Draw();
arr = new TArrow(0,0,0,1,0.03,"|>");
arr->SetFillColor(1);
arr->SetLineWidth(2);
arr->Draw();
}
示例12: TArrow
void
HHV4Vector::Draw(Int_t color, Int_t style) const
{ // draw particle for event display in x-y view
TArrow *Ar = new TArrow(0, 0, Px(), Py(), 0.001, "|>");
Ar->SetLineColor(color);
Ar->SetFillColor(color);
Ar->SetLineWidth(3);
Ar->SetLineStyle(style);
Ar->Draw();
}
示例13: draw_synapse
void draw_synapse(Double_t cx1, Double_t cy1, Double_t cx2, Double_t cy2,
Double_t rad1, Double_t rad2, Double_t weightNormed)
{
const Double_t TIP_SIZE = 0.01;
const Double_t MAX_WEIGHT = 8;
const Double_t MAX_COLOR = 100; // red
const Double_t MIN_COLOR = 60; // blue
if (weightNormed == 0) return;
// gStyle->SetPalette(100, NULL);
TArrow *arrow = new TArrow(cx1+rad1, cy1, cx2-rad2, cy2, TIP_SIZE, ">");
arrow->SetFillColor(1);
arrow->SetFillStyle(1001);
arrow->SetLineWidth((Int_t)(TMath::Abs(weightNormed)*MAX_WEIGHT+0.5));
arrow->SetLineColor((Int_t)((weightNormed+1.0)/2.0*(MAX_COLOR-MIN_COLOR)+MIN_COLOR+0.5));
arrow->Draw();
}
示例14: drawEventZR
void drawEventZR(double vrlb, double vzlb, double vrl0, double vzl0, double pmu1, double etamu1, double pmu2, double etamu2, double ppr, double etapr, double ppi, double etapi, 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;
}
cout << etamu1 << " " << etamu2 << " " << etapr << " " << etapi << endl;
const double thetamu1 = 2*TMath::ATan(TMath::Exp(-etamu1));
const double thetamu2 = 2*TMath::ATan(TMath::Exp(-etamu2));
const double thetapr = 2*TMath::ATan(TMath::Exp(-etapr));
const double thetapi = 2*TMath::ATan(TMath::Exp(-etapi));
//const double thetamu1 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu1)))*sign(etamu1);
//const double thetamu2 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu2)))*sign(etamu2);
//const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)))*sign(etapr);
//const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)))*sign(etapi);
// draw the vertices
TMarker *m;
const double xlb = vzlb;
const double ylb = vrlb;
m = new TMarker(xlb,ylb,7);
m->SetMarkerColor(colLb);
m->Draw();
const double xl0 = vzl0;
const double yl0 = vrl0;
m = new TMarker(xl0,yl0,7);
m->SetMarkerColor(colL0);
m->Draw();
// draw the l0 flight line
TLine *l;
l = new TLine(vzlb,vrlb,vzl0,vrl0);
l->SetLineColor(colL0);
l->SetLineStyle(2);
l->Draw();
// draw the muons
TArrow *a;
const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(thetamu1);
const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(thetamu1);
a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
a->SetLineColor(colMu1);
a->Draw();
const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(thetamu2);
const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(thetamu2);
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(thetapr);
const double ypr = yl0 + scalepr * ppr * TMath::Sin(thetapr);
a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
a->SetLineColor(colPr);
a->Draw();
const double xpi = xl0 + scalepi * ppi * TMath::Cos(thetapi);
const double ypi = yl0 + scalepi * ppi * TMath::Sin(thetapi);
a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
a->SetLineColor(colPi);
a->Draw();
}
示例15: toyMC
void toyMC(int nsteps = 1e6) {
Float_t LA = 9.2;
Float_t LB = 10.3;
Float_t SF = 492./LB;
Float_t eSF = TMath::Sqrt(23.*23.+19.7*19.7)/LB;
// Float_t OF = 358./LA;
// Float_t eOF = 27./LA;
Float_t OF = 358./LB;
Float_t eOF = 31./LB;
Float_t SigB = 188.+238-414;
TH1F* hSig = new TH1F("hSig ; SF-R_{SF/OF}#timesOF ; ","Signal component",600,-100.,500.);
hSig->SetLineColor(kRed+2);
TRandom3* ran = new TRandom3();
for ( int i=0; i<nsteps; ++i ) {
Float_t nBSF = ran->Gaus(SF*LB,eSF*LB);
Float_t nBOF = ran->Gaus(OF*LB,eOF*LB);
Float_t rsfof = ran->Gaus(1.0,0.05);
hSig->Fill(nBSF-nBOF*rsfof);
}
TCanvas* mycan = new TCanvas("mycan","",100,10,900,600);
mycan->SetLogy();
TH1F* hSigNorm = hSig->DrawNormalized("");
hSigNorm->SetMinimum(1e-5);
hSigNorm->Draw();
// Find 95% CL range
float integral = 0;
int binStart = -1;
while ( integral <= 0.025 ) {
++binStart;
integral += hSigNorm->GetBinContent(binStart);
}
std::cout << integral << " up to " << hSigNorm->GetBinCenter(binStart) << std::endl;
integral = 0;
int binEnd = hSigNorm->GetNbinsX()+2;
while ( integral <= 0.025 ) {
--binEnd;
integral += hSigNorm->GetBinContent(binEnd);
}
std::cout << integral << " up to " << hSigNorm->GetBinCenter(binEnd) << std::endl;
// Draw 95% CL
TBox* range95 = new TBox(hSigNorm->GetBinCenter(binStart),hSigNorm->GetMinimum(),hSigNorm->GetBinCenter(binEnd),1.2*hSigNorm->GetMaximum());
range95->SetFillColor(kBlue-9);
range95->SetFillStyle(1000);
range95->SetLineColor(range95->GetFillColor());
range95->Draw();
hSigNorm->SetTitle("hSigNorm; \"S\" #equiv SF - R_{SF/OF}#timesOF ; pdf");
hSigNorm->Draw("same");
std::cout << "Integrating from 0 to " << SigB << ": " << std::endl;
std::cout << hSigNorm->Integral(0,hSigNorm->FindBin(SigB)) <<std::endl;
TLegend* legend = new TLegend(0.6,0.7,0.95,0.9,"","brNDC");
legend->SetBorderSize(0);
legend->AddEntry(hSigNorm,"Expected \"S\" for block B","l");
legend->AddEntry(range95,"95% region","f");
legend->Draw();
mycan->RedrawAxis();
mycan->SaveAs("toyMCexp.pdf");
TArrow* a = new TArrow(SigB,hSigNorm->GetMaximum(),SigB,hSigNorm->GetMinimum()*1.1,0.02);
a->SetLineColor(kBlue+2);
a->Draw();
TLegend* legend2 = new TLegend(0.6,0.6,0.95,0.7,"","brNDC");
legend2->SetBorderSize(0);
legend2->AddEntry(a,"Observed (p-value 0.6%)","l");
legend2->Draw();
mycan->SaveAs("toyMC.pdf");
}