ATLAS Offline Software
Loading...
Searching...
No Matches
VP1Gui Class Reference

#include <VP1Gui.h>

Collaboration diagram for VP1Gui:

Classes

class  Imp

Public Member Functions

 VP1Gui (StoreGateSvc *sg, StoreGateSvc *detstore, ISvcLocator *svclocator, IToolSvc *toolSvc, const std::vector< std::string > &initialvp1files=std::vector< std::string >(), const std::string &initialCruiseMode="NONE", unsigned initialCruiseSeconds=10, const std::string &singleEventSource="", const std::string &singleEventLocalTmpDir="", unsigned localFileCacheLimit=10, const std::vector< std::string > &availableLocalInputDirectories=std::vector< std::string >())
 ~VP1Gui ()
bool argumentsAreValid () const
void init ()
bool hasBeenInitialised ()
bool executeNewEvent (const int &run, const uint64_t &event, const unsigned &triggerType=0, const unsigned &time=0)
void cleanup ()
std::vector< std::string > userRequestedFiles ()
std::string nextRequestedEventFile () const

Private Member Functions

 VP1Gui (const VP1Gui &)
VP1Guioperator= (const VP1Gui &)

Private Attributes

Impm_d

Detailed Description

Definition at line 28 of file VP1Gui.h.

Constructor & Destructor Documentation

◆ VP1Gui() [1/2]

VP1Gui::VP1Gui ( StoreGateSvc * sg,
StoreGateSvc * detstore,
ISvcLocator * svclocator,
IToolSvc * toolSvc,
const std::vector< std::string > & initialvp1files = std::vector<std::string>(),
const std::string & initialCruiseMode = "NONE",
unsigned initialCruiseSeconds = 10,
const std::string & singleEventSource = "",
const std::string & singleEventLocalTmpDir = "",
unsigned localFileCacheLimit = 10,
const std::vector< std::string > & availableLocalInputDirectories = std::vector<std::string>() )

Definition at line 56 of file VP1Gui.cxx.

63 : m_d(new Imp)
64{
65 m_d->sg = sg;
66 m_d->detstore = detstore;
67 m_d->svclocator = svclocator;
68 m_d->toolSvc = toolSvc;
69 m_d->initialCruiseMode = QString(initialCruiseMode.c_str()).simplified();
70 m_d->initialCruiseSeconds = initialCruiseSeconds;
71 m_d->singleEventSource = singleEventSource.c_str();
72 m_d->singleEventLocalTmpDir = singleEventLocalTmpDir.c_str();
73 m_d->localFileCacheLimit = localFileCacheLimit;
74
75 std::vector<std::string>::const_iterator it, itE = initialvp1files.end();
76 for (it = initialvp1files.begin();it!=itE;++it)
77 m_d->initialvp1files << it->c_str();
78
79 itE = availableLocalInputDirectories.end();
80 for (it = availableLocalInputDirectories.begin();it!=itE;++it)
81 m_d->availableLocalInputDirectories << it->c_str();
82
83}
Imp * m_d
Definition VP1Gui.h:72

◆ ~VP1Gui()

VP1Gui::~VP1Gui ( )

Definition at line 86 of file VP1Gui.cxx.

87{
88 delete m_d; m_d=0;
89}

◆ VP1Gui() [2/2]

VP1Gui::VP1Gui ( const VP1Gui & )
private

Member Function Documentation

◆ argumentsAreValid()

bool VP1Gui::argumentsAreValid ( ) const

Definition at line 92 of file VP1Gui.cxx.

93{
94 //Athena pointers:
95
96 if (!m_d->sg) {
97 VP1Msg::message("ERROR: Null pointer to event store.");
98 return false;
99 }
100 if (!m_d->detstore) {
101 VP1Msg::message("ERROR: Null pointer to detector store.");
102 return false;
103 }
104 if (!m_d->svclocator) {
105 VP1Msg::message("ERROR: Null pointer to service locator.");
106 return false;
107 }
108 if (!m_d->toolSvc) {
109 VP1Msg::message("ERROR: Null pointer to tool service.");
110 return false;
111 }
112
113 //Initial files:
114
115 // ...no checks...
116
117 //Cruise mode:
118 if (m_d->initialCruiseMode!="NONE"&&m_d->initialCruiseMode!="EVENT"&&m_d->initialCruiseMode!="TAB"&&m_d->initialCruiseMode!="BOTH") {
119 VP1Msg::message("WARNING: unknown initial cruise mode "+m_d->initialCruiseMode+" (valid are NONE/EVENT/TAB/BOTH). Assuming NONE.");
120 m_d->initialCruiseMode = "NONE";
121 }
122
123 //Single-Event-Per-File modes:
124 if (!m_d->singleEventSource.isEmpty()&&!m_d->singleEventLocalTmpDir.isEmpty()) {
125 const bool httpmode = m_d->singleEventSource.startsWith("http://") || m_d->singleEventSource.startsWith("https://") ;
126 if (httpmode) {
127 QUrl url(m_d->singleEventSource);
128 if (!url.isValid()||url.path().isEmpty()) {
129 //Fixme: check that path ends with a filename!
130 VP1Msg::message("VP1ExecutionScheduler::init ERROR: Source URL ("+m_d->singleEventSource+") incorrect format!");
131 return false;
132 }
133
134 // For the https mode check if the platform supports SSL
135 if(m_d->singleEventSource.startsWith("https://")
136#ifndef QT_NO_SSL
137 && ! (QSslSocket::supportsSsl()) ) {
138#else
139 ) {
140#endif
141 VP1Msg::message("VP1ExecutionScheduler::init ERROR: Unable to retrieve events over Https. The platform does not support SSL");
142 return false;
143 }
144 } else {
145 QFileInfo fi_s(m_d->singleEventSource), fi_l(m_d->singleEventLocalTmpDir);
146 if (!fi_s.exists()||!fi_s.isDir()||!fi_s.isReadable()) {
147 VP1Msg::message("ERROR: Source directory ("+m_d->singleEventSource+") does not exist, is not readable, or is not a directory!");
148 return false;
149 }
150 if (!fi_l.exists()||!fi_l.isDir()||!fi_l.isReadable()||!fi_l.isWritable()) {
151 VP1Msg::message("ERROR: Local tmp directory ("+m_d->singleEventLocalTmpDir+") does not exist, had incorrect permissions, or is not a directory!");
152 return false;
153 }
154 if (fi_l.canonicalFilePath()==fi_s.canonicalFilePath()) {
155 VP1Msg::message("ERROR: Local tmp directory ("+m_d->singleEventLocalTmpDir+") is the same the source directory ("+m_d->singleEventSource+")");
156 return false;
157 }
158 }
159 } else {
160 if (!m_d->singleEventSource.isEmpty()||!m_d->singleEventLocalTmpDir.isEmpty()) {
161 VP1Msg::message("ERROR: Only one of SourceDir and LocalCopyDir set. Set either both or none.");
162 return false;
163 }
164 }
165
166 if (m_d->localFileCacheLimit==1||m_d->localFileCacheLimit==2) {
167 VP1Msg::message("WARNING: Too low value of localFileCacheLimit. Setting to 3. (Set to 0 to disable removal of locally cached files.");
168 m_d->localFileCacheLimit=3;
169 }
170
171 return true;
172}
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30

