KaliVeda
Toolkit for HIC analysis
KVAvailableRunsFile.h
1 /*
2 $Id: KVAvailableRunsFile.h,v 1.5 2008/02/07 09:25:39 franklan Exp $
3 $Revision: 1.5 $
4 $Date: 2008/02/07 09:25:39 $
5 */
6 
9 
10 #ifndef __KVAVAILABLERUNSFILE_H
11 #define __KVAVAILABLERUNSFILE_H
12 
13 #include <KVBase.h>
14 #include "Riostream.h"
15 
16 #include "TDatime.h"
17 #include "TString.h"
18 #include "KVNumberList.h"
19 #include "KVLockfile.h"
20 #include "KVDatime.h"
21 #include "KVDataSet.h"
22 #include "KVList.h"
23 #include "KVHashList.h"
24 #include "KVNameValueList.h"
25 #include "TSystem.h"
26 
27 class KVDBSystem;
28 class TList;
29 
48 class KVAvailableRunsFile: public KVBase {
49 
51 
52 protected:
53  std::ifstream fRunlist;
55 
58  void ReadFile();
59  KVNameValueList* RunHasFileWithDateAndName(Int_t run, const Char_t* filename, TDatime modtime, Int_t& OccNum);
60 
61  const Char_t* GetFileName() const;
62  const Char_t* GetFilePath() const;
65  virtual Bool_t OpenAvailableRunsFile();
66  virtual void CloseAvailableRunsFile();
67 
69  {
70  return fRunlist.is_open();
71  };
72 
73 public:
74 
76  KVAvailableRunsFile(const Char_t* type);
77  KVAvailableRunsFile(const Char_t* type, const KVDataSet* parent);
79 
81  {
83  }
84 
85  const Char_t* GetDataType() const
86  {
87  return GetName();
88  }
89  Int_t IsRunFileName(const Char_t* filename);
90  static Int_t IsRunFileName(const KVString& fmt, const Char_t* filename, Int_t index_multiplier = 10, const Char_t* separators = ".");
91  Bool_t ExtractDateFromFileName(const Char_t* name, KVDatime& date);
92  static Bool_t ExtractDateFromFileName(const TString& fmt, const Char_t* name, KVDatime& date);
93  virtual void Update(Bool_t no_existing_file = kFALSE);
94  virtual Bool_t CheckAvailable(Int_t run);
95  virtual Int_t Count(Int_t run);
96  virtual Bool_t GetRunInfo(Int_t run, TDatime& modtime,
97  TString& filename);
98  virtual void GetRunInfos(Int_t run, KVList* dates, KVList* names);
99  const Char_t* GetFileName(Int_t run);
100  virtual TList* GetListOfAvailableSystems(const KVDBSystem* systol = 0);
101  virtual KVNumberList GetRunList(const KVDBSystem* system = 0);
102 
103  virtual void Remove(Int_t run, const Char_t* filename = "");
104  virtual void UpdateInfos(Int_t run, const Char_t* filename, const Char_t* kvversion, const Char_t* username);
105  virtual Bool_t InfosNeedUpdate(Int_t run, const Char_t* filename);
106  virtual void Add(Int_t run, const Char_t* filename);
107  const KVDataSet* GetDataSet() const
108  {
110  return fDataSet;
111  }
112 
113  void SetDataSet(const KVDataSet* d)
114  {
116  fDataSet = d;
117  }
118 
120  void RemoveDuplicateLines(KVNumberList lines_to_be_removed);
121 
122  ClassDef(KVAvailableRunsFile, 1) //Handles text files containing list of available runs for different datasets and types of data
123 };
124 
125 #endif
int Int_t
#define d(i)
bool Bool_t
char Char_t
#define ClassDef(name, id)
R__EXTERN TSystem * gSystem
Handles lists of available runs for different datasets and types of data.
virtual void CloseAvailableRunsFile()
Bool_t CheckDirectoryForAvailableRunsFile()
Bool_t FileExists() const
virtual void Add(Int_t run, const Char_t *filename)
virtual Bool_t GetRunInfo(Int_t run, TDatime &modtime, TString &filename)
Bool_t ExtractDateFromFileName(const Char_t *name, KVDatime &date)
const Char_t * GetDataType() const
void SetDataSet(const KVDataSet *d)
KVNumberList CheckMultiRunfiles()
Returns a list with all runs which occur more than once in the available runs file.
const KVDataSet * fDataSet
dataset to which this file belongs
virtual Bool_t CheckAvailable(Int_t run)
virtual void Update(Bool_t no_existing_file=kFALSE)
virtual ~ KVAvailableRunsFile()
KVHashList * fAvailableRuns
temporary list used to store infos when updating
virtual KVNumberList GetRunList(const KVDBSystem *system=0)
const Char_t * GetFileName() const
const KVDataSet * GetDataSet() const
KVLockfile runlist_lock
for locking runlist file
KVNameValueList * RunHasFileWithDateAndName(Int_t run, const Char_t *filename, TDatime modtime, Int_t &OccNum)
virtual TList * GetListOfAvailableSystems(const KVDBSystem *systol=0)
virtual Int_t Count(Int_t run)
static KVString date_read_from_filename
virtual void UpdateInfos(Int_t run, const Char_t *filename, const Char_t *kvversion, const Char_t *username)
const Char_t * GetFullPathToAvailableRunsFile() const
virtual void Remove(Int_t run, const Char_t *filename="")
KVAvailableRunsFile()
Default ctor.
virtual void GetRunInfos(Int_t run, KVList *dates, KVList *names)
virtual Bool_t InfosNeedUpdate(Int_t run, const Char_t *filename)
std::ifstream fRunlist
for reading runlist file
Int_t IsRunFileName(const Char_t *filename)
virtual Bool_t OpenAvailableRunsFile()
const Char_t * GetFilePath() const
void RemoveDuplicateLines(KVNumberList lines_to_be_removed)
Base class for KaliVeda framework.
Definition: KVBase.h:142
Database class used to store information on different colliding systems studied during an experiment....
Definition: KVDBSystem.h:52
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:35
Extension of TDatime to handle various useful date formats.
Definition: KVDatime.h:33
Extended version of ROOT THashList.
Definition: KVHashList.h:29
Extended TList class which owns its objects by default.
Definition: KVList.h:28
Interface to (Linux) system lockfile command.
Definition: KVLockfile.h:70
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
const char * GetName() const override
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)