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


C++ TH1D::Delete方法代码示例

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


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

示例1: fitSlices

void fitSlices(TH2* hCorr, TF1* func){

   int nBins = hCorr->GetNbinsX();

   TH1D* hMean = new TH1D(Form("%s_1",hCorr->GetName()),"",nBins,hCorr->GetXaxis()->GetXmin(),hCorr->GetXaxis()->GetXmax());
   TH1D* hSigma = new TH1D(Form("%s_2",hCorr->GetName()),"",nBins,hCorr->GetXaxis()->GetXmin(),hCorr->GetXaxis()->GetXmax());

   for(int i = 1; i < nBins+1; ++i){
      int bin = nBins - i;
      TH1D* h = hCorr->ProjectionY(Form("%s_bin%d",hCorr->GetName(),bin),i,i);

      func->SetParameter(0,h->GetMaximum());
      func->SetParameter(1,h->GetMean());
      func->SetParameter(2,h->GetRMS());

      if(useFits) h->Fit(func);

      hMean->SetBinContent(i,func->GetParameter(1));
      hMean->SetBinError(i,func->GetParError(1));
      hSigma->SetBinContent(i,func->GetParameter(2));
      hSigma->SetBinError(i,func->GetParError(2));
      
      if(onlySaveTable){
	 h->Delete();
      }
   }
}
开发者ID:geonmo,项目名称:cmg-cmssw,代码行数:27,代码来源:makeTable.C

示例2: plot_point

TGraphErrors* plot_point(
			     const TString infile,
			     double R,
			     double R_sig
			     )
{

  TTree *TData = new TTree();
  TData->ReadFile(infile, "t/D:x:y:z:B1:B1Range:B2:B2Range:B3:B3Range:V:T1:T2:T3:T4:T5:T6:T7:T8");

  TH1D *h = new TH1D("h", "", 10000, 0, 10000);
  TH1D *h2 = new TH1D("h2", "", 10000, 0, 10000);
  TData->Draw("TMath::Abs(B2)>>h", "", "goff");
  TData->Draw("TMath::Abs(B3)>>h2", "", "goff");

  vector<double> B_ext, B_in, Bratio, u, u_err, B_err;

  B_in.push_back(h2->GetMean(1));
  B_ext.push_back(h->GetMean(1));

  Bratio.push_back(B_in[0] / B_ext[0]);
  u.push_back( (Bratio[0]*(R**2) + Bratio[0] - 2 - 2*sqrt((Bratio[0]**2)*(R**2) - Bratio[0]*(R**2) - Bratio[0] + 1 ) ) / (Bratio[0]*(R**2) - Bratio[0]) );

  B_err.push_back( 0.00 );
  u_err.push_back( 0.00 );

  TGraphErrors *g_uvB = new TGraphErrors(u.size(), &B_ext[0], &u[0], &B_err[0], &u_err[0]);

  h->Delete();
  h2->Delete();

  return g_uvB;

}
开发者ID:SBU-NSL,项目名称:magcloak-analysis,代码行数:34,代码来源:makePlot_uvB_MRI.C

示例3: AGY

/*=========================================================*/
Float_t AGY(Char_t *matn,Float_t peak,Float_t width=0.0)
{
  Axis_t axmax=axmin+numchx;
  setcanvas(2);
  TH1D *hist;
  hist=(TH1D*)gROOT->FindObject("xtemp");
  if(hist!=NULL)hist->Delete();
  hist=new TH1D("xtemp","xtemp",NCHX,0,DIMX);
  hist->Add(histx,1.0);
  Float_t a=GY(matn,peak,width);
  histx->Add(hist,1.0);
  c1->cd(2);
  histx->SetAxisRange(axmin,axmax);
  histx->SetLineColor(3);
  histx->Draw();
  return a;
}
开发者ID:adamhayes,项目名称:ChicoSort,代码行数:18,代码来源:gatemat.cpp

示例4: AGX

/*=========================================================*/
Float_t AGX(Char_t *matn,Float_t peak,Float_t width=0.0)
{
  Axis_t aymax=aymin+numchy;
  setcanvas(2);
  TH1D *hist;
  hist=(TH1D*)gROOT->FindObject("ytemp");
  if(hist!=NULL)hist->Delete();
  hist=new TH1D("ytemp","ytemp",NCHY,0,DIMY);
  hist->Add(histy,1.0);
  Float_t a=GX(matn,peak,width);
  histy->Add(hist,1.0);
  c1->cd(2);
  histy->SetAxisRange(aymin,aymax);
  histy->SetLineColor(3);
  histy->Draw();
  return a;
}
开发者ID:adamhayes,项目名称:ChicoSort,代码行数:18,代码来源:gatemat.cpp

