Functions | Variables
getLinConstsProtoDUNE.cc File Reference
#include "dunecalib/Calib/LinCalibProtoDUNE.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 gDataType = "data"
 
std::string gCSVFile = ""
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 78 of file getLinConstsProtoDUNE.cc.

79 {
80  if (!ParseCLArgs(argc,argv)) {
81  PrintUsage();
82  return 1;
83  }
84 
86 
87  linCalib->SetIsMC((gDataType == "mc"));
88  linCalib->SetUseCondb(true);
89  if (! gCSVFile.empty())
90  linCalib->SetCSVFileName(gCSVFile);
91 
92  linCalib->Update(gRun);
93 
94  calib::LinConsts_t lc = linCalib->GetLinConsts(100);
95  std::cout << "Linearity constants correction for channel 100:"
96  << std::endl;
97  std::cout << "\tGain = " << lc.gain
98  << "\n\tOffset = " << lc.offset << std::endl;
99 
100  delete linCalib;
101 
102  return 0;
103 }
int gRun
std::string gCSVFile
void PrintUsage()
bool Update(uint64_t ts=0)
std::string gDataType
LinConsts_t GetLinConsts(int chanId)
void SetCSVFileName(std::string f)
bool ParseCLArgs(int argc, char *argv[])
QTextStream & endl(QTextStream &s)
bool ParseCLArgs ( int  argc,
char *  argv[] 
)

Definition at line 20 of file getLinConstsProtoDUNE.cc.

21 {
22 
23  struct option long_options[] = {
24  {"help", 0, 0, 'h'},
25  {"run", 0, 0, 'r'},
26  {"datatype", 0, 0, 'd'},
27  {"file", 0, 0, 'f'},
28  {0,0,0,0}
29  };
30 
31  while (1) {
32  int optindx;
33 
34  int c = getopt_long(argc,argv,"hr:d:f:",long_options,&optindx);
35 
36  if (c==-1) break;
37 
38  switch(c) {
39  case 'r':
40  {
41  int run = atoi(optarg);
42  if (run < 0) {
43  std::cout << "Invalid run number." << std::endl;
44  exit(0);
45  }
46  gRun = run;
47  break;
48  }
49  case 'd':
50  {
51  gDataType = optarg;
52  break;
53  }
54  case 'f':
55  {
56  gCSVFile = optarg;
57  break;
58  }
59  case 'h':
60  default:
61  {
62  return false;
63  }
64  }
65  }
66 
67  if (gRun<0)
68  return false;
69 
70  if ( gDataType != "mc" && gDataType != "data")
71  return false;
72 
73  return true;
74 }
int gRun
std::string gCSVFile
std::string gDataType
QTextStream & endl(QTextStream &s)
void PrintUsage ( )

Definition at line 13 of file getLinConstsProtoDUNE.cc.

14 {
15  std::cout << "Usage: getLinConstsProtoDUNE -r|--run [run number] -d|--datatype [data|mc] -f|--file [csv file] " << std::endl;
16 }
QTextStream & endl(QTextStream &s)

Variable Documentation

std::string gCSVFile = ""

Definition at line 9 of file getLinConstsProtoDUNE.cc.

std::string gDataType = "data"

Definition at line 8 of file getLinConstsProtoDUNE.cc.

int gRun = -1

Definition at line 7 of file getLinConstsProtoDUNE.cc.