本文整理汇总了C++中TGraph::SetMinimum方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::SetMinimum方法的具体用法?C++ TGraph::SetMinimum怎么用?C++ TGraph::SetMinimum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph
的用法示例。
在下文中一共展示了TGraph::SetMinimum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: title
//Return a graph of the llscan
TGraph * LLscanResult::GetGraph()
{
double* pvs = new double[parameterValues.size()] ;
double* llvs = new double[parameterValues.size()] ;
double llmax = 0 ;
for(unsigned int i=0; i< parameterValues.size() ; ++i ){
pvs[i] = parameterValues[i] ;
llvs[i] = llvalues_offset[i] ;
if( llvs[i] > llmax ) llmax = llvs[i] ;
}
TGraph* gr = new TGraph( Int_t(parameterValues.size()), pvs, llvs ) ;
//gr->SetTitle("LL Scan for Parameter xxx");
gr->SetMarkerStyle(1);
gr->SetLineWidth(2);
gr->SetMarkerColor(4);
gr->SetLineColor(4);
gr->GetYaxis()->SetRangeUser( 0., llmax*1.2 );
gr->GetYaxis()->SetLimits( 0., llmax*1.2 );
gr->SetMinimum( 0.0 );
gr->SetMaximum( llmax*1.2 );
gr->Draw("ALP");
string title("LL Scan for Parameter ") ;
title+=parameterName.c_str();
gr->SetTitle(title.c_str());
gr->GetXaxis()->SetTitle(parameterName.c_str());
return gr ;
}
示例2: auto_lednic_input_new
void auto_lednic_input_new()
{
gROOT->SetStyle("Plain");
Double_t ZR_min = 0.5;
Double_t ZR_max = 3.0;
const Int_t n = 100;
// lednic_input default values (ZT = 0.01, V = 0.001)
Double_t ZT_min = 0.001;
Double_t ZT_max = 2.0;
Double_t V_min = 0.0001;
Double_t V_max = 0.3;
Double_t x[n], y_min[n], y_max[n], step = (ZR_max - ZR_min)/n;
for (Int_t i = 0; i < n; i++) {
x[i] = ZR_min + i*step;
y_min[i] = CalcLednicR(x[i], ZT_min, V_min);
y_max[i] = CalcLednicR(x[i], ZT_max, V_max);
}
TGraph *g_min = new TGraph(n, x, y_min);
TGraph *g_max = new TGraph(n, x, y_max);
TGraph *gg = new TGraph(2*n);
for (Int_t i = 0; i < n; i++) {
gg->SetPoint(i, x[i], y_max[i]);
gg->SetPoint(n+i, x[n-i-1], y_min[n-i-1]);
}
gg->SetTitle(";r_{0} [fm];R (k = 0.02 GeV/c)");
gg->GetYaxis()->CenterTitle(); gg->SetMinimum(0); gg->SetFillStyle(3003);
gg->Draw("AF");
g_min->Draw("C");
g_max->SetLineStyle(2);
g_max->Draw("C");
TLegend *leg = new TLegend(0.50, 0.70, 0.85, 0.85);
leg->AddEntry(g_min, Form("t_{0} = %.3f fm, v = %.4fc", ZT_min, V_min), "L");
leg->AddEntry(g_max, Form("t_{0} = %.3f fm, v = %.4fc", ZT_max, V_max), "L");
leg->SetFillColor(0);
leg->Draw();
gPad->Print("pp_correl_r0.pdf");
}
示例3: DrawResponsePlot
void DrawResponsePlot( Float_t genMean[], Float_t genSigma[],
Float_t recoMean[], Float_t recoSigma[]) {
gROOT->ProcessLine(".L mystyle.C");
setTDRStyle();
tdrStyle->SetErrorX(0.5);
tdrStyle->SetPadLeftMargin(0.2);
tdrStyle->SetPadRightMargin(0.10);
tdrStyle->SetLegendBorderSize(0);
tdrStyle->SetTitleYOffset(1.3);
// plot full spectrum
TGraphErrors *ptbalanceGen = new TGraphErrors(nZPtBins, pt, genMean,
errpt, genSigma);
TGraphErrors *ptbalanceReco = new TGraphErrors(nZPtBins, pt, recoMean,
errpt, recoSigma);
// plot Zmumu values
Float_t ptmm[9] = { 40.0, 60.0, 100.0, 140.0, 200.0, 250.0,
330.0, 400.0, 520.0 };
Float_t balancemm[9] = { 0.496, 0.568, 0.66, 0.71, 0.75, 0.765,
0.775, 0.79, 0.81 };
TGraph *ptbalancemm = new TGraph( 9, ptmm, balancemm);
ptbalanceGen->GetXaxis()->SetTitle("p_{T}^{Z} (GeV/c)");
ptbalanceGen->GetYaxis()->SetTitle("p_{T}^{jet} / p_{T}^{Z}");
ptbalanceGen->SetMarkerStyle(22);
ptbalanceGen->SetMarkerSize(1.2);
ptbalanceGen->SetTitle("");
ptbalanceGen->SetMinimum(0.3);
ptbalanceReco->SetMarkerColor(2);
ptbalanceReco->SetLineColor(2);
ptbalanceReco->SetMarkerStyle(22);
ptbalanceReco->SetMarkerSize(1.2);
ptbalanceReco->SetMinimum(0.3);
ptbalancemm->SetMarkerStyle(24);
ptbalancemm->SetMarkerSize(1.2);
ptbalancemm->SetMinimum(0.3);
ptbalancemm->SetMarkerColor(4);
ptbalancemm->SetLineColor(4);
TCanvas c1("c1","",500,500);
ptbalanceGen->Draw("APL");
ptbalanceReco->Draw("PL");
ptbalancemm->Draw("PL");
leg_hist = new TLegend(0.6,0.7,0.89,0.89);
leg_hist->AddEntry( ptbalanceGen, "Generator level", "l");
leg_hist->AddEntry( ptbalanceReco,"Calorimeter level","l");
leg_hist->AddEntry( ptbalancemm,"Z#rightarrow#mu#mu","l");
leg_hist->SetFillColor(0);
leg_hist->Draw();
c1.SaveAs("PtBalanceVsPt.eps");
c1.SaveAs("PtBalanceVsPt.gif");
c1.SaveAs("PtBalanceVsPt.root");
c1.Close();
delete leg_hist;
delete ptbalanceGen;
delete ptbalanceReco;
delete ptbalancemm;
}
示例4: makeDeadEcalEff
// -------------------------
// -- Functions --
// -------------------------
void makeDeadEcalEff() {
gStyle->SetOptStat(0);
TCanvas *c1 = new TCanvas("c1","A Simple Graph with error bars",200,10,700,500);
const Int_t nbins = 6;
TString lifetime = "0.5";
// TString lifetime = "1";
// TString lifetime = "5";
Float_t masses [nbins] = {103, 164, 246, 328, 408, 488};
Float_t effOld0p5ns [nbins] = {0.884, 0.958, 0.889, 0.895, 0.897, 0.909};
Float_t effDPG0p5ns [nbins] = {0.877, 0.958, 0.894, 0.884, 0.901, 0.888}; // Federico's DPG map
Float_t effOld1ns [nbins] = {0.896, 0.93, 0.912, 0.944, 0.918, 0.914};
Float_t effDPG1ns [nbins] = {0.899, 0.92, 0.912, 0.926, 0.90, 0.901}; // Federico's DPG map
Float_t effOld5ns [nbins] = {0.921, 0.938, 0.942, 0.92, 0.936, 0.942};
Float_t effDPG5ns [nbins] = {0.909, 0.913, 0.934, 0.911, 0.93, 0.936}; // Federico's DPG map
Float_t* effOld;
Float_t* effDPG;
if (lifetime=="0p5") {
effOld = effOld0p5ns;
effDPG = effDPG0p5ns;
}
if (lifetime=="1") {
effOld = effOld1ns;
effDPG = effDPG1ns;
}
if (lifetime=="5") {
effOld = effOld5ns;
effDPG = effDPG5ns;
}
for (int i=0; i<nbins; i++) {
effOld[i] = 1.0 - effOld[i];
effDPG[i] = 1.0 - effDPG[i];
}
TGraph *grEffOld = new TGraph(nbins, masses, effOld);
TGraph *grEffDPG = new TGraph(nbins, masses, effDPG);
grEffOld->SetMarkerStyle(21); // 21: square
grEffOld->SetMarkerSize(0.8);
grEffOld->SetMarkerColor(kBlue);
grEffOld->SetLineWidth(2);
grEffOld->SetMinimum(0);
grEffOld->SetMaximum(0.25);
// grEffOld->SetTitle(";chargino mass;efficiency of dead ECAL veto");
grEffOld->SetTitle(";chargino mass;1 - #epsilon");
grEffOld->Draw("AP");
// grEffOld->Draw("P");
grEffDPG->SetMarkerStyle(26); // 26: hollow triangle
grEffDPG->SetMarkerSize(0.8);
grEffDPG->SetMarkerColor(kRed);
grEffDPG->SetLineWidth(2);
grEffDPG->Draw("P, same");
TLine l;
l.SetLineColor(kRed);
l.DrawLine(2.5,1.0,6.5,1.0);
TLegend leg2(0.50,0.6,0.85,0.8);
leg2.AddEntry(grEffOld, "old map (" + lifetime + " ns)", "pl");
leg2.AddEntry(grEffDPG, "ECAL DPG map (" + lifetime + " ns)", "pl");
leg2.SetBorderSize(0);
leg2.SetFillStyle(1001);
leg2.SetFillColor(kWhite);
leg2.SetBorderSize(0);
leg2.SetTextFont(gStyle->GetTitleFont());
leg2.Draw();
TPaveText* pt = new TPaveText(0.50, 0.82, 0.90, 0.88, "NDC");
pt->SetFillStyle(0);
pt->SetBorderSize(0);
pt->SetTextFont(gStyle->GetTitleFont());
pt->AddText("CMS Preliminary, #sqrt{s} = 8 TeV");
// pt->Draw();
c1->SetLogy(0);
c1->Print("deadEcalEff" + lifetime + "ns.pdf");
c1->Clear();
return;
}
示例5: makePlots
//.........这里部分代码省略.........
}
///Pet
PetTreeNu->SetBranchAddress("Ex",&xx);
PetTreeNu->SetBranchAddress("Pb",&yy);
nentries = PetTreeNu->GetEntries();
for (Long64_t i=0;i<nentries;i++) {
PetTreeNu->GetEntry(i);
ProbNu[2]->SetPoint( i, xx, yy);
}
PetTreeANu->SetBranchAddress("Ex",&xx);
PetTreeANu->SetBranchAddress("Pb",&yy);
nentries = PetTreeANu->GetEntries();
for (Long64_t i=0;i<nentries;i++) {
PetTreeANu->GetEntry(i);
ProbANu[2]->SetPoint( i, xx, yy);
}
for( int k=0; k < 3; ++k)
{
ProbNu[k]->SetLineColor(4);
ProbNu[k]->SetMarkerColor(4);
ProbNu[k]->SetMarkerStyle(7);
ProbNu[k]->SetFillColor(10);
ProbNu[k]->SetMaximum(1.0);
ProbNu[k]->SetMinimum(0.0);
TString yaxis = ((TObjString*)v_Labels->At(k))->GetString();
ProbNu[k]->GetYaxis()->SetTitle( yaxis.Data() );
ProbNu[k]->GetXaxis()->SetTitle("E [eV]");
ProbNu[k]->GetYaxis()->CenterTitle(true);
ProbNu[k]->GetXaxis()->CenterTitle(true);
ProbNu[k]->GetXaxis()->SetLabelOffset(0.007);
ProbNu[k]->GetXaxis()->SetLabelSize(0.08);
ProbNu[k]->GetXaxis()->SetTitleSize(0.07);
ProbNu[k]->GetXaxis()->SetTitleOffset(0.9);
ProbNu[k]->GetXaxis()->SetLabelFont(42);
ProbNu[k]->GetYaxis()->SetLabelOffset(0.007);
ProbNu[k]->GetYaxis()->SetLabelSize(0.08);
ProbNu[k]->GetYaxis()->SetLabelFont(42);
ProbNu[k]->GetYaxis()->SetTitleSize(0.09);
ProbNu[k]->GetYaxis()->SetTitleOffset(0.45);
ProbNu[k]->GetYaxis()->SetTitleFont(42);
ProbANu[k]->SetMarkerColor(42);
ProbANu[k]->SetMarkerStyle(23);
ProbANu[k]->SetMarkerSize(0.3);
ProbANu[k]->SetFillColor(10);
ProbANu[k]->SetMaximum(1.0);
ProbANu[k]->SetMinimum(0.0);
}
leg->AddEntry( ProbNu[0], "#nu");
leg->AddEntry( ProbANu[0], "#bar{#nu}");
leg->SetBorderSize(0);
示例6: noAveBounceStdy
//.........这里部分代码省略.........
#ifdef DEBUG_SHIFTS
TCanvas* cdbgsh = new TCanvas;
cdbgsh->cd();
Float_t xsm[NSnConstants::kNsamps], rsmp[NSnConstants::kNsamps];
for (Int_t i=0; i<NSnConstants::kNsamps; ++i) {
xsm[i] = i;
rsmp[i] = samples[ch][i];
}
TGraph* gsmp = new TGraph(NSnConstants::kNsamps, xsm, rsmp);
TGraph* gps = new TGraph(NSnConstants::kNsamps, xsm,
&(pedsubs[ch][0]));
TGraph* gph = new TGraph(NSnConstants::kNsamps, xsm,
&(psshift[ch][0]));
TGraph* gfl = new TGraph(NSnConstants::kNsamps, xsm,
&(filtered[ch][0]));
TGraph* gen = new TGraph(NSnConstants::kNsamps, xsm,
&(envelope[ch][0]));
gsmp->SetMarkerStyle(7);
gsmp->SetMarkerColor(kBlack);
gsmp->SetLineColor(kBlack);
gps->SetMarkerStyle(7);
gps->SetMarkerColor(kRed);
gps->SetLineColor(kRed);
gph->SetMarkerStyle(7);
gph->SetMarkerColor(kAzure-7);
gph->SetLineColor(kAzure-7);
gfl->SetMarkerStyle(7);
gfl->SetMarkerColor(kGreen+2);
gfl->SetLineColor(kGreen+2);
gen->SetMarkerStyle(7);
gen->SetMarkerColor(kViolet-1);
gen->SetLineColor(kViolet-1);
gsmp->SetMinimum(-1500);
gsmp->SetMaximum(2500);
Printf("ch%d: shift=%d, len=%d",
ch, shift[ch], len[ch]);
gsmp->Draw("apc");
gps->Draw("pc");
gph->Draw("pc");
gfl->Draw("pc");
gen->Draw("pc");
cdbgsh->WaitPrimitive();
delete gsmp; delete gps; delete gph; delete gfl; delete gen;
delete cdbgsh;
#endif
}
if (shiftmaxb!=shiftminb) {
maxdt = (shiftmaxb - shiftminb) / (2.0*kSmpRate);
} else {
maxdt = NSnConstants::kNsamps / (2.0*kSmpRate);
}
const Float_t* chdat(0), * xcdat(0);
for (Int_t ch=0; ch<NSnConstants::kNchans; ++ch) {
if (fitOpt==0) {
chdat = &(filtered[ch][0]);
} else if (fitOpt==10) {
chdat = &(envelope[ch][0]);
} else {
Fatal("noAveBounceStdy","Unknown fitOpt [%d]",fitOpt);
}
for (Int_t xc=0; xc<ch; ++xc) {
if (fitOpt==0) {
xcdat = &(filtered[xc][0]);
示例7: histos_pde_two
void histos_pde_two(){
std::string material[3] = {"lxe","lxe_tpb","lyso"};
std::string interaction[3] = {"","_noCher","_noScint"};
double sigmas[3][3][20]; // [mat][inter][pde]
double pdeValues[20];
char pde[5];
TCanvas *c1 = new TCanvas("c1","multipads",900,700);
for(int mat=0; mat<3;mat++){
for(int inter=0; inter<2;inter++){
for(int i=5;i<=100;i+=5){
pdeValues[i/5-1] = i;
//There is an error with lsyo noScint pde 0.05
if((mat==2 && inter==2) && i==5)){
continue;
}
sprintf(pde, "%.2lf", i/100.0);
if(i==100){
sprintf(pde, "0%.2lf", i/100.0);
}
std::string path = "/home/jmbenlloch/next/petalo/work/histo/pde/";
std::string fileName = path + material[mat] + interaction[inter] + std::string("_PHYS_QE_") + std::string(pde) + std::string("_SPTR_0_ASIC_0_DT300_histos.root"); std::string(Form("%d", 1));
std::cout << fileName << std::endl;
TFile *fIn = new TFile(fileName.c_str(), "read");
TH1F *h1 = (TH1F*) fIn->Get("DTOF.DTOF3");
TF1* gauF1 = new TF1("gauF1","gaus",-20,20);
TF1* gauF2 = new TF1("gauF2","gaus",-60,60);
TF1 *total = new TF1("total","gaus(0)+gaus(3)",-50,50);
h1->Scale(1/h1->Integral(), "width");
Double_t par[6];
h1->Fit(gauF1,"R");
h1->Fit(gauF2,"R+");
//Do not plot
h1->GetFunction("gauF1")->SetBit(TF1::kNotDraw);
h1->GetFunction("gauF2")->SetBit(TF1::kNotDraw);
gauF1->GetParameters(&par[0]);
gauF2->GetParameters(&par[3]);
total->SetParameters(par);
h1->Fit(total,"R+");
h1->Draw();
std::string histo = path + material[mat] + interaction[inter] + std::string("_pde_") + pde + std::string(".png");
std::cout << histo << std::endl;
c1->Print(histo.c_str());
std::cout << "PDE: " << pde << "sigma: " << h1->GetFunction("gauF1")->GetParameter(2) << std::endl;
sigmas[mat][inter][i/5-1] = h1->GetFunction("gauF1")->GetParameter(2);
fIn->Close();
}
}
}
c1->Close();
TCanvas *c2 = new TCanvas("c2","multipads",900,700);
TGraph *gLxe = new TGraph(20, pdeValues, sigmas[0][0]);
gLxe->SetLineColor(kRed);
gLxe->SetLineWidth(2);
TGraph *gTpb = new TGraph(20, pdeValues, sigmas[1][0]);
gTpb->SetLineColor(kBlue);
gTpb->SetLineWidth(2);
TGraph *gLyso = new TGraph(20, pdeValues, sigmas[2][0]);
gLyso->SetLineColor(kGreen);
gLyso->SetLineWidth(2);
gLyso->Draw();
gLyso->SetTitle("");
gLyso->GetXaxis().SetTitle("PDE (%)");
gLyso->GetXaxis()->SetLimits(0.,100.);
gLyso->GetYaxis().SetTitle("CRT (ps)");
gLyso->SetMinimum(0.);
gLyso->SetMaximum(50.);
gTpb->Draw("same");
gLxe->Draw("same");
TLegend *leg = new TLegend(0.7, 0.7, 0.9, 0.9);
leg->SetFillColor(0);
leg->AddEntry(gLxe, "LXe", "lp");
leg->AddEntry(gTpb, "LXe-TPB", "lp");
leg->AddEntry(gLyso, "LYSO", "lp");
leg->Draw("same");
c2->Print("/home/jmbenlloch/next/petalo/work/histo/pde/pde.png");
TCanvas *c3 = new TCanvas("c3","multipads",900,700);
TGraph *gLxe_noCher = new TGraph(20, pdeValues, sigmas[0][1]);
//.........这里部分代码省略.........
示例8: MUONStatusMapEvolution
//.........这里部分代码省略.........
int year(2016);
if ( runs[0] <= 139699 ) year=2010;
if ( runs[0] <= 176000 ) year=2011;
if ( runs[0] <= 195344 ) year = 2012;
if ( runs[0] <= 198000 ) year = 2013;
if ( runs[0] <= 246994 ) year = 2015;
TString defaultOCDB;
defaultOCDB.Form("local:///cvmfs/alice-ocdb.cern.ch/calibration/data/%d/OCDB",year);
// defaultOCDB.Form("alien://folder=/alice/data/%d/OCDB?cacheFold=/local/cdb",year);
AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
AliCDBManager::Instance()->SetRun(0);
TList glist;
glist.SetOwner(kTRUE);
TGraph* gnbad = new TGraph(runs.size());
gnbad->SetName("nbad");
glist.Add(gnbad);
TGraph* gnbadped = new TGraph(runs.size());
gnbadped->SetName("nbadped");
glist.Add(gnbadped);
TGraph* gnbadocc = new TGraph(runs.size());
gnbadocc->SetName("nbadocc");
glist.Add(gnbadocc);
TGraph* gnbadhv = new TGraph(runs.size());
gnbadhv->SetName("nbadhv");
glist.Add(gnbadhv);
TGraph* gnmissing = new TGraph(runs.size());
gnmissing->SetName("nmissing");
glist.Add(gnmissing);
TGraph* gnreco = new TGraph(runs.size());
gnreco->SetName("nreco");
glist.Add(gnreco);
TGraph* gnbadlv = new TGraph(runs.size());
gnbadlv->SetName("nbadlv");
glist.Add(gnbadlv);
for ( std::vector<int>::size_type i = 0; i < runs.size(); ++i )
{
Int_t runNumber = runs[i];
Int_t nbadped;
Int_t nbadhv;
Int_t nbadlv;
Int_t nbadocc;
Int_t nmissing;
Int_t nreco;
Int_t nbad = GetBadChannels(runNumber,nbadped,nbadhv,nbadlv,nbadocc,nmissing,nreco);
gnbad->SetPoint(i,runNumber,nbad);
gnbadped->SetPoint(i,runNumber,nbadped);
gnbadhv->SetPoint(i,runNumber,nbadhv);
gnbadlv->SetPoint(i,runNumber,nbadlv);
gnbadocc->SetPoint(i,runNumber,nbadocc);
gnmissing->SetPoint(i,runNumber,nmissing);
gnreco->SetPoint(i,runNumber,nreco);
}
TIter next(&glist);
TGraph* g;
Int_t index(0);
TFile f(outfile,"recreate");
Int_t color[] = { 1 , 2 , 3 , 4, 6, 8, 7 };
Int_t marker[] = { 28 , 24 , 23 , 26, 30, 5, 32 };
while ( ( g = static_cast<TGraph*>(next() ) ) )
{
g->GetXaxis()->SetNdivisions(505);
g->GetXaxis()->SetNoExponent();
g->SetMinimum(0);
g->GetYaxis()->SetNoExponent();
g->SetLineColor(color[index]);
g->SetMarkerStyle(marker[index]);
g->SetMarkerColor(color[index]);
g->SetMarkerSize(1.0);
++index;
g->Write();
}
f.Close();
}
示例9: plotLinearityPS_AllTypes_ERUpgrade
//.........这里部分代码省略.........
gNom->SetPoint(i, eT/GeV, (e-eNominal)/eNominal - alpha);
gPSUp->SetPoint(i, eT/GeV, (e-eVarPSUp)/eVarPSUp - alpha);
gPSDown->SetPoint(i, eT/GeV, (e-eVarPSDown)/eVarPSDown - alpha);
gNom_UC->SetPoint(i, eT/GeV, (e-eNominal_UC)/eNominal_UC - alpha);
gPSUp_UC->SetPoint(i, eT/GeV, (e-eVarPSUp_UC)/eVarPSUp_UC - alpha);
gPSDown_UC->SetPoint(i, eT/GeV, (e-eVarPSDown_UC)/eVarPSDown_UC - alpha);
gNom_CV->SetPoint(i, eT/GeV, (e-eNominal_CV)/eNominal_CV - alpha);
gPSUp_CV->SetPoint(i, eT/GeV, (e-eVarPSUp_CV)/eVarPSUp_CV - alpha);
gPSDown_CV->SetPoint(i, eT/GeV, (e-eVarPSDown_CV)/eVarPSDown_CV - alpha);
}
i++;
if( logx )
e *= exp(eStep);
else
e += eStep;
}
TCanvas* canvas = new TCanvas();
if( logx )
canvas->SetLogx();
if( !subtractAverage ) {
gPSUp->SetMaximum(alpha+.005);
gPSUp->SetMinimum(alpha+-.007);
} else {
gPSUp->SetMaximum(.005);
gPSUp->SetMinimum(-.007);
}
char grafname[99];
sprintf(grafname,"Linearity (%s), PS contribution, #eta = %4.2f", year.c_str(), eta);
gPSUp->SetTitle(grafname);
// Electrons
gPSUp->GetXaxis()->SetTitleOffset(1.2*gNom->GetXaxis()->GetTitleOffset());
gPSUp->GetYaxis()->SetTitleOffset(1.2*gNom->GetYaxis()->GetTitleOffset());
gPSUp->GetXaxis()->SetTitle("E_{T} [GeV]");
gPSUp->GetYaxis()->SetTitle("#alpha(E_{T})");
gPSUp->SetLineWidth(2);
gPSUp->SetLineStyle(2);
gPSUp->SetLineColor(4);
gPSUp->Draw("AL");
gPSDown->SetLineWidth(2);
gPSDown->SetLineStyle(3);
gPSDown->SetLineColor(4);
gPSDown->Draw("L");
gNom->SetLineWidth(2);
gNom->SetLineColor(4);
gNom->Draw("L");
// Unconverted
gPSUp_UC->SetLineWidth(2);
示例10: EnergyDependentCorrections
//.........这里部分代码省略.........
}
infile.close();
infile.open(TString::Format("%s/Asymmetries/AllCorr_OctetAsymmetries_AnaChC_Octets_%i-%i_BinByBin.txt",getenv("ANALYSIS_RESULTS"),60,121));
while (infile >> en >> val >> err) {
AllCorr2012.push_back(val);
}
infile.close();
std::vector <Double_t> en_Th;
std::vector <Double_t> corr_Th;
std::vector <Double_t> en_MC2011;
std::vector <Double_t> corr_MC2011;
std::vector <Double_t> en_MC2012;
std::vector <Double_t> corr_MC2012;
for (int i=2;i<80;++i) {
if (UnCorr2011[i]!=0.) en_Th.push_back(energy[i]), corr_Th.push_back(100.*(TheoryCorr2011[i]/UnCorr2011[i]-1.));
if (TheoryCorr2011[i]!=0.) en_MC2011.push_back(energy[i]), corr_MC2011.push_back(100.*(AllCorr2011[i]/TheoryCorr2011[i]-1.));
if (TheoryCorr2012[i]!=0.) en_MC2012.push_back(energy[i]), corr_MC2012.push_back(100.*(AllCorr2012[i]/TheoryCorr2012[i]-1.));
}
TCanvas *c2 = new TCanvas("c2","c2",1200,800);
c2->Divide(2,1);
c2->cd(1);
TGraph *gTheory = new TGraph(en_Th.size(),&en_Th[0],&corr_Th[0]);
gTheory->SetTitle("Theory Corrections vs. Energy");
gTheory->SetMarkerStyle(kFullCircle);
gTheory->SetMinimum(-5.);
gTheory->SetMaximum(0.);
gTheory->SetLineWidth(3);
gTheory->SetLineColor(kBlack);
gTheory->GetYaxis()->SetTitle("#DeltaA/A (%)");
gTheory->GetYaxis()->CenterTitle();
gTheory->GetXaxis()->SetTitle("Energy (keV)");
gTheory->GetXaxis()->CenterTitle();
gTheory->Draw("AL");
c2->cd(2);
TMultiGraph *mg = new TMultiGraph();
mg->SetTitle("MC Corrections vs. Energy");
TGraph *gMC2011 = new TGraph(en_MC2011.size(),&en_MC2011[0],&corr_MC2011[0]);
gMC2011->SetMarkerStyle(kFullCircle);
//gMC2011->SetMinimum(-10.);
//gMC2011->SetMaximum(6.);
gMC2011->SetLineWidth(3);
gMC2011->SetLineColor(kBlue);
gMC2011->GetYaxis()->SetTitle("#DeltaA/A (%)");
gMC2011->GetYaxis()->CenterTitle();
gMC2011->GetXaxis()->SetTitle("Energy (keV)");
gMC2011->GetXaxis()->CenterTitle();
//gMC2011->Draw("AC");
TGraph *gMC2012 = new TGraph(en_MC2012.size(),&en_MC2012[0],&corr_MC2012[0]);
gMC2012->SetMarkerStyle(kFullCircle);
//gMC2012->SetMinimum(-10.);
//gMC2012->SetMaximum(6.);
gMC2012->SetLineWidth(3);
gMC2012->SetLineColor(kGreen);
//gMC2012->GetYaxis()->SetTitle("#DeltaA/A (%)");
//gMC2012->GetYaxis()->CenterTitle();
//gMC2012->GetXaxis()->SetTitle("Energy (keV)");
//gMC2012->GetXaxis()->CenterTitle();
//gMC2012->Draw("AC");
mg->Add(gMC2011);
mg->Add(gMC2012);
mg->SetMinimum(-8.);
mg->SetMaximum(6.);
mg->Draw("AC");
mg->GetYaxis()->SetTitle("#DeltaA/A (%)");
mg->GetYaxis()->CenterTitle();
mg->GetXaxis()->SetTitle("Energy (keV)");
mg->GetXaxis()->CenterTitle();
gPad->Modified();
TLegend *leg = new TLegend(0.55,0.75,0.85,0.85);
leg->AddEntry(gMC2011,"2011-2012","l");
leg->AddEntry(gMC2012,"2012-2013","l");
leg->SetTextSize(0.05);
leg->Draw("SAME");
}
示例11: Loop
//.........这里部分代码省略.........
<<" ntrkrecor[i] = " << ntrkrecor[i]
<<" ntrk[i] = " << ntrk[i]
<<" eff = " << trkeff[i] << endl;
// <<" responce = " << responceVSptF[i] << endl;
}
}
// calculate efficiency vs Eta and full graph
cout <<" Efficiency vs Eta " << endl;
for(Int_t i = 0; i < netabins; i++) {
if(ntrketa[i] > 0) {
trketaeff[i] = 1.*ntrketareco[i]/ntrketa[i];
etrketaeff[i] = sqrt( trketaeff[i]*(1.-trketaeff[i])/ntrketa[i] );
responceVSetaF[i] = responceVSeta[i]/ntrketarecor[i];
cout <<" i = " << i
<<" eta interval = " << eta[i] <<" - " << eta[i+1]
<<" ntrketareco[i] = " << ntrketareco[i]
<<" ntrketa[i] = " << ntrketa[i]
<<" eff = " << trketaeff[i]
<<" responce = " << responceVSetaF[i] << endl;
}
}
// create graph
// vs pT
setTDRStyle(1,0);
TCanvas* c1 = new TCanvas("X","Y",1);
TGraph *grpt = new TGraphErrors(nptbins,ptgr,trkeff,eptgr,etrkeff);
TAxis* xaxis = grpt->GetXaxis();
grpt->GetXaxis()->SetTitle("p_{T}, GeV");
grpt->GetYaxis()->SetTitle("track finding efficiency");
xaxis->SetLimits(0.8,50.);
grpt->SetMarkerStyle(21);
grpt->SetMaximum(0.9);
grpt->SetMinimum(0.6);
grpt->Draw("AP");
TLatex *t = new TLatex();
t->SetTextSize(0.042);
// TLegend *leg = new TLegend(0.5,0.2,0.7,0.35,NULL,"brNDC");
// leg->SetFillColor(10);
// leg->AddEntry(grpt,"#pi ^{+} and #pi ^{-}","P");
// leg->Draw();
t->DrawLatex(1.,0.85,"CMSSW169, single #pi ^{+} and #pi ^{-}. |#eta ^{#pi}|< 2.5");
c1->SaveAs("trkeff_vs_pt.gif");
c1->SaveAs("trkeff_vs_pt.eps");
setTDRStyle(0,0);
// vs Eta
TCanvas* c2 = new TCanvas("X","Y",1);
TGraph *greta = new TGraphErrors(netabins,etagr,trketaeff,eetagr,etrketaeff);
TAxis* xaxis = greta->GetXaxis();
greta->GetXaxis()->SetTitle("#eta");
greta->GetYaxis()->SetTitle("track finding efficiency");
xaxis->SetLimits(0.0,2.4);
greta->SetMarkerStyle(21);
greta->SetMaximum(1.0);
greta->SetMinimum(0.50);
greta->Draw("AP");
TLatex *t = new TLatex();
t->SetTextSize(0.042);
// TLegend *leg = new TLegend(0.5,0.2,0.7,0.35,NULL,"brNDC");
// leg->SetFillColor(10);
// leg->AddEntry(greta,"#pi ^{+} and #pi ^{-}","P");
// leg->Draw();
t->DrawLatex(0.3,0.87,"CMSSW217, single #pi ^{+} and #pi ^{-}");
t->DrawLatex(0.8,0.85,"1 < p^{#pi^{#pm}} < 50 GeV");
c2->SaveAs("trkeff_vs_eta.gif");
示例12: Loop
//.........这里部分代码省略.........
// hEnTrkNotInter[ih]->Write();
// hEnTrkInter[ih]->Write();
MeanNotInter[ih] = hEnTrkNotInter[ih]->GetMean();
MeanErrorNotInter[ih] = hEnTrkNotInter[ih]->GetMeanError();
MeanInter[ih] = hEnTrkInter[ih]->GetMean();
MeanErrorInter[ih] = hEnTrkInter[ih]->GetMeanError();
leakage[ih] = MeanInter[ih]/MeanNotInter[ih];
eleakage[ih] = leakage[ih] *
sqrt( (MeanErrorNotInter[ih]/MeanNotInter[ih])*(MeanErrorNotInter[ih]/MeanNotInter[ih]) +
(MeanErrorInter[ih]/MeanInter[ih])*(MeanErrorInter[ih]/MeanInter[ih]));
cout <<" ieta = " << ih <<" MeanNotInter = " << MeanNotInter[ih] <<" +/- " << MeanErrorNotInter[ih]
<<" MeanInter = " << MeanInter[ih] <<" +/- " << MeanErrorInter[ih]
<<" leakage = " << leakage[ih] <<" +/- " << eleakage[ih] << endl;
}
TGraph *gleak = new TGraphErrors(netabins,etagr,leakage, eetagr,eleakage);
TGraph *eMeanNotInter = new TGraphErrors(netabins,etagr,MeanNotInter, eetagr,MeanErrorNotInter);
TGraph *eMeanInter = new TGraphErrors(netabins,etagr,MeanInter, eetagr,MeanErrorInter);
// vs Eta
setTDRStyle(0,0);
TCanvas* c3 = new TCanvas("X","Y",1);
c3->Divide(1,2);
c3->cd(1);
TAxis* xaxis = eMeanNotInter->GetXaxis();
eMeanNotInter->GetXaxis()->SetTitle("#eta");
eMeanNotInter->GetYaxis()->SetTitle("calo E_{T}^{raw reco} in cone 0.5/p_{T}^{MC}");
xaxis->SetLimits(0.0,2.4);
eMeanNotInter->SetMarkerStyle(21);
// eMeanNotInter->SetMaximum(0.95);
// eMeanNotInter->SetMinimum(0.55);
eMeanNotInter->SetMaximum(1.);
eMeanNotInter->SetMinimum(0.);
eMeanNotInter->Draw("AP");
eMeanInter->SetMarkerStyle(24);
eMeanInter->Draw("P");
TLatex *t = new TLatex();
t->SetTextSize(0.08);
t->DrawLatex(0.2,0.9,"CMSSW_1_6_9");
TLegend *leg = new TLegend(0.2,0.2,0.8,0.4,NULL,"brNDC");
leg->SetFillColor(10);
leg->AddEntry(eMeanNotInter,"recontructed tracks 2 < p_{T}^{#pi^{#pm}} < 10 GeV","P");
leg->AddEntry(eMeanInter,"not reconstructed tracks 2 < p_{T}^{#pi^{#pm}} < 10 GeV","P");
leg->Draw();
c3->cd(2);
TAxis* xaxis = gleak->GetXaxis();
gleak->GetXaxis()->SetTitle("#eta");
gleak->GetYaxis()->SetTitle("ratio = <E_{T for lost tracks}^{raw reco} / E_{T for found tracks}^{raw reco}>");
xaxis->SetLimits(0.0,2.4);
gleak->SetMarkerStyle(21);
gleak->SetMaximum(1.0);
// leak->SetMinimum(0.7);
gleak->SetMinimum(0.5);
gleak->Draw("AP");
TLatex *t = new TLatex();
t->SetTextSize(0.08);
// t->DrawLatex(0.1,0.75,"<E_{T for lost tracks}^{raw reco} / E_{T for found tracks}^{raw reco}> for p_{T}^{#pi^{#pm}} >2 GeV");
c3->SaveAs("eMean_vs_eta_pt2-10.gif");
c3->SaveAs("eMean_vs_eta_pt2-10.eps");
// original distribtions
setTDRStyle(0,0);
gStyle->SetOptFit(0);
TCanvas* c4 = new TCanvas("X","Y",1);
示例13: AnalysisSparse
//.........这里部分代码省略.........
printf(" SKIP true");
value = -1;
}
gry_true[count] = value;
gry_true_eff[count] = gry_true[count]/gry2[count];
// Propagation of uncertainty (A/B)
Double_t AAA = gry_true[count];
Double_t AAAE = TMath::Sqrt(AAA);
Double_t BBB = gry2[count];
Double_t BBBE = TMath::Sqrt(BBB);
Double_t EEE = TMath::Sqrt((AAAE/AAA)*(AAAE/AAA)+(BBBE/BBB)*(BBBE/BBB));
EEE = EEE*gry_true_eff[count];
gry_true_effE[count] = EEE;
}
Printf("=> %6.4f", ptmean);
count++;
}
new TCanvas();
TGraph *gr = new TGraph(count, grx, gry);
gr->SetMarkerStyle(8);
gr->SetMarkerColor(hh->GetLineColor());
gr->GetXaxis()->SetTitle("p_{t}, GeV/c");
gr->SetTitle(Form("raw phi, %s", gtitle.Data()));
gr->Draw("AP");
cc3 = new TCanvas();
TGraph *gr3 = new TGraph(count, grx, gry3);
gr3->SetMarkerStyle(22);
gr3->SetMarkerColor(kBlue+1);
gr3->GetXaxis()->SetTitle("p_{t}, GeV/c");
gr3->SetTitle(Form("SIG / BKG, %s", gtitle.Data()));
gr3->SetMinimum(0);
gr3->Draw("AP");
cc4 = new TCanvas();
TGraph *gr4 = new TGraph(count, grx, gry4);
gr4->SetMarkerStyle(23);
gr4->SetMarkerColor(kBlue-1);
gr4->GetXaxis()->SetTitle("p_{t}, GeV/c");
gr4->SetTitle(Form("Significance, %s", gtitle.Data()));
gr4->SetMinimum(0);
gr4->Draw("AP");
ccc = new TCanvas("ccc","ccc",0,0,900,300);
ccc->Divide(2, 1, 0.001, 0.001);
ccc->cd(1); gr3->Draw("AP");
ccc->cd(2); gr4->Draw("AP");
TString blabla = "mc";
if (!mc) blabla = "data";
// gr3->SaveAs(Form("SB_%s_%s.C", blabla.Data(), grapht.Data()));
// gr4->SaveAs(Form("Sig_%s_%s.C", blabla.Data(), grapht.Data()));
// ccc->SaveAs(Form("%s_%s_2.eps", blabla.Data(), grapht.Data()));
// c->SaveAs(Form("%s_%s_0.eps", blabla.Data(), grapht.Data()));
// c2->SaveAs(Form("%s_%s_1.eps", blabla.Data(), grapht.Data()));
// cc3->SaveAs(Form("%s_%s_2.eps", blabla.Data(), grapht.Data()));
// gr3->SaveAs(Form("sig_bck_%s_%s.C", blabla.Data(), grapht.Data()));
if (mc) {
new TCanvas();
TGraph *gr2 = new TGraph(count, grx, gry2);
gr2->SetMarkerStyle(8);
gr2->SetMarkerColor(hg->GetLineColor());
示例14: makePlots
//.........这里部分代码省略.........
TString cname = TString("Ratio") + TString("_") + TString(model) + TString("_") + TString(config);
TCanvas * c1 = new TCanvas( cname.Data(), "track/shower ratio", 206,141,722,575);
c1->SetBorderSize(2);
TLegend * leg = new TLegend(0.18,0.64,0.44,0.87);
leg->SetBorderSize(0);
leg->SetTextFont(22);
leg->SetTextSize(0.062);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(0);
int labelpos = 0;
for( int k = 0; k < max; ++k )
{
TGraph * gg = (TGraph*)v_Graphs->At(k);
gg->SetMarkerStyle(25);
gg->SetFillColor(10);
gg->SetLineColor(linecolor[k]);
gg->SetLineWidth(linewidth[k]);
gg->SetLineStyle(linestyle[k]);
gg->SetMaximum(MAXY);
gg->SetMinimum(1.6);
gg->GetXaxis()->SetLimits( 0.0, 0.055 );
gg->GetXaxis()->SetTitle("sin^{2}#theta_{13}");
gg->GetXaxis()->CenterTitle(true);
gg->GetXaxis()->SetLabelFont(42);
gg->GetXaxis()->SetLabelOffset(0.006);
gg->GetXaxis()->SetLabelSize(0.06);
gg->GetXaxis()->SetTitleSize(0.06);
gg->GetXaxis()->SetTickLength(0.05);
gg->GetXaxis()->SetTitleOffset(1.07);
gg->GetXaxis()->SetTitleFont(42);
gg->GetXaxis()->SetNdivisions(509);
gg->GetYaxis()->SetTitle("R");
gg->GetYaxis()->CenterTitle(true);
gg->GetYaxis()->SetNdivisions(509);
gg->GetYaxis()->SetLabelFont(42);
gg->GetYaxis()->SetLabelOffset(0.007);
gg->GetYaxis()->SetLabelSize(0.06);
gg->GetYaxis()->SetTitleSize(0.06);
gg->GetYaxis()->SetTitleOffset(0.93);
gg->GetYaxis()->SetTitleFont(42);
if ( ((k+1) % 2) == 0 )
{
TString alpha = ((TObjString*)v_Labels->At(labelpos))->GetString();
leg->AddEntry( gg, alpha.Data(),"l");
labelpos+=1;
}
c1->cd();
示例15: DrawWalk
//------------------------------------------------------------------------
void DrawWalk()
{
Int_t npeaks = 20;
Int_t sigma=3.;
Bool_t down = false;
Int_t index[20];
Char_t buf1[10], buf2[10];
TCanvas *c1 = new TCanvas("c1", "c1",0,48,1280,951);
gStyle->SetOptStat(0);
c1->Divide(4,3);
for (Int_t i=0; i<12; i++)
{
c1->cd(i+1);
sprintf(buf1,"T0_C_%i_CFD",i+1);
sprintf(buf2,"CFDvsQTC%i",i+1);
cout<<buf1<<" "<<buf2<<endl;
TH2F *qtc_cfd = (TH2F*) gFile->Get(buf2);
TH1F *cfd = (TH1F*) gFile->Get(buf1);
// cfd->Draw();
TSpectrum *s = new TSpectrum(2*npeaks,1);
Int_t nfound = s->Search(cfd,sigma," ",0.05);
cout<<"Found "<<nfound<<" peaks sigma "<<sigma<<endl;;
if(nfound!=0){
Float_t *xpeak = s->GetPositionX();
TMath::Sort(nfound, xpeak, index,down);
Float_t xp = xpeak[index[0]];
Int_t xbin = cfd->GetXaxis()->FindBin(xp);
Float_t yp = cfd->GetBinContent(xbin);
cout<<"xbin = "<<xbin<<"\txpeak = "<<xpeak[1]<<"\typeak = "<<yp<<endl;
Float_t hmax = xp+10*sigma;
Float_t hmin = xp-10*sigma;
cout<<hmin<< " "<<hmax<<endl;
// cfd->GetXaxis()->SetRange(hmin,hmax);
// TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
// cfd->Fit("g1","R");
Int_t hminbin= qtc_cfd->GetXaxis()->GetFirst();
Int_t hmaxbin= qtc_cfd->GetXaxis()->GetLast();
Int_t nbins= qtc_cfd->GetXaxis()->GetNbins();
cout<<" qtc_cfd "<<hminbin<<" "<<hmaxbin<<" "<<nbins<<endl;
// qtc_cfd->Draw();
TProfile *pr_y = qtc_cfd->ProfileX();
Float_t maxHr=pr_y->GetBinCenter(hmaxbin);
pr_y->SetMaximum(hmax);
pr_y->SetMinimum(hmin);
Int_t np=nbins/20;
Double_t *xx = new Double_t[np];
Double_t *yy = new Double_t[np];
Int_t ng=0;
Double_t yg=0;
for (Int_t ip=1; ip<nbins; ip++)
{
if(ip%20 != 0 ) {
if (pr_y->GetBinContent(ip) !=0)
yg +=pr_y->GetBinContent(ip);
// cout<<ng<<" "<<pr_y->GetBinContent(ip)<<" "<<yg<<endl;
ng++;}
else {
xx[ip/20] = Float_t (pr_y->GetBinCenter(ip));
yy[ip/20] = yg/ng;
yg=0;
ng=0;
cout<<ip<<" "<<ip/20<<" "<< xx[ip/20]<<" "<< yy[ip/20]<<endl;
}
}
TH2F *hr = new TH2F("hr"," ",np,0,maxHr, np, hmin, hmax);
hr->Draw();
TGraph *gr = new TGraph(np,xx,yy);
gr->SetMinimum(hmin);
gr->SetMaximum(hmax);
gr->SetMarkerStyle(20);
gr->Draw("P");
// delete [] xx;
// delete [] yy;
// pr_y->Rebin(10);
// pr_y->Draw();
}
}
}