Fork me on GitHub

Changeset 454 in svn for trunk


Ignore:
Timestamp:
Jul 9, 2009, 4:04:59 PM (15 years ago)
Author:
Xavier Rouby
Message:

put the inputfiles in the Logfile

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/interface/SmearUtil.h

    r443 r454  
    226226
    227227 string PdgTableFilename;
    228  //map<int,PdgParticle> PdgTable;
    229228 PdgTable PDGtable;
     229 string inputfilelist, detectorcard, triggercard;
    230230
    231231  // to sort a vector
  • trunk/src/SmearUtil.cc

    r443 r454  
    4545#include <iomanip>
    4646#include <map>
     47#include <vector>
    4748using namespace std;
    4849
     
    207208
    208209  PdgTableFilename  = "data/particle.tbl";
    209  
     210  inputfilelist     = "";
     211  detectorcard      = "";
     212  triggercard       = "";
    210213}
    211214
     
    352355  PdgTableFilename = DET.PdgTableFilename;
    353356  PDGtable         = DET.PDGtable;
     357  inputfilelist    = DET.inputfilelist;
     358  detectorcard     = DET.detectorcard;
     359  triggercard      = DET.triggercard;
    354360}
    355361
     
    497503  PdgTableFilename = DET.PdgTableFilename;
    498504  PDGtable         = DET.PDGtable;
     505
     506  inputfilelist    = DET.inputfilelist;
     507  detectorcard     = DET.detectorcard;
     508  triggercard      = DET.triggercard;
     509
    499510  return *this;
    500511}
    501512
    502 
    503 
     513void RESOLution::setNames(const string& list, const string& det, const string& trig) {
     514  inputfilelist    = list;
     515  detectorcard     = det;
     516  triggercard      = trig;
     517}
    504518
    505519//------------------------------------------------------------------------------
     
    648662
    649663void RESOLution::Logfile(const string& LogName) {
    650   //void RESOLution::Logfile(string outputfilename) {
    651  
     664
     665  // creates the list of good input files
     666  // this list is vector<string> inputfiles.
     667  ifstream infile(inputfilelist.c_str());
     668  vector<string> inputfiles;
     669  string filename;
     670  while(1) {
     671      infile >> filename;                           // reads the first line of the list
     672      if(!infile.good()) break;                     // quits when at the end of the list
     673      ifstream checking_the_file(filename.c_str()); // try to open the file
     674      if(!checking_the_file.good()) continue;       // skips bad/unknown files
     675      else checking_the_file.close();               // close file if found
     676      inputfiles.push_back(filename);               // append the name to the vector
     677  }
     678  infile.close();
     679
    652680  ofstream f_out(LogName.c_str());
    653681
     
    704732  f_out <<"**                                                                  **"<< endl;
    705733  f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
    706   f_out<<"#  Input PDG table : " << PdgTableFilename << "                               *"<<"\n";
     734  f_out <<"*                                                                    *"<< endl;
     735  f_out <<"#********************************                                    *"<<"\n";
     736  f_out <<"# Input files                                                        *"<<"\n";
     737  f_out <<"#********************************                                    *"<<"\n";
     738  f_out << left << setw(22) <<"*  Input list  "<<""
     739        << left << setw(39) << inputfilelist << "" << right << setw(9) << "*"<<"\n";
     740  for (unsigned int i =0; i<inputfiles.size(); i++) {
     741     f_out << left << setw(22) <<"*  - file  "<<""
     742           << left << setw(43) << inputfiles[i] << "" << right << setw(5) << "*"<<"\n";
     743  }
     744  if(detectorcard != "")
     745     f_out << left << setw(22) <<"*  Detector card   "<<""
     746           << left << setw(39) << detectorcard << "" << right << setw(9) << "*"<<"\n";
     747  if(triggercard != "")
     748     f_out << left << setw(22) <<"*  Trigger card    "<<""
     749        << left << setw(39) << triggercard << "" << right << setw(9) << "*"<<"\n";
     750  f_out<<"*  Beam optics :                                                     *"<<"\n";
     751  f_out << left << setw(22) <<"*  - beam 1   "<<""
     752        << left << setw(33) << RP_beam1Card << "" << right << setw(15) << "*"<<"\n";
     753  f_out << left << setw(22) <<"*  - beam 2   "<<""
     754        << left << setw(33) << RP_beam2Card << "" << right << setw(15) << "*"<<"\n";
     755  f_out << left << setw(22) <<"*  Input PDG table   " << ""
     756        << left << setw(39) << PdgTableFilename << "" << right << setw(9) << "*"<<"\n";
     757
    707758  f_out<<"*                                                                    *"<<"\n";
    708759  f_out<<"*                                                                    *"<<"\n";
Note: See TracChangeset for help on using the changeset viewer.