示例5: choleskyUncertainty

	double FitConfidence::choleskyUncertainty( double xx, double * fCov, TF1 * f, int nSamples ){
		int nP = f->GetNpar();
		INFO( FitConfidence::classname(), "Num Params : " << nP  );
		
		double *fCovSqrt = new double[ nP * nP ];
		calcCholesky( nP, fCov, fCovSqrt );

		double yerr = 0;

		TH1D *hDistributionAtX = new TH1D("hDistributionAtX","",200,f->Eval(xx) - .2,f->Eval(xx) + .2);
		
		for (int n = 0; n < nSamples; n++ ) {
			double val = randomSqrtCov(xx,f,nP,fCovSqrt);
			hDistributionAtX->Fill( val );
		}
		yerr = hDistributionAtX->GetRMS();
		hDistributionAtX->Delete();

		return yerr;

	}
开发者ID:jdbrice,项目名称:boiler,代码行数:21,代码来源:FitConfidence.cpp

示例6: makeCentralityTable


//.........这里部分代码省略.........
     hNpart->Fill(parameter,npart);
     hNcoll->Fill(parameter,ncoll);
     hNhard->Fill(parameter,nhard);
     hb->Fill(parameter,b);
  }

  // Fitting Glauber distributions in bins to get mean and sigma values


  TF1* fGaus = new TF1("fb","gaus(0)",0,2); 
  fGaus->SetParameter(0,1);
  fGaus->SetParameter(1,0.04);
  fGaus->SetParameter(2,0.02); 
  
  fitSlices(hNpart,fGaus);
  fitSlices(hNcoll,fGaus);
  fitSlices(hNhard,fGaus);
  fitSlices(hb,fGaus);

 /*
  hNpart->FitSlicesY();
  hNcoll->FitSlicesY();
  hNhard->FitSlicesY();
  hb->FitSlicesY();
 */

  TH1D* hNpartMean = (TH1D*)gDirectory->Get("hNpart_1");
  TH1D* hNpartSigma = (TH1D*)gDirectory->Get("hNpart_2");
  TH1D* hNcollMean = (TH1D*)gDirectory->Get("hNcoll_1");
  TH1D* hNcollSigma = (TH1D*)gDirectory->Get("hNcoll_2");
  TH1D* hNhardMean = (TH1D*)gDirectory->Get("hNhard_1");
  TH1D* hNhardSigma = (TH1D*)gDirectory->Get("hNhard_2");
  TH1D* hbMean = (TH1D*)gDirectory->Get("hb_1");
  TH1D* hbSigma = (TH1D*)gDirectory->Get("hb_2");

  cout<<"-------------------------------------"<<endl;
  cout<<"# Bin NpartMean NpartSigma NcollMean NcollSigma bMean bSigma BinEdge"<<endl;


  // Enter values in table
  for(int i = 0; i < nbins; ++i){
     bins->table_[nbins-i-1].n_part_mean = hNpartMean->GetBinContent(i);
     bins->table_[nbins-i-1].n_part_var = hNpartSigma->GetBinContent(i);
     bins->table_[nbins-i-1].n_coll_mean = hNcollMean->GetBinContent(i);
     bins->table_[nbins-i-1].n_coll_var = hNcollSigma->GetBinContent(i);
     bins->table_[nbins-i-1].b_mean = hbMean->GetBinContent(i);
     bins->table_[nbins-i-1].b_var = hbSigma->GetBinContent(i);
     bins->table_[nbins-i-1].n_hard_mean = hNhardMean->GetBinContent(i);
     bins->table_[nbins-i-1].n_hard_var = hNhardSigma->GetBinContent(i);
     bins->table_[nbins-i-1].bin_edge = binboundaries[i];

     cout<<i<<" "
	 <<hNpartMean->GetBinContent(i)<<" "
	 <<hNpartSigma->GetBinContent(i)<<" "
	 <<hNcollMean->GetBinContent(i)<<" "
	 <<hNcollSigma->GetBinContent(i)<<" "
	 <<hbMean->GetBinContent(i)<<" "
	 <<hbSigma->GetBinContent(i)<<" "
	 <<binboundaries[i]<<" "
	 <<endl;
  }
  cout<<"-------------------------------------"<<endl;

  // Save the table in output file

  if(onlySaveTable){

     TH1D* hh = (TH1D*)gDirectory->Get("hNpart_0");
     hh->Delete();
     hh = (TH1D*)gDirectory->Get("hNcoll_0");
     hh->Delete();
     hh = (TH1D*)gDirectory->Get("hNhard_0");
     hh->Delete();
     hh = (TH1D*)gDirectory->Get("hb_0");
     hh->Delete();

     hNpart->Delete();
     hNpartMean->Delete();
     hNpartSigma->Delete();
     hNcoll->Delete();
     hNcollMean->Delete();
     hNcollSigma->Delete();
     hNhard->Delete();
     hNhardMean->Delete();
     hNhardSigma->Delete();
     hb->Delete();
     hbMean->Delete();
     hbSigma->Delete();
  }
  
  for(int i = 0; i < runnums.size(); ++i){
     CentralityBins* binsForRun = (CentralityBins*) bins->Clone();
     binsForRun->SetName(Form("run%d",runnums[i]));
     binsForRun->Write();
  }
  
  bins->Delete();
  outFile->Write();
  
}
开发者ID:KiSooLee,项目名称:TnP_B,代码行数:101,代码来源:makeCentralityTable.C

