// ROOT
#include "TString.h"
#include "TSystemDirectory.h"
#include "TSystemFile.h"
#include "TTreeFormula.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TError.h"
#include "TFile.h"
#include "TMatrixD.h"
#include "TSystem.h"
#include "TPad.h"
#include "TMD5.h"
#include "TDatime.h"

// STL
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <sys/time.h>
#include <stdlib.h>
#include <math.h>
#include <limits>

// STDC
#include "dirent.h"

#ifdef HAS_XAOD
// #pragma message using ASG_RELEASE compilation scheme
#define XAOD_STANDALONE 1
#define private public
#define protected public
#include "xAODRootAccess/TEvent.h"

#include "xAODCutFlow/CutBookkeeper.h"
#include "xAODCutFlow/CutBookkeeperContainer.h"
#include "xAODCutFlow/CutBookkeeperAuxContainer.h"
#include "xAODTruth/TruthParticleContainer.h"
#include "xAODTruth/TruthParticle.h"
#undef private
#undef protected
#define ASG_RELEASE 1
#endif

// QFramework
#include "QFramework/TQUtils.h"
#include "QFramework/TQListUtils.h"
#include "QFramework/TQStringUtils.h"
#include "QFramework/TQFolder.h"
#include "QFramework/TQLibrary.h"
#include "QFramework/TQIterator.h"
// local stuff
#include "definitions.h"

using std::string;
using std::vector;

////////////////////////////////////////////////////////////////////////////////////////////////
//
// TQUtils:
//
// The TQUtils namespace provides a variety of utility methods.
//
////////////////////////////////////////////////////////////////////////////////////////////////



//__________________________________________________________________________________|___________

int TQUtils::getMinIndex(int val0, int val1, int val2,
                         bool accept0, bool accept1, bool accept2) {

  vector<int> vals;
  vals.push_back(val0);
  vals.push_back(val1);
  vals.push_back(val2);

  vector<bool> accepts;
  accepts.push_back(accept0);
  accepts.push_back(accept1);
  accepts.push_back(accept2);

  return getMinIndex(vals, accepts);
}


//__________________________________________________________________________________|___________

int TQUtils::getMinIndex(const vector<int>& vals, const vector<bool>& accepts) {

  size_t minIndex = -1;
  for (size_t i = 0; i < 3; i++) {
    if ((minIndex == (size_t)(-1) || vals[i] < vals[minIndex]) && i < accepts.size() && accepts[i]) {
      minIndex = i;
    }
  }

  return minIndex;
}


//__________________________________________________________________________________|___________

bool TQUtils::areEquivalent(TObject * obj1, TObject * obj2) {
  // Returns true if objects <obj1> and <obj2> are considered equivalent. [not yet
  // implemented]

  if (!obj1 || !obj2) {
    return false;
  }

  if (obj1->IsA() != obj2->IsA()) {
    return false;
  }

  return false;

  // return true;
}


//__________________________________________________________________________________|___________

bool TQUtils::ensureDirectoryForFile(TString filename) {
  // ensure that the directory for the given file exists
  TString dir = TQFolder::getPathWithoutTail(filename);
  if(dir.IsNull()) return true;
  return ensureDirectory(dir);
}

//__________________________________________________________________________________|___________

char TQUtils::getLastCharacterInFile(const char* filename){
  // retrieve the last character in a text file
  FILE * f = fopen (filename, "r");
  if (!f) return '\0';
  if (fseek( f, -1, SEEK_END ) != 0 ) return '\0';
  char last = fgetc(f);
  return last;
}

//__________________________________________________________________________________|___________

bool TQUtils::ensureTrailingNewline(const char* filename){
  // check if the given text file has a terminating newline character
  // if this is not the case, append a newline at the end
  if(getLastCharacterInFile(filename)=='\n'){
    return true;
  }
  std::fstream filestr;
  filestr.open (filename, std::fstream::in | std::fstream::out | std::fstream::app);
  if(!filestr.is_open()) return false;
  filestr<< '\n';
  filestr.close();
  return true;
}

//__________________________________________________________________________________|___________

bool TQUtils::directoryExists(const TString& path){
  // check if directory <path> exists
  Long_t flags = 0;
  gSystem->GetPathInfo(path.Data(), (Long_t*)0, (Long_t*)0, &flags, (Long_t*)0);
  if (flags & 2) {
    // directory exists
    return true;
  }
  else return false;
}

//__________________________________________________________________________________|___________

bool TQUtils::ensureDirectory(TString path) {
  // ensure that the directory with the given path exists

  if (directoryExists(path))
    return true;

  //create directory
  if(path.Contains("$")){
    WARN("creating directory containing potentially unexpanded path '%s'",path.Data());
  }
  if (0 == gSystem->mkdir(path.Data(),true)) return true;
  else return false;
}

//__________________________________________________________________________________|___________

TFile * TQUtils::openFile(const TString& filename) {

  TFile* file = TFile::Open(filename.Data());

  if(file && file->IsOpen()){

    return file;

  } else {

    if(file) {
      delete file;
      file = 0;
    }
    return NULL;

  }

}

//__________________________________________________________________________________|___________

bool TQUtils::fileExists(const TString& filename) {
  // Check whether the file <filename> exists and return true if so,
  // and false otherwise

  if (filename.BeginsWith("root:") || filename.BeginsWith("dcap:")) return TQUtils::fileExistsEOS(filename);
  else return TQUtils::fileExistsLocal(filename);

  return false;
}

//__________________________________________________________________________________|___________

bool TQUtils::fileExistsEOS(const TString& filename) {
  // Check whether the file <filename> exists and return true if so,
  // and false otherwise. Works on eos paths.

  bool exists = false;
  /* temporarily increase error ignore level */
  int tmp = gErrorIgnoreLevel;
  gErrorIgnoreLevel = 5000;
  // TQLibrary::redirect_stderr("/dev/null");
  TFile * file = TFile::Open(filename.Data(), "READONLY");
  if(file){
    if(file->IsOpen()){
      file->Close();
      exists = true;
    }
    delete file;
  }
  // TQLibrary::restore_stderr();

  /* restore error ignore level */
  gErrorIgnoreLevel = tmp;

  /* return true if we successfully accessed the file */
  return exists;
}

//__________________________________________________________________________________|___________

bool TQUtils::fileExistsLocal(const TString& filename) {
  // check if the file exists and is readable;

  /* check if the file exists by trying to open it with an ifstream */
  std::ifstream ifile(filename.Data(), std::ifstream::binary);
  bool exists = false;

  /* if this succeeded, we need to close it again */
  if (ifile.is_open()) {
    exists = true;
    ifile.close();
  }

  /* return true if we successfully accessed the file */
  return exists;
}


//__________________________________________________________________________________|___________

TList * TQUtils::getListOfFilesMatching(TString pattern) {
  // Scans the file system for files whose names match the string pattern <pattern>
  // and returns a list (instance of TList) of matching filenames (as instances of
  // TObjString).

  pattern = TQStringUtils::trim(pattern);
  if (!pattern.BeginsWith("./") && !pattern.BeginsWith("/") && !pattern.BeginsWith("root://")) {
    pattern.Prepend("./");
  }

  /* split input path pattern */
  TString head;
  TString core;
  TString tail = pattern;
  bool stop = false;
  int pre = TQStringUtils::removeLeading(tail, "/");
  while (!stop && !tail.IsNull()) {
    core = TQFolder::getPathHead(tail);
    if (!TQStringUtils::hasWildcards(core)) {
      head = TQFolder::concatPaths(head, core);
      core.Clear();
    } else {
      stop = true;
    }
  }
  if (head.IsNull() && pre > 0)
    head = ".";
  if (pre > 0)
    head.Prepend(TQStringUtils::repeat("/", pre));
  if (head.CompareTo("~") == 0)
    head.Append("/");

  /* done if no wildcards left to resolve */
  if (core.IsNull()) {
    TString name = gSystem->ExpandPathName(pattern.Data());
    if (fileExists(name)) {
      TList * files = new TList();
      files->SetOwner(true);
      files->Add(new TObjString(name));
      return files;
    } else {
      return NULL;
    }
  }

  TList * files = new TList();
  files->SetOwner(true);

  /* resolve core wildcard */
  TSystemDirectory * dir = new TSystemDirectory("", gSystem->ExpandPathName(head.Data()));
  TList * subFiles = dir->GetListOfFiles();
  if (subFiles) {
    TSystemFile * file;
    TIterator * itr = subFiles->MakeIterator();
    while ((file = (TSystemFile*)itr->Next())) {
      TString name = file->GetName();
      /* don't let wildcards match relative references */
      if (name.CompareTo(".") == 0 || name.CompareTo("..") == 0)
        continue;
      if (TQStringUtils::matches(name, core)) {
        TString path = TQFolder::concatPaths(head, name);
        path = TQFolder::concatPaths(path, tail);

        TList * subList = getListOfFilesMatching(path);
        if (subList) {
          subList->SetOwner(false);
          files->AddAll(subList);
          delete subList;
        }
      }
    }
    delete itr;
    delete subFiles;
  }
  delete dir;

  // return a null pointer instead of an empty list
  if (files->GetEntries() == 0) {
    delete files;
    files = NULL;
  }

  return files;
}


//__________________________________________________________________________________|___________

bool TQUtils::parseAssignment(TString input, TString * dest, TString * source) {

  TList * tokens = TQStringUtils::tokenize(input, "=");

  /* we expect exactly two tokens */
  if (tokens->GetEntries() != 2) { return false; }

  /* make sure the string pointers a valid before assigning the results */
  if (dest) { *dest = TQStringUtils::trim(tokens->At(0)->GetName()); }
  if (source) { *source = TQStringUtils::trim(tokens->At(1)->GetName()); }

  tokens->Delete();
  delete tokens;

  return true;

}

//__________________________________________________________________________________|___________
TObjArray * TQUtils::getBranchNames(const TString& input) {
  /* Strip all valid branch names from a TString
   * and return them in a TObjArray */
  TString startChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  TString validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
  TString sepChars = " =<>!*/+-()";
  TObjArray * params = new TObjArray();

  std::string str(input.Data());
  int startPos = str.find_first_of(startChars.Data());
  int endPos = str.find_first_not_of(validChars.Data(), startPos);

  while (true) {
    if (endPos == -1)
      endPos = str.size();

    TString bname = TQStringUtils::trim(input(startPos,endPos-startPos));
    if(endPos < (int)(str.size())){
      char next = input[endPos];
      if(next == '[' || next == '.'){
        bname.Append("*");
      }
    }
    params -> Add(new TObjString(bname));

    int nextPos = str.find_first_of(sepChars.Data(), endPos);
    if(nextPos == -1) break;
    startPos = str.find_first_of(startChars.Data(), nextPos);
    if(startPos == -1) break;
    endPos = str.find_first_not_of(validChars.Data(), startPos);
  }

  return params;
}


//__________________________________________________________________________________|___________

bool TQUtils::isNum(double a){
  /* Determine if a given number is a valid and finite numerical value */

  // detect NaN
  if (a!=a) return false;
  // determine if the value is finite
  if ((a<std::numeric_limits<double>::infinity()) && (a>-std::numeric_limits<double>::infinity())) return true;
  return false;
}

//__________________________________________________________________________________|___________

bool TQUtils::inRange(double x, double a, double b){
  /* Determine if a given number is in a given range
   * if a<b, inRange(x,a,b) will return true if a<=x<=b, else false
   * if a>b, inRange(x,a,b) will return false if a<x<b, else true
   */

  if(a<b) return (bool)((a<=x) && (x<=b));
  else return (bool)((x<=b) || (a<=x));
}

//__________________________________________________________________________________|___________

unsigned long TQUtils::getCurrentTime(){
  // returns the current time in milliseconds since 01 Jan 1970, 0:00
  struct timeval tp;
  gettimeofday(&tp,NULL);
  return tp.tv_sec * 1000 + tp.tv_usec / 1000;
}

//__________________________________________________________________________________|___________

TString TQUtils::getTimeStamp(const TString& format, size_t len){
  // return the current time formatted according to the given string
  time_t rawtime;
  struct tm * timeinfo;
  char* buffer = (char*)malloc(len*sizeof(char));
  time (&rawtime);
  timeinfo = localtime (&rawtime);
  strftime (buffer,80,format.Data(),timeinfo);
  TString retval(buffer);
  free(buffer);
  return retval;
}

//__________________________________________________________________________________|___________

TString TQUtils::formatTimeDifference(unsigned int time){
  unsigned int time_d = time / 1000 / 60 / 60 / 24;
  unsigned int time_h = time / 1000 / 60 / 60;
  unsigned int time_m = time / 1000 / 60;
  unsigned int time_s = time / 1000;
  time_s = time_s - time_m * 60;
  time_m = time_m - time_h * 60;
  time_h = time_h - time_d * 24;

  std::string retval = "";
  if (time_d > 0)
    retval += std::to_string(time_d) + "-";
  if (time_h < 10)
    retval += "0" + std::to_string(time_h) + ":";
  else
    retval += std::to_string(time_h) + ":";
  if (time_m < 10)
    retval += "0" + std::to_string(time_m) + ":";
  else
    retval += std::to_string(time_m) + ":";
  if (time_s < 10)
    retval += "0" + std::to_string(time_s);
  else
    retval += std::to_string(time_s);

  return TString(retval.c_str());
}

//__________________________________________________________________________________|___________

