Functions | Variables
RunInfoDUNE.cc File Reference
#include "dune/RunHistory/RunHistoryDUNE.h"
#include "nuevdb/IFDatabase/Table.h"
#include <getopt.h>
#include <iostream>

Go to the source code of this file.

Functions

void PrintUsage ()
 
bool ParseCLArgs (int argc, char *argv[])
 
int main (int argc, char **argv)
 

Variables

int gRun = -1
 
std::string gDetStr = ""
 
int gDetId = dune::RunHistoryDUNE::kUnknownDet
 
bool gDumpSCData = false
 
bool gDumpASICSettings = false
 
bool gPrintComponents = false
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 98 of file RunInfoDUNE.cc.

99 {
100  if (!ParseCLArgs(argc,argv)) {
101  PrintUsage();
102  return 1;
103  }
104 
106 
107  std::cout << "Run " << rh->RunNumber() << ":" << std::endl;
108  std::cout << "Cfg: " << rh->CfgLabel() << std::endl;
109 
110  std::cout << "RunType: " << rh->RunTypeAsString() << std::endl;
111  std::cout << "Start time: " << rh->TStartAsString() << std::endl;
112  std::cout << "Stop time: " << rh->TStopAsString() << std::endl;
113  std::cout << "Duration: ";
114  int duration = rh->Duration();
115  int hours = duration/3600;
116  int minutes = (duration-3600*hours)/60;
117  int seconds = (duration-3600*hours-60*minutes);
118  std::cout << hours << " hours, " << minutes << " minutes, " << seconds << " seconds" << std::endl;
119 
120  if (gPrintComponents) {
121  std::cout << "Components: ";
122  std::vector<std::string> comp = rh->Components();
123  std::cout << comp[0];
124  for (size_t i=1; i<comp.size(); ++i)
125  std::cout << ", " << comp[i];
126  std::cout << std::endl;
127  }
128 
129  if (gDumpSCData) {
130  rh->DumpSCData();
131  }
132 
133  if (gDumpASICSettings) {
134  rh->DumpASICSettings();
135  }
136 
137  delete rh;
138 
139  return 0;
140 }
std::string TStopAsString() const
virtual uint64_t Duration() const override
std::string TStartAsString() const
comp
Definition: dbjson.py:31
bool gDumpASICSettings
Definition: RunInfoDUNE.cc:11
int gRun
Definition: RunInfoDUNE.cc:7
second seconds
Alias for common language habits.
Definition: spacetime.h:83
int gDetId
Definition: RunInfoDUNE.cc:9
virtual int RunNumber() const override
std::vector< std::string > Components()
virtual std::string RunTypeAsString() const override
std::string CfgLabel() const
bool gDumpSCData
Definition: RunInfoDUNE.cc:10
bool gPrintComponents
Definition: RunInfoDUNE.cc:12
bool ParseCLArgs(int argc, char *argv[])
Definition: RunInfoDUNE.cc:27
QTextStream & endl(QTextStream &s)
void PrintUsage()
Definition: RunInfoDUNE.cc:16
bool ParseCLArgs ( int  argc,
char *  argv[] 
)

Definition at line 27 of file RunInfoDUNE.cc.

28 {
29 
30  struct option long_options[] = {
31  {"help", 0, 0, 'h'},
32  {"run", 0, 0, 'r'},
33  {"detector", 0, 0, 'd'},
34  {"dumpSCData", 0, 0, 'S'},
35  {"dumpASICSettings", 0, 0, 'A'},
36  {"components", 0, 0, 'C'},
37  {0,0,0,0}
38  };
39 
40  while (1) {
41  int optindx;
42 
43  int c = getopt_long(argc,argv,"r:d:hSCA",long_options,&optindx);
44 
45  if (c==-1) break;
46 
47  switch(c) {
48  case 'r':
49  {
50  int run = atoi(optarg);
51  if (run < 0) {
52  std::cout << "Invalid run number." << std::endl;
53  exit(0);
54  }
55  gRun = run;
56  break;
57  }
58  case 'd':
59  {
60  gDetStr = optarg;
61  break;
62  }
63  case 'h':
64  {
65  PrintUsage();
66  exit(0);
67  break;
68  }
69  case 'S':
70  {
71  gDumpSCData = true;
72  break;
73  }
74  case 'A':
75  {
76  gDumpASICSettings = true;
77  break;
78  }
79  case 'C':
80  {
81  gPrintComponents = true;
82  break;
83  }
84  default:
85  break;
86  }
87  }
88 
91  return false;
92 
93  return true;
94 }
static int DetNameToId(std::string detStr)
bool gDumpASICSettings
Definition: RunInfoDUNE.cc:11
int gRun
Definition: RunInfoDUNE.cc:7
int gDetId
Definition: RunInfoDUNE.cc:9
bool gDumpSCData
Definition: RunInfoDUNE.cc:10
bool gPrintComponents
Definition: RunInfoDUNE.cc:12
QTextStream & endl(QTextStream &s)
std::string gDetStr
Definition: RunInfoDUNE.cc:8
unsigned int run
void PrintUsage()
Definition: RunInfoDUNE.cc:16
void PrintUsage ( )

Definition at line 16 of file RunInfoDUNE.cc.

17 {
18  std::cout << "Usage: RunInfo -d|--detector [detectorName, eg dune35t] -r|--run [run number] [options]" << std::endl;
19  std::cout << "Options:" << std::endl;
20  std::cout << "-S (--dumpSCData): dump slow controls data from database" << std::endl;
21  std::cout << "-A (--dumpASICSettings): dump ASIC settings from database" << std::endl;
22  std::cout << "-C (--components): print DAQ components" << std::endl;
23 }
QTextStream & endl(QTextStream &s)

Variable Documentation

Definition at line 9 of file RunInfoDUNE.cc.

std::string gDetStr = ""

Definition at line 8 of file RunInfoDUNE.cc.

bool gDumpASICSettings = false

Definition at line 11 of file RunInfoDUNE.cc.

bool gDumpSCData = false

Definition at line 10 of file RunInfoDUNE.cc.

bool gPrintComponents = false

Definition at line 12 of file RunInfoDUNE.cc.

int gRun = -1

Definition at line 7 of file RunInfoDUNE.cc.