GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TGRSIOptions.h
Go to the documentation of this file.
1#ifndef TGRSIOPTIONS_H
2#define TGRSIOPTIONS_H
3
4/** \addtogroup Sorting
5 * @{
6 */
7
8#include <map>
9
10#include "TObject.h"
11#include "TFile.h"
12
13#include "TGRSITypes.h"
14#include "TAnalysisOptions.h"
15#include "TUserSettings.h"
16
17/////////////////////////////////////////////////////////////////
18///
19/// \class TGRSIOptions
20///
21/// This class stores the command line arguments that are passed to GRSISort.
22/// This includes file names (root, mid, cal, etc.) as well as command line
23/// arguments. This is a singleton class that can be accessed with
24/// TGRSIOptions::Get() in order to determine any options that have been passed
25/// on the command line.
26///
27/////////////////////////////////////////////////////////////////
28
29class TGRSIOptions : public TObject {
30public:
31 TGRSIOptions() = default; /// Do not use!
32 static TGRSIOptions* Get(int argc = 0, char** argv = nullptr);
33
34 void Clear(Option_t* opt = "") override;
35 void Load(int argc, char** argv);
36 void Print(Option_t* opt = "") const override;
37
38 static bool WriteToFile(TFile* file = nullptr);
39 static void SetOptions(TGRSIOptions* tmp);
40 static Bool_t ReadFromFile(TFile* file = nullptr);
41
42 bool ShouldExit() const { return fShouldExit; }
43 const std::vector<std::string>& InputFiles() const { return fInputFiles; }
44 const std::vector<std::string>& RootInputFiles() const { return fInputRootFiles; }
45 const std::vector<std::string>& CalInputFiles() const { return fInputCalFiles; }
46 const std::vector<std::string>& ValInputFiles() const { return fInputValFiles; }
47 const std::vector<std::string>& InputOdbFiles() const { return fInputOdbFiles; }
48 const std::vector<std::string>& ExternalRunInfo() const { return fExternalRunInfo; }
49 const std::vector<std::string>& InputCutFiles() const { return fInputCutFiles; }
50 const std::vector<std::string>& WinInputFiles() const { return fInputWinFiles; }
51 const std::vector<std::string>& MacroInputFiles() const { return fMacroFiles; }
52 const std::string& DataFrameLibrary() const { return fDataFrameLibrary; }
53
54 const std::string& OutputFragmentFile() const { return fOutputFragmentFile; }
55 const std::string& OutputAnalysisFile() const { return fOutputAnalysisFile; }
56
57 const std::string& OutputFilteredFile() const { return fOutputFilteredFile; }
58 const std::string& OutputFragmentHistogramFile() const { return fOutputFragmentHistogramFile; }
59 const std::string& OutputAnalysisHistogramFile() const { return fOutputAnalysisHistogramFile; }
60 std::string InputRing() const { return fInputRing; }
61 std::string FragmentHistogramLib() const { return fFragmentHistogramLib; }
62 std::string AnalysisHistogramLib() const { return fAnalysisHistogramLib; }
63 std::string CompiledFilterFile() const { return fCompiledFilterFile; }
64
65 const std::vector<std::string>& OptionFiles() const { return fOptionsFile; }
66
67 std::string LogFile() const { return fLogFile; }
68 void LogFile(const std::string& val) { fLogFile = val; }
69
72
73 bool SeparateOutOfOrder() const { return fSeparateOutOfOrder; }
74 bool StartGui() const { return fStartGui; }
75
76 bool SuppressErrors() const { return fSuppressErrors; }
78
79 bool CloseAfterSort() const { return fCloseAfterSort; }
80
81 bool LogErrors() const { return fLogErrors; }
82 bool UseMidFileOdb() const { return fUseMidFileOdb; }
83
84 bool MakeAnalysisTree() const { return fMakeAnalysisTree; }
85 bool UseRnTuple() const { return fUseRnTuple; }
86 bool ReadingMaterial() const { return fReadingMaterial; }
87 bool IgnoreFileOdb() const { return fIgnoreFileOdb; }
88 bool IgnoreOdbChannels() const { return fIgnoreOdbChannels; }
89 int Downscaling() const { return fDownscaling; }
90
91 bool IgnoreScaler() const { return fIgnoreScaler; }
92 bool IgnoreEpics() const { return fIgnoreEpics; }
93 bool WriteFragmentTree() const { return fWriteFragmentTree; }
94 bool WriteBadFrags() const { return fWriteBadFrags; }
95 bool WriteDiagnostics() const { return fWriteDiagnostics; }
96 int WordOffset() const { return fWordOffset; }
97
98 bool Batch() const { return fBatch; }
99
100 bool ShowedVersion() const { return fShowedVersion; }
101 bool ShowLogo() const { return fShowLogo; }
102 bool SortRaw() const { return fSortRaw; }
103 bool ExtractWaves() const { return fExtractWaves; }
104 bool MakeHistos() const { return fMakeHistos; }
105 bool SortMultiple() const { return fSortMultiple; }
106
107 bool Debug() const { return fDebug; } // also used by GRSIFrame
108
109 bool IsOnline() const { return fIsOnline; }
110
113
114 size_t NumberOfEvents() const { return fNumberOfEvents; }
115
117 bool SkipInputSort() const { return fSkipInputSort; }
118 int SortDepth() const { return fSortDepth; }
119
120 bool ShouldExitImmediately() const { return fShouldExit; }
121
122 static kFileType DetermineFileType(const std::string& filename);
123
124 size_t ColumnWidth() const { return fColumnWidth; }
125 size_t StatusWidth() const { return fStatusWidth; }
126 unsigned int StatusInterval() const { return fStatusInterval; }
128
129 // GRSIProof and GRSIFrame only
130 int GetMaxWorkers() const { return fMaxWorkers; }
131 std::string TreeName() const { return fTreeName; }
132 // Proof only
133 bool SelectorOnly() const { return fSelectorOnly; }
135 bool ParallelUnzip() const { return fParallelUnzip; }
136 int CacheSize() const { return fCacheSize; }
137 int Submergers() const { return fSubmergers; }
138 bool ProofStats() const { return fProofStats; }
139
140 void SuppressErrors(bool suppress) { fSuppressErrors = suppress; }
141
142 // shared object libraries
143 void ParserLibrary(std::string& library) { fParserLibrary = library; }
144 const std::string& ParserLibrary() const { return fParserLibrary; }
145
146private:
147 TGRSIOptions(int argc, char** argv);
149
150 bool FileAutoDetect(const std::string& filename);
151
152 std::vector<std::string> fInputFiles; ///< A list of the input files
153 std::vector<std::string> fInputRootFiles; ///< A list of the input root files
154 std::vector<std::string> fInputCalFiles; ///< A list of the input cal files
155 std::vector<std::string> fInputOdbFiles; ///< A list of the input odb files
156 std::vector<std::string> fExternalRunInfo; ///< A list of the input run info files
157 std::vector<std::string> fMacroFiles; ///< A list of the input macro (.C) files
158 std::string fDataFrameLibrary; ///< library (or .cxx file) for dataframe processing (used with grsiframe)
159
160 std::vector<std::string> fInputCutFiles; ///< A list of input cut files
161 std::vector<std::string> fInputValFiles; ///< A list of the input GValue files
162 std::vector<std::string> fInputWinFiles; ///< A list of the input window files
163 std::string fInputRing; ///< The name of hte input ring
164
165 std::string fOutputFragmentFile; ///< The name of the fragment file to write to
166 std::string fOutputAnalysisFile; ///< The name of the analysis file to write to
168 std::string fOutputFragmentHistogramFile; ///< The name of the fragment histogram file
169 std::string fOutputAnalysisHistogramFile; ///< The name of the analysis histogram file
170
171 std::string fFragmentHistogramLib; ///< The name of the script for histogramming fragments
172 std::string fAnalysisHistogramLib; ///< The name of the script for histogramming events
174
175 std::vector<std::string> fOptionsFile; ///< A list of the input .info files
176
177 std::string fLogFile; ///< The name of the output log file
178
179 bool fCloseAfterSort{false}; ///< Flag to close after sorting (-q)
180 bool fLogErrors{false}; ///< Flag to log errors (--log-errors)
181 bool fUseMidFileOdb{false}; ///< Flag to read odb from midas
182 bool fSuppressErrors{false}; ///< Flag to suppress errors (--suppress-errors)
183 bool fReconstructTimeStamp{false}; ///< Flag to reconstruct missing high bits of time stamps (--reconstruct-timestamp)
184
185 bool fMakeAnalysisTree; ///< Flag to make analysis tree (-a)
186 bool fUseRnTuple; ///< Flag to use experimental TRNTuple instead of TTree
187 bool fReadingMaterial; ///< Flag to show reading material (--reading-material)
188 bool fIgnoreFileOdb; ///< Flag to ignore midas file odb
189 bool fIgnoreOdbChannels; ///< Flag to ignore channels from midas file odb (but do use EPICS from ODB)
190 int fDownscaling; ///< Downscaling factor for raw events to be processed
191
192 bool fIgnoreScaler{false}; ///< Flag to ignore scalers in GRIFFIN
193 bool fIgnoreEpics{false}; ///< Flag to ignore epics
194 bool fWriteFragmentTree{false}; ///< Flag to write fragment tree
195 bool fWriteBadFrags{false}; ///< Flag to write bad fragments
196 bool fWriteDiagnostics{false}; ///< Flag to write diagnostics
197 int fWordOffset{-1}; ///< Offset for word count in GRIFFIN header (default 1)
198
199 bool fBatch{false}; ///< Flag to use batch mode (-b)
200
201 bool fShowedVersion{false}; ///< Flag to show version
202 bool fShowLogo{false}; ///< Flag to show logo (suppress with -l)
203 bool fSortRaw{true}; ///< Flag to sort raw file
204 bool fExtractWaves{false}; ///< Flag to keep waveforms (suppress with --no-waveforms)
205 bool fIsOnline{false}; ///< Flag to sort online data
206 bool fStartGui{false}; ///< Flag to start GUI (-g)
207 bool fMakeHistos{false}; ///< Flag to make histograms (-H)
208 bool fSortMultiple{false}; ///< Flag to sort multiple files
209 bool fDebug{false}; ///< Flag for debug mode
210
211 size_t fFragmentWriteQueueSize{100000}; ///< Size of the Fragment write Q
212 size_t fAnalysisWriteQueueSize{100000}; ///< Size of the analysis write Q
213
214 size_t fNumberOfEvents{0}; ///< Number of events, fragments, etc. to process (0 - all)
215
216 bool fIgnoreMissingChannel{false}; ///< Flag to completely ignore missing channels
217 bool fSkipInputSort{false}; ///< Flag to sort on time or triggers
218 int fSortDepth{200000}; ///< Size of Q that stores fragments to be built into events
219
220 static TAnalysisOptions* fAnalysisOptions; ///< contains all options for analysis
221 static TUserSettings* fUserSettings; ///< contains user settings read from text-file
222
223 bool fSeparateOutOfOrder{false}; ///< Flag to build out of order into seperate event tree
224
225 bool fShouldExit{false}; ///< Flag to exit sorting
226
227 bool fHelp{false}; ///< help requested?
228
229 size_t fColumnWidth{20}; ///< Size of verbose columns
230 size_t fStatusWidth{120}; ///< Size of total verbose status
231 unsigned int fStatusInterval{10}; ///< Time between status updates
233
234 // Proof only
235 int fMaxWorkers{-1}; ///< Max workers used in grsiproof
236 bool fSelectorOnly{false}; ///< Flag to turn PROOF off in grsiproof
237 std::string fTreeName; ///< Name of tree to be analyzed (default is empty, i.e. FragmentTree, AnalysisTree, and Lst2RootTree are checked)
238 bool fAverageRateEstimation{false}; ///< enable average rate estimation
239 bool fParallelUnzip{false}; ///< enable use of parallel unzipping
240 int fCacheSize{-1}; ///< set tree cache size, default is -1 (off)
241 int fSubmergers{-1}; ///< set number of sub-mergers (0 = automatic), default is -1 (off)
242 bool fProofStats{false}; ///< enable proof stats
243
244 // shared object libraries
245 std::string fParserLibrary; ///< location of shared object library for data parser and files
246
247 /// \cond CLASSIMP
248 ClassDefOverride(TGRSIOptions, 5) // NOLINT(readability-else-after-return)
249 /// \endcond
250};
251/*! @} */
252#endif /* _TGRSIOPTIONS_H_ */
kFileType
Definition TGRSITypes.h:9
bool fIgnoreScaler
Flag to ignore scalers in GRIFFIN.
const std::vector< std::string > & RootInputFiles() const
bool MakeAnalysisTree() const
bool IsOnline() const
std::string fTreeName
Name of tree to be analyzed (default is empty, i.e. FragmentTree, AnalysisTree, and Lst2RootTree are ...
bool fWriteDiagnostics
Flag to write diagnostics.
void Load(int argc, char **argv)
bool fReadingMaterial
Flag to show reading material (–reading-material)
bool AverageRateEstimation() const
bool SortRaw() const
bool fShouldExit
Flag to exit sorting.
int Submergers() const
std::vector< std::string > fInputFiles
A list of the input files.
bool fWriteBadFrags
Flag to write bad fragments.
bool SelectorOnly() const
std::vector< std::string > fInputValFiles
A list of the input GValue files.
bool ShouldExitImmediately() const
bool fSeparateOutOfOrder
Flag to build out of order into seperate event tree.
static kFileType DetermineFileType(const std::string &filename)
bool fCloseAfterSort
Flag to close after sorting (-q)
bool WriteDiagnostics() const
static TGRSIOptions * Get(int argc=0, char **argv=nullptr)
Do not use!
const std::string & ParserLibrary() const
bool WriteFragmentTree() const
bool fIgnoreFileOdb
Flag to ignore midas file odb.
std::vector< std::string > fInputCutFiles
A list of input cut files.
std::string fInputRing
The name of hte input ring.
bool fSortRaw
Flag to sort raw file.
bool fProofStats
enable proof stats
bool ReconstructTimeStamp() const
static TAnalysisOptions * fAnalysisOptions
contains all options for analysis
unsigned int fStatusInterval
Time between status updates.
size_t fAnalysisWriteQueueSize
Size of the analysis write Q.
unsigned int StatusInterval() const
bool fMakeAnalysisTree
Flag to make analysis tree (-a)
size_t fStatusWidth
Size of total verbose status.
bool fSelectorOnly
Flag to turn PROOF off in grsiproof.
std::vector< std::string > fInputCalFiles
A list of the input cal files.
std::string fOutputFragmentFile
The name of the fragment file to write to.
const std::vector< std::string > & InputFiles() const
std::string fAnalysisHistogramLib
The name of the script for histogramming events.
int fWordOffset
Offset for word count in GRIFFIN header (default 1)
size_t NumberOfEvents() const
static TGRSIOptions * fGRSIOptions
int fCacheSize
set tree cache size, default is -1 (off)
std::string fFragmentHistogramLib
The name of the script for histogramming fragments.
int fMaxWorkers
Max workers used in grsiproof.
static TUserSettings * UserSettings()
std::string CompiledFilterFile() const
int fDownscaling
Downscaling factor for raw events to be processed.
const std::string & OutputFragmentHistogramFile() const
bool fExtractWaves
Flag to keep waveforms (suppress with –no-waveforms)
bool fIgnoreMissingChannel
Flag to completely ignore missing channels.
size_t FragmentWriteQueueSize() const
std::vector< std::string > fOptionsFile
A list of the input .info files.
std::string LogFile() const
bool SeparateOutOfOrder() const
std::string fOutputFilteredFile
const std::vector< std::string > & ExternalRunInfo() const
bool fLogErrors
Flag to log errors (–log-errors)
bool fSuppressErrors
Flag to suppress errors (–suppress-errors)
bool fSkipInputSort
Flag to sort on time or triggers.
int fSubmergers
set number of sub-mergers (0 = automatic), default is -1 (off)
bool fStartGui
Flag to start GUI (-g)
bool IgnoreMissingChannel() const
bool ShowedVersion() const
const std::string & DataFrameLibrary() const
bool IgnoreEpics() const
void LogFile(const std::string &val)
std::string fDataFrameLibrary
library (or .cxx file) for dataframe processing (used with grsiframe)
static void SetOptions(TGRSIOptions *tmp)
bool ProofStats() const
std::string AnalysisHistogramLib() const
TGRSIOptions()=default
const std::string & OutputAnalysisHistogramFile() const
const std::vector< std::string > & InputCutFiles() const
bool ExtractWaves() const
int fSortDepth
Size of Q that stores fragments to be built into events.
static TAnalysisOptions * AnalysisOptions()
static bool WriteToFile(TFile *file=nullptr)
bool LongFileDescription() const
bool fReconstructTimeStamp
Flag to reconstruct missing high bits of time stamps (–reconstruct-timestamp)
const std::string & OutputFilteredFile() const
std::string TreeName() const
const std::vector< std::string > & ValInputFiles() const
int WordOffset() const
bool StartGui() const
std::string fOutputAnalysisFile
The name of the analysis file to write to.
int SortDepth() const
void Clear(Option_t *opt="") override
bool fHelp
help requested?
bool Batch() const
int CacheSize() const
static Bool_t ReadFromFile(TFile *file=nullptr)
std::string fOutputAnalysisHistogramFile
The name of the analysis histogram file.
size_t fNumberOfEvents
Number of events, fragments, etc. to process (0 - all)
bool fIgnoreEpics
Flag to ignore epics.
std::string fLogFile
The name of the output log file.
bool fBatch
Flag to use batch mode (-b)
bool IgnoreFileOdb() const
bool CloseAfterSort() const
size_t fColumnWidth
Size of verbose columns.
bool fIsOnline
Flag to sort online data.
std::vector< std::string > fInputWinFiles
A list of the input window files.
bool fSortMultiple
Flag to sort multiple files.
bool ParallelUnzip() const
bool MakeHistos() const
bool fIgnoreOdbChannels
Flag to ignore channels from midas file odb (but do use EPICS from ODB)
std::string fCompiledFilterFile
const std::vector< std::string > & InputOdbFiles() const
bool UseRnTuple() const
size_t fFragmentWriteQueueSize
Size of the Fragment write Q.
bool fMakeHistos
Flag to make histograms (-H)
bool ShouldExit() const
bool SuppressErrors() const
void Print(Option_t *opt="") const override
bool IgnoreOdbChannels() const
bool fDebug
Flag for debug mode.
bool fParallelUnzip
enable use of parallel unzipping
const std::vector< std::string > & CalInputFiles() const
bool fShowedVersion
Flag to show version.
bool ReadingMaterial() const
bool fAverageRateEstimation
enable average rate estimation
bool Debug() const
bool WriteBadFrags() const
std::string fParserLibrary
location of shared object library for data parser and files
void ParserLibrary(std::string &library)
bool fUseRnTuple
Flag to use experimental TRNTuple instead of TTree.
bool UseMidFileOdb() const
const std::vector< std::string > & MacroInputFiles() const
std::vector< std::string > fInputRootFiles
A list of the input root files.
int Downscaling() const
bool SortMultiple() const
size_t ColumnWidth() const
bool fShowLogo
Flag to show logo (suppress with -l)
bool SkipInputSort() const
bool LogErrors() const
bool fLongFileDescription
bool ShowLogo() const
std::string InputRing() const
bool fWriteFragmentTree
Flag to write fragment tree.
std::vector< std::string > fMacroFiles
A list of the input macro (.C) files.
bool FileAutoDetect(const std::string &filename)
bool fUseMidFileOdb
Flag to read odb from midas.
std::string FragmentHistogramLib() const
static TUserSettings * fUserSettings
contains user settings read from text-file
size_t AnalysisWriteQueueSize() const
bool IgnoreScaler() const
int GetMaxWorkers() const
const std::vector< std::string > & WinInputFiles() const
std::vector< std::string > fExternalRunInfo
A list of the input run info files.
std::vector< std::string > fInputOdbFiles
A list of the input odb files.
void SuppressErrors(bool suppress)
size_t StatusWidth() const
const std::string & OutputFragmentFile() const
std::string fOutputFragmentHistogramFile
The name of the fragment histogram file.
const std::vector< std::string > & OptionFiles() const
const std::string & OutputAnalysisFile() const