本文整理汇总了C++中TH1F::SetMarkerColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1F::SetMarkerColor方法的具体用法?C++ TH1F::SetMarkerColor怎么用?C++ TH1F::SetMarkerColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1F
的用法示例。
在下文中一共展示了TH1F::SetMarkerColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_psi2s_mupt
void make_psi2s_mupt(float ptmin=0.0, float ptmax=30.0, float ymin=0.0, float ymax=2.4, bool absRapidity=true, bool saveFile=false)
{
TCanvas *c1 = new TCanvas("c1","c1");
c1->SetLogy();
TCut defaultCut = "Reco_QQ_sign==0&&Reco_QQ_4mom.M()>3.35&&Reco_QQ_4mom.M()<4.0&&Reco_QQ_ctauTrue>-10";
TCut ptCut = Form("Reco_QQ_4mom.Pt()>%4.1f&&Reco_QQ_4mom.Pt()<%4.1f",ptmin,ptmax);
TCut rapCut;
if (absRapidity)
rapCut = Form("abs(Reco_QQ_4mom.Rapidity())>%3.1f&&abs(Reco_QQ_4mom.Rapidity())<%3.1f",ymin,ymax);
else
rapCut = Form("Reco_QQ_4mom.Rapidity()>%3.1f&&Reco_QQ_4mom.Rapidity()<%3.1f",ymin,ymax);
unsigned int trigBit=2; // DoubleMu0_HighQ
TCut trigCut = Form("(HLTriggers&%u)==%u&&(Reco_QQ_trig&%u)==%u",trigBit,trigBit,trigBit,trigBit);
TString fname;
fname = Form("20140324/MC_psi2s_pp_mupt_Rap_%3.1f-%3.1f_Pt_%3.1f-%3.1f.root",ymin,ymax,ptmin,ptmax);
std::cout << fname << std::endl;
std::cout << "default: " << defaultCut.GetTitle() << std::endl;
std::cout << "pt cut: " << ptCut.GetTitle() << std::endl;
std::cout << "rapidity cut: " << rapCut.GetTitle() << std::endl;
std::cout << "trigger bit: " << trigCut.GetTitle() << std::endl;
TH1F *hMuPlPtRec = new TH1F("hMuPlPtRec","hMuPlPtRec;p_{T} (#mu^{+}) (GeV/c);Events",200,0,20);
TH1F *hMuMiPtRec = new TH1F("hMuMiPtRec","hMuMiPtRec;p_{T} (#mu^{-}) (GeV/c);Events",200,0,20);
TH1F *hMuPtRec = new TH1F("hMuPtRec","hMuPtRec;p_{T} (#mu^{#pm}) (GeV/c);Events",200,0,20);
hMuPlPtRec->Sumw2();
hMuMiPtRec->Sumw2();
hMuPtRec->Sumw2();
hMuPlPtRec->SetMarkerColor(kRed);
hMuMiPtRec->SetMarkerColor(kBlue);
TChain *myTree = new TChain("myTree");
myTree->Add("../root_files/PRpsi2SMC_Histos_2013pp_GlbGlb_STARTHI53_V28-v1_muLessPV.root");
myTree->Draw("Reco_QQ_mupl_4mom.Pt()>>hMuPlPtRec",defaultCut&&ptCut&&rapCut&&trigCut,"e");
myTree->Draw("Reco_QQ_mumi_4mom.Pt()>>hMuMiPtRec",defaultCut&&ptCut&&rapCut&&trigCut,"e");
hMuPtRec->Add(hMuPlPtRec,hMuMiPtRec);
hMuPtRec->Draw();
hMuPlPtRec->Draw("same");
hMuMiPtRec->Draw("same");
TFile *outf = NULL;
if (saveFile) {
outf = new TFile(fname,"RECREATE");
hMuPtRec->Write();
outf->Close();
}
return;
}
示例2: if
///
/// Make a plot out of a 1D histogram holding a 1-CL curve.
/// This is a fall back function that does no fancy stuff.
///
/// \param s The scanner to plot.
/// \param first Set this to true for the first plotted scanner.
///
void OneMinusClPlot::scan1dPlotSimple(MethodAbsScan* s, bool first, int CLsType)
{
if ( arg->debug ){
cout << "OneMinusClPlot::scan1dPlotSimple() : plotting ";
cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
}
m_mainCanvas->cd();
TH1F *hCL = (TH1F*)s->getHCL()->Clone(getUniqueRootName());
if (CLsType==1) hCL = (TH1F*)s->getHCLs()->Clone(getUniqueRootName());
else if (CLsType==2) hCL = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
// get rid of nan and inf
for ( int i=1; i<=hCL->GetNbinsX(); i++ ){
if ( hCL->GetBinContent(i)!=hCL->GetBinContent(i)
|| std::isinf(hCL->GetBinContent(i)) ) hCL->SetBinContent(i, 0.0);
}
int color = s->getLineColor();
if(CLsType==1) color = color + 2 ;
hCL->SetStats(0);
hCL->SetLineColor(color);
hCL->SetMarkerColor(color);
hCL->SetLineWidth(2);
hCL->SetLineStyle(s->getLineStyle());
hCL->SetMarkerColor(color);
hCL->SetMarkerStyle(8);
hCL->SetMarkerSize(0.6);
hCL->GetYaxis()->SetNdivisions(407, true);
hCL->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
hCL->GetYaxis()->SetTitle("1-CL");
hCL->GetXaxis()->SetLabelFont(font);
hCL->GetYaxis()->SetLabelFont(font);
hCL->GetXaxis()->SetTitleFont(font);
hCL->GetYaxis()->SetTitleFont(font);
hCL->GetXaxis()->SetTitleOffset(0.9);
hCL->GetYaxis()->SetTitleOffset(0.85);
hCL->GetXaxis()->SetLabelSize(labelsize);
hCL->GetYaxis()->SetLabelSize(labelsize);
hCL->GetXaxis()->SetTitleSize(titlesize);
hCL->GetYaxis()->SetTitleSize(titlesize);
if ( plotLegend && !arg->isQuickhack(22) ){
if ( arg->plotlog ) hCL->GetYaxis()->SetRangeUser(1e-3,10);
else hCL->GetYaxis()->SetRangeUser(0.0,1.3);
}
else{
if ( arg->plotlog ) hCL->GetYaxis()->SetRangeUser(1e-3,1);
else hCL->GetYaxis()->SetRangeUser(0.0,1.0);
}
hCL->Draw(first?"":"same");
}
示例3: Difference
void Difference(TH1* iH0,TH1 *iH1) {
std::string lName = std::string(iH0->GetName());
//TH1F *lHDiff = new TH1F((lName+"Diff").c_str(),(lName+"Diff").c_str(),50,0,300); lHDiff->Sumw2();
TH1F *lHDiff = new TH1F((lName+"Diff").c_str(),(lName+"Diff").c_str(),iH0->GetNbinsX(),iH0->GetXaxis()->GetXmin(),iH0->GetXaxis()->GetXmax()); lHDiff->Sumw2();
lHDiff->SetFillColor(kViolet); lHDiff->SetFillStyle(1001); lHDiff->SetLineWidth(1);
TH1F *lXHDiff1 = new TH1F((lName+"XDiff1").c_str(),(lName+"XDiff1").c_str(),iH0->GetNbinsX(),iH0->GetXaxis()->GetXmin(),iH0->GetXaxis()->GetXmax());
int i1 = 0;
lXHDiff1->SetLineStyle(2); lXHDiff1->SetLineWidth(2); lXHDiff1->SetLineColor(kRed);
lHDiff->GetYaxis()->SetRangeUser(0,2);
lHDiff->GetYaxis()->SetTitleOffset(0.6);
lHDiff->GetYaxis()->SetTitleSize(0.08);
lHDiff->GetYaxis()->SetLabelSize(0.08);
lHDiff->GetYaxis()->CenterTitle();
lHDiff->GetXaxis()->SetTitleOffset(1.2);
lHDiff->GetXaxis()->SetTitleSize(0.10);
lHDiff->GetXaxis()->SetLabelSize(0.08);
lHDiff->GetXaxis()->SetTitle("#slash{E}_{T} [GeV]");
//lHDiff->GetXaxis()->CenterTitle();
//lHDiff->GetYaxis()->SetTitle(YLabel);
for(int i0 = 0; i0 < lHDiff->GetNbinsX()+1; i0++) {
double lXCenter = lHDiff->GetBinCenter(i0);
double lXVal = iH0 ->GetBinContent(i0);
lXHDiff1->SetBinContent(i0, 1.0);
while(iH1->GetBinCenter(i1) < lXCenter) {i1++;}
if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinContent(i0,(lXVal-iH1->GetBinContent(i0))/(iH1->GetBinContent(i0)));
if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError (i0,iH0->GetBinError(i0)/(iH1->GetBinContent(i0)));
}
lHDiff->SetMarkerStyle(kFullCircle); lHDiff->SetLineColor(kBlack); lHDiff->SetMarkerColor(kBlack);
lHDiff->Draw("E1");
lXHDiff1->Draw("hist sames");
}
示例4: plotVertex
void plotVertex()
{
// Centrality binning
TFile *inf = new TFile("pbpbSpectra.root");
TH1F *hData = (TH1F*)inf->Get("hVzData");
TH1F *hMC = (TH1F*)inf->Get("hVzMC");
hMC->SetLineColor(2);
hMC->SetMarkerColor(2);
hData->Scale(1./hData->Integral());
hMC->Scale(1./hMC->Integral());
makeHistTitle(hMC,"","Primary Vertex Z (cm)","Event Fraction");
TCanvas *c = new TCanvas("c","",600,600);
hMC->Draw();
hData->Draw("same");
TLegend *leg = myLegend(0.37,0.22,0.78,0.41);
leg->AddEntry(hMC,"Reweighted MC","pl");
leg->AddEntry(hData,"Data","pl");
leg->Draw();
c->SaveAs("fig/PrimaryVertex.C");
c->SaveAs("fig/PrimaryVertex.pdf");
c->SaveAs("fig/PrimaryVertex.gif");
}
示例5: PlotScurveGroup
void PlotScurveGroup( Char_t *fname, UInt_t pBeId = 0, UInt_t pFeId = 0, UInt_t pCbc = 0, UInt_t pGroup = 0, UInt_t color = 4 ){
TFile *fin = new TFile( fname );
UInt_t cCh1(0);
for( int i=0; i < 16; i++ ){
cCh1 = i * 16 + pGroup*2;
for( int j = cCh1; j < cCh1 + 2; j++ ){
if( j < 254 ){
TString hname = Form( "h_%02d_%02d_%02d_%03d", pBeId, pFeId, pCbc, j );
TH1F *h = (TH1F *) fin->Get( hname );
h->GetXaxis()->SetRangeUser( 50, 170 );
h->SetLineColor(1);
h->SetMarkerColor(1);
h->SetTitle( Form( "FE(00),CBC(%02d); VCth; Rate", pCbc ) );
TF1 *func = h->GetFunction( Form("f_%s", hname.Data() ) );
if( i == 0 ) h->Draw();
else h->Draw("same");
}
}
}
TString cPadName( fname );
cPadName.ReplaceAll( ".root", Form( "G%d.png", pGroup ) );
gPad->Print( cPadName );
}
示例6: plotBkgModel
void plotBkgModel(TList* HistList, std::string name){
gROOT->SetBatch();
system("mkdir -p plots/ada/bkgMod");
system("mkdir -p plots/grad/bkgMod");
std::string bdt;
TString str = HistList->At(0)->GetName();
if (str.Contains("ada")) bdt="ada";
else if (str.Contains("grad")) bdt="grad";
else std::cout << "Error find BDT type" << std::endl;
assert (str.Contains("ada") || str.Contains("grad"));
gStyle->SetOptStat(0);
gROOT->SetStyle("Plain");
gROOT->ForceStyle();
int color[6] = {kGreen+4,kGreen-1,kGreen,kRed,kRed-2,kRed+4};
TCanvas *canv = new TCanvas();
TLegend *leg = new TLegend(0.45,0.6,0.85,0.85);
leg->SetLineColor(0);
leg->SetFillColor(0);
TPaveText *txt = new TPaveText(0.2,0.1,0.4,0.35,"NDC");
txt->SetFillColor(0);
txt->SetLineColor(0);
txt->AddText("#int L = 4.76 fb^{-1}");
for (int i=1; i<HistList->GetEntries(); i++){
//if (((TH1F*)HistList->At(i))->GetNbinsX()!=((TH1F*)HistList->At(0))->GetNbinsX()) std::cout << "Plot problem: calling plot for histograms with different number of bins" << std::endl;
//assert (((TH1F*)HistList->At(i))->GetNbinsX()==((TH1F*)HistList->At(0))->GetNbinsX());
TH1F *temp = linearBin((TH1F*)HistList->At(i));
temp->Scale(((TH1F*)HistList->At(0))->Integral()/temp->Integral());
temp->SetLineColor(color[i-1]);
temp->SetMarkerStyle(20);
temp->SetMarkerColor(color[i-1]);
temp->SetTitle(Form("Data in sidebands %s %s",bdt.c_str(),name.c_str()));
temp->GetXaxis()->SetTitle("");
temp->GetYaxis()->SetRangeUser(1.0,2.*(((TH1F*)HistList->At(0))->GetMaximum()));
if (i==1) temp->Draw("p");
else temp->Draw("same p");
if (i==1) leg->AddEntry(temp,"Low 3 sideband","lep");
if (i==2) leg->AddEntry(temp,"Low 2 sideband","lep");
if (i==3) leg->AddEntry(temp,"Low 1 sideband","lep");
if (i==4) leg->AddEntry(temp,"High 1 sideband","lep");
if (i==5) leg->AddEntry(temp,"High 2 sideband","lep");
if (i==6) leg->AddEntry(temp,"High 3 sideband","lep");
}
leg->Draw("same");
txt->Draw("same");
canv->SetLogy();
canv->Print(("plots/"+bdt+"/bkgMod/"+name+".png").c_str(),"png");
delete canv;
delete txt;
delete leg;
bkgCalls++;
}
示例7: is
CheckEnabledChannels(const Char_t *runlist)
{
ifstream is(runlist);
Char_t buf[4096];
Int_t run[1024];
Int_t nrun = 0;
while(!is.eof()) {
is.getline(buf, 4096);
if (is.eof()) break;
run[nrun] = atoi(buf);
printf("added run number %d\n", run[nrun]);
nrun++;
}
printf("%d runs added\n", nrun);
is.close();
TH1F *hActive = new TH1F("hActive", "active channels;run;fraction", nrun, 0, nrun);
TH1F *hReadout = new TH1F("hReadout", "good readout;run;fraction", nrun, 0, nrun);
for (Int_t irun = 0; irun < nrun; irun++) {
hr = CheckEnabledChannels(run[irun], kTRUE);
ha = CheckEnabledChannels(run[irun], kFALSE);
hReadout->SetBinContent(irun + 1, hr->Integral());
hActive->SetBinContent(irun + 1, ha->Integral());
hReadout->GetXaxis()->SetBinLabel(irun + 1, Form("%d", run[irun]));
delete hr; delete ha;
}
hReadout->SetMarkerStyle(20);
hReadout->SetMarkerColor(4);
hActive->SetMarkerStyle(25);
hActive->SetMarkerColor(2);
hReadout->Sumw2();
hActive->Sumw2();
hReadout->Divide(hReadout, hActive, 1., 1., "B");
hActive->Scale(1. / 152928.);
hReadout->SetMinimum(0.);
hReadout->SetMaximum(1.);
hReadout->Draw("E");
hActive->Draw("E, same");
TLegend *l = gPad->BuildLegend();
l->SetFillStyle(0);
}
示例8: SetDataStyle
void SetDataStyle(TH1F & ele) {
ele.SetMarkerColor(1);
ele.SetLineColor(1);
ele.SetFillColor(1);
ele.SetFillStyle(0);
ele.SetLineWidth(2);
ele.SetMarkerStyle(20);
ele.SetMarkerSize(1.1);
return;
}
示例9: newDumHistForLegend
TH1F* newDumHistForLegend(const Plot_t* hist) {
// caller is responsible for deleting the hist
TH1F* h = 0;
if (hist!=0) {
TString hn(Form("%s_leg%s",hist->GetName(),
(gPad!=0) ? gPad->GetName() : ""));
h = new TH1F(hn.Data(), "", 1, 0, 1);
h->SetFillColor(hist->GetLineColor());
h->SetLineColor(kWhite);
h->SetMarkerColor(kWhite);
h->SetMarkerStyle(hist->GetMarkerStyle());
h->SetMarkerSize(1);
h->SetBit(TObject::kCanDelete);
}
return h;
}
示例10: getHist
//------------------------------------------------------------//
// Get histogram
//------------------------------------------------------------//
TH1F* getHist(TFile* file, TString pname, TString xtitle,
TString ytitle, int color, int marker)
{
TH1F* hist = (TH1F*) (file->Get(pname.Data())->Clone(Form("%s_%i",pname.Data(),color)));
hist->GetXaxis()->SetTitle(xtitle.Data());
hist->GetYaxis()->SetTitle(ytitle.Data());
hist->SetMarkerStyle(marker);
hist->SetMarkerColor(color);
hist->SetMarkerSize(0.5);
hist->SetLineColor(color);
hist->SetTitle("");
hist->SetStats(0);
hist->GetYaxis()->SetTitleOffset(1.5);
hist->SetLineWidth(2);
return hist;
}
示例11: binomialEfficiency1D
void binomialEfficiency1D(TH1F * numerator,TH1F * denominator){
TH1F * efficiency = numerator->Clone("efficiency");
efficiency->SetXTitle(numerator->GetXaxis()->GetTitle());
efficiency->SetYTitle("#epsilon");
for(int j=0;j<=numerator->GetXaxis()->GetNbins() ;j++){
if(denominator->GetBinContent(j)!=0){
float eff = numerator->GetBinContent(j)/denominator->GetBinContent(j);
float err = sqrt(eff*(1-eff)/denominator->GetBinContent(j));
efficiency->SetBinContent(j,eff);
efficiency->SetBinError(j,err);
cout<<"1Deff "<<j<<" "<<eff<<" +/- "<<err<<endl;
}
}
efficiency->Draw("E");
efficiency->SetMarkerColor(kRed);
efficiency->SetMarkerStyle(23);
efficiency->SetMarkerSize(2);
}
示例12: Ef_Branch
void Ef_Branch(){
gROOT->ProcessLine(" .L tdrstyle.C");
setTDRStyle();
gStyle->SetOptStat(0);
TH1F *IsoPaftl = new TH1F("IsoPaftl","IsoP cut only",100,0,100);
TH1F *IsoPaftlb = new TH1F("IsoPaftlb","IsoP cut only",100,0,100);
//Pt dependency
IsoPaftl->Divide(EffNp,EffN0,1.,1.,"B");
IsoPaftlb->Divide(EffNpb,EffN0b,1.,1.,"B");
TCanvas *c10 = new TCanvas("c10","Branch Out Cuts",900,600);
c10->Divide(3,2);
IsoPaftl->Draw();
IsoPaftlb->Draw("same");
IsoPaftl->SetLineColor(kRed);
IsoPaftl->SetMarkerColor(kRed);
IsoPaftl->SetMarkerSize(0.5);
IsoPaftl->GetYaxis()->SetTitle("Only iso P Cut Efficiency");
IsoPaftl->GetXaxis()->SetTitle("Nvtx");
c10->Update();
c10->SaveAs("LCheck.png");
}
示例13: GoodRun
float GoodRun(int icent, int ihar, int isub, int irun){
float pi = acos(-1);
TF1 *fun = new TF1("fun","pol0",-pi,pi);
TString str;
TFile *fin;
ofstream fout;
if(isub==1){
str = "FVTX1S";
}
else if(isub==2){
str = "FVTX2S";
}
else return -9999;
fin = TFile::Open(Form("Run15pAu200MinBias/output_fvtxwithcntEP_%d.root",GetRun(irun)));
TH1F* hpsi = new TH1F("psi","psi",100,-pi,pi);
for(int ibbcz=0;ibbcz<nbbcz;ibbcz++){
hpsitemp = (TH1F*)fin->Get(Form("psi_%d_%d_%d_%d",icent,ibbcz,ihar,isub));
hpsi->Add(hpsitemp);
}
if(hpsi->GetEntries()>10000){
hpsi->SetMarkerStyle(20);
hpsi->SetMarkerSize(0.6);
hpsi->SetMarkerColor(4);
hpsi->SetMinimum(10);
hpsi->Fit("fun","QR0");
float par=fun->GetParameter(0);
hpsi->SetMaximum(1.5*par);
//hpsi->Draw();
fin->Close();
return fun->GetChisquare()/fun->GetNDF();
}
else{
fin->Close();
return -9999;
}
}
示例14: CheckSDDInESD
//.........这里部分代码省略.........
c2->cd(4);
hdedx6->Draw();
hdedx6->GetXaxis()->SetTitle("dE/dx Lay6");
hdEdxVsMod->SetStats(0);
TCanvas* cdedx=new TCanvas("cdedx","dedx SDD",1400,600);
cdedx->SetLogz();
hdEdxVsMod->Draw("col");
hdEdxVsMod->GetXaxis()->SetTitle("SDD Module Id");
hdEdxVsMod->GetYaxis()->SetTitle("dE/dx (keV/300 #mum)");
hdEdxVsMod->GetYaxis()->SetTitleOffset(1.25);
TCanvas* cv=new TCanvas("cv","Vertex",600,900);
cv->Divide(1,3);
cv->cd(1);
hvx->Draw();
hvx->GetXaxis()->SetTitle("Xv (cm)");
cv->cd(2);
hvy->Draw();
hvy->GetXaxis()->SetTitle("Yv (cm)");
cv->cd(3);
hvz->Draw();
hvz->GetXaxis()->SetTitle("Xv (cm)");
hGoodPMod->SetStats(0);
hGoodPMod->SetTitle("");
TCanvas* ceff0=new TCanvas("ceff0","ModuleIndexInfo",1000,600);
hGoodPMod->Draw("e");
hGoodPMod->GetXaxis()->SetTitle("SDD Module Id");
hGoodPMod->GetYaxis()->SetTitle("Number of tracks");
hMissPMod->SetLineColor(2);
hMissPMod->SetMarkerColor(2);
hMissPMod->SetMarkerStyle(22);
hMissPMod->SetMarkerSize(0.5);
hMissPMod->Draw("psame");
hBadRegMod->SetLineColor(kGreen+1);
hBadRegMod->SetMarkerColor(kGreen+1);
hBadRegMod->SetMarkerStyle(20);
hBadRegMod->SetMarkerSize(0.5);
hBadRegMod->Draw("esame");
hSkippedMod->SetLineColor(kYellow);
hSkippedMod->Draw("esame");
hOutAccMod->SetLineColor(4);
hOutAccMod->Draw("esame");
hNoRefitMod->SetLineColor(6);
hNoRefitMod->Draw("esame");
TLatex* t1=new TLatex(0.7,0.85,"Good Point");
t1->SetNDC();
t1->SetTextColor(1);
t1->Draw();
TLatex* t2=new TLatex(0.7,0.8,"Missing Point");
t2->SetNDC();
t2->SetTextColor(2);
t2->Draw();
TLatex* t3=new TLatex(0.7,0.75,"Bad Region");
t3->SetNDC();
t3->SetTextColor(kGreen+1);
t3->Draw();
ceff0->Update();
TH1F* heff=new TH1F("heff","",260,239.5,499.5);
for(Int_t imod=0; imod<260;imod++){
Float_t numer=hGoodPMod->GetBinContent(imod+1)+hBadRegMod->GetBinContent(imod+1)+hOutAccMod->GetBinContent(imod+1)+hNoRefitMod->GetBinContent(imod+1);
Float_t denom=hAllPMod->GetBinContent(imod+1);
示例15: AnalyseChannelingEfficiency
// Function for the computation of channeling efficiency at various incoming angle
Int_t AnalyseChannelingEfficiency(TTree *fTree,Float_t fChannelingMinimum = 35., Float_t fChannelingMaximum = 70.){
//**//Channeling Gaussian Fit Function
TF1 *vChanneling = new TF1("vChanneling","gaus",fChannelingMinimum,fChannelingMaximum);
vChanneling->SetParNames("Const","Mean","Sigma");
vChanneling->SetLineColor(4);
vChanneling->SetLineStyle(2);
TH2D *hChannelingPlot = new TH2D("hChannelingPlot","Deflection Angle vs. Incoming Angle;Horizontal Incoming Angle [#murad];Horizontal Deflection Angle [#murad]",21,-10.5,10.5,256,-127.5,128.5);
TH1F *hChannelingEfficiency = new TH1F("hChannelingEfficiency","G4Channeling;Horizontal Incoming Angle [#murad];Efficiency [%]",21,-10.5,10.5);
fTree->Draw("-(angXout-angXin):-angXin>>hChannelingPlot");
Double_t vNormalizationToAmorphous = 0.965; // Normalization for channeling efficiency, see PRSTAB 11, 063501 (2008)
for(int i=2;i<=21;i++){
TH1D* h1 = hChannelingPlot->ProjectionY("h1",i,i);
h1->Fit(vChanneling,"QR");
Double_t *vChannelingParameters;
vChannelingParameters = vChanneling->GetParameters();
hChannelingEfficiency->SetBinContent(i,ComputeEfficiency(h1,vChannelingParameters)/vNormalizationToAmorphous);
h1->Delete();
}
hChannelingEfficiency->SetLineColor(3);
hChannelingEfficiency->SetLineStyle(4);
hChannelingEfficiency->SetMarkerColor(3);
hChannelingEfficiency->SetFillStyle(0);
hChannelingEfficiency->SetMarkerStyle(20);
hChannelingEfficiency->Draw("PL");
TGraph* gRoughExperimentalData = new TGraph(11);
gRoughExperimentalData->SetPoint( 0 , -10 , 20 );
gRoughExperimentalData->SetPoint( 1 , -8 , 38 );
gRoughExperimentalData->SetPoint( 2 , -6 , 56 );
gRoughExperimentalData->SetPoint( 3 , -4 , 72 );
gRoughExperimentalData->SetPoint( 4 , -2 , 80 );
gRoughExperimentalData->SetPoint( 5 , 0 , 84 );
gRoughExperimentalData->SetPoint( 6 , 2 , 82 );
gRoughExperimentalData->SetPoint( 7 , 4 , 78 );
gRoughExperimentalData->SetPoint( 8 , 6 , 66 );
gRoughExperimentalData->SetPoint( 9 , 8 , 52 );
gRoughExperimentalData->SetPoint( 10 , 10 , 37 );
gRoughExperimentalData->SetLineColor(4);
gRoughExperimentalData->SetLineStyle(3);
gRoughExperimentalData->SetFillStyle(0);
gRoughExperimentalData->SetFillColor(0);
gRoughExperimentalData->SetMarkerColor(4);
gRoughExperimentalData->SetMarkerStyle(21);
gRoughExperimentalData->SetTitle("Phys. Lett. B 680, 129");
gRoughExperimentalData->Draw("sameCP");
TLegend *aLegend = new TLegend(0.30,0.15,0.55,0.3);
aLegend->AddEntry(hChannelingEfficiency);
aLegend->AddEntry(gRoughExperimentalData);
aLegend->SetFillStyle(0);
aLegend->SetLineColor(0);
aLegend->Draw();
return 0;
}