GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TGRSIProof.h
Go to the documentation of this file.
1// Author: Ryan Dunlop 10/16
2
3#ifndef TGRSIPROOF_H
4#define TGRSIPROOF_H
5
6/** \addtogroup Sorting
7 * @{
8 */
9
10#include "Globals.h"
11#include "TGRSIOptions.h"
12#include "TParserLibrary.h"
13
14#include <iostream>
15#include <ctime>
16
17#include "Rtypes.h"
18#include "TProof.h"
19#include "TString.h"
20
21#include <unistd.h>
22const char* const nulFileName = "/dev/null";
23
24/////////////////////////////////////////////////////////////////
25///
26/// \class TGRSIProof
27///
28/// This class allows proof to work with GRSI
29/// \deprecated
30/// Since PROOF is deprecated it is recommended to use TGRSIFrame
31/// instead.
32///
33/////////////////////////////////////////////////////////////////
34
35class TGRSIProof : public TProof {
36public:
37 TGRSIProof() = default;
38 TGRSIProof(const TGRSIProof&) = delete;
39 TGRSIProof(TGRSIProof&&) noexcept = delete;
40 TGRSIProof& operator=(const TGRSIProof&) = delete;
41 TGRSIProof& operator=(TGRSIProof&&) noexcept = delete;
42 ~TGRSIProof() = default;
43
44 static TGRSIProof* Open(const char* worker = "")
45 {
46 auto* proof = static_cast<TGRSIProof*>(TProof::Open(worker));
47 if(proof != nullptr) { proof->LoadLibsIntoProof(); }
48 return proof;
49 }
50
52 {
53 // This function Loops through all libraries in GRSISort, and brute-force loads them into proof
54 // This is done because order of loading matters. We suppress the cout output because proof->Exec
55 // barfs all of the output. To me there is no obvious way to load every library on each of the PROOF slaves
56
57 const char* pPath = getenv("GRSISYS");
58
59 // First set the include path on each slave
60 Exec(Form(R"(gInterpreter->AddIncludePath("%s/include"))", pPath));
61 // if we have a data parser/detector library load it
62 std::string library = TGRSIOptions::Get()->ParserLibrary();
63 if(library.empty()) {
64 std::cout << DYELLOW << "Not loading any parser library, this might not work!" << RESET_COLOR << std::endl;
65 std::cout << "Loading library '" << pPath << "/lib/libGRSI.so'" << std::endl;
66 Exec(Form(R"(gSystem->Load("%s/lib/libGRSI.so");)", pPath));
67 } else {
68 std::cout << "Loading parser library '" << library << "'" << std::endl;
69 Exec(Form(R"(gSystem->Load("%s");)", library.c_str()));
71 }
72 }
73
74 /// \cond CLASSIMP
75 ClassDefOverride(TGRSIProof, 1) // NOLINT(readability-else-after-return)
76 /// \endcond
77};
78/*! @} */
79#endif // TGRSIProof_H
#define DYELLOW
Definition Globals.h:16
#define RESET_COLOR
Definition Globals.h:5
static TGRSIOptions * Get(int argc=0, char **argv=nullptr)
Do not use!
void ParserLibrary(std::string &library)
TGRSIProof()=default
void LoadLibsIntoProof()
Definition TGRSIProof.h:51
TGRSIProof(TGRSIProof &&) noexcept=delete
TGRSIProof(const TGRSIProof &)=delete
static TGRSIProof * Open(const char *worker="")
Definition TGRSIProof.h:44
void Load(bool quiet=false)
if necessary loads shared object library and sets/initializes all other functions
static TParserLibrary * Get(bool verbose=false)
Definition TSingleton.h:33
const char *const nulFileName
Definition TGRSIProof.h:22