本文整理汇总了C++中TCanvas::GetWh方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::GetWh方法的具体用法?C++ TCanvas::GetWh怎么用?C++ TCanvas::GetWh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::GetWh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HITSummary
void TMRCScanner::HITSummary(int channel)
{
ffile = new TFile(foutfile);
if (ffile->IsOpen()) {
ftree = (TTree*) ffile->Get("T");
ftree->SetMarkerStyle(23);
Double_t w =600;
Double_t h = 600;
TCanvas * myc = new TCanvas("c",Form("HIT Summary - channel %d",channel),w,h);
myc->SetWindowSize(w+(w-myc->GetWw()),h +(h-myc->GetWh()));
myc->Divide(3,2);
myc->Update();
myc->cd(1);
myc->Update();
ftree->Draw(Form("HITEntries[%d]:DAC",channel));
myc->cd(6);
myc->Update();
ftree->Draw(Form("HITMin[%d]:DAC",channel));
myc->cd(3);
myc->Update();
ftree->Draw(Form("HITMax[%d]:DAC",channel));
myc->cd(2);
myc->Update();
ftree->Draw(Form("HITMean[%d]:DAC",channel));
myc->cd(5);
myc->Update();
ftree->Draw(Form("HITRms[%d]:DAC",channel));
}else {
printf("File %s not opened \n",foutfile);
}
delete ffile;
}
示例2: arrowPlot
void arrowPlot(){
gROOT->Reset();
gROOT->SetStyle("Plain");
TChain *mc = new TChain("ntupleR2S");
//MC reco
mc->Add("./ntuple_conversion_MinBiasMC_01.root");
mc->Add("./ntuple_conversion_MinBiasMC_02.root");
mc->Add("./ntuple_conversion_MinBiasMC_03.root");
mc->Add("./ntuple_conversion_MinBiasMC_04.root");
TString rSIM = "sqrt((x+deltax)*(x+deltax)+(y+deltay)*(y+deltay))";
TString xSIM = "(x+deltax)";
TString ySIM = "(y+deltay)";
TString zSIM = "(z+deltaz)";
TString deltar = "sqrt((deltax)*(deltax)+(deltay)*(deltay))";
TString deltax = "(deltax)";
TString deltay = "(deltay)";
TString deltaz = "(deltaz)";
//Z
Int_t nbinU = 64;
Double_t minU = -80.;
Double_t maxU = 80.;
//R
Int_t nbinV = 26;
Double_t minV = 0.;
Double_t maxV = 65.;
TString varU = zSIM;
TString varV = rSIM;
TString deltaU = deltaz;
TString deltaV = deltar;
// TCanvas * canrz = makeNiceCanvas(15, nbinU, nbinV, 0.04, 0.11, 0.07, 0.02);
TCanvas * canrz = makeNiceCanvas(15, nbinU, nbinV, 20, 60, 70, 20);
canrz->cd();
drawFrame("true Z (cm)", "true R (cm)", minU, maxU, minV, maxV, canrz->GetWh());
drawArrowPlot(mc, varU, deltaU, varV, deltaV, nbinU, minU, maxU, nbinV, minV, maxV);
canrz->SaveAs("RZ_Arrow.png");
//X
nbinU = 52;
minU = -65.;
maxU = 65.;
//Y
nbinV = 52;
minV = -65.;
maxV = 65.;
varU = xSIM;
varV = ySIM;
deltaU = deltax;
deltaV = deltay;
TCanvas * canxy = makeNiceCanvas(15, nbinU, nbinV, 20, 60, 70, 20);
canxy->cd();
drawFrame("true X (cm)", "true Y (cm)", minU, maxU, minV, maxV, canxy->GetWh());
drawArrowPlot(mc, varU, deltaU, varV, deltaV, nbinU, minU, maxU, nbinV, minV, maxV);
canxy->SaveAs("XY_Arrow.png");
}
示例3: pmt_testing
void pmt_testing(char* input_file) {
Double_t width = 1000;
Double_t height = 1000;
TCanvas * canvas = new TCanvas("canvas", "PMT Testing", 0, 0, width, height);
canvas->SetWindowSize(width + (width - canvas->GetWw()),
height + (height - canvas->GetWh()));
//Parameters
Int_t nbins = 40;
Double_t min = 550000; //hist min/max values
Double_t max = 600000; //Must be better way to get these!
//Initialized variables
Int_t num_data_points = 0;
Int_t pulse;
Int_t channel;
Int_t total_channels;
const Int_t pedestal = 2020; //how to determine this?
TFile *file = new TFile("adc_data.root", "recreate");
//Style settings
gROOT->SetStyle("Plain");
gStyle->SetPalette(53);
gStyle->SetOptStat(111111);
gStyle->SetOptFit(1111);
gStyle->SetStatBorderSize(0);
gStyle->SetOptTitle(1);
//Prepare Data
//Create nTuple
TTree *t1 = new TTree("t1", "ADC Data");
t1->Branch("pulse", &pulse, "pulse/I");
t1->Branch("channel", &channel, "channel/I");
ifstream in;
in.open(input_file);
//Fill TTree
while ( in >> channel) {
if (num_data_points % 2520 == 0)
pulse++;
t1->Fill();
num_data_points++;
}
in.close();
TH1F * spectrum = new TH1F("spectrum", "ADC Spectrum; Accumulated Channels; Counts", nbins, min, max);
//spectrum->SetBit(TH1::kCanRebin);
spectrum->Sumw2();
for(Int_t i = 0; i < t1->GetEntries(); i++) {
t1->GetEntry(i);
if (i % 2520 == 0) {
cout << "total_channels = " << total_channels << endl;
spectrum->Fill(total_channels);
total_channels = 0;
}
total_channels += TMath::Abs(channel - pedestal);
}
spectrum->SetLineWidth(2);
spectrum->SetMarkerColor(kBlack);
spectrum->SetLineColor(kBlack);
// Fit Gaussian to curve and Draw
spectrum->Fit("gaus");
spectrum->GetFunction("gaus")->SetLineColor(kRed);
spectrum->Draw("Same");
t1->Write();
spectrum->Write();
}