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 115 of file QwRunCondition.cc.

116{
117 fRunConditionList -> AddLast(new TObjString(in));
118 return;
119}

References fRunConditionList.

Referenced by SetArgs().

+ Here is the caller graph for this function:

◆ Get()

TList * QwRunCondition::Get ( )

Definition at line 123 of file QwRunCondition.cc.

124{
125 return fRunConditionList;
126}

References fRunConditionList.

Referenced by QwRootFile::QwRootFile().

+ Here is the caller graph for this function:

◆ GetName()

TString QwRunCondition::GetName ( )

Definition at line 131 of file QwRunCondition.cc.

132{
133 TString name = fRunConditionList->GetName();
134 return name;
135}

References fRunConditionList.

Referenced by QwRootFile::QwRootFile().

+ Here is the caller graph for this function:

◆ GetROCFlags()

TString QwRunCondition::GetROCFlags ( )
private

Definition at line 148 of file QwRunCondition.cc.

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

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 getlogin_r (user_string, fCharLength);
62
63 TString host_name = host_string;
64 TString user_name = user_string;
65
66 // get program name and its arguments (options)
67 TString QwVersion = Form("%d.%d.%d",QWANALYSIS_VERSION_MAJOR, QWANALYSIS_VERSION_MINOR, QWANALYSIS_VERSION_PATCH);
68 TString program_name = argv[0];
69 TString argv_list;
70 for (Int_t i=1; i<argc; i++) argv_list += argv[i];
71
72 // get current time when a ROOT file is created
73 TTimeStamp time_stamp;
74 TString current_time = time_stamp.AsString("l"); // local time
75
76 // get current ROC flags
77 TString roc_flags;
78 // if one of the cdaq cluster AND the user must be a "cdaq",
79 if( (host_name.Contains("cdaql")) and (not user_name.CompareTo("cdaq", TString::kExact)) ) {
80 roc_flags = this->GetROCFlags();
81 }
82 else {
83 roc_flags = "Invalid, because the system is not cdaqlx and the user is not cdaq.";
84 }
85
86 // insert some comments at the beginning of strings...
87 root_version.Insert (0, "ROOT Version : ");
88 current_time.Insert (0, "ROOT file creating time : ");
89 host_name.Insert (0, "ROOT file created on Hostname : ");
90 user_name.Insert (0, "ROOT file created by the user : ");
91
92 program_name.Insert (0, "QwAnalyzer Name : ");
93 QwVersion.Insert (0, "Version : ");
94 argv_list.Insert (0, "QwAnalyzer Options : ");
95
96 roc_flags.Insert (0, "DAQ ROC flags when QwAnalyzer runs : ");
97
98 // add them into list to be returned to main program.
99
100 this -> Add(root_version);
101 this -> Add(program_name);
102 this -> Add(QwVersion);
103 this -> Add(host_name);
104 this -> Add(user_name);
105 this -> Add(argv_list);
106 this -> Add(current_time);
107 this -> Add(gGitInfo);
108 this -> Add(roc_flags);
109
110 return;
111}
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 139 of file QwRunCondition.cc.

140{
141 fRunConditionList->SetName(name);
142 return;
143}

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: