Skip to content

Commit a419d41

Browse files
committed
add SetVerbosityFrequency() to the TaskManager
1 parent 79bc994 commit a419d41

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

infra/TaskManager.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ void TaskManager::Run(long long nEvents) {
101101
nEvents = nEvents < 0 || nEvents > chain_->GetEntries() ? chain_->GetEntries() : nEvents;
102102
}
103103

104+
if (verbosity_frequency_ > 0) {
105+
const int verbosityPeriod = nEvents / verbosity_frequency_;
106+
const int vPlog = static_cast<int>(std::log10(verbosityPeriod));
107+
verbosity_period_ = static_cast<int>(std::pow(10, vPlog));
108+
}
109+
104110
for (long long iEvent = 0; iEvent < nEvents; ++iEvent) {
105111
if (verbosity_period_ > 0 && iEvent % verbosity_period_ == 0) {
106112
std::cout << "Event no " << iEvent << "\n";

infra/TaskManager.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class TaskManager {
159159
void SetWriteMode(eBranchWriteMode mode) { write_mode_ = mode; }
160160
void SetBranchesExclude(std::vector<std::string> brex) { branches_exclude_ = std::move(brex); }
161161
void SetVerbosityPeriod(int value) { verbosity_period_ = value; }
162+
void SetVerbosityFrequency(int value) { verbosity_frequency_ = value; }
162163
void SetIsWriteHashInfo(bool is = true) { is_write_hash_info_ = is; }
163164
void SetIsUpdateEntryInExec(bool is = true) { is_update_entry_in_exec_ = is; }
164165

@@ -187,6 +188,7 @@ class TaskManager {
187188
std::vector<std::string> branches_exclude_{};
188189

189190
int verbosity_period_{-1};
191+
int verbosity_frequency_{-1};
190192

191193
// configuration parameters
192194
eBranchWriteMode write_mode_{eBranchWriteMode::kCreateNewTree};

0 commit comments

Comments
 (0)