ndmspc 0.20250128.0
Loading...
Searching...
No Matches
PointRun.h
1#ifndef NdmspcCorePointRun_H
2#define NdmspcCorePointRun_H
3
4#include <TObject.h>
5#include <TMacro.h>
6#include <TFile.h>
7#include <TList.h>
8#include <TH1S.h>
9#include <THnSparse.h>
10#include <nlohmann/json.hpp>
11#include "Core.h"
12using json = nlohmann::json;
13
14namespace Ndmspc {
15
22
23class PointRun : public TObject {
24 public:
25 PointRun(std::string macro = "NdmspcPointRun.C");
26 virtual ~PointRun();
27
28 bool Run(std::string filename, std::string userConfig = "", std::string environment = "",
29 std::string userConfigRaw = "", bool show = false, std::string outfilename = "");
30 json & Cfg() { return gCfg; }
31 json * CfgPtr() { return &gCfg; }
32 TFile * GetInputFile() const { return fInputFile; }
33 TList * GetInputList() const { return fInputList; }
34 THnSparse * GetResultObject() const { return fResultObject; }
35 Int_t * GetCurrentPoint() { return fCurrentPoint; }
36 std::vector<std::string> GetCurrentPointLabels() { return fCurrentPointLabels; }
37 json GetCurrentPointValue() { return fCurrentPointValue; }
38 TList * GetOutputList() const { return fOutputList; }
39 void SetOutputList(TList * outList) { fOutputList = outList; }
40 void SetSkipCurrentBin(bool scb = true) { fIsSkipBin = scb; }
41 void SetProcessExit(bool pe = true) { fIsProcessExit = pe; }
42 static void SetEnvironment(std::string env) { fgEnvironment = env; }
43
44 static bool Generate(std::string name = "myAnalysis", std::string inFile = "myFile.root",
45 std::string inObjectName = "myNDHistogram");
46 static bool Merge(std::string name = "myAnalysis.json", std::string userConfig = "", std::string environment = "",
47 std::string userConfigRaw = "", std::string fileOpt = "?remote=1");
48
49 private:
50 TMacro * fMacro{nullptr};
51 int fVerbose{0};
52 int fBinCount{0};
53 TFile * fInputFile{nullptr};
54 TList * fInputList{nullptr};
55 THnSparse * fResultObject{nullptr};
56 TFile * fCurrentOutputFile{nullptr};
57 std::string fCurrentOutputFileName{};
58 TDirectory * fCurrentOutputRootDirectory{nullptr};
59 Int_t fCurrentPoint[32];
60 std::vector<std::string> fCurrentPointLabels{};
61 json fCurrentPointValue{};
62 THnSparse * fCurrentProccessHistogram{nullptr};
63 TH1S * fMapAxesType{nullptr};
64 std::vector<TAxis *> fCurrentProcessHistogramAxes{};
65 std::vector<int> fCurrentProcessHistogramPoint{};
66 bool fIsSkipBin{false};
67 bool fIsProcessOk{false};
68 bool fIsProcessExit{false};
69 TList * fOutputList{nullptr};
70 static std::string fgEnvironment;
71
72 bool LoadConfig(std::string config, std::string userConfig = "", std::string environment = "",
73 std::string userConfigRaw = "", bool show = false, std::string outfilename = "");
74 bool Init(std::string extraPath = "");
75 bool Finish();
76 TList * OpenInputs();
77 THnSparse * CreateResult();
78 bool ApplyCuts();
79
80 int ProcessSingleFile();
81 bool ProcessSinglePoint();
82 bool ProcessRecursive(int i);
83 bool ProcessRecursiveInner(Int_t i, std::vector<std::string> & n);
84 void OutputFileOpen();
85 void OutputFileClose();
86 int ProcessHistogramRun();
87
89 ClassDef(PointRun, 1);
91};
92} // namespace Ndmspc
93#endif /* PointRun_H */
PointRun object.
Definition PointRun.h:23
TFile * fInputFile
Bin Count (TODO! rename to axis level maybe)
Definition PointRun.h:53
bool Init(std::string extraPath="")
Definition PointRun.cxx:73
int fBinCount
Verbose level.
Definition PointRun.h:52
THnSparse * CreateResult()
Definition PointRun.cxx:244
TList * OpenInputs()
Definition PointRun.cxx:154
PointRun(std::string macro="NdmspcPointRun.C")
Definition PointRun.cxx:24
virtual ~PointRun()
Definition PointRun.cxx:35
int fVerbose
Macro.
Definition PointRun.h:51
static bool Generate(std::string name="myAnalysis", std::string inFile="myFile.root", std::string inObjectName="myNDHistogram")
bool LoadConfig(std::string config, std::string userConfig="", std::string environment="", std::string userConfigRaw="", bool show=false, std::string outfilename="")
Environment.
Definition PointRun.cxx:42