#include <VP1FileUtilities.h>
 | 
|   | VP1FileUtilities (const std::string &inputDirectory, unsigned int fileLimit, const std::string &outputDir="", bool forceMakeOutputDir=false, bool removeInputFile=true) | 
|   | 
| virtual  | ~VP1FileUtilities () | 
|   | 
| void  | produceNewFile (const std::string &sourceFile, unsigned int runNumber, unsigned long long eventNumber, unsigned int timeStamp, const std::string &textLabel="") | 
|   | 
Definition at line 24 of file VP1FileUtilities.h.
 
◆ VP1FileUtilities()
      
        
          | VP1FileUtilities::VP1FileUtilities  | 
          ( | 
          const std::string &  | 
          inputDirectory,  | 
        
        
           | 
           | 
          unsigned int  | 
          fileLimit,  | 
        
        
           | 
           | 
          const std::string &  | 
          outputDir = "",  | 
        
        
           | 
           | 
          bool  | 
          forceMakeOutputDir = false,  | 
        
        
           | 
           | 
          bool  | 
          removeInputFile = true  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 32 of file VP1FileUtilities.cxx.
   42   if(!inpDir.exists()||!inpDir.isDir()||!inpDir.isReadable()||!inpDir.isWritable()) {
 
   43     std::string errMessage = std::string(
"VP1FileUtilities: ERROR!! The directory ") + 
inputDirectory + std::string(
" either does not exist or is not writable");
 
   44     throw std::runtime_error(errMessage.c_str());
 
   50       if(!inpDir.exists()||!inpDir.isDir()||!inpDir.isReadable()||!inpDir.isWritable()) {
 
   51           std::string errMessage = std::string(
"VP1FileUtilities: ERROR!! The directory ") + 
m_outputDirectory + std::string(
" does not exist.");
 
   53               errMessage += 
"\nforceMakeOutputDir=True --> Creating the output folder now...";
 
   56               throw std::runtime_error(errMessage.c_str());
 
 
 
 
◆ ~VP1FileUtilities()
  
  
      
        
          | VP1FileUtilities::~VP1FileUtilities  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
◆ cleanUp()
  
  
      
        
          | void VP1FileUtilities::cleanUp  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Definition at line 175 of file VP1FileUtilities.cxx.
  182   QStringList nameFilters;
 
  183   nameFilters << 
"vp1_*.pool.root";
 
  186   dir.setNameFilters(nameFilters);
 
  187   dir.setSorting(QDir::Time|QDir::Reversed);
 
  188   QFileInfoList 
list = 
dir.entryInfoList();
 
  192     const QFileInfo& fileInfo = 
list.at(0);
 
  194     if(!
dir.remove(fileInfo.fileName()))
 
  195       throw std::runtime_error(
"VP1FileUtilities::cleanup() - WARNING: Unable to do the clean up!");
 
  199   std::string poolCatalogStr = 
poolCatalog.toStdString();
 
  200   std::cout << 
"looking for " << poolCatalogStr << 
" in " <<  QDir::currentPath().toStdString() << std::endl;
 
  202       std::cout << 
"VP1FileUtilities::cleanUp() - removing the file '" << poolCatalogStr << 
"' because it causes problems for subsequent Athena commands opening the copied file." << std::endl;
 
  203       QDir 
cwd = QDir::currentPath();
 
  205         std::cerr << 
"VP1FileUtilities WARNING! Unable to delete " << poolCatalogStr << std::endl;
 
 
 
 
◆ fileExistsAndReadable()
  
  
      
        
          | bool VP1FileUtilities::fileExistsAndReadable  | 
          ( | 
          const std::string &  | 
          file | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
◆ produceNewFile()
      
        
          | void VP1FileUtilities::produceNewFile  | 
          ( | 
          const std::string &  | 
          sourceFile,  | 
        
        
           | 
           | 
          unsigned int  | 
          runNumber,  | 
        
        
           | 
           | 
          unsigned long long  | 
          eventNumber,  | 
        
        
           | 
           | 
          unsigned int  | 
          timeStamp,  | 
        
        
           | 
           | 
          const std::string &  | 
          textLabel = ""  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 67 of file VP1FileUtilities.cxx.
   74   QString srcName(sourceFile.c_str());
 
   78     throw std::runtime_error(
"Source file does not exist!");
 
   84   QString newFileName = inpDirName;
 
   85   std::ostringstream newFileStr;
 
   92   QString latestEventFileName = inpDirName + QString(newFileStr.str().c_str()) + QString(
"latest_vp1event");
 
   94   if (textLabel != 
"" ) {
 
  100   newFileName += QString(newFileStr.str().c_str());
 
  104   if (outDirName != 
"")
 
  105       newFileName = outDirName + QDir::separator() + newFileName;
 
  108   std::cout << 
"VP1FileUtilities -- copying '" <<  (
srcFile.fileName()).toStdString() << 
"' to: '" << newFileName.toStdString() << 
"'..." << std::endl;
 
  112   qint64 inputSize = 
srcFile.size();
 
  113   std::cout << 
"VP1FileUtilities -- Size of the input file to be copied: " << inputSize << std::endl;
 
  116   if(!
srcFile.copy(newFileName)) {
 
  117       throw std::runtime_error(
"VP1FileUtilities -- Unable to copy the temp file to the new file, so unable to produce the new vp1 event file");
 
  121   std::cout << 
"VP1FileUtilities -- delete temp file? --> " <<  
m_removeInputFile << std::endl;
 
  123     bool copyDone = 
false;
 
  125     typedef std::chrono::duration<int,std::milli> millisecs_t ;
 
  135           std::cout << 
"VP1FileUtilities -- Size of the file to be deleted: " << 
checkFile.size() << std::endl;
 
  138             std::cerr << 
"VP1FileUtilities -- WARNING! Unable to delete " << sourceFile << std::endl;
 
  142           std::cout << 
"VP1FileUtilities -- I could not find the output file, so probably the copy action is not finished yet. I'll wait for a short while and I will retry..." << std::endl;
 
  143           std::this_thread::sleep_for(std::chrono::milliseconds(500)); 
 
  145           millisecs_t 
duration( std::chrono::duration_cast<millisecs_t>(
end-
start) ) ;
 
  148               std::cout << 
"VP1FileUtilities -- WARNING!!! " << 
duration.count() << 
" milliseconds passed and still I cannot find the output file. Probably there was a problem. Giving up with the removal of the source file...\n" ;
 
  156   QFile latestEvent(latestEventFileName);
 
  157   if(latestEvent.exists() && !latestEvent.remove())
 
  158     throw std::runtime_error(
"VP1FileUtilities -- Unable to overwrite the existing latest event file");
 
  160   if(!latestEvent.open(QIODevice::WriteOnly | QIODevice::Text))
 
  161     throw std::runtime_error(
"VP1FileUtilities -- Unable to create new latest event file");
 
  162   latestEvent.write(newFileName.toStdString().c_str());
 
  167       std::cout << 
"VP1FileUtilities -- cleaning up..." << std::endl;
 
 
 
 
◆ m_fileLimit
  
  
      
        
          | int VP1FileUtilities::m_fileLimit | 
         
       
   | 
  
private   | 
  
 
 
◆ m_forceMakeOutputDir
  
  
      
        
          | bool VP1FileUtilities::m_forceMakeOutputDir | 
         
       
   | 
  
private   | 
  
 
 
◆ m_inputDirectory
  
  
      
        
          | std::string VP1FileUtilities::m_inputDirectory | 
         
       
   | 
  
private   | 
  
 
 
◆ m_outputDirectory
  
  
      
        
          | std::string VP1FileUtilities::m_outputDirectory | 
         
       
   | 
  
private   | 
  
 
 
◆ m_removeInputFile
  
  
      
        
          | bool VP1FileUtilities::m_removeInputFile | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: