本文整理汇总了C++中TMultiGraph::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TMultiGraph::Draw方法的具体用法?C++ TMultiGraph::Draw怎么用?C++ TMultiGraph::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMultiGraph
的用法示例。
在下文中一共展示了TMultiGraph::Draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawZShiftsOmega
void drawZShiftsOmega(){
TCanvas* c1 = new TCanvas("c1","c1",600,600);
TMultiGraph* mgr = new TMultiGraph();
mgr->SetTitle("Omega: dz_{0}");
TGraphErrors* gr_dz0_sig = new TGraphErrors("ZShiftSigOmega.txt","%lg %*lg %lg %lg");
gr_dz0_sig->SetMarkerStyle(21);
gr_dz0_sig->SetMarkerColor(kBlue);
mgr->Add(gr_dz0_sig);
TGraphErrors* gr_dz0_asc = new TGraphErrors("ZShiftAscOmega.txt","%lg %*lg %lg %lg");
gr_dz0_asc->SetMarkerStyle(21);
gr_dz0_asc->SetMarkerColor(kRed);
mgr->Add(gr_dz0_asc);
mgr->Draw("ASP");
c1->Update();
c1->Print("c1.png");
c1->Print("c1.root");
return;
}
示例2: GE11sEfficiencyPlots_3Sector_DividerCurrent
//.........这里部分代码省略.........
cout<<"3==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
if (!File3.good()) break;
NT_Detector3_HV.push_back(current);
NT_Detector3_Eff.push_back(eff);
NT_Detector3_EffErr.push_back(efferr);
NT_Detector3->Fill(current,eff,efferr);
nlines++;
}
while (1)
{
File4 >> current >> eff >> efferr;
cout<<"4==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
if (!File4.good()) break;
NT_Detector4_HV.push_back(current);
NT_Detector4_Eff.push_back(eff);
NT_Detector4_EffErr.push_back(efferr);
NT_Detector4->Fill(current,eff,efferr);
nlines++;
}
File1.close();
File2.close();
File3.close();
File4.close();
TCanvas* c1 = new TCanvas("c1","",1);
c1->Range(0,0,1,1);
TPad *pad = new TPad("pad","",0,0,1,1);
pad->SetGrid();
pad->Draw();
pad->cd();
TF1 *f1 = new TF1("f1","[0]+(0.989)/([1]+exp(-[2]*(x-697.3)))",650,815);
TF1 *f2 = new TF1("f2","(0.968)/([1]+exp(-[2]*(x-713)))",650,815);
TF1 *f3 = new TF1("f3","(0.973)/([1]+exp(-[2]*(x-725)))",650,820);
TF1 *f4 = new TF1("f4","(0.985)/([1]+exp(-[2]*(x-614)))",565,720);
// f3->SetParameters(1.,1.,1.);
// create first graph
TGraphErrors *gr1 = new TGraphErrors(NT_Detector1_HV.size());
for(unsigned int i=0;i<NT_Detector1_HV.size();i++)
{
gr1->SetPoint(i,NT_Detector1_HV[i],NT_Detector1_Eff[i]);
gr1->SetPointError(i,0,4*NT_Detector1_EffErr[i]);
}
gr1->SetMarkerColor(kGreen+3);
gr1->SetLineColor(kGreen+3);
gr1->SetMarkerStyle(21);
gr1->GetXaxis()->SetTitle("Current Supplied To HV Divider (#mu A)");
gr1->GetYaxis()->SetTitle("Efficiency");
gr1->SetTitle(GraphTitle);
f1->SetLineColor(kGreen+3);
gr1->Fit("f1","R");
// create first graph
TGraphErrors *gr5 = new TGraphErrors(NT_Detector2_HV.size());
for(unsigned int i=0;i<NT_Detector2_HV.size();i++)
{
gr5->SetPoint(i,NT_Detector2_HV[i],NT_Detector2_Eff[i]);
gr5->SetPointError(i,0,4*NT_Detector2_EffErr[i]);
示例3: TCanvas
void FindConstant::drawChi2AndFitPol2(const std::vector<double>& res, const std::vector<double>& chi2)
{
TCanvas* c1 = new TCanvas();
std::stringstream streamForEResExtraction;
streamForEResExtraction << scintillatorID << "_beta_" << energyResolution;
std::vector<double> Chi2ToFit, ResToFit;
for (size_t i = 0; i < chi2.size(); i++) {
if (chi2[i] < bestChi2 + 50.0) {
std::cout << chi2[i] << std::endl;
Chi2ToFit.push_back( chi2[i] );
ResToFit.push_back( res[i] );
}
}
TMultiGraph* m = new TMultiGraph();
TGraph* gr = new TGraph(Chi2ToFit.size(), &ResToFit[0], &Chi2ToFit[0]);
gr->SetTitle("Chi2 vs #beta");
gr->GetXaxis()->SetTitle("#beta (#sqrt{keV})");
gr->GetYaxis()->SetTitle("Chi2 for best fit");
gr->SetLineColor(2);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->Draw("AP");
gStyle->SetOptFit(1);
quadraticFit = new TF1("quadraticFit", "[0]* (x - [1])**2 + [2]", ResToFit[0], ResToFit[ ResToFit.size() - 1 ] );
quadraticFit->SetParName(0, "a");
quadraticFit->SetParName(1, "x_min");
quadraticFit->SetParName(2, "y_min");
quadraticFit->SetParameter(1, energyResolution);
quadraticFit->SetParameter(2, bestChi2);
gr->Fit(quadraticFit, "R");
quadraticFit->Draw("same");
std::stringstream buf;
buf << sourcePosition;
c1->SaveAs( ("FitResults" + filePath + buf.str() + "/Chi2Plot_strip_fitRegion_" + streamForEResExtraction.str() + expHistoTitle + ".png") );
m->Add(gr);
energyResolution = quadraticFit->GetParameter(1);
TGraph* grFull = new TGraph(chi2.size(), &res[0], &chi2[0]);
grFull->SetTitle("Chi2 vs #beta");
grFull->GetXaxis()->SetTitle("#beta (#sqrt{keV})");
grFull->GetYaxis()->SetTitle("Chi2 for best fit");
grFull->SetLineColor(2);
grFull->SetLineWidth(4);
grFull->SetMarkerColor(4);
grFull->SetMarkerStyle(21);
m->Add(grFull);
m->Draw("AP");
c1->SaveAs( ("FitResults" + filePath + buf.str() + "/Chi2Plot_strip_" + streamForEResExtraction.str() + expHistoTitle + ".png") );
delete gr;
delete c1;
}
示例4: plotS11Baby
void plotS11Baby() {
const int numFiles=8;
char filename[180];
int antFiles[numFiles][2]={{1,17},{1,18},{1,28},{1,27},{2,7},{2,8},{5,8},{5,9}};
int whichOpen[numFiles]={1,1,2,2,5,5,6,6};
int plotThis[numFiles]={1,1,1,1,2,2,2,2};
char *graphDesc[numFiles]={"Office (1)","Office (2)","Outside (1)","Outside (2)","Salt Day I (1)","Salt Day I (2)","Salt Day III (1)","Salt Day III (2)"};
TGraph *grOpen[NUM_OPENS];
TGraph *grOpenPower[NUM_OPENS];
for(int i=0;i<NUM_OPENS;i++) {
grOpen[i]=getOpenWave(i);
// grOpenPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grOpen[i],8);
grOpenPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grOpen[i],32,1024);
Double_t *freq=grOpenPower[i]->GetX();
// cout << i << "\t" << grOpenPower[i]->GetN() << "\t" << freq[1]-freq[0] << "\n";
}
TGraph *grAnt[numFiles];
TGraph *grAntPower[numFiles];
TGraph *grAntRatio[numFiles];
TGraph *grAntTrans[numFiles];
for(int i=0;i<numFiles;i++) {
sprintf(filename,"/home/rjn/saltStuff/hockley2009/disk_%d/TEK%05d.txt",antFiles[i][0],antFiles[i][1]);
grAnt[i]=getWaveFromTxt(filename);
grAnt[i]=cropLikeOpen(grAnt[i],whichOpen[i]);
if(i<3) {
// grAntPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
}
else {
grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
// TGraph *grTemp=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
// grAntPower[i]=FFTtools::smoothFFT(grTemp,2);
}
grAntRatio[i]=FFTtools::dbGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
grAntTrans[i]=FFTtools::ratioSubtractOneGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
// Double_t *freq=grAntPower[i]->GetX();
// cout << i << "\t" << freq[1]-freq[0] << "\n";
// cout << i << "\t" << grAntPower[i]->GetN() << "\t" << freq[1]-freq[0] << "\n";
// cout << grAntRatio[i] << "\t" << grAntTrans[i] << endl;
}
TCanvas *canWave = new TCanvas("canBabyWave","canBabyWave",800,800);
canWave->Divide(1,numFiles);
for(int i=0;i<numFiles;i++) {
canWave->cd(i+1);
grAnt[i]->SetLineColor(getNiceColour(i));
grAnt[i]->Draw("al");
grAnt[i]->SetTitle(graphDesc[i]);
grAnt[i]->GetXaxis()->SetTitle("Time (s)");
grAnt[i]->GetYaxis()->SetTitle("Voltage (V)");
}
TCanvas *can = new TCanvas("canBaby","canBaby",900,600);
can->Divide(1,2);
for(int subPad=1;subPad<=2;subPad++) {
can->cd(subPad);
TMultiGraph *mg = new TMultiGraph();
TLegend *leggy = new TLegend(0.2,0.2,0.4,0.5);
leggy->SetBorderSize(0);
leggy->SetFillColor(0);
leggy->SetFillStyle(0);
for(int i=0;i<numFiles;i++) {
if(plotThis[i]!=subPad) continue;
grAntRatio[i]->SetLineColor(getNiceColour(i));
grAntRatio[i]->SetLineWidth(2);
mg->Add(grAntRatio[i],"l");
leggy->AddEntry(grAntRatio[i],graphDesc[i],"l");
}
mg->Draw("al");
mg->SetTitle("S11 Measurements Baby");
mg->SetMaximum(0);
mg->SetMinimum(-20);
mg->GetXaxis()->SetRangeUser(0,1000);
mg->GetXaxis()->SetTitle("Frequency (MHz)");
mg->GetYaxis()->SetTitle("Reflected Power (dB)");
leggy->Draw();
}
TCanvas *canTrans = new TCanvas("canTransBaby","canTransBaby",900,600);
canTrans->Divide(1,2);
for(int subPad=1;subPad<=2;subPad++) {
canTrans->cd(subPad);
TMultiGraph *mg = new TMultiGraph();
TLegend *leggy2 = new TLegend(0.2,0.55,0.4,0.85);
leggy2->SetBorderSize(0);
leggy2->SetFillColor(0);
leggy2->SetFillStyle(0);
for(int i=0;i<numFiles;i++) {
if(plotThis[i]!=subPad) continue;
grAntTrans[i]->SetLineColor(getNiceColour(i));
grAntTrans[i]->SetLineWidth(2);
mg->Add(grAntTrans[i],"l");
leggy2->AddEntry(grAntTrans[i],graphDesc[i],"l");
}
//.........这里部分代码省略.........
示例5: result_JES_akPu4PF_
//.........这里部分代码省略.........
25};
Double_t Graph_fey1003[4] = {
0.01053149,
0.005298861,
0.004412705,
0.002663901};
gre = new TGraphErrors(4,Graph_fx1003,Graph_fy1003,Graph_fex1003,Graph_fey1003);
gre->SetName("Graph");
gre->SetTitle("some title_2");
gre->SetFillColor(1);
gre->SetFillStyle(0);
gre->SetLineColor(3);
gre->SetMarkerColor(3);
TH1F *Graph_Graph1003 = new TH1F("Graph_Graph1003","some title_2",100,0,110);
Graph_Graph1003->SetMinimum(0.9335092);
Graph_Graph1003->SetMaximum(1.011502);
Graph_Graph1003->SetDirectory(0);
Graph_Graph1003->SetStats(0);
ci = TColor::GetColor("#000099");
Graph_Graph1003->SetLineColor(ci);
Graph_Graph1003->GetXaxis()->SetLabelFont(42);
Graph_Graph1003->GetXaxis()->SetLabelSize(0.035);
Graph_Graph1003->GetXaxis()->SetTitleSize(0.035);
Graph_Graph1003->GetXaxis()->SetTitleFont(42);
Graph_Graph1003->GetYaxis()->SetLabelFont(42);
Graph_Graph1003->GetYaxis()->SetLabelSize(0.035);
Graph_Graph1003->GetYaxis()->SetTitleSize(0.035);
Graph_Graph1003->GetYaxis()->SetTitleFont(42);
Graph_Graph1003->GetZaxis()->SetLabelFont(42);
Graph_Graph1003->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1003->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1003->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1003);
multigraph->Add(gre,"");
multigraph->Draw("AP");
multigraph->GetXaxis()->SetTitle("Centrality");
multigraph->GetXaxis()->SetLabelFont(42);
multigraph->GetXaxis()->SetLabelSize(0.035);
multigraph->GetXaxis()->SetTitleSize(0.035);
multigraph->GetXaxis()->SetTitleFont(42);
multigraph->GetYaxis()->SetTitle("#mu_{Reco./Gen.}");
multigraph->GetYaxis()->SetLabelFont(42);
multigraph->GetYaxis()->SetLabelSize(0.035);
multigraph->GetYaxis()->SetTitleSize(0.035);
multigraph->GetYaxis()->SetTitleFont(42);
TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(1001);
TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
entry->SetLineColor(1);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
entry=leg->AddEntry("Graph","lightJets","l");
entry->SetLineColor(2);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
entry=leg->AddEntry("Graph","bJets","l");
entry->SetLineColor(3);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
leg->Draw();
TLatex * tex = new TLatex(0.25,0.7,"#bf{#color[2]{|#eta_{jet}|<2.0 &75<refpt<120}}");
tex->SetNDC();
tex->SetTextFont(43);
tex->SetTextSize(24);
tex->SetLineWidth(2);
tex->Draw();
TPaveText *pt = new TPaveText(0.3750575,0.9365254,0.6249425,0.995,"blNDC");
pt->SetName("title");
pt->SetBorderSize(0);
pt->SetFillColor(0);
pt->SetFillStyle(0);
pt->SetTextFont(42);
AText = pt->AddText("JES_akPu4PF");
pt->Draw();
Can_result_0->Modified();
Can_result_0->cd();
Can_result_0->SetSelected(Can_result_0);
}
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:result_JES_akPu4PF_(refpt>+75+&&+refpt+<+120)&&(abs(refeta)<2)_Centrality.C
示例6: draw_cross
//.........这里部分代码省略.........
yerr1[3] = 0.0080;
yerr1[4] = 0.0124;
yerr1[5] = 0.0127;
yerr2[0] = 0.097;
yerr2[1] = 0.071;
yerr2[2] = 0.0617;
yerr2[3] = 0.0313;
yerr2[4] = 0.0292;
yerr2[5] = 0.0264;
yerr3[0] = 0.0174;
yerr3[1] = 0.0362;
yerr3[2] = 0.0559;
yerr3[3] = 0.0611;
yerr3[4] = 0.0864;
yerr3[5] = 0.1384;
*/
TMultiGraph *mg = new TMultiGraph("mg","Q2 resolution");
TGraphErrors *g1 = new TGraphErrors(7,x,y1,0,0);
TGraphErrors *g2 = new TGraphErrors(7,x,y2,0,0);
// TGraphErrors *g3 = new TGraphErrors(6,x,y3,0,yerr3);
TCanvas *c11 = new TCanvas("c11","counts vs T",600,600);
// g1->Draw("A*");
g1->SetName("g1");
g1->SetTitle("");
g1->SetMarkerStyle(21);
g1->SetMarkerColor(1);
g1->SetMarkerSize(1.0);
g1->SetDrawOption("AP");
g1->SetLineColor(1);
g1->SetLineWidth(0);
g1->SetFillStyle(0);
g1->GetYaxis()->SetTitle("Q2 resolution (%)");
g1->GetXaxis()->SetTitle("Angle bin (deg)");
g2->SetName("g2");
g2->SetTitle("");
g2->SetMarkerStyle(22);
g2->SetMarkerSize(1.5);
g2->SetMarkerColor(4);
g2->SetDrawOption("P");
g2->SetLineColor(2);
g2->SetLineWidth(0);
g2->SetFillStyle(0);
/*
g3->SetName("g3");
g3->SetMarkerStyle(22);
g3->SetMarkerSize(0.8);
g3->SetMarkerColor(4);
g3->SetDrawOption("P");
g3->SetLineColor(7);
g3->SetLineWidth(2);
g3->SetFillStyle(0);
*/
//mg->Add(g3);
示例7: PlotRanges
/**
The purpose of this function is to conveniently plot an event. Each event is plotted on a TCanvas. Divided into as many pads as there are panels. Each pad is a TMultiGraph with a TLegend, and shows the channels of the digitizer connected to the lines of that panel. The grouping into pads must not necessarily be according to panels, but in any other prefered way.
@param a_channels - a vector of a vector of samples, containing all 32 channels
@ param a_channelsToPadsAssociation - a map from std::string, which is the name of the panel (or group of channels) to be assigned to each pad to a vector if integers, which is the list of channels indices corresponding to indices of channels in the paramater a_channels to associate to a pad
@param sEventTitle - a string containing the title of the event (for example, the time stamp)
*/
void RangePlotter::PlotRanges(Channels_t& a_channels, Range_t& a_channelsToPadsAssociation, std::string sEventTitle)
{
// printf("Plotting\n");
//m_pCanvas->Clear();
m_pCanvas->SetTitle(sEventTitle.c_str());
int iPadCounter = 0;
if(0 == m_vpMultiGraph.size())
{
MakePads(a_channelsToPadsAssociation.size());
for (auto& rangeIt: a_channelsToPadsAssociation)
{
TMultiGraph* pMg = new TMultiGraph();
m_vpMultiGraph.push_back(std::unique_ptr<TMultiGraph>(pMg));
// m_pCanvas->cd(iPadCounter + 1);
ChangePad(iPadCounter);
int i = 0;
auto legend = new TLegend(0.8,0.8,1,1, "Channels");
m_vpLegends.push_back(std::unique_ptr<TLegend>(legend));
printf("printing panel %s\n", rangeIt.first.c_str());
for (auto& chanIt: rangeIt.second)
{
int iNumOfSamples = a_channels[chanIt].size();
TGraph* pGr = new TGraph(iNumOfSamples);
std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
for (int counter = 0; counter < iNumOfSamples; counter++)
{
pGr->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[chanIt][counter]));
}
m_vpGraph[chanIt] = pGr;
pGr->SetLineColor(m_colors[i%(sizeof(m_colors)/sizeof(int))]);
pGr->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + std::string("chan_") + std::to_string(chanIt)).c_str());
std::string sGraphTitle = std::string("Channel ") + std::to_string(chanIt);
pGr->SetTitle(sGraphTitle.c_str());
legend->AddEntry(pGr,std::to_string(chanIt).c_str(), "l");
pMg->Add(pGr);
i++;
}
if(Configuration::Instance().ShowTriggerInWaveformsStep())
{
int iNumOfSamples = a_channels[a_channels.size() - 1].size();
m_vpGraphPrecisionTrigger = new TGraph(iNumOfSamples);
std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
for (int counter = 0; counter < iNumOfSamples; counter++)
{
m_vpGraphPrecisionTrigger->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[a_channels.size() - 1][counter]));
}
m_vpGraphPrecisionTrigger->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + "_Trig").c_str());
m_vpGraphPrecisionTrigger->SetTitle("Trigger");
legend->AddEntry(m_vpGraphPrecisionTrigger,"Trigger", "l");
pMg->Add(m_vpGraphPrecisionTrigger);
}
std::string sMultiGraphTitle = std::string("Panel ") + rangeIt.first;
pMg->SetTitle(sMultiGraphTitle.c_str());
pMg->Draw("AL");
pMg->GetXaxis()->SetTitle("Time [nanoseconds]");
pMg->GetXaxis()->CenterTitle();
pMg->GetYaxis()->SetTitle("Voltage [volts]");
pMg->GetYaxis()->CenterTitle();
gPad->Modified();
pMg->SetMinimum(m_fMinVoltage);
pMg->SetMaximum(m_fMaxVoltage);
legend->Draw();
iPadCounter++;
}
m_pCanvas->Update();
}
else
{
// printf("Plottin again\n");
for (auto& rangeIt: a_channelsToPadsAssociation)
{
printf("Panel %s\n", rangeIt.first.c_str());
m_pCanvas->cd(iPadCounter + 1);
for (auto& chanIt: rangeIt.second)
{
// printf("Chanenl %d\n", chanIt);
//TODO: num of samples is constant per run at least!
m_vpGraph[chanIt]->SetLineWidth(1);
int iNumOfSamples = a_channels[chanIt].size();
std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
for (int counter = 0; counter < iNumOfSamples; counter++)
//.........这里部分代码省略.........
示例8: Eff_Doping
void Eff_Doping(){ // name of file
using namespace std;
double bias=30;
int i=0; // used to name the TGraphs
TCanvas *c1 = new TCanvas("c1","c1",600,400);
TPad *pad1 = new TPad("pad1","",0,0,1,1);
TLegend *leg = new TLegend(.80,.70,.85,.87);
TGraph *gr[4]; // defines array to number of TGraphs
TMultiGraph *mg = new TMultiGraph(); // create multigraph
for (double fluence=13;fluence<=15;fluence+=1){ // loop to create multigraph for select bias values
TString str =TString::Format("/afs/cern.ch/work/m/mbucklan/TCAD/SimpleCMOS/DepletionSimRemesh_3pixels_Rad/Neffextraction_3pixel_yCut_bias=%.1f_pitch=15.0_Fluence=1e+%.0f.txt",bias,fluence); // does some magic, creates string with name of file
if (i==4){
i++;
}
gr[i] = new TGraph(str,"%lg %lg"); // creates graph called gr and reads file
TString str1 =TString::Format("1e%.0f n_{eq} cm^{-2}",fluence); // creates string with bias value
gr[i]->SetTitle(str1); // sets title to string
gr[i]->SetLineColor(i+1); // sets line colour, changes for each graph
mg->Add(gr[i]); // adds graph to multigraph
leg->AddEntry(gr[i],str1,"l");
i++;
}
pad1->Draw();
pad1->cd();
pad1->SetTickx(1); //draws ticks on top side x axis
pad1->SetTicky(1); //draws ticks on right hand side y axis
gPad->Update();
mg->Draw("AL"); // draws multigraph
// Make the graph look fancy...ish
mg->GetXaxis()->SetTitle("Depth (#mum)");
mg->GetYaxis()->SetTitle("Effective Doping Concentration (cm^{-3})");
TString str2 =TString::Format("Effective Doping Concentration for 3 Pixel 100#mum Thick Sensor at %.0fV, Resistivity=100#Omegacm",bias); // does some magic, creates string with name of file
mg->GetHistogram()->SetTitle(str2);
mg->SetMinimum(-2e12);
leg->SetTextSize(0.03);
leg->Draw();
}
示例9: plot
//.........这里部分代码省略.........
countMass++;
}
}
for(int i = 0 ; i < nMassPoints ; i++){
cout << "Mass " << X[i] << endl;
cout << "Exp " << Y[i] << endl;
cout << "Obs " << obsY[i] << endl;
eY1sH[i] = eY1sH[i]-Y[i];
eY1sL[i] = fabs(eY1sL[i]-Y[i]);
eY2sH[i] = eY2sH[i]-Y[i];
eY2sL[i] = TMath::Max( TMath::Abs(eY2sL[i]-Y[i]), eY1sL[i] );
if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
(i==1 || i==4) ){
eY1sH[i] = eY1sH[i-1];
eY2sH[i] = eY2sH[i-1];
}
if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauNSVfitMass")!=string::npos &&
i==4 )
eY2sH[i] = eY2sH[i-1];
if((string(stream.Data())).find("ele")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
i==6 )
eY2sH[i] = eY2sH[7]-Y[7];
cout << "1s Up " << eY1sH[i] << endl;
cout << "1s Down " << eY1sL[i] << endl;
}
TMultiGraph *mg = new TMultiGraph();
mg->SetTitle("");
TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL ,eX1sL , eX1sL, eX1sL);
TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL, eX1sL, eY1sL, eY1sH);
TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX2sL, eX2sL, eY2sL, eY2sH);
TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, eX1sL ,eX1sL , eX1sL, eX1sL);
oneSigma->SetMarkerColor(kBlack);
oneSigma->SetMarkerStyle(kFullCircle);
oneSigma->SetFillColor(kGreen);
oneSigma->SetFillStyle(1001);
twoSigma->SetMarkerColor(kBlack);
twoSigma->SetMarkerStyle(kFullCircle);
twoSigma->SetFillColor(kYellow);
twoSigma->SetFillStyle(1001);
expected->SetMarkerColor(kBlack);
expected->SetMarkerStyle(kFullCircle);
expected->SetMarkerSize(1.5);
expected->SetLineColor(kBlack);
expected->SetLineWidth(2);
observed->SetMarkerColor(kBlue);
observed->SetMarkerStyle(1);
observed->SetLineColor(kBlue);
observed->SetLineWidth(4);
mg->Add(twoSigma);
mg->Add(oneSigma);
mg->Add(expected);
mg->Add(observed);
mg->Draw("ALP3");
c1->cd();
gPad->Modified();
mg->GetXaxis()->SetLimits(105,140);
mg->GetYaxis()->SetTitleOffset(0.97);
mg->SetMinimum(0.);
mg->SetMaximum(xMax);
mg->GetXaxis()->SetTitle("m_{H} (GeV)");
mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");
if((string(stream.Data())).find("ele")!=string::npos )
leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{e}#tau_{had}}");
else if((string(stream.Data())).find("mu")!=string::npos )
leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{#mu}#tau_{had}}");
leg->AddEntry(expected,"Expected CLs limit","P");
leg->AddEntry(observed,"Observed CLs limit","L");
leg->Draw();
TF1 *line = new TF1("line","1",100,150);
line->SetLineColor(kRed);
line->SetLineWidth(2);
line->Draw("SAME");
gPad->SaveAs("submit/grid/limits_"+stream+"_"+variable+".png");
}
示例10: AnalyzeClipping
void AnalyzeClipping(TString inputWaveName = "sum trigger input ch5 960mV",
TString outputWaveName = "sum trigger output ch5 - 2V clip - 960mV input",
Double_t inputDelay = 1.1E-8, Double_t lowerCut = 16E-9, Double_t upperCut = 23E-9,
const char *inFile = "Data.root",const char *WaveformsFile = "Waveforms.root") {
//try to access data file and in case of failure return
if(gSystem->AccessPathName(inFile,kFileExists)) {
cout << "Error: file " << inFile << " does not exsist. Run .x DataParse.C to create it" << endl;
return;
}
TFile *f = TFile::Open(inFile);
TFolder *dataSet;
TString dataFolderS = "SumTriggerBoardData";
dataFolderS.Append(";1");
dataSet = (TFolder*)f->Get(dataFolderS);
cout << dataSet << endl;
cout << dataSet->GetName() << endl;
Int_t nScope = 150; // number of measurements done by the scope evey time
//try to access waveforms file and in case of failure return
if(gSystem->AccessPathName(WaveformsFile,kFileExists)) {
cout << "Error: file " << WaveformsFile << " does not exsist. Run .x WaveformsFileMaker.C to create it" << endl;
return;
}
TFile *f = TFile::Open(WaveformsFile);
TList *listOfKeys = f->GetListOfKeys();
Int_t numberOfKeys = listOfKeys->GetEntries();
TList *listOfGraphs = new TList();
// if the waveform file name begins with the string "comparator" it goes in this list
TList *listOfCompWaves = new TList();
// if the waveform file name begins with the string "sum output" it goes in this list
TList *listOfAdderWaves = new TList();
for(Int_t i = 0; i < numberOfKeys; i++) {
TString *keyName = new TString(listOfKeys->At(i)->GetName());
TTree *tree = (TTree*)f->Get(keyName->Data());
Float_t x = 0;
Float_t y = 0;
tree->SetBranchAddress("x",&x);
tree->SetBranchAddress("y",&y);
Int_t nentries = tree->GetEntries();
TString *gName = new TString(keyName->Data());
gName->Append(" graph");
TGraphErrors *gWave = new TGraphErrors(nentries);
gWave->SetName(gName->Data());
gWave->SetTitle(gName->Data());
gWave->GetXaxis()->SetTitle("Time");
gWave->GetYaxis()->SetTitle("Voltage");
for (Int_t j = 0; j < nentries; j++) {
tree->GetEntry(j);
gWave->SetPoint(j,x,y);
}
listOfGraphs->Add(gWave);
}
// Global variables
Double_t *xInput, *xOutput, *yInput, *yOutput;
// V input 960 mV
TString path = "Clipping/Output width analysis/Channel 5/V input 960mV/";
TGraphErrors *gClip960mV = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope);
gClip960mV->SetMarkerStyle(20);
gClip960mV->SetMarkerSize(0.8);
gClip960mV->GetXaxis()->SetTitle("V clipping (mV)");
gClip960mV->GetYaxis()->SetTitle("Output FWHM (ns)");
TCanvas *cClip960mV = new TCanvas("cClip960mV","Output FWHM in function of V clipping",800,600);
gClip960mV->Draw("APEL");
// Expected output FWHM
TGraphErrors *gInput960mV = listOfGraphs->FindObject("sum trigger input ch5 960mV graph");
Double_t *xClip = gClip960mV->GetX();
Int_t nClip = gClip960mV->GetN();
cout << "nClip = " << nClip << endl;
Long64_t graphPoints = gInput960mV->GetN();
yInput = gInput960mV->GetY();
xInput = gInput960mV->GetX();
vector<double> xFirst(nClip);
vector<double> xLast(nClip);
Double_t half;
Int_t flag = 0;
//.........这里部分代码省略.........
示例11: main
int main(int argc, char** argv)
{
std::string plot_type = argv[1];
//"HVScan";
// std::string plot_type = "AngScanHigh";
// std::string plot_type = "scanX0_HVLow_50";
// std::string plot_type = "scanX0_HVLow_20";
std::cout<<plot_type<<std::endl;
TFile* inF_GaAsEm;
//TFile* inF_GaAsEm_OFF;
TFile* inF_MultiAlkEm;
//TFile* inF_MultiAlkEm_OFF;
TFile* inF_Double9090;
TFile* inF_Double9040;
TFile* inF_Double9090b;
TFile* inF_Double9040b;
TMultiGraph *mg = new TMultiGraph();
TLegend *legC;
if(plot_type == "HV12"){
legC = new TLegend(0.12,0.62,0.30,0.87,NULL,"brNDC");
//plot name MCPName_ScanType_HVScanScanType_MCPName
inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV12_HVScan12_MultiAlkEm.root");
inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV12_HVScan12_GaAsEm.root");
//inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV12_HVScan12_Double9090.root");
inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV12_HVScan12_Double9040.root");
TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
TGraphErrors* eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
//settings
eff_GaAsEm->SetMarkerColor(kGreen+1);
eff_GaAsEm->SetLineColor(kGreen+1);
//eff_GaAsEm_OFF->SetMarkerColor(kGreen+1);
//eff_GaAsEm_OFF->SetLineColor(kGreen+1);
eff_Double9040->SetMarkerColor(kBlue);
eff_Double9040->SetLineColor(kBlue);
eff_Double9090->SetMarkerColor(kRed);
eff_Double9090->SetLineColor(kRed);
eff_MultiAlkEm->SetMarkerColor(1);
eff_MultiAlkEm->SetLineColor(1);
//
eff_GaAsEm->SetMarkerStyle(20);
eff_GaAsEm->SetLineWidth(2);
eff_GaAsEm->SetMarkerSize(0.9);
// eff_GaAsEm_OFF->SetMarkerStyle(22);
// eff_GaAsEm_OFF->SetLineWidth(2);
eff_Double9040->SetMarkerStyle(20);
eff_Double9040->SetLineWidth(2);
eff_Double9040->SetMarkerSize(0.9);
eff_Double9090->SetMarkerStyle(20);
eff_Double9090->SetLineWidth(2);
eff_Double9090->SetMarkerSize(0.9);
eff_MultiAlkEm->SetMarkerStyle(22);
eff_MultiAlkEm->SetLineWidth(2);
legC->SetTextFont(42);
legC->SetTextSize(0.034);
legC->SetFillColor(kWhite);
legC->SetLineColor(kWhite);
legC->SetShadowColor(kWhite);
legC->AddEntry(eff_MultiAlkEm, "MultiAlk. emitt. ON: #DeltaV_{12} = 300 V", "p");
legC->AddEntry(eff_GaAsEm, "GaAs emitt. ON: #DeltaV_{12} = 300 V", "p");
// legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = HV_{2}", "p");
legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = HV_{2}", "p");
mg->Add(eff_GaAsEm);
// mg->Add(eff_GaAsEm_OFF);
mg->Add(eff_Double9090);
mg->Add(eff_Double9040);
mg->Add(eff_MultiAlkEm);
// TCanvas* c = new TCanvas("cEff","cEff",400,800);
TCanvas* c = new TCanvas();
gPad->SetTicks();
char plot_name[100];
std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
system(command.c_str());
sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());
mg->Draw("APL");
mg->SetTitle("Electron Beam 450 MeV");
mg->GetXaxis()->SetRangeUser(1200,4000);
mg->GetXaxis()->SetTitle("HV_{1} (V)");
mg->GetXaxis()->SetTitleSize(0.05);
mg->GetYaxis()->SetTitle("Efficiency");
mg->GetYaxis()->SetTitleSize(0.05);
mg->SetMaximum(1);
mg->SetMinimum(0);
mg->Draw("APL");
legC->Draw("same");
banner4Plot();
//.........这里部分代码省略.........
示例12: makePlots
void makePlots(vector<inputValues> b, vector<inputValues> t, vector<outputValues> o) {
// Plot output values vs pulse width
TMultiGraph * eLPlot = new TMultiGraph();
TMultiGraph * ePsiPlot = new TMultiGraph();
TMultiGraph * vPsiPlot = new TMultiGraph();
vector<TGraph*> eLPlots;
vector<TGraph*> ePsiPlots;
vector<TGraph*> vPsiPlots;
for (int i = 0; i < b.size(); i++) {
int pointNum = 0;
eLPlots.push_back(new TGraph());
ePsiPlots.push_back(new TGraph());
vPsiPlots.push_back(new TGraph());
eLPlots[i]->SetMarkerStyle(21);
ePsiPlots[i]->SetMarkerStyle(21);
vPsiPlots[i]->SetMarkerStyle(21);
eLPlots[i]->SetMarkerColor(i+1);
ePsiPlots[i]->SetMarkerColor(i+1);
vPsiPlots[i]->SetMarkerColor(i+1);
for (int j = 0; j < t.size(); j++) {
if (t[j].cm == b[i].cm) {
eLPlots[i]->SetPoint(pointNum, t[j].pw, o[j].eL);
ePsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].ePsi);
vPsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].vPsi);
pointNum++;
// Debugging
//cout << pointNum << " " << t[j].pw << " " << o[j].eL << " " << o[j].ePsi << endl;
}
}
eLPlot->Add(eLPlots[i]);
ePsiPlot->Add(ePsiPlots[i]);
vPsiPlot->Add(vPsiPlots[i]);
}
eLPlot->SetTitle("Average Number of LED-induced Photoelectrons per Trigger");
ePsiPlot->SetTitle("Single-photoelectron Response Mean in Few-PE Regime");
vPsiPlot->SetTitle("Single-photoelectron Response Variance");
TCanvas * eL_c = new TCanvas("eL_c", "eL Canvas", 200, 10, 700, 500);
eLPlot->Draw("AP");
eLPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
eLPlot->GetYaxis()->SetTitle("Photoelectrons / Trigger");
eL_leg = new TLegend(0.15, 0.67, 0.43, 0.85);
eL_leg->SetHeader(" Integration Window: 156.25ns");
eL_leg->AddEntry(eLPlots[0], "Normal Mode", "P");
eL_leg->AddEntry(eLPlots[1], "Charge Mode", "P");
eL_leg->Draw();
gPad->Modified();
TCanvas * ePsi_c = new TCanvas("ePsi_c", "ePsi Canvas", 200, 10, 700, 500);
ePsiPlot->Draw("AP");
ePsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
ePsiPlot->GetYaxis()->SetTitle("pC");
ePsiPlot->GetYaxis()->SetRangeUser(0.2, 1.4);
ePsi_leg = new TLegend(0.6, 0.7, 0.88, 0.88);
ePsi_leg->SetHeader(" Integration Window: 156.25ns");
ePsi_leg->AddEntry(ePsiPlots[0], "Normal Mode", "P");
ePsi_leg->AddEntry(ePsiPlots[1], "Charge Mode", "P");
ePsi_leg->Draw();
gPad->Modified();
//TCanvas * vPsi_c = new TCanvas("vPsi_c", "vPsi Canvas", 200, 10, 700, 500);
//vPsiPlot->Draw("AP");
//vPsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
//vPsiPlot->GetYaxis()->SetTitle("pC^2");
//vPsiPlot->GetXaxis()->SetRangeUser(7.2, 8.4);
//vPsi_leg = new TLegend(0.15, 0.65, 0.5, 0.85);
//vPsi_leg->AddEntry(eLPlots[0], "PMT Voltage = 1250V", "P");
//vPsi_leg->AddEntry(eLPlots[1], "PMT Voltage = 1300V", "P");
//vPsi_leg->AddEntry(eLPlots[2], "PMT Voltage = 1350V", "P");
//vPsi_leg->AddEntry(eLPlots[3], "PMT Voltage = 1400V", "P");
//vPsi_leg->Draw();
//gPad->Modified();
// Plot spectra
//TCanvas * spectra_c = new TCanvas("spectra_c", "Spectra Canvas", 200, 10, 700, 500);
//spectra_c->SetLogy();
//for (int i = t.size() - 1; i >= 0; i--) {
// //t[i].h->Sumw2();
// t[i].h->SetLineColor(i+1);
// t[i].h->Draw("SAME");
// t[i].h->SetStats(0);
// t[i].h->GetYaxis()->SetRangeUser(1.0, 500000.0);
// t[i].h->SetTitle("PMT Spectra of Pulsed LED w/ Varying Pulse Width");
// t[i].h->GetXaxis()->SetTitle("Integrated Charge / (pC)");
// t[i].h->GetYaxis()->SetTitle("Events");
//}
////b[0].h->Sumw2();
//b[0].h->Draw("SAME");
//b[0].h->SetStats(0);
//.........这里部分代码省略.........
示例13: main
//.........这里部分代码省略.........
errRatioX[i] = eX1;
errRatioY[i] = ratio[i]*sqrt((eY1*eY1)/(ptY*ptY) + (eY2*eY2)/(ptY*ptY));
}
mgX->Add(graphs.at(grs));
mgY->Add(graphs.at(grs+range));
graphs.at(grs+2*range) = new TGraphErrors(graphs.at(grs)->GetN(), graphs.at(grs)->GetX(), ratio, errRatioX, errRatioY);
graphs.at(grs+2*range)->SetLineColor(kBlue+3*(grs-3));
graphs.at(grs+2*range)->SetMarkerColor(kBlue+3*(grs-3));
graphs.at(grs+2*range)->SetMarkerStyle(20+grs);
mgXY->Add(graphs.at(grs+2*range));
}
//Used to fit stuff, but it wasn't all that necessary
// TF1 *p1 = new TF1("p1", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
// TF1 *p2 = new TF1("p2", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//
// p1->SetParameters(-1, 0, 0, 1);
// p2->SetParameters(-1, 0, 0, 1);
//
// graphs.at(range-1)->Fit(p1, "RQME");
// graphs.at(2*range-1)->Fit(p2, "RQME");
//
// float fitmax1 = p1->GetParameter(1);
// float fitmax2 = p2->GetParameter(1);
//
// float fitDiff = fitmax1 - fitmax2;
//
// cout << "X Center: " << fitmax1 << " Y Center: " << fitmax2 << " Difference: " << fitDiff << endl;
///////////////////////// Drawing the X Graph /////////////////////////
c->cd(1);
mgX->Draw("apl");
mgX->GetXaxis()->SetTitle("Hodoscope X Position (mm)");
mgX->GetYaxis()->SetTitle("m2/m1");
mgX->GetYaxis()->SetTitleOffset(1.75);
mgX->GetYaxis()->SetRangeUser(.9, 1.05);
c->SetLeftMargin(0.15);
TLegend* legX = new TLegend(0.1,0.1,0.5,0.3);
legX->SetNColumns(2);
TString entryName;
for(int i = 0; i < range; i++){
entryName.Form("Y in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
legX->AddEntry(graphs.at(i),entryName.Data(),"lp");
}
legX->Draw();
//p1->Draw("same");
///////////////////////// Drawing the Y Graph /////////////////////////
c->cd(2);
mgY->Draw("apl");
mgY->GetXaxis()->SetTitle("Hodoscope Y Position (mm)");
mgY->GetYaxis()->SetTitle("m2/m1");
mgY->GetYaxis()->SetTitleOffset(1.75);
mgY->GetYaxis()->SetRangeUser(.9, 1.05);
c->SetLeftMargin(0.15);
TLegend* legY = new TLegend(0.1,0.1,0.5,0.3);
legY->SetNColumns(2);
for(int i = 0; i < range; i++){
entryName.Form("X in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
示例14: drawFigure7
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
// parameter = "dg0"
// parameter = "lam0"
// parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
gInterpreter->ExecuteMacro("WZPaperStyle.C");
gSystem->mkdir("pdf", kTRUE);
gSystem->mkdir("png", kTRUE);
// Individual settings
//----------------------------------------------------------------------------
if (parameter.Contains("dg0"))
{
xtitle = "#Delta#kappa^{Z}";
ytitle = "#lambda";
xmin = -0.5;
xmax = 0.5;
ymin = -0.039;
ymax = 0.053;
}
else if (parameter.Contains("lam0"))
{
xtitle = "#Delta#kappa^{Z}";
ytitle = "#Deltag^{Z}_{1}";
xmin = -0.53;
xmax = 0.53;
ymin = -0.05;
ymax = 0.09;
}
else if (parameter.Contains("dk0"))
{
xtitle = "#Deltag^{Z}_{1}";
ytitle = "#lambda";
xmin = -0.059;
xmax = 0.059;
ymin = -0.037;
ymax = 0.052;
}
// Read the input file
//----------------------------------------------------------------------------
TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");
TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
TGraph* bestFit = (TGraph*)file->Get("bestFit");
bestFit->SetMarkerSize(1.5);
bestFit->SetMarkerStyle(34);
TGraph* g_large = new TGraph(2);
g_large->SetPoint(0, -1.0, 1.0);
g_large->SetPoint(1, 1.0, 1.0);
// Draw
//----------------------------------------------------------------------------
TCanvas* canvas = new TCanvas("canvas", "canvas");
TMultiGraph* mg = new TMultiGraph();
mg->Add(cont_exp_68);
mg->Add(cont_exp_95);
mg->Add(cont_exp_99);
mg->Add(cont_obs_95);
mg->Add(bestFit, "p");
mg->Add(g_large);
mg->Draw("ac");
mg->SetMinimum(ymin);
mg->SetMaximum(ymax);
// Axis labels
//----------------------------------------------------------------------------
TAxis* xaxis = mg->GetXaxis();
TAxis* yaxis = mg->GetYaxis();
xaxis->SetLabelFont ( 42);
xaxis->SetLabelOffset( 0.01);
xaxis->SetLabelSize ( 0.05);
xaxis->SetNdivisions ( 505);
xaxis->SetTitle (xtitle);
xaxis->SetTitleFont ( 42);
xaxis->SetTitleOffset( 1.2);
xaxis->SetTitleSize ( 0.05);
//.........这里部分代码省略.........
示例15: graphme
void graphme()
{
TString filename;
UInt_t i, j, k, count;
Double_t junk;
Double_t parax[67], parae[67], perpx[79], perpe[79], run[146], arrayx[146], arraye[146], parar[67], perpr[79], zero[79], paracheck[67];
filename = "xs/Para.tmp";
ifstream inFile(filename);
if ( !inFile.is_open())
{
cout << "Error opening file ";
cout << filename;
cout << endl;
break;
}
while( !inFile.eof())
{
inFile >> paracheck[i];
i++;
}
inFile.close();
filename = "xs/Alex.tmp";
ifstream inFile(filename);
if ( !inFile.is_open())
{
cout << "Error opening file ";
cout << filename;
cout << endl;
break;
}
i = 0;
j = 0;
k = 0;
count = 0;
while( !inFile.eof())
{
inFile >> run[i] >> junk >> junk >> junk >> arrayx[i] >> arraye[i];
i++;
}
inFile.close();
for(i=0;i<146;i++)
{
flag = 0;
for(count=0;count<67;count++)
{
if(run[i] == paracheck[count])
{
flag = 1;
break;
}
}
if(flag==0)
{
perpx[k] = arrayx[i];
perpe[k] = arraye[i];
perpr[k] = run[i];
zero[k] = 0;
k++;
}
if(flag==1)
{
parax[j] = arrayx[i];
parae[j] = arraye[i];
parar[j] = run[i];
j++;
}
}
TGraphErrors *gr1 = new TGraphErrors(79, perpr, perpx, zero, perpe);
TGraphErrors *gr2 = new TGraphErrors(67, parar, parax, zero, parae);
c1 = new TCanvas("c1", "c1", 50, 10, 500, 700);
gr2->SetMarkerStyle(21);
gr2->SetMarkerColor(kRed);
gr1->SetMarkerStyle(22);
gr1->SetMarkerColor(kBlue);
TMultiGraph *mg = new TMultiGraph();
mg->SetTitle("Yield/Scalers*Factor with error");
mg->Add(gr1);
mg->Add(gr2);
mg->Draw("AP");
TLegend *tleg = new TLegend(0.6,0.25,0.8,0.35);
tleg->SetFillColor(0);
tleg->SetBorderSize(0);
tleg->AddEntry(gr1,"Perp", "p");
//.........这里部分代码省略.........