49 m_accept.addCut(
"pileupVeto",
"for pileup rejection");
51 const char* fullInpFilePath;
52 if (!
m_fname.empty()) fullInpFilePath = gSystem->ExpandPathName (
m_fname.c_str());
53 else fullInpFilePath = gSystem->ExpandPathName (
"$ROOTCOREBIN/data/HIEventUtils/HIRun2PileUp_PbPb5p02_v2.root");
54 if (gSystem->AccessPathName(fullInpFilePath))
throw std::invalid_argument((
"File not found at \"" + (std::string)fullInpFilePath +
"\"").c_str());
56 ATH_MSG_INFO((
"Read pileup cuts from " + (std::string)fullInpFilePath).c_str());
57 TFile* fIn =
new TFile(fullInpFilePath);
60 hname =
"hEvents";
if (!(fIn->GetListOfKeys()->Contains(hname.c_str()))) {
61 fIn->Close();
throw std::invalid_argument((
"Expected histogram \"" + hname +
"\" not found in \"" +
m_fname +
"\"").c_str());}
62 hname =
"hPileUp";
if (!(fIn->GetListOfKeys()->Contains(hname.c_str()))) {
63 fIn->Close();
throw std::invalid_argument((
"Expected histogram \"" + hname +
"\" not found in \"" +
m_fname +
"\"").c_str());}
64 hname =
"hCut";
if (!(fIn->GetListOfKeys()->Contains(hname.c_str()))) {
65 fIn->Close();
throw std::invalid_argument((
"Expected histogram \"" + hname +
"\" not found in \"" +
m_fname +
"\"").c_str());}
66 hname =
"hEff";
if (!(fIn->GetListOfKeys()->Contains(hname.c_str()))) {
67 fIn->Close();
throw std::invalid_argument((
"Expected histogram \"" + hname +
"\" not found in \"" +
m_fname +
"\"").c_str());}
68 hname =
"hPurity";
if (!(fIn->GetListOfKeys()->Contains(hname.c_str()))) {
69 fIn->Close();
throw std::invalid_argument((
"Expected histogram \"" + hname +
"\" not found in \"" +
m_fname +
"\"").c_str());}
71 m_hEvents = (TH2D*)((TH2D*)fIn->Get(
"hEvents"))->Clone(
"hEvents_HIPileupTool");
m_hEvents->SetDirectory(0);
72 m_hPileUp = (TH2D*)((TH2D*)fIn->Get(
"hPileUp"))->Clone(
"hPileUp_HIPileupTool");
m_hPileUp->SetDirectory(0);
73 m_hCut = (TH1D*)((TH1D*)fIn->Get(
"hCut"))->Clone(
"hCut_HIPileupTool");
m_hCut->SetDirectory(0);
74 m_hEff = (TH1D*)((TH1D*)fIn->Get(
"hEff"))->Clone(
"hEff_HIPileupTool");
m_hEff->SetDirectory(0);
75 m_hPurity = (TH1D*)((TH1D*)fIn->Get(
"hPurity"))->Clone(
"hPurity_HIPileupTool");
m_hPurity->SetDirectory(0);
103 for (
int ibx=0;ibx<
m_hPileUp->GetNbinsX();ibx++) {
106 if (
m_hPileUp->Integral(ibx+1,ibx+1,1,NY) == 0) {
m_hCut->SetBinContent(ibx+1,0);
continue;}
109 for (
int iby=0;iby<NY;iby++) {
111 m_hCut->SetBinContent(ibx+1,
m_hPileUp->GetYaxis()->GetBinCenter(NY-iby));
break;
115 for (
int ibx=0;ibx<
m_hEvents->GetNbinsX();ibx++) {
121 double eff = 1 - (cut - pu_cut)/all;
if ((cut - pu_cut) < 0) eff=1;
122 double pty = pu_cut/pu_all;
123 if (all!=0)
m_hEff->SetBinContent(ibx+1,eff);
124 if (pu_all!=0)
m_hPurity->SetBinContent(ibx+1,pty);
127 return StatusCode::SUCCESS;