Functions | Variables
getXYZCalibProtoDUNE.cc File Reference
#include "dunecalib/Calib/XYZCalibProtoDUNE.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 = "mc"
 
std::string gXCorrFile = ""
 
std::string gYZCorrFile = ""
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 82 of file getXYZCalibProtoDUNE.cc.

83 {
84  if (!ParseCLArgs(argc,argv)) {
85  PrintUsage();
86  return 1;
87  }
88 
90 
91  xyzCalib->SetIsMC((gDataType == "mc"));
92  xyzCalib->SetUseCondb(true);
93  if (! gXCorrFile.empty())
94  xyzCalib->SetXCorrFileName(gXCorrFile);
95  if (! gYZCorrFile.empty())
96  xyzCalib->SetYZCorrFileName(gYZCorrFile);
97 
98  xyzCalib->Update(gRun);
99 
100  for (int ip=0; ip<3; ++ip) {
101  std::cout << "Norm correction for plane " << ip << " = "
102  << xyzCalib->GetNormCorr(ip) << std::endl;
103  for (double x=-300.; x<=300.; x+=50.)
104  std::cout << "xCorr(" << x << ") = " << xyzCalib->GetXCorr(ip,x) << std::endl;
105 
106  for (double y=50.; y<=600.; y+= 100.)
107  for (double z=50.; z<=600.; z+= 100.)
108  std::cout << "yzCorr(0," << y << "," << z << ") = "
109  << xyzCalib->GetYZCorr(ip,0,y,z) << std::endl;
110  }
111 
112  delete xyzCalib;
113 
114  return 0;
115 }
bool Update(uint64_t ts=0)
virtual double GetNormCorr(int plane) override
std::string gXCorrFile
bool ParseCLArgs(int argc, char *argv[])
void PrintUsage()
void SetYZCorrFileName(std::string f)
int gRun
virtual double GetYZCorr(int plane, int side, double y, double z) override
std::string gYZCorrFile
void SetXCorrFileName(std::string f)
list x
Definition: train.py:276
virtual double GetXCorr(int plane, double x) override
QTextStream & endl(QTextStream &s)
std::string gDataType
bool ParseCLArgs ( int  argc,
char *  argv[] 
)

Definition at line 21 of file getXYZCalibProtoDUNE.cc.

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

Definition at line 14 of file getXYZCalibProtoDUNE.cc.

15 {
16  std::cout << "Usage: getXYZCalibProtoDUNE -r|--run [run number] -d|--datatype [data|mc] -x|--xcorr [xcorr csv file] -y|--yzcorr [yzcorr csv file]" << std::endl;
17 }
QTextStream & endl(QTextStream &s)

Variable Documentation

std::string gDataType = "mc"

Definition at line 8 of file getXYZCalibProtoDUNE.cc.

int gRun = -1

Definition at line 7 of file getXYZCalibProtoDUNE.cc.

std::string gXCorrFile = ""

Definition at line 9 of file getXYZCalibProtoDUNE.cc.

std::string gYZCorrFile = ""

Definition at line 10 of file getXYZCalibProtoDUNE.cc.