1 void subtractPileup3(
const char *pileupCutFile,
const char *noPileupCutFile,
const char *subFile,
double eff=0.75) {
14 TFile *tfCut, *tfNoCut, *tfOut;
15 TH2D *cut, *noCut, *noPileup, *pileup;
17 const char* binName[]={
"all",
"awayside",
"nearside",
"soft",
"softAS",
"softNS",
"neck",
"neckAS",
"neckNS",
"hard",
"hardAS",
"hardNS",
"softHard",
"softHardAS",
"softHardNS"};
18 const char* type[] = {
"PP",
"PM",
"MP",
"MM",
"LS",
"US",
"CD",
"CI"};
20 const char* knd[]={
"YtYt",
"SYtDYt",
"PtPt",
21 "NEtaEta",
"PtEtaEta",
"NPhiPhi",
"PtPhiPhi",
22 "NDEtaDPhi",
"PtDEtaDPhi",
"NSEtaDPhi",
"PtSEtaDPhi"};
25 TFile *tfCut =
new TFile(pileupCutFile);
26 TFile *tfNoCut =
new TFile(noPileupCutFile);
27 TFile *tfOut =
new TFile(subFile,
"RECREATE");
31 for (
int it=0;it<8;it++) {
32 for (
int ik=0;ik<11;ik++) {
33 for (
int ibin=0;ibin<15;ibin++) {
35 sprintf(buffer,
"%s_%s_%s_%i",binName[ibin],knd[ik],type[it],ic);
36 tfCut->GetObject(buffer,cut);
37 tfNoCut->GetObject(buffer,noCut);
38 while (cut && noCut) {
40 sprintf(buffer,
"%s_%s_%s_%i_pileup",binName[ibin],knd[ik],type[it],ic);
41 noPileup = (TH2D *) cut->Clone();
42 pileup = (TH2D *) cut->Clone(buffer);
46 noPileup->Add(cut,noCut,1,-(1-eff));
47 noPileup->Scale(1/eff);
48 pileup->Add(noCut,cut,1,-1);
51 for (
int ix=1;ix<=noCut->GetNbinsX();ix++) {
52 for (
int iy=1;iy<=noCut->GetNbinsY();iy++) {
53 double err = cut->GetBinError(ix,iy);
54 noPileup->SetBinError(ix,iy,err);
55 pileup->SetBinError(ix,iy,err);
68 sprintf(buffer,
"%s_%s_%s_%i",binName[ibin],knd[ik],type[it],ic);
69 tfCut->GetObject(buffer,cut);
70 tfNoCut->GetObject(buffer,noCut);