当前位置: 首页>>代码示例>>C++>>正文


C++ TH1I::Write方法代码示例

本文整理汇总了C++中TH1I::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1I::Write方法的具体用法?C++ TH1I::Write怎么用?C++ TH1I::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TH1I的用法示例。


在下文中一共展示了TH1I::Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: histoTrbyTr


//.........这里部分代码省略.........
     if (DEBUG) cout << __LINE__ << ", entries  "<<   it->second.at(1)->GetEntries() << endl;
   if (DEBUG) cout<< __LINE__ << endl;
     stringstream canvasName; 
     canvasName << "c_"<< decay<< "_" << name;
     canvasMap[name] = new TCanvas (canvasName.str().c_str(),canvasName.str().c_str(),1000,700);
   if (DEBUG) cout<< __LINE__ << endl;
     canvasMap[name]->Divide(2,2);
     canvasMap[name]->cd(1); 
     it->second[0]->Draw(); 
     canvasMap[name]->cd(2); 
     it->second[1]->Draw(); 
   if (DEBUG) cout<< __LINE__ << endl;
     canvasMap[name]->cd(3); 
     canvasMap[name]->GetPad(3)->SetLogy();
     it->second[2]->Draw(); 
     it->second[2]->GetXaxis()->SetTitle("GeV/c"); 
//      canvasMap[name]->cd(4); 
//      it->second[3]->Draw(); 
   if (DEBUG) cout<< __LINE__ << endl;
     stringstream canvasFileName;
     canvasFileName << "plots/"<< canvasName.str().c_str()<< ".png" ; 
   if (DEBUG) cout<< __LINE__ << endl;
     if (saveFig ==1){
       if (it->second.at(1)->GetEntries() < 2*nentries/10) continue;
       if (DEBUG) cout<< __LINE__ << endl;
       canvasMap[name]->SaveAs(canvasFileName.str().c_str());
     }
   }
   if (DEBUG) cout<< __LINE__ << endl;
   for (map < string , vector <TH1D*> >::const_iterator it=hTrMap.begin(); it!=hTrMap.end(); it++){
     if (it->second.size()<1) continue ;
     if (it->second.at(1)->GetEntries() < 2*nentries/10) continue;
     string name = it->first;
     canvasMap[name]->Write();
   }
   if (DEBUG) cout<< __LINE__ << endl;

   vector <TCanvas*> cVector;
   cVector.push_back(canv1);
//    cVector.push_back(canv2);
//    cVector.push_back(canv3);
//    cVector.push_back(canv4);
   cVector.push_back(canv7);

   canv1->Draw();
   canv1->Divide(2,2);
      
   canv1->cd(1);
   if (DEBUG) cout<< __LINE__ << endl;
	
   hPt->SetFillStyle(3033);
   hPt->SetFillColor(99);
   hPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
   int maxBin = 0;
   for (int ibin = 1 ; ibin <= hPt->GetNbinsX() ; ibin++){
     if (hPt->GetBinContent(ibin) != 0) {
       maxBin = ibin;
     }
   }
   double maxX = (int )(hPt->GetBinCenter(maxBin)/10)*10  + 11  ;
   hPt->GetXaxis()->SetRangeUser(0,maxX);
   canv1->GetPad(1)->SetLogy();
   hPt->Draw();
   if (DEBUG) cout<< __LINE__ << endl;
	
   canv1->cd(2);
开发者ID:taroni,项目名称:usercode,代码行数:67,代码来源:histoTrbyTr.C

示例2: NewCosmicstest


