本文整理汇总了C++中TH1I::SetLineColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1I::SetLineColor方法的具体用法?C++ TH1I::SetLineColor怎么用?C++ TH1I::SetLineColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1I
的用法示例。
在下文中一共展示了TH1I::SetLineColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strcpy
plotClasses(const char* canvas, const char* title,
int nClasses, const char classes[][200],
const int* events, const double* weights)
{
char evtitle[200], wttitle[200];
strcpy(evtitle,title);
strcpy(wttitle,title);
strcat(evtitle,": Events");
strcat(wttitle,": Weights");
TCanvas *c
= new TCanvas(canvas,"SPR Input Classes",200,10,600,400);
gStyle->SetPalette(1);
int maxEv = TMath::MaxElement(nClasses,events);
double maxWt = TMath::MaxElement(nClasses,weights);
TPad* pad1 = new TPad("events", evtitle,0,0,1.,0.5);
TPad* pad2 = new TPad("weights",wttitle,0,0.5,1.,1.);
pad1->Draw();
pad2->Draw();
// events
pad1->cd();
TH1I* hev = new TH1I("events",evtitle,nClasses,0,nClasses);
for( int i=0;i<nClasses;i++ )
hev->Fill(classes[i],events[i]);
hev->LabelsDeflate("X");
hev->SetLabelSize(0.06,"X");
hev->SetLabelSize(0.1,"X");
hev->SetLabelSize(0.1,"Y");
hev->SetLineColor(4);
hev->SetFillColor(4);
hev->SetBarWidth(0.8);
hev->SetBarOffset(0.1);
TAxis* yaxis1 = hev->GetYaxis();
yaxis1->SetRangeUser(0.,1.1*maxEv);
hev->Draw("B");
// weights
pad2->cd();
TH1D* hwt = new TH1D("weights",wttitle,nClasses,0,nClasses);
for( int i=0;i<nClasses;i++ )
hwt->Fill(classes[i],weights[i]);
hwt->LabelsDeflate("X");
hwt->SetLabelSize(0.06,"X");
hwt->SetLabelSize(0.1,"X");
hwt->SetLabelSize(0.1,"Y");
hwt->SetLineColor(3);
hwt->SetFillColor(3);
hwt->SetBarWidth(0.8);
hwt->SetBarOffset(0.1);
TAxis* yaxis2 = hwt->GetYaxis();
yaxis2->SetRangeUser(0.,1.1*maxWt);
hwt->Draw("B");
}
示例2: Loop
//.........这里部分代码省略.........
//test2->Draw();
TH1F *FileRuns = new TH1F("FileRuns","Run from Lumicalc", maxRun-minRun+2, minRun-1, maxRun+1);
TH1D *XsecDistro = new TH1D("XsecDistro","X sec distribution", 60, 0., 0.6);
//-------------
const Int_t mpt = maxRun-minRun;
int fileRun[mpt];
double Lumi[mpt];
int npt = 0;
// read data file
ifstream file;
//file.open("./2011-run-lumi.txt");
file.open("./LumiAeB-dav.txt");
while (1) {
file >> fileRun[npt] >> Lumi[npt];
if ( ! file.good() ) break;
cout << "x = " << fileRun[npt] << " y = " << Lumi[npt] << endl;
FileRuns->SetBinContent((fileRun[npt]-minRun+2),0.2);
npt++;
}
file.close();
printf("found %d Runs in file \n", npt);
bool flaggg=1;
TH1D *LumiRuns = new TH1D("LumiRuns","Zyield vs Run", maxRun-minRun+2, minRun-1, maxRun+1);
LumiRuns->Sumw2();
for(int i=0; i<npt;i++){
for(int j=0;j<maxRun;j++){
if(fileRun[i]==(minRun+j)){
cout << fileRun[i]-minRun+1 <<" "<< ((float)Runs->GetBinContent(j+1))/Lumi[i] <<" "<< Lumi[i] << " matched run \n";
if(Lumi[i]>0.&&Runs->GetBinContent(j+2)>0.){
LumiRuns->SetBinContent(fileRun[i]-minRun+2,(((double)Runs->GetBinContent(j+2))/Lumi[i])*1000);
LumiRuns->SetBinError(fileRun[i]-minRun+2,((TMath::Sqrt((double)Runs->GetBinContent(j+2)))/Lumi[i])*1000);
XsecDistro->Fill((((double)Runs->GetBinContent(j+2))/Lumi[i])*1000);
flaggg=false;
}
}
else if(fileRun[i]==(minRun+j) && (Runs->GetBinContent(j+2+1)>0. || Runs->GetBinContent(j+2-1)>0.)) cout << "Son cazzi " << fileRun[i]<<"\n";
}
if(flaggg) {
//cout << " ---------------- \n";
cout << fileRun[i] << " Run not matched! \n";
//cout << Runs->GetBinContent(i) <<" " << Runs->GetBinContent(i+1) <<" " << Runs->GetBinContent(i+2) <<" "<< Lumi[i] << " probably not empty \n";
//if(Lumi[i]>1.e+06) cout << "ALERT THIS ONE IS GOOD \n";
}
flaggg=true;
}
TCanvas * Canv = (TCanvas*)gDirectory->GetList()->FindObject("Canv");
if (Canv) delete Canv;
Canv = new TCanvas("Canv","Canv",0,0,800,600);
Canv->cd();
LumiRuns->SetXTitle("Run");
LumiRuns->SetYTitle("#sigma (nb)");
LumiRuns->SetLineColor(kBlack);
LumiRuns->Draw("E1");
Runs->SetLineColor(kRed);
//Runs->Draw("SAMES");
FileRuns->SetLineColor(kBlue);
//FileRuns->Draw("SAMES");
//LumiRuns->Draw("E1 SAMES");
Canv->Print("ratio_zlumi.eps");
TCanvas * Another = (TCanvas*)gDirectory->GetList()->FindObject("Another");
if (Another) delete Another;
Another = new TCanvas("Another","Another",0,0,800,600);
Another->cd();
XsecDistro->SetXTitle("#sigma (nb)");
XsecDistro->SetLineColor(kBlack);
XsecDistro->Draw();
Another->Print("distrib_zsigma.eps");
/*
//-------------
// per il momento tengo le due sezioni separate... solo per debuggare meglio...
//-------------
const Int_t rpt = 120000;
int lsRun[rpt];
float LuSec[rpt];
npt = 0;
// read data file
ifstream in;
in.open("./2011-LS.txt");
while (1) {
in >> lsRun[npt] >> LuSec[npt];
if ( ! in.good() ) break;
//cout << "x = " << fileRun[npt] << " y = " << Lumi[npt] << endl;
npt++;
}
in.close();
printf("found %d LS\n", npt);
*/
}