JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwRunCondition Class Reference

Run condition and quality management. More...

#include <QwRunCondition.h>

Public Member Functions

 QwRunCondition ()
 
 QwRunCondition (Int_t argc, Char_t *argv[], TString name)
 
virtual ~QwRunCondition ()
 
TList * Get ()
 
TString GetName ()
 
void SetROCFlagsFileName (const TString in)
 

Private Member Functions

void SetArgs (Int_t argc, Char_t *argv[])
 
void SetName (const TString name)
 
void Add (TString in)
 
TString GetROCFlags ()
 
 QwRunCondition (const QwRunCondition &rhs)
 
QwRunConditionoperator= (const QwRunCondition &rhs)
 
QwRunConditionoperator& ()
 
const QwRunConditionoperator& () const
 

Private Attributes

TList * fRunConditionList
 
TString fROCFlagFileName
 

Static Private Attributes

static const Int_t fCharLength = 127
 

Detailed Description

Run condition and quality management.

Manages run-level conditions including run quality flags, beam conditions, and other run-specific parameters used for data quality assessment and analysis filtering.

Definition at line 29 of file QwRunCondition.h.

Constructor & Destructor Documentation

◆ QwRunCondition() [1/3]

QwRunCondition::QwRunCondition ( )
inline

Definition at line 33 of file QwRunCondition.h.

33{fRunConditionList=NULL;};
TList * fRunConditionList

References fRunConditionList.

Referenced by operator&(), operator&(), operator=(), and QwRunCondition().

+ Here is the caller graph for this function:

◆ QwRunCondition() [2/3]

QwRunCondition::QwRunCondition ( Int_t argc,
Char_t * argv[],
TString name )

Definition at line 16 of file QwRunCondition.cc.

17{
18
19 fROCFlagFileName = "qwvmets.flags";
20
21 fRunConditionList = new TList;
22 fRunConditionList -> SetOwner(true);
23 this->SetArgs(argc, argv);
24 this->SetName(name);
25
26}
void SetArgs(Int_t argc, Char_t *argv[])
void SetName(const TString name)
TString fROCFlagFileName

References fROCFlagFileName, fRunConditionList, SetArgs(), and SetName().

+ Here is the call graph for this function:

◆ ~QwRunCondition()

QwRunCondition::~QwRunCondition ( )
virtual

Definition at line 29 of file QwRunCondition.cc.

30{
32}

References fRunConditionList.

◆ QwRunCondition() [3/3]

QwRunCondition::QwRunCondition ( const QwRunCondition & rhs)
private

References QwRunCondition().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add()

void QwRunCondition::Add ( TString in)
private

Definition at line 117 of file QwRunCondition.cc.

118{
119 fRunConditionList -> AddLast(new TObjString(in));
120 return;
121}

References fRunConditionList.

Referenced by SetArgs().

+ Here is the caller graph for this function:

◆ Get()

TList * QwRunCondition::Get ( )

Definition at line 125 of file QwRunCondition.cc.

126{
127 return fRunConditionList;
128}

References fRunConditionList.

Referenced by QwRootFile::QwRootFile().

+ Here is the caller graph for this function:

◆ GetName()

TString QwRunCondition::GetName ( )

Definition at line 133 of file QwRunCondition.cc.

134{
135 TString name = fRunConditionList->GetName();
136 return name;
137}

References fRunConditionList.

Referenced by QwRootFile::QwRootFile().

+ Here is the caller graph for this function:

◆ GetROCFlags()

TString QwRunCondition::GetROCFlags ( )
private

Definition at line 150 of file QwRunCondition.cc.

151{
152
153 Bool_t local_debug = false;
154 TString flags;
155
156 std::ifstream flag_file;
157 flag_file.clear();
158
159 fROCFlagFileName.Insert(0, "/home/cdaq/qweak/Settings/");
160
161 flag_file.open(fROCFlagFileName);
162
163 if(not flag_file.is_open()) {
164 std::cout << "There is no flag file, which you try to access "
166 << std::endl;
167 flags = fROCFlagFileName;
168 flags += " is not found";
169
170 }
171 else {
172 while (not flag_file.eof() )
173 {
174 TString line;
175 line.ReadLine(flag_file);
176 if(not line.IsNull()) {
177 if(local_debug) {
178 std::cout << line << std::endl;
179 }
180 if(not line.Contains(";")) {
181 flags = line;
182 }
183 } // if(not line.IsNull()) {
184 } // while (not flag_file.eof() ) {
185 }
186 flag_file.close();
187
188 return flags;
189
190}

References fROCFlagFileName.

Referenced by SetArgs().

+ Here is the caller graph for this function:

◆ operator&() [1/2]

QwRunCondition * QwRunCondition::operator& ( )
private

References QwRunCondition().

