예제 #1
0
//--- function to divide histograms then draw---
void drawDivHist(const char* hn1, const char* hn2, const char* opt, const char* name, const char* title, const int nbin, const float min, const float max, bool log=false, const int lc=0, const int ls=0, const int lw=0)
{
   // find input histos
   if (!TString(opt).Contains("same")) printf("\n");
   printf("h1: %s. h2: %s. Draw: %s\n", hn1, hn2, name);
   TH1F * h1; TH1F * h2;
   if (gROOT->FindObject(hn1))
      h1 = dynamic_cast<TH1F*>(gROOT->FindObject(hn1));
   else {
      printf("%s is not found, please check the histogram name\n", hn1);
      return;
   }
   if (gROOT->FindObject(hn2))
      h2 = dynamic_cast<TH1F*>(gROOT->FindObject(hn2));
   else {
      printf("%s is not found, please check the histogram name\n", hn2);
      return;
   }

   //--- Make/set histogram ---
   printf("hist: %s %d %f %f\n",name,nbin,min,max);
   TH1F * h = createHist(name, title, nbin, min, max);
   setHist(h,lc,ls,lw);

   //--- Action ---
   h->Divide(h1,h2);

   //--- Draw ---
   TCanvas * c = makeCanvas(name,title,log,opt);
   h->Draw(opt);
}
예제 #2
0
			void setPrefix(std::string const & prefix, uint64_t const numbwt, uint64_t const numgt)
			{
				std::vector<std::string> gtfilenames(numgt);
				for ( uint64_t i = 0; i < numbwt; ++i )
				{
					std::ostringstream ostr;
					ostr << prefix << '_' 
						<< std::setw(4) << std::setfill('0') << i << std::setw(0)
						<< ".gt";
					gtfilenames.push_back(ostr.str());
				}
				setGT(gtfilenames);

				std::vector<std::string> bwtfilenames(numbwt);
				for ( uint64_t i = 0; i < numbwt; ++i )
				{
					std::ostringstream ostr;
					ostr << prefix << '_' 
						<< std::setw(4) << std::setfill('0') << i << std::setw(0)
						<< ".bwt";
					bwtfilenames.push_back(ostr.str());
				}
				
				setBWT(bwtfilenames);
				setHWTReq(prefix+".hwtreq");
				setHWT(prefix+".hwt");
				setHist(prefix+".hist");
				setSampledISA(prefix+".sampledisa");
			}
