Public Member Functions | Public Attributes | List of all members
FormatFile Class Reference

Public Member Functions

 FormatFile (string gtype)
 
bool process (size_t record)
 
int numFiles ()
 
DataFilemakeDataFile (int which, string dir=".")
 
string fetchGTitle ()
 
int numOfType (string type)
 

Public Attributes

string fFile
 
string xl
 
string xu
 
string yl
 
string yu
 
vector< stringfileNames
 
vector< stringcols
 
vector< stringcuts
 
vector< double > dcths
 
vector< stringtitles
 
vector< stringdataSource
 
string mtitle
 
string savename
 
string type
 
bool logx = false
 
bool logy = false
 
int binFactor = 1
 

Detailed Description

Definition at line 247 of file rootgINukeVal.C.

Constructor & Destructor Documentation

FormatFile::FormatFile ( string  gtype)

Definition at line 271 of file rootgINukeVal.C.

271  {
272  fFile = fileName;
273 }
string fFile

Member Function Documentation

string FormatFile::fetchGTitle ( )
inline

Definition at line 267 of file rootgINukeVal.C.

267 {return mtitle;};
string mtitle
DataFile * FormatFile::makeDataFile ( int  which,
string  dir = "." 
)

Definition at line 424 of file rootgINukeVal.C.

424  {
425  int num=0;
426  int i=0;
427  //Find the position of the desired file in the vectors
428  while(num <= which && i < dataSource.size()){
429  if(dataSource[i].compare(source)==0){ num++; }
430  i++;
431  }
432  i--;
433  dir = dir+"/";
434  //Setting some default values
435  if(this->type.compare("Angle")==0){
436  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],1.0,i+1);
437  }
438  else if(this->type.compare("Momentum")==0||this->type.compare("XS")==0){
439  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],dcths[i],i+1);
440  }
441  else{
442  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],dcths[i],i+1);
443  }
444  return temp;
445 }
vector< string > titles
size_t i(0)
vector< string > cuts
art art Framework Principal Run temp
int compare(unsigned *r, sha1::digest_t const &d)
Definition: sha1_test_2.cc:61
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following source
vector< string > dataSource
string dir
vector< double > dcths
int num
Definition: f2_nu.C:119
vector< string > cols
vector< string > fileNames
int FormatFile::numFiles ( )
inline

Definition at line 265 of file rootgINukeVal.C.

265 {return fileNames.size();};
vector< string > fileNames
int FormatFile::numOfType ( string  type)

Definition at line 275 of file rootgINukeVal.C.

275  {
276  int count = 0;
277  int i;
278  for(i=0;i<dataSource.size();i++){
279  if(dataSource[i].compare(type)==0){
280  count++;
281  }
282  }
283  return count;
284 }
size_t i(0)
int compare(unsigned *r, sha1::digest_t const &d)
Definition: sha1_test_2.cc:61
vector< string > dataSource
Int_t count[12]
Definition: f2_nu.C:140
bool FormatFile::process ( size_t  record)

Definition at line 286 of file rootgINukeVal.C.

