FEDRA emulsion software from the OPERA Collaboration
viewdist.cpp File Reference
#include <string.h>
#include <iostream>
#include <TRint.h>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbRun.h"
#include "EdbDistortion.h"
Include dependency graph for viewdist.cpp:

Functions

int main (int argc, char *argv[])
 
void print_help_message ()
 
void set_default (TEnv &cenv)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
40 {
41  if (argc < 2) { print_help_message(); return 0; }
42 
43  TEnv cenv("viewenv");
44 
46  gEDBDEBUGLEVEL = cenv.GetValue("viewdist.EdbDebugLevel" , 1);
47  const char *env = cenv.GetValue("viewdist.env" , "viewdist.rootrc");
48 
49  const char *addfile=0;
50  const char *usefile=0;
51  const char *fname=0;
52  for(int i=1; i<argc; i++ ) {
53  char *key = argv[i];
54 
55  if (!strncmp(key,"-f=",3))
56  {
57  if(strlen(key)>3) fname = key+3;
58  }
59  else if(!strncmp(key,"-v=",3))
60  {
61  if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
62  }
63  else if(!strncmp(key,"-add=",5))
64  {
65  if(strlen(key)>5) addfile = key+5;
66  }
67  else if(!strncmp(key,"-use=",5))
68  {
69  if(strlen(key)>5) usefile = key+5;
70  }
71  }
72 
73  if(!fname) { print_help_message(); return 0; }
74 
75  cenv.SetValue("viewdist.env" , env);
76  cenv.ReadFile( cenv.GetValue("viewdist.env" , "viewdist.rootrc") ,kEnvLocal);
77 
79  vm.MakeDistortionMap( fname, cenv, usefile, addfile );
80 
81  cenv.WriteFile("viewdist.save.rootrc");
82  return 1;
83 }
Definition: EdbDistortion.h:79
void MakeDistortionMap(const char *fname, TEnv &env, const char *usefile=0, const char *addfile=0)
Definition: EdbDistortion.cxx:323
TEnv cenv("emrec")
gEDBDEBUGLEVEL
Definition: energy.C:7
const char * fname
Definition: mc2raw.cxx:41
void set_default(TEnv &cenv)
Definition: viewdist.cpp:24
void print_help_message()
Definition: viewdist.cpp:13

◆ print_help_message()

void print_help_message ( )
14 {
15  cout<< "\nUsage: \n\t viewdist -f=FILE [-v=DEBUG -use=primary_correction.txt] \n";
16  cout<< "\t\t DEBUG - verbosity level: 0-print nothing, 1-errors only, 2-normal, 3-print all messages\n";
17  cout<< "\nExample: \n";
18  cout<< "\t viewdist -f=one_layer.root -v=2\n";
19  cout<< "\n If the parameters file (viewdist.rootrc) is not presented - the default \n";
20  cout<< " parameters will be used. After the execution them are saved into viewdist.save.rootrc file\n";
21  cout<<endl;
22 }

◆ set_default()

void set_default ( TEnv &  cenv)
25 {
26  // default parameters for the new alignment
27  cenv.SetValue("viewdist.env" , "viewdist.rootrc");
28  cenv.SetValue("viewdist.EdbDebugLevel" , 1 );
29  cenv.SetValue("viewdist.DumpGr" , 0 );
30  cenv.SetValue("viewdist.NClMin" , 20);
31  cenv.SetValue("viewdist.R2CenterMax" , 15.);
32  cenv.SetValue("viewdist.Rmax" , 1.);
33  cenv.SetValue("viewdist.Xpix" , 0.30625);
34  cenv.SetValue("viewdist.Ypix" , 0.30714);
35  cenv.SetValue("viewdist.NXpix", 1280);
36  cenv.SetValue("viewdist.NYpix", 1024);
37 }