+ Here is the call graph for this function:

◆ operator&() [2/2]

const QwRunCondition * QwRunCondition::operator& ( ) const
private

References QwRunCondition().

+ Here is the call graph for this function:

◆ operator=()

QwRunCondition & QwRunCondition::operator= ( const QwRunCondition & rhs)
private

References QwRunCondition().

+ Here is the call graph for this function:

◆ SetArgs()

void QwRunCondition::SetArgs ( Int_t argc,
Char_t * argv[] )
private

Definition at line 36 of file QwRunCondition.cc.

37{
38
39 // get ROOT release version, date, svn revision and branch
40 // TROOT.h (ROOT)
41 TString root_version = gROOT->GetVersion();
42 root_version += ", Date : ";
43 root_version += gROOT->GetVersionDate();
44#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
45 root_version += ", SVN : ";
46 root_version += gROOT->GetSvnRevision();
47 root_version += " ";
48 root_version += gROOT->GetSvnBranch();
49#else // ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
50 root_version += ", GIT : ";
51 root_version += gROOT->GetGitCommit();
52 root_version += " ";
53 root_version += gROOT->GetGitBranch();
54#endif
55
56 // get hostname and user name
57 char host_string[fCharLength];
58 char user_string[fCharLength];
59
60 gethostname(host_string, fCharLength);
61 if (getlogin_r(user_string, fCharLength) != 0) {
62 snprintf(user_string, fCharLength, "unknown");
63 }
64
65 TString host_name = host_string;
66 TString user_name = user_string;
67
68 // get program name and its arguments (options)
69 TString QwVersion = Form("%d.%d.%d",QWANALYSIS_VERSION_MAJOR, QWANALYSIS_VERSION_MINOR, QWANALYSIS_VERSION_PATCH);
70 TString program_name = argv[0];
71 TString argv_list;
72 for (Int_t i=1; i<argc; i++) argv_list += argv[i];
73
74 // get current time when a ROOT file is created
75 TTimeStamp time_stamp;
76 TString current_time = time_stamp.AsString("l"); // local time
77
78 // get current ROC flags
79 TString roc_flags;
80 // if one of the cdaq cluster AND the user must be a "cdaq",
81 if( (host_name.Contains("cdaql")) and (not user_name.CompareTo("cdaq", TString::kExact)) ) {
82 roc_flags = this->GetROCFlags();
83 }
84 else {
85 roc_flags = "Invalid, because the system is not cdaqlx and the user is not cdaq.";
86 }
87
88 // insert some comments at the beginning of strings...
89 root_version.Insert (0, "ROOT Version : ");
90 current_time.Insert (0, "ROOT file creating time : ");
91 host_name.Insert (0, "ROOT file created on Hostname : ");
92 user_name.Insert (0, "ROOT file created by the user : ");
93
94 program_name.Insert (0, "QwAnalyzer Name : ");
95 QwVersion.Insert (0, "Version : ");
96 argv_list.Insert (0, "QwAnalyzer Options : ");
97
98 roc_flags.Insert (0, "DAQ ROC flags when QwAnalyzer runs : ");
99
100 // add them into list to be returned to main program.
101
102 this -> Add(root_version);
103 this -> Add(program_name);
104 this -> Add(QwVersion);
105 this -> Add(host_name);
106 this -> Add(user_name);
107 this -> Add(argv_list);
108 this -> Add(current_time);
109 this -> Add(gGitInfo);
110 this -> Add(roc_flags);
111
112 return;
113}
const char *const gGitInfo
TString GetROCFlags()
void Add(TString in)
static const Int_t fCharLength

References Add(), fCharLength, GetROCFlags(), and gGitInfo.

Referenced by QwRunCondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetName()

void QwRunCondition::SetName ( const TString name)
private

Definition at line 141 of file QwRunCondition.cc.

142{
143 fRunConditionList->SetName(name);
144 return;
145}

References fRunConditionList.

Referenced by QwRunCondition().

+ Here is the caller graph for this function:

◆ SetROCFlagsFileName()

void QwRunCondition::SetROCFlagsFileName ( const TString in)
inline

Definition at line 40 of file QwRunCondition.h.

40{fROCFlagFileName = in;};

References fROCFlagFileName.

Field Documentation

◆ fCharLength

const Int_t QwRunCondition::fCharLength = 127
staticprivate

Definition at line 55 of file QwRunCondition.h.

Referenced by SetArgs().

◆ fROCFlagFileName

TString QwRunCondition::fROCFlagFileName
private

Definition at line 54 of file QwRunCondition.h.

Referenced by GetROCFlags(), QwRunCondition(), and SetROCFlagsFileName().

◆ fRunConditionList

TList* QwRunCondition::fRunConditionList
private

The documentation for this class was generated from the following files: