int main(int argv, char **argc) {
 
  if(argv != 5) {
    cout << "Usage: ./CalibrationSinglePlot.exec toyfile.root smsfile.root massGlu massLSP" << endl;
    return -1;
  }

  string toyfile(argc[1]);
  string smsfile(argc[2]);
  string massGlu(argc[3]);
  string massLSP(argc[4]);

  do_png(1);
  do_pdf(1);
  char currentpath[1024];
  char *path = getcwd(currentpath, 1024);
  PlottingSetup::basedirectory=string(currentpath)+"/";
  plots_for_config(toyfile, smsfile, massGlu, massLSP);

  return 0;

}
Beispiel #2
0
void	ToyStream::loadFile(QString filePath)
{
  QRegExp isLogoLine("(\\|*)(\\s*)\xff");
  QRegExp isToyLine("^\\s*\\{(\\d+)\\}\\{(\\d+)\\}(.+)\n");
  QRegExp findOpt("\\{(.*)\\}");
  QRegExp findPipe("([^|]*)(\\|+)([^|]*)");
  QRegExp OptColor("\\{c:\\$([0-9A-F]+):?\\$?([0-9A-F]*)\\}");
  QRegExp OptPos("\\{o:(\\d+),(\\d+)\\}");

  QFile toyfile(filePath);
 
  if (!toyfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
     cerr << "Can't read : " << filePath << "\n";
     exit(1);
  }
  while (!toyfile.atEnd()) {
    QByteArray line = toyfile.readLine();
    if (isToyLine.exactMatch(line)) {
      QString optAndText = isToyLine.cap(3);
      // Syl
      if (isLogoLine.indexIn(optAndText) != -1) {
        ToySyl newsyl;
	newsyl.pos = isLogoLine.cap(2).size();
	findPipe.exactMatch(optAndText);
        newsyl.nbpipe = findPipe.cap(2).size();
	newsyl.length = findPipe.cap(3).size();
	newsyl.start = isToyLine.cap(1).toInt();
	newsyl.stop = isToyLine.cap(2).toInt();
	syl.insert(newsyl);
	//show_ToySyl(newsyl);
      }
      //Text
      else {
        ToyText newtext;
	newtext.start = isToyLine.cap(1).toInt();
	newtext.stop = isToyLine.cap(2).toInt();
	newtext.nbpipe = 0;
        newtext.posx = -1;
        newtext.posy = -1;
	// Colors
	if (OptColor.indexIn(optAndText) != -1) {
          newtext.color1 = toycolor2QColor(OptColor.cap(1));
	  if (!OptColor.cap(2).isEmpty())
	    newtext.color2 = toycolor2QColor(OptColor.cap(2));
	}
	// Pos
	if (OptPos.indexIn(optAndText) != -1) {
          newtext.posx = OptPos.cap(1).toInt();
	  newtext.posy = OptPos.cap(2).toInt();
	}
	optAndText.replace(findOpt, "");
	if (findPipe.exactMatch(optAndText)) {
	  newtext.text = findPipe.cap(3);
	  newtext.nbpipe = findPipe.cap(2).size();
	}
	else {
	  newtext.text = optAndText;
	}
        text.insert(newtext);
      }
    }
  }
}