FEDRA emulsion software from the OPERA Collaboration
viewsideal.cpp File Reference
#include <string.h>
#include <iostream>
#include <TRint.h>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbRunAccess.h"
#include "EdbLinking.h"
#include "EdbScanProc.h"
#include "EdbPlateAlignment.h"
#include "EdbMosaic.h"
#include "EdbMosaicIO.h"
Include dependency graph for viewsideal.cpp:

Functions

int main (int argc, char *argv[])
 
void MosaicAlID (EdbID id, const TEnv &cenv)
 
void MosaicAlSet (EdbScanSet &ss, const TEnv &cenv)
 
void print_help_message ()
 
void set_default (TEnv &cenv)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
72 {
73  if (argc < 2) { print_help_message(); return 0; }
74 
75  TEnv cenv("viewsidealenv");
77  gEDBDEBUGLEVEL = cenv.GetValue("viewsideal.EdbDebugLevel" , 1);
78  const char *env = cenv.GetValue("viewsideal.env" , "viewsideal.rootrc");
79  const char *outdir = cenv.GetValue("viewsideal.outdir" , "..");
80 
81  bool do_single = false;
82  bool do_set = false;
83  EdbID id;
84 
85  for(int i=1; i<argc; i++ ) {
86  char *key = argv[i];
87 
88  if(!strncmp(key,"-set=",5))
89  {
90  if(strlen(key)>5) if(id.Set(key+5)) do_set=true;
91  }
92  else if(!strncmp(key,"-id=",4))
93  {
94  if(strlen(key)>4) if(id.Set(key+4)) do_single=true;
95  }
96  else if(!strncmp(key,"-v=",3))
97  {
98  if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
99  }
100  }
101 
102  if(!(do_single||do_set)) { print_help_message(); return 0; }
103  if( do_single&&do_set ) { print_help_message(); return 0; }
104 
105  cenv.SetValue("viewsideal.env" , env);
106  cenv.ReadFile( cenv.GetValue("viewsideal.env" , "viewsideal.rootrc") ,kEnvLocal);
107  cenv.SetValue("viewsideal.outdir" , outdir);
108 
110  sproc.eProcDirClient = cenv.GetValue("viewsideal.outdir","..");
111  cenv.WriteFile("viewsideal.save.rootrc");
112 
113  printf("\n----------------------------------------------------------------------------\n");
114  printf("viewsideal %s\n" ,id.AsString() );
115  printf( "----------------------------------------------------------------------------\n\n");
116  printf("fedra.vsa.ImageCorrSide1: %s\n", cenv.GetValue("fedra.vsa.ImageCorrSide1","") );
117  printf("fedra.vsa.ImageCorrSide2: %s\n", cenv.GetValue("fedra.vsa.ImageCorrSide2","") );
118 
119  if(do_single)
120  {
121  MosaicAlID(id, cenv);
122  }
123  if(do_set)
124  {
125  printf("\n----------------------------------------------------------------------------\n");
126  printf("viewsideal set with id= %s\n", id.AsString() );
127  printf("----------------------------------------------------------------------------\n\n");
128 
130  if(ss)
131  {
132  MosaicAlSet(*ss,cenv);
133  }
134  }
135  cenv.WriteFile("viewsideal.save.rootrc");
136  return 1;
137 }
Definition: EdbID.h:7
Definition: EdbScanProc.h:12
TString eProcDirClient
Definition: EdbScanProc.h:14
EdbScanSet * ReadScanSet(EdbID id)
Definition: EdbScanProc.cxx:1521
Definition: EdbScanSet.h:11
EdbScanProc * sproc
Definition: comptonmap.cpp:29
TEnv cenv("emrec")
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
gEDBDEBUGLEVEL
Definition: energy.C:7
ss
Definition: energy.C:62
UInt_t id
Definition: tlg2pattern.C:118
void set_default(TEnv &cenv)
Definition: viewsideal.cpp:35
void print_help_message()
Definition: viewsideal.cpp:21
void MosaicAlSet(EdbScanSet &ss, const TEnv &cenv)
Definition: viewsideal.cpp:148
void MosaicAlID(EdbID id, const TEnv &cenv)
Definition: viewsideal.cpp:141

◆ MosaicAlID()