◆ cleanup()

void VP1Gui::cleanup ( )

Definition at line 205 of file VP1Gui.cxx.

206{
207 assert(m_d->the_scheduler&&"Cant cleanup before init");
208 VP1ExecutionScheduler::cleanup(m_d->the_scheduler);
209}
static void cleanup(VP1ExecutionScheduler *)

◆ executeNewEvent()

bool VP1Gui::executeNewEvent ( const int & run,
const uint64_t & event,
const unsigned & triggerType = 0,
const unsigned & time = 0 )

Definition at line 212 of file VP1Gui.cxx.

213{
214 VP1Msg::messageDebug("Examining new event ( run# "+QString::number(run)+", event# "+QString::number(event)+" )");
215
216 bool b = m_d->the_scheduler->executeNewEvent(run,event,triggerType,time);
217
218 // NOTE:
219 // we will go on to the lines here below
220 // only when the user clicks on the "Next event" button.
221
222 VP1Msg::messageDebug("Leaving event ( run# "+QString::number(run)+", event# "+QString::number(event)+" )"
223 +(nextRequestedEventFile().empty()?QString(""):". Next requested event file: "+QString(nextRequestedEventFile().c_str())));
224
225 VP1Msg::messageDebug("end of VP1Gui::executeNewEvent().");
226
227 return b;
228}
static const Attributes_t empty
std::string nextRequestedEventFile() const
Definition VP1Gui.cxx:231
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39

◆ hasBeenInitialised()

bool VP1Gui::hasBeenInitialised ( )

Definition at line 175 of file VP1Gui.cxx.

176{
177 return m_d->the_scheduler != 0;
178}

◆ init()

void VP1Gui::init ( )

Definition at line 181 of file VP1Gui.cxx.

182{
183 VP1Msg::messageDebug("Start of VP1Gui::init()...");
184
185 assert(!m_d->the_scheduler&&"Dont init twice!!");
186 VP1Msg::message("");
187 VP1Msg::message("===================================================");
188 VP1Msg::message(" Launching the VP1 GUI");
189 VP1Msg::message("===================================================");
190 VP1Msg::message("");
191 m_d->the_scheduler = VP1ExecutionScheduler::init(m_d->sg,
192 m_d->detstore,
193 m_d->svclocator,
194 m_d->toolSvc,
195 m_d->initialvp1files,
196 m_d->initialCruiseMode,m_d->initialCruiseSeconds,
197 m_d->singleEventSource,m_d->singleEventLocalTmpDir,
198 m_d->localFileCacheLimit,
199 m_d->availableLocalInputDirectories);
200
201 VP1Msg::messageDebug("end of VP1Gui::init().");
202}
static VP1ExecutionScheduler * init(StoreGateSvc *eventStore, StoreGateSvc *detStore, ISvcLocator *svcLocator, IToolSvc *toolSvc, const QStringList &joboptions, QString initialCruiseMode="NONE", unsigned initialCruiseSeconds=10, const QString &singleEventSource="", const QString &singleEventLocalTmpDir="", unsigned localFileCacheLimit=10, const QStringList &availableLocalInputDirectories=QStringList())

◆ nextRequestedEventFile()

std::string VP1Gui::nextRequestedEventFile ( ) const

Definition at line 231 of file VP1Gui.cxx.

232{
233 return m_d->the_scheduler->nextRequestedEventFile().toStdString();
234}

◆ operator=()

VP1Gui & VP1Gui::operator= ( const VP1Gui & )
private

◆ userRequestedFiles()

std::vector< std::string > VP1Gui::userRequestedFiles ( )

Definition at line 237 of file VP1Gui.cxx.

238{
239 std::vector<std::string> retvector;
240 if(m_d->the_scheduler) {
241 const QStringList& inplist = m_d->the_scheduler->userRequestedFiles();
242 for(int i=0; i<inplist.size(); ++i)
243 retvector.push_back(inplist.at(i).toStdString());
244 }
245 return retvector;
246}

Member Data Documentation

◆ m_d

Imp* VP1Gui::m_d
private

Definition at line 72 of file VP1Gui.h.


The documentation for this class was generated from the following files: