ATLAS Offline Software
graphics
VP1
VP1Gui
src
VP1StreamMenuUpdater.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
VP1StreamMenuUpdater.h
"
6
7
#include <QDir>
8
#include <QFile>
9
#include <QFileInfo>
10
#include <QTextStream>
11
#include <QTimer>
12
#include <QDateTime>
13
#include <QMutexLocker>
14
15
VP1StreamMenuUpdater::VP1StreamMenuUpdater
(
VP1DirStatuses
& diractions
16
,QMutex*
mutex
17
,QObject*
parent
)
18
: QThread(
parent
)
19
, m_inputdiractions(diractions)
20
, m_mutex(
mutex
)
21
, m_timer(0)
22
{
23
}
24
25
VP1StreamMenuUpdater::~VP1StreamMenuUpdater
()
26
{
27
delete
m_timer
;
28
}
29
30
void
VP1StreamMenuUpdater::run
()
31
{
32
updateInputDirectoriesStatus
();
33
m_timer
=
new
QTimer(0);
34
connect
(
m_timer
, SIGNAL(
timeout
()),
this
, SLOT(
updateInputDirectoriesStatus
()),Qt::DirectConnection);
35
m_timer
->start(5000);
36
exec
();
37
}
38
39
void
VP1StreamMenuUpdater::updateInputDirectoriesStatus
()
40
{
41
QMutexLocker locker(
m_mutex
);
42
43
for
(QAction* act :
m_inputdiractions
.keys()) {
44
VP1DirStatusData
& dirstatus =
m_inputdiractions
[act];
45
dirstatus.
enabled
=
true
;
46
dirstatus.
bold
=
false
;
47
dirstatus.
dirStatus
=
"unknown"
;
48
49
// Check whether it exists and is really a directory
50
QFileInfo
fi
(dirstatus.
inputDir
);
51
if
(!
fi
.exists()||!
fi
.isDir()) {
52
dirstatus.
enabled
=
false
;
53
dirstatus.
dirStatus
=
"not found"
;
54
}
else
{
55
// Access the latest_vp1event file in order to get the name of the latest vp1 event file
56
// in the directory
57
QFile latestFileRef(dirstatus.
inputDir
+
"/latest_vp1event"
);
58
if
(latestFileRef.exists()
59
&& latestFileRef.open(QIODevice::ReadOnly | QIODevice::Text)) {
60
QTextStream textStream(&latestFileRef);
61
QString latestFileName = textStream.readLine();
62
latestFileRef.close();
63
64
QFileInfo latestFile(latestFileName);
65
if
(latestFile.exists()) {
66
int
secondswithoutupdate = latestFile.lastModified().secsTo(QDateTime::currentDateTime());
67
dirstatus.
bold
= (secondswithoutupdate<60);
68
if
(secondswithoutupdate<120)
69
dirstatus.
dirStatus
=
QString::number
(secondswithoutupdate)+
" seconds since update"
;
70
else
if
(secondswithoutupdate<7200)
71
dirstatus.
dirStatus
=
QString::number
(
static_cast<
int
>
(secondswithoutupdate/60.0+0.5))+
" minutes since update"
;
72
else
73
dirstatus.
dirStatus
=
QString::number
(
static_cast<
int
>
(secondswithoutupdate/3600.0+0.5))+
" hours since update"
;
74
}
75
}
76
}
77
}
78
}
VP1DirStatusData
Definition:
VP1MainWindow.h:54
BeamSpot::mutex
std::mutex mutex
Definition:
InDetBeamSpotVertex.cxx:18
fillPileUpNoiseLumi.connect
string connect
Definition:
fillPileUpNoiseLumi.py:70
VP1DirStatuses
QMap< QAction *, VP1DirStatusData > VP1DirStatuses
Definition:
VP1MainWindow.h:78
VP1DirStatusData::bold
bool bold
Definition:
VP1MainWindow.h:75
VP1StreamMenuUpdater::VP1StreamMenuUpdater
VP1StreamMenuUpdater(VP1DirStatuses &, QMutex *, QObject *parent=0)
Definition:
VP1StreamMenuUpdater.cxx:15
VP1StreamMenuUpdater::m_mutex
QMutex * m_mutex
Definition:
VP1StreamMenuUpdater.h:33
VP1StreamMenuUpdater::m_inputdiractions
VP1DirStatuses & m_inputdiractions
Definition:
VP1StreamMenuUpdater.h:32
VP1DirStatusData::inputDir
QString inputDir
Definition:
VP1MainWindow.h:70
LArG4FSStartPointFilter.exec
exec
Definition:
LArG4FSStartPointFilter.py:103
VP1DirStatusData::dirStatus
QString dirStatus
Definition:
VP1MainWindow.h:73
test_pyathena.parent
parent
Definition:
test_pyathena.py:15
VP1StreamMenuUpdater.h
VP1StreamMenuUpdater::updateInputDirectoriesStatus
void updateInputDirectoriesStatus()
Definition:
VP1StreamMenuUpdater.cxx:39
python.selection.number
number
Definition:
selection.py:20
VP1DirStatusData::enabled
bool enabled
Definition:
VP1MainWindow.h:74
checkFileSG.fi
fi
Definition:
checkFileSG.py:65
VP1StreamMenuUpdater::run
void run()
Definition:
VP1StreamMenuUpdater.cxx:30
VP1StreamMenuUpdater::~VP1StreamMenuUpdater
~VP1StreamMenuUpdater()
Definition:
VP1StreamMenuUpdater.cxx:25
python.TrigInDetArtSteps.timeout
timeout
Definition:
TrigInDetArtSteps.py:35
VP1StreamMenuUpdater::m_timer
QTimer * m_timer
Definition:
VP1StreamMenuUpdater.h:34
Generated on Thu Nov 7 2024 21:31:45 for ATLAS Offline Software by
1.8.18