FEDRA emulsion software from the OPERA Collaboration
emcheck.cpp File Reference
#include <string.h>
#include <iostream>
#include <TRint.h>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbScanProc.h"
Include dependency graph for emcheck.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[] 
)
36{
37 if (argc < 2) { print_help_message(); return 0; }
38
39 TEnv cenv("checkenv");
41 gEDBDEBUGLEVEL = cenv.GetValue("emcheck.EdbDebugLevel" , 1);
42 const char *env = cenv.GetValue("emcheck.env" , "check.rootrc");
43 const char *outdir = cenv.GetValue("emcheck.outdir" , "..");
44
45 bool do_id = false;
46 bool do_set = false;
47 bool do_raw = false;
48 EdbID id;
49
50 for(int i=1; i<argc; i++ ) {
51 char *key = argv[i];
52
53 if (!strncmp(key,"-id=",4))
54 {
55 if(strlen(key)>3) if(id.Set(key+4)) do_id=true;
56 }
57 else if(!strncmp(key,"-set=",5))
58 {
59 if(strlen(key)>5) if(id.Set(key+5)) do_set=true;
60 }
61 else if(!strncmp(key,"-raw",4))
62 {
63 do_raw=true;
64 }
65 else if(!strncmp(key,"-v=",3))
66 {
67 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
68 }
69 }
70
71 if(!(do_id||do_set)) { print_help_message(); return 0; }
72
73 cenv.SetValue("emcheck.env" , env);
74 cenv.ReadFile( cenv.GetValue("emcheck.env" , "check.rootrc") ,kEnvLocal);
75 cenv.SetValue("emcheck.outdir" , outdir);
76
78 sproc.eProcDirClient = cenv.GetValue("emcheck.outdir","..");
79
80 if(do_id) {
81 printf("\n----------------------------------------------------------------------------\n");
82 printf("check ID %s\n", id.AsString() );
83 printf("----------------------------------------------------------------------------\n\n");
84
86 }
87 else if(do_set) {
88 printf("\n----------------------------------------------------------------------------\n");
89 printf("check set %s\n", id.AsString() );
90 printf("----------------------------------------------------------------------------\n\n");
91 cenv.WriteFile("check.save.rootrc");
92
94 }
95
96 cenv.WriteFile("check.save.rootrc");
97 return 1;
98}
Definition: EdbID.h:7
scanned data processing
Definition: EdbScanProc.h:12
void CheckRunQualityRaw(EdbID idss)
Definition: EdbScanProc.h:174
void CheckSetQualityRaw(EdbID idss)
Definition: EdbScanProc.cxx:518
TString eProcDirClient
directory path for root data
Definition: EdbScanProc.h:14
EdbScanProc * sproc
Definition: comptonmap.cpp:29
void set_default(TEnv &cenv)
Definition: emcheck.cpp:27
void print_help_message()
Definition: emcheck.cpp:12
TEnv cenv("emrec")
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
UInt_t id
Definition: tlg2couples.C:117

◆ print_help_message()

void print_help_message ( )
13{
14 cout<< "\nUsage: \n\t emcheck -id=ID [-o=DATA_DIRECTORY -v=DEBUG -raw] \n";
15 cout<< "\t emcheck -set=ID [-o=DATA_DIRECTORY -v=DEBUG ] \n\n";
16 cout<< "\t\t ID - id of the run(set) BRICK.PLATE.MAJOR.MINOR \n";
17 cout<< "\t\t DEBUG - verbosity level: 0-print nothing, 1-errors only, 2-normal, 3-print all messages\n";
18 cout<< "\nExample: \n";
19 cout<< "\t emcheck -set=4554.0.1.1 -o=/scratch/BRICKS -raw -v=2\n";
20 cout<< "\n If the data location directory if not explicitly defined\n";
21 cout<< " the current directory will be assumed to be the brick directory \n";
22 cout<< "\n If the parameters file (check.rootrc) is not presented - the default \n";
23 cout<< " parameters will be used. After the execution them are saved into check.save.rootrc file\n";
24 cout<<endl;
25}

◆ set_default()

void set_default ( TEnv &  cenv)
28{
29 // default parameters for the new checkment
30 cenv.SetValue("emcheck.outdir" , ".." );
31 cenv.SetValue("emcheck.env" , "check.rootrc");
32 cenv.SetValue("emcheck.EdbDebugLevel" , 1 );
33}