예제 #3
0
Message::Message()
{
    d = new MessageData;
    qRegisterMetaType<Message>("Message");
    setType( "" );
    setPayload( "" );
    setSenderID( 0 );
    setGroupID( 0 );
    setSeconds( 0 );
    setUseconds( 0 );
    setBridgeID( 0 );
    setHist( false );
    setName( "Unknown" );
    setSender( 0 );
}
예제 #4
0
//=============================== Main Functions =====================================
//--- function to draw histograms from TTree ---
void drawTree(TTree* nt, const char* draw, const char* cut, const char* opt, const char* name, const char* title, const int nbin, const float min, const float max, bool log=false, const int lc=0, const int ls=0, const int lw=0)
{
   //--- Print some info ---
   if (!TString(opt).Contains("same")) printf("\n");
   printf("%s, tree: %d. Draw: %s\n", name, nt, draw);
//   nt->Print();

   //--- Make/set histogram ---
   printf("hist: %s %d %f %f\n",name,nbin,min,max);
   TH1F * h = createHist(name, title, nbin, min, max);
   setHist(h,lc,ls,lw);

   //--- Draw ---
   TCanvas * c = makeCanvas(name,title,log,opt);
   nt->Draw(draw, cut, opt);
   printf("%s has: %f entries\n",name,h->GetEntries());
}
예제 #5
0
Message::Message( QString type, QByteArray payload, quint64 senderID, quint64 groupID,
                    quint32 seconds, quint32 useconds, quint32 bridgeID, bool hist ,
                    QString name, Target* sender )
{
    d = new MessageData;
    qRegisterMetaType<Message>("Message");

    setType( type );
    setPayload( payload );
    setSenderID( senderID );
    setGroupID( groupID );
    setSeconds( seconds );
    setUseconds( useconds );
    setBridgeID( bridgeID );
    setHist( hist );
    setName( name );
    setSender( sender );
}
예제 #6
0
void LEPStyle::draw()
{
  if( _canv==0 )
    {
      setCanvas();
      setHist();
      _canv->Draw();
      if( _ymin==0 ) _ymin = 0.2;
      //  _ymax = _n*1.5; 
      if( _ymax==0 ) _ymax = _n+_upDy;
      _hist->SetMinimum( _ymin  );
      _hist->SetMaximum( _ymax );
      
      _hist->Draw();

      if( _cmsPrelim ) cmsPrelim( _intLumi );
    }

  //  size_t n_ = _entry.size();
  _n = _entry.size();
  
  if( _extraBand )
    {
      drawExtraBand();
    }
 
  if( _band )
    {
      Double_t xx_[5] = { _bxmin, _bxmax, _bxmax, _bxmin, _bxmin };
      float eps1_ = _eps1*(_ymax-_ymin);
      float eps2_ = _eps2*(_ymax-_ymin);
      Double_t yy_[5] = { _ymin+eps1_, _ymin+eps1_, _ymax-eps2_, _ymax-eps2_, _ymin+eps1_ };
      TPolyLine* pl_ = new TPolyLine( 5, xx_, yy_ );
      pl_->SetFillStyle(_bandFillStyle);
      pl_->SetFillColor(_bandFillColor);
      pl_->SetLineWidth(3);
      pl_->SetLineColor( kOrange );
      pl_->DrawClone("FSame");
      TLine* l_ = new TLine( _bx0, _ymin+eps1_, _bx0, _ymax-eps2_  );
      l_->SetLineWidth(4);
      l_->SetLineColor( kOrange );
      l_->DrawClone();


      if( _hasLegend )
	{

	  cout << "HELLO!!!!" << endl;
	  //      _y0 = 4.0;
	  if( _y0==0 ) _y0 = _n+2*_upDy/3.;
	  if( _dy==0 ) _dy = 0.06;
	  _x0 = _xmax - 0.05*(_xmax-_xmin);
	  
	  TLatex leg1_;
	  leg1_.SetTextSize(_scale*0.05);      
	  leg1_.SetTextAlign(31); 
	  leg1_.DrawLatex( _x0, _y0+_dy, _legend );
	  
	  
	  TLatex leg2_;
	  leg2_.SetTextSize(_scale*0.05);      
	  leg2_.SetTextAlign(23); 
	  leg2_.DrawLatex( _bx0, _y0-_dy, _theory );

	}

//       TLegend* legend=new TLegend(_x0,_y0, _x0+_dx, _y0+_dy );
//       legend->SetLineColor(0);
//       legend->SetFillColor(0);
      
//       //      legend->AddEntry(pl_,_legend,"lf");
//       legend->AddEntry(pl_,_legend,"");

//       legend->Draw("same");
      

    }

  for( size_t ii=0; ii<_entry.size(); ii++ )
    {
      if( _entry[ii]==("SPACE") ) continue;
      Float_t  xval_[1];
      Float_t  yval_[1];
      Float_t    ey_[1];
      Float_t estatup_[1];
      Float_t ecombup_[1];
      Float_t etotup_[1];
      Float_t estatlo_[1];
      Float_t ecomblo_[1];
      Float_t etotlo_[1];

      float yy_ = _n-(Float_t)ii;
      xval_[0] = _val[ii];
      yval_[0] = yy_;
      ey_[0] = 0;

      estatup_[0] = _statup[ii];
      ecombup_[0] = sqrt( pow( _statup[ii],2 ) + pow( _systup[ii],2 ) );
      etotup_[0] = ecombup_[0] + _lumi[ii];

      estatlo_[0] = _statlo[ii];
      ecomblo_[0] = sqrt( pow( _statlo[ii],2 ) + pow( _systlo[ii],2 ) );      
      etotlo_[0] = ecomblo_[0] + _lumi[ii];

      TGraphAsymmErrors* gtot_  = new TGraphAsymmErrors( 1, xval_, yval_, etotlo_, etotup_, ey_, ey_ );
      gtot_->SetLineColor( kGreen );
      TGraphAsymmErrors* gcomb_ = new TGraphAsymmErrors( 1, xval_, yval_, ecomblo_, ecombup_, ey_, ey_ );
      gcomb_->SetLineColor( kRed );
      TGraphAsymmErrors* gstat_ = new TGraphAsymmErrors( 1, xval_, yval_, estatlo_, estatup_, ey_, ey_ );
      gstat_->SetLineColor( kBlack );
      gstat_->SetLineWidth( 2 );
      gstat_->SetMarkerStyle( _marker[ii] );
      gstat_->SetMarkerSize( _size[ii] );
      gstat_->SetMarkerColor( _color[ii] );

      gcomb_->SetLineWidth( 2 );

      gtot_->SetLineWidth( 2 );

      if( _lumi[ii]>0 )
	gtot_->Draw();

      gcomb_->DrawClone();
      gstat_->DrawClone("P");



      if( !_writeText ) continue;

      //   align = 10*HorizontalAlign + VerticalAlign
      // For Horizontal alignment the following convention applies:
      //   1=left adjusted, 2=centered, 3=right adjusted
      // For Vertical alignment the following convention applies:
      //   1=bottom adjusted, 2=centered, 3=top adjusted
      float xtxt_ = _xmin + 0.05*(_xmax-_xmin);
      TLatex ltx1_;

      ltx1_.SetTextSize(_scale*_size1);      
      ltx1_.SetTextAlign(_align1);
      if( _specifyPlacement )
	ltx1_.DrawLatex( _xx1, yy_+_e1, _entry[ii] );
      else
	ltx1_.DrawLatex( xtxt_, yy_+E_+e_, _entry[ii] );

      TLatex ltx2_;

      char line_[512];

      TString str_;
      TString pmstr_(" #pm ");
      TString format_("%-4.");
      format_ += _ndigit[ii];
      format_ += "f";
      TString valstr_;
      TString statstr_;
      TString syststr_;
      TString lumistr_;

      sprintf( line_, format_.Data(), _val[ii] );
      // sprintf( line_,  "%-4.3f", _val[ii] );
      valstr_ = line_;

      if( fabs( _statup[ii]-_statlo[ii] )<0.01 )
	{
	  sprintf( line_, format_.Data(), _statlo[ii] );
	}
      else
	{
	  sprintf( line_, "#scale[0.7]{#splitline{+%-4.3f}{-%-4.3f}}_{ stat.}", _statup[ii], _statlo[ii] );
	}

      statstr_ = line_;
      str_ = valstr_ + pmstr_ + statstr_;
      str_ += "_{ ";
      str_ += _firstError;
      str_ += "}";

      if( _systup[ii]>0 )
	{
	  if( fabs( _systup[ii]-_systlo[ii] )<0.01 )
	    {
	      sprintf( line_, format_.Data(), _systlo[ii] );
	    }
	  else 
	    {
	      sprintf( line_, "#scale[0.7]{#splitline{+%-4.3f}{- %-4.3f}}_", _systup[ii], _systlo[ii] );
	    }
	  syststr_ = line_;
	  str_ += pmstr_;
	  str_ += syststr_;
	  str_ += "_{ ";
	  str_ += _secondError;
	  str_ += "}";
	}
  
      if( _lumi[ii]>0 )
	{
	  sprintf( line_, format_.Data(), _lumi[ii] );
	  lumistr_ = line_;
	  lumistr_ += "_{lumi.}";
	  str_ += pmstr_ + lumistr_;
	}

      //      TString str_(line_);
      
      str_ += _unit;
      cout << str_ << endl;
 
      ltx2_.SetTextSize(_scale*_size2);      
      ltx2_.SetTextAlign(_align2);
      if( _specifyPlacement )
	ltx2_.DrawLatex( _xx2, yy_+_e2, str_ );
      else
	ltx2_.DrawLatex( xtxt_+0.02*(_xmax-_xmin), yy_+E_-e_, str_ );
    }


  _hist->Draw("Same");

  _canv->RedrawAxis();
}
예제 #7
0
void PlotV2ForJetAndTrack(){


  /* Variable */
  double ETMIN = 15;
  
  /* File Loading */
  TFile *f1 = new TFile("../root_files/ANA_spectAnaGEN_March26_PtAll_Ntot400K_proq20_FullExt_Large_VariedN.root");

  TFile *f2=0, *f3=0, *f4=0;
  f2 = new TFile("../root_files/ANA_spectAnaGEN_March26_PtAll_Ntot400K_proq20_FullExt_Large_VariedN_jetQ_fractLog2.00_phidep_a7.00_b10.00.root");

  /* Histogram Loading */
  TH1F *hdnevtminpthat = (TH1F*) f1->Get("dNevtMinPtHat");

  TH1F *hjetspecv0 = (TH1F*) f1->Get("dNJetdEt");

  TH2F *hjetspecdphiv0 = (TH2F*) f1->Get("dNJetdEtdPhi");
  TH2F *hjetspecdphiv0_q1 = (TH2F*) f2->Get("dNJetdEtdPhi");
  TH2F *hjetspecdcos2phiv0_q1 = (TH2F*) f2->Get("dNJetdEtdCos2Phi");

  TH2F *hdntrkdptdpthat = (TH2F*) f1->Get("dNTrkdPtdPtHat");

  TH3F *hdntrkdptdjetetdphi = (TH3F*) f1->Get("dNTrkdPtdJetEtdPhi");
  TH3F *hdntrkdptdpthatdjetet = (TH3F*) f1->Get("dNTrkdPtdPtHatdJetEt");
  

  double small = 1e-3;
  double tot_evt_minpthat = hdnevtminpthat->GetEntries();

  cout<<"Number of min_pt_hat event sample = "<<tot_evt_minpthat<<endl;

  if(tot_evt_minpthat<1E-22){
    cout<<"This sample doesn't include the minimum pt hat bin sample!"<<endl;
    return;
  }

  /* Overall Normalization */
  hjetspecv0->Scale(1./tot_evt_minpthat);
  hjetspecdphiv0->Scale(1./tot_evt_minpthat);
  hjetspecdphiv0_q1->Scale(1./tot_evt_minpthat);
  hdntrkdptdpthat->Scale(1./tot_evt_minpthat);
  hdntrkdptdjetetdphi->Scale(1./tot_evt_minpthat);
  hdntrkdptdpthatdjetet->Scale(1./tot_evt_minpthat);

  /* Dividing By Bin Width */
  divideByWidth(hjetspecv0);


  /* Duplications of Some Histograms */
  TH2F *hjetspecdphiv0_cln = (TH2F*) hjetspecdphiv0->Clone("hjetspecdphiv0_cln");
  TH2F *hjetspecdphiv0_q1_cln = (TH2F*) hjetspecdphiv0_q1->Clone("hjetspecdphiv0_q1_cln");
  TH3F *hdntrkdptdjetetdphi_cln = (TH3F*) hdntrkdptdjetetdphi->Clone("hdntrkdptdjetetdphi_cln");


  /* Dum Histograms */
  TH1D *hdum = new TH1D("hdum","",200,-3.2,3.2);
  hdum->SetStats(0);
  hdum->SetAxisRange(-0.001,0.1,"Y");
  hdum->GetXaxis()->SetTitle("#phi - #psi (rad)");
  hdum->GetXaxis()->CenterTitle();
  hdum->GetYaxis()->SetTitle("A.U");
  hdum->GetYaxis()->CenterTitle();
  hdum->GetXaxis()->SetMoreLogLabels();
  setHist(hdum);

  TH1D *hdum_1 = (TH1D*) hdum->Clone("hdum_1");
  hdum_1->SetAxisRange(0.0,2.0,"X");
  hdum_1->SetAxisRange(-0.001,0.2,"Y");
  hdum_1->GetXaxis()->SetTitle("2cos(#phi - #psi (rad))");
  

  /* ------------ Jet V2 --------------- */

  cout<<"Number of ET bins = "<<hjetspecdphiv0_q1->GetNbinsX()<<endl;

  TCanvas *c0 = new TCanvas("c0","",1250,930);
  makeMultiPanelCanvas(c0,5,4,0.0,0.0,0.2,0.2,0.02);

  TCanvas *c0_1 = new TCanvas("c0_1","",1250,930);
  makeMultiPanelCanvas(c0_1,5,4,0.0,0.0,0.2,0.2,0.02);


  int index = 0;
  hjetspecdphiv0_q1->RebinX(10);  // as original bin is too fine
  hjetspecdcos2phiv0_q1->RebinX(10);

  TH1D *hjetspecdphiv0_q1_projx= (TH1D*) hjetspecdphiv0_q1->ProjectionX("hjetspecdphiv0_q1_projx",0,-1,"e");
  TH1D *hjetspecdcos2phiv0_q1_projx= (TH1D*) hjetspecdcos2phiv0_q1->ProjectionX("hjetspecdcos2phiv0_q1_projx",0,-1,"e");

  for(int i=0;i<hjetspecdphiv0_q1->GetNbinsX();i++){
    
    double etmin = hjetspecdphiv0_q1->GetXaxis()->GetBinLowEdge(i+1);
    double etmax = hjetspecdphiv0_q1->GetXaxis()->GetBinUpEdge(i+1);

    // dPhi distribution of Jet
    TH1D *hjetspec_dphi = (TH1D*) hjetspecdphiv0_q1->ProjectionY("",i+1,i+1,"e");
    hjetspec_dphi->SetName(Form("hjetspec_dphi_et%1.0fto%1.0f",etmin,etmax));     

    // cos(dPhi) distribution of Jet
    TH1D *hjetspec_dcosphi = (TH1D*) hjetspecdcos2phiv0_q1->ProjectionY("",i+1,i+1,"e");
    hjetspec_dcosphi->SetName(Form("hjetspec_dcosphi_et%1.0fto%1.0f",etmin,etmax));

    // --> rebinning
    hjetspec_dphi->Rebin(4);
    hjetspec_dphi->Scale(1./4.);
    
    hjetspec_dcosphi->Rebin(4);
    hjetspec_dcosphi->Scale(1./4.);

    // --> dN/dphi (not necessary, though)
    //divideByWidth(hjetspec_dphi);

    // --> Normalization 
    hjetspec_dphi->Scale(1./hjetspec_dphi->Integral());
    hjetspec_dcosphi->Scale(1./hjetspec_dcosphi->Integral());


    // Draw
    if(etmin<ETMIN) continue;
    if(i%2+1) index++;
    if(index<20) {

      // Fitting methods
      c0->cd(index);
      hdum->Draw("");
      hjetspec_dphi->SetMarkerStyle(20);
      hjetspec_dphi->SetMarkerSize(1.0);
      hjetspec_dphi->Draw("pzsame");

      TLatex *tl_jet = new TLatex(0.5,0.8,Form("%1.1f<E_{T}<%1.1f",etmin,etmax));
      tl_jet->SetTextFont(63);
      tl_jet->SetTextSize(16);
      tl_jet->SetTextColor(kBlack);
      tl_jet->SetLineWidth(1);
      tl_jet->SetNDC();
      tl_jet->Draw("");

      // Fitting
      TF1 *fit1 = new TF1("fit1",FourierDecomp,-3.2,3.2,7);
      //for(int k=0;k<7;k++) fit1->SetParLimits(k,0,10);
      hjetspec_dphi->Fit(fit1,"RNQ");
      
      fit1->SetLineColor(kRed);
      fit1->SetLineWidth(2);
      fit1->Draw("same");

      double par1[7];
      const int binn = sizeof(par1)/sizeof(double) - 1;
      for(int j=0;j<binn;j++) par1[j] = 0.0;
      par1[0] = fit1->GetParameter(0);
      par1[2] = fit1->GetParameter(2);
      //cout<<"par1[2] = "<<par1[2]<<endl;

      TF1 *fit1_v2 = new TF1("fit1_v2",FourierDecomp,-3.2,3.2,7);
      fit1_v2->SetParameters(par1);
      fit1_v2->SetLineColor(kBlue);
      fit1_v2->SetLineWidth(2);
      fit1_v2->Draw("same");
      
      // Extracting methods
      c0_1->cd(index);
      hdum_1->Draw("");
      hjetspec_dcosphi->SetMarkerStyle(20);
      hjetspec_dcosphi->SetMarkerSize(1.0);
      hjetspec_dcosphi->Draw("pzsame");

      cout<<"PAR0 = "<<fit1->GetParameter(0)<<" PAR1 = "<<fit1->GetParameter(1)
	  <<" PAR2 = "<<fit1->GetParameter(2)<<" PAR3 = "<<fit1->GetParameter(3)<<endl;
      //cout<<"fit1->GetParameter(2) = "<<fit1->GetParameter(2)<<endl;
      //cout<<" hjetspec_dcosphi = "<<hjetspec_dcosphi->GetMean()<<endl;
      
      // v2 vs pT
      hjetspecdphiv0_q1_projx->SetBinContent(i+1,fit1->GetParameter(2));
      hjetspecdcos2phiv0_q1_projx->SetBinContent(i+1,GetMeanV2(hjetspec_dcosphi));
      //hjetspecdcos2phiv0_q1_projx->SetBinContent(i+1,hjetspec_dcosphi->Integral()/hjetspec_dcosphi->GetEntries());
      //hjetspecdcos2phiv0_q1_projx->SetBinContent(i+1,hjetspec_dcosphi->GetMean());
    }

    
  }

  // Drawing V2 (pT)
  TCanvas *c1 =new TCanvas("c1","v_{2} as a function of p_{T}",500,500);
  hjetspecdphiv0_q1_projx->SetStats(0);
  //hjetspecdphiv0_q1_projx->SetAxisRange(-0.0001,0.001,"Y");
  hjetspecdphiv0_q1_projx->SetAxisRange(-0.0001,2.0,"Y");    
  hjetspecdphiv0_q1_projx->SetAxisRange(ETMIN,300,"X");
  hjetspecdphiv0_q1_projx->GetYaxis()->SetTitle("Jet v_{2}");
  hjetspecdphiv0_q1_projx->GetXaxis()->SetTitle("Jet E_{T}");
  hjetspecdphiv0_q1_projx->GetXaxis()->CenterTitle();
  hjetspecdphiv0_q1_projx->GetYaxis()->CenterTitle();
  hjetspecdphiv0_q1_projx->GetXaxis()->SetMoreLogLabels();
  hjetspecdphiv0_q1_projx->SetMarkerSize(1.2);
  hjetspecdphiv0_q1_projx->Draw("");
  
  hjetspecdcos2phiv0_q1_projx->SetMarkerColor(kRed);
  hjetspecdcos2phiv0_q1_projx->SetMarkerSize(1.2);
  hjetspecdcos2phiv0_q1_projx->Draw("pzsame");



  /* ---------------- Convoluting Jet Spectra with FF ---------------- */

  // Obtain FF 
  // - 3D of (track pt, pthat, jet et) 
  // - 1D of dN/dET 

  //ObtainFF(hdntrkdptdpthatdjetet, hjetspecv0);
  Obtain2DFF(hdntrkdptdjetetdphi, hjetspecv0);
  
  TH2D *hdntrkdptdphi_cln = (TH2D*) hdntrkdptdjetetdphi_cln->Project3D("zxe");
  hdntrkdptdphi_cln->Reset();

  for(int ij=0;ij<hjetspecdphiv0_cln->GetNbinsX();ij++){

    double etmin = hjetspecdphiv0_cln->GetXaxis()->GetBinLowEdge(ij+1);
    double etmax = hjetspecdphiv0_cln->GetXaxis()->GetBinUpEdge(ij+1);

    // dPhi distribution of Jet
    TH1D *hjetspec_dphi_cln = (TH1D*) hjetspecdphiv0_q1_cln->ProjectionY("",ij+1,ij+1,"e");
    hjetspec_dphi_cln->SetName(Form("hjetspec_dphi_cln_et%1.0fto%1.0f",etmin,etmax));

    // FF (pt,phi) 
    TH2D *hdntrkdpt_2dff_cln2 = (TH2D*) gDirectory->Get(Form("hdntrkdpt_2dff_et%1.0fto%1.0f",etmin,etmax));
    if(hdntrkdpt_2dff_cln2==0) continue;  // don't use empty histograms  

    // Loop over phi in each jet ET bin 
    for(int ijk=0;ijk<hjetspec_dphi_cln->GetNbinsX();ijk++){ 
      
      double phimin = hjetspec_dphi_cln->GetXaxis()->GetBinLowEdge(ijk+1);
      double phimax = hjetspec_dphi_cln->GetXaxis()->GetBinUpEdge(ijk+1);

      //cout<<"phi: "<<phimin<<" to "<<phimax<<endl;

      //TH1D *hdntrkdpt_1dff_cln2 = (TH1D*) hdntrkdpt_2dff_cln2->ProjectionY("",ijk,ijk,"e");
      //hdntrkdpt_1dff_cln2->SetName(Form("hdntrkdpt_1dff_cln2_phi%1.0fto%1.0f",phimin,phimax));

      double dsigma_v0 = hjetspec_dphi_cln->GetBinContent(ijk+1);
      //hdntrkdpt_1dff_cln2->Scale(dsigma_v0);

      // Scale each (pt,phi) 
      for(int m=0;m<hdntrkdpt_2dff_cln2->GetNbinsX();m++){

	double ffval = hdntrkdpt_2dff_cln2->GetBinContent(m,ijk);
	double ffvalerr = hdntrkdpt_2dff_cln2->GetBinError(m,ijk);

	hdntrkdpt_2dff_cln2->SetBinContent(m,ijk,ffval*dsigma_v0);
	hdntrkdpt_2dff_cln2->SetBinError(m,ijk,ffvalerr*dsigma_v0);
      } // end of m

    }// end of ijk

    hdntrkdptdphi_cln->Add(hdntrkdpt_2dff_cln2);

  }// end of convolution

  /* ----------------------- Charged Particle V2 ----------------- */
  TCanvas *c2 =new TCanvas("c2","Track p_{T} vs #phi",500,500);
  hdntrkdptdphi_cln->Draw("COLZ");
  //hdntrkdptdphi_cln->ProjectionX()->Draw("");
  //hdntrkdptdphi_cln->ProjectionY()->Draw("");   
  

  TCanvas *c0_2 = new TCanvas("c0_2","",1250,930);
  makeMultiPanelCanvas(c0_2,5,4,0.0,0.0,0.2,0.2,0.02);


  for(int n=0;n<hdntrkdptdphi_cln->GetNbinsX();n++){
    
    
  }
  



}
예제 #8
0
void setHist(const char* name, const int lc=0, const int ls=0, const int lw=0, const int msz=0, const int mst=0, const double norm = 1, const char* xtitle = "", const char* ytitle = "")
{
   TH1F * h;
   if (h=dynamic_cast<TH1F*>(findHist(name))) setHist(h,lc,ls,lw,msz,mst,norm,xtitle,ytitle);
}
예제 #9
0
//--- function to draw histograms ---
void drawNormHist(TH1* h, const char* opt="", const char* title="", const char* xtitle = "", const char* ytitle = "", const double norm = 1, bool log = false, const int lc=0, const int ls=0, const int lw=0, const int msz=0, const int mst=0)
{
   setHist(h,lc,ls,lw,msz,mst,norm,xtitle,ytitle);
   makeCanvas(Form("normalized_%s",h->GetName()),title, log,opt);
   h->Draw(opt);
}
예제 #10
0
void plotFeedDown(int ntest=1, int centL=0,int centH=100)
{
   // B cross-section
   TFile *inf = new TFile("output_pp_Bmeson_5TeV_y1.root");
//   TFile *inf = new TFile("outputBplus_D_pp_rap24.root");
//    TFile *inf = new TFile("outputBplus_pp.root");
   TH1D *hBPtMax = (TH1D*)inf->Get("hmaxall");
   TH1D *hBPtMin = (TH1D*)inf->Get("hminall");
   TH1D *hBPt = (TH1D*)inf->Get("hpt");
   hBPt->SetName("hBPt");
   hBPtMax->SetName("hBPtMax");
   hBPtMin->SetName("hBPtMin");

   TH1D *hBMaxRatio = (TH1D*)hBPt->Clone("hBMaxRatio");
   hBMaxRatio->Divide(hBPtMax);

   TH1D *hBMinRatio = (TH1D*)hBPt->Clone("hBMinRatio");
   hBMinRatio->Divide(hBPtMin);

   
   hBPt->Rebin(1); 
   
   // D cross-section
//   TFile *infD = new TFile("outputD0_D_pp.root");
   TFile *infD = new TFile("output_pp_d0meson_5TeV_y1.root");
   TH1D *hDPtMax = (TH1D*)infD->Get("hmaxall");
   TH1D *hDPtMin = (TH1D*)infD->Get("hminall");
   TH1D *hDPt = (TH1D*)infD->Get("hpt");
   hDPt->SetName("hDPt");
   hDPtMax->SetName("hDPtMax");
   hDPtMin->SetName("hDPtMin");
   hDPt->Rebin(1); 

   // ratio of B->D0: not correct85% from PYTHIA
   //hBPt->Scale(0.85);
   hBPt->Scale(0.598);
   
   // c->D (55.7%)
   hDPt->Scale(0.557);

   
   TFile *inf2 = new TFile("/data/HeavyFlavourRun2/BtoDPythia/treefile_merged.root");
//   TFile *inf2 = new TFile("test.root");
   TTree *hi = (TTree*) inf2->Get("ana/hi");

   hi->SetAlias("yD","log((sqrt(1.86484*1.86484+pt*pt*cosh(eta)*cosh(eta))+pt*sinh(eta))/sqrt(1.86484*1.86484+pt*pt))");			    
   hi->SetAlias("yB","log((sqrt(5.3*5.3+pt*pt*cosh(eta)*cosh(eta))+pt*sinh(eta))/sqrt(5.3*5.3+pt*pt))");			    
   hi->SetAlias("yJ","log((sqrt(3.09692*3.09692+pt*pt*cosh(eta)*cosh(eta))+pt*sinh(eta))/sqrt(3.09692*3.09692+pt*pt))");			    


   // 6.5, 8, 10, 13, 30

/*
   TH1D *hBNoCut = (TH1D*)hBPt->Clone("hBNoCut");
   TH1D *hBHasD  = (TH1D*)hBPt->Clone("hBHasD");
   
   hi->Draw("pt>>hBHasD","(abs(pdg)>500&&abs(pdg)<600&&abs(yB)<2.4)&&Sum$(abs(pdg)==421&&abs(yD)<2)>0");
   hi->Draw("pt>>hBNoCut","(abs(pdg)>500&&abs(pdg)<600&&abs(yB)<2.4)");
;

   hBNoCut->Divide(hBHasD);
   hBPt->Divide(hBNoCut);
  */  

// 0-100%
   int npoint = 7;
   	
   double ptBins_npjpsi[8] = {1,3,6.5,8,10,13,30,300};
  
   double raa_npjpsi[7];//      = {1,0.6, 0.52,0.43,0.43,0.34,0.5};  
   double raaStat_npjpsi[7];//  = {1,0.4,0.12,0.08,0.09,0.07,0.5};
   double raaSyst_npjpsi[7];//  = {0,0,0.06,0.05,0.05,0.04,0};

/*
0-10, 10-20, 20-30, 30-40, 40-50, 50-100
double nonPromptJpsiRAA_2012[]           = {0.,0.38,0.43,0.48,0.52,0.65,0.69};
double nonPromptJpsiRAAError_2012[]      = {0.,0.02,0.03,0.03,0.04,0.06,0.07};
double nonPromptJpsiRAAErrorSyst_2012[]  = {0.,0.04,0.05,0.05,0.06,0.07,0.07};
*/

   if (centL==0&&centH==100) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=0.6;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=0.4;	// prelim
      raa_npjpsi[2]=0.52;	raaStat_npjpsi[2]=0.12;		raaSyst_npjpsi[2]=0.06;	// np jpsi pas
      raa_npjpsi[3]=0.43;	raaStat_npjpsi[3]=0.08;		raaSyst_npjpsi[3]=0.05;	// np jpsi pas
      raa_npjpsi[4]=0.43;	raaStat_npjpsi[4]=0.09;		raaSyst_npjpsi[4]=0.05;	// np jpsi pas
      raa_npjpsi[5]=0.34;	raaStat_npjpsi[5]=0.07;		raaSyst_npjpsi[5]=0.04;	// np jpsi pas
      raa_npjpsi[6]=0.5;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.25;	// b-jet
   }
   
   if (centL==0&&centH==10) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.38;	raaStat_npjpsi[2]=0.02;		raaSyst_npjpsi[2]=0.04;	// np jpsi pas
      raa_npjpsi[3]=0.38;	raaStat_npjpsi[3]=0.02;		raaSyst_npjpsi[3]=0.04;	// np jpsi pas
      raa_npjpsi[4]=0.38;	raaStat_npjpsi[4]=0.02;		raaSyst_npjpsi[4]=0.04;	// np jpsi pas
      raa_npjpsi[5]=0.38;	raaStat_npjpsi[5]=0.02;		raaSyst_npjpsi[5]=0.04;	// np jpsi pas
      raa_npjpsi[6]=0.39;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.20;	// b-jet
   
   }

   if (centL==10&&centH==20) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.43;	raaStat_npjpsi[2]=0.03;		raaSyst_npjpsi[2]=0.05;	// np jpsi pas
      raa_npjpsi[3]=0.43;	raaStat_npjpsi[3]=0.03;		raaSyst_npjpsi[3]=0.05;	// np jpsi pas
      raa_npjpsi[4]=0.43;	raaStat_npjpsi[4]=0.03;		raaSyst_npjpsi[4]=0.05;	// np jpsi pas
      raa_npjpsi[5]=0.43;	raaStat_npjpsi[5]=0.03;		raaSyst_npjpsi[5]=0.05;	// np jpsi pas
      raa_npjpsi[6]=0.47;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.24;	// b-jet
   
   }

   if (centL==20&&centH==30) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.48;	raaStat_npjpsi[2]=0.03;		raaSyst_npjpsi[2]=0.05;	// np jpsi pas
      raa_npjpsi[3]=0.48;	raaStat_npjpsi[3]=0.03;		raaSyst_npjpsi[3]=0.05;	// np jpsi pas
      raa_npjpsi[4]=0.48;	raaStat_npjpsi[4]=0.03;		raaSyst_npjpsi[4]=0.05;	// np jpsi pas
      raa_npjpsi[5]=0.48;	raaStat_npjpsi[5]=0.03;		raaSyst_npjpsi[5]=0.05;	// np jpsi pas
      raa_npjpsi[6]=0.47;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.24;	// b-jet
   
   }

   if (centL==30&&centH==40) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.52;	raaStat_npjpsi[2]=0.04;		raaSyst_npjpsi[2]=0.06;	// np jpsi pas
      raa_npjpsi[3]=0.52;	raaStat_npjpsi[3]=0.04;		raaSyst_npjpsi[3]=0.06;	// np jpsi pas
      raa_npjpsi[4]=0.52;	raaStat_npjpsi[4]=0.04;		raaSyst_npjpsi[4]=0.06;	// np jpsi pas
      raa_npjpsi[5]=0.52;	raaStat_npjpsi[5]=0.04;		raaSyst_npjpsi[5]=0.06;	// np jpsi pas
      raa_npjpsi[6]=0.61;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.30;	// b-jet
   
   }

   if (centL==40&&centH==50) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.65;	raaStat_npjpsi[2]=0.06;		raaSyst_npjpsi[2]=0.07;	// np jpsi pas
      raa_npjpsi[3]=0.65;	raaStat_npjpsi[3]=0.06;		raaSyst_npjpsi[3]=0.07;	// np jpsi pas
      raa_npjpsi[4]=0.65;	raaStat_npjpsi[4]=0.06;		raaSyst_npjpsi[4]=0.07;	// np jpsi pas
      raa_npjpsi[5]=0.65;	raaStat_npjpsi[5]=0.06;		raaSyst_npjpsi[5]=0.07;	// np jpsi pas
      raa_npjpsi[6]=0.61;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.30;	// b-jet
   
   }

   if (centL==50&&centH==100) {
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.69;	raaStat_npjpsi[2]=0.07;		raaSyst_npjpsi[2]=0.07;	// np jpsi pas
      raa_npjpsi[3]=0.69;	raaStat_npjpsi[3]=0.07;		raaSyst_npjpsi[3]=0.07;	// np jpsi pas
      raa_npjpsi[4]=0.69;	raaStat_npjpsi[4]=0.07;		raaSyst_npjpsi[4]=0.07;	// np jpsi pas
      raa_npjpsi[5]=0.69;	raaStat_npjpsi[5]=0.07;		raaSyst_npjpsi[5]=0.07;	// np jpsi pas
      raa_npjpsi[6]=0.70;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.35;	// b-jet
   
   }


   if (centL==0&&centH==20) {  //averaged by ncoll
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.4;	raaStat_npjpsi[2]=0.03;		raaSyst_npjpsi[2]=0.05;	// np jpsi pas
      raa_npjpsi[3]=0.4;	raaStat_npjpsi[3]=0.03;		raaSyst_npjpsi[3]=0.05;	// np jpsi pas
      raa_npjpsi[4]=0.4;	raaStat_npjpsi[4]=0.03;		raaSyst_npjpsi[4]=0.05;	// np jpsi pas
      raa_npjpsi[5]=0.4;	raaStat_npjpsi[5]=0.03;		raaSyst_npjpsi[5]=0.05;	// np jpsi pas
      raa_npjpsi[6]=0.42;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.21;	// b-jet
   
   }

   if (centL==10&&centH==30) {  //averaged by ncoll
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.45;	raaStat_npjpsi[2]=0.03;		raaSyst_npjpsi[2]=0.05;	// np jpsi pas
      raa_npjpsi[3]=0.45;	raaStat_npjpsi[3]=0.03;		raaSyst_npjpsi[3]=0.05;	// np jpsi pas
      raa_npjpsi[4]=0.45;	raaStat_npjpsi[4]=0.03;		raaSyst_npjpsi[4]=0.05;	// np jpsi pas
      raa_npjpsi[5]=0.45;	raaStat_npjpsi[5]=0.03;		raaSyst_npjpsi[5]=0.05;	// np jpsi pas
      raa_npjpsi[6]=0.47;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.24;	// b-jet
   
   }


   if (centL==30&&centH==50) {  //averaged by ncoll
      raa_npjpsi[0]=1.0;	raaStat_npjpsi[0]=0.0;		raaSyst_npjpsi[0]=1.0;	// no measurement
      raa_npjpsi[1]=1.0;	raaStat_npjpsi[1]=0.0;		raaSyst_npjpsi[1]=1.0;	// no measurement
      raa_npjpsi[2]=0.57;	raaStat_npjpsi[2]=0.06;		raaSyst_npjpsi[2]=0.07;	// np jpsi pas
      raa_npjpsi[3]=0.57;	raaStat_npjpsi[3]=0.06;		raaSyst_npjpsi[3]=0.07;	// np jpsi pas
      raa_npjpsi[4]=0.57;	raaStat_npjpsi[4]=0.06;		raaSyst_npjpsi[4]=0.07;	// np jpsi pas
      raa_npjpsi[5]=0.57;	raaStat_npjpsi[5]=0.06;		raaSyst_npjpsi[5]=0.07;	// np jpsi pas
      raa_npjpsi[6]=0.61;	raaStat_npjpsi[6]=0.0;		raaSyst_npjpsi[6]=0.30;	// b-jet
   
   }


   TH1D *hNPJpsiRAA = new TH1D("hNPJpsiRAA","",npoint,ptBins_npjpsi);

   for (int i=1;i<=npoint;i++)
   {
      hNPJpsiRAA->SetBinContent(i,raa_npjpsi[i-1]);      
      hNPJpsiRAA->SetBinError(i,sqrt(raaSyst_npjpsi[i-1]*raaSyst_npjpsi[i-1]+raaStat_npjpsi[i-1]*raaStat_npjpsi[i-1]));     }

   TCanvas *cJpsiRAA = new TCanvas("cJpsiRAA","",600,600);
   cJpsiRAA->SetLogx();
   TExec *setex2 = new TExec("setex2","gStyle->SetErrorX(0.5)");
   setex2->Draw();
   hNPJpsiRAA->SetXTitle("Non-prompt J/psi R_{AA} (GeV/c)");
   hNPJpsiRAA->SetXTitle("Non-prompt J/psi p_{T} (GeV/c)");
   hNPJpsiRAA->SetYTitle("R_{AA}");
   hNPJpsiRAA->Draw("e1");


   TCanvas *c = new TCanvas("c","",600,600);   

   TH2D *hJpsi= new TH2D("hJpsi","",hBPt->GetNbinsX(),hBPt->GetBinLowEdge(1),hBPt->GetBinLowEdge(hBPt->GetNbinsX()+1),
                            299*4,1,300);
   TH2D *hD= new TH2D("hD","",hBPt->GetNbinsX(),hBPt->GetBinLowEdge(1),hBPt->GetBinLowEdge(hBPt->GetNbinsX()+1),
                            299*4,1,300);
    hi->Draw("pt:BPt>>hJpsi","pdg==443&&BPt>0&&abs(yJ)<1");	
    hi->Draw("pt:BPt>>hD","abs(pdg)==421&&BPt>0&&abs(yD)<1");	
 
   hJpsi->Sumw2();   
   hD->Sumw2();   
   reweighthisto(hBPt,hD);
   reweighthisto(hBPt,hJpsi);
   hJpsi->ProjectionY()->Draw("hist");
   hD->SetLineColor(4);
   hD->SetMarkerColor(4);
   hD->ProjectionY()->Draw("hist same");
   hBPt->Draw("hist same");
   
   hJpsi->SetXTitle("B p_{T} (GeV/c)");
   hJpsi->SetYTitle("J/#psi p_{T} (GeV/c)");
   hD->SetXTitle("B p_{T} (GeV/c)");
   hD->SetYTitle("D^{0} p_{T} (GeV/c)");
   
   TCanvas *c2= new TCanvas("c2","B RAA band",600,600);
   
   TRandom2 rnd;
