ATLAS Offline Software
VP1AvailEvents.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1AvailEvents //
9 // //
10 // Description: Class for keeping track of available events //
11 // when running VP1 in single-file-per-event //
12 // mode. //
13 // //
14 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
15 // Initial version: May 2008 //
16 // //
18 
19 #ifndef IVP1AVAILEVENTS_H
20 #define IVP1AVAILEVENTS_H
21 #include <QObject>
22 #include <QList>
23 #include "VP1Gui/VP1EventFile.h"
24 
25 class VP1AvailEvents : public QObject {
26 
27  Q_OBJECT
28 
29 public:
30 
31  VP1AvailEvents(int timeCutForNew, QString tmpdir, int maxLocalFilesToKeep = -1, QObject * parent = 0);//maxLocalFilesToKeep<=2 means keep all.
32  //timeCutForNew: <0 : no time Cut;
33  // 0 : only newest is fresh
34  // >0 : time cut in seconds.
35  virtual void init() = 0;//Forbidden to do any real work before init is called (in particular emit signals!).
36 
37  virtual ~VP1AvailEvents();
38 
39  //Next two returns ordered lists such that first means newer.
40  QList<VP1EventFile> allLocalEvents() const;//All events copied to tmp directory
41  QList<VP1EventFile> freshEvents() const;//Events that are considered "new", and which have not been investigated yet.
42  VP1EventFile newestEvent() const;//The newest event. Might have been investigated.
43 
44  void setCurrentEvent(int run,int event);//Call on every new event to update the history.
45  int maxLocalFilesToKeep() const;
46 
47 protected:
48  void cleanupAndCheckForEventListChanges();//Call from derived classes to ensure proper emission of XXXEventsChanged() signals.
49  void invalidateDirCache(const QString& dir);//Call from derived classes after making changes to files in directory.
50  bool inHistory(int run, int event) const;
51  QList<VP1EventFile> allEventFilesInDir(const QString& dir) const;
52  QList<VP1EventFile> freshEvents(VP1EventFile newestEvt, const QList<VP1EventFile>&) const;//Given timecut and newestEvt, trim down
53  //list so we only get the "fresh events" left.
54  QString tmpDir() const;
55  QString tmpLocalFileDir() const;
56  QString tmpActiveRetrievalDir();//attempts to create temporary subdirectory in tmpCopyDir which
57  //can be used for temporary files while downloading/copying, etc.
58  //returns an empty string in case of problems.
59 
60  //Definition of fresh events:
61  int timeCutForNew() const;
62  bool requireNewestRunNumber() const { return false; /*fixme*/ }
63  //Convenience:
64  bool isConsideredFresh ( const VP1EventFile& evt, const VP1EventFile& newestEvt ) const;
65 
66  void messageDebug(const QString&) const;//Messages to appear on output.
67 signals:
70  void message(const QString&) const;//Messages to appear in GUI.
71 
72 private Q_SLOTS:
73  void actualCleanup();
75 
76 private:
77 
78  class Imp;
79  Imp * m_d;
80 
81 };
82 
83 #endif
VP1AvailEvents::tmpLocalFileDir
QString tmpLocalFileDir() const
Definition: VP1AvailEvents.cxx:283
VP1AvailEvents::actualCheckForEventListChanges
void actualCheckForEventListChanges()
Definition: VP1AvailEvents.cxx:161
VP1AvailEvents::allLocalEvents
QList< VP1EventFile > allLocalEvents() const
Definition: VP1AvailEvents.cxx:241
VP1AvailEvents::allLocalEventsChanged
void allLocalEventsChanged()
VP1AvailEvents::cleanupAndCheckForEventListChanges
void cleanupAndCheckForEventListChanges()
Definition: VP1AvailEvents.cxx:176
VP1AvailEvents::tmpActiveRetrievalDir
QString tmpActiveRetrievalDir()
Definition: VP1AvailEvents.cxx:277
VP1AvailEvents::init
virtual void init()=0
VP1AvailEvents::actualCleanup
void actualCleanup()
Definition: VP1AvailEvents.cxx:151
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
VP1AvailEvents::freshEventsChanged
void freshEventsChanged()
VP1AvailEvents::message
void message(const QString &) const
VP1AvailEvents::tmpDir
QString tmpDir() const
Definition: VP1AvailEvents.cxx:104
VP1AvailEvents::inHistory
bool inHistory(int run, int event) const
Definition: VP1AvailEvents.cxx:187
VP1AvailEvents::freshEvents
QList< VP1EventFile > freshEvents() const
Definition: VP1AvailEvents.cxx:129
VP1AvailEvents::~VP1AvailEvents
virtual ~VP1AvailEvents()
Definition: VP1AvailEvents.cxx:81
VP1AvailEvents::newestEvent
VP1EventFile newestEvent() const
Definition: VP1AvailEvents.cxx:135
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
VP1AvailEvents::Imp
Definition: VP1AvailEvents.cxx:27
VP1EventFile.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1AvailEvents::timeCutForNew
int timeCutForNew() const
Definition: VP1AvailEvents.cxx:92
run
Definition: run.py:1
VP1AvailEvents::setCurrentEvent
void setCurrentEvent(int run, int event)
Definition: VP1AvailEvents.cxx:144
VP1AvailEvents::requireNewestRunNumber
bool requireNewestRunNumber() const
Definition: VP1AvailEvents.h:62
beamspotman.tmpdir
string tmpdir
Definition: beamspotman.py:412
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
beamspotman.dir
string dir
Definition: beamspotman.py:623
VP1AvailEvents::m_d
Imp * m_d
Definition: VP1AvailEvents.h:78
VP1AvailEvents::VP1AvailEvents
VP1AvailEvents(int timeCutForNew, QString tmpdir, int maxLocalFilesToKeep=-1, QObject *parent=0)
Definition: VP1AvailEvents.cxx:71
VP1AvailEvents::maxLocalFilesToKeep
int maxLocalFilesToKeep() const
Definition: VP1AvailEvents.cxx:98
VP1EventFile
Definition: VP1EventFile.h:23
VP1AvailEvents::allEventFilesInDir
QList< VP1EventFile > allEventFilesInDir(const QString &dir) const
Definition: VP1AvailEvents.cxx:202
VP1AvailEvents
Definition: VP1AvailEvents.h:25
VP1AvailEvents::messageDebug
void messageDebug(const QString &) const
Definition: VP1AvailEvents.cxx:351
VP1AvailEvents::isConsideredFresh
bool isConsideredFresh(const VP1EventFile &evt, const VP1EventFile &newestEvt) const
Definition: VP1AvailEvents.cxx:336
VP1AvailEvents::invalidateDirCache
void invalidateDirCache(const QString &dir)
Definition: VP1AvailEvents.cxx:194