OutputConvention.h
1 /* -*- C++ -*-.***************************************************************************************************
2  Author: Ben Strutt
3  Email: b.strutt.12@ucl.ac.uk
4 
5  Description:
6  A class to manage output file names from environment variables, exec arguments and time.
7 *************************************************************************************************************** */
8 
9 #ifndef OUTPUTCONVENTION_H
10 #define OUTPUTCONVENTION_H
11 
12 
13 #include "TDatime.h"
14 #include "TString.h"
15 #include "TFile.h"
16 #include "TChain.h"
17 
18 #include <stdlib.h>
19 #include <errno.h>
20 #include <sys/stat.h>
21 #include <iostream>
22 #include <algorithm>
23 
24 
25 
26 namespace Acclaim
27 {
28 
36 
37  public:
38 
39  OutputConvention(int argcIn, char* argvIn[]);
40 
41  TString getOutputFileName(TString ext="");
42  TString getOutputDir();
43  TFile* makeFile();
44 
45  static TFile* getFile(TString fileNameWithWildcards);
46 
47  private:
48  int argc;
49  char** argv;
50  TDatime dateTime;
51  TString outputDir;
52  TString dateTimeSuffix;
53  TString outFileName;
54  TString getDateTimeSuffix();
55 
56 
57  };
58 
59 
60 }
61 
62 #endif
OutputConvention(int argcIn, char *argvIn[])
Constructor.
static TFile * getFile(TString fileNameWithWildcards)
Opens matching file with the most recent suffix.
TFile * makeFile()
Create the new output file with proper name.
A class to systematically name files produced by my analysis programs.
Namespace which wraps everything in the library.
TString getOutputFileName(TString ext="")
Get the name of the output file from the program name (and system time).
TString getOutputDir()
Looks for an environment variable called OUTPUT_DIR and if it exists, sets it as the output dir...