QwAnalysis
QwRunCondition Class Reference

#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

Definition at line 21 of file QwRunCondition.h.

Constructor & Destructor Documentation

QwRunCondition::QwRunCondition ( )
inline

Definition at line 25 of file QwRunCondition.h.

References fRunConditionList.

25 {fRunConditionList=NULL;};
TList * fRunConditionList
QwRunCondition::QwRunCondition ( Int_t  argc,
Char_t *  argv[],
TString  name 
)

Definition at line 13 of file QwRunCondition.cc.

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

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

+ Here is the call graph for this function:

QwRunCondition::~QwRunCondition ( )
virtual

Definition at line 26 of file QwRunCondition.cc.

References fRunConditionList.

27 {
29 }
TList * fRunConditionList
QwRunCondition::QwRunCondition ( const QwRunCondition rhs)
private

Member Function Documentation

void QwRunCondition::Add ( TString  in)
private

Definition at line 124 of file QwRunCondition.cc.

References fRunConditionList.

Referenced by SetArgs().

125 {
126  fRunConditionList -> AddLast(new TObjString(in));
127  return;
128 }
static const double in
Definition: QwUnits.h:66
TList * fRunConditionList

+ Here is the caller graph for this function:

TList * QwRunCondition::Get ( )

Definition at line 132 of file QwRunCondition.cc.

References fRunConditionList.

Referenced by QwParityDB::SetAnalysisID().

133 {
134  return fRunConditionList;
135 }
TList * fRunConditionList

+ Here is the caller graph for this function:

TString QwRunCondition::GetName ( )

Definition at line 140 of file QwRunCondition.cc.

References fRunConditionList.

141 {
142  TString name = fRunConditionList->GetName();
143  return name;
144 }
TList * fRunConditionList
TString QwRunCondition::GetROCFlags ( )
private

Definition at line 157 of file QwRunCondition.cc.

References fROCFlagFileName.

Referenced by SetArgs().

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

+ Here is the caller graph for this function:

QwRunCondition* QwRunCondition::operator& ( )
private
const QwRunCondition* QwRunCondition::operator& ( ) const
private
QwRunCondition& QwRunCondition::operator= ( const QwRunCondition rhs)
private
void QwRunCondition::SetArgs ( Int_t  argc,
Char_t *  argv[] 
)
private

Definition at line 33 of file QwRunCondition.cc.

References Add(), fCharLength, GetROCFlags(), QWANA_SVN_LASTCHANGEDREVISION, QWANA_SVN_REVISION, and QWANA_SVN_URL.

Referenced by QwRunCondition().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwRunCondition::SetName ( const TString  name)
private

Definition at line 148 of file QwRunCondition.cc.

References fRunConditionList.

Referenced by QwRunCondition().

149 {
150  fRunConditionList->SetName(name);
151  return;
152 }
TList * fRunConditionList

+ Here is the caller graph for this function:

void QwRunCondition::SetROCFlagsFileName ( const TString  in)
inline

Definition at line 32 of file QwRunCondition.h.

References fROCFlagFileName, and Qw::in.

32 {fROCFlagFileName = in;};
static const double in
Definition: QwUnits.h:66
TString fROCFlagFileName

Field Documentation

const Int_t QwRunCondition::fCharLength = 127
staticprivate

Definition at line 47 of file QwRunCondition.h.

Referenced by SetArgs().

TString QwRunCondition::fROCFlagFileName
private

Definition at line 46 of file QwRunCondition.h.

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

TList* QwRunCondition::fRunConditionList
private

Definition at line 44 of file QwRunCondition.h.

Referenced by Add(), Get(), GetName(), QwRunCondition(), SetName(), and ~QwRunCondition().


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