本文整理汇总了C++中TGaxis::CenterTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::CenterTitle方法的具体用法?C++ TGaxis::CenterTitle怎么用?C++ TGaxis::CenterTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGaxis
的用法示例。
在下文中一共展示了TGaxis::CenterTitle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TGaxis
ReverseXAxis (TGraphAsymmErrors *g, double size)
{
// Remove the current axis
g->GetXaxis()->SetLabelOffset(999);
g->GetXaxis()->SetTickLength(0);
// Redraw the new axis
gPad->Update();
g->GetYaxis()->SetTitle("Event Selection Efficiency");
TGaxis *newaxis = new TGaxis(gPad->GetUxmax(),
gPad->GetUymin(),
gPad->GetUxmin(),
gPad->GetUymin(),
g->GetXaxis()->GetXmin(),
g->GetXaxis()->GetXmax(),
510,"-");
newaxis->SetLabelOffset(-0.04);
newaxis->SetTitle("Centrality");
newaxis->SetTitleFont(42);
newaxis->SetTitleSize(size);
newaxis->SetLabelSize(size);
newaxis->CenterTitle();
newaxis->SetLabelFont(42);
newaxis->Draw();
}
示例2: ReverseXAxis
void ReverseXAxis (TH1 *h)
{
h->GetXaxis()->SetLabelOffset(999);
h->GetXaxis()->SetTickLength(0);
gPad->Update();
TGaxis *newaxis = new TGaxis(gPad->GetUxmax(),
gPad->GetUymin(),
gPad->GetUxmin(),
gPad->GetUymin(),
h->GetXaxis()->GetXmin(),
h->GetXaxis()->GetXmax(),
510,"-");
newaxis->SetLabelOffset(-0.03);
newaxis->SetTitle("X[cm]");
newaxis->CenterTitle(1);
newaxis->Draw();
}
示例3: composeTrackAnalysisbyAssociator
//.........这里部分代码省略.........
DeltaPt2simPtHist->SetBinError(PtIndex, DeltaPtRMS);
TH1D* DeltaPhiHist = DeltaPhimaxPurity2simPtHist->ProjectionY("DeltaPhi", PtIndex, PtIndex, "o");
double DeltaPhiMean = DeltaPhiHist->GetMean();
double DeltaPhiRMS = DeltaPhiHist->GetRMS();
DeltaPhi2simPtHist->SetBinContent(PtIndex, DeltaPhiMean);
DeltaPhi2simPtHist->SetBinError(PtIndex, DeltaPhiRMS);
TH1D* DeltaEtaHist = DeltaEtamaxPurity2simPtHist->ProjectionY("DeltaEta", PtIndex, PtIndex, "o");
double DeltaEtaMean = DeltaEtaHist->GetMean();
double DeltaEtaRMS = DeltaEtaHist->GetRMS();
DeltaEta2simPtHist->SetBinContent(PtIndex, DeltaEtaMean);
DeltaEta2simPtHist->SetBinError(PtIndex, DeltaEtaRMS);
}
myEfficiencyHist->AddLast(Efficiency2simPtHist);
myParticleHist->AddLast(Particle2simPtHist);
mySTAHist->AddLast(STA2simPtHist);
myChargeCheckHist->AddLast(InverseChargeRato2simPtHist);
myDeltaPtHist->AddLast(DeltaPt2simPtHist);
}
double minX = 0;
double minY = 0;
double maxX = 110;
double maxY = 40;
TCanvas* myCanvas = new TCanvas("Canvas", "Canvas", 800, 600);
myCanvas->cd();
TPad* myPad = new TPad("Pad", "Pad", 0, 0, 1, 1);
myPad->Draw();
myPad->cd();
((TH1D*)(myParticleHist->At(0)))->SetStats(0);
((TH1D*)(myParticleHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev");
((TH1D*)(myParticleHist->At(0)))->GetXaxis()->CenterTitle(1);
((TH1D*)(myParticleHist->At(0)))->Draw();
for(int Index = 0; Index < FileNumber; Index++) {
((TH1D*)(mySTAHist->At(Index)))->SetStats(0);
((TH1D*)(mySTAHist->At(Index)))->SetLineColor(kRed+Index);
((TH1D*)(mySTAHist->At(Index)))->Draw("same");
}
TLegend *STALeg = new TLegend(0.6,0.1,0.9,0.3);
STALeg->SetBorderSize(1);
TString LegKey = "ParticleTrack";
STALeg->AddEntry(myParticleHist->At(0), LegKey, "lpf");
for(int Index = 0; Index < FileNumber; Index++) {
LegKey = TypeName[Index];
STALeg->AddEntry(mySTAHist->At(Index), LegKey, "lpf");
}
STALeg->Draw();
string SaveName = OutputPlotNamepreFix + "_STA2simPt" + OutputPlotNameFix;
myCanvas->SaveAs(SaveName.c_str());
myPad->Clear();
myPad->Update();
double YScale = myPad->GetUymax() / 110.;
((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev");
((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->CenterTitle(1);
((TH1D*)(myEfficiencyHist->At(0)))->SetStats(0);
((TH1D*)(myEfficiencyHist->At(0)))->Scale(YScale);
((TH1D*)(myEfficiencyHist->At(0)))->SetLineColor(kRed);
((TH1D*)(myEfficiencyHist->At(0)))->Draw("same,ah");
for(int Index = 1; Index < FileNumber; Index++) {
((TH1D*)(myEfficiencyHist->At(Index)))->SetStats(0);
((TH1D*)(myEfficiencyHist->At(Index)))->Scale(YScale);
((TH1D*)(myEfficiencyHist->At(Index)))->SetLineColor(kRed+Index);
((TH1D*)(myEfficiencyHist->At(Index)))->Draw("same,ah");
示例4: PlotPotential2D
//.........这里部分代码省略.........
LastyBin = Nbins;
}
// ----------------------------------------------------------------------------------
// Get charge density histos
Int_t Nspecies = pData->NSpecies();
TH2F **hDen2D = new TH2F*[Nspecies];
// Get charge density on-axis
TH1F **hDen1D = new TH1F*[Nspecies];
// And electric current (integrated)
TH1F **hCur1D = new TH1F*[Nspecies];
for(Int_t i=0; i<Nspecies; i++) {
hDen2D[i] = NULL;
if(!pData->GetChargeFileName(i))
continue;
cout << Form(" Getting charge density of specie: ") << i << endl;
char hName[24];
sprintf(hName,"hDen2D_%i",i);
hDen2D[i] = (TH2F*) gROOT->FindObject(hName);
if(hDen2D[i]) delete hDen2D[i];
if(!pData->Is3D())
hDen2D[i] = pData->GetCharge(i,opt);
else
hDen2D[i] = pData->GetCharge2DSliceZY(i,-1,Nbins,opt+"avg");
hDen2D[i]->SetName(hName);
hDen2D[i]->GetXaxis()->CenterTitle();
hDen2D[i]->GetYaxis()->CenterTitle();
hDen2D[i]->GetZaxis()->CenterTitle();
if(opt.Contains("comov"))
hDen2D[i]->GetXaxis()->SetTitle("k_{p} #zeta");
else
hDen2D[i]->GetXaxis()->SetTitle("k_{p} z");
if(pData->IsCyl())
hDen2D[i]->GetYaxis()->SetTitle("k_{p} r");
else
hDen2D[i]->GetYaxis()->SetTitle("k_{p} y");
hDen2D[i]->GetZaxis()->SetTitle("n [n_{0}]");
hDen1D[i] = NULL;
hCur1D[i] = NULL;
if(!pData->GetEfieldFileName(i))
continue;
sprintf(hName,"hDen1D_%i",i);
hDen1D[i] = (TH1F*) gROOT->FindObject(hName);
if(hDen1D[i]) delete hDen1D[i];
// 1D histograms
if(pData->Is3D()) {
hDen1D[i] = pData->GetH1SliceZ3D(pData->GetChargeFileName(i)->c_str(),"charge",-1,Nbins,-1,Nbins,opt+"avg");
} else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0).
hDen1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",1,Nbins,opt+"avg");
} else { // 2D cartesian
示例5: PlotDensity1D
void PlotDensity1D( const TString &sim, Int_t time, Int_t Nbins=1, const TString &options="") {
#ifdef __CINT__
gSystem->Load("libplasma.so");
#endif
PlasmaGlob::Initialize();
// Init Units table
PUnits::UnitsTable::Get();
// Load PData
PData *pData = PData::Get(sim.Data());
pData->LoadFileNames(time);
if(!pData->IsInit()) return;
TString opt = options;
gStyle->SetPadRightMargin(0.20); // Margin right axis
if(opt.Contains("grid")) {
gStyle->SetPadGridX(1);
gStyle->SetPadGridY(1);
}
Bool_t CYL = kFALSE;
if(sim.Contains("cyl")) { CYL = kTRUE; opt += "cyl"; }
Bool_t ThreeD = kFALSE;
if(sim.Contains("3D")) ThreeD = kTRUE;
Bool_t INT = kTRUE; // Integrate instead of averaging.
// Some plasma constants
Float_t n0 = pData->GetPlasmaDensity();
Float_t kp = pData->GetPlasmaK();
Float_t skindepth = (1/kp);
Float_t E0 = pData->GetPlasmaE0();
// Some beam properties:
Double_t Ebeam = pData->GetBeamEnergy();
Double_t gamma = pData->GetBeamGamma();
Double_t vbeam = pData->GetBeamVelocity();
Double_t kbeta = PFunc::BeamBetatronWavenumber(gamma,n0);
Double_t rms0 = pData->GetBeamRmsY() * kp;
if(CYL) rms0 = pData->GetBeamRmsR() * kp;
cout << Form(" - Bunch gamma = %8.4f", gamma ) << endl;
cout << Form(" - Bunch velocity = %8.4f c", vbeam ) << endl;
cout << Form(" - Bunch betatron k = %8.4f mm-1", kbeta * PUnits::mm) << endl;
cout << Form(" - Bunch RMS_0 = %8.4f um", rms0 * skindepth / PUnits::um) << endl;
cout << endl;
// Time in OU
Float_t Time = pData->GetRealTime();
// z start of the plasma in normalized units.
Float_t zStartPlasma = pData->GetPlasmaStart()*kp;
// z start of the beam in normalized units.
Float_t zStartBeam = pData->GetBeamStart()*kp;
if(opt.Contains("center")) {
Time -= zStartPlasma;
if(opt.Contains("comov")) // Centers on the head of the beam.
Time += zStartBeam;
}
// Get charge density histos
Int_t Nspecies = pData->NSpecies();
TH1F **hDen1D = new TH1F*[Nspecies];
TH2F *hDen2D = NULL;
for(Int_t i=0;i<Nspecies;i++) {
hDen1D[i] = NULL;
if(!pData->GetChargeFileName(i))
continue;
if(i==0) {
if(ThreeD)
hDen2D = pData->GetCharge2DSliceZY(i,-1,Nbins);
else
hDen2D = pData->GetCharge(i,opt);
char hName[24];
sprintf(hName,"hDen_%i",i);
hDen2D->SetName(hName);
hDen2D->GetXaxis()->CenterTitle();
hDen2D->GetYaxis()->CenterTitle();
hDen2D->GetZaxis()->CenterTitle();
hDen2D->GetXaxis()->SetTitle("z [c/#omega_{p}]");
hDen2D->GetYaxis()->SetTitle("y [c/#omega_{p}]");
if(i==0)
hDen2D->GetZaxis()->SetTitle("#LTn_{e}#GT [n_{0}]");
else
hDen2D->GetZaxis()->SetTitle("#LTn_{b}#GT [n_{0}]");
}
if(Nbins==0) {
Nbins = TMath::Nint(rms0 / hDen2D->GetYaxis()->GetBinWidth(1)) ;
// cout << Form(" Rms0 = %6.2f Dx = %6.2f Nbins = %4i .",
// rms0, hDen2D[i]->GetYaxis()->GetBinWidth(1), Nbins) << endl;
}
//.........这里部分代码省略.........
示例6: PlotField1D
//.........这里部分代码省略.........
// Output file
TString fOutName = Form("./%s/Plots/Field1D/Field1D",sim.Data());
fOutName += Form("-%s_%i",sim.Data(),time);
// Canvas setup
TCanvas *C = new TCanvas("C","Electric wakefield on axis",850,1000);
C->Divide(1,2);
// Draw objects
TPaveText *textTime = new TPaveText(0.70,0.87,0.85,0.92,"NDC");
PlasmaGlob::SetPaveTextStyle(textTime);
char ctext[128];
if(opt.Contains("units") && n0)
sprintf(ctext,"Z = %5.1f mm", 1e3 * skindepth * Time);
else
sprintf(ctext,"T = %5.1f 1/#omega_{p}",Time);
textTime->AddText(ctext);
// Colors
Int_t fieldC = PlasmaGlob::fieldLine;
Int_t phaseC = kGray+1;
// Actual Plotting!
// ------------------------------------------------------------
// More makeup
C->cd(1);
gPad->SetGridy(0);
gPad->SetGridx(0);
gPad->SetFrameLineWidth(2);
hE1D[0]->SetLineWidth(1);
hE1D[0]->GetYaxis()->CenterTitle();
hE1D[0]->GetXaxis()->CenterTitle();
hE1D[0]->SetLineStyle(1);
hE1D[0]->SetLineWidth(3);
hE1D[0]->SetLineColor(fieldC);
hE1D[0]->SetMarkerStyle(20);
if(Nfields>1) {
hE1D[1]->GetYaxis()->CenterTitle();
hE1D[1]->GetXaxis()->CenterTitle();
hE1D[1]->SetLineStyle(1);
hE1D[1]->SetLineWidth(1);
hE1D[1]->SetLineColor(fieldC);
hE1D[1]->SetMarkerStyle(24);
}
Float_t factor = 1.5;
Float_t minimum = factor * hE1D[0]->GetMinimum();
Float_t maximum = factor * hE1D[0]->GetMaximum();
if(Nfields>1) {
if(hE1D[1]->GetMaximum() > hE1D[0]->GetMaximum()) {
maximum = factor * hE1D[1]->GetMaximum();
}
if(hE1D[1]->GetMinimum() < hE1D[0]->GetMinimum()) {
minimum = factor * hE1D[1]->GetMinimum();
}
}
if( maximum >= TMath::Abs(minimum)) minimum = -maximum;
else maximum = - minimum;