本文整理汇总了C++中TVirtualPad::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ TVirtualPad::Update方法的具体用法?C++ TVirtualPad::Update怎么用?C++ TVirtualPad::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVirtualPad
的用法示例。
在下文中一共展示了TVirtualPad::Update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddGrid
//_______________________________________________________________________________________
static void AddGrid()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
TList *list = thisPad->GetListOfPrimitives();
TString histName = thisPad->GetName();
TH2F *m_DummyHist = 0;
const Char_t *dummyName = "Axis3D";
histName += dummyName;
m_DummyHist = list->FindObject(histName.Data());
if (!m_DummyHist) {
m_DummyHist = new TH2F(histName.Data(),"",1,min[0],max[0],1,min[1],max[1]);
m_DummyHist->SetDirectory(0);
m_DummyHist->Draw("surf,same");
}
m_DummyHist->GetXaxis()->SetLimits(min[0],max[0]);
m_DummyHist->GetYaxis()->SetLimits(min[1],max[1]);
m_DummyHist->GetZaxis()->SetLimits(min[2],max[2]);
thisPad->Modified();
thisPad->Update();
}
}
示例2: setLogy
/* *********** multi-pad canvases ******************** */
void setLogy(TCanvas *c, bool on = true) {
c->Modified();
c->Update();
//gSystem->ProcessEvents();
TObject *obj;
TIter next(c->GetListOfPrimitives());
while ((obj = next())) {
if (obj->InheritsFrom(TVirtualPad::Class())) {
TVirtualPad *pad = (TVirtualPad*)obj;
pad->Modified();
pad->Update();
pad->SetLogy(on);
pad->Modified();
pad->Update();
}
}
}
示例3: SetBackround
//_______________________________________________________________________________________
static void SetBackround(Color_t color, TVirtualPad *pad=0)
{
TVirtualPad *thisPad = pad;
if (!thisPad) thisPad = qPad();
if (thisPad) {
thisPad->SetFillColor(color);
thisPad->Modified();
thisPad->Update();
}
}
示例4: qPad
//_______________________________________________________________________________________
static void Inscrease3DScale()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
int i;
for (i=0;i<3; i++) {max[i] *= 0.8; min[i]=max[i]*0.1;}
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}
示例5: RotateView
//_______________________________________________________________________________________
static void RotateView(Float_t phi, Float_t theta, TVirtualPad *pad=0)
{
TVirtualPad *thisPad = pad;
if (!thisPad) thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (view) {
Int_t iret;
Float_t p = phi;
Float_t t = theta;
view->SetView(p, t, 0, iret);
thisPad->SetPhi(-90-p);
thisPad->SetTheta(90-t);
thisPad->Modified();
thisPad->Update();
}
}
}
示例6: AdjustScales
//_______________________________________________________________________________________
static void AdjustScales()
{
TVirtualPad *thisPad = qPad();
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3];
view->GetRange(min,max);
int i;
Double_t maxSide = 0;
// Find the largest side
for (i=0;i<3; i++) maxSide = TMath::Max(maxSide,max[i]-min[i]);
//Adjust scales:
for (i=0;i<3; i++) max[i] += maxSide - (max[i]-min[i]);
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}
示例7: SpiderIdentification
//.........这里部分代码省略.........
}
}
tmpCut = (TList*)fGrid->GetCuts()->Clone("tmpCuts");
}
fGrid->Clear();
if (fScaledHisto) delete fScaledHisto;
KVHistoManipulator hm;
TF1 RtLt("RtLt", Form("x*%lf", fSfx), 0, tmpHisto->GetXaxis()->GetXmax());
TF1 RtLty("RtLty", Form("x*%lf", fSfy), 0, tmpHisto->GetXaxis()->GetXmax());
fScaledHisto = (TH2F*)hm.ScaleHisto(tmpHisto, &RtLt, &RtLty);
if (fIdentificator) delete fIdentificator;
fIdentificator = new KVSpiderIdentificator(fScaledHisto, fXm * fSfx, fYm * fSfy);
switch (fPiedType) {
case kUser:
fIdentificator->SetX0(fPdx * fSfx);
fIdentificator->SetY0(fPdy * fSfy);
break;
case kAuto:
break;
case kNone:
fIdentificator->SetX0(0.);
fIdentificator->SetY0(0.);
}
fIdentificator->SetParameters(fSpFactor);
fIdentificator->SetNangles(fAnglesUp, fAnglesDown);
fIdentificator->SetAlpha(fAlpha);
fProgressBar->SetRange(0, fAnglesUp + fAnglesDown + 1);
fProgressBar->Reset();
fIdentificator->Connect("Increment(Float_t)", "TGHProgressBar", fProgressBar, "SetPosition(Float_t)");
fTestButton->SetEnabled(kFALSE);
fCloseButton->SetEnabled(kFALSE);
fIdentificator->ProcessIdentification();
fTestButton->SetEnabled(kTRUE);
fCloseButton->SetEnabled(kTRUE);
fIdentificator->Disconnect("Increment(Float_t)", fProgressBar, "SetPosition(Float_t)");
fProgressBar->Reset();
if (fDebug) fIdentificator->Draw(fOption.Data());
TList* ll = (TList*)fIdentificator->GetListOfLines();
KVIDZALine* TheLine = 0;
int zmax = 0;
KVSpiderLine* spline = 0;
TIter next_line(ll);
while ((spline = (KVSpiderLine*)next_line())) {
if ((spline->GetN() > 10)) { //&&(spline->GetX(0)<=fIdentificator->GetX0()+200.))
TF1* ff1 = 0;
if (type == kSiCsI) ff1 = spline->GetFunction(fPdx * fSfx, TMath::Max(fScaledHisto->GetXaxis()->GetXmax() * 0.9, spline->GetX(spline->GetN() - 1)));
else if (type == kSiSi) ff1 = spline->GetFunction(fPdx * fSfx, TMath::Min(fScaledHisto->GetXaxis()->GetXmax() * 0.9, spline->GetX(spline->GetN() - 1) * 1.5));
else if (type == kChIoSi) ff1 = spline->GetFunction(fPdx * fSfx, TMath::Min(fScaledHisto->GetXaxis()->GetXmax() * 0.9, spline->GetX(spline->GetN() - 1) * 1.5));
else ff1 = spline->GetFunction();
if ((type == kSiCsI) && (ff1->GetParameter(1) >= 3000. || (ff1->GetParameter(2) <= 0.35) || (ff1->GetParameter(2) >= 1.))) {
Info("SpiderIdentification", "Z = %d has been rejected (fit parameters)", spline->GetZ());
continue;
}
TheLine = (KVIDZALine*)((KVIDZAGrid*)fGrid)->NewLine("ID");
TheLine->SetZ(spline->GetZ());
double min, max;
ff1->GetRange(min, max);
double step = TMath::Min((max - min) * 0.05, 20.); //20.;
double stepmax = (max - min) * 0.2; //800.;
double x = 0.;
for (x = min + 1; x < max + step; x += step) {
if (step <= stepmax) step *= 1.3;
if (ff1->Eval(x) < 4000) TheLine->SetPoint(TheLine->GetN(), x, ff1->Eval(x));
}
if (max > x) TheLine->SetPoint(TheLine->GetN(), max, ff1->Eval(max));
fGrid->Add("ID", TheLine);
if (spline->GetZ() >= zmax) zmax = spline->GetZ();
} else {
Info("SpiderIdentification", "Z = %d has been rejected (too few points)", spline->GetZ());
}
}
TF1 fx("fx12", Form("x/%lf", fSfx), 0., fScaledHisto->GetNbinsX() * 1.);
TF1 fy("fy12", Form("x/%lf", fSfy), 0., fScaledHisto->GetNbinsY() * 1.);
fGrid->Scale(&fx, &fy);
if (fUseCut) delete tmpHisto;
if (tmpCut) fGrid->GetCuts()->AddAll(tmpCut);
pad->cd();
fGrid->Draw();
pad->Modified();
pad->Update();
DoClose();
}
示例8: xtruSamples
//.........这里部分代码省略.........
worldnode->cd();
// Canonical shape ... gets further modified by scale factors
// to create convex (and malformed) versions
Float_t x[] = { -0.50, -1.20, 1.20, 0.50, 0.50, 1.20, -1.20, -0.50 };
Float_t y[] = { -0.75, -2.00, -2.00, -0.75, 0.75, 2.00, 2.00, 0.75 };
Float_t z[] = { -0.50, -1.50, -1.50, 1.50, 1.50, 0.50 };
Float_t s[] = { 0.50, 1.00, 1.50, 1.50, 1.00, 0.50 };
Int_t nxy = sizeof(x)/sizeof(Float_t);
Float_t convexscale[] = { 7.0, -1.0, 1.5 };
Int_t icolor[] = { 1, 2, 3, 2, 2, 2, 4, 2, 6 };
// xycase and zcase: 0=convex, 1=malformed, 2=concave
// this will either create a 2x2 matrix of shapes
// or a 3x3 array (if displaying malformed versions)
for (Int_t zcase = 0; zcase<3; zcase++) {
if (zcase == 1 && !domalformed) continue;
for (Int_t xycase = 0; xycase<3; xycase++) {
if (xycase == 1 && !domalformed) continue;
Char_t *name = "txtruXYZ";
sprintf(name,"txtru%1d%1d%1d",xycase,zcase,zseg);
TXTRU* mytxtru = new TXTRU(name,name,"void",8,2);
Int_t i, j;
Float_t xsign = (makecw) ? -1 : 1;
Float_t zsign = (reversez) ? -1 : 1;
// set the vertex points
for (i=0; i<nxy; i++) {
Float_t xtmp = x[i]*xsign;
Float_t ytmp = y[i];
if (i==0||i==3||i==4||i==7) xtmp *= convexscale[xycase];
if (xycase==2) xtmp *=2;
mytxtru->DefineVertex(i,xtmp,ytmp);
}
// set the z segment positions and scales
for (i=0, j=0; i<zseg; i++) {
Float_t ztmp = z[i]*zsign;
if (i==0||i==5) ztmp *= convexscale[zcase];
if (zcase==2) ztmp *= 2.5;
if (zseg>2 && zcase!=2 && (i==1||i==4)) continue;
mytxtru->DefineSection(j,ztmp,s[i]);
j++;
}
TNode* txtrunode = new TNode(name,name,mytxtru);
txtrunode->SetLineColor(icolor[3*zcase+xycase]);
Float_t pos_scale = (domalformed) ? 10 : 6;
Float_t xpos = (xycase-1)*pos_scale*unit;
Float_t ypos = (zcase-1)*pos_scale*unit;
txtrunode->SetPosition(xpos,ypos,0.);
}
}
// Some extra shapes to show the direction of "z"
Float_t zhalf = 0.5*bigdim;
Float_t rmax = 0.03*bigdim;
TCONE* zcone = new TCONE("zcone","zcone","void",zhalf,0.,rmax,0.,0.);
zcone->SetVisibility(extravis);
TNode* zconenode = new TNode("zconenode","zconenode",zcone);
zconenode->SetLineColor(3);
Float_t dzstub = 2*rmax;
TBRIK* zbrik = new TBRIK("zbrik","zbrik","void",rmax,rmax,dzstub);
zbrik->SetVisibility(extravis);
TNode* zbriknode = new TNode("zbriknode","zbriknode",zbrik);
zbriknode->SetPosition(0.,0.,zhalf+dzstub);
zbriknode->SetLineColor(3);
// geom->ls();
geom->Draw();
// Tweak the pad so that it displays the entire geometry undistorted
TVirtualPad *thisPad = gPad;
if (thisPad) {
TView *view = thisPad->GetView();
if (!view) return;
Double_t min[3],max[3],center[3];
view->GetRange(min,max);
int i;
// Find the boxed center
for (i=0;i<3; i++) center[i] = 0.5*(max[i]+min[i]);
Double_t maxSide = 0;
// Find the largest side
for (i=0;i<3; i++) maxSide = TMath::Max(maxSide,max[i]-center[i]);
file://Adjust scales:
for (i=0;i<3; i++) {
max[i] = center[i] + maxSide;
min[i] = center[i] - maxSide;
}
view->SetRange(min,max);
thisPad->Modified();
thisPad->Update();
}
}
示例9: validation
//.........这里部分代码省略.........
TVirtualPad* ph = it->second->cd(1);
TVirtualPad* pr = it->second->cd(2);
ph->SetPad(0.00, 0.35, 1.00, 1.00);
pr->SetPad(0.00, 0.00, 1.00, 0.35);
ph->SetBottomMargin(0.012);
pr->SetBottomMargin(0.20);
pr->SetTopMargin(0.012);
ph->cd();
ph->Draw();
ph->SetTicks(1,1);
ph->SetLogy();
ph->SetLogx();
// h1Map[it->first+"o"]->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
// h1Map[it->first+"o"]->Draw();
TH1D* hTmpNoErr = (TH1D*)resetErrors(h1Map[it->first+"o"])->Clone();
hTmpNoErr->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
hTmpNoErr->SetLineStyle(1);
hTmpNoErr->SetLineColor(kBlack);
hTmpNoErr->SetFillColor(kAzure-9);
hTmpNoErr->Draw();
TH1D* hTmpErr = (TH1D*)ShiftLog(h1Map[it->first+"o"],0.2)->Clone();
hTmpErr->SetFillStyle(4000); //will be transparent
hTmpErr->SetFillColor(0);
hTmpErr->DrawCopy("epx0SAMES");
hDY->Draw("SAMES");
h1Map[it->first+"t"]->Draw("epSAMES");
//poissonGraphMap[it->first]->Draw("pSAMES");
if(it->first=="2000")
{
graphDY->Draw("SAMESp");
graphSSM->Draw("SAMESp");
h1Template->Draw("epSAMES");
}
_INFO("");
h1dTlvTmpltMap[it->first]->Draw("SAMESp");
h1dBrandeisTmpltMap[it->first]->Draw("SAMESp");
TLine* chopline = new TLine(0.12805,getYmin(h1Map[it->first+"o"]),0.12805,7.e5);
chopline->SetLineStyle(2);
chopline->SetLineColor(kBlack);
chopline->Draw("SAMES");
ptxt->Draw("SAMES");
legMap[it->first]->Draw("SAMES");
ph->RedrawAxis();
ph->Update();
_INFO("");
pr->cd();
pr->Draw();
pr->SetTicks(1,1);
pr->SetGridy();
pr->SetLogx();
h1rMap[it->first]->Draw("ep");
line->Draw("SAMES");
h1rMap[it->first]->Draw("epSAMES");
legR->Draw("SAMES");
pr->RedrawAxis();
pr->Update();
unsigned int savestate = 1;
if(it->first=="1000") savestate = 0;
else if(it->first=="2000") savestate = 2;
else savestate = 1;
TString testType = (doResiduals) ? "_residuals" : "_ratio";
mutype = (doTruth) ? "_truth" : "_recon";
savemultipdf(it->second, "plots/validation/validation"+mutype+testType+"_"+mctype+"_all.pdf", savestate);
saveas(it->second, "plots/validation/validation"+mutype+testType+"_"+mctype+"_"+it->first);
TCanvas* c = new TCanvas(it->first,"",600,400);
c->cd();
c->Draw();
c->SetTicks(1,1);
c->SetLogy();
c->SetLogx();
hTmpNoErr->Draw();
hTmpErr->DrawCopy("epx0SAMES");
hDY->Draw("SAMES");
h1Map[it->first+"t"]->Draw("epSAMES");
//poissonGraphMap[it->first]->Draw("pSAMES");
if(it->first=="2000")
{
graphDY->Draw("SAMESp");
graphSSM->Draw("SAMESp");
h1Template->Draw("epSAMES");
}
h1dTlvTmpltMap[it->first]->Draw("SAMESp");
h1dBrandeisTmpltMap[it->first]->Draw("SAMESp");
legMap[it->first]->Draw("SAMES");
chopline->Draw("SAMES");
ptxt->Draw("SAMES");
c->RedrawAxis();
c->Update();
saveas(c,"plots/validation/validation_"+it->first+"_"+mutype+testType);
_INFO("done "+(string)it->first);
}
}