Created
January 26, 2016 20:00
-
-
Save jdbrice/9386e03b8bac82397bb3 to your computer and use it in GitHub Desktop.
Load data from list in a condor efficient way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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