本文整理汇总了C++中TH1::SetLineStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1::SetLineStyle方法的具体用法?C++ TH1::SetLineStyle怎么用?C++ TH1::SetLineStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1
的用法示例。
在下文中一共展示了TH1::SetLineStyle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetStyle
void SetStyle(TH1& h, double size, int color, int style, int fillstyle=0, int linestyle=1){
h.SetMarkerSize(size);
h.SetMarkerColor(color);
h.SetLineColor(color);
h.SetMarkerStyle(style);
h.SetFillStyle(fillstyle);
h.SetLineStyle(linestyle);
h.GetXaxis()->SetTitleFont(42);
h.GetYaxis()->SetTitleFont(42);
h.GetXaxis()->SetTitleSize(0.048);
h.GetYaxis()->SetTitleSize(0.048);
h.GetXaxis()->CenterTitle();
h.GetYaxis()->CenterTitle();
}
示例2: histogramStyle
void histogramStyle(TH1& hist, int color, int lineStyle, int markerStyle, float markersize, int filled)
{
hist.SetLineWidth(3);
hist.SetStats(kFALSE);
hist.SetLineColor (color);
hist.SetMarkerColor(color);
hist.SetMarkerStyle(markerStyle);
hist.SetMarkerSize(markersize);
hist.SetLineStyle(lineStyle);
if(filled==1){
hist.SetFillStyle(1001);
hist.SetFillColor(color);
}
else{
hist.SetFillStyle(0);
}
}
示例3: makePlot
void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& sample, int massPoint, const std::string& channel, double k,
const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
TFile* inputFile = new TFile(inputFileName_full.data());
if ( !inputFile ) {
std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
assert(0);
}
inputFile->ls();
TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
if ( !canvas ) {
std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
assert(0);
}
int idxPad = -1;
if ( massPoint == 90 ) idxPad = 1;
if ( massPoint == 125 ) idxPad = 2;
if ( massPoint == 200 ) idxPad = 3;
if ( massPoint == 300 ) idxPad = 4;
if ( massPoint == 500 ) idxPad = 5;
if ( massPoint == 800 ) idxPad = 6;
if ( !(idxPad >= 1 && idxPad <= 6) ) {
std::cerr << "Invalid sample = " << sample << " !!" << std::endl;
assert(0);
}
TVirtualPad* pad = canvas->GetPad(idxPad);
std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;
TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 800);
canvas_new->SetFillColor(10);
canvas_new->SetBorderSize(2);
canvas_new->SetTopMargin(0.065);
canvas_new->SetLeftMargin(0.17);
canvas_new->SetBottomMargin(0.165);
canvas_new->SetRightMargin(0.015);
canvas_new->SetLogx(true);
canvas_new->SetLogy(true);
canvas_new->Draw();
canvas_new->cd();
//TList* pad_primitives = canvas->GetListOfPrimitives();
TList* pad_primitives = pad->GetListOfPrimitives();
TH1* histogramCA = 0;
TH1* histogramSVfit = 0;
TH1* histogramSVfitMEMkEq0 = 0;
TH1* histogramSVfitMEMkNeq0 = 0;
TIter pad_nextObj(pad_primitives);
while ( TObject* obj = pad_nextObj() ) {
std::string objName = "";
if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();
std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;
TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
if ( tmpHistogram ) {
std::cout << "tmpHistogram:"
<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
<< " integral = " << tmpHistogram->Integral() << std::endl;
std::cout << "(mean = " << tmpHistogram->GetMean() << ", rms = " << tmpHistogram->GetRMS() << ": rms/mean = " << (tmpHistogram->GetRMS()/tmpHistogram->GetMean()) << ")" << std::endl;
if ( tmpHistogram->GetLineColor() == 416 ) histogramCA = tmpHistogram;
if ( tmpHistogram->GetLineColor() == 600 ) histogramSVfit = tmpHistogram;
if ( tmpHistogram->GetLineColor() == 616 ) histogramSVfitMEMkEq0 = tmpHistogram;
if ( tmpHistogram->GetLineColor() == 632 ) histogramSVfitMEMkNeq0 = tmpHistogram;
}
}
if ( !(histogramCA && histogramSVfit && histogramSVfitMEMkEq0 && histogramSVfitMEMkNeq0) ) {
std::cerr << "Failed to load histograms !!" << std::endl;
assert(0);
}
//gStyle->SetLineStyleString(2,"40 10 10 10 10 10 10 10");
//gStyle->SetLineStyleString(3,"25 15");
//gStyle->SetLineStyleString(4,"60 25");
//int colors[4] = { kBlack, kGreen - 6, kBlue - 7, kMagenta - 7 };
int colors[4] = { 28, kGreen - 6, kBlue - 7, kBlack };
//int lineStyles[4] = { 2, 3, 4, 1 };
int lineStyles[4] = { 7, 1, 1, 1 };
//int lineWidths[4] = { 3, 3, 4, 3 };
int lineWidths[4] = { 3, 3, 1, 1 };
int markerStyles[4] = { 20, 25, 21, 24 };
int markerSizes[4] = { 2, 2, 2, 2 };
histogramCA->SetFillColor(0);
histogramCA->SetFillStyle(0);
histogramCA->SetLineColor(colors[0]);
histogramCA->SetLineStyle(lineStyles[0]);
histogramCA->SetLineWidth(lineWidths[0]);
histogramCA->SetMarkerColor(colors[0]);
histogramCA->SetMarkerStyle(markerStyles[0]);
histogramCA->SetMarkerSize(markerSizes[0]);
//.........这里部分代码省略.........
示例4: plotSubDetResiduals
//------------------------------------------------------------------------------
void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned int subDetId)
{
setNiceStyle();
gStyle->SetOptStat(11111);
gStyle->SetOptFit(0000);
TCanvas *c = new TCanvas("c", "c", 600,600);
c->SetTopMargin(0.15);
TString histoName= "";
if (plotNormHisto) {histoName= "h_NormXprime";}
else histoName= "h_Xprime_";
switch (subDetId){
case 1 : histoName+="TPBBarrel_0";break;
case 2 : histoName+="TPEendcap_1";break;
case 3 : histoName+="TPEendcap_2";break;
case 4 : histoName+="TIBBarrel_0";break;
case 5 : histoName+="TIDEndcap_1";break;
case 6 : histoName+="TIDEndcap_2";break;
case 7 : histoName+="TOBBarrel_3";break;
case 8 : histoName+="TECEndcap_4";break;
case 9 : histoName+="TECEndcap_5";break;
}
int tmpcounter = 0;
TH1 *sumHisto = 0;
for(std::vector<TkOfflineVariables*>::iterator it = sourceList.begin();
it != sourceList.end(); ++it) {
if (tmpcounter == 0 ) {
TFile *f= (*it)->getFile();
sumHisto =(TH1*) f->FindKeyAny(histoName)->ReadObj();//FindObjectAny(histoName.Data());
sumHisto->SetLineColor(tmpcounter+1);
sumHisto->SetLineStyle(tmpcounter+1);
sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw);
sumHisto->Draw();
//get statistic box coordinate to plot all boxes one below the other
//gStyle->SetStatY(0.91);
//gStyle->SetStatW(0.15);
//gStyle->SetStatBorderSize(1);
//gStyle->SetStatH(0.10);
tmpcounter++;
} else {
sumHisto = (TH1*) (*it)->getFile()->FindObjectAny(histoName);
sumHisto->SetLineColor(tmpcounter+1);
sumHisto->SetLineStyle(tmpcounter+1);
sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw);
//hstack->Add(sumHisto);
c->Update();
tmpcounter++;
}
TObject *statObj = sumHisto->GetListOfFunctions()->FindObject("stats");
if (statObj && statObj->InheritsFrom(TPaveStats::Class())) {
TPaveStats *stats = static_cast<TPaveStats*>(statObj);
stats->SetLineColor(tmpcounter+1);
stats->SetTextColor(tmpcounter+1);
stats->SetFillColor(10);
stats->SetX1NDC(0.91-tmpcounter*0.1);
stats->SetX2NDC(0.15);
stats->SetY1NDC(1);
stats->SetY2NDC(0.10);
sumHisto->Draw("sames");
}
}
//hstack->Draw("nostack");
char PlotName[1000];
sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data() );
c->Print(PlotName);
//delete c;
//c=0;
}
示例5: addHists
//.........这里部分代码省略.........
// TFile *f = (*sourceList.begin())->getFile();
TFile *f = (*itSourceFile)->getFile();
// TTree *tree= (*sourceList.begin())->getTree();
TTree *tree= (*itSourceFile)->getTree();
int myLineColor = (*itSourceFile)->getLineColor();
int myLineStyle = (*itSourceFile)->getLineStyle();
TString myLegendName = (*itSourceFile)->getName();
if (!f || !tree) {
std::cout << "PlotAlignmentValidation::addHists: no tree or no file" << std::endl;
return 0;
}
// Todo: TLegend?
// first loop on tree to find out which entries (i.e. modules) fulfill the selection
// 'Entry$' gives the entry number in the tree
Long64_t nSel = tree->Draw("Entry$", selection, "goff");
if (nSel == -1) return 0; // error in selection
if (nSel == 0) {
std::cout << "PlotAlignmentValidation::addHists: no selected module." << std::endl;
return 0;
}
// copy entry numbers that fulfil the selection
const std::vector<double> selected(tree->GetV1(), tree->GetV1() + nSel);
TH1 *h = 0; // becomes result
UInt_t nEmpty = 0;// selected, but empty hists
Long64_t nentries = tree->GetEntriesFast();
std::vector<double>::const_iterator iterEnt = selected.begin();
// second loop on tree:
// for each selected entry get the hist from the file and merge
TkOffTreeVariables *treeMem = 0; // ROOT will initialise
tree->SetBranchAddress("TkOffTreeVariables", &treeMem);
for (Long64_t i = 0; i < nentries; i++){
if (i < *iterEnt - 0.1 // smaller index (with tolerance): skip
|| iterEnt == selected.end()) { // at the end: skip
continue;
} else if (TMath::Abs(i - *iterEnt) < 0.11) {
++iterEnt; // take this entry!
} else std::cout << "Must not happen: " << i << " " << *iterEnt << std::endl;
tree->GetEntry(i);
if (printModuleIds) {
std::cout << treeMem->moduleId << ": " << treeMem->entries << " entries" << std::endl;
}
if (treeMem->entries <= 0) { // little speed up: skip empty hists
++nEmpty;
continue;
}
TString hName;
switch(rType) {
case xPrimeRes: hName = treeMem->histNameX.c_str(); break;
case yPrimeRes: hName = treeMem->histNameY.c_str(); break;
case xPrimeNormRes: hName = treeMem->histNameNormX.c_str(); break;
case yPrimeNormRes: hName = treeMem->histNameNormY.c_str(); break;
case xRes: hName = treeMem->histNameLocalX.c_str(); break;
case yRes: hName = treeMem->histNameLocalY.c_str(); break;
case xNormRes: hName = treeMem->histNameNormLocalX.c_str(); break;
/*case yResNorm: hName = treeMem->histNameNormLocalY.c_str(); break;*/
case ResXvsXProfile: hName = treeMem->profileNameResXvsX.c_str(); break;
case ResXvsYProfile: hName = treeMem->profileNameResXvsY.c_str(); break;
case ResYvsXProfile: hName = treeMem->profileNameResYvsX.c_str(); break;
case ResYvsYProfile: hName = treeMem->profileNameResYvsY.c_str(); break;
}
TKey *histKey = f->FindKeyAny(hName);
TH1 *newHist = (histKey ? static_cast<TH1*>(histKey->ReadObj()) : 0);
if (!newHist) {
std::cout << "Hist " << hName << " not found in file, break loop." << std::endl;
break;
}
newHist->SetLineColor(myLineColor);
newHist->SetLineStyle(myLineStyle);
if (!h) { // first hist: clone, but rename keeping only first part of name
TString name(newHist->GetName());
Ssiz_t pos_ = 0;
for (UInt_t i2 = 0; i2 < 3; ++i2) pos_ = name.Index("_", pos_+1);
name = name(0, pos_); // only up to three '_'
h = static_cast<TH1*>(newHist->Clone("summed_"+name));
// TString myTitle = Form("%s: %lld modules", selection, nSel);
// h->SetTitle( myTitle );
} else { // otherwise just add
h->Add(newHist);
}
delete newHist;
}
std::cout << "PlotAlignmentValidation::addHists" << "Result is merged from " << nSel-nEmpty
<< " modules, " << nEmpty << " hists were empty." << std::endl;
if (nSel-nEmpty == 0) continue;
myLegend->AddEntry(myLegendName, myLegendName, "L");
retHistoStack->Add(h);
}
myLegend->Draw();
return retHistoStack;
}
示例6: GetHistoClSize
//------------------------------------------
TH1* GetHistoClSize(int npix,int id,TObjArray* harr)
{
// book histos
TH1* h = 0;
if (!harr) harr = &histoArr;
//
if (npix<1) {
if (harr->GetEntriesFast()>=id && (h=(TH1*)harr->At(id))) return h;
h = new TH1F("npixAll","npixAll",150,0.5,54.5);
h->SetDirectory(0);
h->SetLineColor(kRed);
harr->AddAtAndExpand(h, kNPixAll);
//
h = new TH1F("npixSpl","npixSpl",150,0.5,54.5);
h->SetLineColor(kBlue);
h->SetDirectory(0);
harr->AddAtAndExpand(h, kNPixSPL);
//
h = (TH1*)harr->At(id);
if (!h) {printf("Unknown histo id=%d\n",id); exit(1);}
return h;
}
//
int idh = npix*10+id;
if (harr->GetEntriesFast()>=idh && (h=(TH1*)harr->At(idh))) return h;
//
const int nbin=100;
const double kdiff=80;
// need to create set of histos
//
h = new TH1F(Form("dxy_npix%d",npix),Form("dr_npix%d",npix),nbin,-kdiff,kdiff);
h->SetDirectory(0);
harr->AddAtAndExpand(h, npix*10 + kDR);
//
h = new TH1F(Form("dtxODD_npix%d",npix),Form("dtxODD_npix%d",npix),nbin,-kdiff,kdiff);
h->SetDirectory(0);
h->SetLineColor(kRed);
harr->AddAtAndExpand(h, npix*10 + kDTXodd);
h = new TH1F(Form("dtxEVN_npix%d",npix),Form("dtxEVN_npix%d",npix),nbin,-kdiff,kdiff);
h->SetDirectory(0);
h->SetLineColor(kBlue);
harr->AddAtAndExpand(h, npix*10 + kDTXeven);
//
h = new TH1F(Form("dtz_npix%d",npix),Form("dtz_npix%d",npix),nbin,-kdiff,kdiff);
h->SetLineColor(kGreen);
h->SetDirectory(0);
harr->AddAtAndExpand(h, npix*10 + kDTZ);
//
//
h = new TH1F(Form("SPL_dtxODD_npix%d",npix),Form("SPL_dtxODD_npix%d",npix),nbin,-kdiff,kdiff);
h->SetLineColor(kMagenta);
h->SetFillColor(kMagenta);
h->SetFillStyle(3001);
h->SetLineStyle(2);
h->SetDirectory(0);
harr->AddAtAndExpand(h, npix*10 + kDTXoddSPL);
h = new TH1F(Form("SPL_dtxEVN_npix%d",npix),Form("SPL_dtxEVN_npix%d",npix),nbin,-kdiff,kdiff);
h->SetLineColor(kCyan);
h->SetFillColor(kCyan);
h->SetFillStyle(3006);
h->SetLineStyle(2);
h->SetDirectory(0);
harr->AddAtAndExpand(h, npix*10 + kDTXevenSPL);
//
h = new TH1F(Form("SPL_dtz_npix%d",npix),Form("SPLdtz_npix%d",npix),nbin,-kdiff,kdiff);
harr->AddAtAndExpand(h, npix*10 + kDTZSPL);
h->SetDirectory(0);
//
h->SetLineColor(kGreen+2);
h->SetFillColor(kGreen+2);
h->SetLineStyle(2);
h->SetFillStyle(3001);
h = (TH1*)harr->At(idh);
if (!h) {printf("Unknown histo id=%d\n",idh); exit(1);}
return h;
}
示例7: makePlot
void makePlot(const std::string& inputFilePath, const std::string& canvasName, const std::string& histogram, const std::string& channel, const std::string& xAxisTitle, const std::string& yAxisTitle,
const std::string& inputFileName, const std::string& outputFilePath, const std::string& outputFileName)
{
std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
TFile* inputFile = new TFile(inputFileName_full.data());
if ( !inputFile ) {
std::cerr << "Failed to open input file = " << inputFileName_full << " !!" << std::endl;
assert(0);
}
inputFile->ls();
TCanvas* canvas = dynamic_cast<TCanvas*>(inputFile->Get(canvasName.data()));
if ( !canvas ) {
std::cerr << "Failed to load canvas = " << canvasName << " !!" << std::endl;
assert(0);
}
int idxPad = -1;
if ( histogram == "mVis" ) idxPad = 1;
if ( histogram == "mTauTau" ) idxPad = 2;
if ( !(idxPad >= 1 && idxPad <= 2) ) {
std::cerr << "Invalid histogram = " << histogram << " !!" << std::endl;
assert(0);
}
TVirtualPad* pad = canvas->GetPad(idxPad);
std::cout << "pad = " << pad << ": ClassName = " << pad->ClassName() << std::endl;
TCanvas* canvas_new = new TCanvas("canvas_new", "canvas_new", 900, 850);
canvas_new->SetFillColor(10);
canvas_new->SetBorderSize(2);
canvas_new->SetTopMargin(0.065);
canvas_new->SetLeftMargin(0.17);
canvas_new->SetBottomMargin(0.155);
canvas_new->SetRightMargin(0.045);
canvas_new->SetLogx(false);
canvas_new->SetLogy(false);
canvas_new->Draw();
canvas_new->cd();
//TList* pad_primitives = canvas->GetListOfPrimitives();
TList* pad_primitives = pad->GetListOfPrimitives();
TH1* histogramDYJets = 0;
TH1* histogramHiggs125 = 0;
TH1* histogramHiggs200 = 0;
TH1* histogramHiggs300 = 0;
TIter pad_nextObj(pad_primitives);
while ( TObject* obj = pad_nextObj() ) {
std::string objName = "";
if ( dynamic_cast<TNamed*>(obj) ) objName = (dynamic_cast<TNamed*>(obj))->GetName();
std::cout << "obj = " << obj << ": name = " << objName << ", type = " << obj->ClassName() << std::endl;
TH1* tmpHistogram = dynamic_cast<TH1*>(obj);
if ( tmpHistogram ) {
std::cout << "tmpHistogram:"
<< " fillColor = " << tmpHistogram->GetFillColor() << ", fillStyle = " << tmpHistogram->GetFillStyle() << ","
<< " lineColor = " << tmpHistogram->GetLineColor() << ", lineStyle = " << tmpHistogram->GetLineStyle() << ", lineWidth = " << tmpHistogram->GetLineWidth() << ","
<< " markerColor = " << tmpHistogram->GetMarkerColor() << ", markerStyle = " << tmpHistogram->GetMarkerStyle() << ", markerSize = " << tmpHistogram->GetMarkerSize() << ","
<< " integral = " << tmpHistogram->Integral() << std::endl;
if ( tmpHistogram->GetFillColor() == 0 ) histogramDYJets = tmpHistogram;
if ( tmpHistogram->GetFillColor() == 632 ) histogramHiggs125 = tmpHistogram;
if ( tmpHistogram->GetFillColor() == 616 ) histogramHiggs200 = tmpHistogram;
if ( tmpHistogram->GetFillColor() == 600 ) histogramHiggs300 = tmpHistogram;
}
}
if ( !(histogramDYJets && histogramHiggs125 && histogramHiggs200 && histogramHiggs300) ) {
std::cerr << "Failed to load histograms !!" << std::endl;
assert(0);
}
int lineColors[4] = { 1, 2, 6, 4 };
int lineStyles[4] = { 1, 1, 1, 1 };
int lineWidths[4] = { 2, 2, 2, 2 };
int fillColors[4] = { 10, 2, 6, 4 };
int fillStyles[4] = { 0, 3002, 3004, 3005 };
histogramDYJets->SetFillColor(fillColors[0]);
histogramDYJets->SetFillStyle(fillStyles[0]);
histogramDYJets->SetLineColor(lineColors[0]);
histogramDYJets->SetLineStyle(lineStyles[0]);
histogramDYJets->SetLineWidth(lineWidths[0]);
histogramHiggs125->SetFillColor(fillColors[1]);
histogramHiggs125->SetFillStyle(fillStyles[1]);
histogramHiggs125->SetLineColor(lineColors[1]);
histogramHiggs125->SetLineStyle(lineStyles[1]);
histogramHiggs125->SetLineWidth(lineWidths[1]);
histogramHiggs200->SetFillColor(fillColors[2]);
histogramHiggs200->SetFillStyle(fillStyles[2]);
histogramHiggs200->SetLineColor(lineColors[2]);
histogramHiggs200->SetLineStyle(lineStyles[2]);
histogramHiggs200->SetLineWidth(lineWidths[2]);
histogramHiggs300->SetFillColor(fillColors[3]);
histogramHiggs300->SetFillStyle(fillStyles[3]);
histogramHiggs300->SetLineColor(lineColors[3]);
//.........这里部分代码省略.........
示例8: trigeff
void trigeff(){
gROOT->Reset();
//=========Macro generated from canvas: cEvtSel/EvtSel
//========= (Wed Apr 14 17:19:34 2010) by ROOT version5.22/00d
TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",550,600);
/*
TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",0,22,550,600);
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
cEvtSel->Range(-13.62658,-0.215625,63.58861,1.221875);
cEvtSel->SetFillColor(0);
cEvtSel->SetBorderMode(0);
cEvtSel->SetBorderSize(0);
cEvtSel->SetTickx(1);
cEvtSel->SetTicky(1);
cEvtSel->SetLeftMargin(0.17);
cEvtSel->SetRightMargin(0.04);
cEvtSel->SetTopMargin(0.05);
cEvtSel->SetBottomMargin(0.15);
cEvtSel->SetFrameLineColor(0);
cEvtSel->SetFrameBorderMode(0);
cEvtSel->SetFrameLineColor(0);
cEvtSel->SetFrameBorderMode(0);
*/
TH1 *hFrame1 = new TH2D("hFrame1","",1,-0.5,60.5,1,0,1.15);
hFrame1->SetDirectory(0);
hFrame1->SetStats(0);
hFrame1->GetXaxis()->SetTitle("Charged-particle multiplicity");
hFrame1->GetXaxis()->CenterTitle(true);
hFrame1->GetYaxis()->SetTitle("Selection efficiency");
hFrame1->GetYaxis()->CenterTitle(true);
hFrame1->Draw("");
hFrame1->GetXaxis()->SetNdivisions(312);
/*
TH1 *hFrame1 = new TH2D("hFrame1","",1,-0.5,60.5,1,0,1.15);
hFrame1->SetDirectory(0);
hFrame1->SetStats(0);
hFrame1->SetFillColor(1);
hFrame1->SetFillStyle(0);
hFrame1->SetLineStyle(0);
hFrame1->SetMarkerStyle(20);
hFrame1->SetMarkerSize(1.5);
hFrame1->GetXaxis()->SetTitle("Charged-particle multiplicity");
hFrame1->GetXaxis()->CenterTitle(true);
hFrame1->GetXaxis()->SetNdivisions(312);
hFrame1->GetXaxis()->SetLabelFont(42);
hFrame1->GetXaxis()->SetLabelOffset(0.01);
hFrame1->GetXaxis()->SetLabelSize(0.045);
hFrame1->GetXaxis()->SetTitleSize(0.055);
hFrame1->GetXaxis()->SetTitleFont(42);
hFrame1->GetYaxis()->SetTitle("Selection efficiency");
hFrame1->GetYaxis()->CenterTitle(true);
hFrame1->GetYaxis()->SetLabelFont(42);
hFrame1->GetYaxis()->SetLabelOffset(0.01);
hFrame1->GetYaxis()->SetLabelSize(0.045);
hFrame1->GetYaxis()->SetTitleSize(0.055);
hFrame1->GetYaxis()->SetTitleOffset(1.6);
hFrame1->GetYaxis()->SetTitleFont(42);
hFrame1->GetZaxis()->SetLabelFont(42);
hFrame1->GetZaxis()->SetLabelSize(0.045);
hFrame1->GetZaxis()->SetTitleFont(42);
hFrame1->Draw("");
*/
TH1 *trigeff = new TH1D("trigeff","trigeff",200,0,200);
trigeff->SetBinContent(1,0.007879584);
trigeff->SetBinContent(2,0.3524112);
trigeff->SetBinContent(3,0.5050529);
trigeff->SetBinContent(4,0.5978595);
trigeff->SetBinContent(5,0.6587795);
trigeff->SetBinContent(6,0.7034895);
trigeff->SetBinContent(7,0.7451056);
trigeff->SetBinContent(8,0.7911818);
trigeff->SetBinContent(9,0.8363224);
trigeff->SetBinContent(10,0.873251);
trigeff->SetBinContent(11,0.9012649);
trigeff->SetBinContent(12,0.9177872);
trigeff->SetBinContent(13,0.9395182);
trigeff->SetBinContent(14,0.9502278);
trigeff->SetBinContent(15,0.9600504);
trigeff->SetBinContent(16,0.9667429);
trigeff->SetBinContent(17,0.9722969);
trigeff->SetBinContent(18,0.977478);
trigeff->SetBinContent(19,0.9801504);
trigeff->SetBinContent(20,0.9840849);
trigeff->SetBinContent(21,0.9843521);
trigeff->SetBinContent(22,0.9856779);
trigeff->SetBinContent(23,0.9894354);
trigeff->SetBinContent(24,0.9892805);
trigeff->SetBinContent(25,0.9913111);
trigeff->SetBinContent(26,0.9934833);
trigeff->SetBinContent(27,0.9907814);
trigeff->SetBinContent(28,0.9928126);
trigeff->SetBinContent(29,0.990099);
//.........这里部分代码省略.........
示例9: diffrac
void diffrac(){
gROOT->Reset();
//gROOT->ProcessLine(".x rootlogon.C");
//=========Macro generated from canvas: cEvtSel/EvtSel
//========= (Wed Apr 14 17:19:02 2010) by ROOT version5.22/00d
TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",550,600);
/*
TCanvas *cEvtSel = new TCanvas("cEvtSel", "EvtSel",0,22,550,600);
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
cEvtSel->Range(-32.99367,-0.009375,158.1456,0.053125);
cEvtSel->SetFillColor(0);
cEvtSel->SetBorderMode(0);
cEvtSel->SetBorderSize(0);
cEvtSel->SetTickx(1);
cEvtSel->SetTicky(1);
cEvtSel->SetLeftMargin(0.17);
cEvtSel->SetRightMargin(0.04);
cEvtSel->SetTopMargin(0.05);
cEvtSel->SetBottomMargin(0.15);
cEvtSel->SetFrameLineColor(0);
cEvtSel->SetFrameBorderMode(0);
cEvtSel->SetFrameLineColor(0);
cEvtSel->SetFrameBorderMode(0);
*/
//TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,60.5,1,0,0.06);
TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,150.5,1,0,0.05);
hFrame2->SetDirectory(0);
hFrame2->SetStats(0);
hFrame2->GetXaxis()->SetTitle("Charged-particle multiplicity");
hFrame2->GetXaxis()->CenterTitle(true);
hFrame2->GetYaxis()->SetTitle("Fraction of events");
hFrame2->GetYaxis()->CenterTitle(true);
hFrame2->GetYaxis()->SetTitleOffset(1.5);
hFrame2->Draw("");
hFrame2->GetXaxis()->SetNdivisions(312);
hFrame2->GetYaxis()->SetNdivisions(305);
/*
TH1 *hFrame2 = new TH2D("hFrame2","",1,-0.5,150.5,1,0,0.05);
hFrame2->SetDirectory(0);
hFrame2->SetStats(0);
hFrame2->SetFillColor(1);
hFrame2->SetFillStyle(0);
hFrame2->SetLineStyle(0);
hFrame2->SetMarkerStyle(20);
hFrame2->SetMarkerSize(1.5);
hFrame2->GetXaxis()->SetTitle("Charged-particle multiplicity");
hFrame2->GetXaxis()->CenterTitle(true);
hFrame2->GetXaxis()->SetNdivisions(312);
hFrame2->GetXaxis()->SetLabelFont(42);
hFrame2->GetXaxis()->SetLabelOffset(0.01);
hFrame2->GetXaxis()->SetLabelSize(0.045);
hFrame2->GetXaxis()->SetTitleSize(0.055);
hFrame2->GetXaxis()->SetTitleFont(42);
hFrame2->GetYaxis()->SetTitle("Fraction of events");
hFrame2->GetYaxis()->CenterTitle(true);
hFrame2->GetYaxis()->SetLabelFont(42);
hFrame2->GetYaxis()->SetLabelOffset(0.01);
hFrame2->GetYaxis()->SetLabelSize(0.045);
hFrame2->GetYaxis()->SetTitleSize(0.055);
hFrame2->GetYaxis()->SetTitleOffset(1.5);
hFrame2->GetYaxis()->SetTitleFont(42);
hFrame2->GetZaxis()->SetLabelFont(42);
hFrame2->GetZaxis()->SetLabelSize(0.045);
hFrame2->GetZaxis()->SetTitleFont(42);
hFrame2->Draw("");
*/
TH1 *diffrac = new TH1D("diffrac","diffrac",200,0,200);
diffrac->SetBinContent(1,0.0004697663);
diffrac->SetBinContent(2,0.008010118);
diffrac->SetBinContent(3,0.0127921);
diffrac->SetBinContent(4,0.01698988);
diffrac->SetBinContent(5,0.02012166);
diffrac->SetBinContent(6,0.022341);
diffrac->SetBinContent(7,0.02315105);
diffrac->SetBinContent(8,0.02518068);
diffrac->SetBinContent(9,0.02668032);
diffrac->SetBinContent(10,0.02875512);
diffrac->SetBinContent(11,0.03089617);
diffrac->SetBinContent(12,0.0324741);
diffrac->SetBinContent(13,0.03311853);
diffrac->SetBinContent(14,0.03265478);
diffrac->SetBinContent(15,0.03213081);
diffrac->SetBinContent(16,0.03054987);
diffrac->SetBinContent(17,0.0283245);
diffrac->SetBinContent(18,0.02640026);
diffrac->SetBinContent(19,0.02394001);
diffrac->SetBinContent(20,0.02234401);
diffrac->SetBinContent(21,0.02026921);
diffrac->SetBinContent(22,0.01865213);
diffrac->SetBinContent(23,0.01720369);
diffrac->SetBinContent(24,0.01639665);
diffrac->SetBinContent(25,0.01546013);
//.........这里部分代码省略.........
示例10: plot
//.........这里部分代码省略.........
TH1* ewktau = (TH1*)f->Get("EWK_Tau");
ci = TColor::GetColor("#993399");
ewktau->SetFillColor(ci);
ewktau->SetLineWidth(0);
TH1* ewkDY = (TH1*)f->Get("EWK_DYx");
TH1* ewkVV = (TH1*)f->Get("EWK_VVx");
ewktau->Add(ewkDY);
ewktau->Add(ewkVV);
//TH1* qcd = (TH1*)f->Get("QCDInv");
TH1* qcd = (TH1*)f->Get("QCD");
ci = TColor::GetColor("#ffcc33");
qcd->SetFillColor(ci);
qcd->SetLineWidth(0);
TH1* fakett = (TH1*)f->Get("fake_tt");
ci = TColor::GetColor("#669900");
fakett->SetFillColor(ci);
fakett->SetLineWidth(0);
TH1* fakeW = (TH1*)f->Get("fake_W");
ci = TColor::GetColor("#cc3300");
fakeW->SetFillColor(ci);
fakeW->SetLineWidth(0);
TH1* faket = (TH1*)f->Get("fake_t");
TH1F *hFrame = new TH1F("hFrame","",20,0,400);
hFrame->SetMinimum(ymin);
if (log)
hFrame->SetMaximum(ymax*1.5);
else
hFrame->SetMaximum(ymax);
hFrame->SetDirectory(0);
hFrame->SetStats(0);
hFrame->SetLineStyle(0);
hFrame->SetMarkerStyle(20);
hFrame->SetXTitle("Transverse mass (#tau jet, E_{T}^{miss}), (GeV/c^{2})");
if (paperStatus)
hFrame->SetXTitle("Transverse mass (#tau_{h}, E_{T}^{miss}), (GeV/c^{2})");
hFrame->SetYTitle("Events / 20 GeV/c^{2}");
hFrame->GetXaxis()->SetTitleSize(0);
hFrame->GetXaxis()->SetLabelSize(0);
hFrame->GetYaxis()->SetTitleFont(43);
hFrame->GetYaxis()->SetTitleSize(27);
hFrame->GetYaxis()->SetTitleOffset(1.3);
// signal
hh->Scale(br*br);
hw->Scale(2*br*(1.0-br));
TH1* signal = (TH1*)hh->Clone();
signal->Add(hw);
ci = TColor::GetColor("#ff3399");
signal->SetLineColor(ci);
signal->SetLineStyle(2);
signal->SetLineWidth(2);
// Fakes
TH1* fakes = (TH1*)(fakett->Clone());
fakes->Add(fakeW);
fakes->Add(faket);
// stacked backgrounds
THStack *exp = new THStack();
exp->SetName("exp");
exp->SetTitle("exp");