File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,12 +93,18 @@ void TaskManager::InitOutChain() {
9393}
9494
9595void TaskManager::Run (long long nEvents) {
96+ if (chain_->GetEntries () > 0 ) {
97+ nEvents = nEvents < 0 || nEvents > chain_->GetEntries () ? chain_->GetEntries () : nEvents;
98+ }
99+ Run (0 , nEvents);
100+ }
96101
102+ void TaskManager::Run (long long nEventFrom, long long nEvents) {
97103 std::cout << " AnalysisTree::Manager::Run" << std::endl;
98104 auto start = std::chrono::system_clock::now ();
99105
100- if (chain_->GetEntries () > 0 ) {
101- nEvents = nEvents < 0 || nEvents > chain_->GetEntries () ? chain_-> GetEntries () : nEvents ;
106+ if (nEventFrom + nEvents > chain_->GetEntries ()) {
107+ throw std::runtime_error ( " TaskManager::Run() - nEventFrom + nEvents > chain_->GetEntries()" ) ;
102108 }
103109
104110 if (verbosity_frequency_ > 0 ) {
@@ -107,7 +113,7 @@ void TaskManager::Run(long long nEvents) {
107113 verbosity_period_ = static_cast <int >(std::pow (10 , vPlog));
108114 }
109115
110- for (long long iEvent = 0 ; iEvent < nEvents; ++iEvent) {
116+ for (long long iEvent = nEventFrom ; iEvent < nEventFrom + nEvents; ++iEvent) {
111117 if (verbosity_period_ > 0 && iEvent % verbosity_period_ == 0 ) {
112118 std::cout << " Event no " << iEvent << " \n " ;
113119 }
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ class TaskManager {
5555 * Initialization in case of only creating AnalysisTree
5656 */
5757 virtual void Init ();
58- virtual void Run (long long nEvents = -1 );
58+ void Run (long long nEventFrom, long long nEvents);
59+ void Run (long long nEvents = -1 );
5960 virtual void Finish ();
6061
6162 void AddTask (Task* task) { tasks_.emplace_back (task); }
You can’t perform that action at this time.
0 commit comments