void MosaicAlID ( EdbID  id,
const TEnv &  cenv 
)
142 {
143  EdbMosaicAl mal;
144  mal.ProcRun( id, cenv );
145 }
Definition: EdbMosaic.h:22
void ProcRun(EdbID id, const TEnv &cenv)
Definition: EdbMosaic.cxx:58

◆ MosaicAlSet()

void MosaicAlSet ( EdbScanSet ss,
const TEnv &  cenv 
)
149 {
150  if(sc.eIDS.GetSize()<1) return;
151  for(int i=0; i<sc.eIDS.GetSize(); i++) {
152  EdbID *id = (EdbID *)(sc.eIDS.At(i)); if(!id) continue;
153  //EdbPlateP *plate = sc.GetPlate(id->ePlate); if(!plate) continue;
154  EdbMosaicAl mal;
155  mal.ProcRun( *id, cenv );
156  }
157 }

◆ print_help_message()

void print_help_message ( )
22 {
23  cout<< "\nUsage: \n";
24  cout<< "\t viewsideal -id=ID [-v=DEBUG] \n";
25 
26  cout<< "\t\t ID - id of the raw.root file formed as BRICK.PLATE.MAJOR.MINOR \n";
27 
28  cout<< "\n If the data location directory if not explicitly defined\n";
29  cout<< " the current directory will be assumed to be the brick directory \n";
30  cout<< "\n If the parameters file (viewsideal.rootrc) is not presented - the default \n";
31  cout<< " parameters will be used. After the execution them are saved into viewsideal.save.rootrc file\n";
32  cout<<endl;
33 }

◆ set_default()

void set_default ( TEnv &  cenv)
36 {
37  // default parameters for views side alignment (vsa)
38 
39  cenv.SetValue("fedra.vsa.DoImageCorr" , 0 );
40  cenv.SetValue("fedra.vsa.ImageCorrSide1" , "1 0 0 1 0 0");
41  cenv.SetValue("fedra.vsa.ImageCorrSide2" , "1 0 0 1 0 0");
42  cenv.SetValue("fedra.vsa.DoImageMatrixCorr" , 0 );
43  cenv.SetValue("fedra.vsa.ImageMatrixCorrSide1" , "");
44  cenv.SetValue("fedra.vsa.ImageMatrixCorrSide2" , "");
45  cenv.SetValue("fedra.vsa.hxy" , "2000 0. 200000. 2000 0. 200000.");
46  cenv.SetValue("fedra.vsa.offsetMax" , 10. );
47  cenv.SetValue("fedra.vsa.DZ" , 0. );
48  cenv.SetValue("fedra.vsa.DPHI" , 0. );
49  cenv.SetValue("fedra.vsa.Yfrag" , 5000 );
50  cenv.SetValue("fedra.vsa.AFID" , 1 );
51  cenv.SetValue("fedra.vsa.Xfrag" , 10000 );
52  cenv.SetValue("fedra.vsa.Yfrag" , 10000 );
53  cenv.SetValue("fedra.vsa.MinPeak" , 25 );
54  cenv.SetValue("fedra.vsa.R0" , 1200.);
55  cenv.SetValue("fedra.vsa.HeaderCut" , "1" );
56  cenv.SetValue("fedra.vsa.sigmaR" , 0.5 );
57  cenv.SetValue("fedra.vsa.sigmaT" , 0.005 );
58  cenv.SetValue("fedra.vsa.ICUT" , "-1 -500. 500. -500. 500. -1. 1. -1. 1. 8. 50.");
59  cenv.SetValue("fedra.vsa.XCUT" , "-1 -300. 300. -200. 200. -1. 1. -1. 1. 0. 0.");
60  cenv.SetValue("fedra.vsa.ScoreCUT" , "-1.5 1.5");
61  cenv.SetValue("fedra.vsa.DoFine" , 1 );
62  cenv.SetValue("fedra.vsa.SaveCouples" , 1 );
63  cenv.SetValue("fedra.vsa.DoSaveAlignments" , 0 );
64  cenv.SetValue("fedra.vsa.NoAlign" , 0 );
65 
66  cenv.SetValue("viewsideal.outdir" , ".." );
67  cenv.SetValue("viewsideal.env" , "viewsideal.rootrc");
68  cenv.SetValue("viewsideal.EdbDebugLevel" , 1 );
69 }