1 void subtractPileup5(
const char *pileupCutFile,
const char *noPileupCutFile,
const char *subFile,
double eff=0.75) {
14 TFile *tfCut, *tfNoCut, *tfOut;
15 TH2D *cut, *noCut, *noPileup, *pileup;
18 const char* binName[]={
"all",
"pipi",
"piK",
"pip",
"KK",
"Kp",
"pp",
"oo"};
19 const char* type[] = {
"PP",
"PM",
"MP",
"MM",
"LS",
"US",
"CD",
"CI"};
21 const char* knd[]={
"YtYt",
"SYtDYt",
"PtPt",
22 "NEtaEta",
"PtEtaEta",
"NPhiPhi",
"PtPhiPhi",
23 "NDEtaDPhi",
"PtDEtaDPhi",
"NSEtaDPhi",
"PtSEtaDPhi"};
26 TFile *tfCut =
new TFile(pileupCutFile);
27 TFile *tfNoCut =
new TFile(noPileupCutFile);
28 TFile *tfOut =
new TFile(subFile,
"RECREATE");
32 for (
int it=0;it<8;it++) {
33 for (
int ik=0;ik<11;ik++) {
34 for (
int ibin=0;ibin<8;ibin++) {
36 sprintf(buffer,
"%s_%s_%s_%i",binName[ibin],knd[ik],type[it],ic);
37 tfCut->GetObject(buffer,cut);
38 tfNoCut->GetObject(buffer,noCut);
39 while (cut && noCut) {
41 noPileup = (TH2D *) cut->Clone();
42 pileup = (TH2D *) cut->Clone();
45 sprintf(buffer,
"%s_%s_%s_%i_pileup",binName[ibin],knd[ik],type[it],ic);
46 pileup->SetName(buffer);
48 noPileup->Add(cut,noCut,1,-(1-eff));
49 noPileup->Scale(1/eff);
50 pileup->Add(noCut,cut,1,-1);
53 for (
int ix=1;ix<=noCut->GetNbinsX();ix++) {
54 for (
int iy=1;iy<=noCut->GetNbinsY();iy++) {
55 double err = cut->GetBinError(ix,iy);
56 noPileup->SetBinError(ix,iy,err);
57 pileup->SetBinError(ix,iy,err);
70 sprintf(buffer,
"%s_%s_%s_%i",binName[ibin],knd[ik],type[it],ic);
71 tfCut->GetObject(buffer,cut);
72 tfNoCut->GetObject(buffer,noCut);