本文整理汇总了C++中TArrow::SetLineColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TArrow::SetLineColor方法的具体用法?C++ TArrow::SetLineColor怎么用?C++ TArrow::SetLineColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArrow
的用法示例。
在下文中一共展示了TArrow::SetLineColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
}
示例4: dessinVent
void Interface::dessinVent(double vent)
{
if(vent != 0){
TArrow *vecteurVent = new TArrow(245,290,245 + 5*vent,290);
vecteurVent->SetLineColor(kBlack);
vecteurVent->Draw();
}
}
示例5: 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();
}
示例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: 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();
}
示例8: EvtSel_Q2Pmiss
void EvtSel_Q2Pmiss(){
Styles style2; style2.setPadsStyle(2); style2.applyStyle();
TString NameTrees[3] = {"AWG82/ntuples/small/RAll_RunAll.root",
"AWG82/ntuples/small/uds_RunAll.root", "AWG82/ntuples/small/ccbar_RunAll.root"};
TChain gen("ntp1"), cont("ntp1");
gen.Add(NameTrees[0]);
for(int t=1; t<3; t++) cont.Add(NameTrees[t]);
double totMCB = 0, totuds = 0, totccbar = 0, totdata = 0, totOffdata = 0;
getNumberB(NameTrees[0], "All", totMCB, totdata, totuds, totccbar, totOffdata);
double wuds = totMCB/totuds*2.09/1.05;
TH1F *hCount = new TH1F("hCount","",100,-4,12);
gen.Draw("candM2>>hCount","weight");
double nTotal = hCount->Integral();
cont.Draw("candM2>>hCount","weight");
nTotal += hCount->Integral()*wuds;
TLine line; line.SetLineStyle(2); line.SetLineColor(28); line.SetLineWidth(2);
TArrow arrow; arrow.SetLineColor(28); arrow.SetFillColor(28); arrow.SetLineWidth(2);
TCanvas can("can","Pmiss and q2 cuts");
can.Divide(2,1); TPad *cPad = (TPad *)can.cd(1);
int bins[] = {42,40}, colors[2][4] = {{8,4,1,3},{8,2,4,1}};
double xrange[2][2] = {{0,4.2},{-3,13}}, yield[2][4], maxi[] = {-99,-99};
TString Variable[] = {"candPMiss","candQ2"};
TString labels[2][4] = {{"Signal (", "Normaliz. (","Had. bkg. (",""},
{"Signal (", "D l #nu (", "D* l #nu (", "Bkg. ("}};
// TString labels[2][4] = {{"Signal", "Normaliz.","Had. Bkg.",""},
// {"Signal", "D l #nu", "D* l #nu", "Bkg."}};
TString cuts[2][4] = {{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&MCType>0&&MCType<5||candType>2&&MCType>6&&MCType<11)*weight",
"(MCType==0&&MCCombmode==12)*weight", ""},
{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&(MCType==1||MCType==3)||candType>2&&(MCType==7||MCType==9))*weight",
"(candType<3&&(MCType==2||MCType==4)||candType>2&&(MCType==8||MCType==10))*weight",
"(!(candType<3&&MCType>0&&MCType<7||candType>2&&MCType>6&&MCType<13))*weight"}};
double legW = 0.4, legH = 0.225;
double legX = 1-style2.PadRightMargin-0.02, legY = 1-style2.PadTopMargin-0.02;
TLegend *leg[2];
leg[0] = new TLegend(legX-legW, legY-legH, legX, legY);
legW = 0.24; legH = 0.285; legX = 0.47;
leg[1] = new TLegend(legX-legW, legY-legH, legX, legY);
TH1F* h[2][4];
for(int pad=0; pad<2; pad++){
leg[pad]->SetTextSize(style2.LabelSize); leg[pad]->SetFillColor(0);
leg[pad]->SetTextFont(style2.nFont); leg[pad]->SetBorderSize(0);
for(int i=0; i<4; i++) {
if(pad==0 && i==3) continue;
TString hname = "h"; hname += pad; hname += i;
h[pad][i] = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
h[pad][i]->SetLineWidth(2); h[pad][i]->SetLineColor(colors[pad][i]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
gen.Draw(vari,cuts[pad][i]);
if(i==3){
hname = "hCont"; hname += pad; hname += i;
TH1F *hCont = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
cont.Draw(vari,cuts[pad][i]);
hCont->Scale(wuds);
h[pad][i]->Add(hCont);
hCont->Delete();
}
yield[pad][i] = h[pad][i]->Integral();
h[pad][i]->Scale(1000/h[pad][i]->Integral());
if(h[pad][i]->GetMaximum()>maxi[pad]) maxi[pad] = h[pad][i]->GetMaximum();
labels[pad][i] += RoundNumber(yield[pad][i]*100,0,nTotal); labels[pad][i] += "%)";
leg[pad]->AddEntry(h[pad][i],labels[pad][i]);
}
h[pad][0]->SetMaximum(maxi[pad]*1.22);
}
h[0][0]->Draw();
style2.fixYAxis(h[0][0],cPad);
style2.setTitles(h[0][0],"|p_{miss}| (GeV)","Entries/(100 MeV)","a)");
h[0][1]->Draw("same");h[0][2]->Draw("same");
leg[0]->Draw();
line.DrawLine(0.2,h[0][0]->GetMinimum(), 0.2,maxi[0]/1.45);
arrow.DrawArrow(0.2,maxi[0]/1.65,0.5,maxi[0]/1.65,0.01,"|>");
cPad = (TPad *)can.cd(2);
h[1][0]->Draw();
style2.fixYAxis(h[1][0],cPad);
style2.setTitles(h[1][0],"q^{2} (GeV^{2})","Entries/(0.4 GeV^{2})","b)");
h[1][1]->Draw("same"); h[1][2]->Draw("same"); h[1][3]->Draw("same");
leg[1]->Draw();
line.DrawLine(4,h[1][0]->GetMinimum(), 4,maxi[1]/1.45);
arrow.DrawArrow(4,maxi[1]/1.65,5.4,maxi[1]/1.65,0.01,"|>");
TString pName = "public_html/EvtSel_Q2Pmiss.eps";
can.SaveAs(pName);
for(int pad=0; pad<2; pad++){
leg[pad]->Delete();
for(int i=0; i<4; i++){
if(pad==0 && i==3) continue;
h[pad][i]->Delete();
}
}
hCount->Delete();
}
示例9: 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();
}
示例10: ClassTree
//.........这里部分代码省略.........
pl->Draw();
line = new TLine(8.3,6.8,8.8,6.8);
line->Draw();
pl = new TPaveLabel(8.8,6.545,12.005,7.055,"TTree","br");
pl->SetFillColor(18);
pl->SetTextSize(0.9);
pl->Draw();
line = new TLine(12.2,8.075,12.7,8.075);
line->Draw();
pl = new TPaveLabel(12.7,7.82,15.905,8.33,"AliTPCClustersArray","br");
pl->SetFillColor(18);
pl->SetTextSize(0.9);
pl->Draw();
line = new TLine(12.2,10.2,16.1,10.2);
line->Draw();
pl = new TPaveLabel(12.7,9.945,15.905,10.455,"TObjArray","br");
pl->SetFillColor(18);
pl->SetTextSize(0.9);
pl->Draw();
line = new TLine(16.1,10.2,16.6,10.2);
line->Draw();
pl = new TPaveLabel(16.6,9.945,19.805,10.455,"TClonesArray","br");
pl->SetFillColor(18);
pl->SetTextSize(0.9);
pl->Draw();
pl = new TPaveLabel(0.1,19.1,18.2,19.9,"*AliSegmet:*AliSegmentArray:*AliArrayI:*AliArrayS:TTree:*TObjArray","br");
pl->SetFillColor(42);
pl->SetTextSize(0.7);
pl->Draw();
line = new TLine(11.4041,6.8,14.3025,10.2);
line->SetLineColor(6);
line->SetLineStyle(3);
line->Draw();
line = new TLine(11.4842,6.8,14.3025,10.2);
line->SetLineColor(6);
line->SetLineStyle(3);
line->Draw();
line = new TLine(6.5025,12.325,6.5025,18.575);
line->SetLineColor(4);
line->SetLineStyle(2);
line->Draw();
line = new TLine(6.5025,11.475,6.5025,17.725);
line->SetLineColor(4);
line->SetLineStyle(2);
line->Draw();
line = new TLine(10.4025,6.8,2.6025,16.025);
line->SetLineColor(4);
line->SetLineStyle(2);
line->Draw();
line = new TLine(10.4025,6.8,2.6025,16.875);
line->SetLineColor(4);
line->SetLineStyle(2);
line->Draw();
line = new TLine(10.4025,6.8,2.6025,15.175);
line->SetLineColor(4);
line->SetLineStyle(2);
line->Draw();
TArrow *arrow = new TArrow(5.43417,10.2,6.5025,10.2,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(6.85861,10.2,2.6025,9.775,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(9.60125,8.075,14.3025,10.2,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(10.1354,8.075,6.5025,12.325,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(11.2037,8.075,10.4025,6.8,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(13.9019,10.2,2.6025,9.775,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
arrow = new TArrow(19.2708,10.2,14.3025,10.2,0.008,"|>");
arrow->SetFillColor(2);
arrow->SetFillStyle(1001);
arrow->SetLineColor(2);
arrow->Draw();
ClassTree->Modified();
ClassTree->cd();
}
示例11: 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");
}
示例12: RoutePlot
//.........这里部分代码省略.........
leggraphs.back()->SetMarkerStyle(8);
leggraphs.back()->SetMarkerSize(1);
if(i==2)leggraphs.back()->SetMarkerColor(9);
leg->AddEntry(leggraphs.back(), Form("particle %i",i+1),"p");
}
TLegend* legMarker= new TLegend(0.7,0.65,0.9,0.95);
legMarker->SetFillColor(0);
legMarker->SetFillStyle(0);
legMarker->SetTextFont(42);
TLegend* legCMS= new TLegend(0.07,0.85,0.39,0.95);
legCMS->SetFillColor(0);
legCMS->SetFillStyle(0);
legCMS->SetBorderSize(0);
legCMS->SetTextFont(42);
legCMS->AddEntry((TObject*)0,"CMS private work","");
TPaveText* legExplain= new TPaveText(0.23,0.84,0.73,0.94,"NDC");
legExplain->SetFillColor(3);
legExplain->SetFillStyle(0);
legExplain->SetBorderSize(0);
legExplain->AddText("BDTs trained and tested with t#bar{t}H, H#rightarrowb#bar{b} and t#bar{t} MC-Samples");
legExplain->SetTextFont(42);
TGraph* initMarker = new TGraph();
initMarker->SetMarkerStyle(34);
initMarker->SetMarkerSize(1.5);
TGraph* zeroKSMarker = new TGraph();
zeroKSMarker->SetMarkerStyle(3);
zeroKSMarker->SetMarkerSize(1.5);
legMarker->AddEntry(initMarker,"init. pos.","p");
TArrow* legArrow = new TArrow(100,0.01,200,0.02,0.02,">");
TArrow* legArrow2 = new TArrow(1270,0.0453,1320,0.0453,0.02,">");
legArrow->SetLineColor(0);
legArrow->SetFillColor(0);
legArrow2->SetLineWidth(2);
legArrow2->SetAngle(40);
legMarker->AddEntry(legArrow,"#Delta#vec{v}","");
// legMarker->AddEntry((TObject*)0,"","");
legMarker->AddEntry(zeroKSMarker,"KS < min KS","p");
TGraph* sizegraph1 = new TGraph();
sizegraph1->SetMarkerStyle(8);
Double_t size2=m*0.74+abschnitt;
sizegraph1->SetMarkerSize(size2);
legMarker->AddEntry(sizegraph1, "A_{ROC} = 0.74","p");
TGraph* sizegraph2 = new TGraph();
sizegraph2->SetMarkerStyle(8);
size2=m*0.76+abschnitt;
sizegraph2->SetMarkerSize(size2);
legMarker->AddEntry(sizegraph2, "A_{ROC} = 0.76","p");
TGraph* sizegraph3 = new TGraph();
sizegraph3->SetMarkerStyle(8);
size2=m*0.78+abschnitt;
sizegraph3->SetMarkerSize(size2);
legMarker->AddEntry(sizegraph3, "A_{ROC} = 0.78","p");
for(size_t i=0;i<graphs.size();i++){
if(i==0){
c->cd();
emptygraph->Draw("AP");
示例13: determineWorkingPoint
void determineWorkingPoint(TString algo="csv",TString baseURL="~/scratch0/top-nosyst/plotter.root")
{
float workPoint(0.244);
float sfb(1.020), sfberr(0.04); //from BTV-11-003
float sflight(1.08), sflighterr(0.13); //from BTV-11-002
// float sfb(0.99), sfberr(0.099); //from BTV-11-001
// float sflight(1.07882), sflighterr(0.244); //from BTV-11-001
if(algo=="tche")
{
workPoint=1.7;
sfb=0.95; sfberr=0.095;
sflight=1.08018; sflighterr=0.1125;
}
TObjArray bjets=getDistributionFromPlotter(algo+"b",baseURL);
TObjArray lightjets=getDistributionFromPlotter(algo+"light",baseURL);
TH1F *bDisc=(TH1F *) bjets.At(1);
TH1F *lightDisc=(TH1F *) lightjets.At(1);
setStyle();
gStyle->SetOptFit(0);
TCanvas *cnv = getNewCanvas("c","c",false);
cnv->Clear();
cnv->SetCanvasSize(1200,1200);
cnv->SetWindowSize(1200,1200);
cnv->Divide(2,2);
//draw the discriminator
TPad *p = (TPad *)cnv->cd(1);
bDisc->SetTitle("b");
bDisc->SetLineColor(1);
bDisc->SetMarkerColor(1);
bDisc->SetMarkerStyle(20);
bDisc->SetFillStyle(0);
bDisc->DrawNormalized("histe1");
lightDisc->SetLineColor(1);
lightDisc->SetMarkerColor(1);
lightDisc->SetMarkerStyle(24);
lightDisc->SetFillStyle(0);
lightDisc->SetTitle("udcsg");
lightDisc->DrawNormalized("histe1same");
TLegend *leg=p->BuildLegend();
formatForCmsPublic(p,leg,"CMS simulation",2);
//draw the b/light efficiencies
p=(TPad *)cnv->cd(2);
p->SetLogy();
TGraphAsymmErrors *bEff = getEfficiencyFrom(bDisc);
TGraphAsymmErrors *lightEff = getEfficiencyFrom(lightDisc);
bEff->SetMarkerStyle(20);
bEff->SetFillStyle(0);
bEff->Draw("ap");
bEff->GetXaxis()->SetTitle(bDisc->GetXaxis()->GetTitle());
bEff->GetYaxis()->SetTitle("Efficiency");
lightEff->SetMarkerStyle(24);
lightEff->SetFillStyle(0);
lightEff->Draw("p");
//draw relatively to a given working point
p=(TPad *)cnv->cd(3);
Double_t baseBEff=bEff->Eval(workPoint);
TGraphAsymmErrors *relBEff=new TGraphAsymmErrors;
relBEff->SetMarkerStyle(20);
relBEff->SetFillStyle(0);
Double_t baseLightEff=lightEff->Eval(workPoint);
TGraphAsymmErrors *relLightEff=new TGraphAsymmErrors;
relLightEff->SetMarkerStyle(24);
relLightEff->SetFillStyle(0);
for(int ip=0; ip<bEff->GetN(); ip++)
{
Double_t cut, y,ey;
bEff->GetPoint(ip,cut,y); ey = bEff->GetErrorY(ip);
Double_t relEff(y/baseBEff);
if(relEff<sfb+2*sfberr && relEff>sfb-2*sfberr)
{
int ipt=relBEff->GetN();
relBEff->SetPoint(ipt,cut,relEff);
relBEff->SetPointError(ipt,0,0,ey/baseBEff,ey/baseBEff);
}
lightEff->GetPoint(ip,cut,y); ey = lightEff->GetErrorY(ip);
relEff=y/baseLightEff;
// if(relEff<sflight+7*sflighterr && relEff>sflight-7*sflighterr)
if(relEff<sflight+3*sflighterr && relEff>sflight-3*sflighterr)
{
int ipt=relLightEff->GetN();
relLightEff->SetPoint(ipt,cut,relEff);
relLightEff->SetPointError(ipt,0,0,ey/baseLightEff,ey/baseLightEff);
}
}
relLightEff->Draw("ap");
relLightEff->GetXaxis()->SetTitle( bDisc->GetXaxis()->GetTitle() );
relLightEff->GetYaxis()->SetTitle( "#varepsilon/#varepsilon_{0}" );
relLightEff->Fit("expo","Q+");
TF1 *ffunc=relLightEff->GetFunction("expo");
float newLightCut=(TMath::Log(sflight)-ffunc->GetParameter(0))/ffunc->GetParameter(1);
float newLightCutErrPlus=(TMath::Log(sflight+sflighterr)-ffunc->GetParameter(0))/ffunc->GetParameter(1)-newLightCut;
//.........这里部分代码省略.........
示例14: chain
int
main (int argc, char *argv[])
{
if (argc != 2)
{
cout << "Usage: " << argv[0] << " INPUT_FILE" << endl;
cout << " or: " << argv[0] << " INPUT_LIST" << endl;
cout << "" << endl;
cout << endl;
return 0;
}
string inputFile = argv[1], upperInputFile;
upperInputFile.resize (inputFile.length ());
transform (inputFile.begin (), inputFile.end (), upperInputFile.begin (), ::toupper);
// so canvases don't appear on the screen when being created
// very useful when running on the OSU T3 from CERN
gROOT->SetBatch();
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadBottomMargin(0.1);
gStyle->SetPadLeftMargin(0.03);
gStyle->SetPadRightMargin(0.08);
//Create chain of root trees
TChain chain("Delphes");
if (upperInputFile.length () < 5 || upperInputFile.substr (upperInputFile.length () - 5, 5) != ".ROOT")
{
ifstream fin (inputFile);
string line;
while(getline(fin, line))
{
chain.Add(line.c_str());
}
fin.close();
}
else
chain.Add(inputFile.c_str());
// Create object of class ExRootTreeReader
ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
// Get pointers to branches used in this analysis
TClonesArray *branchTrack = treeReader->UseBranch("Track");
TClonesArray *branchCluster = treeReader->UseBranch("Cluster");
TClonesArray *branchNPU = treeReader->UseBranch("NPU");
//gStyle->SetOptStat(10011);
//actually, let's turn this off for now
gStyle->SetOptStat(0);
TH2D *hist[LEN];
signal (SIGINT, signalHandler);
//Loop over a LEN Events
for (int event = 0; event < LEN && !interrupted; event++) {
//Load Branches
treeReader->ReadEntry(event);
// N.B. this is a hack put in by Andrew using the ScalarHT class
// it's the number of pileup interactions, it's not actually the HT
unsigned nInteractions = (unsigned) ((ScalarHT *) branchNPU->At(0))->HT + 1;
int nClusters = branchCluster->GetEntries();
// create and format the histogram for this event
TString name = "TrackPtVsTrackZ_" + TString(Form("%d",event+1));
TCanvas *can = new TCanvas(name,name,1600,500);
TString title = "Event " + TString(Form("%d",event+1)) + ": ";
title += TString(Form("%d",nInteractions)) + " Interactions, ";
title += TString(Form("%d",nClusters)) + " Clusters";
hist[event] = new TH2D(name, title, X_BIN, X_MIN, X_MAX, Y_BIN, Y_MIN, Y_MAX);
hist[event]->GetXaxis()->SetTitle("track z [mm]");
hist[event]->GetXaxis()->SetLabelOffset(0.02);
hist[event]->GetXaxis()->SetTitleOffset(1.2);
hist[event]->GetYaxis()->SetTitle("track p_{T} [GeV]");
hist[event]->GetYaxis()->SetTitleOffset(0.35);
TArrow *genPVArrow = new TArrow(0,0,0,0.01,0.01,"|>");
genPVArrow->SetLineColor(3);
genPVArrow->SetFillColor(3);
genPVArrow->SetLineWidth(0.1);
genPVArrow->SetAngle(40);
vector<float> interactionPositions;
vector<TLine *> clusterLineVector;
Cluster *recoPV = (Cluster *) branchCluster->At(0);
TLine *highELine = new TLine(recoPV->Z,0,recoPV->Z,Y_MAX);
highELine->SetLineColor(1);
highELine->SetLineWidth(0.8);
highELine->SetLineStyle(3);
// Draw cluster lines
// Skip first cluster since we've already drawn it (start from 1)
//.........这里部分代码省略.........
示例15: gluinostopMassLifetime
//.........这里部分代码省略.........
mchamp_xs.xsec2mass (mchamp_exp);
TGraphAsymmErrors* mchamp_exp_1sig = new TGraphAsymmErrors (*plots.getExpLimitMchamp1Sig());
mchamp_xs.xsec2mass (mchamp_exp_1sig);
TGraphAsymmErrors* mchamp_exp_2sig = new TGraphAsymmErrors (*plots.getExpLimitMchamp2Sig());
mchamp_xs.xsec2mass (mchamp_exp_2sig);
TCanvas *canvas = new TCanvas("allMassLifetime", "allMassLifetime", 800, 600);
canvas->SetLogx();
canvas->SetGridy();
TH1F* h = new TH1F ("h", "", 1, 7.5e-8, 1e6);
h->SetStats (0);
//h->SetMinimum (300);
h->SetMinimum (0);
//h->SetMaximum (1500);
h->SetMaximum (600);
h->SetTitle("Beamgap Expt");
// h->GetXaxis()->SetTitle("#tau_{#tilde{g},#tilde{t},#tilde{#tau}} [s]");
h->GetXaxis()->SetTitle("#tau [s]");
h->GetYaxis()->SetTitle("m [GeV] ");
h->Draw ("");
// limit arrows
double* x = g_obs->GetX();
for (int i = 0; i < g_obs->GetN(); ++i) {
if (x[i] > 0.5) {
double y = g_obs->GetY()[i];
TArrow* arrow = new TArrow (x[i], y, h->GetXaxis()->GetXmin(), y, 0.02);
arrow->SetLineColor (kRed);
arrow->SetLineWidth (2);
//arrow->Draw();
cout << "GLUINO mass limit @ " << x[i] << "sec is found: " << y << endl;
break;
}
}
x = g_obs->GetX();
for (int i = 0; i < stop_obs->GetN(); ++i) {
if (x[i] > 0.5) {
double y = stop_obs->GetY()[i];
TArrow* arrow = new TArrow (x[i], y, h->GetXaxis()->GetXmin(), y, 0.02);
arrow->SetLineColor (kBlue);
arrow->SetLineWidth (2);
//arrow->Draw();
cout << "STOP mass limit @ " << x[i] << "sec is found: " << y << endl;
break;
}
}
x = mchamp_obs->GetX();
for (int i = 0; i < mchamp_obs->GetN(); ++i) {
if (x[i] > 0.5) {
double y = mchamp_obs->GetY()[i];
TArrow* arrow = new TArrow (x[i], y, h->GetXaxis()->GetXmin(), y, 0.02);
arrow->SetLineColor (kBlack);
arrow->SetLineWidth (2);
arrow->Draw();
cout << "MCHAMP mass limit @ " << x[i] << "sec is found: " << y << endl;
break;
}
}
// gluino