本文整理汇总了C++中TLine类的典型用法代码示例。如果您正苦于以下问题:C++ TLine类的具体用法?C++ TLine怎么用?C++ TLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makePlots_hlt_eventbyevent_comparison
//.........这里部分代码省略.........
myRatio->GetXaxis()->SetTitle(h_hlt_diff->GetXaxis()->GetTitle()); //make y label bigger
myRatio->GetXaxis()->SetLabelSize(0.12);
myRatio->GetXaxis()->SetLabelOffset(0.04);
myRatio->GetXaxis()->SetTitleSize(0.12);
// myRatio->GetYaxis()->SetTitle("Data/MC");
myRatio->GetYaxis()->SetTitle("New - Old / Old");
myRatio->GetYaxis()->SetTitleSize(0.1);
myRatio->GetYaxis()->SetTitleOffset(.45);
myC->cd(2);
gPad->SetTopMargin(small);
gPad->SetTickx();
gPad->Modified();
myC->cd(1);
h_hlt_ref->GetYaxis()->SetTitle("Number of Events");
h_hlt_ref->GetYaxis()->SetTitleSize(0.05);
h_hlt_ref->GetYaxis()->SetTitleOffset(.95);
h_hlt_ref->Draw();
h_hlt_tgt->Draw("same");
legend->Draw();
double xmin = h_hlt_ref->GetBinLowEdge(1);
double xmax = h_hlt_ref->GetBinLowEdge(h_hlt_ref->GetNbinsX()) + h_hlt_ref->GetBinWidth(h_hlt_ref->GetNbinsX());
myC->cd(2);
myRatio->SetLineWidth(2);
myRatio->Draw("hist");
TLine* myLine;
myLine = new TLine(xmin, 0, xmax, 0);
myLine->Draw();
std::string outputFile = dirprefix + "/hlt_path_comparison" + outputSuffix_ + ".pdf";
myC->Print(outputFile.c_str());
delete legend;
delete myC;
delete myLine;
}
if( true ){
int numCommonPaths = int(hlt_common_paths.size());
for( int iPath=0; iPath<numCommonPaths; iPath++ ){
std::cout << " ====================== " << std::endl;
std::string name = hlt_common_paths[iPath];
std::string pathName_ref = "eventbyevent/h_path_ref_" + name;
std::string pathName_tgt = "eventbyevent/h_path_tgt_" + name;
std::string diffname = "h_path_diff_" + name;
//std::cout << " path is " << pathName_ref << std::endl;
if( name=="HLT_LogMonitor" ) continue;
TH1D* h_hlt_filt_ref = (TH1D*)file->Get(pathName_ref.c_str());
TH1D* h_hlt_filt_tgt = (TH1D*)file->Get(pathName_tgt.c_str());
TH1D* h_hlt_filt_diff = (TH1D*)h_hlt_filt_ref->Clone(diffname.c_str());
bool printOut = true;
示例2: QA_Draw_Jet_Summary
void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower",
const char *qa_file_name_new =
"data/G4sPHENIXCells_2000jets25GeV.root_qa.root",
const char *qa_file_name_ref =
"data/G4sPHENIXCells_250jets25GeV.root_qa.root")
{
//! drawing energy range
const double min_Et = 10;
const double max_Et = 80;
SetsPhenixStyle();
TVirtualFitter::SetDefaultFitter("Minuit2");
// file IO
TFile *qa_file_new = new TFile(qa_file_name_new);
assert(qa_file_new->IsOpen());
// buffer for results
vector<float> vec_radius;
vector<TGraphErrors *> vec_phi_res;
vector<TGraphErrors *> vec_eta_res;
vector<TGraphErrors *> vec_e_res;
vector<TGraphErrors *> vec_et_res;
vector<TGraphErrors *> vec_reco_eff;
vector<TGraphErrors *> vec_purity;
// list and process all jets
TList *hist_key_list = qa_file_new->GetListOfKeys();
for (int i = 0; i < hist_key_list->GetSize(); ++i)
{
TString key_name = hist_key_list->At(i)->GetName();
TString s_re_fullname = Form(
"h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et",
jet_family); // regular expression for search
TRegexp re_fullname(s_re_fullname, false);
if (key_name.Index(re_fullname) == kNPOS)
continue;
// cout << " key_name = " << key_name << endl;
TString jet_pair_name = key_name(0,
key_name.Length() - TString("_Matching_Count_Truth_Et").Length()); // remove suffix
// cout << " jet_pair_name = " << jet_pair_name << endl;
//get jet radius
TRegexp re_jetradius("_r[0-9]*", false);
Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius
index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius
assert(index_radius != kNPOS);
float radius = 0;
sscanf(key_name(index_radius, 100).Data(), "_r%f", &radius);
// cout << " index_radius = " << index_radius << endl;
assert(radius != 0);
radius /= 10; // jet radius convention in DST names
cout << "QA_Draw_Jet_Summary - process jet pair " << jet_pair_name
<< " with radius = " << radius << endl;
vector<TGraphErrors *> resolution_efficiency_summary(
QA_Draw_Jet_TruthMatching(jet_pair_name, qa_file_name_new,
qa_file_name_ref));
//save results
vec_radius.push_back(radius);
vec_phi_res.push_back(resolution_efficiency_summary[0]);
vec_eta_res.push_back(resolution_efficiency_summary[1]);
vec_e_res.push_back(resolution_efficiency_summary[2]);
vec_et_res.push_back(resolution_efficiency_summary[3]);
vec_reco_eff.push_back(resolution_efficiency_summary[4]);
vec_purity.push_back(resolution_efficiency_summary[5]);
// break;
}
// plot
TCanvas *c1 = new TCanvas(
TString("QA_Draw_Jet_Summary_") + TString(jet_family),
TString("QA_Draw_Jet_Summary_") + TString(jet_family), 1800, 900);
c1->Divide(3, 2);
int idx = 1;
TPad *p;
// ------------------------------------
p = (TPad *) c1->cd(idx++);
c1->Update();
// p->SetLogz();
TH1 *h_frame =
p->DrawFrame(min_Et, -.1, max_Et, .1,
TString(jet_family) + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)");
// h_frame->GetYaxis()->SetTitleOffset(1.01);
TLine *l = new TLine(min_Et, 0, max_Et, 0);
l->Draw();
p->SetGridx(0);
p->SetGridy(0);
TLegend *legend = new TLegend(0.7, 0.2, .95, 0.5);
legend->SetFillColor(kWhite);
legend->SetFillStyle(1001);
legend->SetLineWidth(2);
//.........这里部分代码省略.........
示例3: Draweff
//.........这里部分代码省略.........
histo_obs_norm->Scale(1/histo_obs->Integral(xbinmin,xbinmax));
TF1 *NBD_fun = new
TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
NBD_fun->SetParameter(0,1); //[0]: Normalized constant
NBD_fun->SetParameter(1,(*kbest)[0]); //[1]: k value
NBD_fun->SetParameter(2,(*mubest)[0]); //[2]: mu value
TTree *t = (TTree*) fGlauber->Get("nt_p_Pb");
Long_t Nevent;
Nevent = (Long_t) t->GetEntries();
Long_t Ev; Int_t Bino; Double_t Para, Bi_Para, Mult;
Float_t Ncoll;
t->SetBranchAddress("Ncoll",&Ncoll);
for(Ev=0; Ev<Nevent; Ev++){
if(Ev%100000==0) cout<<"Have run "<<Ev<<" events"<<endl;
t->GetEntry(Ev);
Para = 0; //make sure that Para doesn't accumulate through loops
for(Bino=0; Bino<Ncoll; Bino++){
Bi_Para = NBD_fun->GetRandom();
Para += Bi_Para;
}
histo_exp->Fill(Para);
}
Double_t SumEvent, scale;
SumEvent = histo_exp->Integral(xbinmin,xbinmax);
scale = 1/SumEvent;
TH1D *histo_exp_norm = (TH1D*) histo_exp->Clone();
histo_exp_norm->Scale(scale);
TCanvas *c1 = new TCanvas();
gStyle->SetOptStat(kFALSE);
double hfbin[]={0,1,2,3,4,6,8,10,13,16,20,25,30,40,55,70,90};
int nhfbin = 16;
rehisto_obs_norm = (TH1D*)histo_obs_norm->Rebin(nhfbin,"rehisto_obs_norm",hfbin);
normalizeByBinWidth(rehisto_obs_norm);
rehisto_exp_norm = (TH1D*)histo_exp_norm->Rebin(nhfbin,"rehisto_exp_norm",hfbin);
normalizeByBinWidth(rehisto_exp_norm);
TH1D* ratio = (TH1D*)rehisto_obs_norm->Clone("ratio");
ratio->Divide(rehisto_exp_norm);
ratio->SetMaximum(1.2);
ratio->SetMinimum(0);
ratio->GetXaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4");
ratio->GetYaxis()->SetTitle("ratio");
TFile *fDSeff = TFile::Open("/afs/cern.ch/work/q/qixu/private/RpA/GlobalEvent/CentrDep/pPbHijing_EffCorr_forNBD.root");
TFile *ftreff = TFile::Open("/afs/cern.ch/user/q/qixu/CMSSW_6_2_5/src/Centrality/Correction/pPbHist_Hijing_TrandEs.root");
TH1D* hbef = (TH1D*)ftreff->Get("hHFEnergy4");
TH1D* rehbef = (TH1D*)hbef->Rebin(nhfbin,"rehHFEnergy4",hfbin);
TH1D* haft = (TH1D*)ftreff->Get("hHFEnergy4_tr");
TH1D* rehaft = (TH1D*)haft->Rebin(nhfbin,"rehHFEnergy4_tr",hfbin);
TGraphAsymmErrors *gtreff = new TGraphAsymmErrors();
gtreff->BayesDivide(rehaft,rehbef);
TGraphAsymmErrors *geff = (TGraphAsymmErrors*)fDSeff->Get("regEffHF4");
for(int i=0;i<geff->GetN();i++){
geff->SetPointEXlow(i,0);
geff->SetPointEXhigh(i,0);
gtreff->SetPointEXlow(i,0);
gtreff->SetPointEXhigh(i,0);
}
ratio->SetTitle("");
ratio->SetLineColor(1);
ratio->SetMarkerStyle(24);
ratio->SetMarkerColor(1);
ratio->SetMarkerSize(1.5);
ratio->Draw("P");
geff->SetMarkerStyle(33);
geff->SetMarkerColor(2);
geff->SetMarkerSize(1.5);
geff->Draw("Psame");
gtreff->SetMarkerStyle(21);
gtreff->SetMarkerColor(4);
gtreff->SetMarkerSize(1.3);
gtreff->Draw("Psame");
TLegend *leg = new TLegend(0.60, 0.2, 0.78, 0.4);
leg->SetFillColor(10);
leg->SetFillStyle(0);
leg->SetBorderSize(0.035);
leg->SetTextFont(42);
leg->SetTextSize(0.045);
leg->AddEntry(ratio,"data/fit","p");
leg->AddEntry(geff,"DS efficiency","p");
leg->AddEntry(gtreff,"Event selection efficiency","p");
leg->Draw("same");
TLine *l = new TLine(0,1,90,1);
l->SetLineStyle(2);
l->Draw("same");
c1->SaveAs(Form("%sratiovseff.png",dirname.Data()));
}
示例4: outputBDTplots
//.........这里部分代码省略.........
if (MLSP==150 && (MSTOP ==300 || MSTOP == 400 || MSTOP == 500 || MSTOP == 600 || MSTOP == 700 || MSTOP == 800)){
double binR1=TTBar->FindBin(0.25);
double binR2=TTBar->FindBin(0.4);
double binR3=TTBar->FindBin(0.5);
double binR4=TTBar->FindBin(0.5);
double binR5=TTBar->FindBin(0.4);
double binR6=TTBar->FindBin(0.1);
TH1F *histobackground=(TH1F*)TTBar->Clone();
histobackground->Add(WJets);
histobackground->Add(Others);
//histobackground->SetAxisRange(0.3,1,"X");
if (MSTOP==300) cout << TTBar->Integral(binR1,nbins+1)+Others->Integral(binR1,nbins+1)+WJets->Integral(binR1,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR1,nbins+1)) << endl;
if (MSTOP==400) cout << histobackground->Integral(binR2,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR2,nbins+1)) << endl;
if (MSTOP==500) cout << histobackground->Integral(binR3,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR3,nbins+1)) << endl;
if (MSTOP==600) cout << histobackground->Integral(binR4,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR4,nbins+1)) << endl;
if (MSTOP==700) cout << histobackground->Integral(binR5,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR5,nbins+1)) << endl;
if (MSTOP==800) cout << histobackground->Integral(binR6,nbins+1) << " +/- " << sqrt(histobackground->Integral(binR6,nbins+1)) << endl;
}*/
max_bin = maxbin(SoB);
cutvalue = TTBar->GetBinLowEdge(max_bin);
double sob = SoB->GetBinContent(max_bin);
char cutval_[32];
snprintf(cutval_, 32, "%.1g", cutvalue);
char fom_[32];
snprintf(fom_, 32, "%.2g", sob);
char signal_[32];
snprintf(signal_, 32, "%.2g", nsignal);
TLegendEntry *legge;
TLegend *leg;
leg = new TLegend(0.6,0.55,0.9,0.85);
leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetTextSize(0.043);
legge = leg->AddEntry(TTBar, "t#bar{t} + Jets", "F");
legge = leg->AddEntry(WJets, "W + Jets", "F");
legge = leg->AddEntry(Others, "Others", "F");
legge = leg->AddEntry(signal, "sig("+TString(stop)+","+TString(neut)+")", "l");
leg->SetFillColor(0);
TCanvas c2("c2","c2",800,600);
stack->Draw("");
signal->Draw("same");
stack->GetYaxis()->SetTitle("Entries");
stack->GetXaxis()->SetTitle("BDT output");
signal->GetXaxis()->SetRangeUser(-0.4,0.8);
stack->GetXaxis()->SetRangeUser(-0.4,0.8);
signal->SetMinimum(0.3);
stack->SetMinimum(0.3);
//signal->GetYaxis()->SetNdivisions(10);
//stack->GetYaxis()->SetNdivisions(10);
if(logbool) c2.SetLogy();
leg->Draw();
double maximobin=stack->GetMaximum();
double cutvalueplot = atof(TString(cutval_));
TLine *linea = new TLine(cutvalueplot,0,cutvalueplot,maximobin);
linea->SetLineWidth(2);
linea->SetLineColor(4);
if (lineacut) linea->Draw();
TLatex l1;
l1.SetTextAlign(12);
l1.SetTextSize(0.04);
l1.SetNDC();
l1.DrawLatex(0.155, 0.98, "CMS Simulation, 20 fb^{-1}");
l1.DrawLatex(0.7, 0.98, "#sqrt{s} = 8 TeV");
TLatex l2;
l2.SetTextAlign(12);
l2.SetTextSize(0.04);
l2.SetNDC();
l2.DrawLatex(0.22, 0.3, "#color[2]{Optimal cut: \t "+TString(cutval_)+"}");
l2.DrawLatex(0.22, 0.25, "#color[2]{[email protected]: \t "+TString(fom_)+"}");
l2.DrawLatex(0.22, 0.2, "#color[2]{Tot. N_{Signal}: \t "+TString(signal_)+"}");
if (!logbool) c2.Print("~/www/STOP/BDTTraining/8TeV/"+dataset_name+"_half/BestSet/"+TString(MVA)+"/histo_"+TString(stop)+"_"+TString(neut)+"_lineal.png");
if(logbool) c2.Print("~/www/STOP/BDTTraining/8TeV/"+dataset_name+"_half/BestSet/"+TString(MVA)+"/histo_"+TString(stop)+"_"+TString(neut)+"_log.png");
}
示例5: SignfificanceT2tt
//.........这里部分代码省略.........
legO->SetTextSize(0.04);
legO->SetTextFont(42);
legO->SetLineColor(1);
legO->SetLineStyle(1);
legO->SetLineWidth(2);
legO->SetFillColor(0);
legO->SetFillStyle(1001);
legO->SetHeader("Observed");
legO->AddEntry(gObs, "unpolarized","l");
legO->AddEntry(gObsR, "right-handed","l");
legO->AddEntry(gObsL, "left-handed","l");
*/
TGraph* graphWhite = new TGraph(5);
graphWhite->SetName("white");
graphWhite->SetTitle("white");
graphWhite->SetFillColor(kWhite);
graphWhite->SetFillStyle(1001);
graphWhite->SetLineColor(kBlack);
graphWhite->SetLineStyle(1);
graphWhite->SetLineWidth(3);
graphWhite->SetPoint(0,100, 500);
graphWhite->SetPoint(1,900, 500);
graphWhite->SetPoint(2,900, 500*0.75);
graphWhite->SetPoint(3,100, 500*0.75);
graphWhite->SetPoint(4,100, 500);
Float_t diagX[4] = {175.+25.,175.+25.+5000,175.-25.+5000,175.-25.};
Float_t diagY[4] = {0,5000,5000,0};
TGraph *gdiagonal = new TGraph(4, diagX, diagY);
gdiagonal->SetName("MtopDiagonal");
gdiagonal->SetFillColor(kWhite);
//#gdiagonal->SetFillColor(18);
TLine* ldiagonal = new TLine(175,0.,650-25.,450);
//TLine* ldiagonal = new TLine(175.,25,175+500,500);
ldiagonal->SetLineColor(kGray);
ldiagonal->SetLineStyle(2);
TLatex* tdiagonal = new TLatex(400-2.5, 400-172.5,"m_{#tilde{t}} = m_{t} + m_{#tilde{#chi}_{1}^{0}}");
//tdiagonal->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
tdiagonal->SetTextAngle(56.31);
tdiagonal->SetTextColor(kGray+2);
tdiagonal->SetTextAlign(11);
tdiagonal->SetTextSize(0.025);
TLine* l2 = new TLine(150,75,585,500);
l2->SetLineColor(kGray);
l2->SetLineStyle(2);
// if(killlowdiag){
// l2->SetX1(200); l2->SetY1(0); l2->SetX2(600); l2->SetY2(400);
// }
TLatex *t2 = new TLatex(300, 300-72.5,"m_{#tilde{t}} = m_{W} + m_{#tilde{#chi}_{1}^{0}}");
//t2->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
t2->SetTextAngle(56.31);
t2->SetTextColor(kGray+2);
t2->SetTextAlign(11);
t2->SetTextSize(0.025);
hSum->Draw("axis");
h->Draw("COLZsame");
gdiagonal->Draw("FSAME");
ldiagonal->Draw("LSAME");
l2->Draw();
示例6: Polarization
//.........这里部分代码省略.........
legO->SetTextSize(0.04);
legO->SetTextFont(42);
legO->SetLineColor(1);
legO->SetLineStyle(1);
legO->SetLineWidth(2);
legO->SetFillColor(0);
legO->SetFillStyle(1001);
legO->SetHeader("Observed");
legO->AddEntry(gObs, "unpolarized","l");
legO->AddEntry(gObsR, "right-handed","l");
legO->AddEntry(gObsL, "left-handed","l");
TGraph* graphWhite = new TGraph(5);
graphWhite->SetName("white");
graphWhite->SetTitle("white");
graphWhite->SetFillColor(kWhite);
graphWhite->SetFillStyle(1001);
graphWhite->SetLineColor(kBlack);
graphWhite->SetLineStyle(1);
graphWhite->SetLineWidth(3);
graphWhite->SetPoint(0,150, 500);
graphWhite->SetPoint(1,950, 500);
graphWhite->SetPoint(2,950, 500*0.6666666667);
graphWhite->SetPoint(3,150, 500*0.6666666667);
graphWhite->SetPoint(4,150, 500);
Float_t diagX[4] = {175.+25.,175.+25.+5000,175.-25.+5000,175.-25.};
Float_t diagY[4] = {0,5000,5000,0};
TGraph *gdiagonal = new TGraph(4, diagX, diagY);
gdiagonal->SetName("MtopDiagonal");
gdiagonal->SetFillColor(kWhite);
//#gdiagonal->SetFillColor(18);
TLine* ldiagonal = new TLine(175,0.,650-25.,450);
//TLine* ldiagonal = new TLine(175.,25,175+500,500);
ldiagonal->SetLineColor(kGray);
ldiagonal->SetLineStyle(2);
TLatex* tdiagonal = new TLatex(400-2.5, 400-172.5,"m_{#tilde{t}} = m_{t} + m_{#tilde{#chi}_{1}^{0}}");
//tdiagonal->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
tdiagonal->SetTextAngle(56.31);
tdiagonal->SetTextColor(kGray+2);
tdiagonal->SetTextAlign(11);
tdiagonal->SetTextSize(0.025);
TLine* l2 = new TLine(150,75,585,500);
l2->SetLineColor(kGray);
l2->SetLineStyle(2);
if(killlowdiag){
l2->SetX1(200); l2->SetY1(0); l2->SetX2(600); l2->SetY2(400);
}
TLatex *t2 = new TLatex(300, 300-72.5,"m_{#tilde{t}} = m_{W} + m_{#tilde{#chi}_{1}^{0}}");
//t2->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
t2->SetTextAngle(56.31);
t2->SetTextColor(kGray+2);
t2->SetTextAlign(11);
t2->SetTextSize(0.025);
hSum->Draw("axis");
gExpR->Draw("c");
gExpL->Draw("c");
gExp->Draw("c");
gObsR->Draw("c");
gObsL->Draw("c");
gObs->Draw("c");
示例7: YieldStudies
//.........这里部分代码省略.........
hemptyMean->GetYaxis()->SetTitleOffset(1.4);
hemptyMean->GetXaxis()->SetTitleSize(0.045);
hemptyMean->GetYaxis()->SetTitleSize(0.05);
hemptyMean->GetXaxis()->SetTitleFont(42);
hemptyMean->GetYaxis()->SetTitleFont(42);
hemptyMean->GetXaxis()->SetLabelFont(42);
hemptyMean->GetYaxis()->SetLabelFont(42);
hemptyMean->GetXaxis()->SetLabelSize(0.04);
hemptyMean->GetYaxis()->SetLabelSize(0.04);
TCanvas* cYields = new TCanvas("cYields","",1000,1000);
cYields->Divide(2,2);
cYields->cd(1);
hemptyMean->Draw();
hMeanPP->SetLineWidth(2);
hMeanPP->Draw("same");
hMeanPPMC->SetLineColor(2);
hMeanPPMC->SetLineWidth(2);
hMeanPPMC->Draw("same");
TLegend *legendMean=new TLegend(0.4958166,0.7558707,0.7949297,0.9299148,"");
legendMean->SetBorderSize(0);
legendMean->SetLineColor(0);
legendMean->SetFillColor(0);
legendMean->SetFillStyle(1001);
legendMean->SetTextFont(42);
legendMean->SetTextSize(0.045);
TLegendEntry *ent_MeanPP=legendMean->AddEntry(hMeanPP,"Data","pf");
ent_MeanPP->SetTextFont(42);
ent_MeanPP->SetLineColor(1);
TLegendEntry *ent_MeanPPMC=legendMean->AddEntry(hMeanPPMC,"MC","pf");
ent_MeanPPMC->SetTextFont(42);
ent_MeanPPMC->SetLineColor(2);
legendMean->Draw("same");
TLine* l = new TLine(5,1.865,100,1.865);
l->SetLineWidth(2);
l->SetLineStyle(2);
l->Draw();
cYields->cd(2);
hemptySigma1->Draw();
hSigmaGaus1PP->SetLineWidth(2);
hSigmaGaus1PP->Draw("same");
hSigmaGaus1PPMC->SetLineColor(2);
hSigmaGaus1PPMC->SetLineWidth(2);
hSigmaGaus1PPMC->Draw("same");
TLegend *legendSigma1=new TLegend(0.4958166,0.7558707,0.7949297,0.9299148,"");
legendSigma1->SetBorderSize(0);
legendSigma1->SetLineColor(0);
legendSigma1->SetFillColor(0);
legendSigma1->SetFillStyle(1001);
legendSigma1->SetTextFont(42);
legendSigma1->SetTextSize(0.045);
TLegendEntry *ent_Sigma1PP=legendSigma1->AddEntry(hSigmaGaus1PP,"Data","pf");
ent_Sigma1PP->SetTextFont(42);
ent_Sigma1PP->SetLineColor(1);
TLegendEntry *ent_Sigma1PPMC=legendSigma1->AddEntry(hSigmaGaus1PPMC,"MC","pf");
ent_Sigma1PPMC->SetTextFont(42);
ent_Sigma1PPMC->SetLineColor(2);
legendSigma1->Draw("same");
cYields->cd(3);
hemptySigma2->Draw();
hSigmaGaus2PP->SetLineWidth(2);
hSigmaGaus2PP->Draw("same");
hSigmaGaus2PPMC->SetLineColor(2);
hSigmaGaus2PPMC->SetLineWidth(2);
hSigmaGaus2PPMC->Draw("same");
示例8: plotVsEta_nice
//.........这里部分代码省略.........
} // for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) {
} // for (int idxCent = 0; idxCent < 9; idxCent++) {
// -----------------------------------------------------
for (int idxCent = 0; idxCent < 1; idxCent++) {
for (int idxDataSet = 0 ; idxDataSet < nDataSets; ++idxDataSet) {
TPad *pad = SetupCanvas(Form("canEta_Ratio_%s_%s", aDataSets[idxDataSet], cent[idxCent]), aDataSetsTitle[idxDataSet], "#eta", 0.45);
for (int idxEtaSuper = 0 ; idxEtaSuper < nEtaSuperSets; ++idxEtaSuper) {
if (idxEtaSuper == 1 || idxEtaSuper == 3 || idxEtaSuper == 5 || idxEtaSuper == 7 || idxEtaSuper == 8 )
continue;
for (int idxMoment = 4 ; idxMoment < nMoments; ++idxMoment) {
pad->cd(idxMoment-3);
TGraphErrors *g = etaGraphs[idxCent][idxEtaSuper][idxDataSet][idxMoment];
// if (idxCent == 0)
// ShiftGraphX(g, -0.015);
// else if (idxCent == 1)
// ShiftGraphX(g, -0.005);
// else if (idxCent == 4)
// ShiftGraphX(g, 0.005);
// else if (idxCent == 8)
// ShiftGraphX(g, 0.015);
ConfigGraph(g, idxMoment, idxEtaSuper);
if (idxEtaSuper == 0) {
g->Draw("AP");
TLine *line05 = new TLine( 0.5, aMinY[idxMoment], 0.5, aMaxY[idxMoment]);
line05->SetLineColor(kGray+1);
line05->SetLineStyle(3);
line05->Draw();
TLine *line50 = new TLine(-0.5, aMinY[idxMoment], -0.5, aMaxY[idxMoment]);
line50->SetLineColor(kGray+1);
line50->SetLineStyle(3);
line50->Draw();
TLine *line00 = new TLine(0., aMinY[idxMoment],0, aMaxY[idxMoment]);
line00->SetLineColor(kGray+1);
line00->SetLineStyle(3);
line00->Draw();
if (idxMoment == 5) {
// TLine *line0 = new TLine(aMinX, 0, aMaxX, 0);
// line0->SetLineColor(kGray+1);
// line0->SetLineStyle(2);
// line0->SetLineWidth(2);
// line0->Draw();
}
else if (idxMoment == 6) {
TLine *line1 = new TLine(aMinX, 1, aMaxX, 1);
line1->SetLineColor(kGray+1);
line1->SetLineStyle(2);
line1->SetLineWidth(2);
line1->Draw();
}
}
g->Draw("PSAME");
} // for (int idxMoment = 0 ; idxMoment < nMoments; ++idxMoment) {
示例9: drawPlots
void drawPlots( bool printgif = false ){
TFile *f = TFile::Open("output/data_e_ttbarV1align_histos.root");
//electron/muon eta
TH1F * heleta_metlt20 = (TH1F*) f->Get("heleta_metlt20");
TH1F * heleta_metgt30 = (TH1F*) f->Get("heleta_metgt30");
TH1F * hmueta_metlt20 = (TH1F*) f->Get("hmueta_metlt20");
TH1F * hmueta_metgt30 = (TH1F*) f->Get("hmueta_metgt30");
TH1F * hdphijetmet_metgt30_ee = (TH1F*) f->Get("hdphijetmet_metgt30_ee");
TH1F * hdphijetmet_metlt20_ee = (TH1F*) f->Get("hdphijetmet_metlt20_ee");
TH1F * hdphijetmet_metgt30_mm = (TH1F*) f->Get("hdphijetmet_metgt30_mm");
TH1F * hdphijetmet_metlt20_mm = (TH1F*) f->Get("hdphijetmet_metlt20_mm");
TCanvas *c1 = new TCanvas("c1","c1",1200,600);
c1->Divide(2,1);
TLegend *leg = new TLegend(0.7,0.7,0.95,0.9);
leg->SetFillColor(0);
leg->SetBorderSize(1);
TLine line;
line.SetLineColor(6);
c1->cd(1);
heleta_metlt20->Rebin(10);
heleta_metlt20->SetTitle("");
heleta_metgt30->Rebin(10);
heleta_metlt20->SetLineColor(4);
heleta_metlt20->Draw("hist");
heleta_metgt30->SetLineColor(2);
heleta_metgt30->SetMarkerColor(2);
heleta_metlt20->SetMarkerSize(0);
heleta_metgt30->Draw("sameE1");
heleta_metlt20->GetXaxis()->SetRangeUser(-3,3);
leg->AddEntry(heleta_metlt20,"tcmet < 20 GeV");
leg->AddEntry(heleta_metgt30,"tcmet > 30 GeV");
line.DrawLine(-1.479,0,-1.479,1.05*heleta_metlt20->GetMaximum());
line.DrawLine(1.479, 0, 1.479,1.05*heleta_metlt20->GetMaximum());
leg->Draw();
c1->cd(2);
hmueta_metlt20->Rebin(10);
hmueta_metlt20->SetTitle("");
hmueta_metgt30->Rebin(10);
hmueta_metlt20->SetLineColor(4);
hmueta_metlt20->Draw("hist");
hmueta_metgt30->SetLineColor(2);
hmueta_metgt30->SetMarkerColor(2);
hmueta_metgt30->Draw("sameE1");
hmueta_metlt20->GetXaxis()->SetRangeUser(-3,3);
leg->Draw();
TCanvas *c2 = new TCanvas("c2","c2",1200,600);
c2->Divide(2,1);
c2->cd(1);
hdphijetmet_metlt20_ee->Rebin(5);
hdphijetmet_metlt20_ee->SetTitle("ee");
hdphijetmet_metlt20_ee->GetXaxis()->SetTitle("#Delta#phi(jet,tcmet)");
hdphijetmet_metgt30_ee->Rebin(5);
hdphijetmet_metlt20_ee->SetLineColor(4);
hdphijetmet_metlt20_ee->Draw("hist");
hdphijetmet_metgt30_ee->SetLineColor(2);
hdphijetmet_metgt30_ee->SetMarkerColor(2);
hdphijetmet_metlt20_ee->SetMarkerSize(0);
hdphijetmet_metgt30_ee->Draw("sameE1");
hdphijetmet_metlt20_ee->GetXaxis()->SetRangeUser(-3,3);
leg->Draw();
c2->cd(2);
hdphijetmet_metlt20_mm->Rebin(5);
hdphijetmet_metlt20_mm->SetTitle("#mu#mu");
hdphijetmet_metlt20_mm->GetXaxis()->SetTitle("#Delta#phi(jet,tcmet)");
hdphijetmet_metgt30_mm->Rebin(5);
hdphijetmet_metlt20_mm->SetLineColor(4);
hdphijetmet_metlt20_mm->Draw("hist");
hdphijetmet_metgt30_mm->SetLineColor(2);
hdphijetmet_metgt30_mm->SetMarkerColor(2);
hdphijetmet_metlt20_mm->SetMarkerSize(0);
hdphijetmet_metgt30_mm->Draw("sameE1");
hdphijetmet_metlt20_mm->GetXaxis()->SetRangeUser(-3,3);
leg->Draw();
if( printgif ){
c1->Modified();
c1->Update();
c1->Print("plots/lepeta.gif");
c2->Modified();
c2->Update();
c2->Print("plots/dphijetmet.gif");
}
}
示例10: feynman
void feynman()
{
//Draw Feynman diagrams
//Author: Nik Berry
TString diagramName;
// diagramName = "ttbardilepton";
diagramName = "ttgammadilepton";
// diagramName = "ttgammadileptonsinglephoton";
TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 600, 300);
c1->Range(0, -40, 140, 100);
Int_t linsav = gStyle->GetLineWidth();
gStyle->SetLineWidth(3);
TLatex t;
t.SetTextAlign(22);
t.SetTextSize(0.1);
TCurlyLine *g;
g = new TCurlyLine(10, 10, 30, 30); g->Draw();
g = new TCurlyLine(10, 50, 30, 30); g->Draw();
t.DrawLatex(7,10,"g");
t.DrawLatex(7,50,"g");
g = new TCurlyLine(30, 30, 55, 30); g->Draw();
t.DrawLatex(42.5, 39,"g");
TLine *l;
l = new TLine(55, 30, 75, 10); l->Draw();
l = new TLine(55, 30, 75, 50); l->Draw();
t.DrawLatex(65,14,"#bar{t}");
t.DrawLatex(65,46,"t");
TCurlyLine *W;
W = new TCurlyLine(75,50,95,75); W->SetWavy(); W->Draw();
t.DrawLatex(85,75,"W^{+}");
l = new TLine(75,50,115,40); l->Draw();
t.DrawLatex(85,40,"b");
l = new TLine(95,75,115,65); l->Draw();
l = new TLine(95,75,115,85); l->Draw();
t.DrawLatex(120,65,"#nu_{e,#mu}");
t.DrawLatex(120,85,"e^{+}#mu^{+}");
W = new TCurlyLine(75,10,95,-15); W->SetWavy(); W->Draw();
t.DrawLatex(85,-18,"W^{-}");
l = new TLine(75,10,115,20); l->Draw();
t.DrawLatex(85,22,"#bar{b}");
l = new TLine(95,-15,115,-25); l->Draw();
l = new TLine(95,-15,115,-10); l->Draw();
t.DrawLatex(120,-25,"#bar{#nu}_{e,#mu}");
t.DrawLatex(120,-10,"e^{-}#mu^{-}");
if(diagramName == "ttgammadileptonsinglephoton"){
TCurlyLine* gamma;
gamma = new TCurlyLine(65,40,80,95); gamma->SetWavy(); gamma->Draw();
t.DrawLatex(69,75,"#gamma");
}
if(diagramName == "ttgammadilepton"){
TCurlyLine* gamma;
gamma = new TCurlyLine(65,40,80,95); gamma->SetWavy(); gamma->Draw(); //top
gamma = new TCurlyLine(90,47,110,60); gamma->SetWavy(); gamma->Draw(); //b
gamma = new TCurlyLine(85,0,105,7); gamma->SetWavy(); gamma->Draw(); //W
gamma = new TCurlyLine(108,-11,125,15); gamma->SetWavy(); gamma->Draw();
t.DrawLatex(69,75,"#gamma");
t.DrawLatex(112,55,"#gamma");
t.DrawLatex(108,6,"#gamma");
t.DrawLatex(127,15,"#gamma");
}
// TLine * l;
// l = new TLine(10, 10, 30, 30); l->Draw();
// l = new TLine(10, 50, 30, 30); l->Draw();
// TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*sqrt(2), 135, 225);
// ginit->SetWavy();
// ginit->Draw();
// t.DrawLatex(7,6,"e^{-}");
// t.DrawLatex(7,55,"e^{+}");
// t.DrawLatex(7,30,"#gamma");
// TCurlyLine *gamma = new TCurlyLine(30, 30, 55, 30);
// gamma->SetWavy();
// gamma->Draw();
// t.DrawLatex(42.5,37.7,"#gamma");
// TArc *a = new TArc(70, 30, 15);
// a->Draw();
// t.DrawLatex(55, 45,"#bar{q}");
// t.DrawLatex(85, 15,"q");
// TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
// gluon->Draw();
// t.DrawLatex(77.5,30,"g");
// TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
// z0->SetWavy();
// z0->Draw();
//.........这里部分代码省略.........
示例11: main
int main(int argc, char** argv)
{
gROOT->Reset();
gROOT->SetStyle("Plain");
gStyle->SetPalette(1);
gStyle->SetOptStat(1111);
gStyle->SetOptFit(111);
TF1 gaussian("gaussian","-exp(-0.1*x) + exp(-0.2 * x)",0,50);
TH1F histo("histo","histo",1000,0,50);
histo.FillRandom("gaussian",100000);
TCanvas cc("cc","cc",400,400);
histo.SetLineColor(kRed);
histo.Draw();
std::cerr << "===== Get Neyman intervals ====" << std::endl;
std::vector<double> band = getSigmaBands_FeldmanCousins (histo) ;
std::cerr << "=======================" << std::endl;
std::cerr << " " << band.at(0) << " << " << band.at(1) << " << " << band.at(2) << " << " << band.at(3) << " << " << band.at(4) << std::endl;
std::cerr << "=======================" << std::endl;
TLine* lVertLeft95 = new TLine(band.at(0),0,band.at(0),1000);
lVertLeft95->SetLineColor(kBlue);
lVertLeft95->SetLineWidth(2);
lVertLeft95->SetLineStyle(5);
TLine* lVertLeft68 = new TLine(band.at(1),0,band.at(1),1000);
lVertLeft68->SetLineColor(kMagenta);
lVertLeft68->SetLineWidth(2);
lVertLeft68->SetLineStyle(5);
TLine* lVertMiddle = new TLine(band.at(2),0,band.at(2),1000);
lVertMiddle->SetLineColor(kGreen);
lVertMiddle->SetLineWidth(2);
lVertMiddle->SetLineStyle(5);
TLine* lVertRight68 = new TLine(band.at(3),0,band.at(3),1000);
lVertRight68->SetLineColor(kMagenta);
lVertRight68->SetLineWidth(2);
lVertRight68->SetLineStyle(5);
TLine* lVertRight95 = new TLine(band.at(4),0,band.at(4),1000);
lVertRight95->SetLineColor(kBlue);
lVertRight95->SetLineWidth(2);
lVertRight95->SetLineStyle(5);
lVertLeft95->Draw();
lVertLeft68->Draw();
lVertMiddle->Draw();
lVertRight68->Draw();
lVertRight95->Draw();
cc.SaveAs("exampleBand.png");
return 0;
}
示例12: makeMETPlots
void makeMETPlots(){
gStyle->SetOptFit(0);
TChain *ch = new TChain("t");
//ch->Add("../output/V00-02-09/highpt/LM6v2_smallTree.root");
//ch->Add("../output/V00-02-00/LM4_baby.root");
//ch->Add("../output/V00-02-16/highpt/LM6v2_smallTree_gen_TEMP.root");
ch->Add("../output/V00-02-18/highpt/LM6v2_smallTree_gen.root");
vector<TCut> metcuts;
vector<float> metcutvals;
metcuts.push_back(TCut("pfmet>200")); metcutvals.push_back(200);
metcuts.push_back(TCut("pfmet>275")); metcutvals.push_back(275);
//TCut sel("njets>=2 && ht>100 && !passz");
TCut sel("foundPair==1 && reco1==1 && reco2==1 && ht>100 && htgen2>100 && ngenjets>=2");
const unsigned int n = metcuts.size();
TH1F* hpass[n];
TH1F* hall[n];
for( unsigned int i = 0 ; i < metcuts.size() ; ++i){
hpass[i] = new TH1F(Form("hpass_%i",i),Form("hpass_%i",i),25,0,500);
hall[i] = new TH1F(Form("hall_%i",i), Form("hall_%i",i) ,25,0,500);
ch->Draw(Form("genmet>>hpass_%i",i),sel+metcuts.at(i));
ch->Draw(Form("genmet>>hall_%i",i) ,sel);
}
TCanvas *can = new TCanvas();
can->cd();
gPad->SetRightMargin(0.1);
gPad->SetTopMargin(0.1);
gPad->SetGridx();
gPad->SetGridy();
gStyle->SetOptFit(0);
TGraphAsymmErrors* gr[n];
TLegend *leg = new TLegend(0.6,0.2,0.87,0.4);
leg->SetFillColor(0);
leg->SetBorderSize(1);
leg->SetTextSize(0.03);
TF1* erf[n];
TLine line;
line.SetLineWidth(2);
line.SetLineStyle(2);
for( unsigned int i = 0 ; i < metcuts.size() ; ++i){
//can[i] = new TCanvas(Form("can_%i",i),Form("can_%i",i),500,500);
//can[i]->cd();
// TF1* efunc = new TF1("efitf", fitf, 0, 500, 3);
// efunc->SetParameters(1, 100, 10);
// efunc->SetParNames("norm", "offset", "width");
erf[i] = new TF1("efitf", fitf, 0, 500, 3);
erf[i]->SetParameters(1, 100, 30);
erf[i]->SetParNames("norm", "offset", "width");
erf[i]->SetLineWidth(2);
//erf[i]->FixParameter(0,1);
//erf[i] = new TF1(Form("erf_%i",i),mfitf,0,400);
//erf[i]->SetParameter(0,100*(i+1));
//erf[i]->SetParameter(1,10);
gr[i] = new TGraphAsymmErrors();
if( i==0 ){
erf[i]->SetLineColor(1);
line.SetLineColor(1);
}
if( i==1 ){
line.SetLineColor(2);
gr[i]->SetLineColor(2);
gr[i]->SetMarkerColor(2);
gr[i]->SetMarkerStyle(21);
erf[i]->SetLineColor(2);
}
if( i==2 ){
gr[i]->SetLineColor(4);
gr[i]->SetMarkerColor(4);
gr[i]->SetMarkerStyle(25);
erf[i]->SetLineColor(4);
}
leg->AddEntry(gr[i],Form("E_{T}^{miss}>%.0f GeV",metcutvals.at(i)),"p");
gr[i]->GetXaxis()->SetRangeUser(0,500);
//.........这里部分代码省略.........
示例13: eventBinning
//================================================
void eventBinning(const Int_t save = 0)
{
TH1F *hVtxZ = (TH1F*)f->Get(Form("mhVertexZ_%s",trigName[kTrigType]));
c = draw1D(hVtxZ,"",kFALSE,kFALSE);
for(int i=0; i<19; i++)
{
double value = -100 + i*10 + 10;
double height = hVtxZ->GetBinContent(hVtxZ->FindFixBin(value));
TLine *line = GetLine(value,0,value,height,2,1,1);
line->Draw();
}
if(save)
{
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sVertexZ_Binning.pdf",run_type,run_cfg_name.Data()));
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sVertexZ_Binning.png",run_type,run_cfg_name.Data()));
}
TH1F *hgRefMultCorr = (TH1F*)f->Get(Form("mhgRefMultCorr_%s",trigName[kTrigType]));
c = draw1D(hgRefMultCorr,"",kTRUE,kFALSE);
//double bounds[9] = {472,401,283,193,126,77,44,23,11};
double bounds[16] = {11,16,23,32,44,59,77,99,126,157,193,235,283,338,401,472};
for(int i=0; i<16; i++)
{
double value = bounds[i];
double height = hgRefMultCorr->GetBinContent(hgRefMultCorr->FindFixBin(value));
TLine *line = GetLine(value,0,value,height,2,1,1);
line->Draw();
}
if(save)
{
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sgRefMult_Binning.pdf",run_type,run_cfg_name.Data()));
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sgRefMult_Binning.png",run_type,run_cfg_name.Data()));
}
// centrality
TH1F *hgRefMult = (TH1F*)f->Get(Form("mhgRefMult_%s",trigName[kTrigType]));
hgRefMult->SetLineColor(2);
c = draw1D(hgRefMult,"",kTRUE,kFALSE);
hgRefMultCorr->Draw("sames HIST");
TLegend *leg = new TLegend(0.15,0.3,0.4,0.5);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
leg->AddEntry(hgRefMult,"Raw gRefMult","L");
leg->AddEntry(hgRefMultCorr,"Corrected gRefMult","L");
leg->Draw();
if(save)
{
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sgRefMult.pdf",run_type,run_cfg_name.Data()));
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sgRefMult.png",run_type,run_cfg_name.Data()));
}
TH1F *hCentrality = (TH1F*)f->Get(Form("mhCentrality_%s",trigName[kTrigType]));
c = draw1D(hCentrality,"",kTRUE,kFALSE);
if(save)
{
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sCentrality.pdf",run_type,run_cfg_name.Data()));
c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_EventMixing/%sCentrality.png",run_type,run_cfg_name.Data()));
}
// event plane
TH2F *hExcVsIncRawEP = (TH2F*)f->Get(Form("mhExcVsIncRawEP_%s",trigName[kTrigType]));
c = draw2D(hExcVsIncRawEP);
TH1F *hEventPlane = (TH1F*)f->Get(Form("mhEventPlane_%s",trigName[kTrigType]));
c = draw1D(hEventPlane,"",kFALSE,kFALSE);
}
示例14: doCarlosPlots
void doCarlosPlots() {
TCanvas *c1 = new TCanvas("c1","Luminosity",200,10,700,500);
// c1->SetFillColor(42);
c1->SetGrid();
// c1->GetFrame()->SetFillColor(21);
// c1->GetFrame()->SetBorderSize(12);
const Int_t n = 6;
Float_t x[n] = {0., 28., 54., 74., 91., 100.};
// Float_t y[n] = {8.0E29, 3.4E30, 2.5E31, 4.9E31, 5.1E31, 1.4E32};
Float_t y[n] = {8.0E29, 3.4E30, 2.5E31, 4.9E31, 5.1E31, 6.278E31};
Float_t ex[n] = {.0001,.0001,.0001,.0001,.0001,.0001};
Float_t ey[n] = {0.,0.,0.,0.,0.,0.};
Float_t y2[n] = {0., 2., 15., 40.,70.,99.7};
Float_t xd[2] = {0., 100.};
Float_t yd[2] = {-10000.,1500000.};
Float_t yd2[2] = {0.001,0.3};
Float_t exd[n] = {.0001,.0001};
Float_t eyd[n] = {0.,0.};
TGraphErrors *gr3 = new TGraphErrors(n,x,y,ex,ey);
gr3->SetMarkerColor(2);
gr3->SetLineColor(2);
gr3->SetLineWidth(3);
gr3->SetMarkerStyle(20);
gr3->SetMinimum(-2.E30);
gr3->GetXaxis()->SetTitle("Time (days)");
gr3->GetYaxis()->SetTitle("L_{inst} (cm^{-2} s^{-1})");
gr3->Draw("ALP");
TLine *hline = new TLine(-10.,1E31,36.,1E31);
hline->SetLineColor(4);
hline->SetLineWidth(3);
hline->Draw("SAME");
TLine *vline = new TLine(36.,-2E30,36.,1E31);
vline->SetLineColor(4);
vline->SetLineWidth(3);
vline->Draw("SAME");
c1->Update();
c1->SaveAs("LumiInst.gif");
TGraphErrors *gr2 = new TGraphErrors(n,x,y2,ex,ey);
gr2->SetMarkerColor(2);
gr2->SetMinimum(-5.0);
gr2->SetMaximum(110.0);
gr2->SetMarkerStyle(20);
gr2->GetXaxis()->SetTitle("Time (days)");
gr2->GetYaxis()->SetTitle("L_{integ} (pb^{-1})");
gr2->Draw("AP");
TF1 *ftotal = new TF1("ftotal","myFunc(x)",0.,101.);
ftotal->SetLineWidth(3);
ftotal->SetLineColor(2);
ftotal->Draw("SAME");
TLine *hline2 = new TLine(-10.,3.85,36.,3.85);
hline2->SetLineColor(4);
hline2->SetLineWidth(3);
hline2->Draw("SAME");
TLine *vline2 = new TLine(36.,-5.0,36.,3.85);
vline2->SetLineColor(4);
vline2->SetLineWidth(3);
vline2->Draw("SAME");
c1->Update();
c1->SaveAs("LumiInteg.gif");
c1->SetLogy();
c1->Update();
c1->SaveAs("LumiIntegLog.gif");
TCanvas *c2 = new TCanvas("c2","Events",300,100,700,500);
c2->cd();
c2->SetGrid();
TGraphErrors *gr4 = new TGraphErrors(2,xd,yd,exd,eyd); // DUMMY
gr4->SetMarkerColor(kWhite);
gr4->GetXaxis()->SetTitle("Time (days)");
gr4->GetYaxis()->SetTitle("N (prompt J/#psi reco)");
TLine *vline3 = new TLine(36.,-20000.0,36.,900000.); // MENU CHANGE
vline3->SetLineColor(kMagenta);
vline3->SetLineStyle(kDashed);
vline3->SetLineWidth(2);
/// FUNCTIONS: HLTMu3
TF1 *fhighHLTMu3 = new TF1("fhighHLTMu3","23887*myFunc(x)",0.,36.);
fhighHLTMu3->SetLineWidth(4);
fhighHLTMu3->SetLineColor(2);
TF1 *fmediumHLTMu3 = new TF1("fmediumHLTMu3","30993*myFunc(x)",0.,36.);
fmediumHLTMu3->SetLineWidth(2);
fmediumHLTMu3->SetLineColor(4);
TF1 *flowHLTMu3 = new TF1("flowHLTMu3","66119*myFunc(x)",0.,36.);
flowHLTMu3->SetLineWidth(2);
//.........这里部分代码省略.........
示例15: TAPSEnergy
//______________________________________________________________________________
void TAPSEnergy()
{
// Main method.
Char_t tmp[256];
// load CaLib
gSystem->Load("libCaLib.so");
// general configuration
Bool_t watch = kFALSE;
const Char_t* data = "Data.TAPS.LG.E1";
const Char_t* hName = "CaLib_TAPS_IM_Neut_1CB_1TAPS";
//const Char_t* hName = "CaLib_TAPS_IM_Neut_2TAPS";
Double_t yMin = 110;
Double_t yMax = 160;
// configuration
const Char_t calibration[] = "LH2_May_18";
const Char_t* fLoc = "$HOME/loc/presort/data/May_18";
// create histogram
gHOverview = new TH1F("Overview", "Overview", 40000, 0, 40000);
TCanvas* cOverview = new TCanvas();
gHOverview->GetYaxis()->SetRangeUser(yMin, yMax);
gHOverview->Draw("E1");
// create line
gLine = new TLine();
gLine->SetLineColor(kBlue);
gLine->SetLineWidth(2);
// init fitting function
gFitFunc = 0;
// create fitting canvas
gCFit = new TCanvas();
// get number of sets
Int_t nSets = TCMySQLManager::GetManager()->GetNsets(data, calibration);
// total number of runs
Int_t nTotRuns = 0;
// first and last runs
Int_t first_run, last_run;
// loop over sets
for (Int_t i = 0; i < nSets; i++)
{
// get runs of set
Int_t nRuns;
Int_t* runs = TCMySQLManager::GetManager()->GetRunsOfSet(data, calibration, i, &nRuns);
// loop over runs
for (Int_t j = 0; j < nRuns; j++)
{
// save first and last runs
if (i == 0 && j == 0) first_run = runs[j];
if (i == nSets-1 && j == nRuns-1) last_run = runs[j];
// clean-up
if (gH) delete gH;
if (gH2) delete gH2;
if (gRFile) delete gRFile;
gH = 0;
gH2 = 0;
gRFile = 0;
// load ROOT file
sprintf(tmp, "%s/ARHistograms_CBTaggTAPS_%d.root", fLoc, runs[j]);
gRFile = new TFile(tmp);
// check file
if (!gRFile) continue;
if (gRFile->IsZombie()) continue;
// load histogram
gH2 = (TH2*) gRFile->Get(hName);
if (!gH2) continue;
if (!gH2->GetEntries()) continue;
// project histogram
sprintf(tmp, "Proj_%d", runs[j]);
gH = gH2->ProjectionX(tmp);
// fit the histogram
Fit(runs[j]);
// update canvases and sleep
if (watch)
{
cOverview->Update();
gCFit->Update();
gSystem->Sleep(50);
}
// count run
nTotRuns++;
//.........这里部分代码省略.........