示例7: GeneralCorrectionFunction

TF1* GeneralCorrectionFunction(
								double ChannelRangeMin, double ChannelRangeMax,double ChannelPeakPos ,
								TH2D *h2DInputForCorrection ,
								int LineIndex,
								TString InputType="T10DeriMaxEnergy",
								TString CorrNumber="1",
								double XRangeMin=0, double XRangeMax=300,
								TString FitFuncCorr="pol2",
								double FitCorrRangeMin=10, double FitCorrRangeMax= 270,
								double TresholdForCorrection=10,
								TString FitFuncSlicesString="gaus(0)+[3]+gaus(4)"
								
								
)
{
	h2DInputForCorrection->GetYaxis()->SetRangeUser(ChannelRangeMin,ChannelRangeMax);
	char buf[60];
	sprintf(buf, "hMaxCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	TH1D *hMaxPosManually=new TH1D(buf,"",h2DInputForCorrection->GetNbinsX(),h2DInputForCorrection->GetXaxis()->GetXmin(),h2DInputForCorrection->GetXaxis()->GetXmax());
	sprintf(buf, "hMaxFitCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	TH1D *hMaxPosManuallyFit=new TH1D(buf,"",h2DInputForCorrection->GetNbinsX(),h2DInputForCorrection->GetXaxis()->GetXmin(),h2DInputForCorrection->GetXaxis()->GetXmax());
	sprintf(buf, "hGausSigmaCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	TH1D *hGausSigmaManually=new TH1D(buf,"",h2DInputForCorrection->GetNbinsX(),h2DInputForCorrection->GetXaxis()->GetXmin(),h2DInputForCorrection->GetXaxis()->GetXmax());
	for(int binX = h2DInputForCorrection->GetXaxis()->FindBin(XRangeMin);binX <= h2DInputForCorrection->GetXaxis()->FindBin(XRangeMax);binX++)
	//for(int binX = h2DInputForCorrection->GetXaxis()->FindBin(200);binX <= h2DInputForCorrection->GetXaxis()->FindBin(200);binX++)
	{
		TH1D *hProfileY =h2DInputForCorrection->ProjectionY("_py",binX,binX);	
		double MaxValue=hProfileY->GetBinCenter(hProfileY->GetMaximumBin());
		
		//hMaxPosManually->SetBinContent(binX, MaxValue);
		//h2DInputForCorrection
		//cout <<hProfileY->GetEntries()<<endl;
		//TF1* FitFuncSlices = new TF1("FitFuncSlices","gaus(0)+[3]",MaxValue-20,MaxValue+20);
		//cout << TMath::Max(MaxValue-20,double(ChannelRangeMin)) << "\t" << TMath::Min(MaxValue+20,double(ChannelRangeMax)) << "\t"<<endl;
		TF1* FitFuncGausSlices = new TF1("FitFuncGausSlices","gaus(0)",TMath::Max(MaxValue-20,double(ChannelRangeMin)),TMath::Min(MaxValue+20,double(ChannelRangeMax)));
		FitFuncGausSlices->SetParameters(hProfileY->GetBinContent(hProfileY->GetMaximumBin()),MaxValue,4);
		
		hProfileY->Fit(FitFuncGausSlices,"RNIQ");
		TF1* FitFuncSlices = new TF1("FitFuncSlices",FitFuncSlicesString.Data(),TMath::Max(MaxValue-3*FitFuncGausSlices->GetParameter(2),double(ChannelRangeMin)),TMath::Min(MaxValue+3*FitFuncGausSlices->GetParameter(2),double(ChannelRangeMax)));
		FitFuncSlices->SetParameters(FitFuncGausSlices->GetParameter(0),FitFuncGausSlices->GetParameter(1),FitFuncGausSlices->GetParameter(2),10,10,FitFuncGausSlices->GetParameter(1)-5,5);
		
		FitFuncSlices->SetParLimits(0,FitFuncGausSlices->GetParameter(0)*0.8,FitFuncGausSlices->GetParameter(0)*1.5);
		FitFuncSlices->SetParLimits(1,TMath::Max(FitFuncGausSlices->GetParameter(1)-10,double(ChannelRangeMin)),TMath::Min(FitFuncGausSlices->GetParameter(1)+10,double(ChannelRangeMax)));
		FitFuncSlices->SetParLimits(2,0,FitFuncGausSlices->GetParameter(2)*2);
		FitFuncSlices->SetParLimits(3,0,500);
		FitFuncSlices->SetParLimits(4,0,FitFuncGausSlices->GetParameter(0)*0.3);
		
		FitFuncSlices->SetParLimits(5,TMath::Max(FitFuncGausSlices->GetParameter(1)-10,double(ChannelRangeMin)),TMath::Min(MaxValue-1,double(ChannelRangeMax)));
		FitFuncSlices->SetParLimits(6,0,10);
		hProfileY->Fit(FitFuncSlices,"RINQ");
		//hProfileY->DrawCopy();
		
		//cout <<MaxValue<<"  " << FitFuncSlices->GetParameter(1) << "   " << FitFuncSlices->GetParError(1) <<endl;
		//cout <<MaxValue<<"  " << FitFuncSlices->GetParameter(1) << "   " << FitFuncSlices->GetMaximumX() <<endl;
		hMaxPosManually->SetBinContent(binX, (FitFuncSlices->GetParameter(1))/ChannelPeakPos);
		hMaxPosManually->SetBinError(binX, FitFuncSlices->GetParError(1)/ChannelPeakPos);
		hGausSigmaManually->SetBinContent(binX, FitFuncSlices->GetParameter(2));
		hGausSigmaManually->SetBinError(binX, FitFuncSlices->GetParError(2));
		if(FitFuncSlices->GetParameter(2)<TresholdForCorrection && FitFuncSlices->GetParError(2)<5)
		{
			hMaxPosManuallyFit->SetBinContent(binX, (FitFuncSlices->GetParameter(1))/ChannelPeakPos);
			hMaxPosManuallyFit->SetBinError(binX, FitFuncSlices->GetParError(1)/ChannelPeakPos);
		}
		//hSpectrumTDeriMax1090Rel_EnergyChannel_MaxPosManually->SetBinError(binX, FitFuncSlices->GetParameter(2)/ChannelPeakPos);
		hProfileY->Delete();
		//cin.ignore();
	}
	//write histos to file
		
	//sprintf(buf, "hMaxCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	hMaxPosManually->Write(0,TObject::kOverwrite);
	//sprintf(buf, "hGausSigmaCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	hGausSigmaManually->Write(0,TObject::kOverwrite);
	hMaxPosManuallyFit->Write(0,TObject::kOverwrite);
	sprintf(buf, "funcCorr%s_%sNorm_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	//fit corr function and write it to file
	TF1 *funcCorrNorm = new TF1(buf,FitFuncCorr.Data(),FitCorrRangeMin,FitCorrRangeMax);
	funcCorrNorm->SetParameters(1,0,-0);
	
	funcCorrNorm->SetParLimits(0,0.8,1);
	//funcCorrNorm->SetParLimits(2,-1E5,0);
	//if(LineIndex==2)
	//	hMaxPosManuallyFit->Fit(funcCorrNorm,"RBI");
	//else
		hMaxPosManuallyFit->Fit(funcCorrNorm,"RBQI");
	sprintf(buf, "funcCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	TF1 *funcCorr = new TF1(buf,FitFuncCorr.Data(),FitCorrRangeMin,FitCorrRangeMax);
	for(int i= 0; i<funcCorr->GetNpar();i++)
	{
		funcCorr->SetParameter(i,funcCorrNorm->GetParameter(i)*ChannelPeakPos);
	}
	//sprintf(buf, "funcCorr%s_%sNorm_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	funcCorrNorm->Write(0,TObject::kOverwrite);
	//sprintf(buf, "funcCorr%s_%s_%d",CorrNumber.Data(),InputType.Data(),LineIndex);
	funcCorr->Write(0,TObject::kOverwrite);
	h2DInputForCorrection->GetYaxis()->UnZoom();
	return funcCorr;
}
开发者ID:mstkph2011,项目名称:HypGeFADCAna,代码行数:98,代码来源:DoTreeBasedT10DeriMaxCorrection.C

示例8: randomSqrtCov

	TGraphErrors *FitConfidence::choleskyBands( TFitResultPtr fitResult, TF1 * f, int nSamples, int nPoints, Reporter* rp,  double x1, double x2 ){

		int nP = f->GetNpar();
		// INFO( FitConfidence::classname(), "Num Params : " << nP  );
		TMatrixDSym cov = fitResult->GetCovarianceMatrix();
		double *covArray = new double[ nP * nP ]; // number of parameters x number of parameters
		covArray = cov.GetMatrixArray();

		// for ( int i = 0; i < 9; i++ ){
		// 	INFO( FitConfidence::classname(), "[" << i << "] = " << covArray[ i ] );
		// }

		double *fCov = new double[ nP * nP ];
		fCov = cov.GetMatrixArray();
		double *fCovSqrt = new double[ nP * nP ];
		calcCholesky( nP, fCov, fCovSqrt );

		// for ( int i = 0; i < 9; i++ ){
		// 	INFO( FitConfidence::classname(), "[" << i << "] = " << fCovSqrt[ i ] );
		// }

		

		// calculate instead
		if ( -1.0 == x1  && -1.0 == x2 )
			f->GetRange( x1, x2 );

		double step = ( x2 - x1 ) / (double) nPoints;

		double x[ nPoints + 1 ];
		double y[ nPoints + 1 ];
		// double yup[ nPoints + 1 ];
		// double ydown[ nPoints + 1 ];
		double yerr[ nPoints + 1 ];
		vector<double> samples;

		int i = 0;
		for (double xx = x1; xx < x2; xx+= step) {
			x[i] = xx;
			TH1D *hDistributionAtX = new TH1D("hDistributionAtX","",200,f->Eval(x[i]) - .2,f->Eval(x[i]) + .2);
			for (int n = 0; n < nSamples; n++ ) {
				double val = randomSqrtCov(x[i],f,nP,fCovSqrt);
				hDistributionAtX->Fill( val );
				samples.push_back( val );
			}
			//hDistributionAtX->DrawCopy();

			y[i] 		= f->Eval(x[i]);
			yerr[i] 	= hDistributionAtX->GetRMS();
			
			// cross check - should always give the same result
			// but very innefficient
			//yerr[i] = choleskyUncertainty( xx, fitResult, f, nSamples );

			// rp.savePage();
			hDistributionAtX->Delete();
			i++;
		} 

		TGraphErrors * g = new TGraphErrors( i - 1, x, y, 0, yerr );

		return g;
	}
开发者ID:jdbrice,项目名称:boiler,代码行数:63,代码来源:FitConfidence.cpp

示例9: makeTable


//.........这里部分代码省略.........
  fitSlices(hb,fGaus);

  TH1D* hNpartMean = (TH1D*)gDirectory->Get("hNpart_1");
  TH1D* hNpartSigma = (TH1D*)gDirectory->Get("hNpart_2");
  TH1D* hNcollMean = (TH1D*)gDirectory->Get("hNcoll_1");
  TH1D* hNcollSigma = (TH1D*)gDirectory->Get("hNcoll_2");
  TH1D* hNhardMean = (TH1D*)gDirectory->Get("hNhard_1");
  TH1D* hNhardSigma = (TH1D*)gDirectory->Get("hNhard_2");
  TH1D* hbMean = (TH1D*)gDirectory->Get("hb_1");
  TH1D* hbSigma = (TH1D*)gDirectory->Get("hb_2");

  cout<<"-------------------------------------"<<endl;
  cout<<"# Bin NpartMean NpartSigma NcollMean NcollSigma bMean bSigma BinEdge"<<endl;

  // Enter values in table
  for(int i = 0; i < nbins; ++i){
     int ii = nbins-i;
     bins->table_[i].n_part_mean = hNpartMean->GetBinContent(ii);
     bins->table_[i].n_part_var = hNpartSigma->GetBinContent(ii);
     bins->table_[i].n_coll_mean = hNcollMean->GetBinContent(ii);
     bins->table_[i].n_coll_var = hNcollSigma->GetBinContent(ii);
     bins->table_[i].b_mean = hbMean->GetBinContent(ii);
     bins->table_[i].b_var = hbSigma->GetBinContent(ii);
     bins->table_[i].n_hard_mean = hNhardMean->GetBinContent(ii);
     bins->table_[i].n_hard_var = hNhardSigma->GetBinContent(ii);
     bins->table_[i].bin_edge = binboundaries[ii-1];

     cout<<i<<" "
	 <<hNpartMean->GetBinContent(ii)<<" "
	 <<hNpartSigma->GetBinContent(ii)<<" "
	 <<hNcollMean->GetBinContent(ii)<<" "
	 <<hNcollSigma->GetBinContent(ii)<<" "
	 <<hbMean->GetBinContent(ii)<<" "
	 <<hbSigma->GetBinContent(ii)<<" "
	 <<binboundaries[ii]<<" "
	 <<endl;
  }
  cout<<"-------------------------------------"<<endl;

  // Save the table in output file
  if(onlySaveTable){

     hNpart->Delete();
     hNpartMean->Delete();
     hNpartSigma->Delete();
     hNcoll->Delete();
     hNcollMean->Delete();
     hNcollSigma->Delete();
     hNhard->Delete();
     hNhardMean->Delete();
     hNhardSigma->Delete();
     hb->Delete();
     hbMean->Delete();
     hbSigma->Delete();
  }
 
  }else{
    cout<<"-------------------------------------"<<endl;
    cout<<"# Bin NpartMean NpartSigma NcollMean NcollSigma bMean bSigma BinEdge"<<endl;

    // Enter values in table
    for(int i = 0; i < nbins; ++i){
      int ii = nbins-i;
      bins->table_[i].n_part_mean = inputMCtable->NpartMeanOfBin(i);
      bins->table_[i].n_part_var = inputMCtable->NpartSigmaOfBin(i);
      bins->table_[i].n_coll_mean = inputMCtable->NcollMeanOfBin(i);
      bins->table_[i].n_coll_var = inputMCtable->NcollSigmaOfBin(i);
      bins->table_[i].b_mean = inputMCtable->bMeanOfBin(i);
      bins->table_[i].b_var = inputMCtable->bSigmaOfBin(i);
      bins->table_[i].n_hard_mean = inputMCtable->NhardMeanOfBin(i);
      bins->table_[i].n_hard_var = inputMCtable->NhardSigmaOfBin(i);
      bins->table_[i].bin_edge = binboundaries[ii-1];

      cout<<i<<" "
	  <<bins->table_[i].n_part_mean<<" "
          <<bins->table_[i].n_part_var<<" "
          <<bins->table_[i].n_coll_mean<<" "
          <<bins->table_[i].n_coll_var<<" "
          <<bins->table_[i].b_mean<<" "
          <<bins->table_[i].b_var<<" "
          <<bins->table_[i].n_hard_mean<<" "
          <<bins->table_[i].n_hard_var<<" "
          <<bins->table_[i].bin_edge<<" "<<endl;

    }
    cout<<"-------------------------------------"<<endl;

  }


  outFile->cd(); 
  dir->cd();

  bins->SetName(Form("run%d",1));
  bins->Write();
  nt->Write();  
  bins->Delete();
  outFile->Write();
  
}
开发者ID:geonmo,项目名称:cmg-cmssw,代码行数:101,代码来源:makeTable.C

示例10: main


//.........这里部分代码省略.........
	// --- 2011 Lumi old --- //
	//double lumiDY = 29743564.0 / 1626.0;
        //double lumiTtJets = 3701947.0 / 94.76;
        //double lumiwJets = 81345381.0 / 27770.0;

	ttJetsNew->Scale(lumiDY / lumiTtJets);
	wJetsNew->Scale(lumiDY / lumiwJets);
		
	dYToMuMuFSRNew->Add(dYToMuMuNonFSRNew);
	dYToMuMuFSRNew->Add(ttJetsNew);
	dYToMuMuFSRNew->Add(wJetsNew);

	dYToMuMuNonFSRNew->Add(ttJetsNew);
	dYToMuMuNonFSRNew->Add(wJetsNew);

	ttJetsNew->Add(wJetsNew);

	c1->Clear();


	dYToMuMuFSRNew->GetYaxis()->SetTitle("Events / 0.004"); //FIXME
       	dYToMuMuFSRNew->GetXaxis()->SetTitle("smearing factors");	

	/*
	dYToMuMuFSR->GetXaxis()->SetLabelFont(42);
	dYToMuMuFSR->GetXaxis()->SetTitleFont(42);
	dYToMuMuFSR->GetYaxis()->SetLabelFont(42);
	dYToMuMuFSR->GetYaxis()->SetTitleFont(42);
	dYToMuMuFSR->GetYaxis()->SetTitleOffset(1.65);
	*/

	dYToMuMuFSRNew->SetFillColor(kGreen-7);
        dYToMuMuNonFSRNew->SetFillColor(kAzure-5);
        ttJetsNew->SetFillColor(kBlue-1);
        wJetsNew->SetFillColor(kCyan+2);

	dYToMuMuFSRNew->Draw("");


	// --- Fit --- //

        TF1 * f1 = new TF1("f1","gaus",xMin,xMax);
	//TF1 * f1 = new TF1("f1","gaus",0.96,1.04);
	//f1->FixParameter(1,1.0); //FIXME
        //f1->FixParameter(2,1.0); //FIXME
        dYToMuMuFSRNew->Fit(f1);
        f1->SetLineColor(kBlue);
        f1->SetLineWidth(2);
        f1->Draw("SAMES");

        c1->Clear();
        dYToMuMuFSRNew->Draw("E");
        f1->Draw("SAMES");

        dYToMuMuFSRNew->SetMarkerStyle(20);
        dYToMuMuFSRNew->SetMarkerSize(0.5);
	
	TLatex latexLabel;
	latexLabel.SetTextFont(42);
	latexLabel.SetTextSize(0.028);
	latexLabel.SetNDC();
	//latexLabel.DrawLatex(0.25, 0.96, "CMS Preliminary 2011               #sqrt{s} = 7 TeV               L = 4.93 fb^{-1}");
	
	//double Ymin = 0;
	//double Ymax = max(dYToMuMuFSR->GetMaximum(),data->GetMaximum()) + max(dYToMuMuFSR->GetMaximum(),data->GetMaximum()) * 0.1;	
	//cout << "Ymax = "<<Ymax<<endl;

	//dYToMuMuFSRNew->GetYaxis()->SetRangeUser(Ymin,Ymax);

	plotsRecording(directoryName, fileName, c1);

	c1->Clear();

	f1->Delete();
	f1 = 0;
        dYToMuMuFSRNew->Delete();
        dYToMuMuFSRNew = 0;
        dYToMuMuNonFSRNew->Delete();
        dYToMuMuNonFSRNew = 0;
        ttJetsNew->Delete();
        ttJetsNew = 0;
        wJetsNew->Delete();
        wJetsNew = 0;
        dYToMuMuFSRChainNew->Delete();
        dYToMuMuFSRChainNew = 0;
        dYToMuMuNonFSRChainNew->Delete();
        dYToMuMuNonFSRChainNew = 0;
        ttJetsChainNew->Delete();
        ttJetsChainNew = 0;
        wJetsChainNew->Delete();
        wJetsChainNew = 0;


	
	delete c1;
	c1 = 0;	
	
	return 0;

}
开发者ID:lsgandurra,项目名称:ZmmgStudies,代码行数:101,代码来源:smearingPlotter.cpp


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