From e62f3eee1db72a16874c0196e9e40db79693374c Mon Sep 17 00:00:00 2001 From: Andrea Marini Date: Wed, 25 Sep 2024 14:30:23 +0200 Subject: [PATCH] 14x comb2023 (#1006) * silencing ZZ complains * silencing ZZ complains on Asimov * trying to dup the file descriptors. this should work on condor and on local. --- src/CachingNLL.cc | 6 +++++- src/ToyMCSamplerOpt.cc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/CachingNLL.cc b/src/CachingNLL.cc index d7ce0411570..04e91c4eca4 100644 --- a/src/CachingNLL.cc +++ b/src/CachingNLL.cc @@ -638,9 +638,13 @@ cacheutils::CachingAddNLL::evaluate() const } // get vals //std::cout<<"Silence is gold!"< &pdfvals = itp->eval(*data_); - freopen("/dev/tty", "w", stdout); + //freopen("/dev/tty", "w", stdout); + dup2(stdout_fd, STDOUT_FILENO); + stdout = fdopen(stdout_fd, "w"); + close(stdout_fd); //std::cout<<"I am alive!"< 1) ? diff --git a/src/ToyMCSamplerOpt.cc b/src/ToyMCSamplerOpt.cc index a411599f606..20a6db9a6f8 100644 --- a/src/ToyMCSamplerOpt.cc +++ b/src/ToyMCSamplerOpt.cc @@ -204,6 +204,7 @@ toymcoptutils::SinglePdfGenInfo::generateWithHisto(RooRealVar *&weightVar, bool RooCmdArg ay = (y ? RooFit::YVar(*y) : RooCmdArg::none()); RooCmdArg az = (z ? RooFit::ZVar(*z) : RooCmdArg::none()); + int stdout_fd = dup(STDOUT_FILENO); freopen("/dev/null", "w", stdout); // AMARINI if (histoSpec_ == 0) { histoSpec_ = pdf_->createHistogram("htemp", *x, ay, az); @@ -266,7 +267,10 @@ toymcoptutils::SinglePdfGenInfo::generateWithHisto(RooRealVar *&weightVar, bool if (!keepHistoSpec_) { delete histoSpec_; histoSpec_ = 0; } //std::cout << "Asimov dataset generated from " << pdf_->GetName() << " (sumw? " << data->sumEntries() << ", expected events " << expectedEvents << ")" << std::endl; //utils::printRDH(data); - freopen("/dev/tty", "w", stdout); + //freopen("/dev/tty", "w", stdout); + dup2(stdout_fd, STDOUT_FILENO); + stdout = fdopen(stdout_fd, "w"); + close(stdout_fd); return data; }