Skip to content

Instantly share code, notes, and snippets.

@jdbrice
Created January 26, 2016 20:00
Show Gist options
  • Select an option

  • Save jdbrice/9386e03b8bac82397bb3 to your computer and use it in GitHub Desktop.

Select an option

Save jdbrice/9386e03b8bac82397bb3 to your computer and use it in GitHub Desktop.
Load data from list in a condor efficient way
void loadListRange( TChain * _chain, string _listFile, int _jobIndex, int _splitBy ){
int min = _jobIndex * _splitBy;
int max = (_jobIndex + 1) * _splitBy - 1;
if ( 0 > _splitBy || 0 > _jobIndex ){
return;
}
int fileIndex = 0;
string line;
ifstream fListFile( _listFile.c_str());
if ( fListFile.is_open() ){
while ( getline( fListFile, line ) ){
if ( fileIndex < min || fileIndex > max ){
// do not add
} else {
_chain->Add( line.c_str() );
}
fileIndex ++;
}
fListFile.close();
} else {
cout << "ERROR" << endl;
}
} // loadListRange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment