ATLAS Offline Software
VP1FileUtilities.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Header file for class VP1FileUtilities //
8 // //
9 // Author: Vakho Tsulaia <tsulaia@mail.cern.ch> //
10 // //
11 // Initial version: October 2007 //
12 // //
13 // Updates: //
14 // Riccardo Maria BIANCHI <rbianchi@cern.ch> //
15 // //
17 
18 #ifndef VP1FILEUTILITIES_H
19 #define VP1FILEUTILITIES_H
20 
21 //NB: There should never be any Qt (or Athena of course) includes in this file!!!
22 #include <string>
23 
25 {
26 public:
27  //
28  // Parameters for the constructor
29  //
30  // 1. inputDirectory. The directory where vp1 event files are created
31  // by Writer algorithm.
32  //
33  // 2. fileLimit.
34  // * Writing: maximum number of files to keep in 'inputDirectory'
35  // * Reading: maximum number of files to keep in 'copyDirectory' (see below)
36  VP1FileUtilities(const std::string& inputDirectory,
37  unsigned int fileLimit, const std::string& outputDir = "", bool forceMakeOutputDir = false, bool removeInputFile = true);
38  virtual ~VP1FileUtilities();
39 
40  //
41  // **** Write method ****
42  //
43  // This method takes the 'sourceFile' (pool.root file with single event) from run directory
44  // and copies it over to the 'inputDirectory' with the name:
45  //
46  // vp1_runNumber_eventNumber_timeStamp.pool.root
47  //
48  // After that, if the total number of files in the 'inputDirectory' is > fileLimit then the oldest
49  // vp1 event file is deleted.
50  void produceNewFile(const std::string& sourceFile,
51  unsigned int runNumber,
52  unsigned long long eventNumber,
53  unsigned int timeStamp,
54  const std::string& textLabel = "");
55 
56  // **** Check if file exists ****
57  static bool fileExistsAndReadable(const std::string&);
58 
59 private:
60  // Delete the oldest vp1 events file in either inputDirectory (inputDir = True) or copyDirectory
61  void cleanUp();
62 
63  std::string m_inputDirectory;
65  std::string m_outputDirectory;
68 };
69 
70 #endif
VP1FileUtilities::m_removeInputFile
bool m_removeInputFile
Definition: VP1FileUtilities.h:67
VP1FileUtilities::~VP1FileUtilities
virtual ~VP1FileUtilities()
Definition: VP1FileUtilities.cxx:63
VP1FileUtilities::fileExistsAndReadable
static bool fileExistsAndReadable(const std::string &)
Definition: VP1FileUtilities.cxx:211
VP1FileUtilities::m_fileLimit
int m_fileLimit
Definition: VP1FileUtilities.h:64
VP1FileUtilities::m_forceMakeOutputDir
bool m_forceMakeOutputDir
Definition: VP1FileUtilities.h:66
VP1FileUtilities::cleanUp
void cleanUp()
Definition: VP1FileUtilities.cxx:175
VP1FileUtilities::VP1FileUtilities
VP1FileUtilities(const std::string &inputDirectory, unsigned int fileLimit, const std::string &outputDir="", bool forceMakeOutputDir=false, bool removeInputFile=true)
Definition: VP1FileUtilities.cxx:32
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
CscCalibQuery.outputDir
string outputDir
Definition: CscCalibQuery.py:261
xAOD::timeStamp
setEventNumber timeStamp
Definition: EventInfo_v1.cxx:128
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
VP1FileUtilities::produceNewFile
void produceNewFile(const std::string &sourceFile, unsigned int runNumber, unsigned long long eventNumber, unsigned int timeStamp, const std::string &textLabel="")
Definition: VP1FileUtilities.cxx:67
TileLaserCalibAlgConfig.inputDirectory
inputDirectory
Definition: TileLaserCalibAlgConfig.py:84
VP1FileUtilities::m_outputDirectory
std::string m_outputDirectory
Definition: VP1FileUtilities.h:65
VP1FileUtilities
Definition: VP1FileUtilities.h:25
VP1FileUtilities::m_inputDirectory
std::string m_inputDirectory
Definition: VP1FileUtilities.h:63