286  {
287  //Clearing variables to prevent contamination from previous process runs
288  fileNames.clear();
289  cols.clear();
290  cuts.clear();
291  dcths.clear();
292  titles.clear();
293  dataSource.clear();
294  logx=false;
295  logy=false;
296  binFactor = 1;
297  mtitle = "";
298  savename = "";
299 
300 
301  bool good = false;
302  ifstream formatStream(fFile.c_str(),ios::in);
303  string line;
304  vector<string> tokens;
305  string temp;
306  if(formatStream.is_open()){
307  //Get the recordth record tag
308  int depth = 0;
309  size_t i=0;
310  while(i<record && formatStream.eof()==false){
311  getline(formatStream,line);
312  line = trim(line);
313  //Searching the current line for the tag markers
314  size_t open = line.find_first_of('[',0);
315  if(open!=string::npos){
316  size_t close = line.find_first_of(']',0);
317  if(close <= open){
318  cout<<"Malformed Tag on following line"<<endl;
319  cout<<" "<<line<<endl;
320  i = record+2;
321  }
322  else{
323  //Pulling out tag contents
324  string curTag = line.substr(open+1,close-open-1);
325  if(curTag.compare("RECORD")==0){
326  i++;
327  }
328  }
329  }
330  }
331  //If there were enough records
332  if(i == record){
333  cout<<"Record "<<record<<" found, processing."<<endl;
334  curTag = "PROCESS";
335  good = true;
336  depth = 1;
337  }
338 
339  //If we hit another RECORD tag or the end of the file, we're done
340  while(good == true && curTag.compare("RECORD")!=0 && formatStream.eof()==false){
341  getline(formatStream,line);
342  if(line[0]!='#'){ //Ignore lines starting with a hash
343  line = trim(line);
344  //Check if line is the opening of a new section, then extract the tag
345  size_t open = line.find_first_of('[',0);
346  if(open!=string::npos){
347  size_t close = line.find_first_of(']',0);
348  curTag = line.substr(open+1,close-open-1);
349  depth = 0;
350  }
351  //Getting data out of the RECORD
352  if(curTag.compare("PROCESS")==0){
353  if(depth==1){
354  //Get the coordinates of the graph
355  size_t commaPos = line.find_first_of(',',0);
356  xl = line.substr(0,commaPos);
357  size_t nextPos = line.find_first_of(',',commaPos+1);
358  xu = line.substr(commaPos+1,nextPos-commaPos-1);
359  commaPos = nextPos;
360  nextPos = line.find_first_of(',',commaPos+1);
361  yl = line.substr(commaPos+1,nextPos-commaPos-1);
362  commaPos = nextPos;
363  nextPos = line.find_first_of(',',commaPos+1);
364  yu = line.substr(commaPos+1,nextPos-commaPos-1);
365  }
366  if(depth==2){type = line;}
367  if(depth==3){mtitle = line;}
368  if(depth==4){savename = line;}
369  if(depth==5){
370  stringstream iss;
371  iss.str(line); iss.clear();
372  iss >> binFactor;
373  }
374  }
375  else if(curTag.compare("GENIE")==0){
376  if(depth==0){dataSource.push_back(curTag);}
377  if(depth==1){fileNames.push_back(line);}
378  if(depth==2){cols.push_back(line);}
379  if(depth==3){cuts.push_back(line);}
380  if(depth==4){
381  stringstream iss;
382  iss.str(line); iss.clear();
383  double val;
384  iss >> val;
385  dcths.push_back(val);
386  }
387  if(depth==5){titles.push_back(line);}
388  }
389  else if(curTag.compare("EXPERIMENTAL")==0){
390  if(depth==0){dataSource.push_back(curTag);}
391  if(depth==1){fileNames.push_back(line);}
392  if(depth==2){
393  //Give some defaults to the stacks
394  dcths.push_back(1);
395  if(type.compare("XS")!=0){
396  cuts.push_back("");
397  }
398  //Push a valid datum onto another stack
399  cols.push_back(line);
400  }
401  if(depth==3){titles.push_back(line);}
402  if(depth==4){cuts.push_back(line);}
403  }
404  else if(curTag.compare("RECORD")!=0){
405  //Someone messed up the format file
406  cout<<"Bad Tag: " <<line<<endl;
407  good = false;
408  }
409  depth++;
410  }
411  }
412  if(type.compare("Angle")!=0){
413  cout<<"Nonangular distribution"<<endl;
414  if(yu[0] == '-'){logy = true; yu = yu.substr(1);}
415  if(yl[0] == '-'){logy = true; yl = yl.substr(1);}
416  if(xu[0] == '-'){logx = true; xu = xu.substr(1);}
417  if(xl[0] == '-'){logx = true; xl = xl.substr(1);}
418  }
419  //cout<<"("<<xl<<","<<yl<<"),("<<xu<<","<<yu<<")"<<endl;
420  }
421  return good;
422 }
vector< string > titles
size_t i(0)
vector< string > cuts
art art Framework Principal Run temp
base_neugen close()
vector< string > dataSource
string trim(string in)
Definition: rootgINukeVal.C:65
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
string fFile
This add method has three it adds this message xid and id to the appropriate and it updates the dynamic information in counts The sequence is as the static apppropriate and timespan will be in the mapped CountAndLimit and there will be no need to recompute them If this xid is not yet in see if the category is in limits if the appropriate counts struct can be formed by using the precedence rules above to combine the limit and interval found in limits along with the severityLimits and severityIntervals arrays found in the ELlimitsTable Along the way the limits map for this category is filled in
vector< double > dcths
vector< string > cols
string savename
vector< string > fileNames
string mtitle

Member Data Documentation

int FormatFile::binFactor = 1

Definition at line 262 of file rootgINukeVal.C.

vector<string> FormatFile::cols

Definition at line 252 of file rootgINukeVal.C.

vector<string> FormatFile::cuts

Definition at line 253 of file rootgINukeVal.C.

vector<string> FormatFile::dataSource

Definition at line 256 of file rootgINukeVal.C.

vector<double> FormatFile::dcths

Definition at line 254 of file rootgINukeVal.C.

string FormatFile::fFile

Definition at line 249 of file rootgINukeVal.C.

vector<string> FormatFile::fileNames

Definition at line 251 of file rootgINukeVal.C.

bool FormatFile::logx = false

Definition at line 260 of file rootgINukeVal.C.

bool FormatFile::logy = false

Definition at line 261 of file rootgINukeVal.C.

string FormatFile::mtitle

Definition at line 257 of file rootgINukeVal.C.

string FormatFile::savename

Definition at line 258 of file rootgINukeVal.C.

vector<string> FormatFile::titles

Definition at line 255 of file rootgINukeVal.C.

string FormatFile::type

Definition at line 259 of file rootgINukeVal.C.

string FormatFile::xl

Definition at line 250 of file rootgINukeVal.C.

string FormatFile::xu

Definition at line 250 of file rootgINukeVal.C.

string FormatFile::yl

Definition at line 250 of file rootgINukeVal.C.

string FormatFile::yu

Definition at line 250 of file rootgINukeVal.C.


The documentation for this class was generated from the following file: