本文整理汇总了C++中TObject::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TObject::Draw方法的具体用法?C++ TObject::Draw怎么用?C++ TObject::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObject
的用法示例。
在下文中一共展示了TObject::Draw方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HighlightFragment
//______________________________________________________________________________
void HighlightFragment()
{
// TODO templates: what and how highlighing
if (!gPad || !gr) return;
// not correct
TVirtualPad *ph = (TVirtualPad *)gPad->FindObject("ph");
if (!ph) {
ph = new TPad("ph", "ph", 0.0, 0.2, 1.0, 1.0);
ph->SetFillColor(kBlue-10);
ph->Draw();
}
Int_t ih = gr->GetHighlightPoint();
if (ih == -1) return;
TRsnFragment *frag = group->FragmentAt(ih);
if (!frag) return;
TVirtualPad *save = gPad;
ph->cd();
TObject *element = frag->FindElement(tagname);
if (!element) ph->Clear();
else element->Draw();
save->cd();
}
示例2: DrawLegend
//________________________________________________________
void GFHistManager::DrawLegend(Int_t layer, Int_t histNo)
{
// histNo starting at '0'
// We must already be in the correct pad, layer and histNo must exist
if(fLegendArrays && layer <= fLegendArrays->GetLast() && fLegendArrays->At(layer)){
TObjArray* legends = static_cast<TObjArray*>(fLegendArrays->At(layer));
TObject* legend = (histNo <= legends->GetLast() ? legends->At(histNo) : NULL);
if(legend) legend->Draw();
}
}
示例3: DrawObjectOnCanvas
void QUserPanel::DrawObjectOnCanvas(const char* itemname)
{
RemoveLink("DrawItem");
AddLink(itemname, "DrawItem");
TObject* obj = GetLinked("DrawItem", 2);
if (obj!=0) {
fxDrawCanvas->getCanvas()->Clear();
fxDrawCanvas->getCanvas()->cd();
obj->Draw("");
fxDrawCanvas->getCanvas()->Update();
}
}
示例4: obase
/**
* Steering
*
* @param input Input file
*/
void
ExtractGSE(const char* input)
{
if (!gROOT->GetClass("GraphSysErr"))
gROOT->LoadMacro("$HOME/GraphSysErr/GraphSysErr.C+g");
TString base = gSystem->BaseName(input); base.ReplaceAll(".root","");
TFile* file = TFile::Open(input, "READ");
if (!file) return;
TH1* cent = GetH1(file, "realCent");
Bool_t first = true;
TList* stack = new TList;
for (Int_t i = 1; i <= cent->GetNbinsX(); i++) {
Double_t c1 = cent->GetXaxis()->GetBinLowEdge(i);
Double_t c2 = cent->GetXaxis()->GetBinUpEdge(i);
TObject* g = MakeGSE(file, c1, c2);
if (!g) continue;
stack->Add(g);
if (first) g->Draw("quad stat combine axis");
else g->Draw("quad stat combine");
first = false;
}
TString obase(base); obase.Prepend("GSE_");
std::ofstream out(Form("%s.input", obase.Data()));
GraphSysErr::Export(stack, out, "HFC", 2);
out << "*E" << std::endl;
out.close();
TFile* rout = TFile::Open(Form("%s.root", obase.Data()), "RECREATE");
stack->Write("container", TObject::kSingleKey);
rout->Write();
}
示例5: if
void
Enlarge(Int_t i)
{
// toolcanvas->cd();
TObject *o;
TList *ll = toolcanvas->GetListOfPrimitives();
for (Int_t ii=ll->GetEntries()-1; ii>=0; ii--)
{
o = ll->At(ii);
ll->Remove(o);
}
toolcanvas->SetWindowSize(toolw-28, toolh-8);
toolcanvas->cd();
bclose->Draw();
// canvas->cd();
vp = (TPad*)canvas->GetListOfPrimitives()->At(i);
if (!vp) return;
// else
// cout << "selected pad name " << vp->GetName() << endl;
TList *alist;
if (vp->GetListOfPrimitives()->GetEntries() > 1)
{
graph0 = (TH1*) vp->GetListOfPrimitives()->At(1);
// graph1 = (TH1*) graph0->Clone("graph1");
alist = vp->GetListOfPrimitives();
}
else
return;
Char_t opt[50];
strcpy(opt,graph0->GetDrawOption());
// display->Draw();
display = SafeConstructCanvas("display");
display->Draw();
display->cd();
gROOT->SetSelectedPad(display);
// std::cout << "______Drawing Pad______\n\t"
// << gPad->GetName() << std::endl;
TString option;
TH1* anh, *anhh;
TObject *oo;
for (Int_t i=1; i<alist->GetEntries(); i++)
{
oo = alist->At(i);
if (oo->InheritsFrom(TH1::Class()))
{
anh = static_cast<TH1*>(oo);
option = anh->GetDrawOption();
option += "HE";
if (i>1)
option += "same";
if (oo->InheritsFrom(TH2::Class()))
anhh = anh->DrawCopy("colz");
else
anhh = anh->DrawCopy(option.Data());
anhh->SetFillStyle(0);
anhh->SetLineColor(anh->GetLineColor());
cout << anhh->GetName() << " with option=\""
<< option.Data() << "\""
<< " lcolor=" << anhh->GetLineColor()
<< " fcolor=" << anhh->GetFillColor()
<< " fstyle=" << anhh->GetFillStyle()
<< flush << endl;
display->Modified();
display->Update();
// gSystem->Sleep(5000);
// anhh->SetFillColor(anh->GetFillColor());
// anhh->SetFillStyle(anh->GetFillStyle());
}
else if (i<alist->GetEntries()-1)
oo->Draw();
}
display->Modified();
display->Update();
}
示例6:
////////////////////// drawhisto by name //////////////////////////////////////////////////////////////////////
//void drawbyname(char* histname)
///////////////////////////////////////////////////////////////////
drawbyname(char* histname){
TObject *obj;
obj = gFile->FindKeyAny(histname)->ReadObj();
obj->Draw();
}