double TQUtils::convertXtoNDC(double x) {
  // convert an x-coordinate (horizontal)
  // from user to NDC coordinates
  // using the current pad
  gPad->Update();
  return (x - gPad->GetX1())/(gPad->GetX2()-gPad->GetX1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertYtoNDC(double y) {
  // convert an y-coordinate (vertical)
  // from user to NDC coordinates
  // using the current pad
  gPad->Update();
  return (y - gPad->GetY1())/(gPad->GetY2()-gPad->GetY1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertXtoPixels(double x) {
  // convert an x-coordinate (horizontal)
  // from user to absolute (pixel) coordinates
  // using the current pad
  return TQUtils::convertXtoNDC(x) * gPad->GetWw();
}

//__________________________________________________________________________________|___________

double TQUtils::convertYtoPixels(double y) {
  // convert an y-coordinate (vertical)
  // from user to absolute (pixel) coordinates
  // using the current pad
  return TQUtils::convertXtoNDC(y) * gPad->GetWh();
}

//__________________________________________________________________________________|___________

double TQUtils::convertXfromNDC(double x) {
  // convert an x-coordinate (horizontal)
  // from NDC to user coordinates
  // using the current pad
  gPad->Update();
  return gPad->GetX1() + x*(gPad->GetX2()-gPad->GetX1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertYfromNDC(double y) {
  // convert an y-coordinate (vertical)
  // from NDC to user coordinates
  // using the current pad
  gPad->Update();
  return gPad->GetY1() + y*(gPad->GetY2()-gPad->GetY1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertdXtoNDC(double x) {
  // convert an x-distance (horizontal)
  // from user to NDC coordinates
  // using the current pad
  gPad->Update();
  return (x)/(gPad->GetX2()-gPad->GetX1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertdYtoNDC(double y) {
  // convert an y-distance (vertical)
  // from user to NDC coordinates
  // using the current pad
  gPad->Update();
  return (y)/(gPad->GetY2()-gPad->GetY1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertdXtoPixels(double x) {
  // convert an x-distance (horizontal)
  // from user to absolute (pixel) coordinates
  // using the current pad
  return TQUtils::convertdXtoNDC(x) * gPad->GetWw();
}

//__________________________________________________________________________________|___________

double TQUtils::convertdYtoPixels(double y) {
  // convert an y-distance (vertical)
  // from user to absolute (pixel) coordinates
  // using the current pad
  return TQUtils::convertdYtoNDC(y) * gPad->GetWh();
}

//__________________________________________________________________________________|___________

double TQUtils::convertdXfromNDC(double x) {
  // convert an x-distance (horizontal)
  // from NDC to user coordinates
  // using the current pad
  gPad->Update();
  return x*(gPad->GetX2()-gPad->GetX1());
}

//__________________________________________________________________________________|___________

double TQUtils::convertdYfromNDC(double y) {
  // convert an y-distance (vertical)
  // from NDC to user coordinates
  // using the current pad
  gPad->Update();
  return y*(gPad->GetY2()-gPad->GetY1());
}

//__________________________________________________________________________________|___________

double TQUtils::getAverage(std::vector<double>& vec) {
  if (vec.size() < 1 ) {
    WARNfunc("Too few entries in argument vector<double>* vec : %i found, 1 or more required, returning 0!",vec.size());
    return 0;
  }
  double sum = 0;
  for (uint i=0;i<vec.size();i++) {
    sum += vec.at(i);
  }
  sum /=vec.size();
  return sum;
}

//__________________________________________________________________________________|___________

double TQUtils::getSampleVariance(std::vector<double>& vec) {
  //returns unbiased sample variance 1/(n-1)*sum (x_i-x)^2
  if (vec.size() < 2 ) {
    ERRORfunc("Too few entries in argument vector<double>* vec : %i found, 2 or more required, returning 0!",vec.size());
    return 0;
  }
  double avg = getAverage(vec);
  double sqsum = 0;
  for (uint i=0;i<vec.size();i++) {
    sqsum += pow(vec.at(i)-avg,2);
  }
  sqsum /=(vec.size()-1);
  return sqsum;
}

//__________________________________________________________________________________|___________

double TQUtils::getSampleCovariance(std::vector<double>& vec1, std::vector<double>& vec2, bool /*verbose*/) {
  //returns unbiased sample covariance 1/(n-1)*sum (x_i-x)^2
  if (vec1.size() != vec2.size()) {
    ERRORfunc("Samples do not match in size, returning 0!");
    return 0;
  }
  if (vec1.size() < 2 ) {
    ERRORfunc("Too few entries in argument vector<double>& vec1 and vec2 : %i found, 2 or more required, returning 0!",vec1.size());
    return 0;
  }

  double avg1 = getAverage(vec1);
  double avg2 = getAverage(vec2);
  double sqsum = 0;
  for (uint i=0;i<vec1.size();i++) {//we checked that vec1.size == vec2.size before.
    sqsum += (vec1.at(i)-avg1)*(vec2.at(i)-avg2);
  }
  sqsum /=(vec1.size()-1);
  return sqsum;
}

//__________________________________________________________________________________|___________

double TQUtils::getSampleCorrelation(std::vector<double>& vec1, std::vector<double>& vec2, bool verbose) {
  if (vec1.size() != vec2.size()) {
    ERRORfunc("Samples do not match in size, returning 0!");
    return 0;
  }
  if (vec1.size() < 2 ) {
    ERRORfunc("Too few entries in argument vector<double>& vec1 and vec2 : %i found, 2 or more required, returning 0!",vec1.size());
    return 0;
  }
  double var1 = getSampleVariance(vec1);
  double var2 = getSampleVariance(vec2);
  if (var1 ==0 || var2 == 0) {
    if(verbose) WARNfunc("Variance of either sample is zero, returning NaN!");
    return std::numeric_limits<double>::quiet_NaN();
  }
  return getSampleCovariance(vec1,vec2,verbose)/sqrt(var1*var2);
}

//__________________________________________________________________________________|___________

double TQUtils::getAverageOrderOfMagnitude(TMatrixD* mat){
  // Calculates the average order of magnitude of the matrix entries through log10(value).
  // If value is zero, the order of magnitude is assumed to be zero.
  // This version does not round at any step.
  if (!mat || mat->GetNrows() == 0 || mat->GetNcols() == 0) return 0.;
  double res = 0.;
  for (int i=0; i<mat->GetNrows(); ++i) {
    for (int j=0; j<mat->GetNcols(); ++j) {
      res += TQUtils::getOrderOfMagnitude((*mat)(i,j));
    }
  }
  return res/(mat->GetNrows()*mat->GetNcols());
}

//__________________________________________________________________________________|___________

int TQUtils::getAverageOrderOfMagnitudeInt(TMatrixD* mat){
  // Calculates the average order of magnitude of the matrix entries through log10(value).
  // If value is zero, the order of magnitude is assumed to be zero.
  // This version rounds down to the next integer at each step (i.e. at each log10(value) as well as for the average)
  if (!mat || mat->GetNrows() == 0 || mat->GetNcols() == 0) return 0;
  int res = 0;
  for (int i=0; i<mat->GetNrows(); ++i) {
    for (int j=0; j<mat->GetNcols(); ++j) {
      res += TQUtils::getOrderOfMagnitudeInt((*mat)(i,j));
    }
  }
  return (int) res/(mat->GetNrows()*mat->GetNcols());
}





//__________________________________________________________________________________|___________

TList* TQUtils::execute(const TString& cmd, size_t maxOutputLength){
  // execute the commmand, returning a TList containing lines of output it produced
  FILE *out = popen(cmd.Data(), "r");
  if(!out) return NULL;
  char* line = (char*)malloc(maxOutputLength*sizeof(char));
  if(!line){ pclose(out); return NULL; }
  TList* l = new TList();
  l->SetOwner(true);
  bool esc = false;
  while (!feof(out)) {
    TString sLine = "";
    while(TQStringUtils::isASCII(sLine)) {
      if(!fgets(line, maxOutputLength, out)) {
        esc = true;
        break;
      }
      sLine += line;
      memset(line, 0, maxOutputLength*sizeof(char));
    }
    if (esc) break;
    TString s = TQStringUtils::trim(sLine,TQStringUtils::blanksAll);
    if(!s.IsNull())
      l->Add(new TObjString(s));
  }
  free(line);
  pclose(out);
  return l;
}

//__________________________________________________________________________________|___________

TString TQUtils::findFileEOS(const TString& basepath, const TString& filename, const TString& eosprefix){
  // return the full valid path of a file residing on EOS, given the filename and a base folder
  // returns empty string if no match found
  TString path = eosprefix+TQFolder::concatPaths(basepath,filename);
  if(TQUtils::fileExists(path)){
    return path;
  }
  TQIterator itr(TQUtils::execute(TQLibrary::getEOScmd()+" ls "+basepath),true);
  while(itr.hasNext()){
    TObject* obj = itr.readNext();
    TString name = obj->GetName();
    if(name.Contains("/")){
      path = name;
    } else {
      path = TQFolder::concatPaths(basepath,name);
    }
    TList* l = TQUtils::execute(TQLibrary::getEOScmd()+" stat "+path,1024);
    if(!l) return "";
    TString status = TQStringUtils::concatNames(l,"");
    delete l;
    if(status.IsNull())
      return "";
    TObjArray* a = status.Tokenize(" ");
    if(!a) return "";
    if(a->IsEmpty()){
      delete a;
      return "";
    }
    TString type = a->Last()->GetName();
    delete a;
    if(type == "directory"){
      TString retval = TQUtils::findFileEOS(path,filename,eosprefix);
      if(!retval.IsNull()){
        return retval;
      }
    } else if(type == "file"){
      if(filename.CompareTo(name) == 0){
        return eosprefix+TQFolder::concatPaths(basepath,name);
      }
    }
  }
  return "";
}

//__________________________________________________________________________________|___________

TString TQUtils::findFileLocal(const TString& basepath, const TString& filename){
  // return the full valid path of a local file, given the filename and a base folder
  // returns empty string if no match found
  TString path = TQFolder::concatPaths(basepath,filename);
  if(TQUtils::fileExists(path))
    return path;
  DIR* dirp = opendir(basepath.Data());
  dirent* dp;
  while ((dp = readdir(dirp)) != NULL){
    if(dp->d_type == DT_DIR){
      TString dname(dp->d_name);
      if(dname == "." || dname == "..") continue;
      TString subpath = TQFolder::concatPaths(basepath,dname);
      TString found = TQUtils::findFileLocal(subpath,filename);
      if(!found.IsNull()){
        closedir(dirp);
        return found;
      }
    } else {
      if(filename.CompareTo(dp->d_name) == 0)
        return TQFolder::concatPaths(basepath,dp->d_name);
    }
  }
  closedir(dirp);
  return "";
}


//__________________________________________________________________________________|___________

TString TQUtils::findFile(const TString& basepath, const TString& filename){
  // return the full valid path of a file at any location, given the filename and a list of base folders
  // returns empty string if no match found
  if(basepath.BeginsWith("root://")){
    size_t pathpos = basepath.Index("/eos/");
    TString eosprefix = basepath(0,pathpos);
    TString path = basepath(pathpos,basepath.Length());
    return TQUtils::findFileEOS(path,filename,eosprefix);
  } else {
    return TQUtils::findFileLocal(basepath,filename);
  }
  return "";
}


//__________________________________________________________________________________|___________

TString TQUtils::findFile(TList* basepaths, const TString& filename, int& index){
  // return the full valid path of a file, given the filename and a list of base folders
  // returns empty string if no match found
  if(!basepaths || filename.IsNull()){
    return "";
  }
  TQIterator itr(basepaths);
  index = 0;
  while(itr.hasNext()){
    index++;
    TObject* obj=itr.readNext();
    TString result = TQUtils::findFile(obj->GetName(),filename);
    if(!result.IsNull()){
      return result;
    }
  }
  return "";
}

//__________________________________________________________________________________|___________

TString TQUtils::findFile(TList* basepaths, const TString& filename){
  // return the full valid path of a file, given the filename and a list of base folders
  // returns empty string if no match found
  int index;
  return TQUtils::findFile(basepaths,filename,index);
}

//__________________________________________________________________________________|___________

TList* TQUtils::ls(TString exp){
  // return a list of files matching the expression
  // if used on local files, the output is equivalent to bash "ls"
  //
  // this function also supports remote file systems
  // - for EOS, please make sure that TQLibrary knows about
  // the location of the "eos.select" binary
  // if not properly detected by the Makefile, this can be
  // edited by calling TQLibrary::getQLibary()->setEOScmd("...")
  // please prefix EOS paths with "root://"
  // - for Grid dCache, please make sure that TQLibrary knows about
  // * the name of the local group disk
  // set with TQLibary::getQLibrary()->setLocalGroupDisk("...")
  // * a dq2 suite (default "dq2")
  // set with TQLibary::getQLibrary()->setDQ2cmd("...")
  // * if necessary, path head replacements. Set with
  // TQLibrary::getQLibrary()->setDQ2Head() for the old head to be removed
  // TQLibrary::getQLibrary()->setdCacheHead() for the new head to be prepended
  // all of these values can be set in a "locals.h" defintion file, for example, put
  // #define LOCALGROUPDISK "UNI-FREIBURG_LOCALGROUPDISK"
  // #define DQ2PATHHEAD "srm://se.bfg.uni-freiburg.de"
  // #define DCACHEPATHHEAD "dcap://se.bfg.uni-freiburg.de:22125"
  // please prefix dataset expressions with "dCache:"
  if(exp.BeginsWith("root://")){
    size_t pathpos = exp.Index("/eos/")+1;
    TString eosprefix = exp(0,pathpos);
    TQStringUtils::ensureTrailingText(eosprefix,"//");
    TString path = exp(pathpos,exp.Length());
    return TQUtils::lsEOS(path,eosprefix);
  } else if(TQStringUtils::removeLeadingText(exp,"dCache:")){
    return TQUtils::lsdCache(exp, TQLibrary::getLocalGroupDisk(), TQLibrary::getDQ2PathHead(), TQLibrary::getdCachePathHead(), TQLibrary::getDQ2cmd());
  } else {
    return TQUtils::lsLocal(exp);
  }
  return NULL;
}

//__________________________________________________________________________________|___________

TList* TQUtils::lsEOS(TString exp, const TString& eosprefix, TString path){
  // return a full list of all files in the given location on EOS
  // please make sure that TQLibrary knows about the location of the
  // binary "eos.select".
  // if not properly detected by the Makefile, this can be
  // edited by calling TQLibrary::getQLibary()->setEOScmd("...")
  TList* retval = new TList();
  retval->SetOwner(true);
  while(!exp.IsNull()){
    TString head = TQFolder::getPathHead(exp);
    if(head.First("*?") == kNPOS){
      std::cout << std::endl << path << " " << head << std::endl << std::endl;
      path = TQFolder::concatPaths(path,head);
    } else {
      TList* l = TQUtils::execute(TQLibrary::getEOScmd()+" ls "+path);
      TQIterator itr(l,true);
      while(itr.hasNext()){
        TObject* obj = itr.readNext();
        if(TQStringUtils::matches(obj->GetName(),head)){
          if(exp.IsNull()){
	    std::cout << std::endl << std::endl << path << " " << obj->GetName() << std::endl << std::endl;
            retval->Add(new TObjString(eosprefix+TQFolder::concatPaths(path,obj->GetName())));
          } else {
            TList* matches = TQUtils::lsEOS(exp,eosprefix,path);
            TQListUtils::moveListContents(matches,retval);
            delete matches;
          }
        }
      }
      return retval;
    }
  }
  retval->Add(new TObjString(eosprefix+path));
  return retval;
}

//__________________________________________________________________________________|___________

TList* TQUtils::lsdCache(const TString& fname, const TString& localGroupDisk, const TString& oldHead, const TString& newHead, const TString& dq2cmd){
  // return a full list of all files locally available in the dCache
  // the dataset and localGroupDisk names are forwarded to dq2-ls
  // the dq2-command can be set as optional parameter (use, e.g. 'dq2' or 'rucio')
  // if oldHead and newHead are given, the resulting path head will be exchanged accordingly
  TList* retval = new TList();
  retval->SetOwner(true);
  if(fname.IsNull()) return retval;
  std::stringstream s;
  s << dq2cmd << "-ls -L " << localGroupDisk << " -fpD " << fname;
  TList* items = TQUtils::execute(s.str().c_str(),1024);
  items->SetOwner(true);
  TQStringIterator itr(items,true);
  while(itr.hasNext()){
    TObjString* obj = itr.readNext();
    if(!obj) continue;
    TString str(obj->GetName());
    if(!oldHead.IsNull()) if(!TQStringUtils::removeLeadingText(str,oldHead)) continue;
    if(!newHead.IsNull()) str.Prepend(newHead);
    retval->Add(new TObjString(str));
  }
  return retval;
}

//__________________________________________________________________________________|___________

TList* TQUtils::lsLocal(const TString& exp){
  // execute an "ls" command locally and return the result as a TList
  return TQUtils::execute(TString::Format("ls %s",exp.Data()),1024);
}

//__________________________________________________________________________________|___________

TList* TQUtils::getObjectsFromFile(TString identifier, TClass* objClass){
  // the identifier is formatted "filename:objectname"
  // retrieves a list of all objects in the given file
  // that have a key matching the given class
  // and object name pattern (may contain wildcards)
  TString filename;
  TQStringUtils::readUpTo(identifier,filename,":");
  TQStringUtils::removeLeading(identifier,":");
  TString objname = identifier;
  return TQUtils::getObjectsFromFile(filename,objname,objClass);
}

//__________________________________________________________________________________|___________

TList* TQUtils::getObjectsFromFile(const TString& filename, const TString& objName, TClass* objClass){
  // retrieves a list of all objects in the given file
  // that have a key matching the given class
  // and object name pattern (may contain wildcards)
  TFile* f = TFile::Open(filename,"READ");
  gDirectory->cd();
  if(!f || !f->IsOpen()){
    ERRORfunc("unable to open file '%s!",filename.Data());
    if(f) delete f;
    return NULL;
  }
  TList* retval = TQUtils::getObjects(objName,objClass,f);
  TQIterator itr(retval);
  while(itr.hasNext()){
    TObject* o = itr.readNext();
    f->Remove(o);//Detach the object from the file, otherwise it's gone once we close the file! (SetDirectory(0) is not implemented for TObject, but only for (some) derived classes, this basically emulates the functionality)
    TQFolder* folder = dynamic_cast<TQFolder*>(o);
    if(folder) folder->setDirectory(gDirectory);
  }
  f->Close();
  delete f;
  return retval;
}

//__________________________________________________________________________________|___________

TList* TQUtils::getObjects(const TString& objName, TClass* objClass, TDirectory* d){
  // retrieves a list of all objects in the given directory
  // that have a key matching the given class
  // and object name pattern (may contain wildcards)
  // Wildcard matching is disabled, if the given name contains a slash (/). In
  // this case the given name is used directory in root_file->Get(..), which
  // means that the TTrees can be stored in TDirectories.
  if(!d) return NULL;
  if(!objClass) return NULL;
  TQIterator itr(d->GetListOfKeys());
  std::map<TString,bool> map;
  TList* retval = new TList();

  if (objName.Contains("/")) {
    TObject* obj = d->Get(objName);
    if (obj) {
      retval->Add(obj);
      return retval;
    }
  }

  while(itr.hasNext()){
    TKey* key = (TKey*)(itr.readNext());
    TClass* c = TClass::GetClass(key->GetClassName());
    if(!c) continue;
    if(!c->InheritsFrom(objClass))
      continue;
    TString name = key->GetName();
    if(!TQStringUtils::matches(name,objName))
      continue;
    if(map.find(name) != map.end())
      continue;
    TObject* obj = d->Get(name);
    if(!obj) continue;
    TQTaggable* taggable = dynamic_cast<TQTaggable*>(obj);
    if(taggable){
      taggable->setTagString(".origin",d->GetName());
      taggable->setTagString(".key",name);
    }
    map[name] = true;
    retval->Add(obj);
  }
  return retval;
}

//__________________________________________________________________________________|___________

std::vector<TQTaggable*>* TQUtils::getListOfTagsFromFile(const TString& filename){
  // retrieves a list of sets of tags written in a file
  // tags written in a single line are put together a set, i.e. one TQTaggable
  // optionally provide a dictionary for $(placeholder)'s
  std::vector<TQTaggable*>* tagsList = new std::vector<TQTaggable*>();
  std::vector<TString>* lines = TQStringUtils::readFileLines(filename);
  if(!lines){
    ERRORfunc("unable to read file '%s'",filename.Data());
    return tagsList;
  }
  for(size_t iline=0; iline<lines->size(); ++iline){
    TQTaggable* tags = new TQTaggable();
    tags->importTags(lines->at(iline));
    tagsList->push_back(tags);
  }
  delete lines;
  if(!tagsList->size()){
    WARNfunc("no tags found in file %", filename.Data());
  }
  return tagsList;
}

//__________________________________________________________________________________|___________

std::vector<TQTaggable*>* TQUtils::getListOfTagsFromFile(const TString& filename, TQTaggable& dictTags){
  // retrieves a list of sets of tags written in a file
  // tags written in a single line are put together a set, i.e. one TQTaggable
  // optionally provide a dictionary for $(placeholder)'s
  std::vector<TQTaggable*>* tagsList = new std::vector<TQTaggable*>();
  std::vector<TString>* lines = TQStringUtils::readFileLines(filename);
  if(!lines){
    ERRORfunc("unable to read file '%s'",filename.Data());
    return tagsList;
  }
  for(size_t iline=0; iline<lines->size(); ++iline){
    TQTaggable* tags = new TQTaggable();
    tags->importTags(dictTags.replaceInText(lines->at(iline)));
    tagsList->push_back(tags);
  }
  delete lines;
  if(!tagsList->size()){
    WARNfunc("no tags found in file %", filename.Data());
  }
  return tagsList;
}

//__________________________________________________________________________________|___________

void TQUtils::printBranches(TTree* t){
  // print the branches of a tree in a nice format
  TCollection* branches = t->GetListOfBranches();
  int width = TQListUtils::getMaxNameLength(branches);
  int typewidth = 40;
  TQIterator itr(branches);
  std::cout << TQStringUtils::makeBoldWhite(TQStringUtils::fixedWidth(t->GetName(),width,false)) << " " << TQStringUtils::makeBoldWhite("status") << " " << TQStringUtils::makeBoldWhite(TQStringUtils::fixedWidth("type",typewidth,false)) << std::endl;
  while(itr.hasNext()){
    TBranch* obj = (TBranch*)(itr.readNext());
    std::cout << TQStringUtils::fixedWidth(obj->GetName(),width,false);
    std::cout << " " << t->GetBranchStatus(obj->GetName());
    std::cout << " " << TQStringUtils::fixedWidth(obj->GetClassName(),typewidth,false) << std::endl;
  }
}

//__________________________________________________________________________________|___________

void TQUtils::printActiveBranches(TTree* t){
  // print the active branches of a tree in a nice format
  TCollection* branches = t->GetListOfBranches();
  int width = TQListUtils::getMaxNameLength(branches);
  int typewidth = 40;
  int count = 0;
  TQIterator itr(branches);
  std::cout << TQStringUtils::makeBoldWhite(TQStringUtils::fixedWidth(t->GetName(),width,false)) << " " << TQStringUtils::makeBoldWhite(TQStringUtils::fixedWidth("type",typewidth,false)) << std::endl;
  while(itr.hasNext()){
    TBranch* obj = (TBranch*)(itr.readNext());
    if(t->GetBranchStatus(obj->GetName())){
      std::cout << TQStringUtils::fixedWidth(obj->GetName(),width,false);
      std::cout << " " << TQStringUtils::fixedWidth(obj->GetClassName(),typewidth,false) << std::endl;
      count++;
    }
  }
  if(count < 1){
    std::cout << "< no active branches >" << std::endl;
  }
}

//__________________________________________________________________________________|___________

#ifdef HAS_XAOD
void printProductionChainLocal(const xAOD::TruthParticle* p, size_t indent){
  if(!p) return;
  for(size_t i=0; i<indent; ++i){
    std::cout << "  ";
  }
  std::cout << "idx=" << p->index() << ", id=" << p->pdgId() << ", status=" << p->status();
  if(p->nParents() == 0){
    std::cout << " (initial)" << std::endl;
  } else {
    std::cout << std::endl;
    for(size_t i=0; i<p->nParents(); ++i){
      printProductionChainLocal(p->parent(i),indent+1);
    }
  }
}
#endif


void TQUtils::printProductionChain(TTree* t, Long64_t evt, int ptcl, const TString& bName){
#ifdef HAS_XAOD
  if(!t->GetCurrentFile()){
    ERRORfunc("cannot read trees from memory - please use a file-based TTree instead. are you using a TransientTree?");
    return;
  }
  xAOD::TEvent event(t, xAOD::TEvent::kClassAccess);
  const xAOD::TruthParticleContainer* truthrecord = 0;
  event.getEntry( evt );
  if(event.retrieve(truthrecord, bName.Data()).isFailure()){
    ERRORfunc("unable to retrieve event!");
    return;
  }
  const xAOD::TruthParticle* p = truthrecord->at(ptcl);
  printProductionChainLocal(p,0);
#endif
}

#ifdef HAS_XAOD
void printDecayChainLocal(const xAOD::TruthParticle* p, size_t indent){
  if(!p) return;
  for(size_t i=0; i<indent; ++i){
    std::cout << "  ";
  }
  std::cout << "idx=" << p->index() << ", id=" << p->pdgId() << ", status=" << p->status();
  if(p->nChildren() == 0){
    std::cout << " (final)" << std::endl;
  } else {
    std::cout << std::endl;
    for(size_t i=0; i<p->nChildren(); ++i){
      printDecayChainLocal(p->child(i),indent+1);
    }
  }
}
#endif

void TQUtils::printDecayChain(TTree* t, Long64_t evt, int ptcl, const TString& bName){
#ifdef HAS_XAOD
  if(!t->GetCurrentFile()){
    ERRORfunc("cannot read trees from memory - please use a file-based TTree instead. are you using a TransientTree?");
    return;
  }
  xAOD::TEvent event(t, xAOD::TEvent::kClassAccess);
  const xAOD::TruthParticleContainer* truthrecord = 0;
  event.getEntry( evt );
  if(event.retrieve(truthrecord, bName.Data()).isFailure()){
    ERRORfunc("unable to retrieve event!");
    return;
  }
  const xAOD::TruthParticle* p = truthrecord->at(ptcl);
  printDecayChainLocal(p,0);
#endif
}


void TQUtils::printParticles(TTree* t, Long64_t evt, int id, const TString& bName){
#ifdef HAS_XAOD
  if(!t->GetCurrentFile()){
    ERRORfunc("cannot read trees from memory - please use a file-based TTree instead. are you using a TransientTree?");
    return;
  }
  xAOD::TEvent event(t, xAOD::TEvent::kClassAccess);
  const xAOD::TruthParticleContainer* truthrecord = 0;
  event.getEntry( evt );
  if(event.retrieve(truthrecord, bName.Data()).isFailure()){
    ERRORfunc("unable to retrieve event!");
    return;
  }
  for(size_t i=0; i<truthrecord->size(); ++i){
    const xAOD::TruthParticle* p = truthrecord->at(i);
    if(p && p->pdgId() == id)
      std::cout << "idx=" << i << ", " << "id=" << p->pdgId() << ", status=" << p->status() << std::endl;
  }
#endif
}


void TQUtils::printParticle(TTree* t, Long64_t evt, int index, const TString& bName){
#ifdef HAS_XAOD
  if(!t->GetCurrentFile()){
    ERRORfunc("cannot read trees from memory - please use a file-based TTree instead. are you using a TransientTree?");
    return;
  }
  xAOD::TEvent event(t, xAOD::TEvent::kClassAccess);
  const xAOD::TruthParticleContainer* truthrecord = 0;
  event.getEntry( evt );
  if(event.retrieve(truthrecord, bName.Data()).isFailure()){
    ERRORfunc("unable to retrieve event!");
    return;
  }
  if(index >= (int)(truthrecord->size())){
    ERRORfunc("cannot access particle %d, truth record only has %d entries",index,(int)(truthrecord->size()));
    return;
  }
  const xAOD::TruthParticle* p = truthrecord->at(index);
  std::cout << "idx=" << index << ", " << "id=" << p->pdgId() << ", status=" << p->status() << ", pt=" << p->pt() << ", eta=" << p->eta() << ", phi=" << p->phi() << ", E=" << p->e() << ", m=" << p->m() << ", px=" << p->px() << ", py=" << p->py() << ", pz=" << p->pz() << std::endl;
#endif
}

//__________________________________________________________________________________|___________

double TQUtils::getValue(TTree* t, const TString& bname, Long64_t iEvent){
  // evaluate an expression on a specific event of a TTree
  if(!t || bname.IsNull() || iEvent < 0) return std::numeric_limits<double>::quiet_NaN();
  t->SetBranchStatus("*",1);
  TTreeFormula* f = new TTreeFormula("tmp",bname,t);
  t->GetEvent(iEvent);
  double val = f->EvalInstance(0.);
  delete f;
  return val;
}

//__________________________________________________________________________________|___________

double TQUtils::getSum(TTree* t, const TString& bname){
  // evaluate an expression on all events of a TTree and return the sum
  if(!t || bname.IsNull()) return std::numeric_limits<double>::quiet_NaN();
  TCollection* branches = TQUtils::getBranchNames(bname);
  TQIterator it(branches);
  t->SetBranchStatus("*",0);
  while(it.hasNext()){
    t->SetBranchStatus(it.readNext()->GetName(),1);
  }
  TTreeFormula* f = new TTreeFormula("tmp",bname,t);
  Long64_t nEvents = t->GetEntries();
  double val = 0;
  for(Long64_t iEvent =0; iEvent<nEvents; ++iEvent){
    t->GetEvent(iEvent);
    val += f->EvalInstance(0.);
  }
  delete f;
  return val;
}

//__________________________________________________________________________________|___________

#ifdef HAS_XAOD
double TQUtils::xAODMetaDataGetSumWeightsInitialFromEventBookkeeper(TTree* metaData){
  // retrieve the initial sum of weights from the event bookkeepers in this tree
  // thanks to a dirty hack, this also works in standalone mode
  if (!metaData) return std::numeric_limits<double>::quiet_NaN();
  TTreeFormula tf("tf","EventBookkeepers.m_nWeightedAcceptedEvents",metaData);
  metaData->LoadTree(0);
  tf.UpdateFormulaLeaves();
  tf.GetNdata();
  double initialSumOfWeightsInThisFile = tf.EvalInstance(1);
  return initialSumOfWeightsInThisFile;
}

namespace TQUtils {
  xAOD::TEvent* xAODMakeEvent(TFile* file){
    if (!file){
      throw std::runtime_error("invalid file");
    }
    xAOD::TEvent* event = new xAOD::TEvent(xAOD::TEvent::kClassAccess);
    if(!event->readFrom(file).isSuccess()){
      throw(TString::Format("unable to read tree from file '%s' into xAOD::TEvent -- possible version incompatibilities?",file->GetName()).Data());
    }
    return event;
  }

  namespace {
    const xAOD::CutBookkeeper* findCutBookkeeper(xAOD::CutBookkeeperContainer* cont, const std::string& name, bool useMaxCycle, const std::string& inputStream){
      if (!cont->size()) {
        throw std::runtime_error("Size of CutBookkeeper container equal to 0");
      }
      // Recommendation is to use the highest cycle for initial events/sum-of-weigths
      int maxCycle = -1;
      const xAOD::CutBookkeeper* c = 0;
      for (const xAOD::CutBookkeeper* cbk: *cont) {
        if(!cbk) {
          WARNfunc("Found invalid CutBookkeeper in container.");
          continue;
        }
        try {
          // This approach prevents errors if for some reason the highest cycle has no entry for "AllExecutedEvents" (which doesn't necessarily points to a problem, maybe add a warning?)
          if ( (!useMaxCycle || (cbk->cycle() > maxCycle)) && (cbk->name() == name) && (cbk->inputStream() == inputStream) ) {
            c = cbk;
            maxCycle = cbk->cycle();
          }
        } catch (const std::exception& e){
          throw std::runtime_error(TString::Format("unable to access content of CutBookkeeper. %s",e.what()).Data());
        }
      }
      if(!c) {
        throw std::runtime_error("Reaching end of function without having found CutBookkeeper result.");
      }

      return c;
    }
  }

  xAOD::CutBookkeeper::Payload xAODMetaDataGetCutBookkeeper(xAOD::TEvent& event, const char* container, const char* bookkeeper){
    // First, check that we have no incomplete bookkeepers.
    // This would be an indication that somewhere in the processing
    // chain, an input file was not completely processed. You should
    // thus disregard the current file as it is not trustworthy.
    const xAOD::CutBookkeeperContainer* constCont = NULL;
    if(event.retrieveMetaInput(constCont, "CutBookkeepers").isFailure() || !constCont){
      throw std::runtime_error("unable to retrieve CutBookkeeper!");
    }
    // due to problems connecting the containers to their aux data store, we need to do this manually
    xAOD::CutBookkeeperContainer* cont = const_cast<xAOD::CutBookkeeperContainer*>(constCont);
    // in the xAOD EDM, the CutBookkeeper bookkeeper contains the initial processing
    if(!cont){
      throw ("unable to const-cast cutbokkeeper");
    }
    const xAOD::CutBookkeeper* c = findCutBookkeeper(cont,bookkeeper,true,container);
    if(!c){
      throw ("unable to find CutBookkeeper 'AllExecutedEvents'");
    }
    return c->payload();
  }
}

double TQUtils::xAODMetaDataGetSumWeightsInitialFromCutBookkeeper(xAOD::TEvent& event, const char* container, const char* bookkeeper){
  // retrieve the initial sum of weights from the cut bookkeepers in this file
  try {
    // xAOD::TEvent event(TQUtils::xAODMakeEvent(file));
    xAOD::CutBookkeeper::Payload payload(TQUtils::xAODMetaDataGetCutBookkeeper(event,container,bookkeeper));
    return payload.sumOfEventWeights;
  } catch (const std::exception& e){
    ERRORfunc(e.what());
  }
  return std::numeric_limits<double>::quiet_NaN();
}

double TQUtils::xAODMetaDataGetSumWeightsInitialFromCutBookkeeper(TTree* metadata, const char* container, const char* bookkeeper){
  // retrieve the initial sum of weights from the cut bookkeepers in this file
  xAOD::TEvent evnt(metadata);
  return TQUtils::xAODMetaDataGetSumWeightsInitialFromCutBookkeeper(evnt,container,bookkeeper);
}

double TQUtils::xAODMetaDataGetNEventsInitialFromCutBookkeeper(xAOD::TEvent& event, const char* container, const char* bookkeeper){
  // retrieve the initial number of events from the cut bookkeepers in this file
  try {
    // xAOD::TEvent event(TQUtils::xAODMakeEvent(file));
    xAOD::CutBookkeeper::Payload payload(TQUtils::xAODMetaDataGetCutBookkeeper(event,container,bookkeeper));
    return payload.nAcceptedEvents;
  } catch (const std::exception& e){
    ERRORfunc(e.what());
  }
  return std::numeric_limits<double>::quiet_NaN();
}

double TQUtils::xAODMetaDataGetNEventsInitialFromCutBookkeeper(TTree* metadata, const char* container, const char* bookkeeper){
  xAOD::TEvent evnt(metadata);
  return TQUtils::xAODMetaDataGetNEventsInitialFromCutBookkeeper(evnt,container,bookkeeper);
}

#endif

//__________________________________________________________________________________|___________

TList* TQUtils::getListOfFoldersInFile(const TString& filename, TClass* type){
  // retrieve the list of TQFolders contained in a given file
  // if the class type is given, only TQFolder instances
  // of the given class type are considered
  TList* list = new TList();
  TQUtils::appendToListOfFolders(filename, list, type);
  return list;
}

//__________________________________________________________________________________|___________

int TQUtils::appendToListOfFolders(const TString& filename, TList* list, TClass* type){
  // append all TQfolders contained in a given file to a list
  // if the class type is given, only TQFolder instances
  // of the given class type are considered
  if(!type || !list || !type->InheritsFrom(TQFolder::Class())) return 0;
  TFile* f = TFile::Open(filename,"READ");
  if(!f) return 0;
  if(!f->IsOpen()) { delete f; return 0; };
  TQIterator* itr = new TQIterator(f->GetListOfKeys());
  int num = 0;
  while(itr->hasNext()){
    TKey* key = (TKey*)(itr->readNext());
    TClass * c = TClass::GetClass(key->GetClassName());
    if(!c) continue;
    if(!c->InheritsFrom(type))
      continue;
    TString name = key->GetName();
    if(name.First('-') != kNPOS)
      continue;
    TQFolder* folder = dynamic_cast<TQFolder*>(f->Get(name));
    if(!folder) continue;
    folder->setTagString(".key",name);
    folder->resolveImportLinks();
    list->Add(folder);
    num++;
  }
  f->Close();
  return num;
}

//__________________________________________________________________________________|___________

TList* TQUtils::getListOfFolderNamesInFile(const TString& filename, TClass* type){
  // retrieve the list of names of TQFolders contained in a given file
  // if the class type is given, only TQFolder instances
  // of the given class type are considered
  TList* list = new TList();
  TQUtils::appendToListOfFolderNames(filename, list, type);
  return list;
}

//__________________________________________________________________________________|___________

int TQUtils::appendToListOfFolderNames(const TString& filename, TList* list, TClass* type, const TString& prefix){
  // append all names of TQFolders contained in a given file to a list
  // if the class type is given, only TQFolder instances
  // of the given class type are considered
  // the prefix is prepended to every single name
  if(!type || !list || !type->InheritsFrom(TQFolder::Class())) return 0;
  TFile* f = TFile::Open(filename,"READ");
  if(!f) return 0;
  if(!f->IsOpen()) { delete f; return 0; };
  TQIterator* itr = new TQIterator(f->GetListOfKeys());
  int num = 0;
  while(itr->hasNext()){
    TKey* key = (TKey*)(itr->readNext());
    TClass * c = TClass::GetClass(key->GetClassName());
    if(!c) continue;
    if(!c->InheritsFrom(type))
      continue;
    TString name = key->GetName();
    if(name.First('-') != kNPOS)
      continue;
    list->Add(new TObjString(prefix+name));
    num++;
  }
  f->Close();
  return num;
}


//__________________________________________________________________________________|___________

double TQUtils::roundAuto(double d, int nSig){
  // round some double to a number of significant digits
  if(d == 0 || !TQUtils::isNum(d)) return d;
  int ndigits = floor(log10(fabs(d))) + 1 - nSig;
  if(fabs(d / pow(10,ndigits)) < 2) ndigits--;
  return pow(10.,ndigits)*floor(d / pow(10,ndigits)+0.5);
}

//__________________________________________________________________________________|___________

double TQUtils::roundAutoDown(double d, int nSig){
  // round down some double to a number of significant digits
  if(d == 0 || !TQUtils::isNum(d)) return d;
  int ndigits = floor(log10(fabs(d))) + 1 - nSig;
  if(fabs(d / pow(10,ndigits)) < 2) ndigits--;
  return pow(10.,ndigits)*floor(d / pow(10,ndigits));
}

//__________________________________________________________________________________|___________

double TQUtils::roundAutoUp(double d, int nSig){
  // round up some double to a number of significant digits
  if(d == 0 || !TQUtils::isNum(d)) return d;
  int ndigits = floor(log10(fabs(d))) + 1 - nSig;
  if(fabs(d / pow(10,ndigits)) < 2) ndigits--;
  return pow(10.,ndigits)*ceil(d / pow(10,ndigits));
}


//__________________________________________________________________________________|___________

double TQUtils::round(double d, int ndigits){
  // round some double to a number of digits
  return pow(10.,-ndigits)*floor(d * pow(10,ndigits)+0.5);
}

//__________________________________________________________________________________|___________

double TQUtils::roundDown(double d, int ndigits){
  // round down some double to a number of digits
  return pow(10.,-ndigits)*floor(d * pow(10,ndigits));
}

//__________________________________________________________________________________|___________

double TQUtils::roundUp(double d, int ndigits){
  // round up some double to a number of digits
  return pow(10.,-ndigits)*ceil(d * pow(10,ndigits));
}

//__________________________________________________________________________________|___________

TString TQUtils::getMD5(const TString& filepath){
  // retrieve the MD5 sum (hex value) of some file as a TString
  if(filepath.BeginsWith("root://eos")){
    return TQUtils::getMD5EOS(filepath);
  }
  return TQUtils::getMD5Local(filepath);
}

//__________________________________________________________________________________|___________

TString TQUtils::getMD5Local(const TString& filepath){
  // retrieve the MD5 sum (hex value) of some local file as a TString
  TMD5* sum = TMD5::FileChecksum(filepath);
  if(!sum) return "";
  TString retval(sum->AsString());
  delete sum;
  return retval;
}

//__________________________________________________________________________________|___________

TString TQUtils::getMD5EOS(TString filepath){
  // retrieve the MD5 sum (hex value) of some EOS file as a TString
  if(!(TQStringUtils::removeLeadingText(filepath,"root://eos") &&
       (TQStringUtils::removeLeadingText(filepath,"user") || TQStringUtils::removeLeadingText(filepath,"atlas")) &&
       TQStringUtils::removeLeadingText(filepath,"/"))) return "<unknown>";
  filepath.Prepend(" stat ");
  filepath.Prepend(TQLibrary::getEOScmd());
  filepath.Append(" | md5sum | cut -f 1 -d ' '");
  TQLibrary::redirect("/dev/null");
  TList* ret = TQUtils::execute(filepath);
  if(ret->GetEntries() != 1){
    delete ret;
    return "<error>";
  }
  TQLibrary::restore();
  TString retval(ret->First()->GetName());
  delete ret;
  return retval;
}

//__________________________________________________________________________________|___________

TString TQUtils::getModificationDate(TFile* f){
  // return the modification date of a TFile as a TString
  if(!f) return "";
  TDatime t(f->GetModificationDate());
  return t.AsString();
}


//__________________________________________________________________________________|___________

unsigned long TQUtils::getFileSize(const TString& path) {
  struct stat st;
  if(stat(path.Data(), &st) != 0) {
      return 0.;
  }
  return st.st_size;
}

//__________________________________________________________________________________|___________

void TQUtils::dumpTop(TString basepath, TString prefix, TString message ) {
  TQUtils::ensureDirectory(basepath);
  TString file = TString::Format("%s/%s_topDump.txt",basepath.Data(),prefix.Data());
  TQUtils::execute(TString::Format("echo \"%s\" > %s ",message.Data(),file.Data() ));
  TQUtils::execute(TString::Format("top -n 1 -u $(whoami) >> %s",file.Data() ));
  return;
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataHeader(std::ostream& out, const TString& vartype, const TString name, const TString& unit) {
  out << vartype << "_variables:\n";
  out << "- header: {name: '" << name << "'";
  if(unit.Length() > 0) out << ", unit: '" << unit << "'",
  out<< "}\n";
  out << "  values:\n";
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataValue(std::ostream& out, double d){
  out << "   - {value: " << d << "}\n";
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataValueAndError(std::ostream& out, double d, double e, std::string elbl){
  out << "   - value: " << d << "\n";
  out << "     errors : {\n";
  out << "     - {symerror : " << e << ", label : '" << elbl << "'}\n";  
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataValueWithErrors(std::ostream& out, double d){
  out << "   - value: " << d << "\n";
  out << "     errors : \n";
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataError(std::ostream& out, double eup, double edn, std::string elbl){
  out << "     - {asymerror : { plus : " << eup << ", minus : " << edn << "}, label : '" << elbl << "'}\n";  
}

//__________________________________________________________________________________|___________

void TQUtils::writeHEPdataValue(std::ostream& out, const TString& s){
  out << "   - {value: '" << s << "'}\n";
}

//__________________________________________________________________________________|___________

void TQUtils::printHEPdataInfo(TQFolder* config, const TString& title, const TString& description, const TString& filename){
  std::cout << "add the following to your submission.yaml" << std::endl;
  std::cout << "---" << std::endl;
  std::cout << "name: \"" << config->getTagStringDefault("labels.title",title) << "\"" << std::endl;
  std::cout << "description: \"" << description << "\"" << std::endl;
  std::cout << "keywords:" << std::endl;
  std::cout << " - {name: reactions, values: [" << config->getTagStringDefault("labels.process","<PUTYOURPROCESSHERE>") << "]}" << std::endl;
  std::cout << " - {name: cmenergies, values: [" << config->getTagStringDefault("labels.sqrtS","<PUTYOURSQRTSHERE>") << "]}" << std::endl;
  std::cout << "data_file: " << filename << std::endl;
  std::cout << "---" << std::endl;	  
}

//__________________________________________________________________________________|___________

std::string TQUtils::readEnvVarValue(const std::string& envVar){
  const char* envVarValue = gSystem->Getenv(envVar.c_str());
  if (envVarValue == NULL){
    DEBUGclass("The environment variable %s could not be read.", envVar.c_str());
    return "";
  }
  std::string envVarValue_string = envVarValue;
  DEBUGclass("Reading environment variable %s: %s", envVar.c_str(), envVarValue);
  return envVarValue_string;
}

bool TQUtils::readEnvVarValueBool(const std::string& envVar, bool fallback) {
  // reads an env var specified by the first argument and returns its value as
  // a boolean. If the env var is not found or cannot be safely interpreted as
  // a boolean then fallback is returned.
  std::string asString = TQUtils::readEnvVarValue(envVar);
  bool isValid = false;
  bool asBool = TQStringUtils::getBoolFromString(asString.c_str(), isValid);
  if (!isValid) {
    return fallback;
  }
  return asBool;
}


// the following functions (getPeakRSS and getCurrentRSS) are based on work of David Robert Nadeau (http://NadeauSoftware.com/) provided under Creative Commons Attribution 3.0 Unported License. Origin: http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_resident_set_size_physical_memory_use
#if defined(_WIN32)
#include <windows.h>
#include <psapi.h>

#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <sys/resource.h>

#if defined(__APPLE__) && defined(__MACH__)
#include <mach/mach.h>

#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#include <fcntl.h>
#include <procfs.h>

#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
#include <stdio.h>

#endif

#else
#warning "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS, they will not return meaningfull values!"
#endif

/**
 * Returns the peak (maximum so far) resident set size (physical
 * memory use) measured in bytes, or zero if the value cannot be
 * determined on this OS.
 */
size_t TQUtils::getPeakRSS( ) {
#if defined(_WIN32)
	/* Windows -------------------------------------------------- */
	PROCESS_MEMORY_COUNTERS info;
	GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
	return (size_t)info.PeakWorkingSetSize;

#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
	/* AIX and Solaris ------------------------------------------ */
	struct psinfo psinfo;
	int fd = -1;
	if ( (fd = open( "/proc/self/psinfo", O_RDONLY )) == -1 )
		return (size_t)0L;		/* Can't open? */
	if ( read( fd, &psinfo, sizeof(psinfo) ) != sizeof(psinfo) )
	{
		close( fd );
		return (size_t)0L;		/* Can't read? */
	}
	close( fd );
	return (size_t)(psinfo.pr_rssize * 1024L);

#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
	/* BSD, Linux, and OSX -------------------------------------- */
	struct rusage rusage;
	getrusage( RUSAGE_SELF, &rusage );
#if defined(__APPLE__) && defined(__MACH__)
	return (size_t)rusage.ru_maxrss;
#else
	return (size_t)(rusage.ru_maxrss * 1024L);
#endif

#else
	/* Unknown OS ----------------------------------------------- */
	return (size_t)0L;			/* Unsupported. */
#endif
}

/**
 * Returns the current resident set size (physical memory use) measured
 * in bytes, or zero if the value cannot be determined on this OS.
 */
size_t TQUtils::getCurrentRSS( ) {
#if defined(_WIN32)
	/* Windows -------------------------------------------------- */
	PROCESS_MEMORY_COUNTERS info;
	GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
	return (size_t)info.WorkingSetSize;

#elif defined(__APPLE__) && defined(__MACH__)
	/* OSX ------------------------------------------------------ */
	struct mach_task_basic_info info;
	mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
	if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
		(task_info_t)&info, &infoCount ) != KERN_SUCCESS )
		return (size_t)0L;		/* Can't access? */
	return (size_t)info.resident_size;

#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
	/* Linux ---------------------------------------------------- */
	long rss = 0L;
	FILE* fp = NULL;
	if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL )
		return (size_t)0L;		/* Can't open? */
	if ( fscanf( fp, "%*s%ld", &rss ) != 1 )
	{
		fclose( fp );
		return (size_t)0L;		/* Can't read? */
	}
	fclose( fp );
	return (size_t)rss * (size_t)sysconf( _SC_PAGESIZE);

#else
	/* AIX, BSD, Solaris, and Unknown OS ------------------------ */
	return (size_t)0L;			/* Unsupported. */
#endif
}
 TQUtils.cxx:1
 TQUtils.cxx:2
 TQUtils.cxx:3
 TQUtils.cxx:4
 TQUtils.cxx:5
 TQUtils.cxx:6
 TQUtils.cxx:7
 TQUtils.cxx:8
 TQUtils.cxx:9
 TQUtils.cxx:10
 TQUtils.cxx:11
 TQUtils.cxx:12
 TQUtils.cxx:13
 TQUtils.cxx:14
 TQUtils.cxx:15
 TQUtils.cxx:16
 TQUtils.cxx:17
 TQUtils.cxx:18
 TQUtils.cxx:19
 TQUtils.cxx:20
 TQUtils.cxx:21
 TQUtils.cxx:22
 TQUtils.cxx:23
 TQUtils.cxx:24
 TQUtils.cxx:25
 TQUtils.cxx:26
 TQUtils.cxx:27
 TQUtils.cxx:28
 TQUtils.cxx:29
 TQUtils.cxx:30
 TQUtils.cxx:31
 TQUtils.cxx:32
 TQUtils.cxx:33
 TQUtils.cxx:34
 TQUtils.cxx:35
 TQUtils.cxx:36
 TQUtils.cxx:37
 TQUtils.cxx:38
 TQUtils.cxx:39
 TQUtils.cxx:40
 TQUtils.cxx:41
 TQUtils.cxx:42
 TQUtils.cxx:43
 TQUtils.cxx:44
 TQUtils.cxx:45
 TQUtils.cxx:46
 TQUtils.cxx:47
 TQUtils.cxx:48
 TQUtils.cxx:49
 TQUtils.cxx:50
 TQUtils.cxx:51
 TQUtils.cxx:52
 TQUtils.cxx:53
 TQUtils.cxx:54
 TQUtils.cxx:55
 TQUtils.cxx:56
 TQUtils.cxx:57
 TQUtils.cxx:58
 TQUtils.cxx:59
 TQUtils.cxx:60
 TQUtils.cxx:61
 TQUtils.cxx:62
 TQUtils.cxx:63
 TQUtils.cxx:64
 TQUtils.cxx:65
 TQUtils.cxx:66
 TQUtils.cxx:67
 TQUtils.cxx:68
 TQUtils.cxx:69
 TQUtils.cxx:70
 TQUtils.cxx:71
 TQUtils.cxx:72
 TQUtils.cxx:73
 TQUtils.cxx:74
 TQUtils.cxx:75
 TQUtils.cxx:76
 TQUtils.cxx:77
 TQUtils.cxx:78
 TQUtils.cxx:79
 TQUtils.cxx:80
 TQUtils.cxx:81
 TQUtils.cxx:82
 TQUtils.cxx:83
 TQUtils.cxx:84
 TQUtils.cxx:85
 TQUtils.cxx:86
 TQUtils.cxx:87
 TQUtils.cxx:88
 TQUtils.cxx:89
 TQUtils.cxx:90
 TQUtils.cxx:91
 TQUtils.cxx:92
 TQUtils.cxx:93
 TQUtils.cxx:94
 TQUtils.cxx:95
 TQUtils.cxx:96
 TQUtils.cxx:97
 TQUtils.cxx:98
 TQUtils.cxx:99
 TQUtils.cxx:100
 TQUtils.cxx:101
 TQUtils.cxx:102
 TQUtils.cxx:103
 TQUtils.cxx:104
 TQUtils.cxx:105
 TQUtils.cxx:106
 TQUtils.cxx:107
 TQUtils.cxx:108
 TQUtils.cxx:109
 TQUtils.cxx:110
 TQUtils.cxx:111
 TQUtils.cxx:112
 TQUtils.cxx:113
 TQUtils.cxx:114
 TQUtils.cxx:115
 TQUtils.cxx:116
 TQUtils.cxx:117
 TQUtils.cxx:118
 TQUtils.cxx:119
 TQUtils.cxx:120
 TQUtils.cxx:121
 TQUtils.cxx:122
 TQUtils.cxx:123
 TQUtils.cxx:124
 TQUtils.cxx:125
 TQUtils.cxx:126
 TQUtils.cxx:127
 TQUtils.cxx:128
 TQUtils.cxx:129
 TQUtils.cxx:130
 TQUtils.cxx:131
 TQUtils.cxx:132
 TQUtils.cxx:133
 TQUtils.cxx:134
 TQUtils.cxx:135
 TQUtils.cxx:136
 TQUtils.cxx:137
 TQUtils.cxx:138
 TQUtils.cxx:139
 TQUtils.cxx:140
 TQUtils.cxx:141
 TQUtils.cxx:142
 TQUtils.cxx:143
 TQUtils.cxx:144
 TQUtils.cxx:145
 TQUtils.cxx:146
 TQUtils.cxx:147
 TQUtils.cxx:148
 TQUtils.cxx:149
 TQUtils.cxx:150
 TQUtils.cxx:151
 TQUtils.cxx:152
 TQUtils.cxx:153
 TQUtils.cxx:154
 TQUtils.cxx:155
 TQUtils.cxx:156
 TQUtils.cxx:157
 TQUtils.cxx:158
 TQUtils.cxx:159
 TQUtils.cxx:160
 TQUtils.cxx:161
 TQUtils.cxx:162
 TQUtils.cxx:163
 TQUtils.cxx:164
 TQUtils.cxx:165
 TQUtils.cxx:166
 TQUtils.cxx:167
 TQUtils.cxx:168
 TQUtils.cxx:169
 TQUtils.cxx:170
 TQUtils.cxx:171
 TQUtils.cxx:172
 TQUtils.cxx:173
 TQUtils.cxx:174
 TQUtils.cxx:175
 TQUtils.cxx:176
 TQUtils.cxx:177
 TQUtils.cxx:178
 TQUtils.cxx:179
 TQUtils.cxx:180
 TQUtils.cxx:181
 TQUtils.cxx:182
 TQUtils.cxx:183
 TQUtils.cxx:184
 TQUtils.cxx:185
 TQUtils.cxx:186
 TQUtils.cxx:187
 TQUtils.cxx:188
 TQUtils.cxx:189
 TQUtils.cxx:190
 TQUtils.cxx:191
 TQUtils.cxx:192
 TQUtils.cxx:193
 TQUtils.cxx:194
 TQUtils.cxx:195
 TQUtils.cxx:196
 TQUtils.cxx:197
 TQUtils.cxx:198
 TQUtils.cxx:199
 TQUtils.cxx:200
 TQUtils.cxx:201
 TQUtils.cxx:202
 TQUtils.cxx:203
 TQUtils.cxx:204
 TQUtils.cxx:205
 TQUtils.cxx:206
 TQUtils.cxx:207
 TQUtils.cxx:208
 TQUtils.cxx:209
 TQUtils.cxx:210
 TQUtils.cxx:211
 TQUtils.cxx:212
 TQUtils.cxx:213
 TQUtils.cxx:214
 TQUtils.cxx:215
 TQUtils.cxx:216
 TQUtils.cxx:217
 TQUtils.cxx:218
 TQUtils.cxx:219
 TQUtils.cxx:220
 TQUtils.cxx:221
 TQUtils.cxx:222
 TQUtils.cxx:223
 TQUtils.cxx:224
 TQUtils.cxx:225
 TQUtils.cxx:226
 TQUtils.cxx:227
 TQUtils.cxx:228
 TQUtils.cxx:229
 TQUtils.cxx:230
 TQUtils.cxx:231
 TQUtils.cxx:232
 TQUtils.cxx:233
 TQUtils.cxx:234
 TQUtils.cxx:235
 TQUtils.cxx:236
 TQUtils.cxx:237
 TQUtils.cxx:238
 TQUtils.cxx:239
 TQUtils.cxx:240
 TQUtils.cxx:241
 TQUtils.cxx:242
 TQUtils.cxx:243
 TQUtils.cxx:244
 TQUtils.cxx:245
 TQUtils.cxx:246
 TQUtils.cxx:247
 TQUtils.cxx:248
 TQUtils.cxx:249
 TQUtils.cxx:250
 TQUtils.cxx:251
 TQUtils.cxx:252
 TQUtils.cxx:253
 TQUtils.cxx:254
 TQUtils.cxx:255
 TQUtils.cxx:256
 TQUtils.cxx:257
 TQUtils.cxx:258
 TQUtils.cxx:259
 TQUtils.cxx:260
 TQUtils.cxx:261
 TQUtils.cxx:262
 TQUtils.cxx:263
 TQUtils.cxx:264
 TQUtils.cxx:265
 TQUtils.cxx:266
 TQUtils.cxx:267
 TQUtils.cxx:268
 TQUtils.cxx:269
 TQUtils.cxx:270
 TQUtils.cxx:271
 TQUtils.cxx:272
 TQUtils.cxx:273
 TQUtils.cxx:274
 TQUtils.cxx:275
 TQUtils.cxx:276
 TQUtils.cxx:277
 TQUtils.cxx:278
 TQUtils.cxx:279
 TQUtils.cxx:280
 TQUtils.cxx:281
 TQUtils.cxx:282
 TQUtils.cxx:283
 TQUtils.cxx:284
 TQUtils.cxx:285
 TQUtils.cxx:286
 TQUtils.cxx:287
 TQUtils.cxx:288
 TQUtils.cxx:289
 TQUtils.cxx:290
 TQUtils.cxx:291
 TQUtils.cxx:292
 TQUtils.cxx:293
 TQUtils.cxx:294
 TQUtils.cxx:295
 TQUtils.cxx:296
 TQUtils.cxx:297
 TQUtils.cxx:298
 TQUtils.cxx:299
 TQUtils.cxx:300
 TQUtils.cxx:301
 TQUtils.cxx:302
 TQUtils.cxx:303
 TQUtils.cxx:304
 TQUtils.cxx:305
 TQUtils.cxx:306
 TQUtils.cxx:307
 TQUtils.cxx:308
 TQUtils.cxx:309
 TQUtils.cxx:310
 TQUtils.cxx:311
 TQUtils.cxx:312
 TQUtils.cxx:313
 TQUtils.cxx:314
 TQUtils.cxx:315
 TQUtils.cxx:316
 TQUtils.cxx:317
 TQUtils.cxx:318
 TQUtils.cxx:319
 TQUtils.cxx:320
 TQUtils.cxx:321
 TQUtils.cxx:322
 TQUtils.cxx:323
 TQUtils.cxx:324
 TQUtils.cxx:325
 TQUtils.cxx:326
 TQUtils.cxx:327
 TQUtils.cxx:328
 TQUtils.cxx:329
 TQUtils.cxx:330
 TQUtils.cxx:331
 TQUtils.cxx:332
 TQUtils.cxx:333
 TQUtils.cxx:334
 TQUtils.cxx:335
 TQUtils.cxx:336
 TQUtils.cxx:337
 TQUtils.cxx:338
 TQUtils.cxx:339
 TQUtils.cxx:340
 TQUtils.cxx:341
 TQUtils.cxx:342
 TQUtils.cxx:343
 TQUtils.cxx:344
 TQUtils.cxx:345
 TQUtils.cxx:346
 TQUtils.cxx:347
 TQUtils.cxx:348
 TQUtils.cxx:349
 TQUtils.cxx:350
 TQUtils.cxx:351
 TQUtils.cxx:352
 TQUtils.cxx:353
 TQUtils.cxx:354
 TQUtils.cxx:355
 TQUtils.cxx:356
 TQUtils.cxx:357
 TQUtils.cxx:358
 TQUtils.cxx:359
 TQUtils.cxx:360
 TQUtils.cxx:361
 TQUtils.cxx:362
 TQUtils.cxx:363
 TQUtils.cxx:364
 TQUtils.cxx:365
 TQUtils.cxx:366
 TQUtils.cxx:367
 TQUtils.cxx:368
 TQUtils.cxx:369
 TQUtils.cxx:370
 TQUtils.cxx:371
 TQUtils.cxx:372
 TQUtils.cxx:373
 TQUtils.cxx:374
 TQUtils.cxx:375
 TQUtils.cxx:376
 TQUtils.cxx:377
 TQUtils.cxx:378
 TQUtils.cxx:379
 TQUtils.cxx:380
 TQUtils.cxx:381
 TQUtils.cxx:382
 TQUtils.cxx:383
 TQUtils.cxx:384
 TQUtils.cxx:385
 TQUtils.cxx:386
 TQUtils.cxx:387
 TQUtils.cxx:388
 TQUtils.cxx:389
 TQUtils.cxx:390
 TQUtils.cxx:391
 TQUtils.cxx:392
 TQUtils.cxx:393
 TQUtils.cxx:394
 TQUtils.cxx:395
 TQUtils.cxx:396
 TQUtils.cxx:397
 TQUtils.cxx:398
 TQUtils.cxx:399
 TQUtils.cxx:400
 TQUtils.cxx:401
 TQUtils.cxx:402
 TQUtils.cxx:403
 TQUtils.cxx:404
 TQUtils.cxx:405
 TQUtils.cxx:406
 TQUtils.cxx:407
 TQUtils.cxx:408
 TQUtils.cxx:409
 TQUtils.cxx:410
 TQUtils.cxx:411
 TQUtils.cxx:412
 TQUtils.cxx:413
 TQUtils.cxx:414
 TQUtils.cxx:415
 TQUtils.cxx:416
 TQUtils.cxx:417
 TQUtils.cxx:418
 TQUtils.cxx:419
 TQUtils.cxx:420
 TQUtils.cxx:421
 TQUtils.cxx:422
 TQUtils.cxx:423
 TQUtils.cxx:424
 TQUtils.cxx:425
 TQUtils.cxx:426
 TQUtils.cxx:427
 TQUtils.cxx:428
 TQUtils.cxx:429
 TQUtils.cxx:430
 TQUtils.cxx:431
 TQUtils.cxx:432
 TQUtils.cxx:433
 TQUtils.cxx:434
 TQUtils.cxx:435
 TQUtils.cxx:436
 TQUtils.cxx:437
 TQUtils.cxx:438
 TQUtils.cxx:439
 TQUtils.cxx:440
 TQUtils.cxx:441
 TQUtils.cxx:442
 TQUtils.cxx:443
 TQUtils.cxx:444
 TQUtils.cxx:445
 TQUtils.cxx:446
 TQUtils.cxx:447
 TQUtils.cxx:448
 TQUtils.cxx:449
 TQUtils.cxx:450
 TQUtils.cxx:451
 TQUtils.cxx:452
 TQUtils.cxx:453
 TQUtils.cxx:454
 TQUtils.cxx:455
 TQUtils.cxx:456
 TQUtils.cxx:457
 TQUtils.cxx:458
 TQUtils.cxx:459
 TQUtils.cxx:460
 TQUtils.cxx:461
 TQUtils.cxx:462
 TQUtils.cxx:463
 TQUtils.cxx:464
 TQUtils.cxx:465
 TQUtils.cxx:466
 TQUtils.cxx:467
 TQUtils.cxx:468
 TQUtils.cxx:469
 TQUtils.cxx:470
 TQUtils.cxx:471
 TQUtils.cxx:472
 TQUtils.cxx:473
 TQUtils.cxx:474
 TQUtils.cxx:475
 TQUtils.cxx:476
 TQUtils.cxx:477
 TQUtils.cxx:478
 TQUtils.cxx:479
 TQUtils.cxx:480
 TQUtils.cxx:481
 TQUtils.cxx:482
 TQUtils.cxx:483
 TQUtils.cxx:484
 TQUtils.cxx:485
 TQUtils.cxx:486
 TQUtils.cxx:487
 TQUtils.cxx:488
 TQUtils.cxx:489
 TQUtils.cxx:490
 TQUtils.cxx:491
 TQUtils.cxx:492
 TQUtils.cxx:493
 TQUtils.cxx:494
 TQUtils.cxx:495
 TQUtils.cxx:496
 TQUtils.cxx:497
 TQUtils.cxx:498
 TQUtils.cxx:499
 TQUtils.cxx:500
 TQUtils.cxx:501
 TQUtils.cxx:502
 TQUtils.cxx:503
 TQUtils.cxx:504
 TQUtils.cxx:505
 TQUtils.cxx:506
 TQUtils.cxx:507
 TQUtils.cxx:508
 TQUtils.cxx:509
 TQUtils.cxx:510
 TQUtils.cxx:511
 TQUtils.cxx:512
 TQUtils.cxx:513
 TQUtils.cxx:514
 TQUtils.cxx:515
 TQUtils.cxx:516
 TQUtils.cxx:517
 TQUtils.cxx:518
 TQUtils.cxx:519
 TQUtils.cxx:520
 TQUtils.cxx:521
 TQUtils.cxx:522
 TQUtils.cxx:523
 TQUtils.cxx:524
 TQUtils.cxx:525
 TQUtils.cxx:526
 TQUtils.cxx:527
 TQUtils.cxx:528
 TQUtils.cxx:529
 TQUtils.cxx:530
 TQUtils.cxx:531
 TQUtils.cxx:532
 TQUtils.cxx:533
 TQUtils.cxx:534
 TQUtils.cxx:535
 TQUtils.cxx:536
 TQUtils.cxx:537
 TQUtils.cxx:538
 TQUtils.cxx:539
 TQUtils.cxx:540
 TQUtils.cxx:541
 TQUtils.cxx:542
 TQUtils.cxx:543
 TQUtils.cxx:544
 TQUtils.cxx:545
 TQUtils.cxx:546
 TQUtils.cxx:547
 TQUtils.cxx:548
 TQUtils.cxx:549
 TQUtils.cxx:550
 TQUtils.cxx:551
 TQUtils.cxx:552
 TQUtils.cxx:553
 TQUtils.cxx:554
 TQUtils.cxx:555
 TQUtils.cxx:556
 TQUtils.cxx:557
 TQUtils.cxx:558
 TQUtils.cxx:559
 TQUtils.cxx:560
 TQUtils.cxx:561
 TQUtils.cxx:562
 TQUtils.cxx:563
 TQUtils.cxx:564
 TQUtils.cxx:565
 TQUtils.cxx:566
 TQUtils.cxx:567
 TQUtils.cxx:568
 TQUtils.cxx:569
 TQUtils.cxx:570
 TQUtils.cxx:571
 TQUtils.cxx:572
 TQUtils.cxx:573
 TQUtils.cxx:574
 TQUtils.cxx:575
 TQUtils.cxx:576
 TQUtils.cxx:577
 TQUtils.cxx:578
 TQUtils.cxx:579
 TQUtils.cxx:580
 TQUtils.cxx:581
 TQUtils.cxx:582
 TQUtils.cxx:583
 TQUtils.cxx:584
 TQUtils.cxx:585
 TQUtils.cxx:586
 TQUtils.cxx:587
 TQUtils.cxx:588
 TQUtils.cxx:589
 TQUtils.cxx:590
 TQUtils.cxx:591
 TQUtils.cxx:592
 TQUtils.cxx:593
 TQUtils.cxx:594
 TQUtils.cxx:595
 TQUtils.cxx:596
 TQUtils.cxx:597
 TQUtils.cxx:598
 TQUtils.cxx:599
 TQUtils.cxx:600
 TQUtils.cxx:601
 TQUtils.cxx:602
 TQUtils.cxx:603
 TQUtils.cxx:604
 TQUtils.cxx:605
 TQUtils.cxx:606
 TQUtils.cxx:607
 TQUtils.cxx:608
 TQUtils.cxx:609
 TQUtils.cxx:610
 TQUtils.cxx:611
 TQUtils.cxx:612
 TQUtils.cxx:613
 TQUtils.cxx:614
 TQUtils.cxx:615
 TQUtils.cxx:616
 TQUtils.cxx:617
 TQUtils.cxx:618
 TQUtils.cxx:619
 TQUtils.cxx:620
 TQUtils.cxx:621
 TQUtils.cxx:622
 TQUtils.cxx:623
 TQUtils.cxx:624
 TQUtils.cxx:625
 TQUtils.cxx:626
 TQUtils.cxx:627
 TQUtils.cxx:628
 TQUtils.cxx:629
 TQUtils.cxx:630
 TQUtils.cxx:631
 TQUtils.cxx:632
 TQUtils.cxx:633
 TQUtils.cxx:634
 TQUtils.cxx:635
 TQUtils.cxx:636
 TQUtils.cxx:637
 TQUtils.cxx:638
 TQUtils.cxx:639
 TQUtils.cxx:640
 TQUtils.cxx:641
 TQUtils.cxx:642
 TQUtils.cxx:643
 TQUtils.cxx:644
 TQUtils.cxx:645
 TQUtils.cxx:646
 TQUtils.cxx:647
 TQUtils.cxx:648
 TQUtils.cxx:649
 TQUtils.cxx:650
 TQUtils.cxx:651
 TQUtils.cxx:652
 TQUtils.cxx:653
 TQUtils.cxx:654
 TQUtils.cxx:655
 TQUtils.cxx:656
 TQUtils.cxx:657
 TQUtils.cxx:658
 TQUtils.cxx:659
 TQUtils.cxx:660
 TQUtils.cxx:661
 TQUtils.cxx:662
 TQUtils.cxx:663
 TQUtils.cxx:664
 TQUtils.cxx:665
 TQUtils.cxx:666
 TQUtils.cxx:667
 TQUtils.cxx:668
 TQUtils.cxx:669
 TQUtils.cxx:670
 TQUtils.cxx:671
 TQUtils.cxx:672
 TQUtils.cxx:673
 TQUtils.cxx:674
 TQUtils.cxx:675
 TQUtils.cxx:676
 TQUtils.cxx:677
 TQUtils.cxx:678
 TQUtils.cxx:679
 TQUtils.cxx:680
 TQUtils.cxx:681
 TQUtils.cxx:682
 TQUtils.cxx:683
 TQUtils.cxx:684
 TQUtils.cxx:685
 TQUtils.cxx:686
 TQUtils.cxx:687
 TQUtils.cxx:688
 TQUtils.cxx:689
 TQUtils.cxx:690
 TQUtils.cxx:691
 TQUtils.cxx:692
 TQUtils.cxx:693
 TQUtils.cxx:694
 TQUtils.cxx:695
 TQUtils.cxx:696
 TQUtils.cxx:697
 TQUtils.cxx:698
 TQUtils.cxx:699
 TQUtils.cxx:700
 TQUtils.cxx:701
 TQUtils.cxx:702
 TQUtils.cxx:703
 TQUtils.cxx:704
 TQUtils.cxx:705
 TQUtils.cxx:706
 TQUtils.cxx:707
 TQUtils.cxx:708
 TQUtils.cxx:709
 TQUtils.cxx:710
 TQUtils.cxx:711
 TQUtils.cxx:712
 TQUtils.cxx:713
 TQUtils.cxx:714
 TQUtils.cxx:715
 TQUtils.cxx:716
 TQUtils.cxx:717
 TQUtils.cxx:718
 TQUtils.cxx:719
 TQUtils.cxx:720
 TQUtils.cxx:721
 TQUtils.cxx:722
 TQUtils.cxx:723
 TQUtils.cxx:724
 TQUtils.cxx:725
 TQUtils.cxx:726
 TQUtils.cxx:727
 TQUtils.cxx:728
 TQUtils.cxx:729
 TQUtils.cxx:730
 TQUtils.cxx:731
 TQUtils.cxx:732
 TQUtils.cxx:733
 TQUtils.cxx:734
 TQUtils.cxx:735
 TQUtils.cxx:736
 TQUtils.cxx:737
 TQUtils.cxx:738
 TQUtils.cxx:739
 TQUtils.cxx:740
 TQUtils.cxx:741
 TQUtils.cxx:742
 TQUtils.cxx:743
 TQUtils.cxx:744
 TQUtils.cxx:745
 TQUtils.cxx:746
 TQUtils.cxx:747
 TQUtils.cxx:748
 TQUtils.cxx:749
 TQUtils.cxx:750
 TQUtils.cxx:751
 TQUtils.cxx:752
 TQUtils.cxx:753
 TQUtils.cxx:754
 TQUtils.cxx:755
 TQUtils.cxx:756
 TQUtils.cxx:757
 TQUtils.cxx:758
 TQUtils.cxx:759
 TQUtils.cxx:760
 TQUtils.cxx:761
 TQUtils.cxx:762
 TQUtils.cxx:763
 TQUtils.cxx:764
 TQUtils.cxx:765
 TQUtils.cxx:766
 TQUtils.cxx:767
 TQUtils.cxx:768
 TQUtils.cxx:769
 TQUtils.cxx:770
 TQUtils.cxx:771
 TQUtils.cxx:772
 TQUtils.cxx:773
 TQUtils.cxx:774
 TQUtils.cxx:775
 TQUtils.cxx:776
 TQUtils.cxx:777
 TQUtils.cxx:778
 TQUtils.cxx:779
 TQUtils.cxx:780
 TQUtils.cxx:781
 TQUtils.cxx:782
 TQUtils.cxx:783
 TQUtils.cxx:784
 TQUtils.cxx:785
 TQUtils.cxx:786
 TQUtils.cxx:787
 TQUtils.cxx:788
 TQUtils.cxx:789
 TQUtils.cxx:790
 TQUtils.cxx:791
 TQUtils.cxx:792
 TQUtils.cxx:793
 TQUtils.cxx:794
 TQUtils.cxx:795
 TQUtils.cxx:796
 TQUtils.cxx:797
 TQUtils.cxx:798
 TQUtils.cxx:799
 TQUtils.cxx:800
 TQUtils.cxx:801
 TQUtils.cxx:802
 TQUtils.cxx:803
 TQUtils.cxx:804
 TQUtils.cxx:805
 TQUtils.cxx:806
 TQUtils.cxx:807
 TQUtils.cxx:808
 TQUtils.cxx:809
 TQUtils.cxx:810
 TQUtils.cxx:811
 TQUtils.cxx:812
 TQUtils.cxx:813
 TQUtils.cxx:814
 TQUtils.cxx:815
 TQUtils.cxx:816
 TQUtils.cxx:817
 TQUtils.cxx:818
 TQUtils.cxx:819
 TQUtils.cxx:820
 TQUtils.cxx:821
 TQUtils.cxx:822
 TQUtils.cxx:823
 TQUtils.cxx:824
 TQUtils.cxx:825
 TQUtils.cxx:826
 TQUtils.cxx:827
 TQUtils.cxx:828
 TQUtils.cxx:829
 TQUtils.cxx:830
 TQUtils.cxx:831
 TQUtils.cxx:832
 TQUtils.cxx:833
 TQUtils.cxx:834
 TQUtils.cxx:835
 TQUtils.cxx:836
 TQUtils.cxx:837
 TQUtils.cxx:838
 TQUtils.cxx:839
 TQUtils.cxx:840
 TQUtils.cxx:841
 TQUtils.cxx:842
 TQUtils.cxx:843
 TQUtils.cxx:844
 TQUtils.cxx:845
 TQUtils.cxx:846
 TQUtils.cxx:847
 TQUtils.cxx:848
 TQUtils.cxx:849
 TQUtils.cxx:850
 TQUtils.cxx:851
 TQUtils.cxx:852
 TQUtils.cxx:853
 TQUtils.cxx:854
 TQUtils.cxx:855
 TQUtils.cxx:856
 TQUtils.cxx:857
 TQUtils.cxx:858
 TQUtils.cxx:859
 TQUtils.cxx:860
 TQUtils.cxx:861
 TQUtils.cxx:862
 TQUtils.cxx:863
 TQUtils.cxx:864
 TQUtils.cxx:865
 TQUtils.cxx:866
 TQUtils.cxx:867
 TQUtils.cxx:868
 TQUtils.cxx:869
 TQUtils.cxx:870
 TQUtils.cxx:871
 TQUtils.cxx:872
 TQUtils.cxx:873
 TQUtils.cxx:874
 TQUtils.cxx:875
 TQUtils.cxx:876
 TQUtils.cxx:877
 TQUtils.cxx:878
 TQUtils.cxx:879
 TQUtils.cxx:880
 TQUtils.cxx:881
 TQUtils.cxx:882
 TQUtils.cxx:883
 TQUtils.cxx:884
 TQUtils.cxx:885
 TQUtils.cxx:886
 TQUtils.cxx:887
 TQUtils.cxx:888
 TQUtils.cxx:889
 TQUtils.cxx:890
 TQUtils.cxx:891
 TQUtils.cxx:892
 TQUtils.cxx:893
 TQUtils.cxx:894
 TQUtils.cxx:895
 TQUtils.cxx:896
 TQUtils.cxx:897
 TQUtils.cxx:898
 TQUtils.cxx:899
 TQUtils.cxx:900
 TQUtils.cxx:901
 TQUtils.cxx:902
 TQUtils.cxx:903
 TQUtils.cxx:904
 TQUtils.cxx:905
 TQUtils.cxx:906
 TQUtils.cxx:907
 TQUtils.cxx:908
 TQUtils.cxx:909
 TQUtils.cxx:910
 TQUtils.cxx:911
 TQUtils.cxx:912
 TQUtils.cxx:913
 TQUtils.cxx:914
 TQUtils.cxx:915
 TQUtils.cxx:916
 TQUtils.cxx:917
 TQUtils.cxx:918
 TQUtils.cxx:919
 TQUtils.cxx:920
 TQUtils.cxx:921
 TQUtils.cxx:922
 TQUtils.cxx:923
 TQUtils.cxx:924
 TQUtils.cxx:925
 TQUtils.cxx:926
 TQUtils.cxx:927
 TQUtils.cxx:928
 TQUtils.cxx:929
 TQUtils.cxx:930
 TQUtils.cxx:931
 TQUtils.cxx:932
 TQUtils.cxx:933
 TQUtils.cxx:934
 TQUtils.cxx:935
 TQUtils.cxx:936
 TQUtils.cxx:937
 TQUtils.cxx:938
 TQUtils.cxx:939
 TQUtils.cxx:940
 TQUtils.cxx:941
 TQUtils.cxx:942
 TQUtils.cxx:943
 TQUtils.cxx:944
 TQUtils.cxx:945
 TQUtils.cxx:946
 TQUtils.cxx:947
 TQUtils.cxx:948
 TQUtils.cxx:949
 TQUtils.cxx:950
 TQUtils.cxx:951
 TQUtils.cxx:952
 TQUtils.cxx:953
 TQUtils.cxx:954
 TQUtils.cxx:955
 TQUtils.cxx:956
 TQUtils.cxx:957
 TQUtils.cxx:958
 TQUtils.cxx:959
 TQUtils.cxx:960
 TQUtils.cxx:961
 TQUtils.cxx:962
 TQUtils.cxx:963
 TQUtils.cxx:964
 TQUtils.cxx:965
 TQUtils.cxx:966
 TQUtils.cxx:967
 TQUtils.cxx:968
 TQUtils.cxx:969
 TQUtils.cxx:970
 TQUtils.cxx:971
 TQUtils.cxx:972
 TQUtils.cxx:973
 TQUtils.cxx:974
 TQUtils.cxx:975
 TQUtils.cxx:976
 TQUtils.cxx:977
 TQUtils.cxx:978
 TQUtils.cxx:979
 TQUtils.cxx:980
 TQUtils.cxx:981
 TQUtils.cxx:982
 TQUtils.cxx:983
 TQUtils.cxx:984
 TQUtils.cxx:985
 TQUtils.cxx:986
 TQUtils.cxx:987
 TQUtils.cxx:988
 TQUtils.cxx:989
 TQUtils.cxx:990
 TQUtils.cxx:991
 TQUtils.cxx:992
 TQUtils.cxx:993
 TQUtils.cxx:994
 TQUtils.cxx:995
 TQUtils.cxx:996
 TQUtils.cxx:997
 TQUtils.cxx:998
 TQUtils.cxx:999
 TQUtils.cxx:1000
 TQUtils.cxx:1001
 TQUtils.cxx:1002
 TQUtils.cxx:1003
 TQUtils.cxx:1004
 TQUtils.cxx:1005
 TQUtils.cxx:1006
 TQUtils.cxx:1007
 TQUtils.cxx:1008
 TQUtils.cxx:1009
 TQUtils.cxx:1010
 TQUtils.cxx:1011
 TQUtils.cxx:1012
 TQUtils.cxx:1013
 TQUtils.cxx:1014
 TQUtils.cxx:1015
 TQUtils.cxx:1016
 TQUtils.cxx:1017
 TQUtils.cxx:1018
 TQUtils.cxx:1019
 TQUtils.cxx:1020
 TQUtils.cxx:1021
 TQUtils.cxx:1022
 TQUtils.cxx:1023
 TQUtils.cxx:1024
 TQUtils.cxx:1025
 TQUtils.cxx:1026
 TQUtils.cxx:1027
 TQUtils.cxx:1028
 TQUtils.cxx:1029
 TQUtils.cxx:1030
 TQUtils.cxx:1031
 TQUtils.cxx:1032
 TQUtils.cxx:1033
 TQUtils.cxx:1034
 TQUtils.cxx:1035
 TQUtils.cxx:1036
 TQUtils.cxx:1037
 TQUtils.cxx:1038
 TQUtils.cxx:1039
 TQUtils.cxx:1040
 TQUtils.cxx:1041
 TQUtils.cxx:1042
 TQUtils.cxx:1043
 TQUtils.cxx:1044
 TQUtils.cxx:1045
 TQUtils.cxx:1046
 TQUtils.cxx:1047
 TQUtils.cxx:1048
 TQUtils.cxx:1049
 TQUtils.cxx:1050
 TQUtils.cxx:1051
 TQUtils.cxx:1052
 TQUtils.cxx:1053
 TQUtils.cxx:1054
 TQUtils.cxx:1055
 TQUtils.cxx:1056
 TQUtils.cxx:1057
 TQUtils.cxx:1058
 TQUtils.cxx:1059
 TQUtils.cxx:1060
 TQUtils.cxx:1061
 TQUtils.cxx:1062
 TQUtils.cxx:1063
 TQUtils.cxx:1064
 TQUtils.cxx:1065
 TQUtils.cxx:1066
 TQUtils.cxx:1067
 TQUtils.cxx:1068
 TQUtils.cxx:1069
 TQUtils.cxx:1070
 TQUtils.cxx:1071
 TQUtils.cxx:1072
 TQUtils.cxx:1073
 TQUtils.cxx:1074
 TQUtils.cxx:1075
 TQUtils.cxx:1076
 TQUtils.cxx:1077
 TQUtils.cxx:1078
 TQUtils.cxx:1079
 TQUtils.cxx:1080
 TQUtils.cxx:1081
 TQUtils.cxx:1082
 TQUtils.cxx:1083
 TQUtils.cxx:1084
 TQUtils.cxx:1085
 TQUtils.cxx:1086
 TQUtils.cxx:1087
 TQUtils.cxx:1088
 TQUtils.cxx:1089
 TQUtils.cxx:1090
 TQUtils.cxx:1091
 TQUtils.cxx:1092
 TQUtils.cxx:1093
 TQUtils.cxx:1094
 TQUtils.cxx:1095
 TQUtils.cxx:1096
 TQUtils.cxx:1097
 TQUtils.cxx:1098
 TQUtils.cxx:1099
 TQUtils.cxx:1100
 TQUtils.cxx:1101
 TQUtils.cxx:1102
 TQUtils.cxx:1103
 TQUtils.cxx:1104
 TQUtils.cxx:1105
 TQUtils.cxx:1106
 TQUtils.cxx:1107
 TQUtils.cxx:1108
 TQUtils.cxx:1109
 TQUtils.cxx:1110
 TQUtils.cxx:1111
 TQUtils.cxx:1112
 TQUtils.cxx:1113
 TQUtils.cxx:1114
 TQUtils.cxx:1115
 TQUtils.cxx:1116
 TQUtils.cxx:1117
 TQUtils.cxx:1118
 TQUtils.cxx:1119
 TQUtils.cxx:1120
 TQUtils.cxx:1121
 TQUtils.cxx:1122
 TQUtils.cxx:1123
 TQUtils.cxx:1124
 TQUtils.cxx:1125
 TQUtils.cxx:1126
 TQUtils.cxx:1127
 TQUtils.cxx:1128
 TQUtils.cxx:1129
 TQUtils.cxx:1130
 TQUtils.cxx:1131
 TQUtils.cxx:1132
 TQUtils.cxx:1133
 TQUtils.cxx:1134
 TQUtils.cxx:1135
 TQUtils.cxx:1136
 TQUtils.cxx:1137
 TQUtils.cxx:1138
 TQUtils.cxx:1139
 TQUtils.cxx:1140
 TQUtils.cxx:1141
 TQUtils.cxx:1142
 TQUtils.cxx:1143
 TQUtils.cxx:1144
 TQUtils.cxx:1145
 TQUtils.cxx:1146
 TQUtils.cxx:1147
 TQUtils.cxx:1148
 TQUtils.cxx:1149
 TQUtils.cxx:1150
 TQUtils.cxx:1151
 TQUtils.cxx:1152
 TQUtils.cxx:1153
 TQUtils.cxx:1154
 TQUtils.cxx:1155
 TQUtils.cxx:1156
 TQUtils.cxx:1157
 TQUtils.cxx:1158
 TQUtils.cxx:1159
 TQUtils.cxx:1160
 TQUtils.cxx:1161
 TQUtils.cxx:1162
 TQUtils.cxx:1163
 TQUtils.cxx:1164
 TQUtils.cxx:1165
 TQUtils.cxx:1166
 TQUtils.cxx:1167
 TQUtils.cxx:1168
 TQUtils.cxx:1169
 TQUtils.cxx:1170
 TQUtils.cxx:1171
 TQUtils.cxx:1172
 TQUtils.cxx:1173
 TQUtils.cxx:1174
 TQUtils.cxx:1175
 TQUtils.cxx:1176
 TQUtils.cxx:1177
 TQUtils.cxx:1178
 TQUtils.cxx:1179
 TQUtils.cxx:1180
 TQUtils.cxx:1181
 TQUtils.cxx:1182
 TQUtils.cxx:1183
 TQUtils.cxx:1184
 TQUtils.cxx:1185
 TQUtils.cxx:1186
 TQUtils.cxx:1187
 TQUtils.cxx:1188
 TQUtils.cxx:1189
 TQUtils.cxx:1190
 TQUtils.cxx:1191
 TQUtils.cxx:1192
 TQUtils.cxx:1193
 TQUtils.cxx:1194
 TQUtils.cxx:1195
 TQUtils.cxx:1196
 TQUtils.cxx:1197
 TQUtils.cxx:1198
 TQUtils.cxx:1199
 TQUtils.cxx:1200
 TQUtils.cxx:1201
 TQUtils.cxx:1202
 TQUtils.cxx:1203
 TQUtils.cxx:1204
 TQUtils.cxx:1205
 TQUtils.cxx:1206
 TQUtils.cxx:1207
 TQUtils.cxx:1208
 TQUtils.cxx:1209
 TQUtils.cxx:1210
 TQUtils.cxx:1211
 TQUtils.cxx:1212
 TQUtils.cxx:1213
 TQUtils.cxx:1214
 TQUtils.cxx:1215
 TQUtils.cxx:1216
 TQUtils.cxx:1217
 TQUtils.cxx:1218
 TQUtils.cxx:1219
 TQUtils.cxx:1220
 TQUtils.cxx:1221
 TQUtils.cxx:1222
 TQUtils.cxx:1223
 TQUtils.cxx:1224
 TQUtils.cxx:1225
 TQUtils.cxx:1226
 TQUtils.cxx:1227
 TQUtils.cxx:1228
 TQUtils.cxx:1229
 TQUtils.cxx:1230
 TQUtils.cxx:1231
 TQUtils.cxx:1232
 TQUtils.cxx:1233
 TQUtils.cxx:1234
 TQUtils.cxx:1235
 TQUtils.cxx:1236
 TQUtils.cxx:1237
 TQUtils.cxx:1238
 TQUtils.cxx:1239
 TQUtils.cxx:1240
 TQUtils.cxx:1241
 TQUtils.cxx:1242
 TQUtils.cxx:1243
 TQUtils.cxx:1244
 TQUtils.cxx:1245
 TQUtils.cxx:1246
 TQUtils.cxx:1247
 TQUtils.cxx:1248
 TQUtils.cxx:1249
 TQUtils.cxx:1250
 TQUtils.cxx:1251
 TQUtils.cxx:1252
 TQUtils.cxx:1253
 TQUtils.cxx:1254
 TQUtils.cxx:1255
 TQUtils.cxx:1256
 TQUtils.cxx:1257
 TQUtils.cxx:1258
 TQUtils.cxx:1259
 TQUtils.cxx:1260
 TQUtils.cxx:1261
 TQUtils.cxx:1262
 TQUtils.cxx:1263
 TQUtils.cxx:1264
 TQUtils.cxx:1265
 TQUtils.cxx:1266
 TQUtils.cxx:1267
 TQUtils.cxx:1268
 TQUtils.cxx:1269
 TQUtils.cxx:1270
 TQUtils.cxx:1271
 TQUtils.cxx:1272
 TQUtils.cxx:1273
 TQUtils.cxx:1274
 TQUtils.cxx:1275
 TQUtils.cxx:1276
 TQUtils.cxx:1277
 TQUtils.cxx:1278
 TQUtils.cxx:1279
 TQUtils.cxx:1280
 TQUtils.cxx:1281
 TQUtils.cxx:1282
 TQUtils.cxx:1283
 TQUtils.cxx:1284
 TQUtils.cxx:1285
 TQUtils.cxx:1286
 TQUtils.cxx:1287
 TQUtils.cxx:1288
 TQUtils.cxx:1289
 TQUtils.cxx:1290
 TQUtils.cxx:1291
 TQUtils.cxx:1292
 TQUtils.cxx:1293
 TQUtils.cxx:1294
 TQUtils.cxx:1295
 TQUtils.cxx:1296
 TQUtils.cxx:1297
 TQUtils.cxx:1298
 TQUtils.cxx:1299
 TQUtils.cxx:1300
 TQUtils.cxx:1301
 TQUtils.cxx:1302
 TQUtils.cxx:1303
 TQUtils.cxx:1304
 TQUtils.cxx:1305
 TQUtils.cxx:1306
 TQUtils.cxx:1307
 TQUtils.cxx:1308
 TQUtils.cxx:1309
 TQUtils.cxx:1310
 TQUtils.cxx:1311
 TQUtils.cxx:1312
 TQUtils.cxx:1313
 TQUtils.cxx:1314
 TQUtils.cxx:1315
 TQUtils.cxx:1316
 TQUtils.cxx:1317
 TQUtils.cxx:1318
 TQUtils.cxx:1319
 TQUtils.cxx:1320
 TQUtils.cxx:1321
 TQUtils.cxx:1322
 TQUtils.cxx:1323
 TQUtils.cxx:1324
 TQUtils.cxx:1325
 TQUtils.cxx:1326
 TQUtils.cxx:1327
 TQUtils.cxx:1328
 TQUtils.cxx:1329
 TQUtils.cxx:1330
 TQUtils.cxx:1331
 TQUtils.cxx:1332
 TQUtils.cxx:1333
 TQUtils.cxx:1334
 TQUtils.cxx:1335
 TQUtils.cxx:1336
 TQUtils.cxx:1337
 TQUtils.cxx:1338
 TQUtils.cxx:1339
 TQUtils.cxx:1340
 TQUtils.cxx:1341
 TQUtils.cxx:1342
 TQUtils.cxx:1343
 TQUtils.cxx:1344
 TQUtils.cxx:1345
 TQUtils.cxx:1346
 TQUtils.cxx:1347
 TQUtils.cxx:1348
 TQUtils.cxx:1349
 TQUtils.cxx:1350
 TQUtils.cxx:1351
 TQUtils.cxx:1352
 TQUtils.cxx:1353
 TQUtils.cxx:1354
 TQUtils.cxx:1355
 TQUtils.cxx:1356
 TQUtils.cxx:1357
 TQUtils.cxx:1358
 TQUtils.cxx:1359
 TQUtils.cxx:1360
 TQUtils.cxx:1361
 TQUtils.cxx:1362
 TQUtils.cxx:1363
 TQUtils.cxx:1364
 TQUtils.cxx:1365
 TQUtils.cxx:1366
 TQUtils.cxx:1367
 TQUtils.cxx:1368
 TQUtils.cxx:1369
 TQUtils.cxx:1370
 TQUtils.cxx:1371
 TQUtils.cxx:1372
 TQUtils.cxx:1373
 TQUtils.cxx:1374
 TQUtils.cxx:1375
 TQUtils.cxx:1376
 TQUtils.cxx:1377
 TQUtils.cxx:1378
 TQUtils.cxx:1379
 TQUtils.cxx:1380
 TQUtils.cxx:1381
 TQUtils.cxx:1382
 TQUtils.cxx:1383
 TQUtils.cxx:1384
 TQUtils.cxx:1385
 TQUtils.cxx:1386
 TQUtils.cxx:1387
 TQUtils.cxx:1388
 TQUtils.cxx:1389
 TQUtils.cxx:1390
 TQUtils.cxx:1391
 TQUtils.cxx:1392
 TQUtils.cxx:1393
 TQUtils.cxx:1394
 TQUtils.cxx:1395
 TQUtils.cxx:1396
 TQUtils.cxx:1397
 TQUtils.cxx:1398
 TQUtils.cxx:1399
 TQUtils.cxx:1400
 TQUtils.cxx:1401
 TQUtils.cxx:1402
 TQUtils.cxx:1403
 TQUtils.cxx:1404
 TQUtils.cxx:1405
 TQUtils.cxx:1406
 TQUtils.cxx:1407
 TQUtils.cxx:1408
 TQUtils.cxx:1409
 TQUtils.cxx:1410
 TQUtils.cxx:1411
 TQUtils.cxx:1412
 TQUtils.cxx:1413
 TQUtils.cxx:1414
 TQUtils.cxx:1415
 TQUtils.cxx:1416
 TQUtils.cxx:1417
 TQUtils.cxx:1418
 TQUtils.cxx:1419
 TQUtils.cxx:1420
 TQUtils.cxx:1421
 TQUtils.cxx:1422
 TQUtils.cxx:1423
 TQUtils.cxx:1424
 TQUtils.cxx:1425
 TQUtils.cxx:1426
 TQUtils.cxx:1427
 TQUtils.cxx:1428
 TQUtils.cxx:1429
 TQUtils.cxx:1430
 TQUtils.cxx:1431
 TQUtils.cxx:1432
 TQUtils.cxx:1433
 TQUtils.cxx:1434
 TQUtils.cxx:1435
 TQUtils.cxx:1436
 TQUtils.cxx:1437
 TQUtils.cxx:1438
 TQUtils.cxx:1439
 TQUtils.cxx:1440
 TQUtils.cxx:1441
 TQUtils.cxx:1442
 TQUtils.cxx:1443
 TQUtils.cxx:1444
 TQUtils.cxx:1445
 TQUtils.cxx:1446
 TQUtils.cxx:1447
 TQUtils.cxx:1448
 TQUtils.cxx:1449
 TQUtils.cxx:1450
 TQUtils.cxx:1451
 TQUtils.cxx:1452
 TQUtils.cxx:1453
 TQUtils.cxx:1454
 TQUtils.cxx:1455
 TQUtils.cxx:1456
 TQUtils.cxx:1457
 TQUtils.cxx:1458
 TQUtils.cxx:1459
 TQUtils.cxx:1460
 TQUtils.cxx:1461
 TQUtils.cxx:1462
 TQUtils.cxx:1463
 TQUtils.cxx:1464
 TQUtils.cxx:1465
 TQUtils.cxx:1466
 TQUtils.cxx:1467
 TQUtils.cxx:1468
 TQUtils.cxx:1469
 TQUtils.cxx:1470
 TQUtils.cxx:1471
 TQUtils.cxx:1472
 TQUtils.cxx:1473
 TQUtils.cxx:1474
 TQUtils.cxx:1475
 TQUtils.cxx:1476
 TQUtils.cxx:1477
 TQUtils.cxx:1478
 TQUtils.cxx:1479
 TQUtils.cxx:1480
 TQUtils.cxx:1481
 TQUtils.cxx:1482
 TQUtils.cxx:1483
 TQUtils.cxx:1484
 TQUtils.cxx:1485
 TQUtils.cxx:1486
 TQUtils.cxx:1487
 TQUtils.cxx:1488
 TQUtils.cxx:1489
 TQUtils.cxx:1490
 TQUtils.cxx:1491
 TQUtils.cxx:1492
 TQUtils.cxx:1493
 TQUtils.cxx:1494
 TQUtils.cxx:1495
 TQUtils.cxx:1496
 TQUtils.cxx:1497
 TQUtils.cxx:1498
 TQUtils.cxx:1499
 TQUtils.cxx:1500
 TQUtils.cxx:1501
 TQUtils.cxx:1502
 TQUtils.cxx:1503
 TQUtils.cxx:1504
 TQUtils.cxx:1505
 TQUtils.cxx:1506
 TQUtils.cxx:1507
 TQUtils.cxx:1508
 TQUtils.cxx:1509
 TQUtils.cxx:1510
 TQUtils.cxx:1511
 TQUtils.cxx:1512
 TQUtils.cxx:1513
 TQUtils.cxx:1514
 TQUtils.cxx:1515
 TQUtils.cxx:1516
 TQUtils.cxx:1517
 TQUtils.cxx:1518
 TQUtils.cxx:1519
 TQUtils.cxx:1520
 TQUtils.cxx:1521
 TQUtils.cxx:1522
 TQUtils.cxx:1523
 TQUtils.cxx:1524
 TQUtils.cxx:1525
 TQUtils.cxx:1526
 TQUtils.cxx:1527
 TQUtils.cxx:1528
 TQUtils.cxx:1529
 TQUtils.cxx:1530
 TQUtils.cxx:1531
 TQUtils.cxx:1532
 TQUtils.cxx:1533
 TQUtils.cxx:1534
 TQUtils.cxx:1535
 TQUtils.cxx:1536
 TQUtils.cxx:1537
 TQUtils.cxx:1538
 TQUtils.cxx:1539
 TQUtils.cxx:1540
 TQUtils.cxx:1541
 TQUtils.cxx:1542
 TQUtils.cxx:1543
 TQUtils.cxx:1544
 TQUtils.cxx:1545
 TQUtils.cxx:1546
 TQUtils.cxx:1547
 TQUtils.cxx:1548
 TQUtils.cxx:1549
 TQUtils.cxx:1550
 TQUtils.cxx:1551
 TQUtils.cxx:1552
 TQUtils.cxx:1553
 TQUtils.cxx:1554
 TQUtils.cxx:1555
 TQUtils.cxx:1556
 TQUtils.cxx:1557
 TQUtils.cxx:1558
 TQUtils.cxx:1559
 TQUtils.cxx:1560
 TQUtils.cxx:1561
 TQUtils.cxx:1562
 TQUtils.cxx:1563
 TQUtils.cxx:1564
 TQUtils.cxx:1565
 TQUtils.cxx:1566
 TQUtils.cxx:1567
 TQUtils.cxx:1568
 TQUtils.cxx:1569
 TQUtils.cxx:1570
 TQUtils.cxx:1571
 TQUtils.cxx:1572
 TQUtils.cxx:1573
 TQUtils.cxx:1574
 TQUtils.cxx:1575
 TQUtils.cxx:1576
 TQUtils.cxx:1577
 TQUtils.cxx:1578
 TQUtils.cxx:1579
 TQUtils.cxx:1580
 TQUtils.cxx:1581
 TQUtils.cxx:1582
 TQUtils.cxx:1583
 TQUtils.cxx:1584
 TQUtils.cxx:1585
 TQUtils.cxx:1586
 TQUtils.cxx:1587
 TQUtils.cxx:1588
 TQUtils.cxx:1589
 TQUtils.cxx:1590
 TQUtils.cxx:1591
 TQUtils.cxx:1592
 TQUtils.cxx:1593
 TQUtils.cxx:1594
 TQUtils.cxx:1595
 TQUtils.cxx:1596
 TQUtils.cxx:1597
 TQUtils.cxx:1598
 TQUtils.cxx:1599
 TQUtils.cxx:1600
 TQUtils.cxx:1601
 TQUtils.cxx:1602
 TQUtils.cxx:1603
 TQUtils.cxx:1604
 TQUtils.cxx:1605
 TQUtils.cxx:1606
 TQUtils.cxx:1607
 TQUtils.cxx:1608
 TQUtils.cxx:1609
 TQUtils.cxx:1610
 TQUtils.cxx:1611
 TQUtils.cxx:1612
 TQUtils.cxx:1613
 TQUtils.cxx:1614
 TQUtils.cxx:1615
 TQUtils.cxx:1616
 TQUtils.cxx:1617
 TQUtils.cxx:1618
 TQUtils.cxx:1619
 TQUtils.cxx:1620
 TQUtils.cxx:1621
 TQUtils.cxx:1622
 TQUtils.cxx:1623
 TQUtils.cxx:1624
 TQUtils.cxx:1625
 TQUtils.cxx:1626
 TQUtils.cxx:1627
 TQUtils.cxx:1628
 TQUtils.cxx:1629
 TQUtils.cxx:1630
 TQUtils.cxx:1631
 TQUtils.cxx:1632
 TQUtils.cxx:1633
 TQUtils.cxx:1634
 TQUtils.cxx:1635
 TQUtils.cxx:1636
 TQUtils.cxx:1637
 TQUtils.cxx:1638
 TQUtils.cxx:1639
 TQUtils.cxx:1640
 TQUtils.cxx:1641
 TQUtils.cxx:1642
 TQUtils.cxx:1643
 TQUtils.cxx:1644
 TQUtils.cxx:1645
 TQUtils.cxx:1646
 TQUtils.cxx:1647
 TQUtils.cxx:1648
 TQUtils.cxx:1649
 TQUtils.cxx:1650
 TQUtils.cxx:1651
 TQUtils.cxx:1652
 TQUtils.cxx:1653
 TQUtils.cxx:1654
 TQUtils.cxx:1655
 TQUtils.cxx:1656
 TQUtils.cxx:1657
 TQUtils.cxx:1658
 TQUtils.cxx:1659
 TQUtils.cxx:1660
 TQUtils.cxx:1661
 TQUtils.cxx:1662
 TQUtils.cxx:1663
 TQUtils.cxx:1664
 TQUtils.cxx:1665
 TQUtils.cxx:1666
 TQUtils.cxx:1667
 TQUtils.cxx:1668
 TQUtils.cxx:1669
 TQUtils.cxx:1670
 TQUtils.cxx:1671
 TQUtils.cxx:1672
 TQUtils.cxx:1673
 TQUtils.cxx:1674
 TQUtils.cxx:1675
 TQUtils.cxx:1676
 TQUtils.cxx:1677
 TQUtils.cxx:1678
 TQUtils.cxx:1679
 TQUtils.cxx:1680
 TQUtils.cxx:1681
 TQUtils.cxx:1682
 TQUtils.cxx:1683
 TQUtils.cxx:1684
 TQUtils.cxx:1685
 TQUtils.cxx:1686
 TQUtils.cxx:1687
 TQUtils.cxx:1688
 TQUtils.cxx:1689
 TQUtils.cxx:1690
 TQUtils.cxx:1691
 TQUtils.cxx:1692
 TQUtils.cxx:1693
 TQUtils.cxx:1694
 TQUtils.cxx:1695
 TQUtils.cxx:1696
 TQUtils.cxx:1697
 TQUtils.cxx:1698
 TQUtils.cxx:1699
 TQUtils.cxx:1700
 TQUtils.cxx:1701
 TQUtils.cxx:1702
 TQUtils.cxx:1703
 TQUtils.cxx:1704
 TQUtils.cxx:1705
 TQUtils.cxx:1706
 TQUtils.cxx:1707
 TQUtils.cxx:1708
 TQUtils.cxx:1709
 TQUtils.cxx:1710
 TQUtils.cxx:1711
 TQUtils.cxx:1712
 TQUtils.cxx:1713
 TQUtils.cxx:1714
 TQUtils.cxx:1715
 TQUtils.cxx:1716
 TQUtils.cxx:1717
 TQUtils.cxx:1718
 TQUtils.cxx:1719
 TQUtils.cxx:1720
 TQUtils.cxx:1721
 TQUtils.cxx:1722
 TQUtils.cxx:1723
 TQUtils.cxx:1724
 TQUtils.cxx:1725
 TQUtils.cxx:1726
 TQUtils.cxx:1727
 TQUtils.cxx:1728
 TQUtils.cxx:1729
 TQUtils.cxx:1730
 TQUtils.cxx:1731
 TQUtils.cxx:1732
 TQUtils.cxx:1733
 TQUtils.cxx:1734
 TQUtils.cxx:1735
 TQUtils.cxx:1736
 TQUtils.cxx:1737
 TQUtils.cxx:1738
 TQUtils.cxx:1739
 TQUtils.cxx:1740
 TQUtils.cxx:1741
 TQUtils.cxx:1742
 TQUtils.cxx:1743
 TQUtils.cxx:1744
 TQUtils.cxx:1745
 TQUtils.cxx:1746
 TQUtils.cxx:1747
 TQUtils.cxx:1748
 TQUtils.cxx:1749
 TQUtils.cxx:1750
 TQUtils.cxx:1751
 TQUtils.cxx:1752
 TQUtils.cxx:1753
 TQUtils.cxx:1754
 TQUtils.cxx:1755
 TQUtils.cxx:1756
 TQUtils.cxx:1757
 TQUtils.cxx:1758
 TQUtils.cxx:1759
 TQUtils.cxx:1760
 TQUtils.cxx:1761
 TQUtils.cxx:1762
 TQUtils.cxx:1763
 TQUtils.cxx:1764
 TQUtils.cxx:1765
 TQUtils.cxx:1766
 TQUtils.cxx:1767
 TQUtils.cxx:1768
 TQUtils.cxx:1769
 TQUtils.cxx:1770
 TQUtils.cxx:1771
 TQUtils.cxx:1772
 TQUtils.cxx:1773
 TQUtils.cxx:1774
 TQUtils.cxx:1775
 TQUtils.cxx:1776
 TQUtils.cxx:1777
 TQUtils.cxx:1778
 TQUtils.cxx:1779
 TQUtils.cxx:1780
 TQUtils.cxx:1781
 TQUtils.cxx:1782
 TQUtils.cxx:1783
 TQUtils.cxx:1784
 TQUtils.cxx:1785
 TQUtils.cxx:1786
 TQUtils.cxx:1787
 TQUtils.cxx:1788
 TQUtils.cxx:1789
 TQUtils.cxx:1790
 TQUtils.cxx:1791
 TQUtils.cxx:1792
 TQUtils.cxx:1793
 TQUtils.cxx:1794
 TQUtils.cxx:1795
 TQUtils.cxx:1796
 TQUtils.cxx:1797
 TQUtils.cxx:1798
 TQUtils.cxx:1799
 TQUtils.cxx:1800
 TQUtils.cxx:1801
 TQUtils.cxx:1802
 TQUtils.cxx:1803
 TQUtils.cxx:1804
 TQUtils.cxx:1805
 TQUtils.cxx:1806
 TQUtils.cxx:1807
 TQUtils.cxx:1808
 TQUtils.cxx:1809
 TQUtils.cxx:1810
 TQUtils.cxx:1811
 TQUtils.cxx:1812
 TQUtils.cxx:1813
 TQUtils.cxx:1814
 TQUtils.cxx:1815
 TQUtils.cxx:1816
 TQUtils.cxx:1817
 TQUtils.cxx:1818
 TQUtils.cxx:1819
 TQUtils.cxx:1820
 TQUtils.cxx:1821
 TQUtils.cxx:1822
 TQUtils.cxx:1823
 TQUtils.cxx:1824
 TQUtils.cxx:1825
 TQUtils.cxx:1826
 TQUtils.cxx:1827
 TQUtils.cxx:1828
 TQUtils.cxx:1829
 TQUtils.cxx:1830