ATLAS Offline Software
Loading...
Searching...
No Matches
VP1AvailEvents.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
25class VP1AvailEvents : public QObject {
26
27 Q_OBJECT
28
29public:
30
31 VP1AvailEvents(int timeCutForNew, const 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
47protected:
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 const 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.
67signals:
70 void message(const QString&) const;//Messages to appear in GUI.
71
72private Q_SLOTS:
73 void actualCleanup();
75
76private:
77
78 class Imp;
80
81};
82
83#endif
QList< VP1EventFile > allLocalEvents() const
void setCurrentEvent(int run, int event)
QList< VP1EventFile > freshEvents() const
virtual ~VP1AvailEvents()
void messageDebug(const QString &) const
QString tmpLocalFileDir() const
void message(const QString &) const
VP1AvailEvents(int timeCutForNew, const QString &tmpdir, int maxLocalFilesToKeep=-1, QObject *parent=0)
const QString & tmpDir() const
void allLocalEventsChanged()
bool requireNewestRunNumber() const
int timeCutForNew() const
bool inHistory(int run, int event) const
QList< VP1EventFile > allEventFilesInDir(const QString &dir) const
VP1EventFile newestEvent() const
int maxLocalFilesToKeep() const
void actualCheckForEventListChanges()
void invalidateDirCache(const QString &dir)
virtual void init()=0
bool isConsideredFresh(const VP1EventFile &evt, const VP1EventFile &newestEvt) const
void cleanupAndCheckForEventListChanges()
void freshEventsChanged()
QString tmpActiveRetrievalDir()
Definition run.py:1