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 <sstream>
16#include <vector>
17#include <ctime>
18#include <fstream>
19#include <streambuf>
20
21#include "Rtypes.h"
22#include "TProof.h"
23#include "TSystemFile.h"
24#include "TSystemDirectory.h"
25#include "TString.h"
26#include "TList.h"
27#include "TROOT.h"
28#include "TError.h"
29
30#include <unistd.h>
31const char* const nulFileName = "/dev/null";
32
33/////////////////////////////////////////////////////////////////
34///
35/// \class TGRSIProof
36///
37/// This class allows proof to work with GRSI
38/// \deprecated
39/// Since PROOF is deprecated it is recommended to use TGRSIFrame
40/// instead.
41///
42/////////////////////////////////////////////////////////////////
43
44class TGRSIProof : public TProof {
45public:
46 TGRSIProof() = default;
47 TGRSIProof(const TGRSIProof&) = delete;
48 TGRSIProof(TGRSIProof&&) noexcept = delete;
49 TGRSIProof& operator=(const TGRSIProof&) = delete;
50 TGRSIProof& operator=(TGRSIProof&&) noexcept = delete;
51 ~TGRSIProof() = default;
52
53 static TGRSIProof* Open(const char* worker = "")
54 {
55 auto* proof = static_cast<TGRSIProof*>(TProof::Open(worker));
56 if(proof != nullptr) { proof->LoadLibsIntoProof(); }
57 return proof;
58 }
59
61 {
62 // This function Loops through all libraries in GRSISort, and brute-force loads them into proof
63 // This is done because order of loading matters. We suppress the cout output because proof->Exec
64 // barfs all of the output. To me there is no obvious way to load every library on each of the PROOF slaves
65
66 const char* pPath = getenv("GRSISYS");
67
68 // First set the include path on each slave
69 Exec(Form(R"(gInterpreter->AddIncludePath("%s/include"))", pPath));
70 // if we have a data parser/detector library load it
71 std::string library = TGRSIOptions::Get()->ParserLibrary();
72 if(library.empty()) {
73 std::cout << DYELLOW << "Not loading any parser library, this might not work!" << RESET_COLOR << std::endl;
74 std::cout << "Loading library '" << pPath << "/lib/libGRSI.so'" << std::endl;
75 Exec(Form(R"(gSystem->Load("%s/lib/libGRSI.so");)", pPath));
76 } else {
77 std::cout << "Loading parser library '" << library << "'" << std::endl;
78 Exec(Form(R"(gSystem->Load("%s");)", library.c_str()));
80 }
81 }
82
83 /// \cond CLASSIMP
84 ClassDefOverride(TGRSIProof, 1) // NOLINT(readability-else-after-return)
85 /// \endcond
86};
87/*! @} */
88#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:60
TGRSIProof(TGRSIProof &&) noexcept=delete
TGRSIProof(const TGRSIProof &)=delete
static TGRSIProof * Open(const char *worker="")
Definition TGRSIProof.h:53
void Load()
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:31