本文整理汇总了C++中TCanvas::GetWw方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::GetWw方法的具体用法?C++ TCanvas::GetWw怎么用?C++ TCanvas::GetWw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::GetWw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}