Skip to content

Instantly share code, notes, and snippets.

@jdbrice
Created May 29, 2018 04:33
Show Gist options
  • Save jdbrice/b04f4c0342fec87ce2e54da076665c9f to your computer and use it in GitHub Desktop.
Save jdbrice/b04f4c0342fec87ce2e54da076665c9f to your computer and use it in GitHub Desktop.
Shuai's ccbar scaling code
void scale(){
TFile *f = new TFile( "cc2ee_dimuonAcc_2014BR.root" );
TH1 * hnParent = (TH1*)f->Get( "nParent" );
TH2 * hMcAcc = (TH2*)f->Get( "hMCAcc1MvsPtcc2ee" );
double Ncc = hnParent->GetBinContent(1);
cout <<"Ncc = " << Ncc << endl;
double sig_cc = 0.797;
double sig_mb = 42;
double bw = 1.0;
hMcAcc->RebinY(20);
hMcAcc->Scale( (1.0 / Ncc) * ( sig_cc / sig_mb ) /* ( 1.0 / 1.43)*/ * ( 1.0 / bw ) );
int b1 = hMcAcc->GetXaxis()->FindBin(2.0);
TH1 * hMcM = hMcAcc->ProjectionY("m", b1, -1 );
hMcM->Scale( 1.0, "width" );
hMcM->Draw();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment