Changes in / [b8a3b20:7a1e27d] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
converters/root2lhco.cpp
rb8a3b20 r7a1e27d 56 56 { 57 57 public: 58 LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile , string JetBranchName);58 LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile); 59 59 ~LHCOWriter(); 60 60 … … 107 107 //------------------------------------------------------------------------------ 108 108 109 LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile , string JetBranchName) :109 LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile) : 110 110 fTriggerWord(0), fEventNumber(1), fTreeReader(0), fOutputFile(0), 111 111 fBranchEvent(0), fBranchTrack(0), fBranchTower(0), fBranchPhoton(0), … … 128 128 fBranchMuon = fTreeReader->UseBranch("Muon"); 129 129 // reconstructed jets 130 fBranchJet = fTreeReader->UseBranch( JetBranchName.c_str());130 fBranchJet = fTreeReader->UseBranch("Jet"); 131 131 // missing transverse energy 132 132 fBranchMissingET = fTreeReader->UseBranch("MissingET"); … … 349 349 350 350 counter = 1; 351 351 352 352 /* 353 353 fItTrack->Reset(); … … 436 436 //--------------------------------------------------------------------------- 437 437 438 pair<string,string> stringToOption(string s) {439 440 string delimiter = "=";441 442 vector<string> vs;443 pair<string,string> res;444 445 size_t pos = 0;446 string token;447 while ((pos = s.find(delimiter)) != std::string::npos) {448 token = s.substr(0, pos);449 //cout << token << std::endl;450 vs.push_back(token);451 s.erase(0, pos + delimiter.length());452 }453 454 //std::cout << s << std::endl;455 vs.push_back(s);456 457 if (vs.size()==2){458 res.first=vs[0];459 res.second=vs[1];460 }461 462 return res;463 464 }465 466 467 438 int main(int argc, char *argv[]) 468 439 { … … 474 445 ExRootTreeReader *treeReader = 0; 475 446 Long64_t entry, allEntries; 476 string JetBranchName="Jet"; 477 478 if(argc < 2 || argc > 4) 479 { 480 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl; 447 448 if(argc < 2 || argc > 3) 449 { 450 cerr << " Usage: " << appName << " input_file" << " [output_file]" << endl; 481 451 cerr << " input_file - input file in ROOT format," << endl; 482 452 cerr << " output_file - output file in LHCO format," << endl; 483 453 cerr << " with no output_file, or when output_file is -, write to standard output." << endl; 484 cerr << " in order to specify the jet-branch name the output_file cannot be omitted." << endl;485 454 return 1; 486 455 } 487 488 for(int iarg=3; iarg< argc ; iarg++){489 490 string argument=argv[iarg];491 pair<string,string> option;492 option=stringToOption(argument);493 494 if ( option.first == "--jet-branch" ) {495 JetBranchName = option.second;496 cout << " Using the jet branch named " << JetBranchName << endl;497 }498 }499 cout << " Using the default jet branch named " << JetBranchName << endl;500 501 456 502 457 signal(SIGINT, SignalHandler); … … 539 494 { 540 495 // Create LHC Olympics converter: 541 writer = new LHCOWriter(treeReader, outputFile , JetBranchName);496 writer = new LHCOWriter(treeReader, outputFile); 542 497 543 498 ExRootProgressBar progressBar(allEntries - 1); … … 576 531 } 577 532 } 533 534
Note:
See TracChangeset
for help on using the changeset viewer.