#include <fstream>#include "PhysicsNtuple/AlgSnarl.h"Go to the source code of this file.
Namespaces | |
| namespace | Anp |
Classes | |
| class | Anp::SelectSpill |
| struct | Anp::RunSubrun |
Functions | |
| const std::vector< RunSubrun > | ReadRunList (const std::string &path, bool print=false) |
| bool | operator== (const RunSubrun &lhs, const RunSubrun &rhs) |
|
||||||||||||
|
Definition at line 428 of file SelectSpill.cxx. References Anp::RunSubrun::run, and Anp::RunSubrun::subrun. 00429 {
00430 if(lhs.run < 0 || rhs.run < 0)
00431 {
00432 return false;
00433 }
00434
00435 if(lhs.run == rhs.run)
00436 {
00437 if(lhs.subrun == rhs.subrun)
00438 {
00439 return true;
00440 }
00441 else if(lhs.subrun < 0 || rhs.subrun < 0)
00442 {
00443 return true;
00444 }
00445 }
00446
00447 return false;
00448 }
|
|
||||||||||||
|
Definition at line 372 of file SelectSpill.cxx. References infile, run(), and UtilString::StringTok(). Referenced by Anp::SelectSpill::ReadList(). 00373 {
00374 vector<RunSubrun> rlist;
00375
00376 std::ifstream infile(path.c_str());
00377 if(!infile.is_open())
00378 {
00379 return rlist;
00380 }
00381
00382 while(!infile.eof())
00383 {
00384 std::string line;
00385 std::getline(infile, line);
00386
00387 if(line.empty()) continue;
00388
00389 vector<string> svec;
00390 UtilString::StringTok(svec, line, " ");
00391
00392 //
00393 // Run list must have run and subrun fiels
00394 //
00395 if(svec.size() != 2) continue;
00396
00397 stringstream runS, subS;
00398 runS << svec.front();
00399 subS << svec.back();
00400
00401 int run = -1, sub = -1;
00402
00403 runS >> run;
00404 subS >> sub;
00405
00406 if(runS.fail() || subS.fail())
00407 {
00408 cerr << " Anp::ReadRunList - stringstream operator>> failed for: " << line << endl;
00409 }
00410 else
00411 {
00412 rlist.push_back(Anp::RunSubrun(run, sub));
00413 }
00414 }
00415
00416 if(print)
00417 {
00418 for(vector<RunSubrun>::const_iterator rit = rlist.begin(); rit != rlist.end(); ++rit)
00419 {
00420 cout << rit -> run << " " << rit -> subrun << endl;
00421 }
00422 }
00423
00424 return rlist;
00425 }
|
1.3.9.1