//   hJpsi	->ProjectionX()->Draw("hist");
   TH2D *hRAATmp = new TH2D("hRAATmp","",97,3,100,100,0,2);
   hRAATmp->SetXTitle("B p_{T} (GeV/c)");
   hRAATmp->SetYTitle("R_{AA}");
   hRAATmp->Draw();

   TCanvas *c3= new TCanvas("c3","D RAA band",600,600);
   TH2D *hDRAATmp = new TH2D("hDRAATmp","",47,3,50,100,0,2);
   hDRAATmp->SetXTitle("D^{0} p_{T} (GeV/c)");
   hDRAATmp->SetYTitle("R_{AA}");

   hDRAATmp->Draw();

   TCanvas *c4= new TCanvas("c4","B->D fraction band",600,600);
   TH2D *hBtoDTmp = new TH2D("hBtoDTmp","",47,3,50,100,0,2);
   hBtoDTmp->SetXTitle("D^{0} p_{T} (GeV/c)");
   hBtoDTmp->SetYTitle("Non-prompt D fraction");
   hBtoDTmp->Draw();
   
   TH1D *hDFromBPt= (TH1D*)hD->ProjectionY()->Clone("hDFromBPt");
   TH1D *hDFromBPtFraction= (TH1D*)hD->ProjectionY()->Clone("hDFromBPtFraction");
   hDFromBPtFraction->Divide(hDPt);
   TH1D *hDFromBPtMax= (TH1D*)hD->ProjectionY()->Clone("hDFromBPtMax");
   TH1D *hDFromBPtMin= (TH1D*)hD->ProjectionY()->Clone("hDFromBPtMin");
   
   setHist(hDFromBPtMax,-1e10);
   setHist(hDFromBPtMin,1e10);
   
   for (int i=0;i<ntest;i++)
   {
       if (i%10==0) cout <<i<<endl;	
       TH1D *hRAASample = (TH1D*)hNPJpsiRAA->Clone(Form(	"hRAASample_%d",i));
       for (int j=1;j<=hRAASample->GetNbinsX();j++) {
          double RAA = (rnd.Rndm()*2-1)*hNPJpsiRAA->GetBinError(j)+hNPJpsiRAA->GetBinContent(j);
	  hRAASample->SetBinContent(j,RAA);
       }
       
       TH2D *hJpsiClone = (TH2D*)hJpsi->Clone(Form("hJpsiClone_%d",i));

       reweighthisto(hBPt,hJpsiClone,hRAASample,1);
       TH1D *hBRAA = hJpsiClone->ProjectionX(Form("hBRAA_%d",i));
       
       c2->cd();
       hBRAA->Divide(hBPt);
       hBRAA->SetLineWidth(3);
       hBRAA->SetLineColor(kGray);
       hBRAA->Rebin(4);
       hBRAA->Scale(1./4.);
       hBRAA->Draw("hist c same");
       
       delete hJpsiClone;
       
       TH2D *hDClone = (TH2D*)hD->Clone(Form("hDClone_%d",i));
       reweighthisto(hBPt,hDClone,hBRAA,0,1);
       
       
       TH1D *hDRAA = hDClone->ProjectionY(Form("hDRAA_%d",i));
       
       getMaximum(hDFromBPtMax,hDRAA);
       getMinimum(hDFromBPtMin,hDRAA);
       
       c3->cd();
       hDRAA->Divide(hDFromBPt);
       hDRAA->SetLineWidth(3);
       hDRAA->SetLineColor(kGray);
       hDRAA->Draw("hist c same");
       
       c4->cd();
       TH1D *hBtoDFrac = hDClone->ProjectionY(Form("hBtoDFrac_%d",i));
       
       hBtoDFrac->Divide(hDPt);
       hBtoDFrac->SetLineWidth(3);
       hBtoDFrac->SetLineColor(kGray);
       hBtoDFrac->Draw("hist same");
       
       delete hDClone;      
//       delete hBRAA;      
//       delete hDRAA;      
       
   }	   
   
   TFile *outf = new TFile(Form("BtoD-%d-%d.root",centL,centH),"recreate");

   TH1D *hDFromBPtCentral=(TH1D*)hDFromBPtMax->Clone("hDFromBPtCentral");
   hDFromBPtCentral->Add(hDFromBPtMin);
   hDFromBPtCentral->Scale(1./2);
   
   hNPJpsiRAA->Write();
   hDFromBPtMax->Write();
   hDFromBPtMin->Write();
   hDFromBPtCentral->Write();
   hDFromBPt->Write();
   hJpsi->Write();
   hD->Write();
   hDFromBPtFraction->Write();
   outf->Write();

   
       
}