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

Functions

int main (int argc, char *argv[])
 
void print_help_message ()
 
void set_default (TEnv &cenv)
 
void ViewAlPlate (const char *fin, const char *fout, TEnv &env)
 
void ViewAlPlate (const EdbID id, TEnv &cenv)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
42{
43 if (argc < 2) { print_help_message(); return 0; }
44
45 TEnv cenv("viewalenv");
47 gEDBDEBUGLEVEL = cenv.GetValue("viewal.EdbDebugLevel" , 1);
48 const char *env = cenv.GetValue("viewal.env" , "viewal.rootrc");
49 const char *outdir = cenv.GetValue("viewal.outdir" , "..");
50
51 bool do_single = false;
52 bool do_set = false;
53 EdbID id;
54
55 for(int i=1; i<argc; i++ ) {
56 char *key = argv[i];
57
58 if(!strncmp(key,"-id=",4))
59 {
60 if(strlen(key)>4) if(id.Set(key+4)) do_single=true;
61 }
62 else if(!strncmp(key,"-set=",5))
63 {
64 if(strlen(key)>5) if(id.Set(key+5)) do_set=true;
65 }
66 else if(!strncmp(key,"-alg=",5))
67 {
68 if(strlen(key)>5) cenv.SetValue("fedra.viewal.algorithm" , atoi(key+5) );
69 }
70 else if(!strncmp(key,"-v=",3))
71 {
72 if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
73 }
74 }
75
76 if(!(do_single||do_set)) { print_help_message(); return 0; }
77 if( do_single&&do_set ) { print_help_message(); return 0; }
78
79 cenv.SetValue("viewal.env" , env);
80 cenv.ReadFile( cenv.GetValue("viewal.env" , "viewal.rootrc") ,kEnvLocal);
81 cenv.SetValue("viewal.outdir" , outdir);
82
83 if(do_single)
84 {
85 ViewAlPlate(id, cenv);
86 }
87
88 cenv.WriteFile("viewal.save.rootrc");
89 return 1;
90}
Definition: EdbID.h:7
TEnv cenv("emrec")
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
void set_default(TEnv &cenv)
Definition: emviewal.cpp:31
void ViewAlPlate(const EdbID id, TEnv &cenv)
Definition: emviewal.cpp:93
void print_help_message()
Definition: emviewal.cpp:17
gEDBDEBUGLEVEL
Definition: energy.C:7
UInt_t id
Definition: tlg2couples.C:117

◆ print_help_message()

void print_help_message ( )
18{
19 cout<< "\nCalculate view coordinate corrections using View-to-View alignment information calculated by LASSO. \nStore the result in the id.va.root files by default. The corrections applied by emlink if AFID=3\n\n";
20 cout<< "\nUsage: \n";
21 cout<< "\t emviewal -id=ID [-alg=ALG -v=DEBUG] \n";
22 cout<< "\t emviewal -set=IDSET [-alg=ALG -v=DEBUG] \n";
23
24 cout<< "\n If the data location directory is not explicitly defined\n";
25 cout<< " the current directory assumed to be the brick directory \n";
26 cout<< "\n If the parameters file (viewal.rootrc) is not present - the default \n";
27 cout<< " ones are used. After the execution the used parameters saved into viewal.save.rootrc file\n";
28 cout<<endl;
29}

◆ set_default()

void set_default ( TEnv &  cenv)
32{
33 // default parameters
34 cenv.SetValue("fedra.viewal.algorithm" , 0);
35 cenv.SetValue("fedra.viewal.cut" , "1");
36 cenv.SetValue("viewal.outdir" , ".." );
37 cenv.SetValue("viewal.env" , "viewal.rootrc");
38 cenv.SetValue("viewal.EdbDebugLevel" , 1 );
39}

◆ ViewAlPlate() [1/2]

void ViewAlPlate ( const char *  fin,
const char *  fout,
TEnv &  env 
)
103{
104 int algorithm = cenv.GetValue("fedra.viewal.algorithm" , 0);
105 TCut cut("cut", cenv.GetValue("fedra.viewal.cut" , "1") );
106
107 Log(2,"\nViewAlPlate","with alg=%d, cut=%s %s -> %s\n", algorithm, cut.GetTitle(),fin,fout );
108
109 EdbViewMap vm;
110 vm.ReadViewsHeaders(fin, cut); // read headers from runfile, fill eViewHeaders
111 vm.ReadPinViewsHeaders(fin); // read headers from runfile, fill ePinViewHeaders
112 vm.ReadViewAlign(fin); // read ViewAlign from runfile, fill eALcp
113 vm.eAlgorithm=algorithm;
114
115 if(algorithm==2) {
116 vm.MakeAHTnocorr(); // create tree with alignment parameters and views headers
117 vm.SaveLinesCorrToRun(fin); // correct hysteresis only
118 }
119 else if(algorithm==3) {
120 vm.MakeAHTnocorr(); // create tree with alignment parameters and views headers
121 vm.SaveColsCorrToRun(fin); // correct hysteresis only (colomns)
122 }
123 else {
124 vm.AddInverseAlign();
125
126 vm.InitAR(); // init eAR structure
127 vm.FillAR(); // fill eAR structure (assumed that view entry==h.GetViewID())
129
130 vm.FillALcp(); //fill neighbouring
131 //vm.CheckView(0,0,225);
132 //vm.CheckView(0,0,112);
133
134 vm.DoCorrection();
135 vm.CorrectToStage();
136 //vm.ConvertRun(fin,fout);
137 vm.SaveCorrToRun(fin);
138 }
139}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
views map
Definition: EdbViewMap.h:71
void MakeAHTnocorr()
Definition: EdbViewMap.cxx:653
Int_t eAlgorithm
algorithm used for correction: 0-bestNeigbour, 1-allNeigbours, 2,3 - hysteresis corr
Definition: EdbViewMap.h:87
void DoCorrection()
Definition: EdbViewMap.cxx:502
void ReadViewsHeaders(const char *file, TCut &cut)
Definition: EdbViewMap.cxx:132
void FillALcp()
Definition: EdbViewMap.cxx:266
void CorrectToStage()
Definition: EdbViewMap.cxx:510
void SaveCorrToRun(const char *fin)
Definition: EdbViewMap.cxx:579
void CheckViewFrameAlignQuality(const char *file)
Definition: EdbViewMap.cxx:223
void ReadPinViewsHeaders(const char *file)
Definition: EdbViewMap.cxx:154
void InitAR()
Definition: EdbViewMap.cxx:45
void SaveLinesCorrToRun(const char *fin)
Definition: EdbViewMap.cxx:744
void AddInverseAlign()
Definition: EdbViewMap.cxx:203
void SaveColsCorrToRun(const char *fin)
Definition: EdbViewMap.cxx:803
void FillAR()
Definition: EdbViewMap.cxx:92
void ReadViewAlign(const char *file)
Definition: EdbViewMap.cxx:183
TCut cut
Definition: check_shower.C:6

◆ ViewAlPlate() [2/2]

void ViewAlPlate ( const EdbID  id,
TEnv &  cenv 
)
94{
95 EdbScanProc proc; proc.eProcDirClient=cenv.GetValue("viewal.outdir" , "..");
96 TString rfile; proc.MakeFileName(rfile,id,"raw.root");
97 TString vafile; proc.MakeFileName(vafile,id,"va.root");
98 ViewAlPlate( rfile.Data(), vafile.Data(), cenv);
99}
scanned data processing
Definition: EdbScanProc.h:12
EdbDataProc * proc
Definition: read_pvr.C:3