44 TFile file(fileName.c_str(),
"update");
48 std::cout << R
"(Failed to open file ")" << fileName << R"(" in update mode!)" << std::endl;
57 TDirectory* oldDir = gDirectory;
61 file = gDirectory->GetFile();
65 std::cout <<
"Error, no file provided and no file open (gDirectory = " << gDirectory->GetName() <<
")!" << std::endl;
70 std::string oldoption = std::string(file->GetOption());
71 if(oldoption ==
"READ") {
72 file->ReOpen(
"UPDATE");
77 std::cout <<
"No file opened to write TAnalysisOptions to." << std::endl;
81 std::cout <<
"Writing TAnalysisOptions to " << gDirectory->GetFile()->GetName() << std::endl;
82 Write(
"AnalysisOptions", TObject::kOverwrite);
85 if(oldoption ==
"READ") {
86 std::cout <<
" Returning " << gDirectory->GetFile()->GetName() <<
" to \"" << oldoption.c_str() <<
"\" mode." << std::endl;
98 TFile file(fileName.c_str(),
"read");
102 std::cout << R
"(Failed to open file ")" << fileName << R"(" in read mode!)" << std::endl;
107 TDirectory* oldDir = gDirectory;
108 if(file !=
nullptr && file->IsOpen()) {
109 TList* list = file->GetListOfKeys();
111 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
112 if((key ==
nullptr) || (strcmp(key->GetClassName(),
"TAnalysisOptions") != 0)) {
120 std::cout << R
"(Failed to find analysis options in file ")" << CYAN << file->GetName() << RESET_COLOR << R"(":)" << std::endl;
122 std::cout << R
"(File ")" << file << R"(" is null or not open)" << std::endl;
132 if(opt1.Contains(
"Q")) {
136 std::cout <<
"Please call TDetector::ResetFlags() on current event to avoid bugs" << std::endl;
void Write(const std::shared_ptr< TMidasEvent > &evt, TMidasFile *outfile)
bool fIsCorrectingCrossTalk
True if we are correcting for cross-talk in GRIFFIN at analysis-level.
void SetCorrectCrossTalk(const bool &flag, Option_t *opt="")
bool WriteToFile(const std::string &file)
double fSuppressionEnergy
Minimum energy used to suppress Ge-Events. (default = 0 keV)
int64_t fBuildWindow
if building with a window(GRIFFIN) this is the size of the window. (default = 2us (2000))
void Print(Option_t *opt="") const override
double fSuppressionWindow
Time used to suppress Ge-Events. (default = 300 ns (300))
void Clear(Option_t *opt="") override
bool fBuildEventsByTimeStamp
use time stamps instead of time (including CFD) to build events
double fAddbackWindow
Time used to build Addback-Ge-Events for TIGRESS/GRIFFIN. (default = 300 ns (300))
bool fWaveformFitting
If true, waveform fitting with SFU algorithm will be performed.
void ReadFromFile(const std::string &file)
bool fStaticWindow
Flag to use static window (default moving)