//.........这里部分代码省略.........
	cout<< "meanflux: "<<meanflux/binsum<<"  "<< meanflux<<endl<<endl;
   printf("MCnTry: %.9f +- %.9f",MCnTry->GetMean(),MCnTry->GetMeanError());
   cout<<endl<<endl;
     
    TCanvas *c1 = new TCanvas("c1","c1",400,400);
	 c1->Divide(1,1);
	 c1->cd(1);
	 MCnTry->DrawCopy();
	
	 TCanvas *c4 = new TCanvas("c4","c4",400,400);
	 c4->Divide(1,1);
	 c4->cd(1);
	 StartPTheta->DrawCopy("SURF2");
	 gPad->SetLogx();
	
	 //TCanvas *c2 = new TCanvas("c2","c2",400,400);
	 //c2->Divide(1,1);
	 //c2->cd(1);
	 //gPad->SetLogy();
	 //wei->DrawCopy();
	
    TCanvas *c3 = new TCanvas("c3","c3",1600,800);
	 c3->Divide(4,2);
	 c3->cd(1);
	 StartXZ->DrawCopy("COLZ");
	 c3->cd(2);
	 //MCP->SetLineColor(kGreen);
	// MCP->DrawCopy();
	 //StartP->DrawCopy();
	 //TF1 *fs = new TF1("fs",NEWs,1,100,2);
	 //fs->FixParameter(0, 0);
	 //fs->FixParameter(1, 500);
	 //StartP->Add(fs,-1);
	 StartP->DrawCopy();
	 //StartP->Fit(fs,"I");
	 
	 
	// 
	 //fs->DrawCopy("SAME");
	 
	 //gPad->SetLogy();
	 gPad->SetLogx();
	 c3->cd(3);
	 MCTheta->SetLineColor(kGreen);
	 MCTheta->DrawCopy();
	 StartTheta->DrawCopy("SAME");
	 //TF1 *f1 = new TF1("f1","[0]*cos(x)*cos(x)",1.57,3.14);
	 //StartTheta->Fit(f1,"","",1.57,3.14);	
	 gPad->SetLogy(0);
	 gPad->SetLogx(0);
	 c3->cd(4);
	 MCPhi->SetLineColor(kGreen);
	 MCPhi->DrawCopy();
	 StartPhi->DrawCopy("SAME");
	//TF1 *f1 = new TF1("f1","[0]*cos(x)*cos(x)",1.57,3.14);
	//StartTheta->Fit(f1,"","",1.57,3.14);	
	 gPad->SetLogy(0);
	 gPad->SetLogx(0);
	 c3->cd(5);
	 MCXZ->DrawCopy("COLZ");
	 c3->cd(6);
	 //MCP->Divide(StartP);
	// MCP->DrawCopy();
	 gPad->SetLogy(0);
	 gPad->SetLogx(0);
	 c3->cd(7);
	 //MCTheta->Divide(StartTheta);
	 MCTheta->DrawCopy();
	 gPad->SetLogy();
	 gPad->SetLogx(0);
	 c3->cd(8);
	 //MCPhi->Divide(StartPhi);
	 MCPhi->DrawCopy();
	 gPad->SetLogy(0);
	 gPad->SetLogx(0);
	 c3->Update();
	 c3->SaveAs("Start.png");
	 
	 
	 
	 
	 StartXZ->Write();
	 StartTheta->Write();
	 StartPhi->Write();
	 StartP->Write();
	 StartPLow->Write();
	 StartPHigh->Write();
	
    StartPTheta->Write();
		
	 MCXZ->Write();
	 MCTheta->Write();
	 MCPhi->Write();
	
	 MCnTry->Write();
	 fout ->Close();
	 
	 
  
}
开发者ID:martinfranke,项目名称:SHiPAnalysis,代码行数:101,代码来源:NewCosmicstest.C

示例3: processWaveforms


//.........这里部分代码省略.........
            deltaTVsPulseHeight->Fill(data.trigger1Time+DPP_PEAKFIT_OFFSET, data.peak1Amplitude);

            // Create a new graph for each wavelet
            //waveletGraphs.push_back(new TGraph());

            // Fill each micropulse graph with waveform samples
            /*for (int l=0; l<procEvent.waveform->size(); l++)
              {
              waveletGraphs.back()->SetPoint(l,l*SAMPLE_PERIOD,procEvent.waveform->at(l));
              }*/

            // Create a new graph for each wavelet
            //triggerGraphs.push_back(new TGraph());

            // Fill each micropulse graph with waveform samples
            //triggerGraphs.back()->SetPoint(0,triggerList[0],triggerValues[0]);

            fill(procEvent.waveform->begin(),procEvent.waveform->end(),BASELINE);
        }

        TGraph* exponentialFit = new TGraph();
        exponentialFit->SetPoint(0,-0.78,140);
        exponentialFit->SetPoint(1,0.16,206);
        exponentialFit->SetPoint(2,1.79,305);
        exponentialFit->SetPoint(3,2.82,417);
        exponentialFit->SetPoint(4,3.59,566);
        exponentialFit->SetPoint(5,4.4,929);
        exponentialFit->SetPoint(6,5.2,1482);
        exponentialFit->SetPoint(7,5.7,2149);
        exponentialFit->SetPoint(8,6.9,5319);
        exponentialFit->SetPoint(9,7.3,7808);
        exponentialFit->SetPoint(10,7.7,11395);
        exponentialFit->SetPoint(11,8.0,16200);
        exponentialFit->Write();

        // Add each wavelet graph to the MultiGraph
        for (int m=0; m<waveletGraphs.size(); m++)
        {
            //cout << "adding graph " << m << " to multigraph" << endl;
            waveletGraphs[m]->Draw();
            waveformWrap->Add(waveletGraphs[m],"l");
        }

        // Add each trigger graph to the MultiGraph
        for (int m=0; m<triggerGraphs.size(); m++)
        {
            //cout << "adding graph " << m << " to multigraph" << endl;
            triggerGraphs[m]->SetMarkerSize(2);
            triggerGraphs[m]->SetMarkerColor(2);
            triggerGraphs[m]->Draw();
            waveformWrap->Add(triggerGraphs[m],"*");
        }

        waveformWrap->Write();

        for(Plots p : targetPlots)
        {
            p.getTOFHisto()->Write();
            p.getEnergyHisto()->Write();
        }

        fittedTimeHisto->Write();

        deltaTVsPulseIntegral0->Write();
        deltaTVsPulseIntegral1->Write();
        deltaTVsPulseIntegral2->Write();
开发者ID:cdpruitt,项目名称:total-neutron-cross-sections,代码行数:67,代码来源:waveform.cpp


注:本文中的TH1I::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。